Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3exports.parseCookie = parseCookie;4exports.parse = parseCookie;5exports.stringifyCookie = stringifyCookie;6exports.stringifySetCookie = stringifySetCookie;7exports.serialize = stringifySetCookie;8exports.parseSetCookie = parseSetCookie;9exports.stringifySetCookie = stringifySetCookie;10exports.serialize = stringifySetCookie;11/**12 * RegExp to match cookie-name in RFC 6265 sec 4.1.113 * This refers out to the obsoleted definition of token in RFC 2616 sec 2.214 * which has been replaced by the token definition in RFC 7230 appendix B.15 *16 * cookie-name = token17 * token = 1*tchar18 * tchar = "!" / "#" / "$" / "%" / "&" / "'" /19 * "*" / "+" / "-" / "." / "^" / "_" /20 * "`" / "|" / "~" / DIGIT / ALPHA21 *22 * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/19123 * Allow same range as cookie value, except `=`, which delimits end of name.24 */25const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;26/**27 * RegExp to match cookie-value in RFC 6265 sec 4.1.128 *29 * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )30 * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E31 * ; US-ASCII characters excluding CTLs,32 * ; whitespace DQUOTE, comma, semicolon,33 * ; and backslash34 *35 * Allowing more characters: https://github.com/jshttp/cookie/issues/19136 * Comma, backslash, and DQUOTE are not part of the parsing algorithm.37 */38const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;39/**40 * RegExp to match domain-value in RFC 6265 sec 4.1.141 *42 * domain-value = <subdomain>43 * ; defined in [RFC1034], Section 3.5, as44 * ; enhanced by [RFC1123], Section 2.145 * <subdomain> = <label> | <subdomain> "." <label>46 * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]47 * Labels must be 63 characters or less.48 * 'let-dig' not 'letter' in the first char, per RFC112349 * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>50 * <let-dig-hyp> = <let-dig> | "-"51 * <let-dig> = <letter> | <digit>52 * <letter> = any one of the 52 alphabetic characters A through Z in53 * upper case and a through z in lower case54 * <digit> = any one of the ten digits 0 through 955 *56 * Keep support for leading dot: https://github.com/jshttp/cookie/issues/17357 *58 * > (Note that a leading %x2E ("."), if present, is ignored even though that59 * character is not permitted, but a trailing %x2E ("."), if present, will60 * cause the user agent to ignore the attribute.)61 */62const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;63/**64 * RegExp to match path-value in RFC 6265 sec 4.1.165 *66 * path-value = <any CHAR except CTLs or ";">67 * CHAR = %x01-7F68 * ; defined in RFC 5234 appendix B.169 */70const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;71/**72 * RegExp to match max-age-value in RFC 6265 sec 5.6.273 */74const maxAgeRegExp = /^-?\d+$/;75const __toString = Object.prototype.toString;76const NullObject = /* @__PURE__ */ (() => {77 const C = function () { };78 C.prototype = Object.create(null);79 return C;80})();81/**82 * Parse a `Cookie` header.83 *84 * Parse the given cookie header string into an object85 * The object has the various cookies as keys(names) => values86 */87function parseCookie(str, options) {88 const obj = new NullObject();89 const len = str.length;90 // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.91 if (len < 2)92 return obj;93 const dec = options?.decode || decode;94 let index = 0;95 do {96 const eqIdx = eqIndex(str, index, len);97 if (eqIdx === -1)98 break; // No more cookie pairs.99 const endIdx = endIndex(str, index, len);100 if (eqIdx > endIdx) {101 // backtrack on prior semicolon102 index = str.lastIndexOf(";", eqIdx - 1) + 1;103 continue;104 }105 const key = valueSlice(str, index, eqIdx);106 // only assign once107 if (obj[key] === undefined) {108 obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));109 }110 index = endIdx + 1;111 } while (index < len);112 return obj;113}114/**115 * Stringifies an object into an HTTP `Cookie` header.116 */117function stringifyCookie(cookie, options) {118 const enc = options?.encode || encodeURIComponent;119 const cookieStrings = [];120 for (const name of Object.keys(cookie)) {121 const val = cookie[name];122 if (val === undefined)123 continue;124 if (!cookieNameRegExp.test(name)) {125 throw new TypeError(`cookie name is invalid: ${name}`);126 }127 const value = enc(val);128 if (!cookieValueRegExp.test(value)) {129 throw new TypeError(`cookie val is invalid: ${val}`);130 }131 cookieStrings.push(`${name}=${value}`);132 }133 return cookieStrings.join("; ");134}135function stringifySetCookie(_name, _val, _opts) {136 const cookie = typeof _name === "object"137 ? _name138 : { ..._opts, name: _name, value: String(_val) };139 const options = typeof _val === "object" ? _val : _opts;140 const enc = options?.encode || encodeURIComponent;141 if (!cookieNameRegExp.test(cookie.name)) {142 throw new TypeError(`argument name is invalid: ${cookie.name}`);143 }144 const value = cookie.value ? enc(cookie.value) : "";145 if (!cookieValueRegExp.test(value)) {146 throw new TypeError(`argument val is invalid: ${cookie.value}`);147 }148 let str = cookie.name + "=" + value;149 if (cookie.maxAge !== undefined) {150 if (!Number.isInteger(cookie.maxAge)) {151 throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);152 }153 str += "; Max-Age=" + cookie.maxAge;154 }155 if (cookie.domain) {156 if (!domainValueRegExp.test(cookie.domain)) {157 throw new TypeError(`option domain is invalid: ${cookie.domain}`);158 }159 str += "; Domain=" + cookie.domain;160 }161 if (cookie.path) {162 if (!pathValueRegExp.test(cookie.path)) {163 throw new TypeError(`option path is invalid: ${cookie.path}`);164 }165 str += "; Path=" + cookie.path;166 }167 if (cookie.expires) {168 if (!isDate(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {169 throw new TypeError(`option expires is invalid: ${cookie.expires}`);170 }171 str += "; Expires=" + cookie.expires.toUTCString();172 }173 if (cookie.httpOnly) {174 str += "; HttpOnly";175 }176 if (cookie.secure) {177 str += "; Secure";178 }179 if (cookie.partitioned) {180 str += "; Partitioned";181 }182 if (cookie.priority) {183 const priority = typeof cookie.priority === "string"184 ? cookie.priority.toLowerCase()185 : undefined;186 switch (priority) {187 case "low":188 str += "; Priority=Low";189 break;190 case "medium":191 str += "; Priority=Medium";192 break;193 case "high":194 str += "; Priority=High";195 break;196 default:197 throw new TypeError(`option priority is invalid: ${cookie.priority}`);198 }199 }200 if (cookie.sameSite) {201 const sameSite = typeof cookie.sameSite === "string"202 ? cookie.sameSite.toLowerCase()203 : cookie.sameSite;204 switch (sameSite) {205 case true:206 case "strict":207 str += "; SameSite=Strict";208 break;209 case "lax":210 str += "; SameSite=Lax";211 break;212 case "none":213 str += "; SameSite=None";214 break;215 default:216 throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);217 }218 }219 return str;220}221/**222 * Deserialize a `Set-Cookie` header into an object.223 *224 * deserialize('foo=bar; httpOnly')225 * => { name: 'foo', value: 'bar', httpOnly: true }226 */227function parseSetCookie(str, options) {228 const dec = options?.decode || decode;229 const len = str.length;230 const endIdx = endIndex(str, 0, len);231 const eqIdx = eqIndex(str, 0, endIdx);232 const setCookie = eqIdx === -1233 ? { name: "", value: dec(valueSlice(str, 0, endIdx)) }234 : {235 name: valueSlice(str, 0, eqIdx),236 value: dec(valueSlice(str, eqIdx + 1, endIdx)),237 };238 let index = endIdx + 1;239 while (index < len) {240 const endIdx = endIndex(str, index, len);241 const eqIdx = eqIndex(str, index, endIdx);242 const attr = eqIdx === -1243 ? valueSlice(str, index, endIdx)244 : valueSlice(str, index, eqIdx);245 const val = eqIdx === -1 ? undefined : valueSlice(str, eqIdx + 1, endIdx);246 switch (attr.toLowerCase()) {247 case "httponly":248 setCookie.httpOnly = true;249 break;250 case "secure":251 setCookie.secure = true;252 break;253 case "partitioned":254 setCookie.partitioned = true;255 break;256 case "domain":257 setCookie.domain = val;258 break;259 case "path":260 setCookie.path = val;261 break;262 case "max-age":263 if (val && maxAgeRegExp.test(val))264 setCookie.maxAge = Number(val);265 break;266 case "expires":267 if (!val)268 break;269 const date = new Date(val);270 if (Number.isFinite(date.valueOf()))271 setCookie.expires = date;272 break;273 case "priority":274 if (!val)275 break;276 const priority = val.toLowerCase();277 if (priority === "low" ||278 priority === "medium" ||279 priority === "high") {280 setCookie.priority = priority;281 }282 break;283 case "samesite":284 if (!val)285 break;286 const sameSite = val.toLowerCase();287 if (sameSite === "lax" ||288 sameSite === "strict" ||289 sameSite === "none") {290 setCookie.sameSite = sameSite;291 }292 break;293 }294 index = endIdx + 1;295 }296 return setCookie;297}298/**299 * Find the `;` character between `min` and `len` in str.300 */301function endIndex(str, min, len) {302 const index = str.indexOf(";", min);303 return index === -1 ? len : index;304}305/**306 * Find the `=` character between `min` and `max` in str.307 */308function eqIndex(str, min, max) {309 const index = str.indexOf("=", min);310 return index < max ? index : -1;311}312/**313 * Slice out a value between startPod to max.314 */315function valueSlice(str, min, max) {316 let start = min;317 let end = max;318 do {319 const code = str.charCodeAt(start);320 if (code !== 0x20 /* */ && code !== 0x09 /* \t */)321 break;322 } while (++start < end);323 while (end > start) {324 const code = str.charCodeAt(end - 1);325 if (code !== 0x20 /* */ && code !== 0x09 /* \t */)326 break;327 end--;328 }329 return str.slice(start, end);330}331/**332 * URL-decode string value. Optimized to skip native call when no %.333 */334function decode(str) {335 if (str.indexOf("%") === -1)336 return str;337 try {338 return decodeURIComponent(str);339 }340 catch (e) {341 return str;342 }343}344/**345 * Determine if value is a Date.346 */347function isDate(val) {348 return __toString.call(val) === "[object Date]";349}350//# sourceMappingURL=index.js.map