Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
87 lines
2.4 KiB
JavaScript
Executable File
87 lines
2.4 KiB
JavaScript
Executable File
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Ivan Kopeykin @vankop
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
/** @typedef {(error: Error|null, result?: Buffer) => void} ErrorFirstCallback */
|
|
|
|
const backSlashCharCode = "\\".charCodeAt(0);
|
|
const slashCharCode = "/".charCodeAt(0);
|
|
const aLowerCaseCharCode = "a".charCodeAt(0);
|
|
const zLowerCaseCharCode = "z".charCodeAt(0);
|
|
const aUpperCaseCharCode = "A".charCodeAt(0);
|
|
const zUpperCaseCharCode = "Z".charCodeAt(0);
|
|
const _0CharCode = "0".charCodeAt(0);
|
|
const _9CharCode = "9".charCodeAt(0);
|
|
const plusCharCode = "+".charCodeAt(0);
|
|
const hyphenCharCode = "-".charCodeAt(0);
|
|
const colonCharCode = ":".charCodeAt(0);
|
|
const hashCharCode = "#".charCodeAt(0);
|
|
const queryCharCode = "?".charCodeAt(0);
|
|
/**
|
|
* Get scheme if specifier is an absolute URL specifier
|
|
* e.g. Absolute specifiers like 'file:///user/webpack/index.js'
|
|
* https://tools.ietf.org/html/rfc3986#section-3.1
|
|
* @param {string} specifier specifier
|
|
* @returns {string|undefined} scheme if absolute URL specifier provided
|
|
*/
|
|
function getScheme(specifier) {
|
|
const start = specifier.charCodeAt(0);
|
|
|
|
// First char maybe only a letter
|
|
if (
|
|
(start < aLowerCaseCharCode || start > zLowerCaseCharCode) &&
|
|
(start < aUpperCaseCharCode || start > zUpperCaseCharCode)
|
|
) {
|
|
return;
|
|
}
|
|
|
|
let i = 1;
|
|
let ch = specifier.charCodeAt(i);
|
|
|
|
while (
|
|
(ch >= aLowerCaseCharCode && ch <= zLowerCaseCharCode) ||
|
|
(ch >= aUpperCaseCharCode && ch <= zUpperCaseCharCode) ||
|
|
(ch >= _0CharCode && ch <= _9CharCode) ||
|
|
ch === plusCharCode ||
|
|
ch === hyphenCharCode
|
|
) {
|
|
if (++i === specifier.length) return;
|
|
ch = specifier.charCodeAt(i);
|
|
}
|
|
|
|
// Scheme must end with colon
|
|
if (ch !== colonCharCode) return;
|
|
|
|
// Check for Windows absolute path
|
|
// https://url.spec.whatwg.org/#url-miscellaneous
|
|
if (i === 1) {
|
|
const nextChar = i + 1 < specifier.length ? specifier.charCodeAt(i + 1) : 0;
|
|
if (
|
|
nextChar === 0 ||
|
|
nextChar === backSlashCharCode ||
|
|
nextChar === slashCharCode ||
|
|
nextChar === hashCharCode ||
|
|
nextChar === queryCharCode
|
|
) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
return specifier.slice(0, i).toLowerCase();
|
|
}
|
|
|
|
/**
|
|
* @param {string} specifier specifier
|
|
* @returns {string | null | undefined} protocol if absolute URL specifier provided
|
|
*/
|
|
function getProtocol(specifier) {
|
|
const scheme = getScheme(specifier);
|
|
return scheme === undefined ? undefined : `${scheme}:`;
|
|
}
|
|
|
|
module.exports.getProtocol = getProtocol;
|
|
module.exports.getScheme = getScheme;
|