-- To obtain the mapping:
--[[
wget -qO .fantasticonrc.js https://github.com/yamatsum/nonicons/raw/master/.fantasticonrc.js \
&& node -e 'console.log(Object.entries(require("./.fantasticonrc.js").codepoints).reduce((acc,v) => acc+"  [\"" + v[0] + "\"] = " + v[1] + ",\n", "{\n") + "}")'
--]]

local codepoints = {
  ["alert-16"] = 61697,
  ["angular-16"] = 61698,
  ["archive-16"] = 61699,
  ["arrow-both-16"] = 61700,
  ["arrow-down-16"] = 61701,
  ["arrow-left-16"] = 61702,
  ["arrow-right-16"] = 61703,
  ["arrow-switch-16"] = 61704,
  ["arrow-up-16"] = 61705,
  ["backbone-16"] = 61706,
  ["beaker-16"] = 61707,
  ["bell-16"] = 61708,
  ["bell-slash-16"] = 61709,
  ["bold-16"] = 61710,
  ["book-16"] = 61711,
  ["bookmark-16"] = 61712,
  ["bookmark-slash-16"] = 61713,
  ["briefcase-16"] = 61714,
  ["broadcast-16"] = 61715,
  ["browser-16"] = 61716,
  ["bug-16"] = 61717,
  ["c-16"] = 61718,
  ["c-plusplus-16"] = 61719,
  ["c-sharp-16"] = 61720,
  ["calendar-16"] = 61721,
  ["check-16"] = 61722,
  ["check-circle-16"] = 61723,
  ["check-circle-fill-16"] = 61724,
  ["checklist-16"] = 61725,
  ["chevron-down-16"] = 61726,
  ["chevron-left-16"] = 61727,
  ["chevron-right-16"] = 61728,
  ["chevron-up-16"] = 61729,
  ["circle-16"] = 61730,
  ["circle-slash-16"] = 61731,
  ["clippy-16"] = 61732,
  ["clock-16"] = 61733,
  ["code-16"] = 61734,
  ["code-review-16"] = 61735,
  ["code-square-16"] = 61736,
  ["comment-16"] = 61737,
  ["comment-discussion-16"] = 61738,
  ["container-16"] = 61739,
  ["cpu-16"] = 61740,
  ["credit-card-16"] = 61741,
  ["cross-reference-16"] = 61742,
  ["css-16"] = 61743,
  ["dart-16"] = 61744,
  ["dash-16"] = 61745,
  ["database-16"] = 61746,
  ["desktop-download-16"] = 61747,
  ["device-camera-16"] = 61748,
  ["device-camera-video-16"] = 61749,
  ["device-desktop-16"] = 61750,
  ["device-mobile-16"] = 61751,
  ["diff-16"] = 61752,
  ["diff-added-16"] = 61753,
  ["diff-ignored-16"] = 61754,
  ["diff-modified-16"] = 61755,
  ["diff-removed-16"] = 61756,
  ["diff-renamed-16"] = 61757,
  ["docker-16"] = 61758,
  ["dot-16"] = 61759,
  ["dot-fill-16"] = 61760,
  ["download-16"] = 61761,
  ["ellipsis-16"] = 61762,
  ["elm-16"] = 61763,
  ["eye-16"] = 61764,
  ["eye-closed-16"] = 61765,
  ["file-16"] = 61766,
  ["file-badge-16"] = 61767,
  ["file-binary-16"] = 61768,
  ["file-code-16"] = 61769,
  ["file-diff-16"] = 61770,
  ["file-directory-16"] = 61771,
  ["file-directory-outline-16"] = 61772,
  ["file-submodule-16"] = 61773,
  ["file-symlink-file-16"] = 61774,
  ["file-zip-16"] = 61775,
  ["filter-16"] = 61776,
  ["flame-16"] = 61777,
  ["fold-16"] = 61778,
  ["fold-down-16"] = 61779,
  ["fold-up-16"] = 61780,
  ["gear-16"] = 61781,
  ["gift-16"] = 61782,
  ["git-branch-16"] = 61783,
  ["git-commit-16"] = 61784,
  ["git-compare-16"] = 61785,
  ["git-merge-16"] = 61786,
  ["git-pull-request-16"] = 61787,
  ["globe-16"] = 61788,
  ["go-16"] = 61789,
  ["grabber-16"] = 61790,
  ["graph-16"] = 61791,
  ["heading-16"] = 61792,
  ["heart-16"] = 61793,
  ["heart-fill-16"] = 61794,
  ["history-16"] = 61795,
  ["home-16"] = 61796,
  ["horizontal-rule-16"] = 61797,
  ["hourglass-16"] = 61798,
  ["html-16"] = 61799,
  ["hubot-16"] = 61800,
  ["image-16"] = 61801,
  ["inbox-16"] = 61802,
  ["infinity-16"] = 61803,
  ["info-16"] = 61804,
  ["issue-closed-16"] = 61805,
  ["issue-opened-16"] = 61806,
  ["issue-reopened-16"] = 61807,
  ["italic-16"] = 61808,
  ["java-16"] = 61809,
  ["javascript-16"] = 61810,
  ["json-16"] = 61811,
  ["kebab-horizontal-16"] = 61812,
  ["key-16"] = 61813,
  ["kotlin-16"] = 61814,
  ["kubernetes-16"] = 61815,
  ["law-16"] = 61816,
  ["light-bulb-16"] = 61817,
  ["link-16"] = 61818,
  ["link-external-16"] = 61819,
  ["list-ordered-16"] = 61820,
  ["list-unordered-16"] = 61821,
  ["location-16"] = 61822,
  ["lock-16"] = 61823,
  ["logo-gist-16"] = 61824,
  ["logo-github-16"] = 61825,
  ["lua-16"] = 61826,
  ["mail-16"] = 61827,
  ["mark-github-16"] = 61828,
  ["markdown-16"] = 61829,
  ["megaphone-16"] = 61830,
  ["mention-16"] = 61831,
  ["meter-16"] = 61832,
  ["milestone-16"] = 61833,
  ["mirror-16"] = 61834,
  ["moon-16"] = 61835,
  ["mortar-board-16"] = 61836,
  ["mute-16"] = 61837,
  ["nginx-16"] = 61838,
  ["no-entry-16"] = 61839,
  ["node-16"] = 61840,
  ["north-star-16"] = 61841,
  ["note-16"] = 61842,
  ["npm-16"] = 61843,
  ["octoface-16"] = 61844,
  ["organization-16"] = 61845,
  ["package-16"] = 61846,
  ["package-dependencies-16"] = 61847,
  ["package-dependents-16"] = 61848,
  ["paintbrush-16"] = 61849,
  ["paper-airplane-16"] = 61850,
  ["pencil-16"] = 61851,
  ["people-16"] = 61852,
  ["perl-16"] = 61853,
  ["person-16"] = 61854,
  ["php-16"] = 61855,
  ["pin-16"] = 61856,
  ["play-16"] = 61857,
  ["plug-16"] = 61858,
  ["plus-16"] = 61859,
  ["plus-circle-16"] = 61860,
  ["project-16"] = 61861,
  ["pulse-16"] = 61862,
  ["python-16"] = 61863,
  ["question-16"] = 61864,
  ["quote-16"] = 61865,
  ["r-16"] = 61866,
  ["react-16"] = 61867,
  ["rectangle-16"] = 61868,
  ["reply-16"] = 61869,
  ["repo-16"] = 61870,
  ["repo-clone-16"] = 61871,
  ["repo-forked-16"] = 61872,
  ["repo-pull-16"] = 61873,
  ["repo-push-16"] = 61874,
  ["repo-template-16"] = 61875,
  ["report-16"] = 61876,
  ["require-16"] = 61877,
  ["rocket-16"] = 61878,
  ["rss-16"] = 61879,
  ["ruby-16"] = 61880,
  ["rust-16"] = 61881,
  ["scala-16"] = 61882,
  ["screen-full-16"] = 61883,
  ["screen-normal-16"] = 61884,
  ["search-16"] = 61885,
  ["server-16"] = 61886,
  ["share-16"] = 61887,
  ["share-android-16"] = 61888,
  ["shield-16"] = 61889,
  ["shield-check-16"] = 61890,
  ["shield-lock-16"] = 61891,
  ["shield-x-16"] = 61892,
  ["sign-in-16"] = 61893,
  ["sign-out-16"] = 61894,
  ["skip-16"] = 61895,
  ["smiley-16"] = 61896,
  ["square-16"] = 61897,
  ["square-fill-16"] = 61898,
  ["squirrel-16"] = 61899,
  ["star-16"] = 61900,
  ["star-fill-16"] = 61901,
  ["stop-16"] = 61902,
  ["stopwatch-16"] = 61903,
  ["strikethrough-16"] = 61904,
  ["sun-16"] = 61905,
  ["swift-16"] = 61906,
  ["sync-16"] = 61907,
  ["tag-16"] = 61908,
  ["tasklist-16"] = 61909,
  ["telescope-16"] = 61910,
  ["terminal-16"] = 61911,
  ["three-bars-16"] = 61912,
  ["thumbsdown-16"] = 61913,
  ["thumbsup-16"] = 61914,
  ["tmux-16"] = 61915,
  ["toml-16"] = 61916,
  ["tools-16"] = 61917,
  ["trashcan-16"] = 61918,
  ["triangle-down-16"] = 61919,
  ["triangle-left-16"] = 61920,
  ["triangle-right-16"] = 61921,
  ["triangle-up-16"] = 61922,
  ["typescript-16"] = 61923,
  ["typography-16"] = 61924,
  ["unfold-16"] = 61925,
  ["unlock-16"] = 61926,
  ["unmute-16"] = 61927,
  ["unverified-16"] = 61928,
  ["upload-16"] = 61929,
  ["verified-16"] = 61930,
  ["versions-16"] = 61931,
  ["vim-16"] = 61932,
  ["vim-command-mode-16"] = 61933,
  ["vim-insert-mode-16"] = 61934,
  ["vim-normal-mode-16"] = 61935,
  ["vim-replace-mode-16"] = 61936,
  ["vim-select-mode-16"] = 61937,
  ["vim-terminal-mode-16"] = 61938,
  ["vim-visual-mode-16"] = 61939,
  ["vue-16"] = 61940,
  ["workflow-16"] = 61941,
  ["x-16"] = 61942,
  ["x-circle-16"] = 61943,
  ["x-circle-fill-16"] = 61944,
  ["yaml-16"] = 61945,
  ["yarn-16"] = 61946,
  ["zap-16"] = 61947,
  ["multi-select-16"] = 61948,
  ["number-16"] = 61949,
  ["trash-16"] = 61950,
  ["video-16"] = 61951,
  ["class-16"] = 61952,
  ["constant-16"] = 61953,
  ["field-16"] = 61954,
  ["interface-16"] = 61955,
  ["keyword-16"] = 61956,
  ["snippet-16"] = 61957,
  ["struct-16"] = 61958,
  ["type-16"] = 61959,
  ["variable-16"] = 61960,
  ["blocked-16"] = 61961,
  ["codescan-16"] = 61962,
  ["codescan-checkmark-16"] = 61963,
  ["codespaces-16"] = 61964,
  ["dependabot-16"] = 61965,
  ["duplicate-16"] = 61966,
  ["person-add-16"] = 61967,
  ["sidebar-collapse-16"] = 61968,
  ["sidebar-expand-16"] = 61969,
  ["table-16"] = 61970,
  ["elixir-16"] = 61971,
  ["terraform-16"] = 61972,
  ["columns-16"] = 61973,
  ["diamond-16"] = 61974,
  ["git-pull-request-closed-16"] = 61975,
  ["git-pull-request-draft-16"] = 61976,
  ["hash-16"] = 61977,
  ["issue-draft-16"] = 61978,
  ["rows-16"] = 61979,
  ["select-single-16"] = 61980,
  ["eslint-16"] = 61981,
  ["prettier-16"] = 61982,
  ["vscode-16"] = 61983,
  ["copy-16"] = 61984,
  ["key-asterisk-16"] = 61985,
  ["paste-16"] = 61986,
  ["sort-asc-16"] = 61987,
  ["sort-desc-16"] = 61988,
  ["babel-16"] = 61989,
  ["ionic-16"] = 61990,
  ["next-16"] = 61991,
  ["svelte-16"] = 61992,
  ["capacitor-16"] = 61993,
  ["graphql-16"] = 61994,
  ["accessibility-16"] = 61995,
  ["apps-16"] = 61996,
  ["bell-fill-16"] = 61997,
  ["cloud-16"] = 61998,
  ["cloud-offline-16"] = 61999,
  ["code-of-conduct-16"] = 62000,
  ["feed-discussion-16"] = 62001,
  ["feed-forked-16"] = 62002,
  ["feed-heart-16"] = 62003,
  ["feed-merged-16"] = 62004,
  ["feed-person-16"] = 62005,
  ["feed-repo-16"] = 62006,
  ["feed-rocket-16"] = 62007,
  ["feed-star-16"] = 62008,
  ["feed-tag-16"] = 62009,
  ["feed-trophy-16"] = 62010,
  ["file-directory-fill-16"] = 62011,
  ["file-directory-open-fill-16"] = 62012,
  ["id-badge-16"] = 62013,
  ["iterations-16"] = 62014,
  ["log-16"] = 62015,
  ["person-fill-16"] = 62016,
  ["repo-deleted-16"] = 62017,
  ["repo-locked-16"] = 62018,
  ["single-select-16"] = 62019,
  ["sliders-16"] = 62020,
  ["stack-16"] = 62021,
  ["tab-external-16"] = 62022,
  ["telescope-fill-16"] = 62023,
  ["trophy-16"] = 62024,
  ["webhook-16"] = 62025,
  ["accessibility-inset-16"] = 62026,
  ["alert-fill-16"] = 62027,
  ["arrow-down-left-16"] = 62028,
  ["arrow-down-right-16"] = 62029,
  ["arrow-up-left-16"] = 62030,
  ["arrow-up-right-16"] = 62031,
  ["cache-16"] = 62032,
  ["checkbox-16"] = 62033,
  ["clock-fill-16"] = 62034,
  ["command-palette-16"] = 62035,
  ["copilot-16"] = 62036,
  ["copilot-error-16"] = 62037,
  ["copilot-warning-16"] = 62038,
  ["file-added-16"] = 62039,
  ["file-moved-16"] = 62040,
  ["file-removed-16"] = 62041,
  ["git-merge-queue-16"] = 62042,
  ["issue-tracked-by-16"] = 62043,
  ["issue-tracked-in-16"] = 62044,
  ["paperclip-16"] = 62045,
  ["prisma-16"] = 62046,
  ["project-roadmap-16"] = 62047,
  ["project-symlink-16"] = 62048,
  ["shield-slash-16"] = 62049,
  ["skip-fill-16"] = 62050,
  ["devices-16"] = 62051,
  ["discussion-closed-16"] = 62052,
  ["discussion-duplicate-16"] = 62053,
  ["discussion-outdated-16"] = 62054,
  ["error-16"] = 62055,
  ["fiscal-host-16"] = 62056,
  ["goal-16"] = 62057,
  ["issue-tracks-16"] = 62058,
  ["layout-16"] = 62059,
  ["loading-16"] = 62060,
  ["move-to-bottom-16"] = 62061,
  ["move-to-end-16"] = 62062,
  ["move-to-start-16"] = 62063,
  ["move-to-top-16"] = 62064,
  ["not-found-16"] = 62065,
  ["passkey-fill-16"] = 62066,
  ["pin-slash-16"] = 62067,
  ["project-template-16"] = 62068,
  ["read-16"] = 62069,
  ["rel-file-path-16"] = 62070,
  ["sparkle-fill-16"] = 62071,
  ["sponsor-tiers-16"] = 62072,
  ["template-16"] = 62073,
  ["unlink-16"] = 62074,
  ["unread-16"] = 62075,
  ["zoom-in-16"] = 62076,
  ["zoom-out-16"] = 62077,
}

local utf8 = setmetatable({}, {
  __index = function(t, k)
    local cp = codepoints[k]
    if not cp then return nil end

    local res
    if cp < 0x0080 then
      res = cp
    elseif cp < 0x0800 then
      res = string.char(0xC0 | (cp >> 6), 0x80 | (cp & 0x3F))
    elseif cp < 0x10000 then
      res = string.char(0xE0 | (cp >> 12), 0x80 | ((cp >> 6) & 0x3F), 0x80 | (cp & 0x3F))
    else
      res = string.char(0xF0 | (cp >> 18), 0x80 | ((cp >> 12) & 0x3F), 0x80 | ((cp >> 6) & 0x3F), 0x80 | (cp & 0x3F))
    end

    t[k] = res
    return res
  end
})

return {
  codepoints = codepoints,
  utf8 = utf8,
  path = USERDIR .. PATHSEP .. "libraries" .. PATHSEP .. "font_nonicons" .. PATHSEP .. "nonicons.ttf"
}
