(() => { // webpackBootstrap
"use strict";
var __webpack_modules__ = ({
87598: (function (__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) {
/* ESM import */var _swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(76150);
/* ESM import */var _swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24460);
/* ESM import */var _swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(28395);
/// <reference no-default-lib="true"/>
/// <reference lib="ES2015" />
/// <reference lib="webworker" />
/* eslint-disable new-cap */ 


var UNKNOWN_HANDLER = {
    message: 'Unknown message type!',
    code: 'UNKNOWN_HANDLER'
};
var NOT_INITIALIZED_CONFIG = {
    message: 'Worker is not initialized with required config!',
    code: 'NOT_INITIALIZED'
};
var NOT_INITIALIZED_API = {
    message: 'Worker is not initialized with required api!',
    code: 'NOT_INITIALIZED'
};
function AssertConfig(config) {
    if (!config) {
        throw NOT_INITIALIZED_CONFIG;
    }
}
function AssertApi(api) {
    if (!api) {
        throw NOT_INITIALIZED_API;
    }
}
var HANDLERS = {
    init: function init(config) {
        return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() {
            return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function(_state) {
                switch(_state.label){
                    case 0:
                        self.config = config;
                        if (self.config.api) {
                            if (!self.config.api.startsWith('/')) {
                                importScripts(self.config.base + '/' + self.config.api);
                            } else {
                                importScripts(self.config.api);
                            }
                        }
                        if (!(self.api && self.api.init)) return [
                            3,
                            2
                        ];
                        return [
                            4,
                            self.api.init()
                        ];
                    case 1:
                        return [
                            2,
                            _state.sent()
                        ];
                    case 2:
                        return [
                            2
                        ];
                }
            });
        })();
    },
    suggest: function suggest(_0) {
        return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function(param) {
            var query, _param_count, count;
            return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function(_state) {
                switch(_state.label){
                    case 0:
                        query = param.query, _param_count = param.count, count = _param_count === void 0 ? 10 : _param_count;
                        AssertConfig(self.config);
                        AssertApi(self.api);
                        return [
                            4,
                            self.api.suggest(query, count)
                        ];
                    case 1:
                        return [
                            2,
                            _state.sent()
                        ];
                }
            });
        }).apply(this, arguments);
    },
    search: function search(_0) {
        return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function(param) {
            var query, _param_count, count, _param_page, page;
            return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function(_state) {
                switch(_state.label){
                    case 0:
                        query = param.query, _param_count = param.count, count = _param_count === void 0 ? 10 : _param_count, _param_page = param.page, page = _param_page === void 0 ? 1 : _param_page;
                        AssertConfig(self.config);
                        AssertApi(self.api);
                        return [
                            4,
                            self.api.search(query, count, page)
                        ];
                    case 1:
                        return [
                            2,
                            _state.sent()
                        ];
                }
            });
        }).apply(this, arguments);
    }
};
self.onmessage = function(message) {
    return (0,_swc_helpers_async_to_generator__WEBPACK_IMPORTED_MODULE_0__._)(function() {
        var _message_ports, port, type, handler, result, error;
        return (0,_swc_helpers_ts_generator__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function(_state) {
            switch(_state.label){
                case 0:
                    _message_ports = (0,_swc_helpers_sliced_to_array__WEBPACK_IMPORTED_MODULE_2__._)(message.ports, 1), port = _message_ports[0];
                    type = message.data.type;
                    handler = HANDLERS[type];
                    if (!handler) {
                        port.postMessage({
                            error: UNKNOWN_HANDLER
                        });
                        return [
                            2
                        ];
                    }
                    _state.label = 1;
                case 1:
                    _state.trys.push([
                        1,
                        3,
                        ,
                        4
                    ]);
                    return [
                        4,
                        handler(message.data)
                    ];
                case 2:
                    result = _state.sent();
                    port.postMessage({
                        result: result
                    });
                    return [
                        3,
                        4
                    ];
                case 3:
                    error = _state.sent();
                    port.postMessage({
                        error: error
                    });
                    return [
                        3,
                        4
                    ];
                case 4:
                    return [
                        2
                    ];
            }
        });
    })();
};


}),

});
/************************************************************************/
// The module cache
var __webpack_module_cache__ = {};

