A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix sqlite fts5
Ammar Ahmed171628c7b99f
diff --git a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxprojindex 440a1a89e..5429723ac 100644--- a/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj+++ b/apps/mobile/native/ios/Notesnook.xcodeproj/project.pbxproj@@ -20,6 +20,10 @@6517B7C12B6838EB0079FF37 /* OpenSans-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BE2B6838EB0079FF37 /* OpenSans-Regular.ttf */; };6517B7C22B6838EB0079FF37 /* OpenSans-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7BF2B6838EB0079FF37 /* OpenSans-SemiBold.ttf */; };6517B7C32B6838EB0079FF37 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };+ 651F09DA2E0D262B00495DED /* fts5-html.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 651F09D92E0D262B00495DED /* fts5-html.xcframework */; };+ 651F09DB2E0D262B00495DED /* fts5-html.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 651F09D92E0D262B00495DED /* fts5-html.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };+ 651F09DD2E0D263300495DED /* fts5-html.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 651F09D92E0D262B00495DED /* fts5-html.xcframework */; };+ 651F09DE2E0D263300495DED /* fts5-html.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 651F09D92E0D262B00495DED /* fts5-html.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };6529A13E279BC4C70048D4A8 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6529A13D279BC4C70048D4A8 /* BootSplash.storyboard */; };656835812BB29A9800144BAB /* OpenSans-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 656835802BB29A8300144BAB /* OpenSans-Italic.ttf */; };6569927F2C5754F10041CD41 /* OpenSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */; };@@ -79,6 +83,28 @@/* End PBXContainerItemProxy section *//* Begin PBXCopyFilesBuildPhase section */+ 651F09DC2E0D262C00495DED /* Embed Frameworks */ = {+ isa = PBXCopyFilesBuildPhase;+ buildActionMask = 2147483647;+ dstPath = "";+ dstSubfolderSpec = 10;+ files = (+ 651F09DB2E0D262B00495DED /* fts5-html.xcframework in Embed Frameworks */,+ );+ name = "Embed Frameworks";+ runOnlyForDeploymentPostprocessing = 0;+ };+ 651F09DF2E0D263300495DED /* Embed Frameworks */ = {+ isa = PBXCopyFilesBuildPhase;+ buildActionMask = 2147483647;+ dstPath = "";+ dstSubfolderSpec = 10;+ files = (+ 651F09DE2E0D263300495DED /* fts5-html.xcframework in Embed Frameworks */,+ );+ name = "Embed Frameworks";+ runOnlyForDeploymentPostprocessing = 0;+ };65A7F34B255687E600699170 /* Embed App Extensions */ = {isa = PBXCopyFilesBuildPhase;buildActionMask = 2147483647;@@ -120,11 +146,11 @@6517B7BE2B6838EB0079FF37 /* OpenSans-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "OpenSans-Regular.ttf"; path = "../../../../packages/editor-mobile/public/fonts/OpenSans-Regular.ttf"; sourceTree = "<group>"; };6517B7BF2B6838EB0079FF37 /* OpenSans-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "OpenSans-SemiBold.ttf"; path = "../../../../packages/editor-mobile/public/fonts/OpenSans-SemiBold.ttf"; sourceTree = "<group>"; };6517B7C02B6838EB0079FF37 /* OpenSans-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "OpenSans-Bold.ttf"; path = "../../../../packages/editor-mobile/public/fonts/OpenSans-Bold.ttf"; sourceTree = "<group>"; };+ 651F09D92E0D262B00495DED /* fts5-html.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = "fts5-html.xcframework"; sourceTree = "<group>"; };6529A13D279BC4C70048D4A8 /* BootSplash.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = BootSplash.storyboard; path = Notesnook/BootSplash.storyboard; sourceTree = "<group>"; };6529D2B0257B4A2900B49BC3 /* NotesnookDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = NotesnookDebug.entitlements; path = Notesnook/NotesnookDebug.entitlements; sourceTree = "<group>"; };656835802BB29A8300144BAB /* OpenSans-Italic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "OpenSans-Italic.ttf"; path = "../../../../packages/editor-mobile/public/fonts/OpenSans-Italic.ttf"; sourceTree = "<group>"; };6593E4A2281C345400492C50 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = Notesnook/AppDelegate.mm; sourceTree = "<group>"; };- 6594DDF22CD8BFE8007F5EC2 /* BetterTrigram.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = BetterTrigram.xcframework; sourceTree = "<group>"; };659BE46625E11A5100E05671 /* notesnook-text.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "notesnook-text.png"; path = "Notesnook/Images.xcassets/notesnook-text.png"; sourceTree = "<group>"; };65A7F34F255689AD00699170 /* Notesnook.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Notesnook.entitlements; path = Notesnook/Notesnook.entitlements; sourceTree = "<group>"; };65AA857725E6DDEC00772A01 /* NotesWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotesWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };@@ -177,6 +203,7 @@files = (2B3F87EC6B2264CD8ABA5DA8 /* libPods-Notesnook.a in Frameworks */,6515C42F2580AA3000E83E39 /* StoreKit.framework in Frameworks */,+ 651F09DA2E0D262B00495DED /* fts5-html.xcframework in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;};@@ -209,6 +236,7 @@isa = PBXFrameworksBuildPhase;buildActionMask = 2147483647;files = (+ 651F09DD2E0D263300495DED /* fts5-html.xcframework in Frameworks */,C619D096A9DE2070DBEAC70F /* libPods-Make Note.a in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;@@ -256,7 +284,7 @@2D16E6871FA4F8E400B85C8A /* Frameworks */ = {isa = PBXGroup;children = (- 6594DDF22CD8BFE8007F5EC2 /* BetterTrigram.xcframework */,+ 651F09D92E0D262B00495DED /* fts5-html.xcframework */,6515C42E2580AA2F00E83E39 /* StoreKit.framework */,ED297162215061F000B7C4FE /* JavaScriptCore.framework */,ED2971642150620600B7C4FE /* JavaScriptCore.framework */,@@ -400,6 +428,7 @@240525450DF9ABA0F332B52E /* [CP] Copy Pods Resources */,65A7F34B255687E600699170 /* Embed App Extensions */,48C834D962D612F18A0388B3 /* [CP] Embed Pods Frameworks */,+ 651F09DC2E0D262C00495DED /* Embed Frameworks */,);buildRules = ();@@ -478,6 +507,7 @@65B5013E25A672B200E2D264 /* Resources */,658D06A625A7446E008C70C0 /* Run Script */,E81EC4451F76606456BCA61F /* [CP] Copy Pods Resources */,+ 651F09DF2E0D263300495DED /* Embed Frameworks */,);buildRules = ();@@ -1772,10 +1802,7 @@ONLY_ACTIVE_ARCH = YES;OTHER_CFLAGS = "$(inherited)";OTHER_CPLUSPLUSFLAGS = "$(inherited)";- OTHER_LDFLAGS = (- "$(inherited)",- " ",- );+ OTHER_LDFLAGS = "$(inherited) ";REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native";SDKROOT = iphoneos;SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";@@ -1840,10 +1867,7 @@ONLY_ACTIVE_ARCH = NO;OTHER_CFLAGS = "$(inherited)";OTHER_CPLUSPLUSFLAGS = "$(inherited)";- OTHER_LDFLAGS = (- "$(inherited)",- " ",- );+ OTHER_LDFLAGS = "$(inherited) ";REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native";SDKROOT = iphoneos;USE_HERMES = true;diff --git a/apps/mobile/native/ios/Podfile.lock b/apps/mobile/native/ios/Podfile.lockindex d751b127f..ce28b32e5 100644--- a/apps/mobile/native/ios/Podfile.lock+++ b/apps/mobile/native/ios/Podfile.lock@@ -1352,7 +1352,7 @@ PODS:- SDWebImage (~> 5.11.1)- react-native-share-extension (2.9.0):- React- - react-native-sodium (1.6.3):+ - react-native-sodium (1.6.4):- React- react-native-theme-switch-animation (0.6.0):- DoubleConversion@@ -2409,11 +2409,11 @@ SPEC CHECKSUMS:react-native-orientation-locker: cc6f357b289a2e0dd2210fea0c52cb8e0727fdaareact-native-pager-view: 5aaf51a9338f7997b8acee0e0febfddd1ade5c0areact-native-pdf: 6a51a22ccefb23eb93298771e4bf090913e86d70- react-native-quick-sqlite: 6aebe0e1c264c48450059e271e5d2404013cea93+ react-native-quick-sqlite: d09ab51a1111d7713a2f38fe7805e021a74fe877react-native-safe-area-context: 9d72abf6d8473da73033b597090a80b709c0b2f1react-native-screenguard: 82437eeb0086a90b5e5d7e54130bb04fb406373ereact-native-share-extension: bcb7e466390a9e50c742f4b1019d6f181aedd7ad- react-native-sodium: aa26d9f46dcfdebd92d3af793b74fbb234a4d75d+ react-native-sodium: 5b55f74705005612e12838ffd583927229a65e6areact-native-theme-switch-animation: d90fe2de0d9e87a63cd6235d98cba6e7054e9a10react-native-webview: 079eca50edf657503318b66687dadfb903731aa8React-nativeconfig: ecf4dc92c40b97e2b3f0c619938f78bfd6507b08diff --git a/apps/mobile/native/ios/fts5-html.xcframework/Info.plist b/apps/mobile/native/ios/fts5-html.xcframework/Info.plistnew file mode 100644index 000000000..1320d7b41--- /dev/null+++ b/apps/mobile/native/ios/fts5-html.xcframework/Info.plist@@ -0,0 +1,44 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>AvailableLibraries</key>+ <array>+ <dict>+ <key>BinaryPath</key>+ <string>fts5-html.dylib</string>+ <key>LibraryIdentifier</key>+ <string>ios-arm64</string>+ <key>LibraryPath</key>+ <string>fts5-html.dylib</string>+ <key>SupportedArchitectures</key>+ <array>+ <string>arm64</string>+ </array>+ <key>SupportedPlatform</key>+ <string>ios</string>+ </dict>+ <dict>+ <key>BinaryPath</key>+ <string>fts5-html.dylib</string>+ <key>LibraryIdentifier</key>+ <string>ios-arm64_x86_64-simulator</string>+ <key>LibraryPath</key>+ <string>fts5-html.dylib</string>+ <key>SupportedArchitectures</key>+ <array>+ <string>arm64</string>+ <string>x86_64</string>+ </array>+ <key>SupportedPlatform</key>+ <string>ios</string>+ <key>SupportedPlatformVariant</key>+ <string>simulator</string>+ </dict>+ </array>+ <key>CFBundlePackageType</key>+ <string>XFWK</string>+ <key>XCFrameworkFormatVersion</key>+ <string>1.0</string>+</dict>+</plist>diff --git a/apps/mobile/native/ios/fts5-html.xcframework/ios-arm64/fts5-html.dylib b/apps/mobile/native/ios/fts5-html.xcframework/ios-arm64/fts5-html.dylibnew file mode 100644index 000000000..e8fa8cbc2Binary files /dev/null and b/apps/mobile/native/ios/fts5-html.xcframework/ios-arm64/fts5-html.dylib differdiff --git a/apps/mobile/native/ios/fts5-html.xcframework/ios-arm64_x86_64-simulator/fts5-html.dylib b/apps/mobile/native/ios/fts5-html.xcframework/ios-arm64_x86_64-simulator/fts5-html.dylibnew file mode 100644index 000000000..c5e7b797dBinary files /dev/null and b/apps/mobile/native/ios/fts5-html.xcframework/ios-arm64_x86_64-simulator/fts5-html.dylib differdiff --git a/apps/mobile/patches/react-native-quick-sqlite+8.2.7.patch b/apps/mobile/patches/react-native-quick-sqlite+8.2.7.patchindex eed9afecd..942fd5d8d 100644--- a/apps/mobile/patches/react-native-quick-sqlite+8.2.7.patch+++ b/apps/mobile/patches/react-native-quick-sqlite+8.2.7.patch@@ -1,11 +1,18 @@diff --git a/node_modules/react-native-quick-sqlite/.DS_Store b/node_modules/react-native-quick-sqlite/.DS_Storenew file mode 100644-index 0000000..e69de29+index 0000000..2914034+Binary files /dev/null and b/node_modules/react-native-quick-sqlite/.DS_Store differdiff --git a/node_modules/react-native-quick-sqlite/android/CMakeLists.txt b/node_modules/react-native-quick-sqlite/android/CMakeLists.txt-index 756979a..ff14bef 100644+index 756979a..efb9f42 100644--- a/node_modules/react-native-quick-sqlite/android/CMakeLists.txt+++ b/node_modules/react-native-quick-sqlite/android/CMakeLists.txt-@@ -5,7 +5,7 @@ set (CMAKE_VERBOSE_MAKEFILE ON)+@@ -1,20 +1,33 @@+ cmake_minimum_required(VERSION 3.13)+ project(RNQuickSQLite)+++include(FetchContent)+++ set (CMAKE_VERBOSE_MAKEFILE ON)set (CMAKE_CXX_STANDARD 17)add_definitions(@@ -14,7 +21,18 @@ index 756979a..ff14bef 100644)include_directories(-@@ -15,6 +15,8 @@ include_directories(+ ../cpp+ )+++FetchContent_Declare(++ lexbor_source++ GIT_REPOSITORY https://github.com/lexbor/lexbor.git++ GIT_TAG v2.4.0++)++++FetchContent_MakeAvailable(lexbor_source)++++file(GLOB_RECURSE cpp_files RELATIVE ${CMAKE_SOURCE_DIR}"../cpp/**.c""../cpp/**.cpp"@@ -23,6 +41,14 @@ index 756979a..ff14bef 100644"cpp-adapter.cpp")+@@ -39,6 +52,7 @@ target_link_libraries(+ android+ fbjni::fbjni+ ReactAndroid::jsi++ lexbor+ )++ # https://github.com/react-native-community/discussions-and-proposals/discussions/816diff --git a/node_modules/react-native-quick-sqlite/android/build.gradle b/node_modules/react-native-quick-sqlite/android/build.gradleindex 8bbfd2d..c37d1db 100644--- a/node_modules/react-native-quick-sqlite/android/build.gradle@@ -109674,7 +109700,7 @@ index 9b284d2..bda794a 100644++#endifdiff --git a/node_modules/react-native-quick-sqlite/cpp/sqliteBridge.cpp b/node_modules/react-native-quick-sqlite/cpp/sqliteBridge.cpp-index 9ffe010..61f7b98 100644+index 9ffe010..3cf38af 100644--- a/node_modules/react-native-quick-sqlite/cpp/sqliteBridge.cpp+++ b/node_modules/react-native-quick-sqlite/cpp/sqliteBridge.cpp@@ -20,6 +20,9 @@@@ -109687,14 +109713,22 @@ index 9ffe010..61f7b98 100644map<string, sqlite3 *> dbMap = map<string, sqlite3 *>();bool folder_exists(const std::string &foldername)-@@ -90,12 +93,17 @@ SQLiteOPResult sqliteOpenDb(string const dbName, string const docPath)+@@ -90,12 +93,25 @@ SQLiteOPResult sqliteOpenDb(string const dbName, string const docPath)int exit = 0;exit = sqlite3_open_v2(dbPath.c_str(), &db, sqlOpenFlags, nullptr);+ if (exit == SQLITE_OK)+ {++#ifndef ANDROID++ sqlite3_enable_load_extension(db, 1);++ sqlite3_load_extension(db, "fts5-html", NULL, NULL);++#endif+++ sqlite3Fts5BetterTrigramInit(db);++ #ifdef ANDROID+ sqlite3Fts5HtmlInit(db);++ #endif+++ }+if (exit != SQLITE_OK)@@ -109708,7 +109742,7 @@ index 9ffe010..61f7b98 100644}else{-@@ -103,9 +111,8 @@ SQLiteOPResult sqliteOpenDb(string const dbName, string const docPath)+@@ -103,9 +119,8 @@ SQLiteOPResult sqliteOpenDb(string const dbName, string const docPath)}return SQLiteOPResult{@@ -109721,7 +109755,7 @@ index 9ffe010..61f7b98 100644SQLiteOPResult sqliteCloseDb(string const dbName)diff --git a/node_modules/react-native-quick-sqlite/react-native-quick-sqlite.podspec b/node_modules/react-native-quick-sqlite/react-native-quick-sqlite.podspec-index 373f52f..b9e769c 100644+index 373f52f..26a2f81 100644--- a/node_modules/react-native-quick-sqlite/react-native-quick-sqlite.podspec+++ b/node_modules/react-native-quick-sqlite/react-native-quick-sqlite.podspec@@ -15,7 +15,7 @@ Pod::Spec.new do |s|@@ -109729,10 +109763,14 @@ index 373f52f..b9e769c 100644s.header_mappings_dir = "cpp"- s.source_files = "ios/**/*.{h,hpp,m,mm}", "cpp/**/*.{h,cpp,c}"-+ s.source_files = "ios/**/*.{h,hpp,m,mm}", "cpp/**/*.{h,cpp,c}", "better-trigram/better-trigram.c", "sqlite3-fts5-html/fts5-html.c"++ s.source_files = "ios/**/*.{h,hpp,m,mm}", "cpp/**/*.{h,cpp,c}", "better-trigram/better-trigram.c"s.pod_target_xcconfig = {:GCC_PREPROCESSOR_DEFINITIONS => "HAVE_FULLFSYNC=1",+diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/.DS_Store b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/.DS_Store+new file mode 100644+index 0000000..5008ddf+Binary files /dev/null and b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/.DS_Store differdiff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/.github/workflows/release.yml b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/.github/workflows/release.ymlnew file mode 100755index 0000000..f3aa8bc@@ -110074,10 +110112,10 @@ index 0000000..e5d9e76+distdiff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/Makefile b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/Makefilenew file mode 100755-index 0000000..9fa632d+index 0000000..0a5328c--- /dev/null+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/Makefile-@@ -0,0 +1,60 @@+@@ -0,0 +1,80 @@+EXT = .so+SQLITE_VERSION ?= version-3.49.1+@@ -110086,7 +110124,12 @@ index 0000000..9fa632d+SQLITE_AMALGAMATION_URL = https://sqlite.org/2025/sqlite-amalgamation-3490100.zip+SQLITE_AMALGAMATION_PATH = deps/sqlite-amalgamation-3490100+-+override CFLAGS += -Ideps/$(SQLITE_VERSION)/ext/fts5 -I$(SQLITE_AMALGAMATION_PATH) -Os -Wall -Wextra++LEXBOR_VERSION = v2.4.0++LEXBOR_PATH = deps/lexbor++++ARCH ?= x86_64++++override CFLAGS += -Ideps/$(SQLITE_VERSION)/ext/fts5 -I$(SQLITE_AMALGAMATION_PATH) -I$(LEXBOR_PATH)/source -Os -Wall -Wextra+CONDITIONAL_CFLAGS = -lm++UNAME_S := $(shell uname -s)@@ -110103,6 +110146,7 @@ index 0000000..9fa632d+TARGET_LOADABLE=$(prefix)/fts5-html$(EXT)+TARGET_FTS5=$(prefix)/fts5$(EXT)+TARGET_LIBSQLITE=$(prefix)/libsqlite3$(EXT)++TARGET_LEXBOR=$(LEXBOR_PATH)/build/liblexbor_static.a++loadable: $(TARGET_LOADABLE)+@@ -110121,8 +110165,22 @@ index 0000000..9fa632d+ unzip sqlite.zip -d deps/+ rm -f sqlite.zip+-+$(TARGET_LOADABLE): $(SQLITE_SRC) $(SQLITE_AMALGAMATION_PATH) $(prefix)-+ $(CC) $(CFLAGS) $(CONDITIONAL_CFLAGS) -shared -fPIC -o $@ fts5-html.c++$(TARGET_LEXBOR):++ mkdir -p deps++ git clone --depth 1 --branch $(LEXBOR_VERSION) https://github.com/lexbor/lexbor.git $(LEXBOR_PATH)++ cd $(LEXBOR_PATH) && \++ cmake -B build \++ -DCMAKE_C_FLAGS="$(CFLAGS)" \++ -DCMAKE_OSX_ARCHITECTURES=$(ARCH) \++ -DLEXBOR_BUILD_STATIC=ON \++ -DLEXBOR_BUILD_SHARED=OFF \++ -DLEXBOR_BUILD_EXAMPLES=OFF \++ -DLEXBOR_BUILD_TESTS=OFF \++ -DLEXBOR_OPTIMIZATION_LEVEL=-O2 && \++ cmake --build build --target lexbor_static++++$(TARGET_LOADABLE): $(SQLITE_SRC) $(SQLITE_AMALGAMATION_PATH) $(TARGET_LEXBOR) $(prefix)++ $(CC) $(CFLAGS) $(CONDITIONAL_CFLAGS) -shared -fPIC -o $@ fts5-html.c $(TARGET_LEXBOR)++$(TARGET_FTS5): $(SQLITE_SRC) $(SQLITE_AMALGAMATION_PATH) $(prefix)+ dir=deps/$(SQLITE_VERSION) \@@ -110140,22 +110198,31 @@ index 0000000..9fa632d+ SQLITE_LIB_PATH=$(TARGET_LIBSQLITE) bun testdiff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/Makefile.vc b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/Makefile.vcnew file mode 100755-index 0000000..63ef942+index 0000000..dc5c1e9--- /dev/null+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/Makefile.vc-@@ -0,0 +1,62 @@+@@ -0,0 +1,85 @@+EXT = .dll+SQLITE_VERSION = version-3.49.1++SQLITE_TARBALL_URL = https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=$(SQLITE_VERSION)+SQLITE_SRC = deps\$(SQLITE_VERSION)\src+SQLITE_AMALGAMATION_URL = https://sqlite.org/2025/sqlite-amalgamation-3490100.zip-+SQLITE_AMALGAMATION_PATH = deps/sqlite-amalgamation-3490100++SQLITE_AMALGAMATION_PATH = deps\sqlite-amalgamation-3490100++TCL_DOWNLOAD_URL = https://www.irontcl.com/downloads/irontcl-amd64-8.6.7.zip+TCLSH_PATH = deps\IronTcl\bin\tclsh86t.exe+-+CFLAGS = -I$(SQLITE_AMALGAMATION_PATH) -Ideps\$(SQLITE_VERSION)\src -Ideps\$(SQLITE_VERSION)\ext\fts5 -Os -Wall++LEXBOR_VERSION = v2.4.0++LEXBOR_PATH = deps\lexbor++++!IF "$(ARCH)" == ""++ARCH = x64++!ENDIF++++LEXBOR_LIB = $(LEXBOR_PATH)\build\Release\lexbor_static.lib++++CFLAGS = -I$(SQLITE_AMALGAMATION_PATH) -Ideps\$(SQLITE_VERSION)\src -Ideps\$(SQLITE_VERSION)\ext\fts5 -I$(LEXBOR_PATH)\source -Os -Wall -DLEXBOR_STATIC /MD++prefix=dist+$(prefix):@@ -110164,6 +110231,7 @@ index 0000000..63ef942+TARGET_LOADABLE=$(prefix)\fts5-html$(EXT)+TARGET_FTS5=$(prefix)\fts5$(EXT)+TARGET_LEMON=$(prefix)\lemon.exe++TARGET_LIBSQLITE=$(prefix)\sqlite3$(EXT)++all: test loadable+loadable: $(TARGET_LOADABLE)@@ -110191,8 +110259,18 @@ index 0000000..63ef942+ powershell -Command "Expand-Archive -Path tcl.zip -DestinationPath deps/"+ del tcl.zip+-+$(TARGET_LOADABLE): $(SQLITE_AMALGAMATION_PATH) $(SQLITE_SRC) $(prefix)-+ cl $(CFLAGS) /LD /Fe$@ fts5-html.c++$(LEXBOR_LIB):++ @echo Setting up Lexbor...++ if not exist deps mkdir deps++ git clone --depth 1 --branch $(LEXBOR_VERSION) https://github.com/lexbor/lexbor.git $(LEXBOR_PATH)++ cd $(LEXBOR_PATH) && mkdir build++ cd $(LEXBOR_PATH)\build && cmake .. -DLEXBOR_BUILD_STATIC=ON -DLEXBOR_BUILD_SHARED=OFF -DLEXBOR_BUILD_EXAMPLES=OFF -DLEXBOR_BUILD_TESTS=OFF -DLEXBOR_OPTIMIZATION_LEVEL=-O2 -DCMAKE_GENERATOR_PLATFORM=$(ARCH)++ cd $(LEXBOR_PATH)\build && cmake --build . --target lexbor_static --config Release++ @echo Finding lexbor .lib...++ dir $(LEXBOR_PATH)\build\Release++++$(TARGET_LOADABLE): $(SQLITE_AMALGAMATION_PATH) $(SQLITE_SRC) $(LEXBOR_LIB) $(prefix)++ cl $(CFLAGS) /LD /Fe$@ fts5-html.c $(LEXBOR_LIB) /link /LIBPATH:$(LEXBOR_PATH)\build++$(TARGET_LEMON): $(SQLITE_SRC) $(prefix)+ cl deps\$(SQLITE_VERSION)\tool\lemon.c /Fe$@@@ -110204,8 +110282,11 @@ index 0000000..63ef942+ powershell -Command "$$CWD = pwd; cd deps\$(SQLITE_VERSION)\ext\fts5; & $$CWD\$(TCLSH_PATH) $$CWD\deps\$(SQLITE_VERSION)\ext\fts5\tool\mkfts5c.tcl"+ cl /DSQLITE_TEST -I$(SQLITE_AMALGAMATION_PATH) /LD /Fe$(TARGET_FTS5) deps\$(SQLITE_VERSION)\ext\fts5\fts5.c+-+test: $(TARGET_FTS5) $(TARGET_LOADABLE)-+ bun test++$(TARGET_LIBSQLITE): $(SQLITE_AMALGAMATION_PATH) $(prefix)++ cl $(CFLAGS) /LD /Fe$@ $(SQLITE_AMALGAMATION_PATH)\sqlite3.c++++test: $(TARGET_FTS5) $(TARGET_LOADABLE) $(TARGET_LIBSQLITE)++ set SQLITE_LIB_PATH=$(TARGET_LIBSQLITE) && bun testdiff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/README.md b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/README.mdnew file mode 100755index 0000000..4881922@@ -110281,17 +110362,17 @@ index 0000000..4881922+```diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/VERSION b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/VERSIONnew file mode 100755-index 0000000..bcab45a+index 0000000..81340c7--- /dev/null+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/VERSION@@ -0,0 +1 @@-+0.0.3++0.0.4diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.c b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.cnew file mode 100755-index 0000000..4c0b47d+index 0000000..d41cc00--- /dev/null+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.c-@@ -0,0 +1,2685 @@+@@ -0,0 +1,2914 @@+/*+** 2023-12-25+**@@ -110321,6 +110402,13 @@ index 0000000..4c0b47d+#define SQLITE_PRIVATE static+#endif+++#include "lexbor/html/tokenizer.h"++#include "lexbor/core/str.h"++#include "lexbor/core/array.h"++++/* Maximum length of an HTML entity name */++#define MAX_ENTITY_NAME_LENGTH 32+++/* START OF HTML ENTITIES */+struct htmlEntity {+ const char *pzName;@@ -112458,471 +112546,689 @@ index 0000000..4c0b47d+ {0, 0}+};+-+#define MAX_ENTITY_NAME_LENGTH 31+#define NUM_ENTITIES 2125++/* END OF HTML ENTITIES */+-+static const htmlEntity *findEntity(const char *s, int len) {-+ int l = 0;-+ int r = NUM_ENTITIES - 1;-+ while (l <= r) {-+ int m = (l + r) / 2;-+ int cmp = strncmp(s, htmlEntities[m].pzName, len);-+ if (cmp == 0) {-+ return &htmlEntities[m];-+ } else if (cmp < 0) {-+ r = m - 1;-+ } else {-+ l = m + 1;-+ }-+ }++/* Find an entity by name using binary search for better performance */++static const htmlEntity *findEntity(const char *name, int nameLen) {++ int left = 0;++ int right = sizeof(htmlEntities) / sizeof(htmlEntities[0]) - 2; /* Exclude NULL terminator */++++ while (left <= right) {++ int mid = (left + right) / 2;++ int cmp = strncmp(name, htmlEntities[mid].pzName, nameLen);++++ if (cmp == 0) {++ /* Check if we have an exact match or if the entity name is longer */++ if (htmlEntities[mid].pzName[nameLen] == '\0') {++ return &htmlEntities[mid];++ }++ /* If name is a prefix, we need to check adjacent entries as well */++ int i = mid - 1;++ while (i >= 0 && strncmp(name, htmlEntities[i].pzName, nameLen) == 0) {++ if (htmlEntities[i].pzName[nameLen] == '\0') {++ return &htmlEntities[i];++ }++ i--;++ }++ i = mid + 1;++ while (htmlEntities[i].pzName != NULL && strncmp(name, htmlEntities[i].pzName, nameLen) == 0) {++ if (htmlEntities[i].pzName[nameLen] == '\0') {++ return &htmlEntities[i];++ }++ i++;++ }++++ /* No exact match found */++ return NULL;++ } else if (cmp < 0) {++ right = mid - 1;++ } else {++ left = mid + 1;++ }++ }++++ return NULL;++}++++/* Parse a codepoint from an HTML entity (e.g., "#123" or "#x123") */++static int parseCodepoint(const char *s, int len) {++ int code = 0;++ const int MAX_CODEPOINT = 0x10FFFF; // Maximum valid Unicode codepoint++++ if (len < 1) {++ return -1;++ }++ if (s[0] == 'x' || s[0] == 'X') {++ /* Hex, e.g. ģ */++ for (int i = 1; i < len; i++) {++ char d = s[i];++++ // Check for potential overflow before multiplying++ if (code > (MAX_CODEPOINT / 16))++ return -1;++++ code *= 16;++ if (d >= '0' && d <= '9') {++ code += d - '0';++ } else if (d >= 'a' && d <= 'f') {++ code += d - 'a' + 10;++ } else if (d >= 'A' && d <= 'F') {++ code += d - 'A' + 10;++ } else {++ return -1;++ }++++ // Check if we've exceeded max valid codepoint++ if (code > MAX_CODEPOINT)++ return -1;++ }++ } else {++ /* Decimal, e.g. { */++ for (int i = 0; i < len; i++) {++ char d = s[i];++++ // Check for potential overflow before multiplying++ if (code > (MAX_CODEPOINT / 10))++ return -1;++++ code *= 10;++ if (d >= '0' && d <= '9') {++ code += d - '0';++ } else {++ return -1;++ }++++ // Check if we've exceeded max valid codepoint++ if (code > MAX_CODEPOINT)++ return -1;++ }++ }++++ // Filter out invalid and dangerous codepoints++ if (code == 0 || (code >= 0xD800 && code <= 0xDFFF))++ return -1;+-+ return NULL;++ return code;+}+-+/* do not include void element here */++++/* List of tags to ignore in tokenization */+static const char *azIgnoreTags[] = {-+ "canvas",-+ "math",-+ "noscript",-+ "object",-+ "script",-+ "style",-+ "svg",-+ "template",-+ NULL,++ "canvas",++ "math",++ "noscript",++ "object",++ "script",++ "style",++ "svg",++ "template",++ NULL,+};+-+struct Fts5HtmlTokenizer {-+ fts5_tokenizer nextTok;-+ Fts5Tokenizer *pNextTokInst;-+};-+typedef struct Fts5HtmlTokenizer Fts5HtmlTokenizer;++/* Structure to track positions in the original HTML */++typedef struct {++ const char *original; /* Original HTML input */++ int originalLength; /* Length of original HTML input */++ char *plain; /* Plain text extracted from HTML */++ int plainLen; /* Length of plain text */++ int plainCapacity; /* Capacity of plain text buffer */++ int *pStartPositions; /* For each char in plain text, original start position */++ int *pEndPositions; /* For each char in plain text, original end position */++ int inIgnoreTag; /* Are we currently in an ignored tag? */++ const char *currentTag; /* Current tag being ignored, if any */++ int lastOriginalPos; /* Last position in the original text */++ int inEntity; /* Currently processing an entity */++ char entityBuf[MAX_ENTITY_NAME_LENGTH + 4]; /* Buffer for entity name */++ int entityLen; /* Length of current entity in buffer */++ int lastTextNode; /* 1 if we've seen a text node before, to add space between nodes */++ int needSpace; /* 1 if we need to add a space before the next text */++} Fts5HtmlContext;++++/* Fts5 tokenizer structure */++typedef struct Fts5HtmlTokenizer {++ fts5_tokenizer nextTok;++ Fts5Tokenizer *pNextTokInst;++} Fts5HtmlTokenizer;++++/* Structure to pass to token callback */++typedef struct {++ int (*xToken)(++ void *pCtx,++ int tflags,++ const char *pToken,++ int nToken,++ int iStart,++ int iEnd++ );++ void *pCtx;++ Fts5HtmlContext *pHtmlCtx;+-+struct htmlEscape {-+ char *pLengths;-+ char *pPlain;-+ int n;-+};-+typedef struct htmlEscape htmlEscape;-+-+struct Fts5HtmlTokenizerContext {-+ int (*xToken)(-+ void *pCtx,-+ int tflags,-+ const char *pToken,-+ int nToken,-+ int iStart,-+ int iEnd-+ );-+ void *pCtx;-+ htmlEscape *pEscape;-+-+ /* current position in the plain (unescaped) text, relative to the what is-+ * passed to the xTokenize call to the next tokenizer-+ */-+ int iPlainCur;-+-+ /* current position in the original (html) text-+ * this is relative to the original text passed to the xTokenize call to-+ * this tokenizer-+ */-+ int iOriginalCur;-+};-+typedef struct Fts5HtmlTokenizerContext Fts5HtmlTokenizerContext;++ /* Current position tracking */++ int iPlainCur; /* Current position in plain text */++ int iOriginalCur; /* Current position in original text */++} Fts5HtmlTokenizerContext;+++/* Case-insensitive string comparison, like strcasecmp but with limited length */+static inline int caseInsensitiveCompare(const char *a, const char *b, int n) {-+ for (int i = 0; i < n; i++) {-+ char ca = (char)tolower(a[i]);-+ char cb = (char)tolower(b[i]);-+ int diff = ca - cb;-+ if (diff != 0 || ca == '\0' || cb == '\0') {-+ return diff;-+ }-+ }-+ return 0;++ for (int i = 0; i < n; i++) {++ char ca = (char)tolower(a[i]);++ char cb = (char)tolower(b[i]);++ int diff = ca - cb;++ if (diff != 0 || ca == '\0' || cb == '\0') {++ return diff;++ }++ }++ return 0;+}+-+static inline int hasPrefix(const char *p, int n, const char *prefix) {-+ int len = strlen(prefix);-+ if (n < len) {-+ return 0;-+ }-+ return strncmp(p, prefix, len) == 0;++/* Initialize the HTML context for lexbor tokenization */++static Fts5HtmlContext *fts5HtmlContextCreate(const char *html, int len) {++ Fts5HtmlContext *ctx = sqlite3_malloc(sizeof(*ctx));++ if (!ctx) return NULL;++++ memset(ctx, 0, sizeof(*ctx));++++ /* Initial capacity is input size + some extra space */++ int initialCapacity = len + 64;++++ ctx->original = html;++ ctx->originalLength = len;++ ctx->plain = sqlite3_malloc(initialCapacity);++ ctx->pStartPositions = sqlite3_malloc(initialCapacity * sizeof(int));++ ctx->pEndPositions = sqlite3_malloc(initialCapacity * sizeof(int));++++ if (!ctx->plain || !ctx->pStartPositions || !ctx->pEndPositions) {++ if (ctx->plain) sqlite3_free(ctx->plain);++ if (ctx->pStartPositions) sqlite3_free(ctx->pStartPositions);++ if (ctx->pEndPositions) sqlite3_free(ctx->pEndPositions);++ sqlite3_free(ctx);++ return NULL;++ }++++ ctx->plainCapacity = initialCapacity;++ ctx->plainLen = 0;++ ctx->inIgnoreTag = 0;++ ctx->currentTag = NULL;++ ctx->lastOriginalPos = 0;++ ctx->inEntity = 0;++ ctx->entityLen = 0;++ ctx->lastTextNode = 0;++ ctx->needSpace = 0;++++ return ctx;+}+-+static int fts5HtmlTokenizerCreate(void *pCtx, const char **azArg, int nArg, Fts5Tokenizer **ppOut) {-+ int rc = SQLITE_OK;-+ fts5_api *pApi = (fts5_api*)pCtx;-+ Fts5HtmlTokenizer *pRet = NULL;-+ void *pTokCtx = NULL;++/* Free the HTML context */++static void fts5HtmlContextFree(Fts5HtmlContext *ctx) {++ if (ctx) {++ if (ctx->plain) sqlite3_free(ctx->plain);++ if (ctx->pStartPositions) sqlite3_free(ctx->pStartPositions);++ if (ctx->pEndPositions) sqlite3_free(ctx->pEndPositions);++ sqlite3_free(ctx);++ }++}+-+ if (nArg == 0) {-+ return SQLITE_MISUSE;-+ }++/* Grow the plain text buffer if needed */++static int fts5HtmlContextGrow(Fts5HtmlContext *ctx, int additionalSize) {++ if (additionalSize <= 0 || additionalSize > (INT_MAX / 2))++ return SQLITE_ERROR;+-+ pRet = sqlite3_malloc(sizeof(*pRet));-+ if (pRet == NULL) {-+ rc = SQLITE_NOMEM;-+ goto error;-+ }-+ memset(pRet, 0, sizeof(*pRet));++ if (ctx->plainLen + additionalSize >= ctx->plainCapacity) {++ int newCapacity;+-+ const char *nextTokName = azArg[0];-+ rc = pApi->xFindTokenizer(pApi, nextTokName, &pTokCtx, &pRet->nextTok);-+ if (rc != SQLITE_OK) {-+ goto error;-+ }++ // Safe calculation to prevent integer overflow++ if (ctx->plainCapacity > (INT_MAX / 2)) {++ // Linear growth instead of exponential when close to INT_MAX++ newCapacity = ctx->plainCapacity + (64 + additionalSize);++ } else {++ newCapacity = ctx->plainCapacity * 2;++ }+-+ rc = pRet->nextTok.xCreate(pTokCtx, azArg + 1, nArg - 1, &pRet->pNextTokInst);-+ if (rc != SQLITE_OK) {-+ goto error;-+ }++ // Ensure we have enough space++ if (newCapacity < ctx->plainLen + additionalSize + 64) {++ // Check for potential overflow++ if ((INT_MAX - 64) < (ctx->plainLen + additionalSize))++ return SQLITE_NOMEM;+-+ *ppOut = (Fts5Tokenizer*)pRet;-+ return SQLITE_OK;++ newCapacity = ctx->plainLen + additionalSize + 64;++ }+-+error:-+ if (pRet != NULL) {-+ sqlite3_free(pRet);-+ }-+ return rc;++ char *newPlain = sqlite3_realloc(ctx->plain, newCapacity);++ int *newStartPositions = sqlite3_realloc(ctx->pStartPositions, newCapacity * sizeof(int));++ int *newEndPositions = sqlite3_realloc(ctx->pEndPositions, newCapacity * sizeof(int));++++ if (!newPlain || !newStartPositions || !newEndPositions) {++ sqlite3_free(newPlain); /* sqlite3_realloc might have succeeded for one but failed for other */++ sqlite3_free(newStartPositions);++ sqlite3_free(newEndPositions);++ return SQLITE_NOMEM;++ }++++ ctx->plain = newPlain;++ ctx->pStartPositions = newStartPositions;++ ctx->pEndPositions = newEndPositions;++ ctx->plainCapacity = newCapacity;++ }++++ return SQLITE_OK;+}+-+static int fts5TokenizeCallback(-+ void *pCtx,-+ int tflags,-+ const char *pToken,-+ int nToken,-+ int iStart,-+ int iEnd++/* Process and emit a single character to the plain text buffer */++static int fts5HtmlContextAddChar(++ Fts5HtmlContext *ctx,++ char c,++ int originalPos,++ int originalLen+) {-+ Fts5HtmlTokenizerContext *p = (Fts5HtmlTokenizerContext*)pCtx;-+ htmlEscape *e = p->pEscape;-+-+ int iActualStart = p->iOriginalCur;-+-+ // if the cursor in plain text is ahead of the position-+ // shared by the actual tokenizer, that means we are moving-+ // by a different offset instead of from token to token.-+ // This is especially the case in trigram tokenizers that-+ // iterate over the same word multiple times, each time-+ // moving by offset 1.-+ if (p->iPlainCur > iStart) {-+ // move back the cursor in the actual document-+ iActualStart = iActualStart - (p->iPlainCur - iStart);-+ }++ // Don't allow null bytes to be added to the plain text++ if (c == '\0') return SQLITE_OK; // Skip null bytes silently++ if (ctx->inIgnoreTag) return SQLITE_OK; /* Skip text in ignored tags */+-+ for (int i = p->iPlainCur; i < iStart; i++) {-+ iActualStart += e->pLengths[i];-+ }-+ int iActualEnd = iActualStart;-+ for (int i = iStart; i < iEnd; i++) {-+ iActualEnd += e->pLengths[i];-+ }-+ p->iOriginalCur = iActualEnd;-+ p->iPlainCur = iEnd;++ int rc = fts5HtmlContextGrow(ctx, 1);++ if (rc != SQLITE_OK) return rc;+-+ return p->xToken(p->pCtx, tflags, pToken, nToken, iActualStart, iActualEnd);++ /* Add the character */++ ctx->plain[ctx->plainLen] = c;++++ /* Update position mapping */++ ctx->pStartPositions[ctx->plainLen] = originalPos;++ ctx->pEndPositions[ctx->plainLen] = originalPos + originalLen;++++ ctx->plainLen++;++ ctx->lastOriginalPos = originalPos + originalLen;++++ return SQLITE_OK;+}+-+static int parseCodepoint(const char *s, int len) {-+ int code = 0;-+ if (len < 1) {-+ return -1;-+ }-+ if (s[0] == 'x' || s[0] == 'X') {-+ /* hex, e.g. ģ */-+ for (int i = 1; i < len; i++) {-+ char d = s[i];-+ code *= 16;-+ if (d >= '0' && d <= '9') {-+ code += d - '0';-+ } else if (d >= 'a' && d <= 'f') {-+ code += d - 'a' + 10;-+ } else if (d >= 'A' && d <= 'F') {-+ code += d - 'A' + 10;-+ } else {-+ return -1;-+ }-+ }-+ } else {-+ /* decimal, e.g. { */-+ for (int i = 0; i < len; i++) {-+ char d = s[i];-+ code *= 10;-+ if (d >= '0' && d <= '9') {-+ code += d - '0';-+ } else {-+ return -1;-+ }-+ }-+ }-+ return code;++#define MAX_ENTITIES_PER_TOKEN 1000++/* Process HTML entities in text */++static int fts5HtmlContextProcessEntities(++ Fts5HtmlContext *ctx,++ const lxb_char_t *text,++ size_t length,++ int originalPos++) {++ if (ctx->inIgnoreTag) return SQLITE_OK; /* Skip text in ignored tags */++++ /* Check for empty text */++ if (length == 0) return SQLITE_OK;++++ int rc = SQLITE_OK;++ const char *p = (const char *)text;++ const char *end = p + length;++ int pos = originalPos;++ int entityCount = 0;++++ while (p < end) {++ char c = *p;++++ if (ctx->inEntity) {++ // Add protection against too many entities in a single token++ if (++entityCount > MAX_ENTITIES_PER_TOKEN) {++ // Too many entities, stop processing to avoid DOS++ ctx->inEntity = 0;++ break;++ }++++ if (!isalnum(c) && c != '#') {++ /* End of entity name */++ if (ctx->entityBuf[1] == '#') {++ /* Numeric entity: { or ģ */++ int code = parseCodepoint(ctx->entityBuf + 2, ctx->entityLen - 2);++++ if (code >= 0) {++ /* Convert to UTF-8 */++ if (code < 0x80) {++ rc = fts5HtmlContextAddChar(ctx, (char)code, originalPos - ctx->entityLen, ctx->entityLen + (c == ';' ? 1 : 0));++ if (rc != SQLITE_OK) return rc;++ } else if (code < 0x800) {++ rc = fts5HtmlContextAddChar(ctx, (char)(0xC0 | (code >> 6)),++ originalPos - ctx->entityLen, ctx->entityLen + (c == ';' ? 1 : 0));++ if (rc != SQLITE_OK) return rc;++ rc = fts5HtmlContextAddChar(ctx, (char)(0x80 | (code & 0x3F)),++ originalPos - ctx->entityLen, 0);++ if (rc != SQLITE_OK) return rc;++ } else if (code < 0x10000) {++ rc = fts5HtmlContextAddChar(ctx, (char)(0xE0 | (code >> 12)),++ originalPos - ctx->entityLen, ctx->entityLen + (c == ';' ? 1 : 0));++ if (rc != SQLITE_OK) return rc;++ rc = fts5HtmlContextAddChar(ctx, (char)(0x80 | ((code >> 6) & 0x3F)),++ originalPos - ctx->entityLen, 0);++ if (rc != SQLITE_OK) return rc;++ rc = fts5HtmlContextAddChar(ctx, (char)(0x80 | (code & 0x3F)),++ originalPos - ctx->entityLen, 0);++ if (rc != SQLITE_OK) return rc;++ } else {++ /* Surrogate pair - rarely used in HTML */++ rc = fts5HtmlContextAddChar(ctx, (char)(0xF0 | (code >> 18)),++ originalPos - ctx->entityLen, ctx->entityLen + (c == ';' ? 1 : 0));++ if (rc != SQLITE_OK) return rc;++ rc = fts5HtmlContextAddChar(ctx, (char)(0x80 | ((code >> 12) & 0x3F)),++ originalPos - ctx->entityLen, 0);++ if (rc != SQLITE_OK) return rc;++ rc = fts5HtmlContextAddChar(ctx, (char)(0x80 | ((code >> 6) & 0x3F)),++ originalPos - ctx->entityLen, 0);++ if (rc != SQLITE_OK) return rc;++ rc = fts5HtmlContextAddChar(ctx, (char)(0x80 | (code & 0x3F)),++ originalPos - ctx->entityLen, 0);++ if (rc != SQLITE_OK) return rc;++ }++ }++ } else {++ /* Named entity: & */++ const htmlEntity *entity = findEntity(ctx->entityBuf + 1, ctx->entityLen - 1);++ if (entity != NULL) {++ const char *pEntity = entity->pzUtf8;++ int entityPos = originalPos - ctx->entityLen;++ int entityLen = ctx->entityLen + (c == ';' ? 1 : 0);++ while (*pEntity != '\0') {++ rc = fts5HtmlContextAddChar(ctx, *pEntity, entityPos, entityLen);++ if (rc != SQLITE_OK) return rc;++ pEntity++;++ /* Only the first char maps to the full entity */++ entityLen = 0;++ }++ }++ }++++ if (c != ';') {++ /* Unclosed entity - emit the character */++ rc = fts5HtmlContextAddChar(ctx, '&', pos - 1, 1);++ rc = fts5HtmlContextAddChar(ctx, c, pos, 1);++ if (rc != SQLITE_OK) return rc;++ }++++ ctx->inEntity = 0;++ ctx->entityLen = 0;++ } else {++ if (ctx->entityLen < MAX_ENTITY_NAME_LENGTH) {++ ctx->entityBuf[ctx->entityLen++] = c;++ }++ }++ } else if (c == '&') {++ /* Start of entity */++ ctx->inEntity = 1;++ ctx->entityLen = 0;++ ctx->entityBuf[ctx->entityLen++] = c;++ } else {++ /* Regular character */++ rc = fts5HtmlContextAddChar(ctx, c, pos, 1);++ if (rc != SQLITE_OK) return rc;++ }++++ p++;++ pos++;++ }++++ return SQLITE_OK;+}+-+static void htmlEscapeFree(htmlEscape *p) {-+ if (p != NULL) {-+ if (p->pLengths != NULL) {-+ sqlite3_free(p->pLengths);-+ }-+ if (p->pPlain != NULL) {-+ sqlite3_free(p->pPlain);-+ }-+ sqlite3_free(p);-+ }++/* List of HTML block-level elements that should cause whitespace to be inserted */++static const char *azBlockElements[] = {++ "address", "article", "aside", "blockquote", "details", "dialog",++ "dd", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer",++ "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr",++ "li", "main", "nav", "ol", "p", "pre", "section", "table", "ul",++ NULL++};++++/* Check if a tag is a block-level element */++static int isBlockElement(const char *tagName, int tagLen) {++ if (!tagName || tagLen <= 0) return 0;++++ for (int i = 0; azBlockElements[i] != NULL; i++) {++ if (caseInsensitiveCompare(tagName, azBlockElements[i], tagLen) == 0) {++ return 1;++ }++ }++ return 0;+}+-+static int htmlUnescape(const char *s, int len, htmlEscape **pOutEscape) {-+ if (len <= 0) {-+ *pOutEscape = NULL;-+ return SQLITE_OK;-+ }-+ int bufLen = len + 16;++/* token callback function */++static lxb_html_token_t *tokenCallback(++ lxb_html_tokenizer_t *tkz,++ lxb_html_token_t *token,++ void *ctx++) {++ Fts5HtmlContext *context = (Fts5HtmlContext *)ctx;++ bool is_close = token->type & LXB_HTML_TOKEN_TYPE_CLOSE;+-+ int rc = SQLITE_OK;-+ htmlEscape *e = sqlite3_malloc(sizeof(*e));-+ if (e == NULL) {-+ rc = SQLITE_NOMEM;-+ goto end;-+ }-+ memset(e, 0, sizeof(*e));++ /* Handle the EOF token */++ if (token->tag_id == LXB_TAG__END_OF_FILE) {++ return token;++ }+-+ e->pLengths = sqlite3_malloc(bufLen);-+ if (e->pLengths == NULL) {-+ rc = SQLITE_NOMEM;-+ goto end;-+ }-+ memset(e->pLengths, 0, bufLen);++ /* Handle text tokens */++ if (token->tag_id == LXB_TAG__TEXT) {++ if (!context->inIgnoreTag) {++ int originalPos = token->begin - (const lxb_char_t *)context->original;+-+ e->pPlain = sqlite3_malloc(bufLen);-+ if (e->pPlain == NULL) {-+ rc = SQLITE_NOMEM;-+ goto end;-+ }-+ memset(e->pPlain, 0, bufLen);-+-+ const char *p = s;-+ const char *pEmit = s;-+-+ char *ep = e->pPlain;-+ char *el = e->pLengths;-+-+#define EMIT(c) do {\-+ if (ep >= e->pPlain + bufLen) {\-+ rc = SQLITE_ERROR;\-+ goto end;\-+ }\-+ *ep++ = c;\-+ *el++ = (p + 1) - pEmit;\-+ pEmit = p + 1;\-+} while (0)-+-+ unsigned long escaped = 0;-+ char buf[MAX_ENTITY_NAME_LENGTH + 4] = {0};-+-+ for (; p - s < len; p++) {-+ char c = *p;-+ if (escaped > 0) {-+ if (!isalnum(c) && c != '#') {-+ if (buf[1] == '#') {-+ /* numeric escape, buf: � or � */-+ int code = parseCodepoint(buf + 2, escaped - 2);-+ /* assume code is a Unicode code point, encode into UTF-8 */-+ if (code < 0) {-+ /* invalid escape, */-+ } else if (code < 0x80) {-+ EMIT(code);-+ } else if (code < 0x800) {-+ EMIT(0xC0 | (code >> 6));-+ EMIT(0x80 | (code & 0x3F));-+ } else if (code < 0x10000) {-+ EMIT(0xE0 | (code >> 12));-+ EMIT(0x80 | ((code >> 6) & 0x3F));-+ EMIT(0x80 | (code & 0x3F));-+ } else if (code < 0x110000) {-+ EMIT(0xF0 | (code >> 18));-+ EMIT(0x80 | ((code >> 12) & 0x3F));-+ EMIT(0x80 | ((code >> 6) & 0x3F));-+ EMIT(0x80 | (code & 0x3F));-+ } else {-+ /* invalid escape, ignore */-+ }-+ } else {-+ /* named escape, buf: & */-+ const htmlEntity *entity = findEntity(buf + 1, escaped - 1);-+ if (entity != NULL) {-+ const char *pEntity = entity->pzUtf8;-+ while (*pEntity != '\0') {-+ EMIT(*pEntity);-+ pEntity++;-+ }-+ } else {-+ /* invalid escape, ignore */-+ }-+ }-+ if (c != ';') {-+ /* unclosed entity */-+ EMIT(c);-+ }-+ escaped = 0;-+ } else {-+ if (escaped < sizeof(buf)) {-+ buf[escaped++] = c;-+ }-+ }-+ } else {-+ /* not escaped */-+ if (c == '&') {-+ escaped = 0;-+ memset(buf, 0, sizeof(buf));-+ buf[escaped++] = c;-+ } else {-+ EMIT(c);-+ }-+ }-+ }++ /* Check if we need to add a space (from previous node or block element) */++ if ((context->needSpace || context->lastTextNode) && context->plainLen > 0) {++ /* Only add space if the last character isn't already a space */++ if (context->plain[context->plainLen-1] != ' ') {++ fts5HtmlContextAddChar(context, ' ', originalPos, 0);++ }++ context->needSpace = 0;++ }+-+ e->n = ep - e->pPlain;++ fts5HtmlContextProcessEntities(context, token->begin, token->end - token->begin, originalPos);++ context->lastTextNode = 1;++ }++ return token;++ }++++ /* Handle HTML comments - they should cause space between adjacent text nodes */++ if (token->tag_id == LXB_TAG__EM_COMMENT) {++ if (!context->inIgnoreTag && context->lastTextNode) {++ context->needSpace = 1;++ }++ return token;++ }++++ /* Handle tag tokens */++ const lxb_char_t *name = lxb_tag_name_by_id(token->tag_id, NULL);+-+ *pOutEscape = e;-+ return rc;++ if (name == NULL) return token; /* Skip if we can't get the tag name */+-+#undef EMIT-+end:-+ htmlEscapeFree(e);++ size_t name_len = strlen((const char *)name);+-+ *pOutEscape = e;-+ return rc;++ /* Check if we're entering an ignored tag */++ if (!is_close && !context->inIgnoreTag) {++ for (int i = 0; azIgnoreTags[i] != NULL; i++) {++ if (caseInsensitiveCompare((const char *)name, azIgnoreTags[i], name_len) == 0) {++ context->inIgnoreTag = 1;++ context->currentTag = azIgnoreTags[i];++ break;++ }++ }++++ /* Handle block-level elements - they should add whitespace */++ if (isBlockElement((const char *)name, name_len)) {++ if (context->lastTextNode && context->plainLen > 0) {++ context->needSpace = 1;++ }++ }++ }++ /* Check if we're exiting an ignored tag */++ else if (is_close && context->inIgnoreTag && context->currentTag) {++ if (caseInsensitiveCompare((const char *)name, context->currentTag, name_len) == 0) {++ context->inIgnoreTag = 0;++ context->currentTag = NULL;++ }++ }++ /* Handle closing block elements */++ else if (is_close && isBlockElement((const char *)name, name_len)) {++ context->needSpace = 1;++ }++++ return token;+}+-+static int fts5HtmlTokenizerTokenize(-+ Fts5Tokenizer *pTokenizer,-+ void *pCtx,-+ int flags,-+ const char *pText,-+ int nText,-+ int (*xToken)(-+ void *pCtx,-+ int tflags,-+ const char *pToken,-+ int nToken,-+ int iStart,-+ int iEnd-+ )++/* Create the lexbor-based FTS5 tokenizer */++static int fts5HtmlTokenizerCreate(++ void *pCtx,++ const char **azArg,++ int nArg,++ Fts5Tokenizer **ppOut++) {++ int rc = SQLITE_OK;++ fts5_api *pApi = (fts5_api *)pCtx;++ Fts5HtmlTokenizer *pRet = NULL;++ void *pTokCtx = NULL;++++ if (nArg == 0) {++ return SQLITE_MISUSE;++ }++++ pRet = sqlite3_malloc(sizeof(*pRet));++ if (pRet == NULL) {++ rc = SQLITE_NOMEM;++ goto error;++ }++ memset(pRet, 0, sizeof(*pRet));++++ const char *nextTokName = azArg[0];++ rc = pApi->xFindTokenizer(pApi, nextTokName, &pTokCtx, &pRet->nextTok);++ if (rc != SQLITE_OK) {++ goto error;++ }++++ rc = pRet->nextTok.xCreate(pTokCtx, azArg + 1, nArg - 1, &pRet->pNextTokInst);++ if (rc != SQLITE_OK) {++ goto error;++ }++++ *ppOut = (Fts5Tokenizer *)pRet;++ return SQLITE_OK;++++error:++ if (pRet != NULL) {++ sqlite3_free(pRet);++ }++ return rc;++}++++/* Tokenize callback for the next tokenizer - maps positions in plain text back to HTML positions */++static int fts5TokenizeCallback(++ void *pCtx,++ int tflags,++ const char *pToken,++ int nToken,++ int iStart,++ int iEnd+) {-+ int rc;-+ Fts5HtmlTokenizer *p = (Fts5HtmlTokenizer*)pTokenizer;++ Fts5HtmlTokenizerContext *p = (Fts5HtmlTokenizerContext *)pCtx;++ Fts5HtmlContext *html = p->pHtmlCtx;+-+ // states-+ const char *pzCurIgnoreTag = NULL;++ // Improved bounds checking++ if (iStart < 0 || iStart >= html->plainLen || iEnd <= 0 || iEnd > html->plainLen || iEnd <= iStart) {++ /* Invalid indices, just use current positions */++ return p->xToken(p->pCtx, tflags, pToken, nToken, p->iOriginalCur, p->iOriginalCur + nToken);++ }+-+ // iterate over the tokens-+ const char *pPrev = pText;-+ const char *pCur = pText;-+ const char *pEnd = pText + nText;++ /* Direct position mapping - no need for complex calculations */++ int iActualStart = html->pStartPositions[iStart];++ int iActualEnd = html->pEndPositions[iEnd - 1];+-+ while (1) {++ // Additional sanity check++ if (iActualEnd < iActualStart) {++ iActualEnd = iActualStart + nToken;++ }+-+#define STEP(n) do {\-+ if (pCur + n >= pEnd) { \-+ return SQLITE_OK; \-+ } \-+ pCur += n; \-+} while (0)++ /* Update cursors */++ p->iOriginalCur = iActualEnd;++ p->iPlainCur = iEnd;+-+ /* find the next tag */-+ while (*pCur != '<' && pCur < pEnd) {-+ pCur++;-+ }++ /* Pass the token and mapped positions to the original callback */++ return p->xToken(p->pCtx, tflags, pToken, nToken, iActualStart, iActualEnd);++}+-+ /* current is '<' or end of text */-+ if (pzCurIgnoreTag == NULL && pCur > pPrev) {-+ htmlEscape *pEscape = NULL;-+ rc = htmlUnescape(pPrev, pCur - pPrev, &pEscape);-+ if (rc != SQLITE_OK) {-+ return rc;-+ }-+ Fts5HtmlTokenizerContext ctx = {-+ .xToken = xToken,-+ .pCtx = pCtx,-+ .pEscape = pEscape,-+ .iPlainCur = 0,-+ .iOriginalCur = pPrev - pText,-+ };-+ /* emit the text token */-+ rc = p->nextTok.xTokenize(p->pNextTokInst, &ctx, flags, pEscape->pPlain, pEscape->n, fts5TokenizeCallback);-+ htmlEscapeFree(pEscape);-+ if (rc != SQLITE_OK) {-+ return rc;-+ }-+ }-+ STEP(1);-+-+ /* check for comment */-+ if (hasPrefix(pCur, pEnd - pCur, "!--")) {-+ STEP(3);-+ while (!hasPrefix(pCur, pEnd - pCur, "-->")) {-+ STEP(1);-+ }-+ STEP(3);-+ continue;-+ }++/* Tokenize HTML content */++static int fts5HtmlTokenizerTokenize(++ Fts5Tokenizer *pTokenizer,++ void *pCtx,++ int flags,++ const char *pText,++ int nText,++ int (*xToken)(void *pCtx, int tflags, const char *pToken, int nToken, int iStart, int iEnd)++) {++ int rc = SQLITE_OK;++ Fts5HtmlTokenizer *p = (Fts5HtmlTokenizer *)pTokenizer;+-+ /* parse the tag */-+ int iTagType = 0; /* 0: self-closing, 1: start tag, 2: end tag */-+ const char *pTagName;-+ int nTagName;-+ if (*pCur == '/') { /* </... */-+ iTagType = 2;-+ STEP(1);-+ } else {-+ iTagType = 1;-+ }-+ pTagName = pCur;-+ while (!isspace(*pCur) && *pCur != '>') {-+ STEP(1);-+ }-+ nTagName = pCur - pTagName;-+ while (*pCur != '>') {-+ STEP(1);-+ }-+ if (*(pCur - 1) == '/') {-+ iTagType = 0;-+ }++ /* Create lexbor tokenizer */++ lxb_html_tokenizer_t *tkz = lxb_html_tokenizer_create();++ lxb_status_t status = lxb_html_tokenizer_init(tkz);++ if (status != LXB_STATUS_OK) {++ lxb_html_tokenizer_destroy(tkz);++ return SQLITE_ERROR;++ }+-+ /* check if tag is ignored */-+ if (pzCurIgnoreTag == NULL && iTagType == 1) {-+ for (int i = 0; azIgnoreTags[i] != NULL; i++) {-+ if (caseInsensitiveCompare(pTagName, azIgnoreTags[i], nTagName) == 0) {-+ pzCurIgnoreTag = azIgnoreTags[i];-+ break;-+ }-+ }-+ } else if (pzCurIgnoreTag != NULL && iTagType == 2) {-+ if (caseInsensitiveCompare(pTagName, pzCurIgnoreTag, nTagName) == 0) {-+ pzCurIgnoreTag = NULL;-+ }-+ }++ /* Create HTML context */++ Fts5HtmlContext *htmlCtx = fts5HtmlContextCreate(pText, nText);++ if (!htmlCtx) {++ lxb_html_tokenizer_destroy(tkz);++ return SQLITE_NOMEM;++ }+-+ /* tag ended */-+ STEP(1);-+ pPrev = pCur;++ /* Set the token callback */++ lxb_html_tokenizer_callback_token_done_set(tkz, tokenCallback, htmlCtx);+-+#undef STEP++ /* Tokenize the HTML */++ status = lxb_html_tokenizer_begin(tkz);++ if (status != LXB_STATUS_OK) {++ rc = SQLITE_ERROR;++ goto cleanup;++ }+-+ }++ status = lxb_html_tokenizer_chunk(tkz, (const lxb_char_t *)pText, nText);++ if (status != LXB_STATUS_OK) {++ rc = SQLITE_ERROR;++ goto cleanup;++ }++++ status = lxb_html_tokenizer_end(tkz);++ if (status != LXB_STATUS_OK) {++ rc = SQLITE_ERROR;++ goto cleanup;++ }++++ /* Set up the tokenizer context for the next tokenizer */++ Fts5HtmlTokenizerContext ctx = {++ .xToken = xToken,++ .pCtx = pCtx,++ .pHtmlCtx = htmlCtx,++ .iPlainCur = 0,++ .iOriginalCur = 0,++ };++++ /* Call the next tokenizer on the extracted plain text */++ rc = p->nextTok.xTokenize(++ p->pNextTokInst,++ &ctx,++ flags,++ htmlCtx->plain,++ htmlCtx->plainLen,++ fts5TokenizeCallback++ );+-+ return SQLITE_OK;++cleanup:++ lxb_html_tokenizer_destroy(tkz);++ fts5HtmlContextFree(htmlCtx);++++ return rc;+}+++/* Delete the tokenizer */+static void fts5HtmlTokenizerDelete(Fts5Tokenizer *pTokenizer) {-+ Fts5HtmlTokenizer *p = (Fts5HtmlTokenizer*)pTokenizer;-+ p->nextTok.xDelete(p->pNextTokInst);-+ sqlite3_free(p);++ Fts5HtmlTokenizer *p = (Fts5HtmlTokenizer *)pTokenizer;++ p->nextTok.xDelete(p->pNextTokInst);++ sqlite3_free(p);+}+++/* Get FTS5 API from database handle */+static fts5_api *fts5_api_from_db(sqlite3 *db) {+ fts5_api *pRet = 0;+ sqlite3_stmt *pStmt = 0;@@ -112947,34 +113253,38 @@ index 0000000..4c0b47d+ return pRet;+}+++/* Initialize the lexbor-based HTML tokenizer with SQLite */+static int fts5HtmlInit(sqlite3 *db) {-+ fts5_api *pApi;-+ pApi = fts5_api_from_db(db);-+ if (!pApi) {-+ return SQLITE_ERROR;-+ }++ fts5_api *pApi = fts5_api_from_db(db);++ if (!pApi) {++ return SQLITE_ERROR;++ }+-+ fts5_tokenizer tok = {-+ .xCreate = fts5HtmlTokenizerCreate,-+ .xTokenize = fts5HtmlTokenizerTokenize,-+ .xDelete = fts5HtmlTokenizerDelete,-+ };++ fts5_tokenizer tokenizer = {++ fts5HtmlTokenizerCreate,++ fts5HtmlTokenizerDelete,++ fts5HtmlTokenizerTokenize++ };+-+ return pApi->xCreateTokenizer(pApi, "html", (void *)pApi, &tok, NULL);++ return pApi->xCreateTokenizer(pApi,++ "html",++ (void*)pApi,++ &tokenizer,++ NULL++ );+}+++/* Register the lexbor-based HTML tokenizer with SQLite */+#ifdef SQLITE_CORE+SQLITE_PRIVATE int sqlite3Fts5HtmlInit(sqlite3 *db) {-+ return fts5HtmlInit(db);++ return fts5HtmlInit(db);+}+#else+SQLITE_FTS5_HTML_API int-+sqlite3_ftshtml_init(sqlite3 *db, char **error,-+ const sqlite3_api_routines *api) {-+ SQLITE_EXTENSION_INIT2(api);-+ UNUSED_PARAM(error);-+-+ return fts5HtmlInit(db);++sqlite3_ftshtml_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) {++ UNUSED_PARAM(pzErrMsg);++ SQLITE_EXTENSION_INIT2(pApi);++ return fts5HtmlInit(db);+}+#endifdiff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.h b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.h@@ -113024,11 +113334,117 @@ index 0000000..ab224e9+#endif++#endif /* ifndef SQLITE_FTS5_HTML_H */-diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.test.ts b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.test.ts+diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/genhtmlentity.ts b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/genhtmlentity.tsnew file mode 100755-index 0000000..81ce97d+index 0000000..8878773--- /dev/null-+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.test.ts++++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/genhtmlentity.ts+@@ -0,0 +1,80 @@++// @ts-ignore++import * as fs from "node:fs/promises";++++interface EntityDefinition {++ characters: string;++}++++const FILENAME = "fts5-html.c";++const entities: Record<string, EntityDefinition> = await fetch(++ "https://html.spec.whatwg.org/entities.json",++).then((r) => r.json());++++const cleaned = Object.fromEntries(++ Object.entries(entities).map(([k, v]) => [k.replace(/^&(.*?);?$/g, "$1"), v]),++);++++function strcmp(a: string, b: string): number {++ if (a < b) {++ return -1;++ } else if (a > b) {++ return 1;++ } else {++ return 0;++ }++}++++const encoder = new TextEncoder();++++const parts: string[] = [];++++parts.push(++ `++struct htmlEntity {++ const char *pzName;++ const char *pzUtf8;++};++typedef struct htmlEntity htmlEntity;++++static const htmlEntity htmlEntities[] = {++`.trim(),++);++++for (const [name, { characters }] of Object.entries(cleaned).sort((a, b) =>++ strcmp(a[0], b[0]),++)) {++ const hex = encoder.encode(characters);++ const escaped = Array.from(hex)++ .map((h) => "\\x" + h.toString(16).padStart(2, "0"))++ .join("");++ parts.push(`\t{"${name}", "${escaped}"},`);++}++++parts.push(`++ {0, 0}++};++++#define MAX_ENTITY_NAME_LENGTH ${Math.max(...Object.keys(cleaned).map((k) => k.length))}++#define NUM_ENTITIES ${Object.keys(cleaned).length}++`);++++const input = await fs.readFile(FILENAME, "utf-8");++let emit = true;++const outputParts: string[] = [];++++for (let line of input.split("\n")) {++ if (line.includes("/* START OF HTML ENTITIES */")) {++ outputParts.push(line);++ emit = false;++ }++ if (emit) {++ outputParts.push(line);++ }++ if (line.includes("/* END OF HTML ENTITIES */")) {++ emit = true;++ outputParts.push(parts.join("\n"));++ outputParts.push(line);++ }++}++++await fs.writeFile(FILENAME, outputParts.join("\n"));+diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/sqlite-dist.toml b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/sqlite-dist.toml+new file mode 100755+index 0000000..eb5cbd7+--- /dev/null++++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/sqlite-dist.toml+@@ -0,0 +1,14 @@++[package]++name = "sqlite3-fts5-html"++license = "Public Domain"++homepage = "https://github.com/streetwriters/sqlite3-fts5-html"++repo = "https://github.com/streetwriters/sqlite3-fts5-html"++description = "A pseudo tokenizer for SQLite3 FTS5 to strip HTML tags"++authors = ["Abdullah Atta"]++git_tag_format = "v$VERSION"++++[targets]++github_releases = {}++amalgamation = {include=["fts5-html.c", "fts5-html.h"]}++++npm = {}+diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/tests/fts5-html.test.ts b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/tests/fts5-html.test.ts+new file mode 100755+index 0000000..24bd350+--- /dev/null++++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/tests/fts5-html.test.ts@@ -0,0 +1,213 @@+/*+ ** 2024-10-21@@ -113192,7 +113608,7 @@ index 0000000..81ce97d+ const db = initDatabase();+ afterAll(() => db.close());+-+ test("1.0", () => {++ test("1.0", async () => {+ [+ `CREATE VIRTUAL TABLE test USING fts5(x, y, tokenize = 'html trigram remove_diacritics 1');`,+ `INSERT INTO test VALUES('a', '<pre>describe(ContactFormComponent, () => {<br> let component:</pre>');`,@@ -113243,109 +113659,196 @@ index 0000000..81ce97d+ expect(result?.detail).toInclude(expected);+ });+}-diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/genhtmlentity.ts b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/genhtmlentity.ts+diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/tests/html5lib.test.ts b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/tests/html5lib.test.tsnew file mode 100755-index 0000000..8878773+index 0000000..11895d2--- /dev/null-+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/genhtmlentity.ts-@@ -0,0 +1,80 @@-+// @ts-ignore-+import * as fs from "node:fs/promises";++++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/tests/html5lib.test.ts+@@ -0,0 +1,187 @@++/*++ ** 2024-10-21++ **++ ** The author disclaims copyright to this source code. In place of++ ** a legal notice, here is a blessing:++ **++ ** May you do good and not evil.++ ** May you find forgiveness for yourself and forgive others.++ ** May you share freely, never taking more than you give.++ **++ */+-+interface EntityDefinition {-+ characters: string;-+}++import { Database } from "bun:sqlite";++import { describe, test, expect, beforeAll, afterAll } from "bun:test";++import { readdir, readFile } from "node:fs/promises";++import { join } from "node:path";+-+const FILENAME = "fts5-html.c";-+const entities: Record<string, EntityDefinition> = await fetch(-+ "https://html.spec.whatwg.org/entities.json",-+).then((r) => r.json());++const HTML5LIB_DIR = join(import.meta.dir, "html5lib-tests");++const TOKENIZER_TESTS_DIR = join(HTML5LIB_DIR, "tokenizer");+-+const cleaned = Object.fromEntries(-+ Object.entries(entities).map(([k, v]) => [k.replace(/^&(.*?);?$/g, "$1"), v]),-+);++// Extension based on platform++const EXT =++ process.platform === "win32"++ ? ".dll"++ : process.platform === "darwin"++ ? ".dylib"++ : ".so";+-+function strcmp(a: string, b: string): number {-+ if (a < b) {-+ return -1;-+ } else if (a > b) {-+ return 1;-+ } else {-+ return 0;++// Set custom SQLite path if on macOS and env var is set++// if (process.platform === "darwin" && process.env.SQLITE_LIB_PATH)++// Database.setCustomSQLite(process.env.SQLITE_LIB_PATH);++++// Our tokenizer implementation++class HtmlTokenizer {++ private db: Database;++++ constructor() {++ this.db = new Database(":memory:");++ this.db.loadExtension(`./dist/fts5${EXT}`);++ this.db.loadExtension(`./dist/fts5-html${EXT}`);++++ // Create a test table with our HTML tokenizer++ this.db++ .query(++ `CREATE VIRTUAL TABLE test_html USING fts5(content, tokenize = 'html unicode61')`,++ )++ .run();++ // Create a test table with our HTML tokenizer++ this.db++ .query(++ `CREATE VIRTUAL TABLE test_html_vocab USING fts5vocab(test_html, 'instance')`,++ )++ .run();+ }-+}+-+const encoder = new TextEncoder();++ // Tokenize HTML content and return the tokens++ tokenize(html: string): string[] {++ // Insert the HTML content into our FTS5 table++ this.db.query(`INSERT INTO test_html VALUES(?)`).run(html);+-+const parts: string[] = [];++ // Use SQLite's built-in function to get the tokens++ const tokens = this.db++ .query(++ `++ SELECT term++ FROM test_html_vocab++ `,++ )++ .all() as { term: string }[];+-+parts.push(-+ `-+struct htmlEntity {-+ const char *pzName;-+ const char *pzUtf8;-+};-+typedef struct htmlEntity htmlEntity;++ // Clear the table for next test++ this.db.query(`DELETE FROM test_html`).run();+-+static const htmlEntity htmlEntities[] = {-+`.trim(),-+);++ return tokens.map((t) => t.term);++ }+-+for (const [name, { characters }] of Object.entries(cleaned).sort((a, b) =>-+ strcmp(a[0], b[0]),-+)) {-+ const hex = encoder.encode(characters);-+ const escaped = Array.from(hex)-+ .map((h) => "\\x" + h.toString(16).padStart(2, "0"))-+ .join("");-+ parts.push(`\t{"${name}", "${escaped}"},`);++ close() {++ this.db.close();++ }+}+-+parts.push(`-+ {0, 0}-+};++// Load and parse HTML5Lib test cases++async function loadHtml5LibTests(testFile: string): Promise<any> {++ const filePath = join(TOKENIZER_TESTS_DIR, testFile);++ const content = await readFile(filePath, "utf-8");++ return JSON.parse(content);++}+-+#define MAX_ENTITY_NAME_LENGTH ${Math.max(...Object.keys(cleaned).map((k) => k.length))}-+#define NUM_ENTITIES ${Object.keys(cleaned).length}-+`);++describe("HTML5Lib Tokenizer Tests", () => {++ let tokenizer = new HtmlTokenizer();+-+const input = await fs.readFile(FILENAME, "utf-8");-+let emit = true;-+const outputParts: string[] = [];++ afterAll(() => {++ tokenizer.close();++ });+-+for (let line of input.split("\n")) {-+ if (line.includes("/* START OF HTML ENTITIES */")) {-+ outputParts.push(line);-+ emit = false;-+ }-+ if (emit) {-+ outputParts.push(line);-+ }-+ if (line.includes("/* END OF HTML ENTITIES */")) {-+ emit = true;-+ outputParts.push(parts.join("\n"));-+ outputParts.push(line);-+ }-+}++ test("Basic HTML tokenization", () => {++ const html = "<p>Hello <b>World</b></p>";++ const tokens = tokenizer.tokenize(html);+-+await fs.writeFile(FILENAME, outputParts.join("\n"));-diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/sqlite-dist.toml b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/sqlite-dist.toml-new file mode 100755-index 0000000..eb5cbd7---- /dev/null-+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/sqlite-dist.toml-@@ -0,0 +1,14 @@-+[package]-+name = "sqlite3-fts5-html"-+license = "Public Domain"-+homepage = "https://github.com/streetwriters/sqlite3-fts5-html"-+repo = "https://github.com/streetwriters/sqlite3-fts5-html"-+description = "A pseudo tokenizer for SQLite3 FTS5 to strip HTML tags"-+authors = ["Abdullah Atta"]-+git_tag_format = "v$VERSION"++ expect(tokens).toContain("hello");++ expect(tokens).toContain("world");++ });+-+[targets]-+github_releases = {}-+amalgamation = {include=["fts5-html.c", "fts5-html.h"]}++ // Run selected HTML5Lib tests++ describe("HTML5Lib Test Suite", async () => {++ // Get all JSON test files from the HTML5Lib tokenizer tests directory++ const files = await readdir(TOKENIZER_TESTS_DIR);++ const testFiles = files.filter((file) => file.endsWith(".test"));+-+npm = {}++ if (testFiles.length === 0) {++ throw new Error(++ "No HTML5Lib test files found. Make sure the HTML5Lib repo is cloned to tests/html5lib",++ );++ } else {++ console.log(`Found ${testFiles.length} HTML5Lib tokenizer test files`);++ }++++ for (const testFile of testFiles) {++ const testData = await loadHtml5LibTests(testFile);++ if (!testData?.tests) {++ console.warn(`No tests found in: ${testFile}`);++ continue;++ }++++ describe(testFile, async () => {++ for (const testCase of testData.tests) {++ if (!testCase.input) continue;++ test(testCase.description, () => {++ // Tokenize the input HTML++ const tokens = tokenizer.tokenize(testCase.input);++++ // For HTML5Lib test cases, we're primarily checking that parsing completes++ // without errors. The specific output tokens will differ from the HTML5Lib++ // expected output since our tokenizer is designed for FTS indexing++ expect(tokens).toBeDefined();++ });++ }++ });++ }++ });++++ // Custom test cases that specifically test our tokenizer's behavior++ describe("Custom HTML Test Cases", () => {++ const testCases = [++ {++ name: "Entity decoding",++ html: "Text with & < > " ' entities",++ expectedTokens: ["text", "with", "entities"],++ },++ {++ name: "Script and style content exclusion",++ html: "<p>Visible text</p><script>var x = 'invisible';</script><style>body { display: none }</style>",++ expectedTokens: ["visible", "text"],++ unexpectedTokens: ["var", "invisible", "body", "display", "none"],++ },++ {++ name: "HTML comments",++ html: "<p>Text</p><!-- Comment should be ignored --><p>More text</p>",++ expectedTokens: ["text", "more", "text"],++ unexpectedTokens: ["comment", "should", "be", "ignored"],++ },++ {++ name: "Numeric entities",++ html: "ABC and ABC",++ expectedTokens: ["abc", "and", "abc"],++ },++ ];++++ for (const testCase of testCases) {++ test(testCase.name, () => {++ const tokens = tokenizer.tokenize(testCase.html);++++ if (testCase.expectedTokens) {++ for (const expected of testCase.expectedTokens) {++ expect(tokens).toContain(expected);++ }++ }++++ if (testCase.unexpectedTokens) {++ for (const unexpected of testCase.unexpectedTokens) {++ expect(tokens).not.toContain(unexpected);++ }++ }++ });++ }++ });++});