js packages

Orual 2ba2a4e8 02136a32

+10813 -1
+2 -1
crates/weaver-renderer-js/Cargo.toml
··· 4 4 edition.workspace = true 5 5 license.workspace = true 6 6 authors.workspace = true 7 + repository = "https://tangled.org/nonbinary.computer/weaver" 7 8 description = "WASM bindings for weaver-renderer" 8 9 9 10 [lib] 10 - crate-type = ["cdylib", "rlib"] 11 + crate-type = ["cdylib"] 11 12 12 13 [features] 13 14 default = ["syntax-highlighting"]
+1
crates/weaver-renderer-js/LICENSE
··· 1 + ../../LICENSE
+266
crates/weaver-renderer-js/build.sh
··· 1 + #!/usr/bin/env bash 2 + set -euo pipefail 3 + 4 + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 5 + cd "$SCRIPT_DIR" 6 + 7 + PKG_NAME="@weaver.sh/renderer" 8 + PKG_VERSION="0.1.1" 9 + 10 + # Targets to build 11 + TARGETS=(bundler web nodejs deno) 12 + 13 + COMMAND="${1:-build}" 14 + shift || true 15 + 16 + # Feature variants 17 + declare -A VARIANTS=( 18 + ["core"]="" 19 + ["full"]="syntax-highlighting" 20 + ) 21 + 22 + build() { 23 + local target="$1" 24 + local variant="$2" 25 + local features="$3" 26 + local out_dir="pkg/${variant}/${target}" 27 + 28 + echo "Building ${variant}/${target}..." 29 + 30 + local feature_args="" 31 + if [[ -n "$features" ]]; then 32 + feature_args="--features $features" 33 + fi 34 + 35 + wasm-pack build \ 36 + --out-name weaver_renderer \ 37 + --out-dir "$out_dir" \ 38 + --target "$target" \ 39 + --no-default-features \ 40 + $feature_args 41 + 42 + # Report size 43 + local wasm_file="${out_dir}/weaver_renderer_bg.wasm" 44 + if [[ -f "$wasm_file" ]]; then 45 + local size=$(ls -lh "$wasm_file" | awk '{print $5}') 46 + echo " → ${size}" 47 + fi 48 + } 49 + 50 + generate_package_json() { 51 + local variant="$1" 52 + local out_dir="pkg/${variant}" 53 + local description="AT Protocol record renderer (${variant})" 54 + 55 + if [[ "$variant" == "full" ]]; then 56 + description="AT Protocol record renderer with syntax highlighting" 57 + else 58 + description="AT Protocol record renderer (lightweight, no syntax highlighting)" 59 + fi 60 + 61 + cat > "${out_dir}/package.json" << EOF 62 + { 63 + "name": "${PKG_NAME}-${variant}", 64 + "version": "${PKG_VERSION}", 65 + "description": "${description}", 66 + "license": "MPL-2.0", 67 + "repository": { 68 + "type": "git", 69 + "url": "https://tangled.org/nonbinary.computer/weaver" 70 + }, 71 + "keywords": ["atproto", "bluesky", "markdown", "renderer", "wasm"], 72 + "main": "nodejs/weaver_renderer.js", 73 + "module": "bundler/weaver_renderer.js", 74 + "browser": "web/weaver_renderer.js", 75 + "types": "bundler/weaver_renderer.d.ts", 76 + "exports": { 77 + ".": { 78 + "deno": "./deno/weaver_renderer.js", 79 + "node": { 80 + "import": "./nodejs/weaver_renderer.js", 81 + "require": "./nodejs/weaver_renderer.js" 82 + }, 83 + "browser": { 84 + "import": "./web/weaver_renderer.js" 85 + }, 86 + "default": "./bundler/weaver_renderer.js" 87 + }, 88 + "./bundler": { 89 + "import": "./bundler/weaver_renderer.js", 90 + "types": "./bundler/weaver_renderer.d.ts" 91 + }, 92 + "./web": { 93 + "import": "./web/weaver_renderer.js", 94 + "types": "./web/weaver_renderer.d.ts" 95 + }, 96 + "./nodejs": { 97 + "import": "./nodejs/weaver_renderer.js", 98 + "require": "./nodejs/weaver_renderer.js", 99 + "types": "./nodejs/weaver_renderer.d.ts" 100 + }, 101 + "./deno": { 102 + "import": "./deno/weaver_renderer.js", 103 + "types": "./deno/weaver_renderer.d.ts" 104 + } 105 + }, 106 + "files": [ 107 + "bundler/", 108 + "web/", 109 + "nodejs/", 110 + "deno/", 111 + "README.md" 112 + ] 113 + } 114 + EOF 115 + } 116 + 117 + generate_readme() { 118 + local variant="$1" 119 + local out_dir="pkg/${variant}" 120 + 121 + cat > "${out_dir}/README.md" << 'EOF' 122 + # @weaver.sh/renderer 123 + 124 + WASM bindings for rendering AT Protocol records (Bluesky posts, etc.) to HTML. 125 + 126 + ## Installation 127 + 128 + ```bash 129 + npm install @weaver.sh/renderer-full # With syntax highlighting 130 + npm install @weaver.sh/renderer-core # Light(er) weight 131 + ``` 132 + 133 + ## Usage 134 + 135 + ### With a bundler (webpack, vite, etc.) 136 + 137 + ```javascript 138 + import init, { render_record, render_markdown } from '@weaver.sh/renderer-full'; 139 + 140 + await init(); 141 + 142 + const html = render_record(atUri, recordJson); 143 + ``` 144 + 145 + ### Direct browser usage (no bundler) 146 + 147 + ```html 148 + <script type="module"> 149 + import init, { render_record } from '@weaver.sh/renderer-full/web'; 150 + await init(); 151 + // ... 152 + </script> 153 + ``` 154 + 155 + ### Node.js 156 + 157 + ```javascript 158 + const { render_record } = require('@weaver.sh/renderer-full/nodejs'); 159 + ``` 160 + 161 + ## API 162 + 163 + - `render_record(at_uri, record_json, fallback_author?, resolved_content?)` - Render an AT Protocol record 164 + - `render_markdown(markdown, resolved_content?)` - Render markdown to HTML 165 + - `render_math(latex, display_mode)` - Render LaTeX math to MathML 166 + - `render_faceted_text(text, facets_json)` - Render rich text with facets 167 + EOF 168 + } 169 + 170 + do_build() { 171 + # Clean previous builds 172 + rm -rf pkg 173 + 174 + # Build all combinations 175 + for variant in "${!VARIANTS[@]}"; do 176 + features="${VARIANTS[$variant]}" 177 + 178 + for target in "${TARGETS[@]}"; do 179 + build "$target" "$variant" "$features" 180 + done 181 + 182 + generate_package_json "$variant" 183 + generate_readme "$variant" 184 + 185 + # Clean up wasm-pack artifacts we don't need 186 + find "pkg/${variant}" -name ".gitignore" -delete 187 + find "pkg/${variant}" -name "package.json" -path "*/bundler/*" -delete 188 + find "pkg/${variant}" -name "package.json" -path "*/web/*" -delete 189 + find "pkg/${variant}" -name "package.json" -path "*/nodejs/*" -delete 190 + find "pkg/${variant}" -name "package.json" -path "*/deno/*" -delete 191 + done 192 + 193 + echo "" 194 + echo "Build complete!" 195 + echo "" 196 + ls -lh pkg/core/web/*.wasm pkg/full/web/*.wasm 2>/dev/null || true 197 + echo "" 198 + echo "Packages:" 199 + echo " pkg/core/ - @weaver.sh/renderer-core (no syntax highlighting)" 200 + echo " pkg/full/ - @weaver.sh/renderer-full (with syntax highlighting)" 201 + } 202 + 203 + do_pack() { 204 + echo "Packing..." 205 + for variant in "${!VARIANTS[@]}"; do 206 + echo " ${variant}..." 207 + (cd "pkg/${variant}" && npm pack) 208 + done 209 + echo "" 210 + echo "Tarballs created:" 211 + ls -lh pkg/*/*.tgz 2>/dev/null || true 212 + } 213 + 214 + do_publish() { 215 + local tag="${1:-}" 216 + local tag_arg="" 217 + if [[ -n "$tag" ]]; then 218 + tag_arg="--tag $tag" 219 + fi 220 + 221 + echo "Publishing..." 222 + for variant in "${!VARIANTS[@]}"; do 223 + echo " ${variant}..." 224 + (cd "pkg/${variant}" && npm publish --access public $tag_arg) 225 + done 226 + echo "" 227 + echo "Published!" 228 + } 229 + 230 + usage() { 231 + echo "Usage: $0 [command]" 232 + echo "" 233 + echo "Commands:" 234 + echo " build Build all variants and targets (default)" 235 + echo " pack Create npm tarballs" 236 + echo " publish Publish to npm registry" 237 + echo " all Build, pack, and publish" 238 + echo "" 239 + echo "Options for publish:" 240 + echo " --tag <tag> Publish with a specific tag (e.g., 'next', 'beta')" 241 + } 242 + 243 + case "$COMMAND" in 244 + build) 245 + do_build 246 + ;; 247 + pack) 248 + do_pack 249 + ;; 250 + publish) 251 + do_publish "$@" 252 + ;; 253 + all) 254 + do_build 255 + do_pack 256 + do_publish "$@" 257 + ;; 258 + -h|--help|help) 259 + usage 260 + ;; 261 + *) 262 + echo "Unknown command: $COMMAND" 263 + usage 264 + exit 1 265 + ;; 266 + esac
+45
crates/weaver-renderer-js/pkg/core/README.md
··· 1 + # @weaver/renderer 2 + 3 + WASM bindings for rendering AT Protocol records (Bluesky posts, etc.) to HTML. 4 + 5 + ## Installation 6 + 7 + ```bash 8 + npm install @weaver.sh/renderer-full # With syntax highlighting 9 + npm install @weaver.sh/renderer-core # Light(er) weight 10 + ``` 11 + 12 + ## Usage 13 + 14 + ### With a bundler (webpack, vite, etc.) 15 + 16 + ```javascript 17 + import init, { render_record, render_markdown } from '@weaver/renderer-full'; 18 + 19 + await init(); 20 + 21 + const html = render_record(atUri, recordJson); 22 + ``` 23 + 24 + ### Direct browser usage (no bundler) 25 + 26 + ```html 27 + <script type="module"> 28 + import init, { render_record } from '@weaver/renderer-full/web'; 29 + await init(); 30 + // ... 31 + </script> 32 + ``` 33 + 34 + ### Node.js 35 + 36 + ```javascript 37 + const { render_record } = require('@weaver/renderer-full/nodejs'); 38 + ``` 39 + 40 + ## API 41 + 42 + - `render_record(at_uri, record_json, fallback_author?, resolved_content?)` - Render an AT Protocol record 43 + - `render_markdown(markdown, resolved_content?)` - Render markdown to HTML 44 + - `render_math(latex, display_mode)` - Render LaTeX math to MathML 45 + - `render_faceted_text(text, facets_json)` - Render rich text with facets
+373
crates/weaver-renderer-js/pkg/core/bundler/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+84
crates/weaver-renderer-js/pkg/core/bundler/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;
+5
crates/weaver-renderer-js/pkg/core/bundler/weaver_renderer.js
··· 1 + import * as wasm from "./weaver_renderer_bg.wasm"; 2 + export * from "./weaver_renderer_bg.js"; 3 + import { __wbg_set_wasm } from "./weaver_renderer_bg.js"; 4 + __wbg_set_wasm(wasm); 5 + wasm.__wbindgen_start();
+797
crates/weaver-renderer-js/pkg/core/bundler/weaver_renderer_bg.js
··· 1 + let wasm; 2 + export function __wbg_set_wasm(val) { 3 + wasm = val; 4 + } 5 + 6 + function addHeapObject(obj) { 7 + if (heap_next === heap.length) heap.push(heap.length + 1); 8 + const idx = heap_next; 9 + heap_next = heap[idx]; 10 + 11 + heap[idx] = obj; 12 + return idx; 13 + } 14 + 15 + function _assertClass(instance, klass) { 16 + if (!(instance instanceof klass)) { 17 + throw new Error(`expected instance of ${klass.name}`); 18 + } 19 + } 20 + 21 + function debugString(val) { 22 + // primitive types 23 + const type = typeof val; 24 + if (type == 'number' || type == 'boolean' || val == null) { 25 + return `${val}`; 26 + } 27 + if (type == 'string') { 28 + return `"${val}"`; 29 + } 30 + if (type == 'symbol') { 31 + const description = val.description; 32 + if (description == null) { 33 + return 'Symbol'; 34 + } else { 35 + return `Symbol(${description})`; 36 + } 37 + } 38 + if (type == 'function') { 39 + const name = val.name; 40 + if (typeof name == 'string' && name.length > 0) { 41 + return `Function(${name})`; 42 + } else { 43 + return 'Function'; 44 + } 45 + } 46 + // objects 47 + if (Array.isArray(val)) { 48 + const length = val.length; 49 + let debug = '['; 50 + if (length > 0) { 51 + debug += debugString(val[0]); 52 + } 53 + for(let i = 1; i < length; i++) { 54 + debug += ', ' + debugString(val[i]); 55 + } 56 + debug += ']'; 57 + return debug; 58 + } 59 + // Test for built-in 60 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 61 + let className; 62 + if (builtInMatches && builtInMatches.length > 1) { 63 + className = builtInMatches[1]; 64 + } else { 65 + // Failed to match the standard '[object ClassName]' 66 + return toString.call(val); 67 + } 68 + if (className == 'Object') { 69 + // we're a user defined class or Object 70 + // JSON.stringify avoids problems with cycles, and is generally much 71 + // easier than looping through ownProperties of `val`. 72 + try { 73 + return 'Object(' + JSON.stringify(val) + ')'; 74 + } catch (_) { 75 + return 'Object'; 76 + } 77 + } 78 + // errors 79 + if (val instanceof Error) { 80 + return `${val.name}: ${val.message}\n${val.stack}`; 81 + } 82 + // TODO we could test for more things here, like `Set`s and `Map`s. 83 + return className; 84 + } 85 + 86 + function dropObject(idx) { 87 + if (idx < 132) return; 88 + heap[idx] = heap_next; 89 + heap_next = idx; 90 + } 91 + 92 + function getArrayU8FromWasm0(ptr, len) { 93 + ptr = ptr >>> 0; 94 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 95 + } 96 + 97 + let cachedDataViewMemory0 = null; 98 + function getDataViewMemory0() { 99 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 100 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 101 + } 102 + return cachedDataViewMemory0; 103 + } 104 + 105 + function getStringFromWasm0(ptr, len) { 106 + ptr = ptr >>> 0; 107 + return decodeText(ptr, len); 108 + } 109 + 110 + let cachedUint8ArrayMemory0 = null; 111 + function getUint8ArrayMemory0() { 112 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 113 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 114 + } 115 + return cachedUint8ArrayMemory0; 116 + } 117 + 118 + function getObject(idx) { return heap[idx]; } 119 + 120 + function handleError(f, args) { 121 + try { 122 + return f.apply(this, args); 123 + } catch (e) { 124 + wasm.__wbindgen_export3(addHeapObject(e)); 125 + } 126 + } 127 + 128 + let heap = new Array(128).fill(undefined); 129 + heap.push(undefined, null, true, false); 130 + 131 + let heap_next = heap.length; 132 + 133 + function isLikeNone(x) { 134 + return x === undefined || x === null; 135 + } 136 + 137 + function passStringToWasm0(arg, malloc, realloc) { 138 + if (realloc === undefined) { 139 + const buf = cachedTextEncoder.encode(arg); 140 + const ptr = malloc(buf.length, 1) >>> 0; 141 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 142 + WASM_VECTOR_LEN = buf.length; 143 + return ptr; 144 + } 145 + 146 + let len = arg.length; 147 + let ptr = malloc(len, 1) >>> 0; 148 + 149 + const mem = getUint8ArrayMemory0(); 150 + 151 + let offset = 0; 152 + 153 + for (; offset < len; offset++) { 154 + const code = arg.charCodeAt(offset); 155 + if (code > 0x7F) break; 156 + mem[ptr + offset] = code; 157 + } 158 + if (offset !== len) { 159 + if (offset !== 0) { 160 + arg = arg.slice(offset); 161 + } 162 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 163 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 164 + const ret = cachedTextEncoder.encodeInto(arg, view); 165 + 166 + offset += ret.written; 167 + ptr = realloc(ptr, len, offset, 1) >>> 0; 168 + } 169 + 170 + WASM_VECTOR_LEN = offset; 171 + return ptr; 172 + } 173 + 174 + function takeObject(idx) { 175 + const ret = getObject(idx); 176 + dropObject(idx); 177 + return ret; 178 + } 179 + 180 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 181 + cachedTextDecoder.decode(); 182 + const MAX_SAFARI_DECODE_BYTES = 2146435072; 183 + let numBytesDecoded = 0; 184 + function decodeText(ptr, len) { 185 + numBytesDecoded += len; 186 + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { 187 + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 188 + cachedTextDecoder.decode(); 189 + numBytesDecoded = len; 190 + } 191 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 192 + } 193 + 194 + const cachedTextEncoder = new TextEncoder(); 195 + 196 + if (!('encodeInto' in cachedTextEncoder)) { 197 + cachedTextEncoder.encodeInto = function (arg, view) { 198 + const buf = cachedTextEncoder.encode(arg); 199 + view.set(buf); 200 + return { 201 + read: arg.length, 202 + written: buf.length 203 + }; 204 + } 205 + } 206 + 207 + let WASM_VECTOR_LEN = 0; 208 + 209 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 210 + ? { register: () => {}, unregister: () => {} } 211 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 212 + 213 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 214 + ? { register: () => {}, unregister: () => {} } 215 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 216 + 217 + /** 218 + * Result from rendering LaTeX math. 219 + */ 220 + export class JsMathResult { 221 + static __wrap(ptr) { 222 + ptr = ptr >>> 0; 223 + const obj = Object.create(JsMathResult.prototype); 224 + obj.__wbg_ptr = ptr; 225 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 226 + return obj; 227 + } 228 + __destroy_into_raw() { 229 + const ptr = this.__wbg_ptr; 230 + this.__wbg_ptr = 0; 231 + JsMathResultFinalization.unregister(this); 232 + return ptr; 233 + } 234 + free() { 235 + const ptr = this.__destroy_into_raw(); 236 + wasm.__wbg_jsmathresult_free(ptr, 0); 237 + } 238 + /** 239 + * @returns {boolean} 240 + */ 241 + get success() { 242 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 243 + return ret !== 0; 244 + } 245 + /** 246 + * @param {boolean} arg0 247 + */ 248 + set success(arg0) { 249 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 250 + } 251 + /** 252 + * @returns {string} 253 + */ 254 + get html() { 255 + let deferred1_0; 256 + let deferred1_1; 257 + try { 258 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 259 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 260 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 261 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 262 + deferred1_0 = r0; 263 + deferred1_1 = r1; 264 + return getStringFromWasm0(r0, r1); 265 + } finally { 266 + wasm.__wbindgen_add_to_stack_pointer(16); 267 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 268 + } 269 + } 270 + /** 271 + * @param {string} arg0 272 + */ 273 + set html(arg0) { 274 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 275 + const len0 = WASM_VECTOR_LEN; 276 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 277 + } 278 + /** 279 + * @returns {string | undefined} 280 + */ 281 + get error() { 282 + try { 283 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 284 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 285 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 286 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 287 + let v1; 288 + if (r0 !== 0) { 289 + v1 = getStringFromWasm0(r0, r1).slice(); 290 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 291 + } 292 + return v1; 293 + } finally { 294 + wasm.__wbindgen_add_to_stack_pointer(16); 295 + } 296 + } 297 + /** 298 + * @param {string | null} [arg0] 299 + */ 300 + set error(arg0) { 301 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 302 + var len0 = WASM_VECTOR_LEN; 303 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 304 + } 305 + } 306 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 307 + 308 + /** 309 + * Pre-rendered embed content for synchronous rendering. 310 + * 311 + * Build this by calling `create_resolved_content()` and adding embeds 312 + * with `resolved_content_add_embed()`. 313 + */ 314 + export class JsResolvedContent { 315 + static __wrap(ptr) { 316 + ptr = ptr >>> 0; 317 + const obj = Object.create(JsResolvedContent.prototype); 318 + obj.__wbg_ptr = ptr; 319 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 320 + return obj; 321 + } 322 + __destroy_into_raw() { 323 + const ptr = this.__wbg_ptr; 324 + this.__wbg_ptr = 0; 325 + JsResolvedContentFinalization.unregister(this); 326 + return ptr; 327 + } 328 + free() { 329 + const ptr = this.__destroy_into_raw(); 330 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 331 + } 332 + /** 333 + * Create an empty resolved content container. 334 + */ 335 + constructor() { 336 + const ret = wasm.create_resolved_content(); 337 + this.__wbg_ptr = ret >>> 0; 338 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 339 + return this; 340 + } 341 + /** 342 + * Add pre-rendered embed HTML for an AT URI. 343 + * 344 + * # Arguments 345 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 346 + * * `html` - The pre-rendered HTML for this embed 347 + * @param {string} at_uri 348 + * @param {string} html 349 + */ 350 + addEmbed(at_uri, html) { 351 + try { 352 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 353 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 354 + const len0 = WASM_VECTOR_LEN; 355 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 356 + const len1 = WASM_VECTOR_LEN; 357 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 358 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 359 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 360 + if (r1) { 361 + throw takeObject(r0); 362 + } 363 + } finally { 364 + wasm.__wbindgen_add_to_stack_pointer(16); 365 + } 366 + } 367 + } 368 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 369 + 370 + /** 371 + * Create an empty resolved content container. 372 + * 373 + * Use this to pre-render embeds before calling render functions. 374 + * @returns {JsResolvedContent} 375 + */ 376 + export function create_resolved_content() { 377 + const ret = wasm.create_resolved_content(); 378 + return JsResolvedContent.__wrap(ret); 379 + } 380 + 381 + /** 382 + * Initialize panic hook for better error messages in console. 383 + */ 384 + export function init() { 385 + wasm.init(); 386 + } 387 + 388 + /** 389 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 390 + * 391 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 392 + * 393 + * # Arguments 394 + * * `text` - The plain text content 395 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 396 + * @param {string} text 397 + * @param {any} facets_json 398 + * @returns {string} 399 + */ 400 + export function render_faceted_text(text, facets_json) { 401 + let deferred3_0; 402 + let deferred3_1; 403 + try { 404 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 405 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 406 + const len0 = WASM_VECTOR_LEN; 407 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 408 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 409 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 410 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 411 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 412 + var ptr2 = r0; 413 + var len2 = r1; 414 + if (r3) { 415 + ptr2 = 0; len2 = 0; 416 + throw takeObject(r2); 417 + } 418 + deferred3_0 = ptr2; 419 + deferred3_1 = len2; 420 + return getStringFromWasm0(ptr2, len2); 421 + } finally { 422 + wasm.__wbindgen_add_to_stack_pointer(16); 423 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 424 + } 425 + } 426 + 427 + /** 428 + * Render markdown to HTML. 429 + * 430 + * # Arguments 431 + * * `markdown` - The markdown source text 432 + * * `resolved_content` - Optional pre-rendered embed content 433 + * @param {string} markdown 434 + * @param {JsResolvedContent | null} [resolved_content] 435 + * @returns {string} 436 + */ 437 + export function render_markdown(markdown, resolved_content) { 438 + let deferred4_0; 439 + let deferred4_1; 440 + try { 441 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 442 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 443 + const len0 = WASM_VECTOR_LEN; 444 + let ptr1 = 0; 445 + if (!isLikeNone(resolved_content)) { 446 + _assertClass(resolved_content, JsResolvedContent); 447 + ptr1 = resolved_content.__destroy_into_raw(); 448 + } 449 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 450 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 451 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 452 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 453 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 454 + var ptr3 = r0; 455 + var len3 = r1; 456 + if (r3) { 457 + ptr3 = 0; len3 = 0; 458 + throw takeObject(r2); 459 + } 460 + deferred4_0 = ptr3; 461 + deferred4_1 = len3; 462 + return getStringFromWasm0(ptr3, len3); 463 + } finally { 464 + wasm.__wbindgen_add_to_stack_pointer(16); 465 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 466 + } 467 + } 468 + 469 + /** 470 + * Render LaTeX math to MathML. 471 + * 472 + * # Arguments 473 + * * `latex` - The LaTeX math expression 474 + * * `display_mode` - true for display math (block), false for inline math 475 + * @param {string} latex 476 + * @param {boolean} display_mode 477 + * @returns {JsMathResult} 478 + */ 479 + export function render_math(latex, display_mode) { 480 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 481 + const len0 = WASM_VECTOR_LEN; 482 + const ret = wasm.render_math(ptr0, len0, display_mode); 483 + return JsMathResult.__wrap(ret); 484 + } 485 + 486 + /** 487 + * Render an AT Protocol record as HTML. 488 + * 489 + * Takes a record URI and the record data (typically fetched from an appview). 490 + * Returns the rendered HTML string. 491 + * 492 + * # Arguments 493 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 494 + * * `record_json` - The record data as JSON 495 + * * `fallback_author` - Optional author profile for records that don't include author info 496 + * * `resolved_content` - Optional pre-rendered embed content 497 + * @param {string} at_uri 498 + * @param {any} record_json 499 + * @param {any | null} [fallback_author] 500 + * @param {JsResolvedContent | null} [resolved_content] 501 + * @returns {string} 502 + */ 503 + export function render_record(at_uri, record_json, fallback_author, resolved_content) { 504 + let deferred4_0; 505 + let deferred4_1; 506 + try { 507 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 508 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 509 + const len0 = WASM_VECTOR_LEN; 510 + let ptr1 = 0; 511 + if (!isLikeNone(resolved_content)) { 512 + _assertClass(resolved_content, JsResolvedContent); 513 + ptr1 = resolved_content.__destroy_into_raw(); 514 + } 515 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 516 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 517 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 518 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 519 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 520 + var ptr3 = r0; 521 + var len3 = r1; 522 + if (r3) { 523 + ptr3 = 0; len3 = 0; 524 + throw takeObject(r2); 525 + } 526 + deferred4_0 = ptr3; 527 + deferred4_1 = len3; 528 + return getStringFromWasm0(ptr3, len3); 529 + } finally { 530 + wasm.__wbindgen_add_to_stack_pointer(16); 531 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 532 + } 533 + } 534 + 535 + export function __wbg_Error_52673b7de5a0ca89(arg0, arg1) { 536 + const ret = Error(getStringFromWasm0(arg0, arg1)); 537 + return addHeapObject(ret); 538 + }; 539 + 540 + export function __wbg_Number_2d1dcfcf4ec51736(arg0) { 541 + const ret = Number(getObject(arg0)); 542 + return ret; 543 + }; 544 + 545 + export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) { 546 + const ret = String(getObject(arg1)); 547 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 548 + const len1 = WASM_VECTOR_LEN; 549 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 550 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 551 + }; 552 + 553 + export function __wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d(arg0, arg1) { 554 + const v = getObject(arg1); 555 + const ret = typeof(v) === 'bigint' ? v : undefined; 556 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 557 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 558 + }; 559 + 560 + export function __wbg___wbindgen_boolean_get_dea25b33882b895b(arg0) { 561 + const v = getObject(arg0); 562 + const ret = typeof(v) === 'boolean' ? v : undefined; 563 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 564 + }; 565 + 566 + export function __wbg___wbindgen_debug_string_adfb662ae34724b6(arg0, arg1) { 567 + const ret = debugString(getObject(arg1)); 568 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 569 + const len1 = WASM_VECTOR_LEN; 570 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 571 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 572 + }; 573 + 574 + export function __wbg___wbindgen_in_0d3e1e8f0c669317(arg0, arg1) { 575 + const ret = getObject(arg0) in getObject(arg1); 576 + return ret; 577 + }; 578 + 579 + export function __wbg___wbindgen_is_bigint_0e1a2e3f55cfae27(arg0) { 580 + const ret = typeof(getObject(arg0)) === 'bigint'; 581 + return ret; 582 + }; 583 + 584 + export function __wbg___wbindgen_is_function_8d400b8b1af978cd(arg0) { 585 + const ret = typeof(getObject(arg0)) === 'function'; 586 + return ret; 587 + }; 588 + 589 + export function __wbg___wbindgen_is_object_ce774f3490692386(arg0) { 590 + const val = getObject(arg0); 591 + const ret = typeof(val) === 'object' && val !== null; 592 + return ret; 593 + }; 594 + 595 + export function __wbg___wbindgen_is_undefined_f6b95eab589e0269(arg0) { 596 + const ret = getObject(arg0) === undefined; 597 + return ret; 598 + }; 599 + 600 + export function __wbg___wbindgen_jsval_eq_b6101cc9cef1fe36(arg0, arg1) { 601 + const ret = getObject(arg0) === getObject(arg1); 602 + return ret; 603 + }; 604 + 605 + export function __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d(arg0, arg1) { 606 + const ret = getObject(arg0) == getObject(arg1); 607 + return ret; 608 + }; 609 + 610 + export function __wbg___wbindgen_number_get_9619185a74197f95(arg0, arg1) { 611 + const obj = getObject(arg1); 612 + const ret = typeof(obj) === 'number' ? obj : undefined; 613 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 614 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 615 + }; 616 + 617 + export function __wbg___wbindgen_string_get_a2a31e16edf96e42(arg0, arg1) { 618 + const obj = getObject(arg1); 619 + const ret = typeof(obj) === 'string' ? obj : undefined; 620 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 621 + var len1 = WASM_VECTOR_LEN; 622 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 623 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 624 + }; 625 + 626 + export function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) { 627 + throw new Error(getStringFromWasm0(arg0, arg1)); 628 + }; 629 + 630 + export function __wbg_call_abb4ff46ce38be40() { return handleError(function (arg0, arg1) { 631 + const ret = getObject(arg0).call(getObject(arg1)); 632 + return addHeapObject(ret); 633 + }, arguments) }; 634 + 635 + export function __wbg_done_62ea16af4ce34b24(arg0) { 636 + const ret = getObject(arg0).done; 637 + return ret; 638 + }; 639 + 640 + export function __wbg_entries_83c79938054e065f(arg0) { 641 + const ret = Object.entries(getObject(arg0)); 642 + return addHeapObject(ret); 643 + }; 644 + 645 + export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) { 646 + let deferred0_0; 647 + let deferred0_1; 648 + try { 649 + deferred0_0 = arg0; 650 + deferred0_1 = arg1; 651 + console.error(getStringFromWasm0(arg0, arg1)); 652 + } finally { 653 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 654 + } 655 + }; 656 + 657 + export function __wbg_get_6b7bd52aca3f9671(arg0, arg1) { 658 + const ret = getObject(arg0)[arg1 >>> 0]; 659 + return addHeapObject(ret); 660 + }; 661 + 662 + export function __wbg_get_af9dab7e9603ea93() { return handleError(function (arg0, arg1) { 663 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 664 + return addHeapObject(ret); 665 + }, arguments) }; 666 + 667 + export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) { 668 + const ret = getObject(arg0)[getObject(arg1)]; 669 + return addHeapObject(ret); 670 + }; 671 + 672 + export function __wbg_instanceof_ArrayBuffer_f3320d2419cd0355(arg0) { 673 + let result; 674 + try { 675 + result = getObject(arg0) instanceof ArrayBuffer; 676 + } catch (_) { 677 + result = false; 678 + } 679 + const ret = result; 680 + return ret; 681 + }; 682 + 683 + export function __wbg_instanceof_Map_084be8da74364158(arg0) { 684 + let result; 685 + try { 686 + result = getObject(arg0) instanceof Map; 687 + } catch (_) { 688 + result = false; 689 + } 690 + const ret = result; 691 + return ret; 692 + }; 693 + 694 + export function __wbg_instanceof_Uint8Array_da54ccc9d3e09434(arg0) { 695 + let result; 696 + try { 697 + result = getObject(arg0) instanceof Uint8Array; 698 + } catch (_) { 699 + result = false; 700 + } 701 + const ret = result; 702 + return ret; 703 + }; 704 + 705 + export function __wbg_isArray_51fd9e6422c0a395(arg0) { 706 + const ret = Array.isArray(getObject(arg0)); 707 + return ret; 708 + }; 709 + 710 + export function __wbg_isSafeInteger_ae7d3f054d55fa16(arg0) { 711 + const ret = Number.isSafeInteger(getObject(arg0)); 712 + return ret; 713 + }; 714 + 715 + export function __wbg_iterator_27b7c8b35ab3e86b() { 716 + const ret = Symbol.iterator; 717 + return addHeapObject(ret); 718 + }; 719 + 720 + export function __wbg_length_22ac23eaec9d8053(arg0) { 721 + const ret = getObject(arg0).length; 722 + return ret; 723 + }; 724 + 725 + export function __wbg_length_d45040a40c570362(arg0) { 726 + const ret = getObject(arg0).length; 727 + return ret; 728 + }; 729 + 730 + export function __wbg_new_6421f6084cc5bc5a(arg0) { 731 + const ret = new Uint8Array(getObject(arg0)); 732 + return addHeapObject(ret); 733 + }; 734 + 735 + export function __wbg_new_8a6f238a6ece86ea() { 736 + const ret = new Error(); 737 + return addHeapObject(ret); 738 + }; 739 + 740 + export function __wbg_next_138a17bbf04e926c(arg0) { 741 + const ret = getObject(arg0).next; 742 + return addHeapObject(ret); 743 + }; 744 + 745 + export function __wbg_next_3cfe5c0fe2a4cc53() { return handleError(function (arg0) { 746 + const ret = getObject(arg0).next(); 747 + return addHeapObject(ret); 748 + }, arguments) }; 749 + 750 + export function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0, arg1, arg2) { 751 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 752 + }; 753 + 754 + export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) { 755 + const ret = getObject(arg1).stack; 756 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 757 + const len1 = WASM_VECTOR_LEN; 758 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 759 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 760 + }; 761 + 762 + export function __wbg_value_57b7b035e117f7ee(arg0) { 763 + const ret = getObject(arg0).value; 764 + return addHeapObject(ret); 765 + }; 766 + 767 + export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) { 768 + // Cast intrinsic for `Ref(String) -> Externref`. 769 + const ret = getStringFromWasm0(arg0, arg1); 770 + return addHeapObject(ret); 771 + }; 772 + 773 + export function __wbindgen_cast_4625c577ab2ec9ee(arg0) { 774 + // Cast intrinsic for `U64 -> Externref`. 775 + const ret = BigInt.asUintN(64, arg0); 776 + return addHeapObject(ret); 777 + }; 778 + 779 + export function __wbindgen_cast_9ae0607507abb057(arg0) { 780 + // Cast intrinsic for `I64 -> Externref`. 781 + const ret = arg0; 782 + return addHeapObject(ret); 783 + }; 784 + 785 + export function __wbindgen_object_clone_ref(arg0) { 786 + const ret = getObject(arg0); 787 + return addHeapObject(ret); 788 + }; 789 + 790 + export function __wbindgen_object_drop_ref(arg0) { 791 + takeObject(arg0); 792 + }; 793 + 794 + export function __wbindgen_object_is_undefined(arg0) { 795 + const ret = getObject(arg0) === undefined; 796 + return ret; 797 + };
+25
crates/weaver-renderer-js/pkg/core/bundler/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+373
crates/weaver-renderer-js/pkg/core/deno/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+84
crates/weaver-renderer-js/pkg/core/deno/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;
+743
crates/weaver-renderer-js/pkg/core/deno/weaver_renderer.js
··· 1 + 2 + 3 + function addHeapObject(obj) { 4 + if (heap_next === heap.length) heap.push(heap.length + 1); 5 + const idx = heap_next; 6 + heap_next = heap[idx]; 7 + 8 + heap[idx] = obj; 9 + return idx; 10 + } 11 + 12 + function _assertClass(instance, klass) { 13 + if (!(instance instanceof klass)) { 14 + throw new Error(`expected instance of ${klass.name}`); 15 + } 16 + } 17 + 18 + function debugString(val) { 19 + // primitive types 20 + const type = typeof val; 21 + if (type == 'number' || type == 'boolean' || val == null) { 22 + return `${val}`; 23 + } 24 + if (type == 'string') { 25 + return `"${val}"`; 26 + } 27 + if (type == 'symbol') { 28 + const description = val.description; 29 + if (description == null) { 30 + return 'Symbol'; 31 + } else { 32 + return `Symbol(${description})`; 33 + } 34 + } 35 + if (type == 'function') { 36 + const name = val.name; 37 + if (typeof name == 'string' && name.length > 0) { 38 + return `Function(${name})`; 39 + } else { 40 + return 'Function'; 41 + } 42 + } 43 + // objects 44 + if (Array.isArray(val)) { 45 + const length = val.length; 46 + let debug = '['; 47 + if (length > 0) { 48 + debug += debugString(val[0]); 49 + } 50 + for(let i = 1; i < length; i++) { 51 + debug += ', ' + debugString(val[i]); 52 + } 53 + debug += ']'; 54 + return debug; 55 + } 56 + // Test for built-in 57 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 58 + let className; 59 + if (builtInMatches && builtInMatches.length > 1) { 60 + className = builtInMatches[1]; 61 + } else { 62 + // Failed to match the standard '[object ClassName]' 63 + return toString.call(val); 64 + } 65 + if (className == 'Object') { 66 + // we're a user defined class or Object 67 + // JSON.stringify avoids problems with cycles, and is generally much 68 + // easier than looping through ownProperties of `val`. 69 + try { 70 + return 'Object(' + JSON.stringify(val) + ')'; 71 + } catch (_) { 72 + return 'Object'; 73 + } 74 + } 75 + // errors 76 + if (val instanceof Error) { 77 + return `${val.name}: ${val.message}\n${val.stack}`; 78 + } 79 + // TODO we could test for more things here, like `Set`s and `Map`s. 80 + return className; 81 + } 82 + 83 + function dropObject(idx) { 84 + if (idx < 132) return; 85 + heap[idx] = heap_next; 86 + heap_next = idx; 87 + } 88 + 89 + function getArrayU8FromWasm0(ptr, len) { 90 + ptr = ptr >>> 0; 91 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 92 + } 93 + 94 + let cachedDataViewMemory0 = null; 95 + function getDataViewMemory0() { 96 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 97 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 98 + } 99 + return cachedDataViewMemory0; 100 + } 101 + 102 + function getStringFromWasm0(ptr, len) { 103 + ptr = ptr >>> 0; 104 + return decodeText(ptr, len); 105 + } 106 + 107 + let cachedUint8ArrayMemory0 = null; 108 + function getUint8ArrayMemory0() { 109 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 110 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 111 + } 112 + return cachedUint8ArrayMemory0; 113 + } 114 + 115 + function getObject(idx) { return heap[idx]; } 116 + 117 + function handleError(f, args) { 118 + try { 119 + return f.apply(this, args); 120 + } catch (e) { 121 + wasm.__wbindgen_export3(addHeapObject(e)); 122 + } 123 + } 124 + 125 + let heap = new Array(128).fill(undefined); 126 + heap.push(undefined, null, true, false); 127 + 128 + let heap_next = heap.length; 129 + 130 + function isLikeNone(x) { 131 + return x === undefined || x === null; 132 + } 133 + 134 + function passStringToWasm0(arg, malloc, realloc) { 135 + if (realloc === undefined) { 136 + const buf = cachedTextEncoder.encode(arg); 137 + const ptr = malloc(buf.length, 1) >>> 0; 138 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 139 + WASM_VECTOR_LEN = buf.length; 140 + return ptr; 141 + } 142 + 143 + let len = arg.length; 144 + let ptr = malloc(len, 1) >>> 0; 145 + 146 + const mem = getUint8ArrayMemory0(); 147 + 148 + let offset = 0; 149 + 150 + for (; offset < len; offset++) { 151 + const code = arg.charCodeAt(offset); 152 + if (code > 0x7F) break; 153 + mem[ptr + offset] = code; 154 + } 155 + if (offset !== len) { 156 + if (offset !== 0) { 157 + arg = arg.slice(offset); 158 + } 159 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 160 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 161 + const ret = cachedTextEncoder.encodeInto(arg, view); 162 + 163 + offset += ret.written; 164 + ptr = realloc(ptr, len, offset, 1) >>> 0; 165 + } 166 + 167 + WASM_VECTOR_LEN = offset; 168 + return ptr; 169 + } 170 + 171 + function takeObject(idx) { 172 + const ret = getObject(idx); 173 + dropObject(idx); 174 + return ret; 175 + } 176 + 177 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 178 + cachedTextDecoder.decode(); 179 + function decodeText(ptr, len) { 180 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 181 + } 182 + 183 + const cachedTextEncoder = new TextEncoder(); 184 + 185 + let WASM_VECTOR_LEN = 0; 186 + 187 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 188 + ? { register: () => {}, unregister: () => {} } 189 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 190 + 191 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 192 + ? { register: () => {}, unregister: () => {} } 193 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 194 + 195 + /** 196 + * Result from rendering LaTeX math. 197 + */ 198 + export class JsMathResult { 199 + static __wrap(ptr) { 200 + ptr = ptr >>> 0; 201 + const obj = Object.create(JsMathResult.prototype); 202 + obj.__wbg_ptr = ptr; 203 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 204 + return obj; 205 + } 206 + __destroy_into_raw() { 207 + const ptr = this.__wbg_ptr; 208 + this.__wbg_ptr = 0; 209 + JsMathResultFinalization.unregister(this); 210 + return ptr; 211 + } 212 + free() { 213 + const ptr = this.__destroy_into_raw(); 214 + wasm.__wbg_jsmathresult_free(ptr, 0); 215 + } 216 + /** 217 + * @returns {boolean} 218 + */ 219 + get success() { 220 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 221 + return ret !== 0; 222 + } 223 + /** 224 + * @param {boolean} arg0 225 + */ 226 + set success(arg0) { 227 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 228 + } 229 + /** 230 + * @returns {string} 231 + */ 232 + get html() { 233 + let deferred1_0; 234 + let deferred1_1; 235 + try { 236 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 237 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 238 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 239 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 240 + deferred1_0 = r0; 241 + deferred1_1 = r1; 242 + return getStringFromWasm0(r0, r1); 243 + } finally { 244 + wasm.__wbindgen_add_to_stack_pointer(16); 245 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 246 + } 247 + } 248 + /** 249 + * @param {string} arg0 250 + */ 251 + set html(arg0) { 252 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 253 + const len0 = WASM_VECTOR_LEN; 254 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 255 + } 256 + /** 257 + * @returns {string | undefined} 258 + */ 259 + get error() { 260 + try { 261 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 262 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 263 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 264 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 265 + let v1; 266 + if (r0 !== 0) { 267 + v1 = getStringFromWasm0(r0, r1).slice(); 268 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 269 + } 270 + return v1; 271 + } finally { 272 + wasm.__wbindgen_add_to_stack_pointer(16); 273 + } 274 + } 275 + /** 276 + * @param {string | null} [arg0] 277 + */ 278 + set error(arg0) { 279 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 280 + var len0 = WASM_VECTOR_LEN; 281 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 282 + } 283 + } 284 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 285 + 286 + /** 287 + * Pre-rendered embed content for synchronous rendering. 288 + * 289 + * Build this by calling `create_resolved_content()` and adding embeds 290 + * with `resolved_content_add_embed()`. 291 + */ 292 + export class JsResolvedContent { 293 + static __wrap(ptr) { 294 + ptr = ptr >>> 0; 295 + const obj = Object.create(JsResolvedContent.prototype); 296 + obj.__wbg_ptr = ptr; 297 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 298 + return obj; 299 + } 300 + __destroy_into_raw() { 301 + const ptr = this.__wbg_ptr; 302 + this.__wbg_ptr = 0; 303 + JsResolvedContentFinalization.unregister(this); 304 + return ptr; 305 + } 306 + free() { 307 + const ptr = this.__destroy_into_raw(); 308 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 309 + } 310 + /** 311 + * Create an empty resolved content container. 312 + */ 313 + constructor() { 314 + const ret = wasm.create_resolved_content(); 315 + this.__wbg_ptr = ret >>> 0; 316 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 317 + return this; 318 + } 319 + /** 320 + * Add pre-rendered embed HTML for an AT URI. 321 + * 322 + * # Arguments 323 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 324 + * * `html` - The pre-rendered HTML for this embed 325 + * @param {string} at_uri 326 + * @param {string} html 327 + */ 328 + addEmbed(at_uri, html) { 329 + try { 330 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 331 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 332 + const len0 = WASM_VECTOR_LEN; 333 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 334 + const len1 = WASM_VECTOR_LEN; 335 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 336 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 337 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 338 + if (r1) { 339 + throw takeObject(r0); 340 + } 341 + } finally { 342 + wasm.__wbindgen_add_to_stack_pointer(16); 343 + } 344 + } 345 + } 346 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 347 + 348 + /** 349 + * Create an empty resolved content container. 350 + * 351 + * Use this to pre-render embeds before calling render functions. 352 + * @returns {JsResolvedContent} 353 + */ 354 + export function create_resolved_content() { 355 + const ret = wasm.create_resolved_content(); 356 + return JsResolvedContent.__wrap(ret); 357 + } 358 + 359 + /** 360 + * Initialize panic hook for better error messages in console. 361 + */ 362 + export function init() { 363 + wasm.init(); 364 + } 365 + 366 + /** 367 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 368 + * 369 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 370 + * 371 + * # Arguments 372 + * * `text` - The plain text content 373 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 374 + * @param {string} text 375 + * @param {any} facets_json 376 + * @returns {string} 377 + */ 378 + export function render_faceted_text(text, facets_json) { 379 + let deferred3_0; 380 + let deferred3_1; 381 + try { 382 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 383 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 384 + const len0 = WASM_VECTOR_LEN; 385 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 386 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 387 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 388 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 389 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 390 + var ptr2 = r0; 391 + var len2 = r1; 392 + if (r3) { 393 + ptr2 = 0; len2 = 0; 394 + throw takeObject(r2); 395 + } 396 + deferred3_0 = ptr2; 397 + deferred3_1 = len2; 398 + return getStringFromWasm0(ptr2, len2); 399 + } finally { 400 + wasm.__wbindgen_add_to_stack_pointer(16); 401 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 402 + } 403 + } 404 + 405 + /** 406 + * Render markdown to HTML. 407 + * 408 + * # Arguments 409 + * * `markdown` - The markdown source text 410 + * * `resolved_content` - Optional pre-rendered embed content 411 + * @param {string} markdown 412 + * @param {JsResolvedContent | null} [resolved_content] 413 + * @returns {string} 414 + */ 415 + export function render_markdown(markdown, resolved_content) { 416 + let deferred4_0; 417 + let deferred4_1; 418 + try { 419 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 420 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 421 + const len0 = WASM_VECTOR_LEN; 422 + let ptr1 = 0; 423 + if (!isLikeNone(resolved_content)) { 424 + _assertClass(resolved_content, JsResolvedContent); 425 + ptr1 = resolved_content.__destroy_into_raw(); 426 + } 427 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 428 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 429 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 430 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 431 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 432 + var ptr3 = r0; 433 + var len3 = r1; 434 + if (r3) { 435 + ptr3 = 0; len3 = 0; 436 + throw takeObject(r2); 437 + } 438 + deferred4_0 = ptr3; 439 + deferred4_1 = len3; 440 + return getStringFromWasm0(ptr3, len3); 441 + } finally { 442 + wasm.__wbindgen_add_to_stack_pointer(16); 443 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 444 + } 445 + } 446 + 447 + /** 448 + * Render LaTeX math to MathML. 449 + * 450 + * # Arguments 451 + * * `latex` - The LaTeX math expression 452 + * * `display_mode` - true for display math (block), false for inline math 453 + * @param {string} latex 454 + * @param {boolean} display_mode 455 + * @returns {JsMathResult} 456 + */ 457 + export function render_math(latex, display_mode) { 458 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 459 + const len0 = WASM_VECTOR_LEN; 460 + const ret = wasm.render_math(ptr0, len0, display_mode); 461 + return JsMathResult.__wrap(ret); 462 + } 463 + 464 + /** 465 + * Render an AT Protocol record as HTML. 466 + * 467 + * Takes a record URI and the record data (typically fetched from an appview). 468 + * Returns the rendered HTML string. 469 + * 470 + * # Arguments 471 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 472 + * * `record_json` - The record data as JSON 473 + * * `fallback_author` - Optional author profile for records that don't include author info 474 + * * `resolved_content` - Optional pre-rendered embed content 475 + * @param {string} at_uri 476 + * @param {any} record_json 477 + * @param {any | null} [fallback_author] 478 + * @param {JsResolvedContent | null} [resolved_content] 479 + * @returns {string} 480 + */ 481 + export function render_record(at_uri, record_json, fallback_author, resolved_content) { 482 + let deferred4_0; 483 + let deferred4_1; 484 + try { 485 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 486 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 487 + const len0 = WASM_VECTOR_LEN; 488 + let ptr1 = 0; 489 + if (!isLikeNone(resolved_content)) { 490 + _assertClass(resolved_content, JsResolvedContent); 491 + ptr1 = resolved_content.__destroy_into_raw(); 492 + } 493 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 494 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 495 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 496 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 497 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 498 + var ptr3 = r0; 499 + var len3 = r1; 500 + if (r3) { 501 + ptr3 = 0; len3 = 0; 502 + throw takeObject(r2); 503 + } 504 + deferred4_0 = ptr3; 505 + deferred4_1 = len3; 506 + return getStringFromWasm0(ptr3, len3); 507 + } finally { 508 + wasm.__wbindgen_add_to_stack_pointer(16); 509 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 510 + } 511 + } 512 + 513 + const imports = { 514 + __wbindgen_placeholder__: { 515 + __wbg_Error_52673b7de5a0ca89: function(arg0, arg1) { 516 + const ret = Error(getStringFromWasm0(arg0, arg1)); 517 + return addHeapObject(ret); 518 + }, 519 + __wbg_Number_2d1dcfcf4ec51736: function(arg0) { 520 + const ret = Number(getObject(arg0)); 521 + return ret; 522 + }, 523 + __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) { 524 + const ret = String(getObject(arg1)); 525 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 526 + const len1 = WASM_VECTOR_LEN; 527 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 528 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 529 + }, 530 + __wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d: function(arg0, arg1) { 531 + const v = getObject(arg1); 532 + const ret = typeof(v) === 'bigint' ? v : undefined; 533 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 534 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 535 + }, 536 + __wbg___wbindgen_boolean_get_dea25b33882b895b: function(arg0) { 537 + const v = getObject(arg0); 538 + const ret = typeof(v) === 'boolean' ? v : undefined; 539 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 540 + }, 541 + __wbg___wbindgen_debug_string_adfb662ae34724b6: function(arg0, arg1) { 542 + const ret = debugString(getObject(arg1)); 543 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 544 + const len1 = WASM_VECTOR_LEN; 545 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 546 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 547 + }, 548 + __wbg___wbindgen_in_0d3e1e8f0c669317: function(arg0, arg1) { 549 + const ret = getObject(arg0) in getObject(arg1); 550 + return ret; 551 + }, 552 + __wbg___wbindgen_is_bigint_0e1a2e3f55cfae27: function(arg0) { 553 + const ret = typeof(getObject(arg0)) === 'bigint'; 554 + return ret; 555 + }, 556 + __wbg___wbindgen_is_function_8d400b8b1af978cd: function(arg0) { 557 + const ret = typeof(getObject(arg0)) === 'function'; 558 + return ret; 559 + }, 560 + __wbg___wbindgen_is_object_ce774f3490692386: function(arg0) { 561 + const val = getObject(arg0); 562 + const ret = typeof(val) === 'object' && val !== null; 563 + return ret; 564 + }, 565 + __wbg___wbindgen_is_undefined_f6b95eab589e0269: function(arg0) { 566 + const ret = getObject(arg0) === undefined; 567 + return ret; 568 + }, 569 + __wbg___wbindgen_jsval_eq_b6101cc9cef1fe36: function(arg0, arg1) { 570 + const ret = getObject(arg0) === getObject(arg1); 571 + return ret; 572 + }, 573 + __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d: function(arg0, arg1) { 574 + const ret = getObject(arg0) == getObject(arg1); 575 + return ret; 576 + }, 577 + __wbg___wbindgen_number_get_9619185a74197f95: function(arg0, arg1) { 578 + const obj = getObject(arg1); 579 + const ret = typeof(obj) === 'number' ? obj : undefined; 580 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 581 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 582 + }, 583 + __wbg___wbindgen_string_get_a2a31e16edf96e42: function(arg0, arg1) { 584 + const obj = getObject(arg1); 585 + const ret = typeof(obj) === 'string' ? obj : undefined; 586 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 587 + var len1 = WASM_VECTOR_LEN; 588 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 589 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 590 + }, 591 + __wbg___wbindgen_throw_dd24417ed36fc46e: function(arg0, arg1) { 592 + throw new Error(getStringFromWasm0(arg0, arg1)); 593 + }, 594 + __wbg_call_abb4ff46ce38be40: function() { return handleError(function (arg0, arg1) { 595 + const ret = getObject(arg0).call(getObject(arg1)); 596 + return addHeapObject(ret); 597 + }, arguments) }, 598 + __wbg_done_62ea16af4ce34b24: function(arg0) { 599 + const ret = getObject(arg0).done; 600 + return ret; 601 + }, 602 + __wbg_entries_83c79938054e065f: function(arg0) { 603 + const ret = Object.entries(getObject(arg0)); 604 + return addHeapObject(ret); 605 + }, 606 + __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) { 607 + let deferred0_0; 608 + let deferred0_1; 609 + try { 610 + deferred0_0 = arg0; 611 + deferred0_1 = arg1; 612 + console.error(getStringFromWasm0(arg0, arg1)); 613 + } finally { 614 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 615 + } 616 + }, 617 + __wbg_get_6b7bd52aca3f9671: function(arg0, arg1) { 618 + const ret = getObject(arg0)[arg1 >>> 0]; 619 + return addHeapObject(ret); 620 + }, 621 + __wbg_get_af9dab7e9603ea93: function() { return handleError(function (arg0, arg1) { 622 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 623 + return addHeapObject(ret); 624 + }, arguments) }, 625 + __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) { 626 + const ret = getObject(arg0)[getObject(arg1)]; 627 + return addHeapObject(ret); 628 + }, 629 + __wbg_instanceof_ArrayBuffer_f3320d2419cd0355: function(arg0) { 630 + let result; 631 + try { 632 + result = getObject(arg0) instanceof ArrayBuffer; 633 + } catch (_) { 634 + result = false; 635 + } 636 + const ret = result; 637 + return ret; 638 + }, 639 + __wbg_instanceof_Map_084be8da74364158: function(arg0) { 640 + let result; 641 + try { 642 + result = getObject(arg0) instanceof Map; 643 + } catch (_) { 644 + result = false; 645 + } 646 + const ret = result; 647 + return ret; 648 + }, 649 + __wbg_instanceof_Uint8Array_da54ccc9d3e09434: function(arg0) { 650 + let result; 651 + try { 652 + result = getObject(arg0) instanceof Uint8Array; 653 + } catch (_) { 654 + result = false; 655 + } 656 + const ret = result; 657 + return ret; 658 + }, 659 + __wbg_isArray_51fd9e6422c0a395: function(arg0) { 660 + const ret = Array.isArray(getObject(arg0)); 661 + return ret; 662 + }, 663 + __wbg_isSafeInteger_ae7d3f054d55fa16: function(arg0) { 664 + const ret = Number.isSafeInteger(getObject(arg0)); 665 + return ret; 666 + }, 667 + __wbg_iterator_27b7c8b35ab3e86b: function() { 668 + const ret = Symbol.iterator; 669 + return addHeapObject(ret); 670 + }, 671 + __wbg_length_22ac23eaec9d8053: function(arg0) { 672 + const ret = getObject(arg0).length; 673 + return ret; 674 + }, 675 + __wbg_length_d45040a40c570362: function(arg0) { 676 + const ret = getObject(arg0).length; 677 + return ret; 678 + }, 679 + __wbg_new_6421f6084cc5bc5a: function(arg0) { 680 + const ret = new Uint8Array(getObject(arg0)); 681 + return addHeapObject(ret); 682 + }, 683 + __wbg_new_8a6f238a6ece86ea: function() { 684 + const ret = new Error(); 685 + return addHeapObject(ret); 686 + }, 687 + __wbg_next_138a17bbf04e926c: function(arg0) { 688 + const ret = getObject(arg0).next; 689 + return addHeapObject(ret); 690 + }, 691 + __wbg_next_3cfe5c0fe2a4cc53: function() { return handleError(function (arg0) { 692 + const ret = getObject(arg0).next(); 693 + return addHeapObject(ret); 694 + }, arguments) }, 695 + __wbg_prototypesetcall_dfe9b766cdc1f1fd: function(arg0, arg1, arg2) { 696 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 697 + }, 698 + __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) { 699 + const ret = getObject(arg1).stack; 700 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 701 + const len1 = WASM_VECTOR_LEN; 702 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 703 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 704 + }, 705 + __wbg_value_57b7b035e117f7ee: function(arg0) { 706 + const ret = getObject(arg0).value; 707 + return addHeapObject(ret); 708 + }, 709 + __wbindgen_cast_2241b6af4c4b2941: function(arg0, arg1) { 710 + // Cast intrinsic for `Ref(String) -> Externref`. 711 + const ret = getStringFromWasm0(arg0, arg1); 712 + return addHeapObject(ret); 713 + }, 714 + __wbindgen_cast_4625c577ab2ec9ee: function(arg0) { 715 + // Cast intrinsic for `U64 -> Externref`. 716 + const ret = BigInt.asUintN(64, arg0); 717 + return addHeapObject(ret); 718 + }, 719 + __wbindgen_cast_9ae0607507abb057: function(arg0) { 720 + // Cast intrinsic for `I64 -> Externref`. 721 + const ret = arg0; 722 + return addHeapObject(ret); 723 + }, 724 + __wbindgen_object_clone_ref: function(arg0) { 725 + const ret = getObject(arg0); 726 + return addHeapObject(ret); 727 + }, 728 + __wbindgen_object_drop_ref: function(arg0) { 729 + takeObject(arg0); 730 + }, 731 + __wbindgen_object_is_undefined: function(arg0) { 732 + const ret = getObject(arg0) === undefined; 733 + return ret; 734 + }, 735 + }, 736 + 737 + }; 738 + 739 + const wasmUrl = new URL('weaver_renderer_bg.wasm', import.meta.url); 740 + const wasm = (await WebAssembly.instantiateStreaming(fetch(wasmUrl), imports)).instance.exports; 741 + export { wasm as __wasm }; 742 + 743 + wasm.__wbindgen_start();
+25
crates/weaver-renderer-js/pkg/core/deno/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+373
crates/weaver-renderer-js/pkg/core/nodejs/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+84
crates/weaver-renderer-js/pkg/core/nodejs/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;
+803
crates/weaver-renderer-js/pkg/core/nodejs/weaver_renderer.js
··· 1 + 2 + let imports = {}; 3 + imports['__wbindgen_placeholder__'] = module.exports; 4 + 5 + function addHeapObject(obj) { 6 + if (heap_next === heap.length) heap.push(heap.length + 1); 7 + const idx = heap_next; 8 + heap_next = heap[idx]; 9 + 10 + heap[idx] = obj; 11 + return idx; 12 + } 13 + 14 + function _assertClass(instance, klass) { 15 + if (!(instance instanceof klass)) { 16 + throw new Error(`expected instance of ${klass.name}`); 17 + } 18 + } 19 + 20 + function debugString(val) { 21 + // primitive types 22 + const type = typeof val; 23 + if (type == 'number' || type == 'boolean' || val == null) { 24 + return `${val}`; 25 + } 26 + if (type == 'string') { 27 + return `"${val}"`; 28 + } 29 + if (type == 'symbol') { 30 + const description = val.description; 31 + if (description == null) { 32 + return 'Symbol'; 33 + } else { 34 + return `Symbol(${description})`; 35 + } 36 + } 37 + if (type == 'function') { 38 + const name = val.name; 39 + if (typeof name == 'string' && name.length > 0) { 40 + return `Function(${name})`; 41 + } else { 42 + return 'Function'; 43 + } 44 + } 45 + // objects 46 + if (Array.isArray(val)) { 47 + const length = val.length; 48 + let debug = '['; 49 + if (length > 0) { 50 + debug += debugString(val[0]); 51 + } 52 + for(let i = 1; i < length; i++) { 53 + debug += ', ' + debugString(val[i]); 54 + } 55 + debug += ']'; 56 + return debug; 57 + } 58 + // Test for built-in 59 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 60 + let className; 61 + if (builtInMatches && builtInMatches.length > 1) { 62 + className = builtInMatches[1]; 63 + } else { 64 + // Failed to match the standard '[object ClassName]' 65 + return toString.call(val); 66 + } 67 + if (className == 'Object') { 68 + // we're a user defined class or Object 69 + // JSON.stringify avoids problems with cycles, and is generally much 70 + // easier than looping through ownProperties of `val`. 71 + try { 72 + return 'Object(' + JSON.stringify(val) + ')'; 73 + } catch (_) { 74 + return 'Object'; 75 + } 76 + } 77 + // errors 78 + if (val instanceof Error) { 79 + return `${val.name}: ${val.message}\n${val.stack}`; 80 + } 81 + // TODO we could test for more things here, like `Set`s and `Map`s. 82 + return className; 83 + } 84 + 85 + function dropObject(idx) { 86 + if (idx < 132) return; 87 + heap[idx] = heap_next; 88 + heap_next = idx; 89 + } 90 + 91 + function getArrayU8FromWasm0(ptr, len) { 92 + ptr = ptr >>> 0; 93 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 94 + } 95 + 96 + let cachedDataViewMemory0 = null; 97 + function getDataViewMemory0() { 98 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 99 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 100 + } 101 + return cachedDataViewMemory0; 102 + } 103 + 104 + function getStringFromWasm0(ptr, len) { 105 + ptr = ptr >>> 0; 106 + return decodeText(ptr, len); 107 + } 108 + 109 + let cachedUint8ArrayMemory0 = null; 110 + function getUint8ArrayMemory0() { 111 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 112 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 113 + } 114 + return cachedUint8ArrayMemory0; 115 + } 116 + 117 + function getObject(idx) { return heap[idx]; } 118 + 119 + function handleError(f, args) { 120 + try { 121 + return f.apply(this, args); 122 + } catch (e) { 123 + wasm.__wbindgen_export3(addHeapObject(e)); 124 + } 125 + } 126 + 127 + let heap = new Array(128).fill(undefined); 128 + heap.push(undefined, null, true, false); 129 + 130 + let heap_next = heap.length; 131 + 132 + function isLikeNone(x) { 133 + return x === undefined || x === null; 134 + } 135 + 136 + function passStringToWasm0(arg, malloc, realloc) { 137 + if (realloc === undefined) { 138 + const buf = cachedTextEncoder.encode(arg); 139 + const ptr = malloc(buf.length, 1) >>> 0; 140 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 141 + WASM_VECTOR_LEN = buf.length; 142 + return ptr; 143 + } 144 + 145 + let len = arg.length; 146 + let ptr = malloc(len, 1) >>> 0; 147 + 148 + const mem = getUint8ArrayMemory0(); 149 + 150 + let offset = 0; 151 + 152 + for (; offset < len; offset++) { 153 + const code = arg.charCodeAt(offset); 154 + if (code > 0x7F) break; 155 + mem[ptr + offset] = code; 156 + } 157 + if (offset !== len) { 158 + if (offset !== 0) { 159 + arg = arg.slice(offset); 160 + } 161 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 162 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 163 + const ret = cachedTextEncoder.encodeInto(arg, view); 164 + 165 + offset += ret.written; 166 + ptr = realloc(ptr, len, offset, 1) >>> 0; 167 + } 168 + 169 + WASM_VECTOR_LEN = offset; 170 + return ptr; 171 + } 172 + 173 + function takeObject(idx) { 174 + const ret = getObject(idx); 175 + dropObject(idx); 176 + return ret; 177 + } 178 + 179 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 180 + cachedTextDecoder.decode(); 181 + function decodeText(ptr, len) { 182 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 183 + } 184 + 185 + const cachedTextEncoder = new TextEncoder(); 186 + 187 + if (!('encodeInto' in cachedTextEncoder)) { 188 + cachedTextEncoder.encodeInto = function (arg, view) { 189 + const buf = cachedTextEncoder.encode(arg); 190 + view.set(buf); 191 + return { 192 + read: arg.length, 193 + written: buf.length 194 + }; 195 + } 196 + } 197 + 198 + let WASM_VECTOR_LEN = 0; 199 + 200 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 201 + ? { register: () => {}, unregister: () => {} } 202 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 203 + 204 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 205 + ? { register: () => {}, unregister: () => {} } 206 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 207 + 208 + /** 209 + * Result from rendering LaTeX math. 210 + */ 211 + class JsMathResult { 212 + static __wrap(ptr) { 213 + ptr = ptr >>> 0; 214 + const obj = Object.create(JsMathResult.prototype); 215 + obj.__wbg_ptr = ptr; 216 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 217 + return obj; 218 + } 219 + __destroy_into_raw() { 220 + const ptr = this.__wbg_ptr; 221 + this.__wbg_ptr = 0; 222 + JsMathResultFinalization.unregister(this); 223 + return ptr; 224 + } 225 + free() { 226 + const ptr = this.__destroy_into_raw(); 227 + wasm.__wbg_jsmathresult_free(ptr, 0); 228 + } 229 + /** 230 + * @returns {boolean} 231 + */ 232 + get success() { 233 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 234 + return ret !== 0; 235 + } 236 + /** 237 + * @param {boolean} arg0 238 + */ 239 + set success(arg0) { 240 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 241 + } 242 + /** 243 + * @returns {string} 244 + */ 245 + get html() { 246 + let deferred1_0; 247 + let deferred1_1; 248 + try { 249 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 250 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 251 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 252 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 253 + deferred1_0 = r0; 254 + deferred1_1 = r1; 255 + return getStringFromWasm0(r0, r1); 256 + } finally { 257 + wasm.__wbindgen_add_to_stack_pointer(16); 258 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 259 + } 260 + } 261 + /** 262 + * @param {string} arg0 263 + */ 264 + set html(arg0) { 265 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 266 + const len0 = WASM_VECTOR_LEN; 267 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 268 + } 269 + /** 270 + * @returns {string | undefined} 271 + */ 272 + get error() { 273 + try { 274 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 275 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 276 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 277 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 278 + let v1; 279 + if (r0 !== 0) { 280 + v1 = getStringFromWasm0(r0, r1).slice(); 281 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 282 + } 283 + return v1; 284 + } finally { 285 + wasm.__wbindgen_add_to_stack_pointer(16); 286 + } 287 + } 288 + /** 289 + * @param {string | null} [arg0] 290 + */ 291 + set error(arg0) { 292 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 293 + var len0 = WASM_VECTOR_LEN; 294 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 295 + } 296 + } 297 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 298 + exports.JsMathResult = JsMathResult; 299 + 300 + /** 301 + * Pre-rendered embed content for synchronous rendering. 302 + * 303 + * Build this by calling `create_resolved_content()` and adding embeds 304 + * with `resolved_content_add_embed()`. 305 + */ 306 + class JsResolvedContent { 307 + static __wrap(ptr) { 308 + ptr = ptr >>> 0; 309 + const obj = Object.create(JsResolvedContent.prototype); 310 + obj.__wbg_ptr = ptr; 311 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 312 + return obj; 313 + } 314 + __destroy_into_raw() { 315 + const ptr = this.__wbg_ptr; 316 + this.__wbg_ptr = 0; 317 + JsResolvedContentFinalization.unregister(this); 318 + return ptr; 319 + } 320 + free() { 321 + const ptr = this.__destroy_into_raw(); 322 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 323 + } 324 + /** 325 + * Create an empty resolved content container. 326 + */ 327 + constructor() { 328 + const ret = wasm.create_resolved_content(); 329 + this.__wbg_ptr = ret >>> 0; 330 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 331 + return this; 332 + } 333 + /** 334 + * Add pre-rendered embed HTML for an AT URI. 335 + * 336 + * # Arguments 337 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 338 + * * `html` - The pre-rendered HTML for this embed 339 + * @param {string} at_uri 340 + * @param {string} html 341 + */ 342 + addEmbed(at_uri, html) { 343 + try { 344 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 345 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 346 + const len0 = WASM_VECTOR_LEN; 347 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 348 + const len1 = WASM_VECTOR_LEN; 349 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 350 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 351 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 352 + if (r1) { 353 + throw takeObject(r0); 354 + } 355 + } finally { 356 + wasm.__wbindgen_add_to_stack_pointer(16); 357 + } 358 + } 359 + } 360 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 361 + exports.JsResolvedContent = JsResolvedContent; 362 + 363 + /** 364 + * Create an empty resolved content container. 365 + * 366 + * Use this to pre-render embeds before calling render functions. 367 + * @returns {JsResolvedContent} 368 + */ 369 + function create_resolved_content() { 370 + const ret = wasm.create_resolved_content(); 371 + return JsResolvedContent.__wrap(ret); 372 + } 373 + exports.create_resolved_content = create_resolved_content; 374 + 375 + /** 376 + * Initialize panic hook for better error messages in console. 377 + */ 378 + function init() { 379 + wasm.init(); 380 + } 381 + exports.init = init; 382 + 383 + /** 384 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 385 + * 386 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 387 + * 388 + * # Arguments 389 + * * `text` - The plain text content 390 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 391 + * @param {string} text 392 + * @param {any} facets_json 393 + * @returns {string} 394 + */ 395 + function render_faceted_text(text, facets_json) { 396 + let deferred3_0; 397 + let deferred3_1; 398 + try { 399 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 400 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 401 + const len0 = WASM_VECTOR_LEN; 402 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 403 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 404 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 405 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 406 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 407 + var ptr2 = r0; 408 + var len2 = r1; 409 + if (r3) { 410 + ptr2 = 0; len2 = 0; 411 + throw takeObject(r2); 412 + } 413 + deferred3_0 = ptr2; 414 + deferred3_1 = len2; 415 + return getStringFromWasm0(ptr2, len2); 416 + } finally { 417 + wasm.__wbindgen_add_to_stack_pointer(16); 418 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 419 + } 420 + } 421 + exports.render_faceted_text = render_faceted_text; 422 + 423 + /** 424 + * Render markdown to HTML. 425 + * 426 + * # Arguments 427 + * * `markdown` - The markdown source text 428 + * * `resolved_content` - Optional pre-rendered embed content 429 + * @param {string} markdown 430 + * @param {JsResolvedContent | null} [resolved_content] 431 + * @returns {string} 432 + */ 433 + function render_markdown(markdown, resolved_content) { 434 + let deferred4_0; 435 + let deferred4_1; 436 + try { 437 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 438 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 439 + const len0 = WASM_VECTOR_LEN; 440 + let ptr1 = 0; 441 + if (!isLikeNone(resolved_content)) { 442 + _assertClass(resolved_content, JsResolvedContent); 443 + ptr1 = resolved_content.__destroy_into_raw(); 444 + } 445 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 446 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 447 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 448 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 449 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 450 + var ptr3 = r0; 451 + var len3 = r1; 452 + if (r3) { 453 + ptr3 = 0; len3 = 0; 454 + throw takeObject(r2); 455 + } 456 + deferred4_0 = ptr3; 457 + deferred4_1 = len3; 458 + return getStringFromWasm0(ptr3, len3); 459 + } finally { 460 + wasm.__wbindgen_add_to_stack_pointer(16); 461 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 462 + } 463 + } 464 + exports.render_markdown = render_markdown; 465 + 466 + /** 467 + * Render LaTeX math to MathML. 468 + * 469 + * # Arguments 470 + * * `latex` - The LaTeX math expression 471 + * * `display_mode` - true for display math (block), false for inline math 472 + * @param {string} latex 473 + * @param {boolean} display_mode 474 + * @returns {JsMathResult} 475 + */ 476 + function render_math(latex, display_mode) { 477 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 478 + const len0 = WASM_VECTOR_LEN; 479 + const ret = wasm.render_math(ptr0, len0, display_mode); 480 + return JsMathResult.__wrap(ret); 481 + } 482 + exports.render_math = render_math; 483 + 484 + /** 485 + * Render an AT Protocol record as HTML. 486 + * 487 + * Takes a record URI and the record data (typically fetched from an appview). 488 + * Returns the rendered HTML string. 489 + * 490 + * # Arguments 491 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 492 + * * `record_json` - The record data as JSON 493 + * * `fallback_author` - Optional author profile for records that don't include author info 494 + * * `resolved_content` - Optional pre-rendered embed content 495 + * @param {string} at_uri 496 + * @param {any} record_json 497 + * @param {any | null} [fallback_author] 498 + * @param {JsResolvedContent | null} [resolved_content] 499 + * @returns {string} 500 + */ 501 + function render_record(at_uri, record_json, fallback_author, resolved_content) { 502 + let deferred4_0; 503 + let deferred4_1; 504 + try { 505 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 506 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 507 + const len0 = WASM_VECTOR_LEN; 508 + let ptr1 = 0; 509 + if (!isLikeNone(resolved_content)) { 510 + _assertClass(resolved_content, JsResolvedContent); 511 + ptr1 = resolved_content.__destroy_into_raw(); 512 + } 513 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 514 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 515 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 516 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 517 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 518 + var ptr3 = r0; 519 + var len3 = r1; 520 + if (r3) { 521 + ptr3 = 0; len3 = 0; 522 + throw takeObject(r2); 523 + } 524 + deferred4_0 = ptr3; 525 + deferred4_1 = len3; 526 + return getStringFromWasm0(ptr3, len3); 527 + } finally { 528 + wasm.__wbindgen_add_to_stack_pointer(16); 529 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 530 + } 531 + } 532 + exports.render_record = render_record; 533 + 534 + exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) { 535 + const ret = Error(getStringFromWasm0(arg0, arg1)); 536 + return addHeapObject(ret); 537 + }; 538 + 539 + exports.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) { 540 + const ret = Number(getObject(arg0)); 541 + return ret; 542 + }; 543 + 544 + exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) { 545 + const ret = String(getObject(arg1)); 546 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 547 + const len1 = WASM_VECTOR_LEN; 548 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 549 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 550 + }; 551 + 552 + exports.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) { 553 + const v = getObject(arg1); 554 + const ret = typeof(v) === 'bigint' ? v : undefined; 555 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 556 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 557 + }; 558 + 559 + exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) { 560 + const v = getObject(arg0); 561 + const ret = typeof(v) === 'boolean' ? v : undefined; 562 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 563 + }; 564 + 565 + exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) { 566 + const ret = debugString(getObject(arg1)); 567 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 568 + const len1 = WASM_VECTOR_LEN; 569 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 570 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 571 + }; 572 + 573 + exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) { 574 + const ret = getObject(arg0) in getObject(arg1); 575 + return ret; 576 + }; 577 + 578 + exports.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) { 579 + const ret = typeof(getObject(arg0)) === 'bigint'; 580 + return ret; 581 + }; 582 + 583 + exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) { 584 + const ret = typeof(getObject(arg0)) === 'function'; 585 + return ret; 586 + }; 587 + 588 + exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) { 589 + const val = getObject(arg0); 590 + const ret = typeof(val) === 'object' && val !== null; 591 + return ret; 592 + }; 593 + 594 + exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) { 595 + const ret = getObject(arg0) === undefined; 596 + return ret; 597 + }; 598 + 599 + exports.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) { 600 + const ret = getObject(arg0) === getObject(arg1); 601 + return ret; 602 + }; 603 + 604 + exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) { 605 + const ret = getObject(arg0) == getObject(arg1); 606 + return ret; 607 + }; 608 + 609 + exports.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) { 610 + const obj = getObject(arg1); 611 + const ret = typeof(obj) === 'number' ? obj : undefined; 612 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 613 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 614 + }; 615 + 616 + exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) { 617 + const obj = getObject(arg1); 618 + const ret = typeof(obj) === 'string' ? obj : undefined; 619 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 620 + var len1 = WASM_VECTOR_LEN; 621 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 622 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 623 + }; 624 + 625 + exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) { 626 + throw new Error(getStringFromWasm0(arg0, arg1)); 627 + }; 628 + 629 + exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) { 630 + const ret = getObject(arg0).call(getObject(arg1)); 631 + return addHeapObject(ret); 632 + }, arguments) }; 633 + 634 + exports.__wbg_done_62ea16af4ce34b24 = function(arg0) { 635 + const ret = getObject(arg0).done; 636 + return ret; 637 + }; 638 + 639 + exports.__wbg_entries_83c79938054e065f = function(arg0) { 640 + const ret = Object.entries(getObject(arg0)); 641 + return addHeapObject(ret); 642 + }; 643 + 644 + exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) { 645 + let deferred0_0; 646 + let deferred0_1; 647 + try { 648 + deferred0_0 = arg0; 649 + deferred0_1 = arg1; 650 + console.error(getStringFromWasm0(arg0, arg1)); 651 + } finally { 652 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 653 + } 654 + }; 655 + 656 + exports.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) { 657 + const ret = getObject(arg0)[arg1 >>> 0]; 658 + return addHeapObject(ret); 659 + }; 660 + 661 + exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) { 662 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 663 + return addHeapObject(ret); 664 + }, arguments) }; 665 + 666 + exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) { 667 + const ret = getObject(arg0)[getObject(arg1)]; 668 + return addHeapObject(ret); 669 + }; 670 + 671 + exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) { 672 + let result; 673 + try { 674 + result = getObject(arg0) instanceof ArrayBuffer; 675 + } catch (_) { 676 + result = false; 677 + } 678 + const ret = result; 679 + return ret; 680 + }; 681 + 682 + exports.__wbg_instanceof_Map_084be8da74364158 = function(arg0) { 683 + let result; 684 + try { 685 + result = getObject(arg0) instanceof Map; 686 + } catch (_) { 687 + result = false; 688 + } 689 + const ret = result; 690 + return ret; 691 + }; 692 + 693 + exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) { 694 + let result; 695 + try { 696 + result = getObject(arg0) instanceof Uint8Array; 697 + } catch (_) { 698 + result = false; 699 + } 700 + const ret = result; 701 + return ret; 702 + }; 703 + 704 + exports.__wbg_isArray_51fd9e6422c0a395 = function(arg0) { 705 + const ret = Array.isArray(getObject(arg0)); 706 + return ret; 707 + }; 708 + 709 + exports.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) { 710 + const ret = Number.isSafeInteger(getObject(arg0)); 711 + return ret; 712 + }; 713 + 714 + exports.__wbg_iterator_27b7c8b35ab3e86b = function() { 715 + const ret = Symbol.iterator; 716 + return addHeapObject(ret); 717 + }; 718 + 719 + exports.__wbg_length_22ac23eaec9d8053 = function(arg0) { 720 + const ret = getObject(arg0).length; 721 + return ret; 722 + }; 723 + 724 + exports.__wbg_length_d45040a40c570362 = function(arg0) { 725 + const ret = getObject(arg0).length; 726 + return ret; 727 + }; 728 + 729 + exports.__wbg_new_6421f6084cc5bc5a = function(arg0) { 730 + const ret = new Uint8Array(getObject(arg0)); 731 + return addHeapObject(ret); 732 + }; 733 + 734 + exports.__wbg_new_8a6f238a6ece86ea = function() { 735 + const ret = new Error(); 736 + return addHeapObject(ret); 737 + }; 738 + 739 + exports.__wbg_next_138a17bbf04e926c = function(arg0) { 740 + const ret = getObject(arg0).next; 741 + return addHeapObject(ret); 742 + }; 743 + 744 + exports.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) { 745 + const ret = getObject(arg0).next(); 746 + return addHeapObject(ret); 747 + }, arguments) }; 748 + 749 + exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) { 750 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 751 + }; 752 + 753 + exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) { 754 + const ret = getObject(arg1).stack; 755 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 756 + const len1 = WASM_VECTOR_LEN; 757 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 758 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 759 + }; 760 + 761 + exports.__wbg_value_57b7b035e117f7ee = function(arg0) { 762 + const ret = getObject(arg0).value; 763 + return addHeapObject(ret); 764 + }; 765 + 766 + exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) { 767 + // Cast intrinsic for `Ref(String) -> Externref`. 768 + const ret = getStringFromWasm0(arg0, arg1); 769 + return addHeapObject(ret); 770 + }; 771 + 772 + exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) { 773 + // Cast intrinsic for `U64 -> Externref`. 774 + const ret = BigInt.asUintN(64, arg0); 775 + return addHeapObject(ret); 776 + }; 777 + 778 + exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) { 779 + // Cast intrinsic for `I64 -> Externref`. 780 + const ret = arg0; 781 + return addHeapObject(ret); 782 + }; 783 + 784 + exports.__wbindgen_object_clone_ref = function(arg0) { 785 + const ret = getObject(arg0); 786 + return addHeapObject(ret); 787 + }; 788 + 789 + exports.__wbindgen_object_drop_ref = function(arg0) { 790 + takeObject(arg0); 791 + }; 792 + 793 + exports.__wbindgen_object_is_undefined = function(arg0) { 794 + const ret = getObject(arg0) === undefined; 795 + return ret; 796 + }; 797 + 798 + const wasmPath = `${__dirname}/weaver_renderer_bg.wasm`; 799 + const wasmBytes = require('fs').readFileSync(wasmPath); 800 + const wasmModule = new WebAssembly.Module(wasmBytes); 801 + const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports; 802 + 803 + wasm.__wbindgen_start();
+25
crates/weaver-renderer-js/pkg/core/nodejs/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+52
crates/weaver-renderer-js/pkg/core/package.json
··· 1 + { 2 + "name": "@weaver.sh/renderer-core", 3 + "version": "0.1.1", 4 + "description": "AT Protocol record renderer (lightweight, no syntax highlighting)", 5 + "license": "MPL-2.0", 6 + "repository": { 7 + "type": "git", 8 + "url": "https://tangled.org/nonbinary.computer/weaver" 9 + }, 10 + "keywords": ["atproto", "bluesky", "markdown", "renderer", "wasm"], 11 + "main": "nodejs/weaver_renderer.js", 12 + "module": "bundler/weaver_renderer.js", 13 + "browser": "web/weaver_renderer.js", 14 + "types": "bundler/weaver_renderer.d.ts", 15 + "exports": { 16 + ".": { 17 + "deno": "./deno/weaver_renderer.js", 18 + "node": { 19 + "import": "./nodejs/weaver_renderer.js", 20 + "require": "./nodejs/weaver_renderer.js" 21 + }, 22 + "browser": { 23 + "import": "./web/weaver_renderer.js" 24 + }, 25 + "default": "./bundler/weaver_renderer.js" 26 + }, 27 + "./bundler": { 28 + "import": "./bundler/weaver_renderer.js", 29 + "types": "./bundler/weaver_renderer.d.ts" 30 + }, 31 + "./web": { 32 + "import": "./web/weaver_renderer.js", 33 + "types": "./web/weaver_renderer.d.ts" 34 + }, 35 + "./nodejs": { 36 + "import": "./nodejs/weaver_renderer.js", 37 + "require": "./nodejs/weaver_renderer.js", 38 + "types": "./nodejs/weaver_renderer.d.ts" 39 + }, 40 + "./deno": { 41 + "import": "./deno/weaver_renderer.js", 42 + "types": "./deno/weaver_renderer.d.ts" 43 + } 44 + }, 45 + "files": [ 46 + "bundler/", 47 + "web/", 48 + "nodejs/", 49 + "deno/", 50 + "README.md" 51 + ] 52 + }
+373
crates/weaver-renderer-js/pkg/core/web/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+134
crates/weaver-renderer-js/pkg/core/web/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string; 85 + 86 + export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; 87 + 88 + export interface InitOutput { 89 + readonly memory: WebAssembly.Memory; 90 + readonly __wbg_get_jsmathresult_error: (a: number, b: number) => void; 91 + readonly __wbg_get_jsmathresult_html: (a: number, b: number) => void; 92 + readonly __wbg_get_jsmathresult_success: (a: number) => number; 93 + readonly __wbg_jsmathresult_free: (a: number, b: number) => void; 94 + readonly __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 95 + readonly __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 96 + readonly __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 97 + readonly __wbg_set_jsmathresult_success: (a: number, b: number) => void; 98 + readonly create_resolved_content: () => number; 99 + readonly init: () => void; 100 + readonly jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 101 + readonly render_faceted_text: (a: number, b: number, c: number, d: number) => void; 102 + readonly render_markdown: (a: number, b: number, c: number, d: number) => void; 103 + readonly render_math: (a: number, b: number, c: number) => number; 104 + readonly render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 105 + readonly jsresolvedcontent_new: () => number; 106 + readonly __wbindgen_export: (a: number, b: number) => number; 107 + readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 108 + readonly __wbindgen_export3: (a: number) => void; 109 + readonly __wbindgen_export4: (a: number, b: number, c: number) => void; 110 + readonly __wbindgen_add_to_stack_pointer: (a: number) => number; 111 + readonly __wbindgen_start: () => void; 112 + } 113 + 114 + export type SyncInitInput = BufferSource | WebAssembly.Module; 115 + 116 + /** 117 + * Instantiates the given `module`, which can either be bytes or 118 + * a precompiled `WebAssembly.Module`. 119 + * 120 + * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. 121 + * 122 + * @returns {InitOutput} 123 + */ 124 + export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; 125 + 126 + /** 127 + * If `module_or_path` is {RequestInfo} or {URL}, makes a request and 128 + * for everything else, calls `WebAssembly.instantiate` directly. 129 + * 130 + * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. 131 + * 132 + * @returns {Promise<InitOutput>} 133 + */ 134 + export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
+849
crates/weaver-renderer-js/pkg/core/web/weaver_renderer.js
··· 1 + let wasm; 2 + 3 + function addHeapObject(obj) { 4 + if (heap_next === heap.length) heap.push(heap.length + 1); 5 + const idx = heap_next; 6 + heap_next = heap[idx]; 7 + 8 + heap[idx] = obj; 9 + return idx; 10 + } 11 + 12 + function _assertClass(instance, klass) { 13 + if (!(instance instanceof klass)) { 14 + throw new Error(`expected instance of ${klass.name}`); 15 + } 16 + } 17 + 18 + function debugString(val) { 19 + // primitive types 20 + const type = typeof val; 21 + if (type == 'number' || type == 'boolean' || val == null) { 22 + return `${val}`; 23 + } 24 + if (type == 'string') { 25 + return `"${val}"`; 26 + } 27 + if (type == 'symbol') { 28 + const description = val.description; 29 + if (description == null) { 30 + return 'Symbol'; 31 + } else { 32 + return `Symbol(${description})`; 33 + } 34 + } 35 + if (type == 'function') { 36 + const name = val.name; 37 + if (typeof name == 'string' && name.length > 0) { 38 + return `Function(${name})`; 39 + } else { 40 + return 'Function'; 41 + } 42 + } 43 + // objects 44 + if (Array.isArray(val)) { 45 + const length = val.length; 46 + let debug = '['; 47 + if (length > 0) { 48 + debug += debugString(val[0]); 49 + } 50 + for(let i = 1; i < length; i++) { 51 + debug += ', ' + debugString(val[i]); 52 + } 53 + debug += ']'; 54 + return debug; 55 + } 56 + // Test for built-in 57 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 58 + let className; 59 + if (builtInMatches && builtInMatches.length > 1) { 60 + className = builtInMatches[1]; 61 + } else { 62 + // Failed to match the standard '[object ClassName]' 63 + return toString.call(val); 64 + } 65 + if (className == 'Object') { 66 + // we're a user defined class or Object 67 + // JSON.stringify avoids problems with cycles, and is generally much 68 + // easier than looping through ownProperties of `val`. 69 + try { 70 + return 'Object(' + JSON.stringify(val) + ')'; 71 + } catch (_) { 72 + return 'Object'; 73 + } 74 + } 75 + // errors 76 + if (val instanceof Error) { 77 + return `${val.name}: ${val.message}\n${val.stack}`; 78 + } 79 + // TODO we could test for more things here, like `Set`s and `Map`s. 80 + return className; 81 + } 82 + 83 + function dropObject(idx) { 84 + if (idx < 132) return; 85 + heap[idx] = heap_next; 86 + heap_next = idx; 87 + } 88 + 89 + function getArrayU8FromWasm0(ptr, len) { 90 + ptr = ptr >>> 0; 91 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 92 + } 93 + 94 + let cachedDataViewMemory0 = null; 95 + function getDataViewMemory0() { 96 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 97 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 98 + } 99 + return cachedDataViewMemory0; 100 + } 101 + 102 + function getStringFromWasm0(ptr, len) { 103 + ptr = ptr >>> 0; 104 + return decodeText(ptr, len); 105 + } 106 + 107 + let cachedUint8ArrayMemory0 = null; 108 + function getUint8ArrayMemory0() { 109 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 110 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 111 + } 112 + return cachedUint8ArrayMemory0; 113 + } 114 + 115 + function getObject(idx) { return heap[idx]; } 116 + 117 + function handleError(f, args) { 118 + try { 119 + return f.apply(this, args); 120 + } catch (e) { 121 + wasm.__wbindgen_export3(addHeapObject(e)); 122 + } 123 + } 124 + 125 + let heap = new Array(128).fill(undefined); 126 + heap.push(undefined, null, true, false); 127 + 128 + let heap_next = heap.length; 129 + 130 + function isLikeNone(x) { 131 + return x === undefined || x === null; 132 + } 133 + 134 + function passStringToWasm0(arg, malloc, realloc) { 135 + if (realloc === undefined) { 136 + const buf = cachedTextEncoder.encode(arg); 137 + const ptr = malloc(buf.length, 1) >>> 0; 138 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 139 + WASM_VECTOR_LEN = buf.length; 140 + return ptr; 141 + } 142 + 143 + let len = arg.length; 144 + let ptr = malloc(len, 1) >>> 0; 145 + 146 + const mem = getUint8ArrayMemory0(); 147 + 148 + let offset = 0; 149 + 150 + for (; offset < len; offset++) { 151 + const code = arg.charCodeAt(offset); 152 + if (code > 0x7F) break; 153 + mem[ptr + offset] = code; 154 + } 155 + if (offset !== len) { 156 + if (offset !== 0) { 157 + arg = arg.slice(offset); 158 + } 159 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 160 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 161 + const ret = cachedTextEncoder.encodeInto(arg, view); 162 + 163 + offset += ret.written; 164 + ptr = realloc(ptr, len, offset, 1) >>> 0; 165 + } 166 + 167 + WASM_VECTOR_LEN = offset; 168 + return ptr; 169 + } 170 + 171 + function takeObject(idx) { 172 + const ret = getObject(idx); 173 + dropObject(idx); 174 + return ret; 175 + } 176 + 177 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 178 + cachedTextDecoder.decode(); 179 + const MAX_SAFARI_DECODE_BYTES = 2146435072; 180 + let numBytesDecoded = 0; 181 + function decodeText(ptr, len) { 182 + numBytesDecoded += len; 183 + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { 184 + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 185 + cachedTextDecoder.decode(); 186 + numBytesDecoded = len; 187 + } 188 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 189 + } 190 + 191 + const cachedTextEncoder = new TextEncoder(); 192 + 193 + if (!('encodeInto' in cachedTextEncoder)) { 194 + cachedTextEncoder.encodeInto = function (arg, view) { 195 + const buf = cachedTextEncoder.encode(arg); 196 + view.set(buf); 197 + return { 198 + read: arg.length, 199 + written: buf.length 200 + }; 201 + } 202 + } 203 + 204 + let WASM_VECTOR_LEN = 0; 205 + 206 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 207 + ? { register: () => {}, unregister: () => {} } 208 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 209 + 210 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 211 + ? { register: () => {}, unregister: () => {} } 212 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 213 + 214 + /** 215 + * Result from rendering LaTeX math. 216 + */ 217 + export class JsMathResult { 218 + static __wrap(ptr) { 219 + ptr = ptr >>> 0; 220 + const obj = Object.create(JsMathResult.prototype); 221 + obj.__wbg_ptr = ptr; 222 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 223 + return obj; 224 + } 225 + __destroy_into_raw() { 226 + const ptr = this.__wbg_ptr; 227 + this.__wbg_ptr = 0; 228 + JsMathResultFinalization.unregister(this); 229 + return ptr; 230 + } 231 + free() { 232 + const ptr = this.__destroy_into_raw(); 233 + wasm.__wbg_jsmathresult_free(ptr, 0); 234 + } 235 + /** 236 + * @returns {boolean} 237 + */ 238 + get success() { 239 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 240 + return ret !== 0; 241 + } 242 + /** 243 + * @param {boolean} arg0 244 + */ 245 + set success(arg0) { 246 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 247 + } 248 + /** 249 + * @returns {string} 250 + */ 251 + get html() { 252 + let deferred1_0; 253 + let deferred1_1; 254 + try { 255 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 256 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 257 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 258 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 259 + deferred1_0 = r0; 260 + deferred1_1 = r1; 261 + return getStringFromWasm0(r0, r1); 262 + } finally { 263 + wasm.__wbindgen_add_to_stack_pointer(16); 264 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 265 + } 266 + } 267 + /** 268 + * @param {string} arg0 269 + */ 270 + set html(arg0) { 271 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 272 + const len0 = WASM_VECTOR_LEN; 273 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 274 + } 275 + /** 276 + * @returns {string | undefined} 277 + */ 278 + get error() { 279 + try { 280 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 281 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 282 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 283 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 284 + let v1; 285 + if (r0 !== 0) { 286 + v1 = getStringFromWasm0(r0, r1).slice(); 287 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 288 + } 289 + return v1; 290 + } finally { 291 + wasm.__wbindgen_add_to_stack_pointer(16); 292 + } 293 + } 294 + /** 295 + * @param {string | null} [arg0] 296 + */ 297 + set error(arg0) { 298 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 299 + var len0 = WASM_VECTOR_LEN; 300 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 301 + } 302 + } 303 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 304 + 305 + /** 306 + * Pre-rendered embed content for synchronous rendering. 307 + * 308 + * Build this by calling `create_resolved_content()` and adding embeds 309 + * with `resolved_content_add_embed()`. 310 + */ 311 + export class JsResolvedContent { 312 + static __wrap(ptr) { 313 + ptr = ptr >>> 0; 314 + const obj = Object.create(JsResolvedContent.prototype); 315 + obj.__wbg_ptr = ptr; 316 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 317 + return obj; 318 + } 319 + __destroy_into_raw() { 320 + const ptr = this.__wbg_ptr; 321 + this.__wbg_ptr = 0; 322 + JsResolvedContentFinalization.unregister(this); 323 + return ptr; 324 + } 325 + free() { 326 + const ptr = this.__destroy_into_raw(); 327 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 328 + } 329 + /** 330 + * Create an empty resolved content container. 331 + */ 332 + constructor() { 333 + const ret = wasm.create_resolved_content(); 334 + this.__wbg_ptr = ret >>> 0; 335 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 336 + return this; 337 + } 338 + /** 339 + * Add pre-rendered embed HTML for an AT URI. 340 + * 341 + * # Arguments 342 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 343 + * * `html` - The pre-rendered HTML for this embed 344 + * @param {string} at_uri 345 + * @param {string} html 346 + */ 347 + addEmbed(at_uri, html) { 348 + try { 349 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 350 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 351 + const len0 = WASM_VECTOR_LEN; 352 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 353 + const len1 = WASM_VECTOR_LEN; 354 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 355 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 356 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 357 + if (r1) { 358 + throw takeObject(r0); 359 + } 360 + } finally { 361 + wasm.__wbindgen_add_to_stack_pointer(16); 362 + } 363 + } 364 + } 365 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 366 + 367 + /** 368 + * Create an empty resolved content container. 369 + * 370 + * Use this to pre-render embeds before calling render functions. 371 + * @returns {JsResolvedContent} 372 + */ 373 + export function create_resolved_content() { 374 + const ret = wasm.create_resolved_content(); 375 + return JsResolvedContent.__wrap(ret); 376 + } 377 + 378 + /** 379 + * Initialize panic hook for better error messages in console. 380 + */ 381 + export function init() { 382 + wasm.init(); 383 + } 384 + 385 + /** 386 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 387 + * 388 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 389 + * 390 + * # Arguments 391 + * * `text` - The plain text content 392 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 393 + * @param {string} text 394 + * @param {any} facets_json 395 + * @returns {string} 396 + */ 397 + export function render_faceted_text(text, facets_json) { 398 + let deferred3_0; 399 + let deferred3_1; 400 + try { 401 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 402 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 403 + const len0 = WASM_VECTOR_LEN; 404 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 405 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 406 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 407 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 408 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 409 + var ptr2 = r0; 410 + var len2 = r1; 411 + if (r3) { 412 + ptr2 = 0; len2 = 0; 413 + throw takeObject(r2); 414 + } 415 + deferred3_0 = ptr2; 416 + deferred3_1 = len2; 417 + return getStringFromWasm0(ptr2, len2); 418 + } finally { 419 + wasm.__wbindgen_add_to_stack_pointer(16); 420 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 421 + } 422 + } 423 + 424 + /** 425 + * Render markdown to HTML. 426 + * 427 + * # Arguments 428 + * * `markdown` - The markdown source text 429 + * * `resolved_content` - Optional pre-rendered embed content 430 + * @param {string} markdown 431 + * @param {JsResolvedContent | null} [resolved_content] 432 + * @returns {string} 433 + */ 434 + export function render_markdown(markdown, resolved_content) { 435 + let deferred4_0; 436 + let deferred4_1; 437 + try { 438 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 439 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 440 + const len0 = WASM_VECTOR_LEN; 441 + let ptr1 = 0; 442 + if (!isLikeNone(resolved_content)) { 443 + _assertClass(resolved_content, JsResolvedContent); 444 + ptr1 = resolved_content.__destroy_into_raw(); 445 + } 446 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 447 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 448 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 449 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 450 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 451 + var ptr3 = r0; 452 + var len3 = r1; 453 + if (r3) { 454 + ptr3 = 0; len3 = 0; 455 + throw takeObject(r2); 456 + } 457 + deferred4_0 = ptr3; 458 + deferred4_1 = len3; 459 + return getStringFromWasm0(ptr3, len3); 460 + } finally { 461 + wasm.__wbindgen_add_to_stack_pointer(16); 462 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 463 + } 464 + } 465 + 466 + /** 467 + * Render LaTeX math to MathML. 468 + * 469 + * # Arguments 470 + * * `latex` - The LaTeX math expression 471 + * * `display_mode` - true for display math (block), false for inline math 472 + * @param {string} latex 473 + * @param {boolean} display_mode 474 + * @returns {JsMathResult} 475 + */ 476 + export function render_math(latex, display_mode) { 477 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 478 + const len0 = WASM_VECTOR_LEN; 479 + const ret = wasm.render_math(ptr0, len0, display_mode); 480 + return JsMathResult.__wrap(ret); 481 + } 482 + 483 + /** 484 + * Render an AT Protocol record as HTML. 485 + * 486 + * Takes a record URI and the record data (typically fetched from an appview). 487 + * Returns the rendered HTML string. 488 + * 489 + * # Arguments 490 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 491 + * * `record_json` - The record data as JSON 492 + * * `fallback_author` - Optional author profile for records that don't include author info 493 + * * `resolved_content` - Optional pre-rendered embed content 494 + * @param {string} at_uri 495 + * @param {any} record_json 496 + * @param {any | null} [fallback_author] 497 + * @param {JsResolvedContent | null} [resolved_content] 498 + * @returns {string} 499 + */ 500 + export function render_record(at_uri, record_json, fallback_author, resolved_content) { 501 + let deferred4_0; 502 + let deferred4_1; 503 + try { 504 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 505 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 506 + const len0 = WASM_VECTOR_LEN; 507 + let ptr1 = 0; 508 + if (!isLikeNone(resolved_content)) { 509 + _assertClass(resolved_content, JsResolvedContent); 510 + ptr1 = resolved_content.__destroy_into_raw(); 511 + } 512 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 513 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 514 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 515 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 516 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 517 + var ptr3 = r0; 518 + var len3 = r1; 519 + if (r3) { 520 + ptr3 = 0; len3 = 0; 521 + throw takeObject(r2); 522 + } 523 + deferred4_0 = ptr3; 524 + deferred4_1 = len3; 525 + return getStringFromWasm0(ptr3, len3); 526 + } finally { 527 + wasm.__wbindgen_add_to_stack_pointer(16); 528 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 529 + } 530 + } 531 + 532 + const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']); 533 + 534 + async function __wbg_load(module, imports) { 535 + if (typeof Response === 'function' && module instanceof Response) { 536 + if (typeof WebAssembly.instantiateStreaming === 'function') { 537 + try { 538 + return await WebAssembly.instantiateStreaming(module, imports); 539 + } catch (e) { 540 + const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type); 541 + 542 + if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') { 543 + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); 544 + 545 + } else { 546 + throw e; 547 + } 548 + } 549 + } 550 + 551 + const bytes = await module.arrayBuffer(); 552 + return await WebAssembly.instantiate(bytes, imports); 553 + } else { 554 + const instance = await WebAssembly.instantiate(module, imports); 555 + 556 + if (instance instanceof WebAssembly.Instance) { 557 + return { instance, module }; 558 + } else { 559 + return instance; 560 + } 561 + } 562 + } 563 + 564 + function __wbg_get_imports() { 565 + const imports = {}; 566 + imports.wbg = {}; 567 + imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) { 568 + const ret = Error(getStringFromWasm0(arg0, arg1)); 569 + return addHeapObject(ret); 570 + }; 571 + imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) { 572 + const ret = Number(getObject(arg0)); 573 + return ret; 574 + }; 575 + imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) { 576 + const ret = String(getObject(arg1)); 577 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 578 + const len1 = WASM_VECTOR_LEN; 579 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 580 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 581 + }; 582 + imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) { 583 + const v = getObject(arg1); 584 + const ret = typeof(v) === 'bigint' ? v : undefined; 585 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 586 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 587 + }; 588 + imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) { 589 + const v = getObject(arg0); 590 + const ret = typeof(v) === 'boolean' ? v : undefined; 591 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 592 + }; 593 + imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) { 594 + const ret = debugString(getObject(arg1)); 595 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 596 + const len1 = WASM_VECTOR_LEN; 597 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 598 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 599 + }; 600 + imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) { 601 + const ret = getObject(arg0) in getObject(arg1); 602 + return ret; 603 + }; 604 + imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) { 605 + const ret = typeof(getObject(arg0)) === 'bigint'; 606 + return ret; 607 + }; 608 + imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) { 609 + const ret = typeof(getObject(arg0)) === 'function'; 610 + return ret; 611 + }; 612 + imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) { 613 + const val = getObject(arg0); 614 + const ret = typeof(val) === 'object' && val !== null; 615 + return ret; 616 + }; 617 + imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) { 618 + const ret = getObject(arg0) === undefined; 619 + return ret; 620 + }; 621 + imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) { 622 + const ret = getObject(arg0) === getObject(arg1); 623 + return ret; 624 + }; 625 + imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) { 626 + const ret = getObject(arg0) == getObject(arg1); 627 + return ret; 628 + }; 629 + imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) { 630 + const obj = getObject(arg1); 631 + const ret = typeof(obj) === 'number' ? obj : undefined; 632 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 633 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 634 + }; 635 + imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) { 636 + const obj = getObject(arg1); 637 + const ret = typeof(obj) === 'string' ? obj : undefined; 638 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 639 + var len1 = WASM_VECTOR_LEN; 640 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 641 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 642 + }; 643 + imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) { 644 + throw new Error(getStringFromWasm0(arg0, arg1)); 645 + }; 646 + imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) { 647 + const ret = getObject(arg0).call(getObject(arg1)); 648 + return addHeapObject(ret); 649 + }, arguments) }; 650 + imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) { 651 + const ret = getObject(arg0).done; 652 + return ret; 653 + }; 654 + imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) { 655 + const ret = Object.entries(getObject(arg0)); 656 + return addHeapObject(ret); 657 + }; 658 + imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) { 659 + let deferred0_0; 660 + let deferred0_1; 661 + try { 662 + deferred0_0 = arg0; 663 + deferred0_1 = arg1; 664 + console.error(getStringFromWasm0(arg0, arg1)); 665 + } finally { 666 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 667 + } 668 + }; 669 + imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) { 670 + const ret = getObject(arg0)[arg1 >>> 0]; 671 + return addHeapObject(ret); 672 + }; 673 + imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) { 674 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 675 + return addHeapObject(ret); 676 + }, arguments) }; 677 + imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) { 678 + const ret = getObject(arg0)[getObject(arg1)]; 679 + return addHeapObject(ret); 680 + }; 681 + imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) { 682 + let result; 683 + try { 684 + result = getObject(arg0) instanceof ArrayBuffer; 685 + } catch (_) { 686 + result = false; 687 + } 688 + const ret = result; 689 + return ret; 690 + }; 691 + imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) { 692 + let result; 693 + try { 694 + result = getObject(arg0) instanceof Map; 695 + } catch (_) { 696 + result = false; 697 + } 698 + const ret = result; 699 + return ret; 700 + }; 701 + imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) { 702 + let result; 703 + try { 704 + result = getObject(arg0) instanceof Uint8Array; 705 + } catch (_) { 706 + result = false; 707 + } 708 + const ret = result; 709 + return ret; 710 + }; 711 + imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) { 712 + const ret = Array.isArray(getObject(arg0)); 713 + return ret; 714 + }; 715 + imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) { 716 + const ret = Number.isSafeInteger(getObject(arg0)); 717 + return ret; 718 + }; 719 + imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() { 720 + const ret = Symbol.iterator; 721 + return addHeapObject(ret); 722 + }; 723 + imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) { 724 + const ret = getObject(arg0).length; 725 + return ret; 726 + }; 727 + imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) { 728 + const ret = getObject(arg0).length; 729 + return ret; 730 + }; 731 + imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) { 732 + const ret = new Uint8Array(getObject(arg0)); 733 + return addHeapObject(ret); 734 + }; 735 + imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { 736 + const ret = new Error(); 737 + return addHeapObject(ret); 738 + }; 739 + imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) { 740 + const ret = getObject(arg0).next; 741 + return addHeapObject(ret); 742 + }; 743 + imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) { 744 + const ret = getObject(arg0).next(); 745 + return addHeapObject(ret); 746 + }, arguments) }; 747 + imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) { 748 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 749 + }; 750 + imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) { 751 + const ret = getObject(arg1).stack; 752 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 753 + const len1 = WASM_VECTOR_LEN; 754 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 755 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 756 + }; 757 + imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) { 758 + const ret = getObject(arg0).value; 759 + return addHeapObject(ret); 760 + }; 761 + imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) { 762 + // Cast intrinsic for `Ref(String) -> Externref`. 763 + const ret = getStringFromWasm0(arg0, arg1); 764 + return addHeapObject(ret); 765 + }; 766 + imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) { 767 + // Cast intrinsic for `U64 -> Externref`. 768 + const ret = BigInt.asUintN(64, arg0); 769 + return addHeapObject(ret); 770 + }; 771 + imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) { 772 + // Cast intrinsic for `I64 -> Externref`. 773 + const ret = arg0; 774 + return addHeapObject(ret); 775 + }; 776 + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { 777 + const ret = getObject(arg0); 778 + return addHeapObject(ret); 779 + }; 780 + imports.wbg.__wbindgen_object_drop_ref = function(arg0) { 781 + takeObject(arg0); 782 + }; 783 + imports.wbg.__wbindgen_object_is_undefined = function(arg0) { 784 + const ret = getObject(arg0) === undefined; 785 + return ret; 786 + }; 787 + 788 + return imports; 789 + } 790 + 791 + function __wbg_finalize_init(instance, module) { 792 + wasm = instance.exports; 793 + __wbg_init.__wbindgen_wasm_module = module; 794 + cachedDataViewMemory0 = null; 795 + cachedUint8ArrayMemory0 = null; 796 + 797 + 798 + wasm.__wbindgen_start(); 799 + return wasm; 800 + } 801 + 802 + function initSync(module) { 803 + if (wasm !== undefined) return wasm; 804 + 805 + 806 + if (typeof module !== 'undefined') { 807 + if (Object.getPrototypeOf(module) === Object.prototype) { 808 + ({module} = module) 809 + } else { 810 + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') 811 + } 812 + } 813 + 814 + const imports = __wbg_get_imports(); 815 + if (!(module instanceof WebAssembly.Module)) { 816 + module = new WebAssembly.Module(module); 817 + } 818 + const instance = new WebAssembly.Instance(module, imports); 819 + return __wbg_finalize_init(instance, module); 820 + } 821 + 822 + async function __wbg_init(module_or_path) { 823 + if (wasm !== undefined) return wasm; 824 + 825 + 826 + if (typeof module_or_path !== 'undefined') { 827 + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { 828 + ({module_or_path} = module_or_path) 829 + } else { 830 + console.warn('using deprecated parameters for the initialization function; pass a single object instead') 831 + } 832 + } 833 + 834 + if (typeof module_or_path === 'undefined') { 835 + module_or_path = new URL('weaver_renderer_bg.wasm', import.meta.url); 836 + } 837 + const imports = __wbg_get_imports(); 838 + 839 + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { 840 + module_or_path = fetch(module_or_path); 841 + } 842 + 843 + const { instance, module } = await __wbg_load(await module_or_path, imports); 844 + 845 + return __wbg_finalize_init(instance, module); 846 + } 847 + 848 + export { initSync }; 849 + export default __wbg_init;
+25
crates/weaver-renderer-js/pkg/core/web/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+45
crates/weaver-renderer-js/pkg/full/README.md
··· 1 + # @weaver/renderer 2 + 3 + WASM bindings for rendering AT Protocol records (Bluesky posts, etc.) to HTML. 4 + 5 + ## Installation 6 + 7 + ```bash 8 + npm install @weaver.sh/renderer-full # With syntax highlighting 9 + npm install @weaver.sh/renderer-core # Light(er) weight 10 + ``` 11 + 12 + ## Usage 13 + 14 + ### With a bundler (webpack, vite, etc.) 15 + 16 + ```javascript 17 + import init, { render_record, render_markdown } from '@weaver/renderer-full'; 18 + 19 + await init(); 20 + 21 + const html = render_record(atUri, recordJson); 22 + ``` 23 + 24 + ### Direct browser usage (no bundler) 25 + 26 + ```html 27 + <script type="module"> 28 + import init, { render_record } from '@weaver/renderer-full/web'; 29 + await init(); 30 + // ... 31 + </script> 32 + ``` 33 + 34 + ### Node.js 35 + 36 + ```javascript 37 + const { render_record } = require('@weaver/renderer-full/nodejs'); 38 + ``` 39 + 40 + ## API 41 + 42 + - `render_record(at_uri, record_json, fallback_author?, resolved_content?)` - Render an AT Protocol record 43 + - `render_markdown(markdown, resolved_content?)` - Render markdown to HTML 44 + - `render_math(latex, display_mode)` - Render LaTeX math to MathML 45 + - `render_faceted_text(text, facets_json)` - Render rich text with facets
+373
crates/weaver-renderer-js/pkg/full/bundler/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+84
crates/weaver-renderer-js/pkg/full/bundler/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;
+5
crates/weaver-renderer-js/pkg/full/bundler/weaver_renderer.js
··· 1 + import * as wasm from "./weaver_renderer_bg.wasm"; 2 + export * from "./weaver_renderer_bg.js"; 3 + import { __wbg_set_wasm } from "./weaver_renderer_bg.js"; 4 + __wbg_set_wasm(wasm); 5 + wasm.__wbindgen_start();
+797
crates/weaver-renderer-js/pkg/full/bundler/weaver_renderer_bg.js
··· 1 + let wasm; 2 + export function __wbg_set_wasm(val) { 3 + wasm = val; 4 + } 5 + 6 + function addHeapObject(obj) { 7 + if (heap_next === heap.length) heap.push(heap.length + 1); 8 + const idx = heap_next; 9 + heap_next = heap[idx]; 10 + 11 + heap[idx] = obj; 12 + return idx; 13 + } 14 + 15 + function _assertClass(instance, klass) { 16 + if (!(instance instanceof klass)) { 17 + throw new Error(`expected instance of ${klass.name}`); 18 + } 19 + } 20 + 21 + function debugString(val) { 22 + // primitive types 23 + const type = typeof val; 24 + if (type == 'number' || type == 'boolean' || val == null) { 25 + return `${val}`; 26 + } 27 + if (type == 'string') { 28 + return `"${val}"`; 29 + } 30 + if (type == 'symbol') { 31 + const description = val.description; 32 + if (description == null) { 33 + return 'Symbol'; 34 + } else { 35 + return `Symbol(${description})`; 36 + } 37 + } 38 + if (type == 'function') { 39 + const name = val.name; 40 + if (typeof name == 'string' && name.length > 0) { 41 + return `Function(${name})`; 42 + } else { 43 + return 'Function'; 44 + } 45 + } 46 + // objects 47 + if (Array.isArray(val)) { 48 + const length = val.length; 49 + let debug = '['; 50 + if (length > 0) { 51 + debug += debugString(val[0]); 52 + } 53 + for(let i = 1; i < length; i++) { 54 + debug += ', ' + debugString(val[i]); 55 + } 56 + debug += ']'; 57 + return debug; 58 + } 59 + // Test for built-in 60 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 61 + let className; 62 + if (builtInMatches && builtInMatches.length > 1) { 63 + className = builtInMatches[1]; 64 + } else { 65 + // Failed to match the standard '[object ClassName]' 66 + return toString.call(val); 67 + } 68 + if (className == 'Object') { 69 + // we're a user defined class or Object 70 + // JSON.stringify avoids problems with cycles, and is generally much 71 + // easier than looping through ownProperties of `val`. 72 + try { 73 + return 'Object(' + JSON.stringify(val) + ')'; 74 + } catch (_) { 75 + return 'Object'; 76 + } 77 + } 78 + // errors 79 + if (val instanceof Error) { 80 + return `${val.name}: ${val.message}\n${val.stack}`; 81 + } 82 + // TODO we could test for more things here, like `Set`s and `Map`s. 83 + return className; 84 + } 85 + 86 + function dropObject(idx) { 87 + if (idx < 132) return; 88 + heap[idx] = heap_next; 89 + heap_next = idx; 90 + } 91 + 92 + function getArrayU8FromWasm0(ptr, len) { 93 + ptr = ptr >>> 0; 94 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 95 + } 96 + 97 + let cachedDataViewMemory0 = null; 98 + function getDataViewMemory0() { 99 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 100 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 101 + } 102 + return cachedDataViewMemory0; 103 + } 104 + 105 + function getStringFromWasm0(ptr, len) { 106 + ptr = ptr >>> 0; 107 + return decodeText(ptr, len); 108 + } 109 + 110 + let cachedUint8ArrayMemory0 = null; 111 + function getUint8ArrayMemory0() { 112 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 113 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 114 + } 115 + return cachedUint8ArrayMemory0; 116 + } 117 + 118 + function getObject(idx) { return heap[idx]; } 119 + 120 + function handleError(f, args) { 121 + try { 122 + return f.apply(this, args); 123 + } catch (e) { 124 + wasm.__wbindgen_export3(addHeapObject(e)); 125 + } 126 + } 127 + 128 + let heap = new Array(128).fill(undefined); 129 + heap.push(undefined, null, true, false); 130 + 131 + let heap_next = heap.length; 132 + 133 + function isLikeNone(x) { 134 + return x === undefined || x === null; 135 + } 136 + 137 + function passStringToWasm0(arg, malloc, realloc) { 138 + if (realloc === undefined) { 139 + const buf = cachedTextEncoder.encode(arg); 140 + const ptr = malloc(buf.length, 1) >>> 0; 141 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 142 + WASM_VECTOR_LEN = buf.length; 143 + return ptr; 144 + } 145 + 146 + let len = arg.length; 147 + let ptr = malloc(len, 1) >>> 0; 148 + 149 + const mem = getUint8ArrayMemory0(); 150 + 151 + let offset = 0; 152 + 153 + for (; offset < len; offset++) { 154 + const code = arg.charCodeAt(offset); 155 + if (code > 0x7F) break; 156 + mem[ptr + offset] = code; 157 + } 158 + if (offset !== len) { 159 + if (offset !== 0) { 160 + arg = arg.slice(offset); 161 + } 162 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 163 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 164 + const ret = cachedTextEncoder.encodeInto(arg, view); 165 + 166 + offset += ret.written; 167 + ptr = realloc(ptr, len, offset, 1) >>> 0; 168 + } 169 + 170 + WASM_VECTOR_LEN = offset; 171 + return ptr; 172 + } 173 + 174 + function takeObject(idx) { 175 + const ret = getObject(idx); 176 + dropObject(idx); 177 + return ret; 178 + } 179 + 180 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 181 + cachedTextDecoder.decode(); 182 + const MAX_SAFARI_DECODE_BYTES = 2146435072; 183 + let numBytesDecoded = 0; 184 + function decodeText(ptr, len) { 185 + numBytesDecoded += len; 186 + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { 187 + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 188 + cachedTextDecoder.decode(); 189 + numBytesDecoded = len; 190 + } 191 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 192 + } 193 + 194 + const cachedTextEncoder = new TextEncoder(); 195 + 196 + if (!('encodeInto' in cachedTextEncoder)) { 197 + cachedTextEncoder.encodeInto = function (arg, view) { 198 + const buf = cachedTextEncoder.encode(arg); 199 + view.set(buf); 200 + return { 201 + read: arg.length, 202 + written: buf.length 203 + }; 204 + } 205 + } 206 + 207 + let WASM_VECTOR_LEN = 0; 208 + 209 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 210 + ? { register: () => {}, unregister: () => {} } 211 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 212 + 213 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 214 + ? { register: () => {}, unregister: () => {} } 215 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 216 + 217 + /** 218 + * Result from rendering LaTeX math. 219 + */ 220 + export class JsMathResult { 221 + static __wrap(ptr) { 222 + ptr = ptr >>> 0; 223 + const obj = Object.create(JsMathResult.prototype); 224 + obj.__wbg_ptr = ptr; 225 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 226 + return obj; 227 + } 228 + __destroy_into_raw() { 229 + const ptr = this.__wbg_ptr; 230 + this.__wbg_ptr = 0; 231 + JsMathResultFinalization.unregister(this); 232 + return ptr; 233 + } 234 + free() { 235 + const ptr = this.__destroy_into_raw(); 236 + wasm.__wbg_jsmathresult_free(ptr, 0); 237 + } 238 + /** 239 + * @returns {boolean} 240 + */ 241 + get success() { 242 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 243 + return ret !== 0; 244 + } 245 + /** 246 + * @param {boolean} arg0 247 + */ 248 + set success(arg0) { 249 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 250 + } 251 + /** 252 + * @returns {string} 253 + */ 254 + get html() { 255 + let deferred1_0; 256 + let deferred1_1; 257 + try { 258 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 259 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 260 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 261 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 262 + deferred1_0 = r0; 263 + deferred1_1 = r1; 264 + return getStringFromWasm0(r0, r1); 265 + } finally { 266 + wasm.__wbindgen_add_to_stack_pointer(16); 267 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 268 + } 269 + } 270 + /** 271 + * @param {string} arg0 272 + */ 273 + set html(arg0) { 274 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 275 + const len0 = WASM_VECTOR_LEN; 276 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 277 + } 278 + /** 279 + * @returns {string | undefined} 280 + */ 281 + get error() { 282 + try { 283 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 284 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 285 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 286 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 287 + let v1; 288 + if (r0 !== 0) { 289 + v1 = getStringFromWasm0(r0, r1).slice(); 290 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 291 + } 292 + return v1; 293 + } finally { 294 + wasm.__wbindgen_add_to_stack_pointer(16); 295 + } 296 + } 297 + /** 298 + * @param {string | null} [arg0] 299 + */ 300 + set error(arg0) { 301 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 302 + var len0 = WASM_VECTOR_LEN; 303 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 304 + } 305 + } 306 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 307 + 308 + /** 309 + * Pre-rendered embed content for synchronous rendering. 310 + * 311 + * Build this by calling `create_resolved_content()` and adding embeds 312 + * with `resolved_content_add_embed()`. 313 + */ 314 + export class JsResolvedContent { 315 + static __wrap(ptr) { 316 + ptr = ptr >>> 0; 317 + const obj = Object.create(JsResolvedContent.prototype); 318 + obj.__wbg_ptr = ptr; 319 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 320 + return obj; 321 + } 322 + __destroy_into_raw() { 323 + const ptr = this.__wbg_ptr; 324 + this.__wbg_ptr = 0; 325 + JsResolvedContentFinalization.unregister(this); 326 + return ptr; 327 + } 328 + free() { 329 + const ptr = this.__destroy_into_raw(); 330 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 331 + } 332 + /** 333 + * Create an empty resolved content container. 334 + */ 335 + constructor() { 336 + const ret = wasm.create_resolved_content(); 337 + this.__wbg_ptr = ret >>> 0; 338 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 339 + return this; 340 + } 341 + /** 342 + * Add pre-rendered embed HTML for an AT URI. 343 + * 344 + * # Arguments 345 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 346 + * * `html` - The pre-rendered HTML for this embed 347 + * @param {string} at_uri 348 + * @param {string} html 349 + */ 350 + addEmbed(at_uri, html) { 351 + try { 352 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 353 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 354 + const len0 = WASM_VECTOR_LEN; 355 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 356 + const len1 = WASM_VECTOR_LEN; 357 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 358 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 359 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 360 + if (r1) { 361 + throw takeObject(r0); 362 + } 363 + } finally { 364 + wasm.__wbindgen_add_to_stack_pointer(16); 365 + } 366 + } 367 + } 368 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 369 + 370 + /** 371 + * Create an empty resolved content container. 372 + * 373 + * Use this to pre-render embeds before calling render functions. 374 + * @returns {JsResolvedContent} 375 + */ 376 + export function create_resolved_content() { 377 + const ret = wasm.create_resolved_content(); 378 + return JsResolvedContent.__wrap(ret); 379 + } 380 + 381 + /** 382 + * Initialize panic hook for better error messages in console. 383 + */ 384 + export function init() { 385 + wasm.init(); 386 + } 387 + 388 + /** 389 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 390 + * 391 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 392 + * 393 + * # Arguments 394 + * * `text` - The plain text content 395 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 396 + * @param {string} text 397 + * @param {any} facets_json 398 + * @returns {string} 399 + */ 400 + export function render_faceted_text(text, facets_json) { 401 + let deferred3_0; 402 + let deferred3_1; 403 + try { 404 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 405 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 406 + const len0 = WASM_VECTOR_LEN; 407 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 408 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 409 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 410 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 411 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 412 + var ptr2 = r0; 413 + var len2 = r1; 414 + if (r3) { 415 + ptr2 = 0; len2 = 0; 416 + throw takeObject(r2); 417 + } 418 + deferred3_0 = ptr2; 419 + deferred3_1 = len2; 420 + return getStringFromWasm0(ptr2, len2); 421 + } finally { 422 + wasm.__wbindgen_add_to_stack_pointer(16); 423 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 424 + } 425 + } 426 + 427 + /** 428 + * Render markdown to HTML. 429 + * 430 + * # Arguments 431 + * * `markdown` - The markdown source text 432 + * * `resolved_content` - Optional pre-rendered embed content 433 + * @param {string} markdown 434 + * @param {JsResolvedContent | null} [resolved_content] 435 + * @returns {string} 436 + */ 437 + export function render_markdown(markdown, resolved_content) { 438 + let deferred4_0; 439 + let deferred4_1; 440 + try { 441 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 442 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 443 + const len0 = WASM_VECTOR_LEN; 444 + let ptr1 = 0; 445 + if (!isLikeNone(resolved_content)) { 446 + _assertClass(resolved_content, JsResolvedContent); 447 + ptr1 = resolved_content.__destroy_into_raw(); 448 + } 449 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 450 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 451 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 452 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 453 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 454 + var ptr3 = r0; 455 + var len3 = r1; 456 + if (r3) { 457 + ptr3 = 0; len3 = 0; 458 + throw takeObject(r2); 459 + } 460 + deferred4_0 = ptr3; 461 + deferred4_1 = len3; 462 + return getStringFromWasm0(ptr3, len3); 463 + } finally { 464 + wasm.__wbindgen_add_to_stack_pointer(16); 465 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 466 + } 467 + } 468 + 469 + /** 470 + * Render LaTeX math to MathML. 471 + * 472 + * # Arguments 473 + * * `latex` - The LaTeX math expression 474 + * * `display_mode` - true for display math (block), false for inline math 475 + * @param {string} latex 476 + * @param {boolean} display_mode 477 + * @returns {JsMathResult} 478 + */ 479 + export function render_math(latex, display_mode) { 480 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 481 + const len0 = WASM_VECTOR_LEN; 482 + const ret = wasm.render_math(ptr0, len0, display_mode); 483 + return JsMathResult.__wrap(ret); 484 + } 485 + 486 + /** 487 + * Render an AT Protocol record as HTML. 488 + * 489 + * Takes a record URI and the record data (typically fetched from an appview). 490 + * Returns the rendered HTML string. 491 + * 492 + * # Arguments 493 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 494 + * * `record_json` - The record data as JSON 495 + * * `fallback_author` - Optional author profile for records that don't include author info 496 + * * `resolved_content` - Optional pre-rendered embed content 497 + * @param {string} at_uri 498 + * @param {any} record_json 499 + * @param {any | null} [fallback_author] 500 + * @param {JsResolvedContent | null} [resolved_content] 501 + * @returns {string} 502 + */ 503 + export function render_record(at_uri, record_json, fallback_author, resolved_content) { 504 + let deferred4_0; 505 + let deferred4_1; 506 + try { 507 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 508 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 509 + const len0 = WASM_VECTOR_LEN; 510 + let ptr1 = 0; 511 + if (!isLikeNone(resolved_content)) { 512 + _assertClass(resolved_content, JsResolvedContent); 513 + ptr1 = resolved_content.__destroy_into_raw(); 514 + } 515 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 516 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 517 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 518 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 519 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 520 + var ptr3 = r0; 521 + var len3 = r1; 522 + if (r3) { 523 + ptr3 = 0; len3 = 0; 524 + throw takeObject(r2); 525 + } 526 + deferred4_0 = ptr3; 527 + deferred4_1 = len3; 528 + return getStringFromWasm0(ptr3, len3); 529 + } finally { 530 + wasm.__wbindgen_add_to_stack_pointer(16); 531 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 532 + } 533 + } 534 + 535 + export function __wbg_Error_52673b7de5a0ca89(arg0, arg1) { 536 + const ret = Error(getStringFromWasm0(arg0, arg1)); 537 + return addHeapObject(ret); 538 + }; 539 + 540 + export function __wbg_Number_2d1dcfcf4ec51736(arg0) { 541 + const ret = Number(getObject(arg0)); 542 + return ret; 543 + }; 544 + 545 + export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) { 546 + const ret = String(getObject(arg1)); 547 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 548 + const len1 = WASM_VECTOR_LEN; 549 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 550 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 551 + }; 552 + 553 + export function __wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d(arg0, arg1) { 554 + const v = getObject(arg1); 555 + const ret = typeof(v) === 'bigint' ? v : undefined; 556 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 557 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 558 + }; 559 + 560 + export function __wbg___wbindgen_boolean_get_dea25b33882b895b(arg0) { 561 + const v = getObject(arg0); 562 + const ret = typeof(v) === 'boolean' ? v : undefined; 563 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 564 + }; 565 + 566 + export function __wbg___wbindgen_debug_string_adfb662ae34724b6(arg0, arg1) { 567 + const ret = debugString(getObject(arg1)); 568 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 569 + const len1 = WASM_VECTOR_LEN; 570 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 571 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 572 + }; 573 + 574 + export function __wbg___wbindgen_in_0d3e1e8f0c669317(arg0, arg1) { 575 + const ret = getObject(arg0) in getObject(arg1); 576 + return ret; 577 + }; 578 + 579 + export function __wbg___wbindgen_is_bigint_0e1a2e3f55cfae27(arg0) { 580 + const ret = typeof(getObject(arg0)) === 'bigint'; 581 + return ret; 582 + }; 583 + 584 + export function __wbg___wbindgen_is_function_8d400b8b1af978cd(arg0) { 585 + const ret = typeof(getObject(arg0)) === 'function'; 586 + return ret; 587 + }; 588 + 589 + export function __wbg___wbindgen_is_object_ce774f3490692386(arg0) { 590 + const val = getObject(arg0); 591 + const ret = typeof(val) === 'object' && val !== null; 592 + return ret; 593 + }; 594 + 595 + export function __wbg___wbindgen_is_undefined_f6b95eab589e0269(arg0) { 596 + const ret = getObject(arg0) === undefined; 597 + return ret; 598 + }; 599 + 600 + export function __wbg___wbindgen_jsval_eq_b6101cc9cef1fe36(arg0, arg1) { 601 + const ret = getObject(arg0) === getObject(arg1); 602 + return ret; 603 + }; 604 + 605 + export function __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d(arg0, arg1) { 606 + const ret = getObject(arg0) == getObject(arg1); 607 + return ret; 608 + }; 609 + 610 + export function __wbg___wbindgen_number_get_9619185a74197f95(arg0, arg1) { 611 + const obj = getObject(arg1); 612 + const ret = typeof(obj) === 'number' ? obj : undefined; 613 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 614 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 615 + }; 616 + 617 + export function __wbg___wbindgen_string_get_a2a31e16edf96e42(arg0, arg1) { 618 + const obj = getObject(arg1); 619 + const ret = typeof(obj) === 'string' ? obj : undefined; 620 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 621 + var len1 = WASM_VECTOR_LEN; 622 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 623 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 624 + }; 625 + 626 + export function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) { 627 + throw new Error(getStringFromWasm0(arg0, arg1)); 628 + }; 629 + 630 + export function __wbg_call_abb4ff46ce38be40() { return handleError(function (arg0, arg1) { 631 + const ret = getObject(arg0).call(getObject(arg1)); 632 + return addHeapObject(ret); 633 + }, arguments) }; 634 + 635 + export function __wbg_done_62ea16af4ce34b24(arg0) { 636 + const ret = getObject(arg0).done; 637 + return ret; 638 + }; 639 + 640 + export function __wbg_entries_83c79938054e065f(arg0) { 641 + const ret = Object.entries(getObject(arg0)); 642 + return addHeapObject(ret); 643 + }; 644 + 645 + export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) { 646 + let deferred0_0; 647 + let deferred0_1; 648 + try { 649 + deferred0_0 = arg0; 650 + deferred0_1 = arg1; 651 + console.error(getStringFromWasm0(arg0, arg1)); 652 + } finally { 653 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 654 + } 655 + }; 656 + 657 + export function __wbg_get_6b7bd52aca3f9671(arg0, arg1) { 658 + const ret = getObject(arg0)[arg1 >>> 0]; 659 + return addHeapObject(ret); 660 + }; 661 + 662 + export function __wbg_get_af9dab7e9603ea93() { return handleError(function (arg0, arg1) { 663 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 664 + return addHeapObject(ret); 665 + }, arguments) }; 666 + 667 + export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) { 668 + const ret = getObject(arg0)[getObject(arg1)]; 669 + return addHeapObject(ret); 670 + }; 671 + 672 + export function __wbg_instanceof_ArrayBuffer_f3320d2419cd0355(arg0) { 673 + let result; 674 + try { 675 + result = getObject(arg0) instanceof ArrayBuffer; 676 + } catch (_) { 677 + result = false; 678 + } 679 + const ret = result; 680 + return ret; 681 + }; 682 + 683 + export function __wbg_instanceof_Map_084be8da74364158(arg0) { 684 + let result; 685 + try { 686 + result = getObject(arg0) instanceof Map; 687 + } catch (_) { 688 + result = false; 689 + } 690 + const ret = result; 691 + return ret; 692 + }; 693 + 694 + export function __wbg_instanceof_Uint8Array_da54ccc9d3e09434(arg0) { 695 + let result; 696 + try { 697 + result = getObject(arg0) instanceof Uint8Array; 698 + } catch (_) { 699 + result = false; 700 + } 701 + const ret = result; 702 + return ret; 703 + }; 704 + 705 + export function __wbg_isArray_51fd9e6422c0a395(arg0) { 706 + const ret = Array.isArray(getObject(arg0)); 707 + return ret; 708 + }; 709 + 710 + export function __wbg_isSafeInteger_ae7d3f054d55fa16(arg0) { 711 + const ret = Number.isSafeInteger(getObject(arg0)); 712 + return ret; 713 + }; 714 + 715 + export function __wbg_iterator_27b7c8b35ab3e86b() { 716 + const ret = Symbol.iterator; 717 + return addHeapObject(ret); 718 + }; 719 + 720 + export function __wbg_length_22ac23eaec9d8053(arg0) { 721 + const ret = getObject(arg0).length; 722 + return ret; 723 + }; 724 + 725 + export function __wbg_length_d45040a40c570362(arg0) { 726 + const ret = getObject(arg0).length; 727 + return ret; 728 + }; 729 + 730 + export function __wbg_new_6421f6084cc5bc5a(arg0) { 731 + const ret = new Uint8Array(getObject(arg0)); 732 + return addHeapObject(ret); 733 + }; 734 + 735 + export function __wbg_new_8a6f238a6ece86ea() { 736 + const ret = new Error(); 737 + return addHeapObject(ret); 738 + }; 739 + 740 + export function __wbg_next_138a17bbf04e926c(arg0) { 741 + const ret = getObject(arg0).next; 742 + return addHeapObject(ret); 743 + }; 744 + 745 + export function __wbg_next_3cfe5c0fe2a4cc53() { return handleError(function (arg0) { 746 + const ret = getObject(arg0).next(); 747 + return addHeapObject(ret); 748 + }, arguments) }; 749 + 750 + export function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0, arg1, arg2) { 751 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 752 + }; 753 + 754 + export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) { 755 + const ret = getObject(arg1).stack; 756 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 757 + const len1 = WASM_VECTOR_LEN; 758 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 759 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 760 + }; 761 + 762 + export function __wbg_value_57b7b035e117f7ee(arg0) { 763 + const ret = getObject(arg0).value; 764 + return addHeapObject(ret); 765 + }; 766 + 767 + export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) { 768 + // Cast intrinsic for `Ref(String) -> Externref`. 769 + const ret = getStringFromWasm0(arg0, arg1); 770 + return addHeapObject(ret); 771 + }; 772 + 773 + export function __wbindgen_cast_4625c577ab2ec9ee(arg0) { 774 + // Cast intrinsic for `U64 -> Externref`. 775 + const ret = BigInt.asUintN(64, arg0); 776 + return addHeapObject(ret); 777 + }; 778 + 779 + export function __wbindgen_cast_9ae0607507abb057(arg0) { 780 + // Cast intrinsic for `I64 -> Externref`. 781 + const ret = arg0; 782 + return addHeapObject(ret); 783 + }; 784 + 785 + export function __wbindgen_object_clone_ref(arg0) { 786 + const ret = getObject(arg0); 787 + return addHeapObject(ret); 788 + }; 789 + 790 + export function __wbindgen_object_drop_ref(arg0) { 791 + takeObject(arg0); 792 + }; 793 + 794 + export function __wbindgen_object_is_undefined(arg0) { 795 + const ret = getObject(arg0) === undefined; 796 + return ret; 797 + };
+25
crates/weaver-renderer-js/pkg/full/bundler/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+373
crates/weaver-renderer-js/pkg/full/deno/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+84
crates/weaver-renderer-js/pkg/full/deno/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;
+743
crates/weaver-renderer-js/pkg/full/deno/weaver_renderer.js
··· 1 + 2 + 3 + function addHeapObject(obj) { 4 + if (heap_next === heap.length) heap.push(heap.length + 1); 5 + const idx = heap_next; 6 + heap_next = heap[idx]; 7 + 8 + heap[idx] = obj; 9 + return idx; 10 + } 11 + 12 + function _assertClass(instance, klass) { 13 + if (!(instance instanceof klass)) { 14 + throw new Error(`expected instance of ${klass.name}`); 15 + } 16 + } 17 + 18 + function debugString(val) { 19 + // primitive types 20 + const type = typeof val; 21 + if (type == 'number' || type == 'boolean' || val == null) { 22 + return `${val}`; 23 + } 24 + if (type == 'string') { 25 + return `"${val}"`; 26 + } 27 + if (type == 'symbol') { 28 + const description = val.description; 29 + if (description == null) { 30 + return 'Symbol'; 31 + } else { 32 + return `Symbol(${description})`; 33 + } 34 + } 35 + if (type == 'function') { 36 + const name = val.name; 37 + if (typeof name == 'string' && name.length > 0) { 38 + return `Function(${name})`; 39 + } else { 40 + return 'Function'; 41 + } 42 + } 43 + // objects 44 + if (Array.isArray(val)) { 45 + const length = val.length; 46 + let debug = '['; 47 + if (length > 0) { 48 + debug += debugString(val[0]); 49 + } 50 + for(let i = 1; i < length; i++) { 51 + debug += ', ' + debugString(val[i]); 52 + } 53 + debug += ']'; 54 + return debug; 55 + } 56 + // Test for built-in 57 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 58 + let className; 59 + if (builtInMatches && builtInMatches.length > 1) { 60 + className = builtInMatches[1]; 61 + } else { 62 + // Failed to match the standard '[object ClassName]' 63 + return toString.call(val); 64 + } 65 + if (className == 'Object') { 66 + // we're a user defined class or Object 67 + // JSON.stringify avoids problems with cycles, and is generally much 68 + // easier than looping through ownProperties of `val`. 69 + try { 70 + return 'Object(' + JSON.stringify(val) + ')'; 71 + } catch (_) { 72 + return 'Object'; 73 + } 74 + } 75 + // errors 76 + if (val instanceof Error) { 77 + return `${val.name}: ${val.message}\n${val.stack}`; 78 + } 79 + // TODO we could test for more things here, like `Set`s and `Map`s. 80 + return className; 81 + } 82 + 83 + function dropObject(idx) { 84 + if (idx < 132) return; 85 + heap[idx] = heap_next; 86 + heap_next = idx; 87 + } 88 + 89 + function getArrayU8FromWasm0(ptr, len) { 90 + ptr = ptr >>> 0; 91 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 92 + } 93 + 94 + let cachedDataViewMemory0 = null; 95 + function getDataViewMemory0() { 96 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 97 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 98 + } 99 + return cachedDataViewMemory0; 100 + } 101 + 102 + function getStringFromWasm0(ptr, len) { 103 + ptr = ptr >>> 0; 104 + return decodeText(ptr, len); 105 + } 106 + 107 + let cachedUint8ArrayMemory0 = null; 108 + function getUint8ArrayMemory0() { 109 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 110 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 111 + } 112 + return cachedUint8ArrayMemory0; 113 + } 114 + 115 + function getObject(idx) { return heap[idx]; } 116 + 117 + function handleError(f, args) { 118 + try { 119 + return f.apply(this, args); 120 + } catch (e) { 121 + wasm.__wbindgen_export3(addHeapObject(e)); 122 + } 123 + } 124 + 125 + let heap = new Array(128).fill(undefined); 126 + heap.push(undefined, null, true, false); 127 + 128 + let heap_next = heap.length; 129 + 130 + function isLikeNone(x) { 131 + return x === undefined || x === null; 132 + } 133 + 134 + function passStringToWasm0(arg, malloc, realloc) { 135 + if (realloc === undefined) { 136 + const buf = cachedTextEncoder.encode(arg); 137 + const ptr = malloc(buf.length, 1) >>> 0; 138 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 139 + WASM_VECTOR_LEN = buf.length; 140 + return ptr; 141 + } 142 + 143 + let len = arg.length; 144 + let ptr = malloc(len, 1) >>> 0; 145 + 146 + const mem = getUint8ArrayMemory0(); 147 + 148 + let offset = 0; 149 + 150 + for (; offset < len; offset++) { 151 + const code = arg.charCodeAt(offset); 152 + if (code > 0x7F) break; 153 + mem[ptr + offset] = code; 154 + } 155 + if (offset !== len) { 156 + if (offset !== 0) { 157 + arg = arg.slice(offset); 158 + } 159 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 160 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 161 + const ret = cachedTextEncoder.encodeInto(arg, view); 162 + 163 + offset += ret.written; 164 + ptr = realloc(ptr, len, offset, 1) >>> 0; 165 + } 166 + 167 + WASM_VECTOR_LEN = offset; 168 + return ptr; 169 + } 170 + 171 + function takeObject(idx) { 172 + const ret = getObject(idx); 173 + dropObject(idx); 174 + return ret; 175 + } 176 + 177 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 178 + cachedTextDecoder.decode(); 179 + function decodeText(ptr, len) { 180 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 181 + } 182 + 183 + const cachedTextEncoder = new TextEncoder(); 184 + 185 + let WASM_VECTOR_LEN = 0; 186 + 187 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 188 + ? { register: () => {}, unregister: () => {} } 189 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 190 + 191 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 192 + ? { register: () => {}, unregister: () => {} } 193 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 194 + 195 + /** 196 + * Result from rendering LaTeX math. 197 + */ 198 + export class JsMathResult { 199 + static __wrap(ptr) { 200 + ptr = ptr >>> 0; 201 + const obj = Object.create(JsMathResult.prototype); 202 + obj.__wbg_ptr = ptr; 203 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 204 + return obj; 205 + } 206 + __destroy_into_raw() { 207 + const ptr = this.__wbg_ptr; 208 + this.__wbg_ptr = 0; 209 + JsMathResultFinalization.unregister(this); 210 + return ptr; 211 + } 212 + free() { 213 + const ptr = this.__destroy_into_raw(); 214 + wasm.__wbg_jsmathresult_free(ptr, 0); 215 + } 216 + /** 217 + * @returns {boolean} 218 + */ 219 + get success() { 220 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 221 + return ret !== 0; 222 + } 223 + /** 224 + * @param {boolean} arg0 225 + */ 226 + set success(arg0) { 227 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 228 + } 229 + /** 230 + * @returns {string} 231 + */ 232 + get html() { 233 + let deferred1_0; 234 + let deferred1_1; 235 + try { 236 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 237 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 238 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 239 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 240 + deferred1_0 = r0; 241 + deferred1_1 = r1; 242 + return getStringFromWasm0(r0, r1); 243 + } finally { 244 + wasm.__wbindgen_add_to_stack_pointer(16); 245 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 246 + } 247 + } 248 + /** 249 + * @param {string} arg0 250 + */ 251 + set html(arg0) { 252 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 253 + const len0 = WASM_VECTOR_LEN; 254 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 255 + } 256 + /** 257 + * @returns {string | undefined} 258 + */ 259 + get error() { 260 + try { 261 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 262 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 263 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 264 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 265 + let v1; 266 + if (r0 !== 0) { 267 + v1 = getStringFromWasm0(r0, r1).slice(); 268 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 269 + } 270 + return v1; 271 + } finally { 272 + wasm.__wbindgen_add_to_stack_pointer(16); 273 + } 274 + } 275 + /** 276 + * @param {string | null} [arg0] 277 + */ 278 + set error(arg0) { 279 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 280 + var len0 = WASM_VECTOR_LEN; 281 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 282 + } 283 + } 284 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 285 + 286 + /** 287 + * Pre-rendered embed content for synchronous rendering. 288 + * 289 + * Build this by calling `create_resolved_content()` and adding embeds 290 + * with `resolved_content_add_embed()`. 291 + */ 292 + export class JsResolvedContent { 293 + static __wrap(ptr) { 294 + ptr = ptr >>> 0; 295 + const obj = Object.create(JsResolvedContent.prototype); 296 + obj.__wbg_ptr = ptr; 297 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 298 + return obj; 299 + } 300 + __destroy_into_raw() { 301 + const ptr = this.__wbg_ptr; 302 + this.__wbg_ptr = 0; 303 + JsResolvedContentFinalization.unregister(this); 304 + return ptr; 305 + } 306 + free() { 307 + const ptr = this.__destroy_into_raw(); 308 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 309 + } 310 + /** 311 + * Create an empty resolved content container. 312 + */ 313 + constructor() { 314 + const ret = wasm.create_resolved_content(); 315 + this.__wbg_ptr = ret >>> 0; 316 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 317 + return this; 318 + } 319 + /** 320 + * Add pre-rendered embed HTML for an AT URI. 321 + * 322 + * # Arguments 323 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 324 + * * `html` - The pre-rendered HTML for this embed 325 + * @param {string} at_uri 326 + * @param {string} html 327 + */ 328 + addEmbed(at_uri, html) { 329 + try { 330 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 331 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 332 + const len0 = WASM_VECTOR_LEN; 333 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 334 + const len1 = WASM_VECTOR_LEN; 335 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 336 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 337 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 338 + if (r1) { 339 + throw takeObject(r0); 340 + } 341 + } finally { 342 + wasm.__wbindgen_add_to_stack_pointer(16); 343 + } 344 + } 345 + } 346 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 347 + 348 + /** 349 + * Create an empty resolved content container. 350 + * 351 + * Use this to pre-render embeds before calling render functions. 352 + * @returns {JsResolvedContent} 353 + */ 354 + export function create_resolved_content() { 355 + const ret = wasm.create_resolved_content(); 356 + return JsResolvedContent.__wrap(ret); 357 + } 358 + 359 + /** 360 + * Initialize panic hook for better error messages in console. 361 + */ 362 + export function init() { 363 + wasm.init(); 364 + } 365 + 366 + /** 367 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 368 + * 369 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 370 + * 371 + * # Arguments 372 + * * `text` - The plain text content 373 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 374 + * @param {string} text 375 + * @param {any} facets_json 376 + * @returns {string} 377 + */ 378 + export function render_faceted_text(text, facets_json) { 379 + let deferred3_0; 380 + let deferred3_1; 381 + try { 382 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 383 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 384 + const len0 = WASM_VECTOR_LEN; 385 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 386 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 387 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 388 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 389 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 390 + var ptr2 = r0; 391 + var len2 = r1; 392 + if (r3) { 393 + ptr2 = 0; len2 = 0; 394 + throw takeObject(r2); 395 + } 396 + deferred3_0 = ptr2; 397 + deferred3_1 = len2; 398 + return getStringFromWasm0(ptr2, len2); 399 + } finally { 400 + wasm.__wbindgen_add_to_stack_pointer(16); 401 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 402 + } 403 + } 404 + 405 + /** 406 + * Render markdown to HTML. 407 + * 408 + * # Arguments 409 + * * `markdown` - The markdown source text 410 + * * `resolved_content` - Optional pre-rendered embed content 411 + * @param {string} markdown 412 + * @param {JsResolvedContent | null} [resolved_content] 413 + * @returns {string} 414 + */ 415 + export function render_markdown(markdown, resolved_content) { 416 + let deferred4_0; 417 + let deferred4_1; 418 + try { 419 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 420 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 421 + const len0 = WASM_VECTOR_LEN; 422 + let ptr1 = 0; 423 + if (!isLikeNone(resolved_content)) { 424 + _assertClass(resolved_content, JsResolvedContent); 425 + ptr1 = resolved_content.__destroy_into_raw(); 426 + } 427 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 428 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 429 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 430 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 431 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 432 + var ptr3 = r0; 433 + var len3 = r1; 434 + if (r3) { 435 + ptr3 = 0; len3 = 0; 436 + throw takeObject(r2); 437 + } 438 + deferred4_0 = ptr3; 439 + deferred4_1 = len3; 440 + return getStringFromWasm0(ptr3, len3); 441 + } finally { 442 + wasm.__wbindgen_add_to_stack_pointer(16); 443 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 444 + } 445 + } 446 + 447 + /** 448 + * Render LaTeX math to MathML. 449 + * 450 + * # Arguments 451 + * * `latex` - The LaTeX math expression 452 + * * `display_mode` - true for display math (block), false for inline math 453 + * @param {string} latex 454 + * @param {boolean} display_mode 455 + * @returns {JsMathResult} 456 + */ 457 + export function render_math(latex, display_mode) { 458 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 459 + const len0 = WASM_VECTOR_LEN; 460 + const ret = wasm.render_math(ptr0, len0, display_mode); 461 + return JsMathResult.__wrap(ret); 462 + } 463 + 464 + /** 465 + * Render an AT Protocol record as HTML. 466 + * 467 + * Takes a record URI and the record data (typically fetched from an appview). 468 + * Returns the rendered HTML string. 469 + * 470 + * # Arguments 471 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 472 + * * `record_json` - The record data as JSON 473 + * * `fallback_author` - Optional author profile for records that don't include author info 474 + * * `resolved_content` - Optional pre-rendered embed content 475 + * @param {string} at_uri 476 + * @param {any} record_json 477 + * @param {any | null} [fallback_author] 478 + * @param {JsResolvedContent | null} [resolved_content] 479 + * @returns {string} 480 + */ 481 + export function render_record(at_uri, record_json, fallback_author, resolved_content) { 482 + let deferred4_0; 483 + let deferred4_1; 484 + try { 485 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 486 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 487 + const len0 = WASM_VECTOR_LEN; 488 + let ptr1 = 0; 489 + if (!isLikeNone(resolved_content)) { 490 + _assertClass(resolved_content, JsResolvedContent); 491 + ptr1 = resolved_content.__destroy_into_raw(); 492 + } 493 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 494 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 495 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 496 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 497 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 498 + var ptr3 = r0; 499 + var len3 = r1; 500 + if (r3) { 501 + ptr3 = 0; len3 = 0; 502 + throw takeObject(r2); 503 + } 504 + deferred4_0 = ptr3; 505 + deferred4_1 = len3; 506 + return getStringFromWasm0(ptr3, len3); 507 + } finally { 508 + wasm.__wbindgen_add_to_stack_pointer(16); 509 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 510 + } 511 + } 512 + 513 + const imports = { 514 + __wbindgen_placeholder__: { 515 + __wbg_Error_52673b7de5a0ca89: function(arg0, arg1) { 516 + const ret = Error(getStringFromWasm0(arg0, arg1)); 517 + return addHeapObject(ret); 518 + }, 519 + __wbg_Number_2d1dcfcf4ec51736: function(arg0) { 520 + const ret = Number(getObject(arg0)); 521 + return ret; 522 + }, 523 + __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) { 524 + const ret = String(getObject(arg1)); 525 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 526 + const len1 = WASM_VECTOR_LEN; 527 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 528 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 529 + }, 530 + __wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d: function(arg0, arg1) { 531 + const v = getObject(arg1); 532 + const ret = typeof(v) === 'bigint' ? v : undefined; 533 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 534 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 535 + }, 536 + __wbg___wbindgen_boolean_get_dea25b33882b895b: function(arg0) { 537 + const v = getObject(arg0); 538 + const ret = typeof(v) === 'boolean' ? v : undefined; 539 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 540 + }, 541 + __wbg___wbindgen_debug_string_adfb662ae34724b6: function(arg0, arg1) { 542 + const ret = debugString(getObject(arg1)); 543 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 544 + const len1 = WASM_VECTOR_LEN; 545 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 546 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 547 + }, 548 + __wbg___wbindgen_in_0d3e1e8f0c669317: function(arg0, arg1) { 549 + const ret = getObject(arg0) in getObject(arg1); 550 + return ret; 551 + }, 552 + __wbg___wbindgen_is_bigint_0e1a2e3f55cfae27: function(arg0) { 553 + const ret = typeof(getObject(arg0)) === 'bigint'; 554 + return ret; 555 + }, 556 + __wbg___wbindgen_is_function_8d400b8b1af978cd: function(arg0) { 557 + const ret = typeof(getObject(arg0)) === 'function'; 558 + return ret; 559 + }, 560 + __wbg___wbindgen_is_object_ce774f3490692386: function(arg0) { 561 + const val = getObject(arg0); 562 + const ret = typeof(val) === 'object' && val !== null; 563 + return ret; 564 + }, 565 + __wbg___wbindgen_is_undefined_f6b95eab589e0269: function(arg0) { 566 + const ret = getObject(arg0) === undefined; 567 + return ret; 568 + }, 569 + __wbg___wbindgen_jsval_eq_b6101cc9cef1fe36: function(arg0, arg1) { 570 + const ret = getObject(arg0) === getObject(arg1); 571 + return ret; 572 + }, 573 + __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d: function(arg0, arg1) { 574 + const ret = getObject(arg0) == getObject(arg1); 575 + return ret; 576 + }, 577 + __wbg___wbindgen_number_get_9619185a74197f95: function(arg0, arg1) { 578 + const obj = getObject(arg1); 579 + const ret = typeof(obj) === 'number' ? obj : undefined; 580 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 581 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 582 + }, 583 + __wbg___wbindgen_string_get_a2a31e16edf96e42: function(arg0, arg1) { 584 + const obj = getObject(arg1); 585 + const ret = typeof(obj) === 'string' ? obj : undefined; 586 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 587 + var len1 = WASM_VECTOR_LEN; 588 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 589 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 590 + }, 591 + __wbg___wbindgen_throw_dd24417ed36fc46e: function(arg0, arg1) { 592 + throw new Error(getStringFromWasm0(arg0, arg1)); 593 + }, 594 + __wbg_call_abb4ff46ce38be40: function() { return handleError(function (arg0, arg1) { 595 + const ret = getObject(arg0).call(getObject(arg1)); 596 + return addHeapObject(ret); 597 + }, arguments) }, 598 + __wbg_done_62ea16af4ce34b24: function(arg0) { 599 + const ret = getObject(arg0).done; 600 + return ret; 601 + }, 602 + __wbg_entries_83c79938054e065f: function(arg0) { 603 + const ret = Object.entries(getObject(arg0)); 604 + return addHeapObject(ret); 605 + }, 606 + __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) { 607 + let deferred0_0; 608 + let deferred0_1; 609 + try { 610 + deferred0_0 = arg0; 611 + deferred0_1 = arg1; 612 + console.error(getStringFromWasm0(arg0, arg1)); 613 + } finally { 614 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 615 + } 616 + }, 617 + __wbg_get_6b7bd52aca3f9671: function(arg0, arg1) { 618 + const ret = getObject(arg0)[arg1 >>> 0]; 619 + return addHeapObject(ret); 620 + }, 621 + __wbg_get_af9dab7e9603ea93: function() { return handleError(function (arg0, arg1) { 622 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 623 + return addHeapObject(ret); 624 + }, arguments) }, 625 + __wbg_get_with_ref_key_1dc361bd10053bfe: function(arg0, arg1) { 626 + const ret = getObject(arg0)[getObject(arg1)]; 627 + return addHeapObject(ret); 628 + }, 629 + __wbg_instanceof_ArrayBuffer_f3320d2419cd0355: function(arg0) { 630 + let result; 631 + try { 632 + result = getObject(arg0) instanceof ArrayBuffer; 633 + } catch (_) { 634 + result = false; 635 + } 636 + const ret = result; 637 + return ret; 638 + }, 639 + __wbg_instanceof_Map_084be8da74364158: function(arg0) { 640 + let result; 641 + try { 642 + result = getObject(arg0) instanceof Map; 643 + } catch (_) { 644 + result = false; 645 + } 646 + const ret = result; 647 + return ret; 648 + }, 649 + __wbg_instanceof_Uint8Array_da54ccc9d3e09434: function(arg0) { 650 + let result; 651 + try { 652 + result = getObject(arg0) instanceof Uint8Array; 653 + } catch (_) { 654 + result = false; 655 + } 656 + const ret = result; 657 + return ret; 658 + }, 659 + __wbg_isArray_51fd9e6422c0a395: function(arg0) { 660 + const ret = Array.isArray(getObject(arg0)); 661 + return ret; 662 + }, 663 + __wbg_isSafeInteger_ae7d3f054d55fa16: function(arg0) { 664 + const ret = Number.isSafeInteger(getObject(arg0)); 665 + return ret; 666 + }, 667 + __wbg_iterator_27b7c8b35ab3e86b: function() { 668 + const ret = Symbol.iterator; 669 + return addHeapObject(ret); 670 + }, 671 + __wbg_length_22ac23eaec9d8053: function(arg0) { 672 + const ret = getObject(arg0).length; 673 + return ret; 674 + }, 675 + __wbg_length_d45040a40c570362: function(arg0) { 676 + const ret = getObject(arg0).length; 677 + return ret; 678 + }, 679 + __wbg_new_6421f6084cc5bc5a: function(arg0) { 680 + const ret = new Uint8Array(getObject(arg0)); 681 + return addHeapObject(ret); 682 + }, 683 + __wbg_new_8a6f238a6ece86ea: function() { 684 + const ret = new Error(); 685 + return addHeapObject(ret); 686 + }, 687 + __wbg_next_138a17bbf04e926c: function(arg0) { 688 + const ret = getObject(arg0).next; 689 + return addHeapObject(ret); 690 + }, 691 + __wbg_next_3cfe5c0fe2a4cc53: function() { return handleError(function (arg0) { 692 + const ret = getObject(arg0).next(); 693 + return addHeapObject(ret); 694 + }, arguments) }, 695 + __wbg_prototypesetcall_dfe9b766cdc1f1fd: function(arg0, arg1, arg2) { 696 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 697 + }, 698 + __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) { 699 + const ret = getObject(arg1).stack; 700 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 701 + const len1 = WASM_VECTOR_LEN; 702 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 703 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 704 + }, 705 + __wbg_value_57b7b035e117f7ee: function(arg0) { 706 + const ret = getObject(arg0).value; 707 + return addHeapObject(ret); 708 + }, 709 + __wbindgen_cast_2241b6af4c4b2941: function(arg0, arg1) { 710 + // Cast intrinsic for `Ref(String) -> Externref`. 711 + const ret = getStringFromWasm0(arg0, arg1); 712 + return addHeapObject(ret); 713 + }, 714 + __wbindgen_cast_4625c577ab2ec9ee: function(arg0) { 715 + // Cast intrinsic for `U64 -> Externref`. 716 + const ret = BigInt.asUintN(64, arg0); 717 + return addHeapObject(ret); 718 + }, 719 + __wbindgen_cast_9ae0607507abb057: function(arg0) { 720 + // Cast intrinsic for `I64 -> Externref`. 721 + const ret = arg0; 722 + return addHeapObject(ret); 723 + }, 724 + __wbindgen_object_clone_ref: function(arg0) { 725 + const ret = getObject(arg0); 726 + return addHeapObject(ret); 727 + }, 728 + __wbindgen_object_drop_ref: function(arg0) { 729 + takeObject(arg0); 730 + }, 731 + __wbindgen_object_is_undefined: function(arg0) { 732 + const ret = getObject(arg0) === undefined; 733 + return ret; 734 + }, 735 + }, 736 + 737 + }; 738 + 739 + const wasmUrl = new URL('weaver_renderer_bg.wasm', import.meta.url); 740 + const wasm = (await WebAssembly.instantiateStreaming(fetch(wasmUrl), imports)).instance.exports; 741 + export { wasm as __wasm }; 742 + 743 + wasm.__wbindgen_start();
+25
crates/weaver-renderer-js/pkg/full/deno/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+373
crates/weaver-renderer-js/pkg/full/nodejs/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+84
crates/weaver-renderer-js/pkg/full/nodejs/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string;
+803
crates/weaver-renderer-js/pkg/full/nodejs/weaver_renderer.js
··· 1 + 2 + let imports = {}; 3 + imports['__wbindgen_placeholder__'] = module.exports; 4 + 5 + function addHeapObject(obj) { 6 + if (heap_next === heap.length) heap.push(heap.length + 1); 7 + const idx = heap_next; 8 + heap_next = heap[idx]; 9 + 10 + heap[idx] = obj; 11 + return idx; 12 + } 13 + 14 + function _assertClass(instance, klass) { 15 + if (!(instance instanceof klass)) { 16 + throw new Error(`expected instance of ${klass.name}`); 17 + } 18 + } 19 + 20 + function debugString(val) { 21 + // primitive types 22 + const type = typeof val; 23 + if (type == 'number' || type == 'boolean' || val == null) { 24 + return `${val}`; 25 + } 26 + if (type == 'string') { 27 + return `"${val}"`; 28 + } 29 + if (type == 'symbol') { 30 + const description = val.description; 31 + if (description == null) { 32 + return 'Symbol'; 33 + } else { 34 + return `Symbol(${description})`; 35 + } 36 + } 37 + if (type == 'function') { 38 + const name = val.name; 39 + if (typeof name == 'string' && name.length > 0) { 40 + return `Function(${name})`; 41 + } else { 42 + return 'Function'; 43 + } 44 + } 45 + // objects 46 + if (Array.isArray(val)) { 47 + const length = val.length; 48 + let debug = '['; 49 + if (length > 0) { 50 + debug += debugString(val[0]); 51 + } 52 + for(let i = 1; i < length; i++) { 53 + debug += ', ' + debugString(val[i]); 54 + } 55 + debug += ']'; 56 + return debug; 57 + } 58 + // Test for built-in 59 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 60 + let className; 61 + if (builtInMatches && builtInMatches.length > 1) { 62 + className = builtInMatches[1]; 63 + } else { 64 + // Failed to match the standard '[object ClassName]' 65 + return toString.call(val); 66 + } 67 + if (className == 'Object') { 68 + // we're a user defined class or Object 69 + // JSON.stringify avoids problems with cycles, and is generally much 70 + // easier than looping through ownProperties of `val`. 71 + try { 72 + return 'Object(' + JSON.stringify(val) + ')'; 73 + } catch (_) { 74 + return 'Object'; 75 + } 76 + } 77 + // errors 78 + if (val instanceof Error) { 79 + return `${val.name}: ${val.message}\n${val.stack}`; 80 + } 81 + // TODO we could test for more things here, like `Set`s and `Map`s. 82 + return className; 83 + } 84 + 85 + function dropObject(idx) { 86 + if (idx < 132) return; 87 + heap[idx] = heap_next; 88 + heap_next = idx; 89 + } 90 + 91 + function getArrayU8FromWasm0(ptr, len) { 92 + ptr = ptr >>> 0; 93 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 94 + } 95 + 96 + let cachedDataViewMemory0 = null; 97 + function getDataViewMemory0() { 98 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 99 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 100 + } 101 + return cachedDataViewMemory0; 102 + } 103 + 104 + function getStringFromWasm0(ptr, len) { 105 + ptr = ptr >>> 0; 106 + return decodeText(ptr, len); 107 + } 108 + 109 + let cachedUint8ArrayMemory0 = null; 110 + function getUint8ArrayMemory0() { 111 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 112 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 113 + } 114 + return cachedUint8ArrayMemory0; 115 + } 116 + 117 + function getObject(idx) { return heap[idx]; } 118 + 119 + function handleError(f, args) { 120 + try { 121 + return f.apply(this, args); 122 + } catch (e) { 123 + wasm.__wbindgen_export3(addHeapObject(e)); 124 + } 125 + } 126 + 127 + let heap = new Array(128).fill(undefined); 128 + heap.push(undefined, null, true, false); 129 + 130 + let heap_next = heap.length; 131 + 132 + function isLikeNone(x) { 133 + return x === undefined || x === null; 134 + } 135 + 136 + function passStringToWasm0(arg, malloc, realloc) { 137 + if (realloc === undefined) { 138 + const buf = cachedTextEncoder.encode(arg); 139 + const ptr = malloc(buf.length, 1) >>> 0; 140 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 141 + WASM_VECTOR_LEN = buf.length; 142 + return ptr; 143 + } 144 + 145 + let len = arg.length; 146 + let ptr = malloc(len, 1) >>> 0; 147 + 148 + const mem = getUint8ArrayMemory0(); 149 + 150 + let offset = 0; 151 + 152 + for (; offset < len; offset++) { 153 + const code = arg.charCodeAt(offset); 154 + if (code > 0x7F) break; 155 + mem[ptr + offset] = code; 156 + } 157 + if (offset !== len) { 158 + if (offset !== 0) { 159 + arg = arg.slice(offset); 160 + } 161 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 162 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 163 + const ret = cachedTextEncoder.encodeInto(arg, view); 164 + 165 + offset += ret.written; 166 + ptr = realloc(ptr, len, offset, 1) >>> 0; 167 + } 168 + 169 + WASM_VECTOR_LEN = offset; 170 + return ptr; 171 + } 172 + 173 + function takeObject(idx) { 174 + const ret = getObject(idx); 175 + dropObject(idx); 176 + return ret; 177 + } 178 + 179 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 180 + cachedTextDecoder.decode(); 181 + function decodeText(ptr, len) { 182 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 183 + } 184 + 185 + const cachedTextEncoder = new TextEncoder(); 186 + 187 + if (!('encodeInto' in cachedTextEncoder)) { 188 + cachedTextEncoder.encodeInto = function (arg, view) { 189 + const buf = cachedTextEncoder.encode(arg); 190 + view.set(buf); 191 + return { 192 + read: arg.length, 193 + written: buf.length 194 + }; 195 + } 196 + } 197 + 198 + let WASM_VECTOR_LEN = 0; 199 + 200 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 201 + ? { register: () => {}, unregister: () => {} } 202 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 203 + 204 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 205 + ? { register: () => {}, unregister: () => {} } 206 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 207 + 208 + /** 209 + * Result from rendering LaTeX math. 210 + */ 211 + class JsMathResult { 212 + static __wrap(ptr) { 213 + ptr = ptr >>> 0; 214 + const obj = Object.create(JsMathResult.prototype); 215 + obj.__wbg_ptr = ptr; 216 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 217 + return obj; 218 + } 219 + __destroy_into_raw() { 220 + const ptr = this.__wbg_ptr; 221 + this.__wbg_ptr = 0; 222 + JsMathResultFinalization.unregister(this); 223 + return ptr; 224 + } 225 + free() { 226 + const ptr = this.__destroy_into_raw(); 227 + wasm.__wbg_jsmathresult_free(ptr, 0); 228 + } 229 + /** 230 + * @returns {boolean} 231 + */ 232 + get success() { 233 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 234 + return ret !== 0; 235 + } 236 + /** 237 + * @param {boolean} arg0 238 + */ 239 + set success(arg0) { 240 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 241 + } 242 + /** 243 + * @returns {string} 244 + */ 245 + get html() { 246 + let deferred1_0; 247 + let deferred1_1; 248 + try { 249 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 250 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 251 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 252 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 253 + deferred1_0 = r0; 254 + deferred1_1 = r1; 255 + return getStringFromWasm0(r0, r1); 256 + } finally { 257 + wasm.__wbindgen_add_to_stack_pointer(16); 258 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 259 + } 260 + } 261 + /** 262 + * @param {string} arg0 263 + */ 264 + set html(arg0) { 265 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 266 + const len0 = WASM_VECTOR_LEN; 267 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 268 + } 269 + /** 270 + * @returns {string | undefined} 271 + */ 272 + get error() { 273 + try { 274 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 275 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 276 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 277 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 278 + let v1; 279 + if (r0 !== 0) { 280 + v1 = getStringFromWasm0(r0, r1).slice(); 281 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 282 + } 283 + return v1; 284 + } finally { 285 + wasm.__wbindgen_add_to_stack_pointer(16); 286 + } 287 + } 288 + /** 289 + * @param {string | null} [arg0] 290 + */ 291 + set error(arg0) { 292 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 293 + var len0 = WASM_VECTOR_LEN; 294 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 295 + } 296 + } 297 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 298 + exports.JsMathResult = JsMathResult; 299 + 300 + /** 301 + * Pre-rendered embed content for synchronous rendering. 302 + * 303 + * Build this by calling `create_resolved_content()` and adding embeds 304 + * with `resolved_content_add_embed()`. 305 + */ 306 + class JsResolvedContent { 307 + static __wrap(ptr) { 308 + ptr = ptr >>> 0; 309 + const obj = Object.create(JsResolvedContent.prototype); 310 + obj.__wbg_ptr = ptr; 311 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 312 + return obj; 313 + } 314 + __destroy_into_raw() { 315 + const ptr = this.__wbg_ptr; 316 + this.__wbg_ptr = 0; 317 + JsResolvedContentFinalization.unregister(this); 318 + return ptr; 319 + } 320 + free() { 321 + const ptr = this.__destroy_into_raw(); 322 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 323 + } 324 + /** 325 + * Create an empty resolved content container. 326 + */ 327 + constructor() { 328 + const ret = wasm.create_resolved_content(); 329 + this.__wbg_ptr = ret >>> 0; 330 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 331 + return this; 332 + } 333 + /** 334 + * Add pre-rendered embed HTML for an AT URI. 335 + * 336 + * # Arguments 337 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 338 + * * `html` - The pre-rendered HTML for this embed 339 + * @param {string} at_uri 340 + * @param {string} html 341 + */ 342 + addEmbed(at_uri, html) { 343 + try { 344 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 345 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 346 + const len0 = WASM_VECTOR_LEN; 347 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 348 + const len1 = WASM_VECTOR_LEN; 349 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 350 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 351 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 352 + if (r1) { 353 + throw takeObject(r0); 354 + } 355 + } finally { 356 + wasm.__wbindgen_add_to_stack_pointer(16); 357 + } 358 + } 359 + } 360 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 361 + exports.JsResolvedContent = JsResolvedContent; 362 + 363 + /** 364 + * Create an empty resolved content container. 365 + * 366 + * Use this to pre-render embeds before calling render functions. 367 + * @returns {JsResolvedContent} 368 + */ 369 + function create_resolved_content() { 370 + const ret = wasm.create_resolved_content(); 371 + return JsResolvedContent.__wrap(ret); 372 + } 373 + exports.create_resolved_content = create_resolved_content; 374 + 375 + /** 376 + * Initialize panic hook for better error messages in console. 377 + */ 378 + function init() { 379 + wasm.init(); 380 + } 381 + exports.init = init; 382 + 383 + /** 384 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 385 + * 386 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 387 + * 388 + * # Arguments 389 + * * `text` - The plain text content 390 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 391 + * @param {string} text 392 + * @param {any} facets_json 393 + * @returns {string} 394 + */ 395 + function render_faceted_text(text, facets_json) { 396 + let deferred3_0; 397 + let deferred3_1; 398 + try { 399 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 400 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 401 + const len0 = WASM_VECTOR_LEN; 402 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 403 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 404 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 405 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 406 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 407 + var ptr2 = r0; 408 + var len2 = r1; 409 + if (r3) { 410 + ptr2 = 0; len2 = 0; 411 + throw takeObject(r2); 412 + } 413 + deferred3_0 = ptr2; 414 + deferred3_1 = len2; 415 + return getStringFromWasm0(ptr2, len2); 416 + } finally { 417 + wasm.__wbindgen_add_to_stack_pointer(16); 418 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 419 + } 420 + } 421 + exports.render_faceted_text = render_faceted_text; 422 + 423 + /** 424 + * Render markdown to HTML. 425 + * 426 + * # Arguments 427 + * * `markdown` - The markdown source text 428 + * * `resolved_content` - Optional pre-rendered embed content 429 + * @param {string} markdown 430 + * @param {JsResolvedContent | null} [resolved_content] 431 + * @returns {string} 432 + */ 433 + function render_markdown(markdown, resolved_content) { 434 + let deferred4_0; 435 + let deferred4_1; 436 + try { 437 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 438 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 439 + const len0 = WASM_VECTOR_LEN; 440 + let ptr1 = 0; 441 + if (!isLikeNone(resolved_content)) { 442 + _assertClass(resolved_content, JsResolvedContent); 443 + ptr1 = resolved_content.__destroy_into_raw(); 444 + } 445 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 446 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 447 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 448 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 449 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 450 + var ptr3 = r0; 451 + var len3 = r1; 452 + if (r3) { 453 + ptr3 = 0; len3 = 0; 454 + throw takeObject(r2); 455 + } 456 + deferred4_0 = ptr3; 457 + deferred4_1 = len3; 458 + return getStringFromWasm0(ptr3, len3); 459 + } finally { 460 + wasm.__wbindgen_add_to_stack_pointer(16); 461 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 462 + } 463 + } 464 + exports.render_markdown = render_markdown; 465 + 466 + /** 467 + * Render LaTeX math to MathML. 468 + * 469 + * # Arguments 470 + * * `latex` - The LaTeX math expression 471 + * * `display_mode` - true for display math (block), false for inline math 472 + * @param {string} latex 473 + * @param {boolean} display_mode 474 + * @returns {JsMathResult} 475 + */ 476 + function render_math(latex, display_mode) { 477 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 478 + const len0 = WASM_VECTOR_LEN; 479 + const ret = wasm.render_math(ptr0, len0, display_mode); 480 + return JsMathResult.__wrap(ret); 481 + } 482 + exports.render_math = render_math; 483 + 484 + /** 485 + * Render an AT Protocol record as HTML. 486 + * 487 + * Takes a record URI and the record data (typically fetched from an appview). 488 + * Returns the rendered HTML string. 489 + * 490 + * # Arguments 491 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 492 + * * `record_json` - The record data as JSON 493 + * * `fallback_author` - Optional author profile for records that don't include author info 494 + * * `resolved_content` - Optional pre-rendered embed content 495 + * @param {string} at_uri 496 + * @param {any} record_json 497 + * @param {any | null} [fallback_author] 498 + * @param {JsResolvedContent | null} [resolved_content] 499 + * @returns {string} 500 + */ 501 + function render_record(at_uri, record_json, fallback_author, resolved_content) { 502 + let deferred4_0; 503 + let deferred4_1; 504 + try { 505 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 506 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 507 + const len0 = WASM_VECTOR_LEN; 508 + let ptr1 = 0; 509 + if (!isLikeNone(resolved_content)) { 510 + _assertClass(resolved_content, JsResolvedContent); 511 + ptr1 = resolved_content.__destroy_into_raw(); 512 + } 513 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 514 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 515 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 516 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 517 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 518 + var ptr3 = r0; 519 + var len3 = r1; 520 + if (r3) { 521 + ptr3 = 0; len3 = 0; 522 + throw takeObject(r2); 523 + } 524 + deferred4_0 = ptr3; 525 + deferred4_1 = len3; 526 + return getStringFromWasm0(ptr3, len3); 527 + } finally { 528 + wasm.__wbindgen_add_to_stack_pointer(16); 529 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 530 + } 531 + } 532 + exports.render_record = render_record; 533 + 534 + exports.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) { 535 + const ret = Error(getStringFromWasm0(arg0, arg1)); 536 + return addHeapObject(ret); 537 + }; 538 + 539 + exports.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) { 540 + const ret = Number(getObject(arg0)); 541 + return ret; 542 + }; 543 + 544 + exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) { 545 + const ret = String(getObject(arg1)); 546 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 547 + const len1 = WASM_VECTOR_LEN; 548 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 549 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 550 + }; 551 + 552 + exports.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) { 553 + const v = getObject(arg1); 554 + const ret = typeof(v) === 'bigint' ? v : undefined; 555 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 556 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 557 + }; 558 + 559 + exports.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) { 560 + const v = getObject(arg0); 561 + const ret = typeof(v) === 'boolean' ? v : undefined; 562 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 563 + }; 564 + 565 + exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) { 566 + const ret = debugString(getObject(arg1)); 567 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 568 + const len1 = WASM_VECTOR_LEN; 569 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 570 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 571 + }; 572 + 573 + exports.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) { 574 + const ret = getObject(arg0) in getObject(arg1); 575 + return ret; 576 + }; 577 + 578 + exports.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) { 579 + const ret = typeof(getObject(arg0)) === 'bigint'; 580 + return ret; 581 + }; 582 + 583 + exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) { 584 + const ret = typeof(getObject(arg0)) === 'function'; 585 + return ret; 586 + }; 587 + 588 + exports.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) { 589 + const val = getObject(arg0); 590 + const ret = typeof(val) === 'object' && val !== null; 591 + return ret; 592 + }; 593 + 594 + exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) { 595 + const ret = getObject(arg0) === undefined; 596 + return ret; 597 + }; 598 + 599 + exports.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) { 600 + const ret = getObject(arg0) === getObject(arg1); 601 + return ret; 602 + }; 603 + 604 + exports.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) { 605 + const ret = getObject(arg0) == getObject(arg1); 606 + return ret; 607 + }; 608 + 609 + exports.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) { 610 + const obj = getObject(arg1); 611 + const ret = typeof(obj) === 'number' ? obj : undefined; 612 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 613 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 614 + }; 615 + 616 + exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) { 617 + const obj = getObject(arg1); 618 + const ret = typeof(obj) === 'string' ? obj : undefined; 619 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 620 + var len1 = WASM_VECTOR_LEN; 621 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 622 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 623 + }; 624 + 625 + exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) { 626 + throw new Error(getStringFromWasm0(arg0, arg1)); 627 + }; 628 + 629 + exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) { 630 + const ret = getObject(arg0).call(getObject(arg1)); 631 + return addHeapObject(ret); 632 + }, arguments) }; 633 + 634 + exports.__wbg_done_62ea16af4ce34b24 = function(arg0) { 635 + const ret = getObject(arg0).done; 636 + return ret; 637 + }; 638 + 639 + exports.__wbg_entries_83c79938054e065f = function(arg0) { 640 + const ret = Object.entries(getObject(arg0)); 641 + return addHeapObject(ret); 642 + }; 643 + 644 + exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) { 645 + let deferred0_0; 646 + let deferred0_1; 647 + try { 648 + deferred0_0 = arg0; 649 + deferred0_1 = arg1; 650 + console.error(getStringFromWasm0(arg0, arg1)); 651 + } finally { 652 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 653 + } 654 + }; 655 + 656 + exports.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) { 657 + const ret = getObject(arg0)[arg1 >>> 0]; 658 + return addHeapObject(ret); 659 + }; 660 + 661 + exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) { 662 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 663 + return addHeapObject(ret); 664 + }, arguments) }; 665 + 666 + exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) { 667 + const ret = getObject(arg0)[getObject(arg1)]; 668 + return addHeapObject(ret); 669 + }; 670 + 671 + exports.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) { 672 + let result; 673 + try { 674 + result = getObject(arg0) instanceof ArrayBuffer; 675 + } catch (_) { 676 + result = false; 677 + } 678 + const ret = result; 679 + return ret; 680 + }; 681 + 682 + exports.__wbg_instanceof_Map_084be8da74364158 = function(arg0) { 683 + let result; 684 + try { 685 + result = getObject(arg0) instanceof Map; 686 + } catch (_) { 687 + result = false; 688 + } 689 + const ret = result; 690 + return ret; 691 + }; 692 + 693 + exports.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) { 694 + let result; 695 + try { 696 + result = getObject(arg0) instanceof Uint8Array; 697 + } catch (_) { 698 + result = false; 699 + } 700 + const ret = result; 701 + return ret; 702 + }; 703 + 704 + exports.__wbg_isArray_51fd9e6422c0a395 = function(arg0) { 705 + const ret = Array.isArray(getObject(arg0)); 706 + return ret; 707 + }; 708 + 709 + exports.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) { 710 + const ret = Number.isSafeInteger(getObject(arg0)); 711 + return ret; 712 + }; 713 + 714 + exports.__wbg_iterator_27b7c8b35ab3e86b = function() { 715 + const ret = Symbol.iterator; 716 + return addHeapObject(ret); 717 + }; 718 + 719 + exports.__wbg_length_22ac23eaec9d8053 = function(arg0) { 720 + const ret = getObject(arg0).length; 721 + return ret; 722 + }; 723 + 724 + exports.__wbg_length_d45040a40c570362 = function(arg0) { 725 + const ret = getObject(arg0).length; 726 + return ret; 727 + }; 728 + 729 + exports.__wbg_new_6421f6084cc5bc5a = function(arg0) { 730 + const ret = new Uint8Array(getObject(arg0)); 731 + return addHeapObject(ret); 732 + }; 733 + 734 + exports.__wbg_new_8a6f238a6ece86ea = function() { 735 + const ret = new Error(); 736 + return addHeapObject(ret); 737 + }; 738 + 739 + exports.__wbg_next_138a17bbf04e926c = function(arg0) { 740 + const ret = getObject(arg0).next; 741 + return addHeapObject(ret); 742 + }; 743 + 744 + exports.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) { 745 + const ret = getObject(arg0).next(); 746 + return addHeapObject(ret); 747 + }, arguments) }; 748 + 749 + exports.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) { 750 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 751 + }; 752 + 753 + exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) { 754 + const ret = getObject(arg1).stack; 755 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 756 + const len1 = WASM_VECTOR_LEN; 757 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 758 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 759 + }; 760 + 761 + exports.__wbg_value_57b7b035e117f7ee = function(arg0) { 762 + const ret = getObject(arg0).value; 763 + return addHeapObject(ret); 764 + }; 765 + 766 + exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) { 767 + // Cast intrinsic for `Ref(String) -> Externref`. 768 + const ret = getStringFromWasm0(arg0, arg1); 769 + return addHeapObject(ret); 770 + }; 771 + 772 + exports.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) { 773 + // Cast intrinsic for `U64 -> Externref`. 774 + const ret = BigInt.asUintN(64, arg0); 775 + return addHeapObject(ret); 776 + }; 777 + 778 + exports.__wbindgen_cast_9ae0607507abb057 = function(arg0) { 779 + // Cast intrinsic for `I64 -> Externref`. 780 + const ret = arg0; 781 + return addHeapObject(ret); 782 + }; 783 + 784 + exports.__wbindgen_object_clone_ref = function(arg0) { 785 + const ret = getObject(arg0); 786 + return addHeapObject(ret); 787 + }; 788 + 789 + exports.__wbindgen_object_drop_ref = function(arg0) { 790 + takeObject(arg0); 791 + }; 792 + 793 + exports.__wbindgen_object_is_undefined = function(arg0) { 794 + const ret = getObject(arg0) === undefined; 795 + return ret; 796 + }; 797 + 798 + const wasmPath = `${__dirname}/weaver_renderer_bg.wasm`; 799 + const wasmBytes = require('fs').readFileSync(wasmPath); 800 + const wasmModule = new WebAssembly.Module(wasmBytes); 801 + const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports; 802 + 803 + wasm.__wbindgen_start();
+25
crates/weaver-renderer-js/pkg/full/nodejs/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;
+52
crates/weaver-renderer-js/pkg/full/package.json
··· 1 + { 2 + "name": "@weaver.sh/renderer-full", 3 + "version": "0.1.1", 4 + "description": "AT Protocol record renderer with syntax highlighting", 5 + "license": "MPL-2.0", 6 + "repository": { 7 + "type": "git", 8 + "url": "https://tangled.org/nonbinary.computer/weaver" 9 + }, 10 + "keywords": ["atproto", "bluesky", "markdown", "renderer", "wasm"], 11 + "main": "nodejs/weaver_renderer.js", 12 + "module": "bundler/weaver_renderer.js", 13 + "browser": "web/weaver_renderer.js", 14 + "types": "bundler/weaver_renderer.d.ts", 15 + "exports": { 16 + ".": { 17 + "deno": "./deno/weaver_renderer.js", 18 + "node": { 19 + "import": "./nodejs/weaver_renderer.js", 20 + "require": "./nodejs/weaver_renderer.js" 21 + }, 22 + "browser": { 23 + "import": "./web/weaver_renderer.js" 24 + }, 25 + "default": "./bundler/weaver_renderer.js" 26 + }, 27 + "./bundler": { 28 + "import": "./bundler/weaver_renderer.js", 29 + "types": "./bundler/weaver_renderer.d.ts" 30 + }, 31 + "./web": { 32 + "import": "./web/weaver_renderer.js", 33 + "types": "./web/weaver_renderer.d.ts" 34 + }, 35 + "./nodejs": { 36 + "import": "./nodejs/weaver_renderer.js", 37 + "require": "./nodejs/weaver_renderer.js", 38 + "types": "./nodejs/weaver_renderer.d.ts" 39 + }, 40 + "./deno": { 41 + "import": "./deno/weaver_renderer.js", 42 + "types": "./deno/weaver_renderer.d.ts" 43 + } 44 + }, 45 + "files": [ 46 + "bundler/", 47 + "web/", 48 + "nodejs/", 49 + "deno/", 50 + "README.md" 51 + ] 52 + }
+373
crates/weaver-renderer-js/pkg/full/web/LICENSE
··· 1 + Mozilla Public License Version 2.0 2 + ================================== 3 + 4 + 1. Definitions 5 + -------------- 6 + 7 + 1.1. "Contributor" 8 + means each individual or legal entity that creates, contributes to 9 + the creation of, or owns Covered Software. 10 + 11 + 1.2. "Contributor Version" 12 + means the combination of the Contributions of others (if any) used 13 + by a Contributor and that particular Contributor's Contribution. 14 + 15 + 1.3. "Contribution" 16 + means Covered Software of a particular Contributor. 17 + 18 + 1.4. "Covered Software" 19 + means Source Code Form to which the initial Contributor has attached 20 + the notice in Exhibit A, the Executable Form of such Source Code 21 + Form, and Modifications of such Source Code Form, in each case 22 + including portions thereof. 23 + 24 + 1.5. "Incompatible With Secondary Licenses" 25 + means 26 + 27 + (a) that the initial Contributor has attached the notice described 28 + in Exhibit B to the Covered Software; or 29 + 30 + (b) that the Covered Software was made available under the terms of 31 + version 1.1 or earlier of the License, but not also under the 32 + terms of a Secondary License. 33 + 34 + 1.6. "Executable Form" 35 + means any form of the work other than Source Code Form. 36 + 37 + 1.7. "Larger Work" 38 + means a work that combines Covered Software with other material, in 39 + a separate file or files, that is not Covered Software. 40 + 41 + 1.8. "License" 42 + means this document. 43 + 44 + 1.9. "Licensable" 45 + means having the right to grant, to the maximum extent possible, 46 + whether at the time of the initial grant or subsequently, any and 47 + all of the rights conveyed by this License. 48 + 49 + 1.10. "Modifications" 50 + means any of the following: 51 + 52 + (a) any file in Source Code Form that results from an addition to, 53 + deletion from, or modification of the contents of Covered 54 + Software; or 55 + 56 + (b) any new file in Source Code Form that contains any Covered 57 + Software. 58 + 59 + 1.11. "Patent Claims" of a Contributor 60 + means any patent claim(s), including without limitation, method, 61 + process, and apparatus claims, in any patent Licensable by such 62 + Contributor that would be infringed, but for the grant of the 63 + License, by the making, using, selling, offering for sale, having 64 + made, import, or transfer of either its Contributions or its 65 + Contributor Version. 66 + 67 + 1.12. "Secondary License" 68 + means either the GNU General Public License, Version 2.0, the GNU 69 + Lesser General Public License, Version 2.1, the GNU Affero General 70 + Public License, Version 3.0, or any later versions of those 71 + licenses. 72 + 73 + 1.13. "Source Code Form" 74 + means the form of the work preferred for making modifications. 75 + 76 + 1.14. "You" (or "Your") 77 + means an individual or a legal entity exercising rights under this 78 + License. For legal entities, "You" includes any entity that 79 + controls, is controlled by, or is under common control with You. For 80 + purposes of this definition, "control" means (a) the power, direct 81 + or indirect, to cause the direction or management of such entity, 82 + whether by contract or otherwise, or (b) ownership of more than 83 + fifty percent (50%) of the outstanding shares or beneficial 84 + ownership of such entity. 85 + 86 + 2. License Grants and Conditions 87 + -------------------------------- 88 + 89 + 2.1. Grants 90 + 91 + Each Contributor hereby grants You a world-wide, royalty-free, 92 + non-exclusive license: 93 + 94 + (a) under intellectual property rights (other than patent or trademark) 95 + Licensable by such Contributor to use, reproduce, make available, 96 + modify, display, perform, distribute, and otherwise exploit its 97 + Contributions, either on an unmodified basis, with Modifications, or 98 + as part of a Larger Work; and 99 + 100 + (b) under Patent Claims of such Contributor to make, use, sell, offer 101 + for sale, have made, import, and otherwise transfer either its 102 + Contributions or its Contributor Version. 103 + 104 + 2.2. Effective Date 105 + 106 + The licenses granted in Section 2.1 with respect to any Contribution 107 + become effective for each Contribution on the date the Contributor first 108 + distributes such Contribution. 109 + 110 + 2.3. Limitations on Grant Scope 111 + 112 + The licenses granted in this Section 2 are the only rights granted under 113 + this License. No additional rights or licenses will be implied from the 114 + distribution or licensing of Covered Software under this License. 115 + Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 + Contributor: 117 + 118 + (a) for any code that a Contributor has removed from Covered Software; 119 + or 120 + 121 + (b) for infringements caused by: (i) Your and any other third party's 122 + modifications of Covered Software, or (ii) the combination of its 123 + Contributions with other software (except as part of its Contributor 124 + Version); or 125 + 126 + (c) under Patent Claims infringed by Covered Software in the absence of 127 + its Contributions. 128 + 129 + This License does not grant any rights in the trademarks, service marks, 130 + or logos of any Contributor (except as may be necessary to comply with 131 + the notice requirements in Section 3.4). 132 + 133 + 2.4. Subsequent Licenses 134 + 135 + No Contributor makes additional grants as a result of Your choice to 136 + distribute the Covered Software under a subsequent version of this 137 + License (see Section 10.2) or under the terms of a Secondary License (if 138 + permitted under the terms of Section 3.3). 139 + 140 + 2.5. Representation 141 + 142 + Each Contributor represents that the Contributor believes its 143 + Contributions are its original creation(s) or it has sufficient rights 144 + to grant the rights to its Contributions conveyed by this License. 145 + 146 + 2.6. Fair Use 147 + 148 + This License is not intended to limit any rights You have under 149 + applicable copyright doctrines of fair use, fair dealing, or other 150 + equivalents. 151 + 152 + 2.7. Conditions 153 + 154 + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 + in Section 2.1. 156 + 157 + 3. Responsibilities 158 + ------------------- 159 + 160 + 3.1. Distribution of Source Form 161 + 162 + All distribution of Covered Software in Source Code Form, including any 163 + Modifications that You create or to which You contribute, must be under 164 + the terms of this License. You must inform recipients that the Source 165 + Code Form of the Covered Software is governed by the terms of this 166 + License, and how they can obtain a copy of this License. You may not 167 + attempt to alter or restrict the recipients' rights in the Source Code 168 + Form. 169 + 170 + 3.2. Distribution of Executable Form 171 + 172 + If You distribute Covered Software in Executable Form then: 173 + 174 + (a) such Covered Software must also be made available in Source Code 175 + Form, as described in Section 3.1, and You must inform recipients of 176 + the Executable Form how they can obtain a copy of such Source Code 177 + Form by reasonable means in a timely manner, at a charge no more 178 + than the cost of distribution to the recipient; and 179 + 180 + (b) You may distribute such Executable Form under the terms of this 181 + License, or sublicense it under different terms, provided that the 182 + license for the Executable Form does not attempt to limit or alter 183 + the recipients' rights in the Source Code Form under this License. 184 + 185 + 3.3. Distribution of a Larger Work 186 + 187 + You may create and distribute a Larger Work under terms of Your choice, 188 + provided that You also comply with the requirements of this License for 189 + the Covered Software. If the Larger Work is a combination of Covered 190 + Software with a work governed by one or more Secondary Licenses, and the 191 + Covered Software is not Incompatible With Secondary Licenses, this 192 + License permits You to additionally distribute such Covered Software 193 + under the terms of such Secondary License(s), so that the recipient of 194 + the Larger Work may, at their option, further distribute the Covered 195 + Software under the terms of either this License or such Secondary 196 + License(s). 197 + 198 + 3.4. Notices 199 + 200 + You may not remove or alter the substance of any license notices 201 + (including copyright notices, patent notices, disclaimers of warranty, 202 + or limitations of liability) contained within the Source Code Form of 203 + the Covered Software, except that You may alter any license notices to 204 + the extent required to remedy known factual inaccuracies. 205 + 206 + 3.5. Application of Additional Terms 207 + 208 + You may choose to offer, and to charge a fee for, warranty, support, 209 + indemnity or liability obligations to one or more recipients of Covered 210 + Software. However, You may do so only on Your own behalf, and not on 211 + behalf of any Contributor. You must make it absolutely clear that any 212 + such warranty, support, indemnity, or liability obligation is offered by 213 + You alone, and You hereby agree to indemnify every Contributor for any 214 + liability incurred by such Contributor as a result of warranty, support, 215 + indemnity or liability terms You offer. You may include additional 216 + disclaimers of warranty and limitations of liability specific to any 217 + jurisdiction. 218 + 219 + 4. Inability to Comply Due to Statute or Regulation 220 + --------------------------------------------------- 221 + 222 + If it is impossible for You to comply with any of the terms of this 223 + License with respect to some or all of the Covered Software due to 224 + statute, judicial order, or regulation then You must: (a) comply with 225 + the terms of this License to the maximum extent possible; and (b) 226 + describe the limitations and the code they affect. Such description must 227 + be placed in a text file included with all distributions of the Covered 228 + Software under this License. Except to the extent prohibited by statute 229 + or regulation, such description must be sufficiently detailed for a 230 + recipient of ordinary skill to be able to understand it. 231 + 232 + 5. Termination 233 + -------------- 234 + 235 + 5.1. The rights granted under this License will terminate automatically 236 + if You fail to comply with any of its terms. However, if You become 237 + compliant, then the rights granted under this License from a particular 238 + Contributor are reinstated (a) provisionally, unless and until such 239 + Contributor explicitly and finally terminates Your grants, and (b) on an 240 + ongoing basis, if such Contributor fails to notify You of the 241 + non-compliance by some reasonable means prior to 60 days after You have 242 + come back into compliance. Moreover, Your grants from a particular 243 + Contributor are reinstated on an ongoing basis if such Contributor 244 + notifies You of the non-compliance by some reasonable means, this is the 245 + first time You have received notice of non-compliance with this License 246 + from such Contributor, and You become compliant prior to 30 days after 247 + Your receipt of the notice. 248 + 249 + 5.2. If You initiate litigation against any entity by asserting a patent 250 + infringement claim (excluding declaratory judgment actions, 251 + counter-claims, and cross-claims) alleging that a Contributor Version 252 + directly or indirectly infringes any patent, then the rights granted to 253 + You by any and all Contributors for the Covered Software under Section 254 + 2.1 of this License shall terminate. 255 + 256 + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 + end user license agreements (excluding distributors and resellers) which 258 + have been validly granted by You or Your distributors under this License 259 + prior to termination shall survive termination. 260 + 261 + ************************************************************************ 262 + * * 263 + * 6. Disclaimer of Warranty * 264 + * ------------------------- * 265 + * * 266 + * Covered Software is provided under this License on an "as is" * 267 + * basis, without warranty of any kind, either expressed, implied, or * 268 + * statutory, including, without limitation, warranties that the * 269 + * Covered Software is free of defects, merchantable, fit for a * 270 + * particular purpose or non-infringing. The entire risk as to the * 271 + * quality and performance of the Covered Software is with You. * 272 + * Should any Covered Software prove defective in any respect, You * 273 + * (not any Contributor) assume the cost of any necessary servicing, * 274 + * repair, or correction. This disclaimer of warranty constitutes an * 275 + * essential part of this License. No use of any Covered Software is * 276 + * authorized under this License except under this disclaimer. * 277 + * * 278 + ************************************************************************ 279 + 280 + ************************************************************************ 281 + * * 282 + * 7. Limitation of Liability * 283 + * -------------------------- * 284 + * * 285 + * Under no circumstances and under no legal theory, whether tort * 286 + * (including negligence), contract, or otherwise, shall any * 287 + * Contributor, or anyone who distributes Covered Software as * 288 + * permitted above, be liable to You for any direct, indirect, * 289 + * special, incidental, or consequential damages of any character * 290 + * including, without limitation, damages for lost profits, loss of * 291 + * goodwill, work stoppage, computer failure or malfunction, or any * 292 + * and all other commercial damages or losses, even if such party * 293 + * shall have been informed of the possibility of such damages. This * 294 + * limitation of liability shall not apply to liability for death or * 295 + * personal injury resulting from such party's negligence to the * 296 + * extent applicable law prohibits such limitation. Some * 297 + * jurisdictions do not allow the exclusion or limitation of * 298 + * incidental or consequential damages, so this exclusion and * 299 + * limitation may not apply to You. * 300 + * * 301 + ************************************************************************ 302 + 303 + 8. Litigation 304 + ------------- 305 + 306 + Any litigation relating to this License may be brought only in the 307 + courts of a jurisdiction where the defendant maintains its principal 308 + place of business and such litigation shall be governed by laws of that 309 + jurisdiction, without reference to its conflict-of-law provisions. 310 + Nothing in this Section shall prevent a party's ability to bring 311 + cross-claims or counter-claims. 312 + 313 + 9. Miscellaneous 314 + ---------------- 315 + 316 + This License represents the complete agreement concerning the subject 317 + matter hereof. If any provision of this License is held to be 318 + unenforceable, such provision shall be reformed only to the extent 319 + necessary to make it enforceable. Any law or regulation which provides 320 + that the language of a contract shall be construed against the drafter 321 + shall not be used to construe this License against a Contributor. 322 + 323 + 10. Versions of the License 324 + --------------------------- 325 + 326 + 10.1. New Versions 327 + 328 + Mozilla Foundation is the license steward. Except as provided in Section 329 + 10.3, no one other than the license steward has the right to modify or 330 + publish new versions of this License. Each version will be given a 331 + distinguishing version number. 332 + 333 + 10.2. Effect of New Versions 334 + 335 + You may distribute the Covered Software under the terms of the version 336 + of the License under which You originally received the Covered Software, 337 + or under the terms of any subsequent version published by the license 338 + steward. 339 + 340 + 10.3. Modified Versions 341 + 342 + If you create software not governed by this License, and you want to 343 + create a new license for such software, you may create and use a 344 + modified version of this License if you rename the license and remove 345 + any references to the name of the license steward (except to note that 346 + such modified license differs from this License). 347 + 348 + 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 + Licenses 350 + 351 + If You choose to distribute Source Code Form that is Incompatible With 352 + Secondary Licenses under the terms of this version of the License, the 353 + notice described in Exhibit B of this License must be attached. 354 + 355 + Exhibit A - Source Code Form License Notice 356 + ------------------------------------------- 357 + 358 + This Source Code Form is subject to the terms of the Mozilla Public 359 + License, v. 2.0. If a copy of the MPL was not distributed with this 360 + file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 + 362 + If it is not possible or desirable to put the notice in a particular 363 + file, then You may include the notice in a location (such as a LICENSE 364 + file in a relevant directory) where a recipient would be likely to look 365 + for such a notice. 366 + 367 + You may add additional accurate notices of copyright ownership. 368 + 369 + Exhibit B - "Incompatible With Secondary Licenses" Notice 370 + --------------------------------------------------------- 371 + 372 + This Source Code Form is "Incompatible With Secondary Licenses", as 373 + defined by the Mozilla Public License, v. 2.0.
+134
crates/weaver-renderer-js/pkg/full/web/weaver_renderer.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + 4 + export class JsMathResult { 5 + private constructor(); 6 + free(): void; 7 + [Symbol.dispose](): void; 8 + success: boolean; 9 + html: string; 10 + get error(): string | undefined; 11 + set error(value: string | null | undefined); 12 + } 13 + 14 + export class JsResolvedContent { 15 + free(): void; 16 + [Symbol.dispose](): void; 17 + /** 18 + * Create an empty resolved content container. 19 + */ 20 + constructor(); 21 + /** 22 + * Add pre-rendered embed HTML for an AT URI. 23 + * 24 + * # Arguments 25 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 26 + * * `html` - The pre-rendered HTML for this embed 27 + */ 28 + addEmbed(at_uri: string, html: string): void; 29 + } 30 + 31 + /** 32 + * Create an empty resolved content container. 33 + * 34 + * Use this to pre-render embeds before calling render functions. 35 + */ 36 + export function create_resolved_content(): JsResolvedContent; 37 + 38 + /** 39 + * Initialize panic hook for better error messages in console. 40 + */ 41 + export function init(): void; 42 + 43 + /** 44 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 45 + * 46 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 47 + * 48 + * # Arguments 49 + * * `text` - The plain text content 50 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 51 + */ 52 + export function render_faceted_text(text: string, facets_json: any): string; 53 + 54 + /** 55 + * Render markdown to HTML. 56 + * 57 + * # Arguments 58 + * * `markdown` - The markdown source text 59 + * * `resolved_content` - Optional pre-rendered embed content 60 + */ 61 + export function render_markdown(markdown: string, resolved_content?: JsResolvedContent | null): string; 62 + 63 + /** 64 + * Render LaTeX math to MathML. 65 + * 66 + * # Arguments 67 + * * `latex` - The LaTeX math expression 68 + * * `display_mode` - true for display math (block), false for inline math 69 + */ 70 + export function render_math(latex: string, display_mode: boolean): JsMathResult; 71 + 72 + /** 73 + * Render an AT Protocol record as HTML. 74 + * 75 + * Takes a record URI and the record data (typically fetched from an appview). 76 + * Returns the rendered HTML string. 77 + * 78 + * # Arguments 79 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 80 + * * `record_json` - The record data as JSON 81 + * * `fallback_author` - Optional author profile for records that don't include author info 82 + * * `resolved_content` - Optional pre-rendered embed content 83 + */ 84 + export function render_record(at_uri: string, record_json: any, fallback_author?: any | null, resolved_content?: JsResolvedContent | null): string; 85 + 86 + export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; 87 + 88 + export interface InitOutput { 89 + readonly memory: WebAssembly.Memory; 90 + readonly __wbg_get_jsmathresult_error: (a: number, b: number) => void; 91 + readonly __wbg_get_jsmathresult_html: (a: number, b: number) => void; 92 + readonly __wbg_get_jsmathresult_success: (a: number) => number; 93 + readonly __wbg_jsmathresult_free: (a: number, b: number) => void; 94 + readonly __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 95 + readonly __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 96 + readonly __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 97 + readonly __wbg_set_jsmathresult_success: (a: number, b: number) => void; 98 + readonly create_resolved_content: () => number; 99 + readonly init: () => void; 100 + readonly jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 101 + readonly render_faceted_text: (a: number, b: number, c: number, d: number) => void; 102 + readonly render_markdown: (a: number, b: number, c: number, d: number) => void; 103 + readonly render_math: (a: number, b: number, c: number) => number; 104 + readonly render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 105 + readonly jsresolvedcontent_new: () => number; 106 + readonly __wbindgen_export: (a: number, b: number) => number; 107 + readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 108 + readonly __wbindgen_export3: (a: number) => void; 109 + readonly __wbindgen_export4: (a: number, b: number, c: number) => void; 110 + readonly __wbindgen_add_to_stack_pointer: (a: number) => number; 111 + readonly __wbindgen_start: () => void; 112 + } 113 + 114 + export type SyncInitInput = BufferSource | WebAssembly.Module; 115 + 116 + /** 117 + * Instantiates the given `module`, which can either be bytes or 118 + * a precompiled `WebAssembly.Module`. 119 + * 120 + * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. 121 + * 122 + * @returns {InitOutput} 123 + */ 124 + export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; 125 + 126 + /** 127 + * If `module_or_path` is {RequestInfo} or {URL}, makes a request and 128 + * for everything else, calls `WebAssembly.instantiate` directly. 129 + * 130 + * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. 131 + * 132 + * @returns {Promise<InitOutput>} 133 + */ 134 + export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
+849
crates/weaver-renderer-js/pkg/full/web/weaver_renderer.js
··· 1 + let wasm; 2 + 3 + function addHeapObject(obj) { 4 + if (heap_next === heap.length) heap.push(heap.length + 1); 5 + const idx = heap_next; 6 + heap_next = heap[idx]; 7 + 8 + heap[idx] = obj; 9 + return idx; 10 + } 11 + 12 + function _assertClass(instance, klass) { 13 + if (!(instance instanceof klass)) { 14 + throw new Error(`expected instance of ${klass.name}`); 15 + } 16 + } 17 + 18 + function debugString(val) { 19 + // primitive types 20 + const type = typeof val; 21 + if (type == 'number' || type == 'boolean' || val == null) { 22 + return `${val}`; 23 + } 24 + if (type == 'string') { 25 + return `"${val}"`; 26 + } 27 + if (type == 'symbol') { 28 + const description = val.description; 29 + if (description == null) { 30 + return 'Symbol'; 31 + } else { 32 + return `Symbol(${description})`; 33 + } 34 + } 35 + if (type == 'function') { 36 + const name = val.name; 37 + if (typeof name == 'string' && name.length > 0) { 38 + return `Function(${name})`; 39 + } else { 40 + return 'Function'; 41 + } 42 + } 43 + // objects 44 + if (Array.isArray(val)) { 45 + const length = val.length; 46 + let debug = '['; 47 + if (length > 0) { 48 + debug += debugString(val[0]); 49 + } 50 + for(let i = 1; i < length; i++) { 51 + debug += ', ' + debugString(val[i]); 52 + } 53 + debug += ']'; 54 + return debug; 55 + } 56 + // Test for built-in 57 + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); 58 + let className; 59 + if (builtInMatches && builtInMatches.length > 1) { 60 + className = builtInMatches[1]; 61 + } else { 62 + // Failed to match the standard '[object ClassName]' 63 + return toString.call(val); 64 + } 65 + if (className == 'Object') { 66 + // we're a user defined class or Object 67 + // JSON.stringify avoids problems with cycles, and is generally much 68 + // easier than looping through ownProperties of `val`. 69 + try { 70 + return 'Object(' + JSON.stringify(val) + ')'; 71 + } catch (_) { 72 + return 'Object'; 73 + } 74 + } 75 + // errors 76 + if (val instanceof Error) { 77 + return `${val.name}: ${val.message}\n${val.stack}`; 78 + } 79 + // TODO we could test for more things here, like `Set`s and `Map`s. 80 + return className; 81 + } 82 + 83 + function dropObject(idx) { 84 + if (idx < 132) return; 85 + heap[idx] = heap_next; 86 + heap_next = idx; 87 + } 88 + 89 + function getArrayU8FromWasm0(ptr, len) { 90 + ptr = ptr >>> 0; 91 + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); 92 + } 93 + 94 + let cachedDataViewMemory0 = null; 95 + function getDataViewMemory0() { 96 + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { 97 + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); 98 + } 99 + return cachedDataViewMemory0; 100 + } 101 + 102 + function getStringFromWasm0(ptr, len) { 103 + ptr = ptr >>> 0; 104 + return decodeText(ptr, len); 105 + } 106 + 107 + let cachedUint8ArrayMemory0 = null; 108 + function getUint8ArrayMemory0() { 109 + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 110 + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 111 + } 112 + return cachedUint8ArrayMemory0; 113 + } 114 + 115 + function getObject(idx) { return heap[idx]; } 116 + 117 + function handleError(f, args) { 118 + try { 119 + return f.apply(this, args); 120 + } catch (e) { 121 + wasm.__wbindgen_export3(addHeapObject(e)); 122 + } 123 + } 124 + 125 + let heap = new Array(128).fill(undefined); 126 + heap.push(undefined, null, true, false); 127 + 128 + let heap_next = heap.length; 129 + 130 + function isLikeNone(x) { 131 + return x === undefined || x === null; 132 + } 133 + 134 + function passStringToWasm0(arg, malloc, realloc) { 135 + if (realloc === undefined) { 136 + const buf = cachedTextEncoder.encode(arg); 137 + const ptr = malloc(buf.length, 1) >>> 0; 138 + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); 139 + WASM_VECTOR_LEN = buf.length; 140 + return ptr; 141 + } 142 + 143 + let len = arg.length; 144 + let ptr = malloc(len, 1) >>> 0; 145 + 146 + const mem = getUint8ArrayMemory0(); 147 + 148 + let offset = 0; 149 + 150 + for (; offset < len; offset++) { 151 + const code = arg.charCodeAt(offset); 152 + if (code > 0x7F) break; 153 + mem[ptr + offset] = code; 154 + } 155 + if (offset !== len) { 156 + if (offset !== 0) { 157 + arg = arg.slice(offset); 158 + } 159 + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; 160 + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); 161 + const ret = cachedTextEncoder.encodeInto(arg, view); 162 + 163 + offset += ret.written; 164 + ptr = realloc(ptr, len, offset, 1) >>> 0; 165 + } 166 + 167 + WASM_VECTOR_LEN = offset; 168 + return ptr; 169 + } 170 + 171 + function takeObject(idx) { 172 + const ret = getObject(idx); 173 + dropObject(idx); 174 + return ret; 175 + } 176 + 177 + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 178 + cachedTextDecoder.decode(); 179 + const MAX_SAFARI_DECODE_BYTES = 2146435072; 180 + let numBytesDecoded = 0; 181 + function decodeText(ptr, len) { 182 + numBytesDecoded += len; 183 + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { 184 + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); 185 + cachedTextDecoder.decode(); 186 + numBytesDecoded = len; 187 + } 188 + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 189 + } 190 + 191 + const cachedTextEncoder = new TextEncoder(); 192 + 193 + if (!('encodeInto' in cachedTextEncoder)) { 194 + cachedTextEncoder.encodeInto = function (arg, view) { 195 + const buf = cachedTextEncoder.encode(arg); 196 + view.set(buf); 197 + return { 198 + read: arg.length, 199 + written: buf.length 200 + }; 201 + } 202 + } 203 + 204 + let WASM_VECTOR_LEN = 0; 205 + 206 + const JsMathResultFinalization = (typeof FinalizationRegistry === 'undefined') 207 + ? { register: () => {}, unregister: () => {} } 208 + : new FinalizationRegistry(ptr => wasm.__wbg_jsmathresult_free(ptr >>> 0, 1)); 209 + 210 + const JsResolvedContentFinalization = (typeof FinalizationRegistry === 'undefined') 211 + ? { register: () => {}, unregister: () => {} } 212 + : new FinalizationRegistry(ptr => wasm.__wbg_jsresolvedcontent_free(ptr >>> 0, 1)); 213 + 214 + /** 215 + * Result from rendering LaTeX math. 216 + */ 217 + export class JsMathResult { 218 + static __wrap(ptr) { 219 + ptr = ptr >>> 0; 220 + const obj = Object.create(JsMathResult.prototype); 221 + obj.__wbg_ptr = ptr; 222 + JsMathResultFinalization.register(obj, obj.__wbg_ptr, obj); 223 + return obj; 224 + } 225 + __destroy_into_raw() { 226 + const ptr = this.__wbg_ptr; 227 + this.__wbg_ptr = 0; 228 + JsMathResultFinalization.unregister(this); 229 + return ptr; 230 + } 231 + free() { 232 + const ptr = this.__destroy_into_raw(); 233 + wasm.__wbg_jsmathresult_free(ptr, 0); 234 + } 235 + /** 236 + * @returns {boolean} 237 + */ 238 + get success() { 239 + const ret = wasm.__wbg_get_jsmathresult_success(this.__wbg_ptr); 240 + return ret !== 0; 241 + } 242 + /** 243 + * @param {boolean} arg0 244 + */ 245 + set success(arg0) { 246 + wasm.__wbg_set_jsmathresult_success(this.__wbg_ptr, arg0); 247 + } 248 + /** 249 + * @returns {string} 250 + */ 251 + get html() { 252 + let deferred1_0; 253 + let deferred1_1; 254 + try { 255 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 256 + wasm.__wbg_get_jsmathresult_html(retptr, this.__wbg_ptr); 257 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 258 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 259 + deferred1_0 = r0; 260 + deferred1_1 = r1; 261 + return getStringFromWasm0(r0, r1); 262 + } finally { 263 + wasm.__wbindgen_add_to_stack_pointer(16); 264 + wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1); 265 + } 266 + } 267 + /** 268 + * @param {string} arg0 269 + */ 270 + set html(arg0) { 271 + const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 272 + const len0 = WASM_VECTOR_LEN; 273 + wasm.__wbg_set_jsmathresult_html(this.__wbg_ptr, ptr0, len0); 274 + } 275 + /** 276 + * @returns {string | undefined} 277 + */ 278 + get error() { 279 + try { 280 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 281 + wasm.__wbg_get_jsmathresult_error(retptr, this.__wbg_ptr); 282 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 283 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 284 + let v1; 285 + if (r0 !== 0) { 286 + v1 = getStringFromWasm0(r0, r1).slice(); 287 + wasm.__wbindgen_export4(r0, r1 * 1, 1); 288 + } 289 + return v1; 290 + } finally { 291 + wasm.__wbindgen_add_to_stack_pointer(16); 292 + } 293 + } 294 + /** 295 + * @param {string | null} [arg0] 296 + */ 297 + set error(arg0) { 298 + var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export2); 299 + var len0 = WASM_VECTOR_LEN; 300 + wasm.__wbg_set_jsmathresult_error(this.__wbg_ptr, ptr0, len0); 301 + } 302 + } 303 + if (Symbol.dispose) JsMathResult.prototype[Symbol.dispose] = JsMathResult.prototype.free; 304 + 305 + /** 306 + * Pre-rendered embed content for synchronous rendering. 307 + * 308 + * Build this by calling `create_resolved_content()` and adding embeds 309 + * with `resolved_content_add_embed()`. 310 + */ 311 + export class JsResolvedContent { 312 + static __wrap(ptr) { 313 + ptr = ptr >>> 0; 314 + const obj = Object.create(JsResolvedContent.prototype); 315 + obj.__wbg_ptr = ptr; 316 + JsResolvedContentFinalization.register(obj, obj.__wbg_ptr, obj); 317 + return obj; 318 + } 319 + __destroy_into_raw() { 320 + const ptr = this.__wbg_ptr; 321 + this.__wbg_ptr = 0; 322 + JsResolvedContentFinalization.unregister(this); 323 + return ptr; 324 + } 325 + free() { 326 + const ptr = this.__destroy_into_raw(); 327 + wasm.__wbg_jsresolvedcontent_free(ptr, 0); 328 + } 329 + /** 330 + * Create an empty resolved content container. 331 + */ 332 + constructor() { 333 + const ret = wasm.create_resolved_content(); 334 + this.__wbg_ptr = ret >>> 0; 335 + JsResolvedContentFinalization.register(this, this.__wbg_ptr, this); 336 + return this; 337 + } 338 + /** 339 + * Add pre-rendered embed HTML for an AT URI. 340 + * 341 + * # Arguments 342 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 343 + * * `html` - The pre-rendered HTML for this embed 344 + * @param {string} at_uri 345 + * @param {string} html 346 + */ 347 + addEmbed(at_uri, html) { 348 + try { 349 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 350 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 351 + const len0 = WASM_VECTOR_LEN; 352 + const ptr1 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2); 353 + const len1 = WASM_VECTOR_LEN; 354 + wasm.jsresolvedcontent_addEmbed(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1); 355 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 356 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 357 + if (r1) { 358 + throw takeObject(r0); 359 + } 360 + } finally { 361 + wasm.__wbindgen_add_to_stack_pointer(16); 362 + } 363 + } 364 + } 365 + if (Symbol.dispose) JsResolvedContent.prototype[Symbol.dispose] = JsResolvedContent.prototype.free; 366 + 367 + /** 368 + * Create an empty resolved content container. 369 + * 370 + * Use this to pre-render embeds before calling render functions. 371 + * @returns {JsResolvedContent} 372 + */ 373 + export function create_resolved_content() { 374 + const ret = wasm.create_resolved_content(); 375 + return JsResolvedContent.__wrap(ret); 376 + } 377 + 378 + /** 379 + * Initialize panic hook for better error messages in console. 380 + */ 381 + export function init() { 382 + wasm.init(); 383 + } 384 + 385 + /** 386 + * Render faceted text (rich text with mentions, links, etc.) to HTML. 387 + * 388 + * Accepts facets from several AT Protocol lexicons (app.bsky, pub.leaflet, blog.pckt). 389 + * 390 + * # Arguments 391 + * * `text` - The plain text content 392 + * * `facets_json` - Array of facets with `index` (byteStart/byteEnd) and `features` array 393 + * @param {string} text 394 + * @param {any} facets_json 395 + * @returns {string} 396 + */ 397 + export function render_faceted_text(text, facets_json) { 398 + let deferred3_0; 399 + let deferred3_1; 400 + try { 401 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 402 + const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2); 403 + const len0 = WASM_VECTOR_LEN; 404 + wasm.render_faceted_text(retptr, ptr0, len0, addHeapObject(facets_json)); 405 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 406 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 407 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 408 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 409 + var ptr2 = r0; 410 + var len2 = r1; 411 + if (r3) { 412 + ptr2 = 0; len2 = 0; 413 + throw takeObject(r2); 414 + } 415 + deferred3_0 = ptr2; 416 + deferred3_1 = len2; 417 + return getStringFromWasm0(ptr2, len2); 418 + } finally { 419 + wasm.__wbindgen_add_to_stack_pointer(16); 420 + wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1); 421 + } 422 + } 423 + 424 + /** 425 + * Render markdown to HTML. 426 + * 427 + * # Arguments 428 + * * `markdown` - The markdown source text 429 + * * `resolved_content` - Optional pre-rendered embed content 430 + * @param {string} markdown 431 + * @param {JsResolvedContent | null} [resolved_content] 432 + * @returns {string} 433 + */ 434 + export function render_markdown(markdown, resolved_content) { 435 + let deferred4_0; 436 + let deferred4_1; 437 + try { 438 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 439 + const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2); 440 + const len0 = WASM_VECTOR_LEN; 441 + let ptr1 = 0; 442 + if (!isLikeNone(resolved_content)) { 443 + _assertClass(resolved_content, JsResolvedContent); 444 + ptr1 = resolved_content.__destroy_into_raw(); 445 + } 446 + wasm.render_markdown(retptr, ptr0, len0, ptr1); 447 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 448 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 449 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 450 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 451 + var ptr3 = r0; 452 + var len3 = r1; 453 + if (r3) { 454 + ptr3 = 0; len3 = 0; 455 + throw takeObject(r2); 456 + } 457 + deferred4_0 = ptr3; 458 + deferred4_1 = len3; 459 + return getStringFromWasm0(ptr3, len3); 460 + } finally { 461 + wasm.__wbindgen_add_to_stack_pointer(16); 462 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 463 + } 464 + } 465 + 466 + /** 467 + * Render LaTeX math to MathML. 468 + * 469 + * # Arguments 470 + * * `latex` - The LaTeX math expression 471 + * * `display_mode` - true for display math (block), false for inline math 472 + * @param {string} latex 473 + * @param {boolean} display_mode 474 + * @returns {JsMathResult} 475 + */ 476 + export function render_math(latex, display_mode) { 477 + const ptr0 = passStringToWasm0(latex, wasm.__wbindgen_export, wasm.__wbindgen_export2); 478 + const len0 = WASM_VECTOR_LEN; 479 + const ret = wasm.render_math(ptr0, len0, display_mode); 480 + return JsMathResult.__wrap(ret); 481 + } 482 + 483 + /** 484 + * Render an AT Protocol record as HTML. 485 + * 486 + * Takes a record URI and the record data (typically fetched from an appview). 487 + * Returns the rendered HTML string. 488 + * 489 + * # Arguments 490 + * * `at_uri` - The AT Protocol URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") 491 + * * `record_json` - The record data as JSON 492 + * * `fallback_author` - Optional author profile for records that don't include author info 493 + * * `resolved_content` - Optional pre-rendered embed content 494 + * @param {string} at_uri 495 + * @param {any} record_json 496 + * @param {any | null} [fallback_author] 497 + * @param {JsResolvedContent | null} [resolved_content] 498 + * @returns {string} 499 + */ 500 + export function render_record(at_uri, record_json, fallback_author, resolved_content) { 501 + let deferred4_0; 502 + let deferred4_1; 503 + try { 504 + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); 505 + const ptr0 = passStringToWasm0(at_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2); 506 + const len0 = WASM_VECTOR_LEN; 507 + let ptr1 = 0; 508 + if (!isLikeNone(resolved_content)) { 509 + _assertClass(resolved_content, JsResolvedContent); 510 + ptr1 = resolved_content.__destroy_into_raw(); 511 + } 512 + wasm.render_record(retptr, ptr0, len0, addHeapObject(record_json), isLikeNone(fallback_author) ? 0 : addHeapObject(fallback_author), ptr1); 513 + var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); 514 + var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); 515 + var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); 516 + var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true); 517 + var ptr3 = r0; 518 + var len3 = r1; 519 + if (r3) { 520 + ptr3 = 0; len3 = 0; 521 + throw takeObject(r2); 522 + } 523 + deferred4_0 = ptr3; 524 + deferred4_1 = len3; 525 + return getStringFromWasm0(ptr3, len3); 526 + } finally { 527 + wasm.__wbindgen_add_to_stack_pointer(16); 528 + wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1); 529 + } 530 + } 531 + 532 + const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']); 533 + 534 + async function __wbg_load(module, imports) { 535 + if (typeof Response === 'function' && module instanceof Response) { 536 + if (typeof WebAssembly.instantiateStreaming === 'function') { 537 + try { 538 + return await WebAssembly.instantiateStreaming(module, imports); 539 + } catch (e) { 540 + const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type); 541 + 542 + if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') { 543 + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); 544 + 545 + } else { 546 + throw e; 547 + } 548 + } 549 + } 550 + 551 + const bytes = await module.arrayBuffer(); 552 + return await WebAssembly.instantiate(bytes, imports); 553 + } else { 554 + const instance = await WebAssembly.instantiate(module, imports); 555 + 556 + if (instance instanceof WebAssembly.Instance) { 557 + return { instance, module }; 558 + } else { 559 + return instance; 560 + } 561 + } 562 + } 563 + 564 + function __wbg_get_imports() { 565 + const imports = {}; 566 + imports.wbg = {}; 567 + imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) { 568 + const ret = Error(getStringFromWasm0(arg0, arg1)); 569 + return addHeapObject(ret); 570 + }; 571 + imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) { 572 + const ret = Number(getObject(arg0)); 573 + return ret; 574 + }; 575 + imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) { 576 + const ret = String(getObject(arg1)); 577 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 578 + const len1 = WASM_VECTOR_LEN; 579 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 580 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 581 + }; 582 + imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) { 583 + const v = getObject(arg1); 584 + const ret = typeof(v) === 'bigint' ? v : undefined; 585 + getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true); 586 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 587 + }; 588 + imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) { 589 + const v = getObject(arg0); 590 + const ret = typeof(v) === 'boolean' ? v : undefined; 591 + return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0; 592 + }; 593 + imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) { 594 + const ret = debugString(getObject(arg1)); 595 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 596 + const len1 = WASM_VECTOR_LEN; 597 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 598 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 599 + }; 600 + imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) { 601 + const ret = getObject(arg0) in getObject(arg1); 602 + return ret; 603 + }; 604 + imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) { 605 + const ret = typeof(getObject(arg0)) === 'bigint'; 606 + return ret; 607 + }; 608 + imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) { 609 + const ret = typeof(getObject(arg0)) === 'function'; 610 + return ret; 611 + }; 612 + imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) { 613 + const val = getObject(arg0); 614 + const ret = typeof(val) === 'object' && val !== null; 615 + return ret; 616 + }; 617 + imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) { 618 + const ret = getObject(arg0) === undefined; 619 + return ret; 620 + }; 621 + imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) { 622 + const ret = getObject(arg0) === getObject(arg1); 623 + return ret; 624 + }; 625 + imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) { 626 + const ret = getObject(arg0) == getObject(arg1); 627 + return ret; 628 + }; 629 + imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) { 630 + const obj = getObject(arg1); 631 + const ret = typeof(obj) === 'number' ? obj : undefined; 632 + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); 633 + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); 634 + }; 635 + imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) { 636 + const obj = getObject(arg1); 637 + const ret = typeof(obj) === 'string' ? obj : undefined; 638 + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 639 + var len1 = WASM_VECTOR_LEN; 640 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 641 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 642 + }; 643 + imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) { 644 + throw new Error(getStringFromWasm0(arg0, arg1)); 645 + }; 646 + imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) { 647 + const ret = getObject(arg0).call(getObject(arg1)); 648 + return addHeapObject(ret); 649 + }, arguments) }; 650 + imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) { 651 + const ret = getObject(arg0).done; 652 + return ret; 653 + }; 654 + imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) { 655 + const ret = Object.entries(getObject(arg0)); 656 + return addHeapObject(ret); 657 + }; 658 + imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) { 659 + let deferred0_0; 660 + let deferred0_1; 661 + try { 662 + deferred0_0 = arg0; 663 + deferred0_1 = arg1; 664 + console.error(getStringFromWasm0(arg0, arg1)); 665 + } finally { 666 + wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1); 667 + } 668 + }; 669 + imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) { 670 + const ret = getObject(arg0)[arg1 >>> 0]; 671 + return addHeapObject(ret); 672 + }; 673 + imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) { 674 + const ret = Reflect.get(getObject(arg0), getObject(arg1)); 675 + return addHeapObject(ret); 676 + }, arguments) }; 677 + imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) { 678 + const ret = getObject(arg0)[getObject(arg1)]; 679 + return addHeapObject(ret); 680 + }; 681 + imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) { 682 + let result; 683 + try { 684 + result = getObject(arg0) instanceof ArrayBuffer; 685 + } catch (_) { 686 + result = false; 687 + } 688 + const ret = result; 689 + return ret; 690 + }; 691 + imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) { 692 + let result; 693 + try { 694 + result = getObject(arg0) instanceof Map; 695 + } catch (_) { 696 + result = false; 697 + } 698 + const ret = result; 699 + return ret; 700 + }; 701 + imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) { 702 + let result; 703 + try { 704 + result = getObject(arg0) instanceof Uint8Array; 705 + } catch (_) { 706 + result = false; 707 + } 708 + const ret = result; 709 + return ret; 710 + }; 711 + imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) { 712 + const ret = Array.isArray(getObject(arg0)); 713 + return ret; 714 + }; 715 + imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) { 716 + const ret = Number.isSafeInteger(getObject(arg0)); 717 + return ret; 718 + }; 719 + imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() { 720 + const ret = Symbol.iterator; 721 + return addHeapObject(ret); 722 + }; 723 + imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) { 724 + const ret = getObject(arg0).length; 725 + return ret; 726 + }; 727 + imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) { 728 + const ret = getObject(arg0).length; 729 + return ret; 730 + }; 731 + imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) { 732 + const ret = new Uint8Array(getObject(arg0)); 733 + return addHeapObject(ret); 734 + }; 735 + imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { 736 + const ret = new Error(); 737 + return addHeapObject(ret); 738 + }; 739 + imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) { 740 + const ret = getObject(arg0).next; 741 + return addHeapObject(ret); 742 + }; 743 + imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) { 744 + const ret = getObject(arg0).next(); 745 + return addHeapObject(ret); 746 + }, arguments) }; 747 + imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) { 748 + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2)); 749 + }; 750 + imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) { 751 + const ret = getObject(arg1).stack; 752 + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2); 753 + const len1 = WASM_VECTOR_LEN; 754 + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); 755 + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); 756 + }; 757 + imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) { 758 + const ret = getObject(arg0).value; 759 + return addHeapObject(ret); 760 + }; 761 + imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) { 762 + // Cast intrinsic for `Ref(String) -> Externref`. 763 + const ret = getStringFromWasm0(arg0, arg1); 764 + return addHeapObject(ret); 765 + }; 766 + imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) { 767 + // Cast intrinsic for `U64 -> Externref`. 768 + const ret = BigInt.asUintN(64, arg0); 769 + return addHeapObject(ret); 770 + }; 771 + imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) { 772 + // Cast intrinsic for `I64 -> Externref`. 773 + const ret = arg0; 774 + return addHeapObject(ret); 775 + }; 776 + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { 777 + const ret = getObject(arg0); 778 + return addHeapObject(ret); 779 + }; 780 + imports.wbg.__wbindgen_object_drop_ref = function(arg0) { 781 + takeObject(arg0); 782 + }; 783 + imports.wbg.__wbindgen_object_is_undefined = function(arg0) { 784 + const ret = getObject(arg0) === undefined; 785 + return ret; 786 + }; 787 + 788 + return imports; 789 + } 790 + 791 + function __wbg_finalize_init(instance, module) { 792 + wasm = instance.exports; 793 + __wbg_init.__wbindgen_wasm_module = module; 794 + cachedDataViewMemory0 = null; 795 + cachedUint8ArrayMemory0 = null; 796 + 797 + 798 + wasm.__wbindgen_start(); 799 + return wasm; 800 + } 801 + 802 + function initSync(module) { 803 + if (wasm !== undefined) return wasm; 804 + 805 + 806 + if (typeof module !== 'undefined') { 807 + if (Object.getPrototypeOf(module) === Object.prototype) { 808 + ({module} = module) 809 + } else { 810 + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') 811 + } 812 + } 813 + 814 + const imports = __wbg_get_imports(); 815 + if (!(module instanceof WebAssembly.Module)) { 816 + module = new WebAssembly.Module(module); 817 + } 818 + const instance = new WebAssembly.Instance(module, imports); 819 + return __wbg_finalize_init(instance, module); 820 + } 821 + 822 + async function __wbg_init(module_or_path) { 823 + if (wasm !== undefined) return wasm; 824 + 825 + 826 + if (typeof module_or_path !== 'undefined') { 827 + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { 828 + ({module_or_path} = module_or_path) 829 + } else { 830 + console.warn('using deprecated parameters for the initialization function; pass a single object instead') 831 + } 832 + } 833 + 834 + if (typeof module_or_path === 'undefined') { 835 + module_or_path = new URL('weaver_renderer_bg.wasm', import.meta.url); 836 + } 837 + const imports = __wbg_get_imports(); 838 + 839 + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { 840 + module_or_path = fetch(module_or_path); 841 + } 842 + 843 + const { instance, module } = await __wbg_load(await module_or_path, imports); 844 + 845 + return __wbg_finalize_init(instance, module); 846 + } 847 + 848 + export { initSync }; 849 + export default __wbg_init;
+25
crates/weaver-renderer-js/pkg/full/web/weaver_renderer_bg.wasm.d.ts
··· 1 + /* tslint:disable */ 2 + /* eslint-disable */ 3 + export const memory: WebAssembly.Memory; 4 + export const __wbg_get_jsmathresult_error: (a: number, b: number) => void; 5 + export const __wbg_get_jsmathresult_html: (a: number, b: number) => void; 6 + export const __wbg_get_jsmathresult_success: (a: number) => number; 7 + export const __wbg_jsmathresult_free: (a: number, b: number) => void; 8 + export const __wbg_jsresolvedcontent_free: (a: number, b: number) => void; 9 + export const __wbg_set_jsmathresult_error: (a: number, b: number, c: number) => void; 10 + export const __wbg_set_jsmathresult_html: (a: number, b: number, c: number) => void; 11 + export const __wbg_set_jsmathresult_success: (a: number, b: number) => void; 12 + export const create_resolved_content: () => number; 13 + export const init: () => void; 14 + export const jsresolvedcontent_addEmbed: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 15 + export const render_faceted_text: (a: number, b: number, c: number, d: number) => void; 16 + export const render_markdown: (a: number, b: number, c: number, d: number) => void; 17 + export const render_math: (a: number, b: number, c: number) => number; 18 + export const render_record: (a: number, b: number, c: number, d: number, e: number, f: number) => void; 19 + export const jsresolvedcontent_new: () => number; 20 + export const __wbindgen_export: (a: number, b: number) => number; 21 + export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; 22 + export const __wbindgen_export3: (a: number) => void; 23 + export const __wbindgen_export4: (a: number, b: number, c: number) => void; 24 + export const __wbindgen_add_to_stack_pointer: (a: number) => number; 25 + export const __wbindgen_start: () => void;