// The require function
function __webpack_require__(moduleId) {

// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);

// Return the exports of the module
return module.exports;

}

// expose the modules object (__webpack_modules__)
__webpack_require__.m = __webpack_modules__;

// the startup function
__webpack_require__.x = () => {
// Load entry module and return exports
// This entry module depends on other loaded chunks and execution need to be delayed
var __webpack_exports__ = __webpack_require__.O(undefined, ["653"], function() { return __webpack_require__(87598) });
__webpack_exports__ = __webpack_require__.O(__webpack_exports__);
return __webpack_exports__
};

/************************************************************************/
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
	for(var key in definition) {
        if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
            Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
        }
    }
};
})();
// webpack/runtime/ensure_chunk
(() => {
__webpack_require__.f = {};
// This file contains only the entry chunk.
// The chunk loading function for additional chunks
__webpack_require__.e = (chunkId) => {
	return Promise.all(
		Object.keys(__webpack_require__.f).reduce((promises, key) => {
			__webpack_require__.f[key](chunkId, promises);
			return promises;
		}, [])
	);
};
})();
// webpack/runtime/get javascript chunk filename
(() => {
// This function allow to reference chunks
__webpack_require__.u = (chunkId) => {
  // return url for filenames not based on template
  
  // return url for filenames based on template
  return "" + chunkId + ".js"
}
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/on_chunk_loaded
(() => {
var deferred = [];
__webpack_require__.O = (result, chunkIds, fn, priority) => {
	if (chunkIds) {
		priority = priority || 0;
		for (var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--)
			deferred[i] = deferred[i - 1];
		deferred[i] = [chunkIds, fn, priority];
		return;
	}
	var notFulfilled = Infinity;
	for (var i = 0; i < deferred.length; i++) {
		var [chunkIds, fn, priority] = deferred[i];
		var fulfilled = true;
		for (var j = 0; j < chunkIds.length; j++) {
			if (
				(priority & (1 === 0) || notFulfilled >= priority) &&
				Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))
			) {
				chunkIds.splice(j--, 1);
			} else {
				fulfilled = false;
				if (priority < notFulfilled) notFulfilled = priority;
			}
		}
		if (fulfilled) {
			deferred.splice(i--, 1);
			var r = fn();
			if (r !== undefined) result = r;
		}
	}
	return result;
};

})();
// webpack/runtime/startup_chunk_dependencies
(() => {
var next = __webpack_require__.x
__webpack_require__.x = () => {
  __webpack_require__.e("653");
return next();
}
})();
// webpack/runtime/require_chunk_loading
(() => {
var installedChunks = {"444": 1,};
__webpack_require__.O.require = (chunkId) => (installedChunks[chunkId])// object to store loaded chunks
// "1" means "loaded", otherwise not loaded yet
var installChunk = (chunk) => {
	var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;
	for (var moduleId in moreModules) {
		if (__webpack_require__.o(moreModules, moduleId)) {
		 __webpack_require__.m[moduleId] = moreModules[moduleId];
		}
	}
	if (runtime) runtime(__webpack_require__);
	for (var i = 0; i < chunkIds.length; i++) installedChunks[chunkIds[i]] = 1;
	__webpack_require__.O();
};// require() chunk loading for javascript
__webpack_require__.f.require = (chunkId, promises) => {
	// "1" is the signal for "already loaded"
	if (!installedChunks[chunkId]) {
		if (true) {
			installChunk(require("./" + __webpack_require__.u(chunkId)));
		} else installedChunks[chunkId] = 1;
	}
};
})();
/************************************************************************/
// run startup
var __webpack_exports__ = __webpack_require__.x();
module.exports = __webpack_exports__;
})()
;
//# sourceMappingURL=444.js.map