-module(string_width). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([mode_2027/1, mode_2027_ext/1, mode_wcwidth/1, ambiguous_as_wide/1, count_ansi_codes/1, with_tab_width/2, at_tab_offset/2, get_terminal_size/0, is_ansi_component/2, fold_with/4, fold_raw/4, fold_raw_pieces/4, tabs_to_spaces_with/2, line_with/2, dimensions_with/2, limit_with/4, position_with/6, align_with/5, new/0, line/1, dimensions/1, limit/3, tabs_to_spaces/1, position/5, align/4, fold/3]). -export_type([options/0, mode/0, size/0, limit_state/0, alignment/0, placement/0, piece/0]). -opaque options() :: {options, boolean(), boolean(), mode(), integer(), integer()}. -type mode() :: mode_wcwidth | mode2027 | mode2027_ext. -type size() :: {size, integer(), integer()}. -type limit_state() :: {limit_state, binary(), integer(), integer(), binary(), integer(), binary(), integer(), binary(), integer()}. -type alignment() :: left | center | right. -type placement() :: top | middle | bottom. -type piece() :: {piece, binary(), integer(), integer(), integer()}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 99). -spec mode_2027(options()) -> options(). mode_2027(Options) -> erlang:setelement(4, Options, mode2027). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 113). -spec mode_2027_ext(options()) -> options(). mode_2027_ext(Options) -> erlang:setelement(4, Options, mode2027_ext). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 124). -spec mode_wcwidth(options()) -> options(). mode_wcwidth(Options) -> erlang:setelement(4, Options, mode_wcwidth). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 134). -spec ambiguous_as_wide(options()) -> options(). ambiguous_as_wide(Options) -> erlang:setelement(3, Options, true). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 142). -spec count_ansi_codes(options()) -> options(). count_ansi_codes(Options) -> erlang:setelement(2, Options, true). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 150). -spec with_tab_width(options(), integer()) -> options(). with_tab_width(Options, Tab_width) -> erlang:setelement(5, Options, Tab_width). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 159). -spec at_tab_offset(options(), integer()) -> options(). at_tab_offset(Options, Tab_offset) -> erlang:setelement(6, Options, Tab_offset). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 175). -spec get_terminal_size() -> {ok, size()} | {error, nil}. get_terminal_size() -> case string_width_ffi:get_terminal_size() of {ok, {Rows, Columns}} -> {ok, {size, Rows, Columns}}; _ -> {error, nil} end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 300). -spec tab(options(), integer()) -> integer(). tab(Options, Col) -> (((case erlang:element(5, Options) of 0 -> 0; Gleam@denominator -> Col div Gleam@denominator end) + 1) * erlang:element(5, Options)) - Col. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 307). -spec prepare_measure(options(), binary()) -> {binary(), list({integer(), integer()}), integer()}. prepare_measure(Options, Str) -> Ansi_ranges = case erlang:element(2, Options) of true -> []; false -> string_width@internal@ansi:match(Str) end, {Str, Ansi_ranges, 0}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 363). -spec limit_state_col(limit_state()) -> integer(). limit_state_col(State) -> ((erlang:element(4, State) + erlang:element(6, State)) + erlang:element( 8, State )) + erlang:element(10, State). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 854). -spec div_up(integer(), integer()) -> integer(). div_up(Numerator, Denom) -> case Denom of 0 -> 0; Gleam@denominator -> ((Numerator + Denom) - 1) div Gleam@denominator end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 862). -spec is_ansi_component(binary(), options()) -> boolean(). is_ansi_component(Str, Options) -> case erlang:element(2, Options) of true -> false; false -> case Str of <<"\x{1b}"/utf8, _/binary>> -> true; <<"\x{9b}"/utf8, _/binary>> -> true; <<"\x{9d}"/utf8, _/binary>> -> true; _ -> false end end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1017). -spec piece_reducer(GKU, options(), fun((GKU, piece()) -> GKU)) -> {{GKU, integer(), integer()}, fun(({GKU, integer(), integer()}, binary(), integer()) -> {GKU, integer(), integer()})}. piece_reducer(State, Options, Fun) -> Initial = {State, 0, erlang:element(6, Options)}, Fun@1 = fun(State@1, Piece, Width) -> {State@2, Row, Column} = State@1, Width@1 = case Piece of <<"\t"/utf8>> -> tab(Options, Column); _ -> Width end, State@3 = Fun(State@2, {piece, Piece, Row, Column, Width@1}), case Piece of <<"\n"/utf8>> -> {State@3, Row + 1, erlang:element(6, Options)}; _ -> {State@3, Row, Column + Width@1} end end, {Initial, Fun@1}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1244). -spec table_lookup(bitstring(), integer()) -> boolean(). table_lookup(Table, Value) -> Hi = erlang:'bsr'(Value, 8), Md = erlang:'bsr'(erlang:'band'(Value, 16#ff), 3), Lo = erlang:'band'(Value, 7), Lvl1_skip = Hi * 8, <<_:Lvl1_skip, Lvl1/integer, _/bitstring>> = case Table of <<_:Lvl1_skip, _/integer, _/bitstring>> -> Table; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Pattern match failed, no pattern matched the value."/utf8>>, value => _assert_fail, module => <<"string_width"/utf8>>, function => <<"table_lookup"/utf8>>, line => 1250}) end, Lvl2_skip = ((Lvl1 * 32) + Md) * 8, <<_:Lvl2_skip, Lvl3/integer, _/bitstring>> = case Table of <<_:Lvl2_skip, _/integer, _/bitstring>> -> Table; _assert_fail@1 -> erlang:error(#{gleam_error => let_assert, message => <<"Pattern match failed, no pattern matched the value."/utf8>>, value => _assert_fail@1, module => <<"string_width"/utf8>>, function => <<"table_lookup"/utf8>>, line => 1253}) end, (erlang:'bsr'(Lvl3, Lo) rem 2) /= 0. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1202). -spec is_ignorable(integer()) -> boolean(). is_ignorable(Cp) -> case Cp =< 16#1ffff of true -> table_lookup( <<16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 17, 33, 17, 17, 17, 34, 35, 36, 37, 38, 39, 40, 17, 17, 41, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 42, 43, 17, 17, 44, 45, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 46, 17, 47, 48, 49, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 51, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 52, 17, 17, 53, 54, 17, 55, 56, 57, 17, 17, 17, 17, 17, 17, 58, 17, 17, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 17, 73, 74, 75, 76, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 77, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 78, 17, 17, 17, 17, 17, 17, 17, 17, 79, 80, 17, 17, 17, 81, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 82, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 83, 17, 84, 85, 17, 17, 17, 17, 17, 17, 17, 86, 17, 17, 17, 17, 17, 87, 80, 88, 17, 89, 90, 17, 17, 91, 92, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 255, 255, 255, 255, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 191, 182, 0, 0, 0, 0, 0, 0, 0, 63, 0, 255, 23, 0, 0, 0, 0, 0, 248, 255, 255, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 191, 159, 61, 0, 0, 0, 128, 2, 0, 0, 0, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 255, 1, 0, 0, 0, 0, 0, 0, 248, 15, 32, 0, 0, 192, 251, 239, 62, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 131, 255, 0, 0, 0, 0, 0, 252, 255, 255, 255, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 20, 254, 33, 254, 0, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 16, 30, 32, 0, 0, 12, 0, 0, 64, 6, 0, 0, 0, 0, 0, 0, 16, 134, 57, 2, 0, 0, 0, 35, 0, 6, 0, 0, 0, 0, 0, 0, 16, 190, 33, 0, 0, 12, 0, 0, 252, 2, 0, 0, 0, 0, 0, 0, 144, 30, 32, 96, 0, 12, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 32, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 208, 193, 61, 96, 0, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 144, 64, 48, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 24, 30, 32, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 7, 128, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 31, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 160, 2, 0, 0, 0, 0, 0, 0, 254, 127, 223, 224, 255, 254, 255, 255, 255, 31, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 253, 102, 0, 0, 0, 195, 1, 0, 30, 0, 100, 32, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0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255, 31, 32, 0, 16, 0, 0, 248, 254, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 255, 255, 249, 219, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>, Cp ); false -> (Cp >= 16#e0000) andalso (Cp =< 16#e0fff) end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1209). -spec is_ambiguous(integer()) -> boolean(). is_ambiguous(Cp) -> case Cp =< 16#ffff of true -> table_lookup( <<8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 13, 13, 13, 22, 13, 13, 13, 13, 13, 13, 23, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 13, 13, 13, 13, 13, 25, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 146, 101, 223, 247, 64, 0, 129, 193, 67, 55, 141, 87, 2, 0, 10, 8, 192, 8, 14, 129, 23, 47, 12, 0, 192, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 85, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 46, 1, 175, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 254, 255, 251, 3, 254, 255, 251, 3, 0, 0, 0, 0, 0, 0, 2, 0, 255, 255, 255, 255, 255, 255, 255, 255, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 51, 247, 0, 45, 72, 0, 0, 0, 0, 0, 0, 16, 128, 30, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 2, 72, 0, 70, 8, 0, 0, 0, 0, 24, 120, 255, 15, 255, 3, 0, 2, 255, 3, 0, 0, 0, 3, 0, 0, 20, 0, 128, 0, 0, 0, 141, 137, 34, 228, 169, 95, 240, 48, 0, 17, 4, 0, 243, 204, 0, 0, 204, 0, 32, 2, 32, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 255, 255, 255, 255, 15, 0, 255, 255, 60, 0, 251, 3, 204, 48, 195, 201, 3, 0, 60, 128, 0, 0, 96, 194, 0, 80, 0, 0, 0, 0, 5, 0, 0, 0, 187, 183, 0, 0, 0, 0, 0, 192, 0, 0, 0, 128, 192, 191, 239, 255, 11, 251, 211, 219, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 192, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32>>, Cp ); false -> (((((((((Cp >= 16#1f100) andalso (Cp =< 16#1f10a)) orelse ((Cp >= 16#1f110) andalso (Cp =< 16#1f12d))) orelse ((Cp >= 16#1f130) andalso (Cp =< 16#1f169))) orelse ((Cp >= 16#1f170) andalso (Cp =< 16#1f18d))) orelse ((Cp >= 16#1f18f) andalso (Cp =< 16#1f190))) orelse ((Cp >= 16#1f19b) andalso (Cp =< 16#1f1ac))) orelse ((Cp >= 16#e0100) andalso (Cp =< 16#e01ef))) orelse ((Cp >= 16#f0000) andalso (Cp =< 16#ffffd))) orelse ((Cp >= 16#100000) andalso (Cp =< 16#10FFFD)) end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1226). -spec is_wide(integer()) -> boolean(). is_wide(Cp) -> case Cp =< 16#1ffff of true -> table_lookup( <<16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 18, 16, 19, 20, 21, 16, 16, 16, 22, 16, 16, 23, 24, 25, 26, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 16, 16, 16, 16, 30, 16, 16, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 28, 28, 16, 16, 16, 32, 33, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 34, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 35, 28, 28, 28, 28, 36, 37, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 38, 28, 39, 40, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 41, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 42, 43, 44, 45, 46, 47, 48, 49, 16, 50, 51, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 48, 0, 0, 0, 255, 0, 0, 255, 15, 0, 0, 0, 0, 128, 0, 252, 8, 0, 2, 12, 0, 96, 48, 64, 16, 0, 0, 4, 44, 36, 32, 12, 0, 0, 0, 1, 0, 0, 0, 80, 184, 0, 0, 0, 0, 0, 0, 0, 224, 0, 0, 0, 1, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 224, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 128, 255, 255, 255, 255, 255, 127, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31, 255, 255, 255, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 3, 0, 0, 255, 255, 255, 255, 247, 255, 127, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 3, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 0, 0, 0, 0, 128, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 239, 111, 255, 255, 255, 255, 7, 0, 4, 0, 0, 0, 39, 0, 240, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 255, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 254, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 255, 255, 255, 255, 255, 15, 255, 1, 3, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 1, 224, 191, 255, 255, 255, 255, 255, 255, 255, 255, 223, 255, 255, 15, 0, 255, 255, 255, 255, 255, 135, 15, 0, 255, 255, 17, 255, 255, 255, 255, 255, 255, 255, 255, 127, 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 159, 255, 255, 255, 255, 255, 255, 255, 63, 0, 120, 255, 255, 255, 0, 0, 4, 0, 0, 96, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 63, 16, 231, 240, 0, 24, 240, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 15, 1, 0, 0, 240, 255, 255, 255, 255, 255, 247, 191, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 31, 255, 131, 255, 255, 255, 255, 255, 255, 127, 192, 255, 159, 255, 3, 255, 1>>, Cp ); false -> (Cp >= 16#20000) andalso (Cp =< 16#40000) end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1177). -spec wcwidth(options(), integer()) -> integer(). wcwidth(Options, Cp) -> case Cp of _ when Cp =< 16#1f -> 0; _ when Cp =< 16#7e -> 1; _ -> case is_ignorable(Cp) of true -> 0; false -> case is_wide(Cp) orelse (erlang:element(3, Options) andalso is_ambiguous( Cp )) of true -> 2; false -> 1 end end end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1233). -spec is_spacing_mark(integer()) -> boolean(). is_spacing_mark(Cp) -> case Cp =< 16#1ffff of true -> table_lookup( <<16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 21, 16, 22, 23, 16, 16, 16, 16, 16, 16, 24, 16, 25, 26, 27, 28, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 29, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 30, 31, 32, 33, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 16, 45, 46, 47, 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 49, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 50, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 51, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 200, 1, 222, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 192, 129, 25, 128, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 192, 1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 192, 1, 26, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 64, 129, 25, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 198, 29, 128, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 64, 159, 13, 96, 0, 0, 0, 8, 0, 12, 0, 0, 0, 0, 0, 0, 192, 193, 29, 128, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 128, 3, 255, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 0, 128, 0,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, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 128, 1, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 8, 0, 0, 0, 0, 0, 48, 192, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 224, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>, Cp ); false -> false end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1258). -spec fold_graphemes(binary(), GLB, fun((GLB, binary()) -> GLB)) -> GLB. fold_graphemes(Str, State, Fun) -> case gleam@string:pop_grapheme(Str) of {ok, {Grapheme, Str@1}} -> fold_graphemes(Str@1, Fun(State, Grapheme), Fun); {error, nil} -> State end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1091). -spec fold_chars_wcwidth( options(), binary(), GKY, fun((GKY, binary(), integer()) -> GKY) ) -> GKY. fold_chars_wcwidth(Options, String, State, Fun) -> fold_graphemes( String, State, fun(State@1, Grapheme) -> Width = (string_width_ffi:fold_codepoints( Grapheme, 0, fun(Acc, Cp) -> Acc + wcwidth(Options, Cp) end )), Fun(State@1, Grapheme, Width) end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1127). -spec measure_mode_2027(options(), binary()) -> integer(). measure_mode_2027(Options, String) -> string_width_ffi:fold_codepoints(String, 0, fun(Max, Cp) -> case Cp of 16#fe0f when Max > 0 -> 2; _ -> gleam@int:max(Max, wcwidth(Options, Cp)) end end). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1105). -spec fold_chars_2027( options(), binary(), GKZ, fun((GKZ, binary(), integer()) -> GKZ) ) -> GKZ. fold_chars_2027(Options, String, State, Fun) -> fold_graphemes( String, State, fun(State@1, Grapheme) -> Width = measure_mode_2027(Options, Grapheme), Fun(State@1, Grapheme, Width) end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1136). -spec measure_mode_2027_ext(options(), binary()) -> integer(). measure_mode_2027_ext(Options, String) -> string_width_ffi:fold_codepoints( String, 0, fun(Max, Cp) -> case Max =:= 0 of true -> wcwidth(Options, Cp); false -> case Cp of 16#fe0f -> 2; _ -> case wcwidth(Options, Cp) of 0 -> Max; Width -> case is_spacing_mark(Cp) of true -> gleam@int:max(Max, Width); false -> 2 end end end end end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1116). -spec fold_chars_2027_ext( options(), binary(), GLA, fun((GLA, binary(), integer()) -> GLA) ) -> GLA. fold_chars_2027_ext(Options, String, State, Fun) -> fold_graphemes( String, State, fun(State@1, Grapheme) -> Width = measure_mode_2027_ext(Options, Grapheme), Fun(State@1, Grapheme, Width) end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1044). -spec fold_parts( binary(), integer(), list({integer(), integer()}), GKW, fun((GKW, binary()) -> GKW), fun((GKW, binary(), integer()) -> GKW) ) -> GKW. fold_parts(String, Offset, Ranges, State, On_chars, On_range) -> case Ranges of [{Start, Length} | Ranges@1] when Start =:= Offset -> {Range_slice, String@1} = erlang:split_binary(String, Length), State@1 = On_range(State, Range_slice, Length), Offset@1 = Start + Length, fold_parts( String@1, Offset@1, Ranges@1, State@1, On_chars, On_range ); [{Start@1, Length@1} | Ranges@2] -> {Before, At_range} = erlang:split_binary(String, Start@1 - Offset), {Range_slice@1, String@2} = erlang:split_binary(At_range, Length@1), State@2 = begin _pipe = State, _pipe@1 = On_chars(_pipe, Before), On_range(_pipe@1, Range_slice@1, Length@1) end, Offset@2 = Start@1 + Length@1, fold_parts( String@2, Offset@2, Ranges@2, State@2, On_chars, On_range ); [] -> case String of <<""/utf8>> -> State; _ -> On_chars(State, String) end end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 898). -spec fold_with(binary(), options(), GKR, fun((GKR, piece()) -> GKR)) -> GKR. fold_with(Str, Options, State, Fun) -> {State@1, Fun@1} = piece_reducer(State, Options, Fun), On_chars = case erlang:element(4, Options) of mode_wcwidth -> fun(State@2, Str@1) -> fold_chars_wcwidth(Options, Str@1, State@2, Fun@1) end; mode2027 -> fun(State@3, Str@2) -> fold_chars_2027(Options, Str@2, State@3, Fun@1) end; mode2027_ext -> fun(State@4, Str@3) -> fold_chars_2027_ext(Options, Str@3, State@4, Fun@1) end end, Ansi_ranges = case erlang:element(2, Options) of true -> []; false -> string_width@internal@ansi:match(Str) end, On_range = fun(State@5, Ansi, _) -> Fun@1(State@5, Ansi, 0) end, {State@6, _, _} = fold_parts( Str, 0, Ansi_ranges, State@1, On_chars, On_range ), State@6. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 368). -spec limit_state_overflow(limit_state(), binary(), options()) -> {binary(), binary(), integer()}. limit_state_overflow(State, Piece, Options) -> Str = <<<<(erlang:element(7, State))/binary, (erlang:element(9, State))/binary>>/binary, Piece/binary>>, {Before@1, After@1, Width@1} = (fold_with( Str, Options, {<<""/utf8>>, <<""/utf8>>, 0}, fun(_use0, Piece@1) -> {Before, After, Width} = _use0, case (erlang:element(4, Piece@1) + erlang:element(5, Piece@1)) > erlang:element( 8, State ) of true -> {Before, <>, Width + erlang:element(5, Piece@1)}; false -> {<>, After, Width} end end )), case Before@1 =:= <<""/utf8>> of true -> {Before@1, After@1, Width@1}; false -> {<<(erlang:element(5, State))/binary, Before@1/binary>>, After@1, Width@1} end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 1081). -spec fold_chars_raw( options(), binary(), GKX, fun((GKX, binary(), integer()) -> GKX) ) -> GKX. fold_chars_raw(Options, String, State, Fun) -> string_width_ffi:fold_codepoints( String, State, fun(State@1, Cp) -> Fun( State@1, string_width_ffi:utf_codepoint_to_string(Cp), wcwidth(Options, Cp) ) end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 961). -spec fold_raw(binary(), options(), GKS, fun((GKS, binary(), integer()) -> GKS)) -> GKS. fold_raw(String, Options, State, Fun) -> Ansi_ranges = case erlang:element(2, Options) of true -> []; false -> string_width@internal@ansi:match(String) end, On_chars = case erlang:element(4, Options) of mode_wcwidth -> fun(State@1, Str) -> fold_chars_raw(Options, Str, State@1, Fun) end; mode2027 -> fun(State@2, Str@1) -> fold_chars_2027(Options, Str@1, State@2, Fun) end; mode2027_ext -> fun(State@3, Str@2) -> fold_chars_2027_ext(Options, Str@2, State@3, Fun) end end, On_range = fun(State@4, Ansi, _) -> Fun(State@4, Ansi, 0) end, fold_parts(String, 0, Ansi_ranges, State, On_chars, On_range). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 988). -spec fold_raw_pieces(binary(), options(), GKT, fun((GKT, piece()) -> GKT)) -> GKT. fold_raw_pieces(String, Options, State, Fun) -> Ansi_ranges = case erlang:element(2, Options) of true -> []; false -> string_width@internal@ansi:match(String) end, {State@1, Fun@1} = piece_reducer(State, Options, Fun), On_chars = case erlang:element(4, Options) of mode_wcwidth -> fun(State@2, Str) -> fold_chars_raw(Options, Str, State@2, Fun@1) end; mode2027 -> fun(State@3, Str@1) -> fold_chars_2027(Options, Str@1, State@3, Fun@1) end; mode2027_ext -> fun(State@4, Str@2) -> fold_chars_2027_ext(Options, Str@2, State@4, Fun@1) end end, On_range = fun(State@5, Ansi, _) -> Fun@1(State@5, Ansi, 0) end, {State@6, _, _} = fold_parts( String, 0, Ansi_ranges, State@1, On_chars, On_range ), State@6. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 639). -spec tabs_to_spaces_with(binary(), options()) -> binary(). tabs_to_spaces_with(Str, Options) -> fold_raw_pieces( Str, Options, <<""/utf8>>, fun(Acc, Piece) -> case erlang:element(2, Piece) of <<"\t"/utf8>> -> <>, erlang:element(5, Piece) ))/binary>>; _ -> <> end end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 823). -spec do_align(binary(), options(), fun((binary(), integer()) -> binary())) -> binary(). do_align(Str, Options, Align) -> Push_line = fun(State) -> {Acc, Line, Line_width} = State, Line@1 = Align(Line, Line_width), case Acc of <<""/utf8>> -> {Line@1, <<""/utf8>>, 0}; _ -> {<<<>/binary, Line@1/binary>>, <<""/utf8>>, 0} end end, State@1 = {<<""/utf8>>, <<""/utf8>>, 0}, State@3 = (fold_raw_pieces( Str, Options, State@1, fun(State@2, Piece) -> {Acc@1, Line@2, Line_width@1} = State@2, case erlang:element(2, Piece) of <<"\n"/utf8>> -> Push_line(State@2); <<"\t"/utf8>> -> {Acc@1, <>, erlang:element(5, Piece) ))/binary>>, Line_width@1 + erlang:element(5, Piece)}; _ -> {Acc@1, <>, Line_width@1 + erlang:element(5, Piece)} end end )), {Result, _, _} = Push_line(State@3), Result. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 252). -spec do_measure(binary(), options()) -> {integer(), integer(), integer()}. do_measure(Str, Options) -> {Str@1, Ranges, Range_width} = prepare_measure(Options, Str), Fun = fun(State, Chr, Width) -> {Rows, Cols_max, Cols_min, Cols_curr} = State, case Chr of <<"\n"/utf8>> -> {Rows + 1, gleam@int:max(Cols_max, Cols_curr), gleam@int:min(Cols_max, Cols_curr), erlang:element(6, Options)}; <<"\t"/utf8>> -> {Rows, Cols_max, Cols_min, Cols_curr + tab(Options, Cols_curr)}; _ -> {Rows, Cols_max, Cols_min, Cols_curr + Width} end end, On_range = fun(State@1, Ansi, Length) -> Fun(State@1, Ansi, Range_width * Length) end, On_chars = case erlang:element(4, Options) of mode_wcwidth -> fun(State@2, Str@2) -> fold_chars_raw(Options, Str@2, State@2, Fun) end; mode2027 -> fun(State@3, Str@3) -> fold_chars_2027(Options, Str@3, State@3, Fun) end; mode2027_ext -> fun(State@4, Str@4) -> fold_chars_2027_ext(Options, Str@4, State@4, Fun) end end, Initial = {0, 0, 16#1fffffffffffff, erlang:element(6, Options)}, {Rows@1, Cols_max@1, Cols_min@1, Cols_curr@1} = fold_parts( Str@1, 0, Ranges, Initial, On_chars, On_range ), Cols_max@2 = gleam@int:max(Cols_max@1, Cols_curr@1) - erlang:element( 6, Options ), Rows@2 = case Cols_curr@1 > erlang:element(6, Options) of true -> Rows@1 + 1; false -> Rows@1 end, Cols_min@2 = case Rows@2 > 0 of true -> gleam@int:min(Cols_min@1, Cols_curr@1) - erlang:element(6, Options); false -> 0 end, {Rows@2, Cols_max@2, Cols_min@2}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 222). -spec line_with(binary(), options()) -> integer(). line_with(Str, Options) -> {_, Columns, _} = do_measure(Str, Options), Columns. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 247). -spec dimensions_with(binary(), options()) -> size(). dimensions_with(Str, Options) -> {Rows, Columns, _} = do_measure(Str, Options), {size, Rows, Columns}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 390). -spec limit_with(binary(), size(), options(), binary()) -> binary(). limit_with(Str, Max_size, Options, Ellipsis) -> Ellipsis_width = line_with(Ellipsis, Options), Initial = {limit_state, <<""/utf8>>, 0, 0, <<""/utf8>>, 0, <<""/utf8>>, 0, <<""/utf8>>, 0}, Commit = fun(Max_col, State, Piece, Width) -> New_col = limit_state_col(State), Is_last_line = (erlang:element(3, State) + 1) >= erlang:element( 2, Max_size ), case (erlang:element(7, State) =:= <<""/utf8>>) andalso (erlang:element( 9, State ) =:= <<""/utf8>>) of true -> case erlang:element(2, State) of <<""/utf8>> -> State; _ -> erlang:setelement( 6, erlang:setelement( 5, State, <<(erlang:element(5, State))/binary, Piece/binary>> ), erlang:element(6, State) + Width ) end; false -> case New_col =< Max_col of true -> Str@1 = <<<<<<(erlang:element(2, State))/binary, (erlang:element(5, State))/binary>>/binary, (erlang:element(7, State))/binary>>/binary, (erlang:element(9, State))/binary>>, erlang:setelement( 6, erlang:setelement( 5, erlang:setelement( 4, erlang:setelement( 3, erlang:setelement(2, Initial, Str@1), erlang:element(3, State) ), New_col ), Piece ), Width ); false -> case Is_last_line of true -> {Truncated, _, _} = limit_state_overflow( State, <<""/utf8>>, Options ), erlang:setelement( 4, erlang:setelement( 3, erlang:setelement( 2, Initial, <<<<(erlang:element(2, State))/binary, Truncated/binary>>/binary, Ellipsis/binary>> ), erlang:element(3, State) + 1 ), erlang:element(3, Max_size) ); false -> erlang:setelement( 6, erlang:setelement( 5, erlang:setelement( 4, erlang:setelement( 3, erlang:setelement( 2, Initial, <<<<<<(erlang:element( 2, State ))/binary, "\n"/utf8>>/binary, (erlang:element( 7, State ))/binary>>/binary, (erlang:element( 9, State ))/binary>> ), erlang:element(3, State) + 1 ), erlang:element(8, State) + erlang:element( 10, State ) ), Piece ), Width ) end end end end, State@3 = (fold_raw( Str, Options, Initial, fun(State@1, Piece@1, Width@1) -> Is_last_line@1 = (erlang:element(3, State@1) + 1) >= erlang:element( 2, Max_size ), Max_col@1 = case Is_last_line@1 of true -> erlang:element(3, Max_size) - Ellipsis_width; false -> erlang:element(3, Max_size) end, case erlang:element(3, State@1) >= erlang:element(2, Max_size) of true -> case is_ansi_component(Piece@1, Options) of true -> erlang:setelement( 2, State@1, <<(erlang:element(2, State@1))/binary, Piece@1/binary>> ); false -> State@1 end; false -> case Piece@1 of <<"\n"/utf8>> -> State@2 = Commit(Max_col@1, State@1, <<""/utf8>>, 0), erlang:setelement( 4, erlang:setelement( 3, erlang:setelement( 2, State@2, <<(erlang:element(2, State@2))/binary, "\n"/utf8>> ), erlang:element(3, State@2) + 1 ), 0 ); <<"\t"/utf8>> -> Curr_col = limit_state_col(State@1), Width@2 = case Curr_col =< Max_col@1 of true -> tab( Options, erlang:element(6, Options) + Curr_col ); false -> Wrapped_col = erlang:element(8, State@1) + erlang:element( 10, State@1 ), tab( Options, erlang:element(6, Options) + Wrapped_col ) end, Commit(Max_col@1, State@1, Piece@1, Width@2); <<" "/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{a0}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{1680}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2000}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2001}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2002}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2003}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2004}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2005}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2006}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2007}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2008}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{2009}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{200a}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{202f}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{205f}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); <<"\x{3000}"/utf8>> -> Commit(Max_col@1, State@1, Piece@1, Width@1); _ -> case (limit_state_col(State@1) + Width@1) =< Max_col@1 of true -> erlang:setelement( 8, erlang:setelement( 7, State@1, <<(erlang:element(7, State@1))/binary, Piece@1/binary>> ), erlang:element(8, State@1) + Width@1 ); false -> case ((erlang:element(8, State@1) + erlang:element( 10, State@1 )) + Width@1) > erlang:element(3, Max_size) of true -> {Truncated@1, Overflow, Overflow_width} = limit_state_overflow( State@1, Piece@1, Options ), case Is_last_line@1 of false -> erlang:setelement( 8, erlang:setelement( 7, erlang:setelement( 3, erlang:setelement( 2, Initial, <<<<(erlang:element( 2, State@1 ))/binary, Truncated@1/binary>>/binary, "\n"/utf8>> ), erlang:element( 3, State@1 ) + 1 ), Overflow ), Overflow_width ); true -> erlang:setelement( 4, erlang:setelement( 3, erlang:setelement( 2, Initial, <<<<(erlang:element( 2, State@1 ))/binary, Truncated@1/binary>>/binary, Ellipsis/binary>> ), erlang:element( 3, State@1 ) + 1 ), erlang:element( 3, Max_size ) ) end; false -> erlang:setelement( 10, erlang:setelement( 9, State@1, <<(erlang:element( 9, State@1 ))/binary, Piece@1/binary>> ), erlang:element(10, State@1) + Width@1 ) end end end end end )), State@4 = Commit(erlang:element(3, Max_size), State@3, <<""/utf8>>, 0), erlang:element(2, State@4). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 687). -spec position_with( binary(), size(), alignment(), placement(), options(), binary() ) -> binary(). position_with(Str, Bounding_box, Alignment, Placement, Options, Space) -> {Str_rows, Str_cols_max, Str_cols_min} = do_measure(Str, Options), Space_width = line_with(Space, Options), Str@1 = case erlang:element(3, Bounding_box) > Str_cols_min of true -> Align = case Alignment of left -> fun(Line, Line_width) -> Missing = div_up( erlang:element(3, Bounding_box) - Line_width, Space_width ), <> end; right -> Missing_left = div_up( erlang:element(3, Bounding_box) - Str_cols_max, Space_width ), Space_left = gleam@string:repeat(Space, Missing_left), fun(Line@1, Line_width@1) -> Missing@1 = (case Space_width of 0 -> 0; Gleam@denominator -> (erlang:element( 3, Bounding_box ) - Line_width@1) div Gleam@denominator end) - Missing_left, <<<>/binary, (gleam@string:repeat(Space, Missing@1))/binary>> end; center -> Missing_total = div_up( erlang:element(3, Bounding_box) - Str_cols_max, Space_width ), Missing_left@1 = Missing_total div 2, Space_left@1 = gleam@string:repeat(Space, Missing_left@1), Space_right = gleam@string:repeat( Space, Missing_total - Missing_left@1 ), fun(Line@2, Line_width@2) -> Missing@2 = (case Space_width of 0 -> 0; Gleam@denominator@1 -> (erlang:element( 3, Bounding_box ) - Line_width@2) div Gleam@denominator@1 end) - Missing_total, <<<<<>/binary, (gleam@string:repeat(Space, Missing@2))/binary>>/binary, Space_right/binary>> end end, do_align(Str, Options, Align); false -> Str end, Missing_rows = erlang:element(2, Bounding_box) - Str_rows, case Missing_rows > 0 of true -> Space_row = gleam@string:repeat( Space, div_up(erlang:element(3, Bounding_box), Space_width) ), case Placement of top -> <>, Missing_rows ))/binary>>; bottom -> <<(gleam@string:repeat( <>, Missing_rows ))/binary, Str@1/binary>>; middle -> Top = Missing_rows div 2, Bottom = Missing_rows - Top, <<<<(gleam@string:repeat( <>, Top ))/binary, Str@1/binary>>/binary, (gleam@string:repeat( <<"\n"/utf8, Space_row/binary>>, Bottom ))/binary>> end; false -> Str@1 end. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 797). -spec align_with(binary(), integer(), alignment(), options(), binary()) -> binary(). align_with(Str, Max_width, Alignment, Options, Space) -> Space_width = line_with(Space, Options), do_align( Str, Options, fun(Line, Line_width) -> Missing = div_up(Max_width - Line_width, Space_width), case Missing > 0 of true -> case Alignment of left -> <>; right -> <<(gleam@string:repeat(Space, Missing))/binary, Line/binary>>; center -> Left = Missing div 2, Right = Missing - Left, <<<<(gleam@string:repeat(Space, Left))/binary, Line/binary>>/binary, (gleam@string:repeat(Space, Right))/binary>> end; false -> Line end end ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 79). -spec new() -> options(). new() -> {options, false, false, mode_wcwidth, 8, 0}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 205). -spec line(binary()) -> integer(). line(Str) -> {_, Columns, _} = do_measure( Str, {options, false, false, mode_wcwidth, 8, 0} ), Columns. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 241). -spec dimensions(binary()) -> size(). dimensions(Str) -> {Rows, Columns, _} = do_measure( Str, {options, false, false, mode_wcwidth, 8, 0} ), {size, Rows, Columns}. -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 341). -spec limit(binary(), size(), binary()) -> binary(). limit(Str, Max_size, Ellipsis) -> limit_with( Str, Max_size, {options, false, false, mode_wcwidth, 8, 0}, Ellipsis ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 625). -spec tabs_to_spaces(binary()) -> binary(). tabs_to_spaces(Str) -> tabs_to_spaces_with(Str, {options, false, false, mode_wcwidth, 8, 0}). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 676). -spec position(binary(), size(), alignment(), placement(), binary()) -> binary(). position(Str, Bounding_box, Alignment, Placement, Space) -> position_with( Str, Bounding_box, Alignment, Placement, {options, false, false, mode_wcwidth, 8, 0}, Space ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 787). -spec align(binary(), integer(), alignment(), binary()) -> binary(). align(Str, Max_width, Alignment, Space) -> align_with( Str, Max_width, Alignment, {options, false, false, mode_wcwidth, 8, 0}, Space ). -file("/home/arkan/Projects/private/string-width/src/string_width.gleam", 884). -spec fold(binary(), GKQ, fun((GKQ, piece()) -> GKQ)) -> GKQ. fold(Str, State, Fun) -> fold_with(Str, {options, false, false, mode_wcwidth, 8, 0}, State, Fun).