char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
521a64cd0
char/aliceai-t5-moe
1import { UrlProtocol } from '$lib/enums' ; 2 3const STD = [ 'com' , 'net' , 'org' , 'gov' , 'edu' ] as const ; 4const STD_MIL = [ ...STD , 'mil' ] as const ; 5const ccTLD_PREFIXES :Record < string , readonly string []> = { 6ae :[ 'co' , 'net' , 'org' , 'gov' , 'ac' , 'sch' ], 7// --- Standard 5 only --- 8ar :STD , 9au :[ ...STD_MIL , 'id' , 'asn' , 'csiro' ], 10bd :STD , 11bg :STD , 12br :[ 13 ...STD_MIL , 14'art' , 15'eco' , 16'eng' , 17'inf' , 18'med' , 19'psi' , 20'tmp' , 21'etc' , 22'adm' , 23'adv' , 24'arq' , 25'bio' , 26'bmd' , 27'cim' , 28'cng' , 29'cnt' , 30'coop' , 31'ecn' , 32'esp' , 33'far' , 34'fm' , 35'fnd' , 36'fot' , 37'fst' , 38'g12' , 39'ggf' , 40'imb' , 41'ind' , 42'jor' , 43'jus' , 44'leg' , 45'lel' , 46'mat' , 47'mp' , 48'mus' , 49'not' , 50'ntr' , 51'odo' , 52'ppg' , 53'pro' , 54'psc' , 55'qsl' , 56'rec' , 57'slg' , 58'srv' , 59'trd' , 60'tur' , 61'tv' , 62'vet' , 63'vlog' , 64'wiki' , 65'zlg' 66], 67cn :STD_MIL , 68eg :STD , 69gr :STD , 70hk :STD , 71hr :STD , 72hu :[ 'co' , 'net' , 'org' , 'gov' , 'edu' ], 73id :[ ...STD_MIL , 'co' , 'go' , 'or' , 'web' , 'sch' ], 74il :[ 'co' , 'net' , 'org' , 'gov' , 'ac' , 'muni' ], 75in :[ ...STD_MIL , 'co' , 'gen' , 'ind' , 'firm' , 'ernet' , 'nic' ], 76jp :[ 'ac' , 'ad' , 'co' , 'ed' , 'go' , 'gr' , 'lg' , 'ne' , 'or' ], 77ke :[ 'co' , 'or' , 'ne' , 'go' , 'ac' , 'sc' ], 78kr :[ ...STD_MIL , 'co' , 'go' , 'or' , 'ac' , 're' ], 79lk :STD , 80mx :STD_MIL , 81my :STD_MIL , 82ng :STD , 83nz :[ 84 ...STD_MIL , 85'co' , 86'gen' , 87'geek' , 88'kiwi' , 89'maori' , 90'school' , 91'govt' , 92'health' , 93'iwi' , 94'parliament' 95], 96 97ph :STD , 98pk :STD , 99pl :STD , 100ro :STD , 101rs :[ 'co' , 'net' , 'org' , 'gov' , 'edu' ], 102ru :STD , 103sa :STD , 104sg :[ ...STD , 'per' ], 105 106si :STD , 107th :[ 'co' , 'go' , 'or' , 'in' , 'ac' , 'mi' , 'net' ], 108tr :STD , 109tw :STD , 110ua :STD , 111uk :[ 'co' , 'org' , 'net' , 'ac' , 'gov' , 'mil' , 'nhs' , 'police' , 'mod' , 'ltd' , 'plc' , 'me' , 'sch' ], 112ve :STD , 113za :[ 'co' , 'org' , 'net' , 'web' , 'law' , 'mil' ] 114}; 115const WILDCARD_BASES :Record < string , readonly string []> = { 116br :[ 'nom' , 'blog' ], 117jp :[ 118'kobe' , 119'kyoto' , 120'nagoya' , 121'osaka' , 122'sapporo' , 123'sendai' , 124'tokyo' , 125'yokohama' , 126'aichi' , 127'akita' , 128'aomori' , 129'chiba' , 130'ehime' , 131'fukui' , 132'fukuoka' , 133'fukushima' , 134'gifu' , 135'gunma' , 136'hiroshima' , 137'hokkaido' , 138'hyogo' , 139'ibaraki' , 140'ishikawa' , 141'iwate' , 142'kagawa' , 143'kagoshima' , 144'kanagawa' , 145'kochi' , 146'kumamoto' , 147'mie' , 148'miyagi' , 149'miyazaki' , 150'nagano' , 151'nara' , 152'niigata' , 153'oita' , 154'okayama' , 155'okinawa' , 156'saga' , 157'saitama' , 158'shiga' , 159'shimane' , 160'shizuoka' , 161'tochigi' , 162'tokushima' , 163'tottori' , 164'toyama' , 165'wakayama' , 166'yamagata' , 167'yamaguchi' , 168'yamanashi' 169] 170}; 171 172function buildSuffixSet ( suffixes :Record < string , readonly string []>) :Set < string > { 173const set = new Set < string >(); 174 175for ( const [ tld , parts ] of Object . entries ( suffixes )) { 176for ( const part of parts ) { 177set . add ( ` ${ part } . ${ tld } ` ); 178} 179} 180 181return set ; 182} 183 184export const TWO_PART_PUBLIC_SUFFIXES = buildSuffixSet ( ccTLD_PREFIXES ); 185export const WILDCARD_PUBLIC_SUFFIXES = buildSuffixSet ( WILDCARD_BASES ); 186 187// Matches one or more trailing "/" characters at the end of a URL/path. 188export const TRAILING_SLASHES_REGEX = / \/+$ / ; 189 190// Protocols that apiFetch treats as absolute and passes through untouched. 191// Add a protocol here when a caller needs to fetch an absolute URL with it. 192export const API_ABSOLUTE_URL_PROTOCOLS = [ UrlProtocol . HTTP , UrlProtocol . HTTPS ] as const ;