"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    PathHandler: function() {
        return PathHandler;
    }
});
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class PathHandler {
    static getInstance() {
        if (!PathHandler.instance) PathHandler.instance = new PathHandler();
        return PathHandler.instance;
    }
    parse(wildcardPath, schemaId) {
        if (!schemaId) throw new Error('schemaId is required.');
        const segments = wildcardPath.split('/').filter(Boolean);
        let found = false;
        const result = {
            schemaId
        };
        for(let i = 0; i < segments.length; i += 2){
            const key = segments[i];
            const value = segments[i + 1];
            if (!value) continue;
            let validKey = true;
            switch(key){
                case 'collection':
                    result.collection = value;
                    break;
                case 'filter-by-tk':
                    result.filterByTk = value;
                    break;
                case 'source-id':
                    result.sourceId = value;
                    break;
                case 'tab':
                    result.tab = value;
                    break;
                default:
                    validKey = false;
                    console.warn("Unknown key: ".concat(key));
            }
            if (validKey) found = true;
        }
        return !!found && result;
    }
    toWildcardPath(params) {
        const { collection, filterByTk, sourceId, tab } = params;
        const segments = [];
        if (collection) segments.push('collection', collection);
        if (filterByTk) segments.push('filter-by-tk', filterByTk);
        if (sourceId) segments.push('source-id', sourceId);
        if (tab) segments.push('tab', tab);
        return segments.join('/');
    }
    constructor(){}
}
_define_property(PathHandler, "instance", void 0);
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
