@nitra/zebra 8.0.3 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitraZebra.podspec +1 -1
- package/Package.swift +4 -1
- package/README.md +1 -1
- package/dist/plugin.js +9 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/ZebraPlugin/Zebra.swift +98 -44
- package/ios/Sources/ZebraPlugin/ZebraLog.swift +11 -0
- package/ios/Sources/ZebraPlugin/ZebraPlugin.swift +57 -53
- package/ios/Tests/ZebraPluginTests/ZebraTests.swift +11 -8
- package/package.json +2 -1
package/NitraZebra.podspec
CHANGED
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '16.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.frameworks = 'ExternalAccessory'
|
|
17
17
|
s.swift_version = '5.1'
|
package/Package.swift
CHANGED
|
@@ -3,7 +3,7 @@ import PackageDescription
|
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
5
|
name: "NitraZebra",
|
|
6
|
-
platforms: [.iOS(.
|
|
6
|
+
platforms: [.iOS(.v16)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
9
|
name: "NitraZebra",
|
|
@@ -20,6 +20,9 @@ let package = Package(
|
|
|
20
20
|
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
21
|
],
|
|
22
22
|
path: "ios/Sources/ZebraPlugin",
|
|
23
|
+
swiftSettings: [
|
|
24
|
+
.enableUpcomingFeature("StrictConcurrency")
|
|
25
|
+
],
|
|
23
26
|
linkerSettings: [
|
|
24
27
|
.linkedFramework("ExternalAccessory")
|
|
25
28
|
]),
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Capacitor-плагін для друку ZPL на принтерах Zebra з п
|
|
|
7
7
|
- **Capacitor** 7.0.0 або новіший
|
|
8
8
|
- **Веб**: браузер з підтримкою [Web Serial API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API) (Chrome, Edge, Opera)
|
|
9
9
|
- **Android**: minSdk 23, targetSdk 35
|
|
10
|
-
- **iOS**:
|
|
10
|
+
- **iOS**: 16.0+
|
|
11
11
|
|
|
12
12
|
## Встановлення
|
|
13
13
|
|
package/dist/plugin.js
CHANGED
|
@@ -18,7 +18,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
|
-
//#region ../node_modules/.bun/@capacitor+preferences@
|
|
21
|
+
//#region ../node_modules/.bun/@capacitor+preferences@8.0.0+2476a4e6bb24aa03/node_modules/@capacitor/preferences/dist/esm/web.js
|
|
22
22
|
var web_exports$1 = /* @__PURE__ */ __exportAll({ PreferencesWeb: () => PreferencesWeb });
|
|
23
23
|
var PreferencesWeb;
|
|
24
24
|
var init_web$1 = __esmMin((() => {
|
|
@@ -90,11 +90,18 @@ var init_web$1 = __esmMin((() => {
|
|
|
90
90
|
}));
|
|
91
91
|
|
|
92
92
|
//#endregion
|
|
93
|
-
//#region ../node_modules/.bun/@capacitor+preferences@
|
|
93
|
+
//#region ../node_modules/.bun/@capacitor+preferences@8.0.0+2476a4e6bb24aa03/node_modules/@capacitor/preferences/dist/esm/index.js
|
|
94
94
|
const Preferences = registerPlugin("Preferences", { web: () => Promise.resolve().then(() => (init_web$1(), web_exports$1)).then((m) => new m.PreferencesWeb()) });
|
|
95
95
|
|
|
96
96
|
//#endregion
|
|
97
97
|
//#region src/utils/validate.js
|
|
98
|
+
/**
|
|
99
|
+
* Нормалізує аргумент ZPL для друку: перевіряє рядок і повертає обрізану команду.
|
|
100
|
+
* @param {string} zpl - рядок ZPL-команд
|
|
101
|
+
* @returns {string} обрізаний рядок ZPL
|
|
102
|
+
* @throws {TypeError} якщо zpl не рядок
|
|
103
|
+
* @throws {Error} якщо команда порожня
|
|
104
|
+
*/
|
|
98
105
|
function normalizePrintArg(zpl) {
|
|
99
106
|
if (typeof zpl !== "string") throw new TypeError("Expected \"zpl\" to be a string");
|
|
100
107
|
const command = zpl.trim();
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","names":["createConsola","getViteEnvVar"],"sources":["../../node_modules/.bun/@capacitor+preferences@7.0.3+2476a4e6bb24aa03/node_modules/@capacitor/preferences/dist/esm/web.js","../../node_modules/.bun/@capacitor+preferences@7.0.3+2476a4e6bb24aa03/node_modules/@capacitor/preferences/dist/esm/index.js","../src/utils/validate.js","../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/core.mjs","../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/browser.mjs","../../node_modules/.bun/@nitra+consola@2.4.1/node_modules/@nitra/consola/src/otel-reporter.js","../../node_modules/.bun/@nitra+consola@2.4.1/node_modules/@nitra/consola/src/browser.js","../src/web.js","../src/index.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nexport class PreferencesWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.group = 'CapacitorStorage';\n }\n async configure({ group }) {\n if (typeof group === 'string') {\n this.group = group;\n }\n }\n async get(options) {\n const value = this.impl.getItem(this.applyPrefix(options.key));\n return { value };\n }\n async set(options) {\n this.impl.setItem(this.applyPrefix(options.key), options.value);\n }\n async remove(options) {\n this.impl.removeItem(this.applyPrefix(options.key));\n }\n async keys() {\n const keys = this.rawKeys().map(k => k.substring(this.prefix.length));\n return { keys };\n }\n async clear() {\n for (const key of this.rawKeys()) {\n this.impl.removeItem(key);\n }\n }\n async migrate() {\n var _a;\n const migrated = [];\n const existing = [];\n const oldprefix = '_cap_';\n const keys = Object.keys(this.impl).filter(k => k.indexOf(oldprefix) === 0);\n for (const oldkey of keys) {\n const key = oldkey.substring(oldprefix.length);\n const value = (_a = this.impl.getItem(oldkey)) !== null && _a !== void 0 ? _a : '';\n const { value: currentValue } = await this.get({ key });\n if (typeof currentValue === 'string') {\n existing.push(key);\n }\n else {\n await this.set({ key, value });\n migrated.push(key);\n }\n }\n return { migrated, existing };\n }\n async removeOld() {\n const oldprefix = '_cap_';\n const keys = Object.keys(this.impl).filter(k => k.indexOf(oldprefix) === 0);\n for (const oldkey of keys) {\n this.impl.removeItem(oldkey);\n }\n }\n get impl() {\n return window.localStorage;\n }\n get prefix() {\n return this.group === 'NativeStorage' ? '' : `${this.group}.`;\n }\n rawKeys() {\n return Object.keys(this.impl).filter(k => k.indexOf(this.prefix) === 0);\n }\n applyPrefix(key) {\n return this.prefix + key;\n }\n}\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nconst Preferences = registerPlugin('Preferences', {\n web: () => import('./web').then(m => new m.PreferencesWeb()),\n});\nexport * from './definitions';\nexport { Preferences };\n//# sourceMappingURL=index.js.map","export function normalizePrintArg(zpl) {\n if (typeof zpl !== 'string') {\n throw new TypeError('Expected \"zpl\" to be a string')\n }\n\n const command = zpl.trim()\n if (!command) {\n throw new Error('ZPL команда порожня')\n }\n\n return command\n}\n","const LogLevels = {\n silent: Number.NEGATIVE_INFINITY,\n fatal: 0,\n error: 0,\n warn: 1,\n log: 2,\n info: 3,\n success: 3,\n fail: 3,\n ready: 3,\n start: 3,\n box: 3,\n debug: 4,\n trace: 5,\n verbose: Number.POSITIVE_INFINITY\n};\nconst LogTypes = {\n // Silent\n silent: {\n level: -1\n },\n // Level 0\n fatal: {\n level: LogLevels.fatal\n },\n error: {\n level: LogLevels.error\n },\n // Level 1\n warn: {\n level: LogLevels.warn\n },\n // Level 2\n log: {\n level: LogLevels.log\n },\n // Level 3\n info: {\n level: LogLevels.info\n },\n success: {\n level: LogLevels.success\n },\n fail: {\n level: LogLevels.fail\n },\n ready: {\n level: LogLevels.info\n },\n start: {\n level: LogLevels.info\n },\n box: {\n level: LogLevels.info\n },\n // Level 4\n debug: {\n level: LogLevels.debug\n },\n // Level 5\n trace: {\n level: LogLevels.trace\n },\n // Verbose\n verbose: {\n level: LogLevels.verbose\n }\n};\n\nfunction isPlainObject$1(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n if (Symbol.iterator in value) {\n return false;\n }\n if (Symbol.toStringTag in value) {\n return Object.prototype.toString.call(value) === \"[object Module]\";\n }\n return true;\n}\n\nfunction _defu(baseObject, defaults, namespace = \".\", merger) {\n if (!isPlainObject$1(defaults)) {\n return _defu(baseObject, {}, namespace, merger);\n }\n const object = Object.assign({}, defaults);\n for (const key in baseObject) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue;\n }\n const value = baseObject[key];\n if (value === null || value === void 0) {\n continue;\n }\n if (merger && merger(object, key, value, namespace)) {\n continue;\n }\n if (Array.isArray(value) && Array.isArray(object[key])) {\n object[key] = [...value, ...object[key]];\n } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {\n object[key] = _defu(\n value,\n object[key],\n (namespace ? `${namespace}.` : \"\") + key.toString(),\n merger\n );\n } else {\n object[key] = value;\n }\n }\n return object;\n}\nfunction createDefu(merger) {\n return (...arguments_) => (\n // eslint-disable-next-line unicorn/no-array-reduce\n arguments_.reduce((p, c) => _defu(p, c, \"\", merger), {})\n );\n}\nconst defu = createDefu();\n\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n}\nfunction isLogObj(arg) {\n if (!isPlainObject(arg)) {\n return false;\n }\n if (!arg.message && !arg.args) {\n return false;\n }\n if (arg.stack) {\n return false;\n }\n return true;\n}\n\nlet paused = false;\nconst queue = [];\nclass Consola {\n options;\n _lastLog;\n _mockFn;\n /**\n * Creates an instance of Consola with specified options or defaults.\n *\n * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.\n */\n constructor(options = {}) {\n const types = options.types || LogTypes;\n this.options = defu(\n {\n ...options,\n defaults: { ...options.defaults },\n level: _normalizeLogLevel(options.level, types),\n reporters: [...options.reporters || []]\n },\n {\n types: LogTypes,\n throttle: 1e3,\n throttleMin: 5,\n formatOptions: {\n date: true,\n colors: false,\n compact: true\n }\n }\n );\n for (const type in types) {\n const defaults = {\n type,\n ...this.options.defaults,\n ...types[type]\n };\n this[type] = this._wrapLogFn(defaults);\n this[type].raw = this._wrapLogFn(\n defaults,\n true\n );\n }\n if (this.options.mockFn) {\n this.mockTypes();\n }\n this._lastLog = {};\n }\n /**\n * Gets the current log level of the Consola instance.\n *\n * @returns {number} The current log level.\n */\n get level() {\n return this.options.level;\n }\n /**\n * Sets the minimum log level that will be output by the instance.\n *\n * @param {number} level - The new log level to set.\n */\n set level(level) {\n this.options.level = _normalizeLogLevel(\n level,\n this.options.types,\n this.options.level\n );\n }\n /**\n * Displays a prompt to the user and returns the response.\n * Throw an error if `prompt` is not supported by the current configuration.\n *\n * @template T\n * @param {string} message - The message to display in the prompt.\n * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.\n * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.\n */\n prompt(message, opts) {\n if (!this.options.prompt) {\n throw new Error(\"prompt is not supported!\");\n }\n return this.options.prompt(message, opts);\n }\n /**\n * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.\n *\n * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.\n * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n */\n create(options) {\n const instance = new Consola({\n ...this.options,\n ...options\n });\n if (this._mockFn) {\n instance.mockTypes(this._mockFn);\n }\n return instance;\n }\n /**\n * Creates a new Consola instance with the specified default log object properties.\n *\n * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.\n * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n */\n withDefaults(defaults) {\n return this.create({\n ...this.options,\n defaults: {\n ...this.options.defaults,\n ...defaults\n }\n });\n }\n /**\n * Creates a new Consola instance with a specified tag, which will be included in every log.\n *\n * @param {string} tag - The tag to include in each log of the new instance.\n * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n */\n withTag(tag) {\n return this.withDefaults({\n tag: this.options.defaults.tag ? this.options.defaults.tag + \":\" + tag : tag\n });\n }\n /**\n * Adds a custom reporter to the Consola instance.\n * Reporters will be called for each log message, depending on their implementation and log level.\n *\n * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.\n * @returns {Consola} The current Consola instance.\n */\n addReporter(reporter) {\n this.options.reporters.push(reporter);\n return this;\n }\n /**\n * Removes a custom reporter from the Consola instance.\n * If no reporter is specified, all reporters will be removed.\n *\n * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.\n * @returns {Consola} The current Consola instance.\n */\n removeReporter(reporter) {\n if (reporter) {\n const i = this.options.reporters.indexOf(reporter);\n if (i !== -1) {\n return this.options.reporters.splice(i, 1);\n }\n } else {\n this.options.reporters.splice(0);\n }\n return this;\n }\n /**\n * Replaces all reporters of the Consola instance with the specified array of reporters.\n *\n * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.\n * @returns {Consola} The current Consola instance.\n */\n setReporters(reporters) {\n this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];\n return this;\n }\n wrapAll() {\n this.wrapConsole();\n this.wrapStd();\n }\n restoreAll() {\n this.restoreConsole();\n this.restoreStd();\n }\n /**\n * Overrides console methods with Consola logging methods for consistent logging.\n */\n wrapConsole() {\n for (const type in this.options.types) {\n if (!console[\"__\" + type]) {\n console[\"__\" + type] = console[type];\n }\n console[type] = this[type].raw;\n }\n }\n /**\n * Restores the original console methods, removing Consola overrides.\n */\n restoreConsole() {\n for (const type in this.options.types) {\n if (console[\"__\" + type]) {\n console[type] = console[\"__\" + type];\n delete console[\"__\" + type];\n }\n }\n }\n /**\n * Overrides standard output and error streams to redirect them through Consola.\n */\n wrapStd() {\n this._wrapStream(this.options.stdout, \"log\");\n this._wrapStream(this.options.stderr, \"log\");\n }\n _wrapStream(stream, type) {\n if (!stream) {\n return;\n }\n if (!stream.__write) {\n stream.__write = stream.write;\n }\n stream.write = (data) => {\n this[type].raw(String(data).trim());\n };\n }\n /**\n * Restores the original standard output and error streams, removing the Consola redirection.\n */\n restoreStd() {\n this._restoreStream(this.options.stdout);\n this._restoreStream(this.options.stderr);\n }\n _restoreStream(stream) {\n if (!stream) {\n return;\n }\n if (stream.__write) {\n stream.write = stream.__write;\n delete stream.__write;\n }\n }\n /**\n * Pauses logging, queues incoming logs until resumed.\n */\n pauseLogs() {\n paused = true;\n }\n /**\n * Resumes logging, processing any queued logs.\n */\n resumeLogs() {\n paused = false;\n const _queue = queue.splice(0);\n for (const item of _queue) {\n item[0]._logFn(item[1], item[2]);\n }\n }\n /**\n * Replaces logging methods with mocks if a mock function is provided.\n *\n * @param {ConsolaOptions[\"mockFn\"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions[\"mockFn\"]}.\n */\n mockTypes(mockFn) {\n const _mockFn = mockFn || this.options.mockFn;\n this._mockFn = _mockFn;\n if (typeof _mockFn !== \"function\") {\n return;\n }\n for (const type in this.options.types) {\n this[type] = _mockFn(type, this.options.types[type]) || this[type];\n this[type].raw = this[type];\n }\n }\n _wrapLogFn(defaults, isRaw) {\n return (...args) => {\n if (paused) {\n queue.push([this, defaults, args, isRaw]);\n return;\n }\n return this._logFn(defaults, args, isRaw);\n };\n }\n _logFn(defaults, args, isRaw) {\n if ((defaults.level || 0) > this.level) {\n return false;\n }\n const logObj = {\n date: /* @__PURE__ */ new Date(),\n args: [],\n ...defaults,\n level: _normalizeLogLevel(defaults.level, this.options.types)\n };\n if (!isRaw && args.length === 1 && isLogObj(args[0])) {\n Object.assign(logObj, args[0]);\n } else {\n logObj.args = [...args];\n }\n if (logObj.message) {\n logObj.args.unshift(logObj.message);\n delete logObj.message;\n }\n if (logObj.additional) {\n if (!Array.isArray(logObj.additional)) {\n logObj.additional = logObj.additional.split(\"\\n\");\n }\n logObj.args.push(\"\\n\" + logObj.additional.join(\"\\n\"));\n delete logObj.additional;\n }\n logObj.type = typeof logObj.type === \"string\" ? logObj.type.toLowerCase() : \"log\";\n logObj.tag = typeof logObj.tag === \"string\" ? logObj.tag : \"\";\n const resolveLog = (newLog = false) => {\n const repeated = (this._lastLog.count || 0) - this.options.throttleMin;\n if (this._lastLog.object && repeated > 0) {\n const args2 = [...this._lastLog.object.args];\n if (repeated > 1) {\n args2.push(`(repeated ${repeated} times)`);\n }\n this._log({ ...this._lastLog.object, args: args2 });\n this._lastLog.count = 1;\n }\n if (newLog) {\n this._lastLog.object = logObj;\n this._log(logObj);\n }\n };\n clearTimeout(this._lastLog.timeout);\n const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;\n this._lastLog.time = logObj.date;\n if (diffTime < this.options.throttle) {\n try {\n const serializedLog = JSON.stringify([\n logObj.type,\n logObj.tag,\n logObj.args\n ]);\n const isSameLog = this._lastLog.serialized === serializedLog;\n this._lastLog.serialized = serializedLog;\n if (isSameLog) {\n this._lastLog.count = (this._lastLog.count || 0) + 1;\n if (this._lastLog.count > this.options.throttleMin) {\n this._lastLog.timeout = setTimeout(\n resolveLog,\n this.options.throttle\n );\n return;\n }\n }\n } catch {\n }\n }\n resolveLog(true);\n }\n _log(logObj) {\n for (const reporter of this.options.reporters) {\n reporter.log(logObj, {\n options: this.options\n });\n }\n }\n}\nfunction _normalizeLogLevel(input, types = {}, defaultLevel = 3) {\n if (input === void 0) {\n return defaultLevel;\n }\n if (typeof input === \"number\") {\n return input;\n }\n if (types[input] && types[input].level !== void 0) {\n return types[input].level;\n }\n return defaultLevel;\n}\nConsola.prototype.add = Consola.prototype.addReporter;\nConsola.prototype.remove = Consola.prototype.removeReporter;\nConsola.prototype.clear = Consola.prototype.removeReporter;\nConsola.prototype.withScope = Consola.prototype.withTag;\nConsola.prototype.mock = Consola.prototype.mockTypes;\nConsola.prototype.pause = Consola.prototype.pauseLogs;\nConsola.prototype.resume = Consola.prototype.resumeLogs;\nfunction createConsola(options = {}) {\n return new Consola(options);\n}\n\nexport { Consola, LogLevels, LogTypes, createConsola };\n","import { createConsola as createConsola$1 } from './core.mjs';\nexport { Consola, LogLevels, LogTypes } from './core.mjs';\n\nclass BrowserReporter {\n options;\n defaultColor;\n levelColorMap;\n typeColorMap;\n constructor(options) {\n this.options = { ...options };\n this.defaultColor = \"#7f8c8d\";\n this.levelColorMap = {\n 0: \"#c0392b\",\n // Red\n 1: \"#f39c12\",\n // Yellow\n 3: \"#00BCD4\"\n // Cyan\n };\n this.typeColorMap = {\n success: \"#2ecc71\"\n // Green\n };\n }\n _getLogFn(level) {\n if (level < 1) {\n return console.__error || console.error;\n }\n if (level === 1) {\n return console.__warn || console.warn;\n }\n return console.__log || console.log;\n }\n log(logObj) {\n const consoleLogFn = this._getLogFn(logObj.level);\n const type = logObj.type === \"log\" ? \"\" : logObj.type;\n const tag = logObj.tag || \"\";\n const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;\n const style = `\n background: ${color};\n border-radius: 0.5em;\n color: white;\n font-weight: bold;\n padding: 2px 0.5em;\n `;\n const badge = `%c${[tag, type].filter(Boolean).join(\":\")}`;\n if (typeof logObj.args[0] === \"string\") {\n consoleLogFn(\n `${badge}%c ${logObj.args[0]}`,\n style,\n // Empty string as style resets to default console style\n \"\",\n ...logObj.args.slice(1)\n );\n } else {\n consoleLogFn(badge, style, ...logObj.args);\n }\n }\n}\n\nfunction createConsola(options = {}) {\n const consola2 = createConsola$1({\n reporters: options.reporters || [new BrowserReporter({})],\n prompt(message, options2 = {}) {\n if (options2.type === \"confirm\") {\n return Promise.resolve(confirm(message));\n }\n return Promise.resolve(prompt(message));\n },\n ...options\n });\n return consola2;\n}\nconst consola = createConsola();\n\nexport { consola, createConsola, consola as default };\n","// Отримання змінних середовища з Vite (import.meta.env)\nconst getViteEnvVar = name => {\n try {\n // eslint-disable-next-line no-undef\n const viteName = `VITE_${name}`\n // eslint-disable-next-line no-undef\n return import.meta?.env?.[viteName]\n } catch {\n return null\n }\n}\n\n// OpenTelemetry Reporter для експорту логів до OpenTelemetry Collector через HTTP\nexport class OpenTelemetryReporter {\n constructor(options = {}) {\n this.endpoint =\n options.endpoint || getViteEnvVar('OTEL_EXPORTER_OTLP_LOGS_ENDPOINT') || 'http://localhost:4318/v1/logs'\n this.serviceName = options.serviceName || getViteEnvVar('OTEL_SERVICE_NAME') || 'consola-service'\n this.serviceVersion = options.serviceVersion || getViteEnvVar('OTEL_SERVICE_VERSION') || '1.0.0'\n this.batchSize = options.batchSize || parseInt(getViteEnvVar('OTEL_BATCH_SIZE') || '10', 10)\n this.flushInterval = options.flushInterval || parseInt(getViteEnvVar('OTEL_FLUSH_INTERVAL') || '5000', 10)\n this.buffer = []\n this.flushTimer = null\n this.headers = {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n\n // Запускаємо таймер для періодичної відправки\n if (this.flushInterval > 0) {\n this.startFlushTimer()\n }\n }\n\n formatMessage(logObj) {\n const args = logObj.args || []\n if (args.length === 0) return ''\n\n return args\n .map(arg => {\n if (arg instanceof Error) {\n let msg = `${arg.name || 'Error'}: ${arg.message || ''}`\n if (arg.stack && arg.stack !== arg.message) {\n msg += '\\n' + arg.stack\n }\n return msg\n }\n if (arg === null) return 'null'\n if (arg === undefined) return 'undefined'\n if (typeof arg === 'object') {\n try {\n return JSON.stringify(arg, null, 2)\n } catch {\n return String(arg)\n }\n }\n return String(arg)\n })\n .join(' ')\n }\n\n getSeverityNumber(type) {\n // Маппінг типів consola до OpenTelemetry severity numbers\n const severityMap = {\n trace: 1, // TRACE\n debug: 5, // DEBUG\n info: 9, // INFO\n log: 9, // INFO\n warn: 13, // WARN\n error: 17, // ERROR\n fatal: 21, // FATAL\n success: 9, // INFO\n start: 9, // INFO\n ready: 9, // INFO\n fail: 17 // ERROR\n }\n return severityMap[type] || 9\n }\n\n getSeverityText(type) {\n const textMap = {\n trace: 'TRACE',\n debug: 'DEBUG',\n info: 'INFO',\n log: 'INFO',\n warn: 'WARN',\n error: 'ERROR',\n fatal: 'FATAL',\n success: 'INFO',\n start: 'INFO',\n ready: 'INFO',\n fail: 'ERROR'\n }\n return textMap[type] || 'INFO'\n }\n\n getFileInfo() {\n try {\n const stack = new Error('Stack trace').stack\n if (!stack) return null\n\n const skipPatterns = ['OpenTelemetryReporter', 'otel-reporter.js', 'browser.js', 'consola', 'createLogger']\n const lines = stack.split('\\n').slice(4, 15)\n\n for (const line of lines) {\n const trimmed = line.trim()\n const shouldSkip = skipPatterns.some(pattern => trimmed.includes(pattern))\n\n if (!shouldSkip) {\n const match =\n trimmed.match(/\\(?([^()]+):(\\d+):(\\d+)\\)?/) || trimmed.match(/at\\s+[^(]*\\(?([^:]+):(\\d+):(\\d+)\\)?/)\n\n if (match) {\n let file = match[1].trim()\n const lineNum = match[2]\n\n if (file.includes('://')) {\n file = file.slice(file.indexOf('://') + 3).slice(file.indexOf('/'))\n }\n if (file.includes('/src/')) {\n file = file.slice(file.indexOf('/src/') + 5)\n }\n const queryIndex = file.indexOf('?')\n if (queryIndex > 0) file = file.slice(0, queryIndex)\n const hashIndex = file.indexOf('#')\n if (hashIndex > 0) file = file.slice(0, hashIndex)\n if (file.startsWith('/')) file = file.slice(1)\n\n if (file && lineNum) {\n return { file, line: parseInt(lineNum, 10), column: parseInt(match[3], 10) }\n }\n }\n }\n }\n } catch {\n // Ігноруємо помилки\n }\n return null\n }\n\n createLogRecord(logObj) {\n const type = logObj.type || 'log'\n const message = this.formatMessage(logObj)\n const fileInfo = this.getFileInfo()\n const timestamp = Date.now() * 1000000 // наносекунди\n\n const logRecord = {\n timeUnixNano: timestamp.toString(),\n severityNumber: this.getSeverityNumber(type),\n severityText: this.getSeverityText(type),\n body: {\n stringValue: message\n },\n attributes: [\n {\n key: 'log.type',\n value: { stringValue: type }\n }\n ]\n }\n\n // Додаємо інформацію про файл, якщо доступна\n if (fileInfo) {\n logRecord.attributes.push(\n {\n key: 'code.filepath',\n value: { stringValue: fileInfo.file }\n },\n {\n key: 'code.lineno',\n value: { intValue: fileInfo.line }\n }\n )\n if (fileInfo.column) {\n logRecord.attributes.push({\n key: 'code.colno',\n value: { intValue: fileInfo.column }\n })\n }\n }\n\n // Додаємо додаткові атрибути з logObj, якщо вони є\n if (logObj.extra && typeof logObj.extra === 'object') {\n for (const [key, value] of Object.entries(logObj.extra)) {\n logRecord.attributes.push({\n key: `extra.${key}`,\n value: { stringValue: String(value) }\n })\n }\n }\n\n return logRecord\n }\n\n async sendLogs(logs) {\n if (logs.length === 0) return\n\n const resourceLogs = {\n resource: {\n attributes: [\n {\n key: 'service.name',\n value: { stringValue: this.serviceName }\n },\n {\n key: 'service.version',\n value: { stringValue: this.serviceVersion }\n }\n ]\n },\n scopeLogs: [\n {\n scope: {\n name: 'consola',\n version: '1.0.0'\n },\n logRecords: logs\n }\n ]\n }\n\n const payload = {\n resourceLogs: [resourceLogs]\n }\n\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n mode: 'cors',\n headers: this.headers,\n body: JSON.stringify(payload)\n })\n\n if (!response.ok) {\n console.warn(`OpenTelemetry export failed: ${response.status} ${response.statusText}`)\n }\n } catch (error) {\n // Тихо ігноруємо помилки, щоб не порушити роботу додатку\n console.warn('OpenTelemetry export error:', error?.message || String(error))\n }\n }\n\n async flush() {\n if (this.buffer.length === 0) return\n\n const logsToSend = [...this.buffer]\n this.buffer = []\n await this.sendLogs(logsToSend)\n }\n\n startFlushTimer() {\n if (this.flushTimer) {\n clearInterval(this.flushTimer)\n }\n this.flushTimer = setInterval(() => {\n this.flush().catch(error => {\n console.warn('OpenTelemetry flush error:', error?.message || String(error))\n })\n }, this.flushInterval)\n }\n\n log(logObj) {\n try {\n const logRecord = this.createLogRecord(logObj)\n this.buffer.push(logRecord)\n\n // Відправляємо одразу, якщо буфер досяг максимального розміру\n if (this.buffer.length >= this.batchSize) {\n this.flush().catch(error => {\n console.warn('OpenTelemetry flush error:', error?.message || String(error))\n })\n }\n } catch (error) {\n // Тихо ігноруємо помилки\n console.warn('OpenTelemetry log processing error:', error?.message || String(error))\n }\n }\n\n destroy() {\n if (this.flushTimer) {\n clearInterval(this.flushTimer)\n this.flushTimer = null\n }\n // Відправляємо залишкові логи перед знищенням\n return this.flush()\n }\n}\n\n/**\n * Створює OpenTelemetry репортер для експорту логів до OpenTelemetry Collector\n *\n * @param {Object} options - Опції репортера\n * @param {String} options.endpoint - URL endpoint OpenTelemetry Collector (за замовчуванням: http://localhost:4318/v1/logs)\n * @param {String} options.serviceName - Ім'я сервісу (за замовчуванням: consola-service)\n * @param {String} options.serviceVersion - Версія сервісу (за замовчуванням: 1.0.0)\n * @param {Number} options.batchSize - Розмір батча для відправки (за замовчуванням: 10)\n * @param {Number} options.flushInterval - Інтервал автоматичної відправки в мс (за замовчуванням: 5000)\n * @param {Object} options.headers - Додаткові HTTP заголовки\n * @returns {OpenTelemetryReporter} Екземпляр OpenTelemetry репортера\n *\n * @example\n * import { createOpenTelemetryReporter } from '@nitra/consola'\n * const otelReporter = createOpenTelemetryReporter({\n * endpoint: 'http://localhost:4318/v1/logs',\n * serviceName: 'my-app',\n * serviceVersion: '1.0.0'\n * })\n * consola.addReporter(otelReporter)\n */\nexport const createOpenTelemetryReporter = (options = {}) => {\n return new OpenTelemetryReporter(options)\n}\n","/* global location, process, import */\nimport { consola } from 'consola'\nimport { OpenTelemetryReporter } from './otel-reporter.js'\n\nconst options = {}\n\n// Vite Debug mode\nif (typeof __CONSOLA_LEVEL_DEBUG__ !== 'undefined') {\n options.level = 4\n} else if (typeof location !== 'undefined' && location.protocol === 'http:') {\n options.level = 4\n} else if (typeof process !== 'undefined' && (process.env.DEV || process.env.CONSOLA_LEVEL_DEBUG)) {\n // Quasar Debug mode\n options.level = 4\n}\n\n// HTML Popup Reporter — дублювання повідомлень у вигляді спливаючих блоків (без canvas)\nconst POPUP_PADDING = 12\nconst POPUP_LABEL_PADDING = 8\nconst POPUP_LINE_HEIGHT = 20\nconst POPUP_BUTTON_SIZE = 18\nconst POPUP_BUTTON_PADDING = 6\nconst POPUP_MIN_HEIGHT = 36\nconst POPUP_MAX_MESSAGE_LENGTH = 500\n\nconst POPUP_STYLES = `\n#consola-popup-container { position: fixed; inset: 0; pointer-events: none; z-index: 999999; }\n.consola-popup { pointer-events: auto; position: fixed; left: 20px; max-width: calc(100vw - 40px); min-height: ${POPUP_MIN_HEIGHT}px;\n display: flex; align-items: stretch; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border: 1px solid #e0e0e0;\n font: 13px -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif; }\n.consola-popup-label { flex-shrink: 0; padding: 0 ${POPUP_LABEL_PADDING}px; display: flex; align-items: center; justify-content: center;\n color: #fff; font: 11px monospace; font-weight: bold; text-transform: lowercase; }\n.consola-popup-content { flex: 1; min-width: 0; padding: ${POPUP_PADDING}px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; }\n.consola-popup-text { flex: 1 1 auto; min-width: 0; color: #212121; line-height: ${POPUP_LINE_HEIGHT}px; white-space: pre-wrap; word-break: break-word; }\n.consola-popup-filelink { flex: 0 0 auto; color: #1976D2; font: 11px monospace; text-decoration: underline; cursor: pointer; }\n.consola-popup-filelink:hover { text-decoration: underline; }\n.consola-popup-close { flex-shrink: 0; width: ${POPUP_BUTTON_SIZE}px; height: ${POPUP_BUTTON_SIZE}px; margin: ${POPUP_BUTTON_PADDING}px; padding: 0; border: none; background: transparent;\n color: #999; font-size: 16px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 2px; }\n.consola-popup-close:hover { background: rgba(0,0,0,0.06); color: #666; }\n`\n\nclass HtmlPopupReporter {\n constructor() {\n this.container = null\n this.messages = []\n this.messageId = 0\n this.init()\n }\n\n init() {\n if (typeof document === 'undefined') return\n\n const doInit = () => {\n if (!document.body) {\n setTimeout(doInit, 10)\n return\n }\n\n let container = document.querySelector('#consola-popup-container')\n if (!container) {\n const style = document.createElement('style')\n style.textContent = POPUP_STYLES\n document.head.append(style)\n container = document.createElement('div')\n container.id = 'consola-popup-container'\n document.body.append(container)\n }\n\n this.container = container\n this.animate()\n }\n\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', doInit)\n } else {\n doInit()\n }\n }\n\n getColorForType(type) {\n const colors = {\n trace: '#9E9E9E',\n debug: '#607D8B',\n info: '#2196F3',\n log: '#2196F3',\n warn: '#FFC107',\n error: '#D32F2F',\n fatal: '#7B1FA2',\n success: '#4CAF50',\n start: '#00BCD4',\n box: '#9E9E9E',\n ready: '#4CAF50',\n fail: '#D32F2F'\n }\n return colors[type] || colors.log || '#616161'\n }\n\n getTypeLabel(type) {\n return type || 'log'\n }\n\n getFileInfo() {\n try {\n const stack = new Error('Stack trace').stack\n if (!stack) return null\n\n const skipPatterns = ['HtmlPopupReporter', 'CanvasPopupReporter', 'browser.js', 'consola', 'createLogger']\n const lines = stack.split('\\n').slice(4, 15)\n\n for (const line of lines) {\n const trimmed = line.trim()\n const shouldSkip = skipPatterns.some(pattern => trimmed.includes(pattern))\n\n if (!shouldSkip) {\n const match =\n trimmed.match(/\\(?([^()]+):(\\d+):(\\d+)\\)?/) || trimmed.match(/at\\s+[^(]*\\(?([^:]+):(\\d+):(\\d+)\\)?/)\n\n if (match) {\n let file = match[1].trim()\n const lineNum = match[2]\n\n // Очищаємо ім'я файлу\n if (file.includes('://')) {\n file = file.slice(file.indexOf('://') + 3).slice(file.indexOf('/'))\n }\n if (file.includes('/src/')) {\n file = file.slice(file.indexOf('/src/') + 5)\n }\n const queryIndex = file.indexOf('?')\n if (queryIndex > 0) file = file.slice(0, queryIndex)\n const hashIndex = file.indexOf('#')\n if (hashIndex > 0) file = file.slice(0, hashIndex)\n if (file.startsWith('/')) file = file.slice(1)\n\n if (file && lineNum) {\n return { file, line: parseInt(lineNum, 10), column: parseInt(match[3], 10), fullPath: match[0] }\n }\n }\n }\n }\n } catch {\n // Ігноруємо помилки\n }\n return null\n }\n\n formatMessage(logObj) {\n const args = logObj.args || []\n if (args.length === 0) return ''\n\n const message = args\n .map(arg => {\n if (arg instanceof Error) {\n let msg = `${arg.name || 'Error'}: ${arg.message || ''}`\n if (arg.stack && arg.stack !== arg.message) {\n msg += '\\n' + arg.stack.split('\\n').slice(0, 3).join('\\n')\n }\n return msg\n }\n if (arg === null) return 'null'\n if (arg === undefined) return 'undefined'\n if (typeof arg === 'object') {\n try {\n const str = arg.toString?.()\n if (str && str !== '[object Object]') return str\n return JSON.stringify(arg, null, 2)\n } catch {\n return String(arg)\n }\n }\n return String(arg)\n })\n .join(' ')\n\n return message.length > POPUP_MAX_MESSAGE_LENGTH ? message.slice(0, POPUP_MAX_MESSAGE_LENGTH) + '...' : message\n }\n\n log(logObj) {\n if (!this.container) return\n\n const text = this.formatMessage(logObj)\n if (!text) return\n\n const type = logObj.type || 'log'\n const color = this.getColorForType(type)\n const typeLabel = this.getTypeLabel(type)\n const id = this.messageId++\n const fileInfo = this.getFileInfo()\n\n const popup = document.createElement('div')\n popup.className = 'consola-popup'\n popup.dataset.id = String(id)\n popup.style.bottom = `${window.innerHeight}px`\n popup.style.backgroundColor = '#fff'\n\n const label = document.createElement('span')\n label.className = 'consola-popup-label'\n label.style.backgroundColor = color\n label.textContent = typeLabel\n\n const content = document.createElement('div')\n content.className = 'consola-popup-content'\n\n const textEl = document.createElement('div')\n textEl.className = 'consola-popup-text'\n textEl.textContent = text\n\n content.append(textEl)\n\n if (fileInfo) {\n const fileLink = document.createElement('span')\n fileLink.className = 'consola-popup-filelink'\n fileLink.textContent = `${fileInfo.file}:${fileInfo.line}`\n fileLink.role = 'button'\n fileLink.tabIndex = 0\n fileLink.addEventListener('click', e => {\n e.preventDefault()\n console.log(`%c${fileInfo.file}:${fileInfo.line}`, 'color: #1976D2; text-decoration: underline;')\n })\n content.append(fileLink)\n }\n\n const closeBtn = document.createElement('button')\n closeBtn.type = 'button'\n closeBtn.className = 'consola-popup-close'\n closeBtn.setAttribute('aria-label', 'Close')\n closeBtn.textContent = '×'\n closeBtn.addEventListener('click', () => {\n const idx = this.messages.findIndex(m => m.id === id)\n if (idx !== -1) {\n const entry = this.messages[idx]\n if (entry.el && entry.el.parentNode) entry.el.remove()\n this.messages.splice(idx, 1)\n }\n })\n\n popup.append(label, content, closeBtn)\n this.container.append(popup)\n\n const height = popup.offsetHeight\n this.messages.push({\n id,\n el: popup,\n targetBottom: 20,\n currentBottom: window.innerHeight,\n height\n })\n }\n\n animate() {\n if (!this.container) return\n\n let offset = 20\n for (let i = this.messages.length - 1; i >= 0; i--) {\n const msg = this.messages[i]\n if (msg.el && msg.el.parentNode) {\n const h = msg.el.offsetHeight\n msg.height = h\n msg.targetBottom = offset\n msg.currentBottom += (msg.targetBottom - msg.currentBottom) * 0.1\n msg.el.style.bottom = `${Math.round(msg.currentBottom)}px`\n offset += h + 10\n }\n }\n\n requestAnimationFrame(() => this.animate())\n }\n}\n\n// Отримання змінних середовища з Vite (import.meta.env)\nconst getViteEnvVar = name => {\n try {\n // eslint-disable-next-line no-undef\n const viteName = `VITE_${name}`\n // eslint-disable-next-line no-undef\n return import.meta?.env?.[viteName]\n } catch {\n return null\n }\n}\n\n// Перевіряємо змінну середовища VITE_CONSOLA_POPUP_DEBUG\nlet isPopupDebugEnabled = false\n\n// Vite замінює import.meta.env.VITE_* під час збірки\n// Використовуємо прямий доступ до import.meta.env, оскільки Vite обробляє це під час збірки\nif (typeof document !== 'undefined') {\n try {\n // Vite замінює цей код під час збірки\n // eslint-disable-next-line no-undef\n const envValue = import.meta.env?.VITE_CONSOLA_POPUP_DEBUG\n if (envValue !== undefined && envValue !== null && envValue !== '') {\n // Vite завжди повертає рядки для змінних середовища\n isPopupDebugEnabled = String(envValue).toLowerCase() === 'true' || envValue === true\n }\n } catch {\n // Ігноруємо помилки, якщо import.meta недоступний\n }\n}\n\nif (!isPopupDebugEnabled && typeof process !== 'undefined' && process.env) {\n const processValue = process.env.VITE_CONSOLA_POPUP_DEBUG\n if (processValue) {\n isPopupDebugEnabled = String(processValue).toLowerCase() === 'true'\n }\n}\n\n// Створюємо один екземпляр репортера, якщо потрібно\n// НЕ встановлюємо options.reporters, щоб стандартний BrowserReporter працював\n// Додаємо наш репортер після створення екземпляра через addReporter\nlet htmlPopupReporter = null\nif (isPopupDebugEnabled && typeof document !== 'undefined') {\n htmlPopupReporter = new HtmlPopupReporter()\n}\n\nconst defaultConsola = consola.create(options)\n\n// Додаємо HTML репортер до default екземпляра, якщо потрібно (не замінює стандартний)\nif (isPopupDebugEnabled && typeof document !== 'undefined' && htmlPopupReporter) {\n defaultConsola.addReporter(htmlPopupReporter)\n}\n\n// Перевіряємо змінні середовища Vite для OpenTelemetry експорту\nlet openTelemetryReporter = null\nconst otelEndpoint = getViteEnvVar('OTEL_EXPORTER_OTLP_LOGS_ENDPOINT')\n\nif (otelEndpoint) {\n openTelemetryReporter = new OpenTelemetryReporter()\n defaultConsola.addReporter(openTelemetryReporter)\n}\n\nexport default defaultConsola\n\n// Експортуємо consola з нашими опціями, а не базовий\nexport { defaultConsola as consola }\n\n// Експортуємо OpenTelemetryReporter та createOpenTelemetryReporter для прямого використання\nexport { createOpenTelemetryReporter, OpenTelemetryReporter } from './otel-reporter.js'\n\n/**\n * pass import.meta.url\n * example: const consola = createLogger(import.meta.url)\n *\n * @param {String} _url - The import.meta.url or file URL to use for logger creation\n * @returns {Consola} A consola logger instance\n */\nexport const createLogger = _url => {\n return defaultConsola\n}\n","/// <reference path=\"./web-serial.d.ts\" />\nimport { WebPlugin } from '@capacitor/core'\nimport { consola } from '@nitra/consola'\n\nexport class ZebraWeb extends WebPlugin {\n async print({ zpl }) {\n try {\n consola.debug('Запит на підключення до принтера...', 'info')\n\n // Запитуємо порт (Web Serial API)\n const serial = navigator.serial\n if (!serial) throw new Error('Web Serial API не підтримується в цьому браузері')\n const port = await serial.requestPort()\n consola.debug(\"Порт вибрано, відкриваємо з'єднання...\", 'info')\n\n // Відкриваємо з'єднання з налаштуваннями для Zebra принтера\n await port.open({\n baudRate: 9600, // Можна спробувати 115200 якщо не працює\n dataBits: 8,\n parity: 'none',\n stopBits: 1,\n flowControl: 'none'\n })\n\n consola.debug(\"З'єднання відкрито!\", 'success')\n\n // Отримуємо writer для відправки даних\n const writer = port.writable.getWriter()\n\n // Оновлюємо стан\n consola.debug('Принтер готовий до друку', 'success')\n\n if (!port || !writer) {\n consola.debug('Помилка: Принтер не підключено', 'error')\n return\n }\n\n consola.debug(`Відправка ZPL команди: ${zpl.slice(0, 50)}...`, 'info')\n\n // Конвертуємо текст в Uint8Array\n const encoder = new TextEncoder()\n const data = encoder.encode(zpl)\n\n // Відправляємо дані\n await writer.write(data)\n\n // Чекаємо трохи для обробки принтером\n // await new Promise(resolve => setTimeout(resolve, 500))\n\n consola.debug(`✓ Команда відправлена (${data.length} байт)`, 'success')\n consola.debug('print from web capacitor plugin', zpl)\n return {\n success: true\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n consola.debug(`Помилка підключення: ${message}`, 'error')\n\n // Спробуємо перепідключитися\n // await disconnect()\n throw error\n }\n }\n\n getPairedDevices() {\n return {\n devices: [\n { address: '00:00:00:00:00:00', name: 'Virtual Printer' },\n { address: '11:11:11:11:11:11', name: 'Virtual Headphone' }\n ]\n }\n }\n}\n","import { registerPlugin } from '@capacitor/core'\nimport { Preferences } from '@capacitor/preferences'\nimport { normalizePrintArg } from './utils/validate.js'\n\nconst ZebraPlugin = registerPlugin('Zebra', {\n web: () => import('./web.js').then(m => new m.ZebraWeb())\n})\n\nconst Zebra = {\n /**\n * Приймає лише zpl як рядок; address для нативних платформ береться з Preferences (після setPrinterAddress або вибору пристрою).\n * @param {string} zpl - ZPL-рядок для друку\n * @returns {Promise<{success?: boolean, devices?: Array<{address: string, name: string}>, message?: string}>} Результат друку або список пристроїв\n */\n async print(zpl) {\n const zplNormalized = normalizePrintArg(zpl)\n\n const { value: address } = await Preferences.get({ key: 'printer_address' })\n const addressTrimmed = typeof address === 'string' ? address.trim() : ''\n if (!addressTrimmed) {\n const { devices } = await ZebraPlugin.getPairedDevices()\n if (devices?.length > 0) {\n return { success: false, message: 'device list', devices }\n }\n return { success: false, message: 'No paired devices found' }\n }\n return ZebraPlugin.print({ zpl: zplNormalized, address: addressTrimmed })\n },\n getPairedDevices() {\n return ZebraPlugin.getPairedDevices()\n }\n}\n\nexport { Zebra }\n"],"x_google_ignoreList":[0,1,3,4,5,6],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CACa,iBAAb,cAAoC,UAAU;EAC1C,cAAc;AACV,SAAM,GAAG,UAAU;AACnB,QAAK,QAAQ;;EAEjB,MAAM,UAAU,EAAE,SAAS;AACvB,OAAI,OAAO,UAAU,SACjB,MAAK,QAAQ;;EAGrB,MAAM,IAAI,SAAS;AAEf,UAAO,EAAE,OADK,KAAK,KAAK,QAAQ,KAAK,YAAY,QAAQ,IAAI,CAAC,EAC9C;;EAEpB,MAAM,IAAI,SAAS;AACf,QAAK,KAAK,QAAQ,KAAK,YAAY,QAAQ,IAAI,EAAE,QAAQ,MAAM;;EAEnE,MAAM,OAAO,SAAS;AAClB,QAAK,KAAK,WAAW,KAAK,YAAY,QAAQ,IAAI,CAAC;;EAEvD,MAAM,OAAO;AAET,UAAO,EAAE,MADI,KAAK,SAAS,CAAC,KAAI,MAAK,EAAE,UAAU,KAAK,OAAO,OAAO,CAAC,EACtD;;EAEnB,MAAM,QAAQ;AACV,QAAK,MAAM,OAAO,KAAK,SAAS,CAC5B,MAAK,KAAK,WAAW,IAAI;;EAGjC,MAAM,UAAU;GACZ,IAAI;GACJ,MAAM,WAAW,EAAE;GACnB,MAAM,WAAW,EAAE;GACnB,MAAM,YAAY;GAClB,MAAM,OAAO,OAAO,KA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B;GACnB,MAAM,EAAE,YAAY,MAAM,YAAY,kBAAkB;AACxD,OAAI,SAAS,SAAS,EACpB,QAAO;IAAE,SAAS;IAAO,SAAS;IAAe;IAAS;AAE5D,UAAO;IAAE,SAAS;IAAO,SAAS;IAA2B;;AAE/D,SAAO,YAAY,MAAM;GAAE,KAAK;GAAe,SAAS;GAAgB,CAAC;;CAE3E,mBAAmB;AACjB,SAAO,YAAY,kBAAkB;;CAExC"}
|
|
1
|
+
{"version":3,"file":"plugin.js","names":["createConsola","getViteEnvVar"],"sources":["../../node_modules/.bun/@capacitor+preferences@8.0.0+2476a4e6bb24aa03/node_modules/@capacitor/preferences/dist/esm/web.js","../../node_modules/.bun/@capacitor+preferences@8.0.0+2476a4e6bb24aa03/node_modules/@capacitor/preferences/dist/esm/index.js","../src/utils/validate.js","../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/core.mjs","../../node_modules/.bun/consola@3.4.2/node_modules/consola/dist/browser.mjs","../../node_modules/.bun/@nitra+consola@2.4.1/node_modules/@nitra/consola/src/otel-reporter.js","../../node_modules/.bun/@nitra+consola@2.4.1/node_modules/@nitra/consola/src/browser.js","../src/web.js","../src/index.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nexport class PreferencesWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.group = 'CapacitorStorage';\n }\n async configure({ group }) {\n if (typeof group === 'string') {\n this.group = group;\n }\n }\n async get(options) {\n const value = this.impl.getItem(this.applyPrefix(options.key));\n return { value };\n }\n async set(options) {\n this.impl.setItem(this.applyPrefix(options.key), options.value);\n }\n async remove(options) {\n this.impl.removeItem(this.applyPrefix(options.key));\n }\n async keys() {\n const keys = this.rawKeys().map((k) => k.substring(this.prefix.length));\n return { keys };\n }\n async clear() {\n for (const key of this.rawKeys()) {\n this.impl.removeItem(key);\n }\n }\n async migrate() {\n var _a;\n const migrated = [];\n const existing = [];\n const oldprefix = '_cap_';\n const keys = Object.keys(this.impl).filter((k) => k.indexOf(oldprefix) === 0);\n for (const oldkey of keys) {\n const key = oldkey.substring(oldprefix.length);\n const value = (_a = this.impl.getItem(oldkey)) !== null && _a !== void 0 ? _a : '';\n const { value: currentValue } = await this.get({ key });\n if (typeof currentValue === 'string') {\n existing.push(key);\n }\n else {\n await this.set({ key, value });\n migrated.push(key);\n }\n }\n return { migrated, existing };\n }\n async removeOld() {\n const oldprefix = '_cap_';\n const keys = Object.keys(this.impl).filter((k) => k.indexOf(oldprefix) === 0);\n for (const oldkey of keys) {\n this.impl.removeItem(oldkey);\n }\n }\n get impl() {\n return window.localStorage;\n }\n get prefix() {\n return this.group === 'NativeStorage' ? '' : `${this.group}.`;\n }\n rawKeys() {\n return Object.keys(this.impl).filter((k) => k.indexOf(this.prefix) === 0);\n }\n applyPrefix(key) {\n return this.prefix + key;\n }\n}\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nconst Preferences = registerPlugin('Preferences', {\n web: () => import('./web').then((m) => new m.PreferencesWeb()),\n});\nexport * from './definitions';\nexport { Preferences };\n//# sourceMappingURL=index.js.map","/**\n * Нормалізує аргумент ZPL для друку: перевіряє рядок і повертає обрізану команду.\n * @param {string} zpl - рядок ZPL-команд\n * @returns {string} обрізаний рядок ZPL\n * @throws {TypeError} якщо zpl не рядок\n * @throws {Error} якщо команда порожня\n */\nexport function normalizePrintArg(zpl) {\n if (typeof zpl !== 'string') {\n throw new TypeError('Expected \"zpl\" to be a string')\n }\n\n const command = zpl.trim()\n if (!command) {\n throw new Error('ZPL команда порожня')\n }\n\n return command\n}\n","const LogLevels = {\n silent: Number.NEGATIVE_INFINITY,\n fatal: 0,\n error: 0,\n warn: 1,\n log: 2,\n info: 3,\n success: 3,\n fail: 3,\n ready: 3,\n start: 3,\n box: 3,\n debug: 4,\n trace: 5,\n verbose: Number.POSITIVE_INFINITY\n};\nconst LogTypes = {\n // Silent\n silent: {\n level: -1\n },\n // Level 0\n fatal: {\n level: LogLevels.fatal\n },\n error: {\n level: LogLevels.error\n },\n // Level 1\n warn: {\n level: LogLevels.warn\n },\n // Level 2\n log: {\n level: LogLevels.log\n },\n // Level 3\n info: {\n level: LogLevels.info\n },\n success: {\n level: LogLevels.success\n },\n fail: {\n level: LogLevels.fail\n },\n ready: {\n level: LogLevels.info\n },\n start: {\n level: LogLevels.info\n },\n box: {\n level: LogLevels.info\n },\n // Level 4\n debug: {\n level: LogLevels.debug\n },\n // Level 5\n trace: {\n level: LogLevels.trace\n },\n // Verbose\n verbose: {\n level: LogLevels.verbose\n }\n};\n\nfunction isPlainObject$1(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {\n return false;\n }\n if (Symbol.iterator in value) {\n return false;\n }\n if (Symbol.toStringTag in value) {\n return Object.prototype.toString.call(value) === \"[object Module]\";\n }\n return true;\n}\n\nfunction _defu(baseObject, defaults, namespace = \".\", merger) {\n if (!isPlainObject$1(defaults)) {\n return _defu(baseObject, {}, namespace, merger);\n }\n const object = Object.assign({}, defaults);\n for (const key in baseObject) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue;\n }\n const value = baseObject[key];\n if (value === null || value === void 0) {\n continue;\n }\n if (merger && merger(object, key, value, namespace)) {\n continue;\n }\n if (Array.isArray(value) && Array.isArray(object[key])) {\n object[key] = [...value, ...object[key]];\n } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {\n object[key] = _defu(\n value,\n object[key],\n (namespace ? `${namespace}.` : \"\") + key.toString(),\n merger\n );\n } else {\n object[key] = value;\n }\n }\n return object;\n}\nfunction createDefu(merger) {\n return (...arguments_) => (\n // eslint-disable-next-line unicorn/no-array-reduce\n arguments_.reduce((p, c) => _defu(p, c, \"\", merger), {})\n );\n}\nconst defu = createDefu();\n\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === \"[object Object]\";\n}\nfunction isLogObj(arg) {\n if (!isPlainObject(arg)) {\n return false;\n }\n if (!arg.message && !arg.args) {\n return false;\n }\n if (arg.stack) {\n return false;\n }\n return true;\n}\n\nlet paused = false;\nconst queue = [];\nclass Consola {\n options;\n _lastLog;\n _mockFn;\n /**\n * Creates an instance of Consola with specified options or defaults.\n *\n * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.\n */\n constructor(options = {}) {\n const types = options.types || LogTypes;\n this.options = defu(\n {\n ...options,\n defaults: { ...options.defaults },\n level: _normalizeLogLevel(options.level, types),\n reporters: [...options.reporters || []]\n },\n {\n types: LogTypes,\n throttle: 1e3,\n throttleMin: 5,\n formatOptions: {\n date: true,\n colors: false,\n compact: true\n }\n }\n );\n for (const type in types) {\n const defaults = {\n type,\n ...this.options.defaults,\n ...types[type]\n };\n this[type] = this._wrapLogFn(defaults);\n this[type].raw = this._wrapLogFn(\n defaults,\n true\n );\n }\n if (this.options.mockFn) {\n this.mockTypes();\n }\n this._lastLog = {};\n }\n /**\n * Gets the current log level of the Consola instance.\n *\n * @returns {number} The current log level.\n */\n get level() {\n return this.options.level;\n }\n /**\n * Sets the minimum log level that will be output by the instance.\n *\n * @param {number} level - The new log level to set.\n */\n set level(level) {\n this.options.level = _normalizeLogLevel(\n level,\n this.options.types,\n this.options.level\n );\n }\n /**\n * Displays a prompt to the user and returns the response.\n * Throw an error if `prompt` is not supported by the current configuration.\n *\n * @template T\n * @param {string} message - The message to display in the prompt.\n * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.\n * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.\n */\n prompt(message, opts) {\n if (!this.options.prompt) {\n throw new Error(\"prompt is not supported!\");\n }\n return this.options.prompt(message, opts);\n }\n /**\n * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.\n *\n * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.\n * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n */\n create(options) {\n const instance = new Consola({\n ...this.options,\n ...options\n });\n if (this._mockFn) {\n instance.mockTypes(this._mockFn);\n }\n return instance;\n }\n /**\n * Creates a new Consola instance with the specified default log object properties.\n *\n * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.\n * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n */\n withDefaults(defaults) {\n return this.create({\n ...this.options,\n defaults: {\n ...this.options.defaults,\n ...defaults\n }\n });\n }\n /**\n * Creates a new Consola instance with a specified tag, which will be included in every log.\n *\n * @param {string} tag - The tag to include in each log of the new instance.\n * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.\n */\n withTag(tag) {\n return this.withDefaults({\n tag: this.options.defaults.tag ? this.options.defaults.tag + \":\" + tag : tag\n });\n }\n /**\n * Adds a custom reporter to the Consola instance.\n * Reporters will be called for each log message, depending on their implementation and log level.\n *\n * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.\n * @returns {Consola} The current Consola instance.\n */\n addReporter(reporter) {\n this.options.reporters.push(reporter);\n return this;\n }\n /**\n * Removes a custom reporter from the Consola instance.\n * If no reporter is specified, all reporters will be removed.\n *\n * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.\n * @returns {Consola} The current Consola instance.\n */\n removeReporter(reporter) {\n if (reporter) {\n const i = this.options.reporters.indexOf(reporter);\n if (i !== -1) {\n return this.options.reporters.splice(i, 1);\n }\n } else {\n this.options.reporters.splice(0);\n }\n return this;\n }\n /**\n * Replaces all reporters of the Consola instance with the specified array of reporters.\n *\n * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.\n * @returns {Consola} The current Consola instance.\n */\n setReporters(reporters) {\n this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];\n return this;\n }\n wrapAll() {\n this.wrapConsole();\n this.wrapStd();\n }\n restoreAll() {\n this.restoreConsole();\n this.restoreStd();\n }\n /**\n * Overrides console methods with Consola logging methods for consistent logging.\n */\n wrapConsole() {\n for (const type in this.options.types) {\n if (!console[\"__\" + type]) {\n console[\"__\" + type] = console[type];\n }\n console[type] = this[type].raw;\n }\n }\n /**\n * Restores the original console methods, removing Consola overrides.\n */\n restoreConsole() {\n for (const type in this.options.types) {\n if (console[\"__\" + type]) {\n console[type] = console[\"__\" + type];\n delete console[\"__\" + type];\n }\n }\n }\n /**\n * Overrides standard output and error streams to redirect them through Consola.\n */\n wrapStd() {\n this._wrapStream(this.options.stdout, \"log\");\n this._wrapStream(this.options.stderr, \"log\");\n }\n _wrapStream(stream, type) {\n if (!stream) {\n return;\n }\n if (!stream.__write) {\n stream.__write = stream.write;\n }\n stream.write = (data) => {\n this[type].raw(String(data).trim());\n };\n }\n /**\n * Restores the original standard output and error streams, removing the Consola redirection.\n */\n restoreStd() {\n this._restoreStream(this.options.stdout);\n this._restoreStream(this.options.stderr);\n }\n _restoreStream(stream) {\n if (!stream) {\n return;\n }\n if (stream.__write) {\n stream.write = stream.__write;\n delete stream.__write;\n }\n }\n /**\n * Pauses logging, queues incoming logs until resumed.\n */\n pauseLogs() {\n paused = true;\n }\n /**\n * Resumes logging, processing any queued logs.\n */\n resumeLogs() {\n paused = false;\n const _queue = queue.splice(0);\n for (const item of _queue) {\n item[0]._logFn(item[1], item[2]);\n }\n }\n /**\n * Replaces logging methods with mocks if a mock function is provided.\n *\n * @param {ConsolaOptions[\"mockFn\"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions[\"mockFn\"]}.\n */\n mockTypes(mockFn) {\n const _mockFn = mockFn || this.options.mockFn;\n this._mockFn = _mockFn;\n if (typeof _mockFn !== \"function\") {\n return;\n }\n for (const type in this.options.types) {\n this[type] = _mockFn(type, this.options.types[type]) || this[type];\n this[type].raw = this[type];\n }\n }\n _wrapLogFn(defaults, isRaw) {\n return (...args) => {\n if (paused) {\n queue.push([this, defaults, args, isRaw]);\n return;\n }\n return this._logFn(defaults, args, isRaw);\n };\n }\n _logFn(defaults, args, isRaw) {\n if ((defaults.level || 0) > this.level) {\n return false;\n }\n const logObj = {\n date: /* @__PURE__ */ new Date(),\n args: [],\n ...defaults,\n level: _normalizeLogLevel(defaults.level, this.options.types)\n };\n if (!isRaw && args.length === 1 && isLogObj(args[0])) {\n Object.assign(logObj, args[0]);\n } else {\n logObj.args = [...args];\n }\n if (logObj.message) {\n logObj.args.unshift(logObj.message);\n delete logObj.message;\n }\n if (logObj.additional) {\n if (!Array.isArray(logObj.additional)) {\n logObj.additional = logObj.additional.split(\"\\n\");\n }\n logObj.args.push(\"\\n\" + logObj.additional.join(\"\\n\"));\n delete logObj.additional;\n }\n logObj.type = typeof logObj.type === \"string\" ? logObj.type.toLowerCase() : \"log\";\n logObj.tag = typeof logObj.tag === \"string\" ? logObj.tag : \"\";\n const resolveLog = (newLog = false) => {\n const repeated = (this._lastLog.count || 0) - this.options.throttleMin;\n if (this._lastLog.object && repeated > 0) {\n const args2 = [...this._lastLog.object.args];\n if (repeated > 1) {\n args2.push(`(repeated ${repeated} times)`);\n }\n this._log({ ...this._lastLog.object, args: args2 });\n this._lastLog.count = 1;\n }\n if (newLog) {\n this._lastLog.object = logObj;\n this._log(logObj);\n }\n };\n clearTimeout(this._lastLog.timeout);\n const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;\n this._lastLog.time = logObj.date;\n if (diffTime < this.options.throttle) {\n try {\n const serializedLog = JSON.stringify([\n logObj.type,\n logObj.tag,\n logObj.args\n ]);\n const isSameLog = this._lastLog.serialized === serializedLog;\n this._lastLog.serialized = serializedLog;\n if (isSameLog) {\n this._lastLog.count = (this._lastLog.count || 0) + 1;\n if (this._lastLog.count > this.options.throttleMin) {\n this._lastLog.timeout = setTimeout(\n resolveLog,\n this.options.throttle\n );\n return;\n }\n }\n } catch {\n }\n }\n resolveLog(true);\n }\n _log(logObj) {\n for (const reporter of this.options.reporters) {\n reporter.log(logObj, {\n options: this.options\n });\n }\n }\n}\nfunction _normalizeLogLevel(input, types = {}, defaultLevel = 3) {\n if (input === void 0) {\n return defaultLevel;\n }\n if (typeof input === \"number\") {\n return input;\n }\n if (types[input] && types[input].level !== void 0) {\n return types[input].level;\n }\n return defaultLevel;\n}\nConsola.prototype.add = Consola.prototype.addReporter;\nConsola.prototype.remove = Consola.prototype.removeReporter;\nConsola.prototype.clear = Consola.prototype.removeReporter;\nConsola.prototype.withScope = Consola.prototype.withTag;\nConsola.prototype.mock = Consola.prototype.mockTypes;\nConsola.prototype.pause = Consola.prototype.pauseLogs;\nConsola.prototype.resume = Consola.prototype.resumeLogs;\nfunction createConsola(options = {}) {\n return new Consola(options);\n}\n\nexport { Consola, LogLevels, LogTypes, createConsola };\n","import { createConsola as createConsola$1 } from './core.mjs';\nexport { Consola, LogLevels, LogTypes } from './core.mjs';\n\nclass BrowserReporter {\n options;\n defaultColor;\n levelColorMap;\n typeColorMap;\n constructor(options) {\n this.options = { ...options };\n this.defaultColor = \"#7f8c8d\";\n this.levelColorMap = {\n 0: \"#c0392b\",\n // Red\n 1: \"#f39c12\",\n // Yellow\n 3: \"#00BCD4\"\n // Cyan\n };\n this.typeColorMap = {\n success: \"#2ecc71\"\n // Green\n };\n }\n _getLogFn(level) {\n if (level < 1) {\n return console.__error || console.error;\n }\n if (level === 1) {\n return console.__warn || console.warn;\n }\n return console.__log || console.log;\n }\n log(logObj) {\n const consoleLogFn = this._getLogFn(logObj.level);\n const type = logObj.type === \"log\" ? \"\" : logObj.type;\n const tag = logObj.tag || \"\";\n const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;\n const style = `\n background: ${color};\n border-radius: 0.5em;\n color: white;\n font-weight: bold;\n padding: 2px 0.5em;\n `;\n const badge = `%c${[tag, type].filter(Boolean).join(\":\")}`;\n if (typeof logObj.args[0] === \"string\") {\n consoleLogFn(\n `${badge}%c ${logObj.args[0]}`,\n style,\n // Empty string as style resets to default console style\n \"\",\n ...logObj.args.slice(1)\n );\n } else {\n consoleLogFn(badge, style, ...logObj.args);\n }\n }\n}\n\nfunction createConsola(options = {}) {\n const consola2 = createConsola$1({\n reporters: options.reporters || [new BrowserReporter({})],\n prompt(message, options2 = {}) {\n if (options2.type === \"confirm\") {\n return Promise.resolve(confirm(message));\n }\n return Promise.resolve(prompt(message));\n },\n ...options\n });\n return consola2;\n}\nconst consola = createConsola();\n\nexport { consola, createConsola, consola as default };\n","// Отримання змінних середовища з Vite (import.meta.env)\nconst getViteEnvVar = name => {\n try {\n // eslint-disable-next-line no-undef\n const viteName = `VITE_${name}`\n // eslint-disable-next-line no-undef\n return import.meta?.env?.[viteName]\n } catch {\n return null\n }\n}\n\n// OpenTelemetry Reporter для експорту логів до OpenTelemetry Collector через HTTP\nexport class OpenTelemetryReporter {\n constructor(options = {}) {\n this.endpoint =\n options.endpoint || getViteEnvVar('OTEL_EXPORTER_OTLP_LOGS_ENDPOINT') || 'http://localhost:4318/v1/logs'\n this.serviceName = options.serviceName || getViteEnvVar('OTEL_SERVICE_NAME') || 'consola-service'\n this.serviceVersion = options.serviceVersion || getViteEnvVar('OTEL_SERVICE_VERSION') || '1.0.0'\n this.batchSize = options.batchSize || parseInt(getViteEnvVar('OTEL_BATCH_SIZE') || '10', 10)\n this.flushInterval = options.flushInterval || parseInt(getViteEnvVar('OTEL_FLUSH_INTERVAL') || '5000', 10)\n this.buffer = []\n this.flushTimer = null\n this.headers = {\n 'Content-Type': 'application/json',\n ...options.headers\n }\n\n // Запускаємо таймер для періодичної відправки\n if (this.flushInterval > 0) {\n this.startFlushTimer()\n }\n }\n\n formatMessage(logObj) {\n const args = logObj.args || []\n if (args.length === 0) return ''\n\n return args\n .map(arg => {\n if (arg instanceof Error) {\n let msg = `${arg.name || 'Error'}: ${arg.message || ''}`\n if (arg.stack && arg.stack !== arg.message) {\n msg += '\\n' + arg.stack\n }\n return msg\n }\n if (arg === null) return 'null'\n if (arg === undefined) return 'undefined'\n if (typeof arg === 'object') {\n try {\n return JSON.stringify(arg, null, 2)\n } catch {\n return String(arg)\n }\n }\n return String(arg)\n })\n .join(' ')\n }\n\n getSeverityNumber(type) {\n // Маппінг типів consola до OpenTelemetry severity numbers\n const severityMap = {\n trace: 1, // TRACE\n debug: 5, // DEBUG\n info: 9, // INFO\n log: 9, // INFO\n warn: 13, // WARN\n error: 17, // ERROR\n fatal: 21, // FATAL\n success: 9, // INFO\n start: 9, // INFO\n ready: 9, // INFO\n fail: 17 // ERROR\n }\n return severityMap[type] || 9\n }\n\n getSeverityText(type) {\n const textMap = {\n trace: 'TRACE',\n debug: 'DEBUG',\n info: 'INFO',\n log: 'INFO',\n warn: 'WARN',\n error: 'ERROR',\n fatal: 'FATAL',\n success: 'INFO',\n start: 'INFO',\n ready: 'INFO',\n fail: 'ERROR'\n }\n return textMap[type] || 'INFO'\n }\n\n getFileInfo() {\n try {\n const stack = new Error('Stack trace').stack\n if (!stack) return null\n\n const skipPatterns = ['OpenTelemetryReporter', 'otel-reporter.js', 'browser.js', 'consola', 'createLogger']\n const lines = stack.split('\\n').slice(4, 15)\n\n for (const line of lines) {\n const trimmed = line.trim()\n const shouldSkip = skipPatterns.some(pattern => trimmed.includes(pattern))\n\n if (!shouldSkip) {\n const match =\n trimmed.match(/\\(?([^()]+):(\\d+):(\\d+)\\)?/) || trimmed.match(/at\\s+[^(]*\\(?([^:]+):(\\d+):(\\d+)\\)?/)\n\n if (match) {\n let file = match[1].trim()\n const lineNum = match[2]\n\n if (file.includes('://')) {\n file = file.slice(file.indexOf('://') + 3).slice(file.indexOf('/'))\n }\n if (file.includes('/src/')) {\n file = file.slice(file.indexOf('/src/') + 5)\n }\n const queryIndex = file.indexOf('?')\n if (queryIndex > 0) file = file.slice(0, queryIndex)\n const hashIndex = file.indexOf('#')\n if (hashIndex > 0) file = file.slice(0, hashIndex)\n if (file.startsWith('/')) file = file.slice(1)\n\n if (file && lineNum) {\n return { file, line: parseInt(lineNum, 10), column: parseInt(match[3], 10) }\n }\n }\n }\n }\n } catch {\n // Ігноруємо помилки\n }\n return null\n }\n\n createLogRecord(logObj) {\n const type = logObj.type || 'log'\n const message = this.formatMessage(logObj)\n const fileInfo = this.getFileInfo()\n const timestamp = Date.now() * 1000000 // наносекунди\n\n const logRecord = {\n timeUnixNano: timestamp.toString(),\n severityNumber: this.getSeverityNumber(type),\n severityText: this.getSeverityText(type),\n body: {\n stringValue: message\n },\n attributes: [\n {\n key: 'log.type',\n value: { stringValue: type }\n }\n ]\n }\n\n // Додаємо інформацію про файл, якщо доступна\n if (fileInfo) {\n logRecord.attributes.push(\n {\n key: 'code.filepath',\n value: { stringValue: fileInfo.file }\n },\n {\n key: 'code.lineno',\n value: { intValue: fileInfo.line }\n }\n )\n if (fileInfo.column) {\n logRecord.attributes.push({\n key: 'code.colno',\n value: { intValue: fileInfo.column }\n })\n }\n }\n\n // Додаємо додаткові атрибути з logObj, якщо вони є\n if (logObj.extra && typeof logObj.extra === 'object') {\n for (const [key, value] of Object.entries(logObj.extra)) {\n logRecord.attributes.push({\n key: `extra.${key}`,\n value: { stringValue: String(value) }\n })\n }\n }\n\n return logRecord\n }\n\n async sendLogs(logs) {\n if (logs.length === 0) return\n\n const resourceLogs = {\n resource: {\n attributes: [\n {\n key: 'service.name',\n value: { stringValue: this.serviceName }\n },\n {\n key: 'service.version',\n value: { stringValue: this.serviceVersion }\n }\n ]\n },\n scopeLogs: [\n {\n scope: {\n name: 'consola',\n version: '1.0.0'\n },\n logRecords: logs\n }\n ]\n }\n\n const payload = {\n resourceLogs: [resourceLogs]\n }\n\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n mode: 'cors',\n headers: this.headers,\n body: JSON.stringify(payload)\n })\n\n if (!response.ok) {\n console.warn(`OpenTelemetry export failed: ${response.status} ${response.statusText}`)\n }\n } catch (error) {\n // Тихо ігноруємо помилки, щоб не порушити роботу додатку\n console.warn('OpenTelemetry export error:', error?.message || String(error))\n }\n }\n\n async flush() {\n if (this.buffer.length === 0) return\n\n const logsToSend = [...this.buffer]\n this.buffer = []\n await this.sendLogs(logsToSend)\n }\n\n startFlushTimer() {\n if (this.flushTimer) {\n clearInterval(this.flushTimer)\n }\n this.flushTimer = setInterval(() => {\n this.flush().catch(error => {\n console.warn('OpenTelemetry flush error:', error?.message || String(error))\n })\n }, this.flushInterval)\n }\n\n log(logObj) {\n try {\n const logRecord = this.createLogRecord(logObj)\n this.buffer.push(logRecord)\n\n // Відправляємо одразу, якщо буфер досяг максимального розміру\n if (this.buffer.length >= this.batchSize) {\n this.flush().catch(error => {\n console.warn('OpenTelemetry flush error:', error?.message || String(error))\n })\n }\n } catch (error) {\n // Тихо ігноруємо помилки\n console.warn('OpenTelemetry log processing error:', error?.message || String(error))\n }\n }\n\n destroy() {\n if (this.flushTimer) {\n clearInterval(this.flushTimer)\n this.flushTimer = null\n }\n // Відправляємо залишкові логи перед знищенням\n return this.flush()\n }\n}\n\n/**\n * Створює OpenTelemetry репортер для експорту логів до OpenTelemetry Collector\n *\n * @param {Object} options - Опції репортера\n * @param {String} options.endpoint - URL endpoint OpenTelemetry Collector (за замовчуванням: http://localhost:4318/v1/logs)\n * @param {String} options.serviceName - Ім'я сервісу (за замовчуванням: consola-service)\n * @param {String} options.serviceVersion - Версія сервісу (за замовчуванням: 1.0.0)\n * @param {Number} options.batchSize - Розмір батча для відправки (за замовчуванням: 10)\n * @param {Number} options.flushInterval - Інтервал автоматичної відправки в мс (за замовчуванням: 5000)\n * @param {Object} options.headers - Додаткові HTTP заголовки\n * @returns {OpenTelemetryReporter} Екземпляр OpenTelemetry репортера\n *\n * @example\n * import { createOpenTelemetryReporter } from '@nitra/consola'\n * const otelReporter = createOpenTelemetryReporter({\n * endpoint: 'http://localhost:4318/v1/logs',\n * serviceName: 'my-app',\n * serviceVersion: '1.0.0'\n * })\n * consola.addReporter(otelReporter)\n */\nexport const createOpenTelemetryReporter = (options = {}) => {\n return new OpenTelemetryReporter(options)\n}\n","/* global location, process, import */\nimport { consola } from 'consola'\nimport { OpenTelemetryReporter } from './otel-reporter.js'\n\nconst options = {}\n\n// Vite Debug mode\nif (typeof __CONSOLA_LEVEL_DEBUG__ !== 'undefined') {\n options.level = 4\n} else if (typeof location !== 'undefined' && location.protocol === 'http:') {\n options.level = 4\n} else if (typeof process !== 'undefined' && (process.env.DEV || process.env.CONSOLA_LEVEL_DEBUG)) {\n // Quasar Debug mode\n options.level = 4\n}\n\n// HTML Popup Reporter — дублювання повідомлень у вигляді спливаючих блоків (без canvas)\nconst POPUP_PADDING = 12\nconst POPUP_LABEL_PADDING = 8\nconst POPUP_LINE_HEIGHT = 20\nconst POPUP_BUTTON_SIZE = 18\nconst POPUP_BUTTON_PADDING = 6\nconst POPUP_MIN_HEIGHT = 36\nconst POPUP_MAX_MESSAGE_LENGTH = 500\n\nconst POPUP_STYLES = `\n#consola-popup-container { position: fixed; inset: 0; pointer-events: none; z-index: 999999; }\n.consola-popup { pointer-events: auto; position: fixed; left: 20px; max-width: calc(100vw - 40px); min-height: ${POPUP_MIN_HEIGHT}px;\n display: flex; align-items: stretch; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border: 1px solid #e0e0e0;\n font: 13px -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif; }\n.consola-popup-label { flex-shrink: 0; padding: 0 ${POPUP_LABEL_PADDING}px; display: flex; align-items: center; justify-content: center;\n color: #fff; font: 11px monospace; font-weight: bold; text-transform: lowercase; }\n.consola-popup-content { flex: 1; min-width: 0; padding: ${POPUP_PADDING}px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; }\n.consola-popup-text { flex: 1 1 auto; min-width: 0; color: #212121; line-height: ${POPUP_LINE_HEIGHT}px; white-space: pre-wrap; word-break: break-word; }\n.consola-popup-filelink { flex: 0 0 auto; color: #1976D2; font: 11px monospace; text-decoration: underline; cursor: pointer; }\n.consola-popup-filelink:hover { text-decoration: underline; }\n.consola-popup-close { flex-shrink: 0; width: ${POPUP_BUTTON_SIZE}px; height: ${POPUP_BUTTON_SIZE}px; margin: ${POPUP_BUTTON_PADDING}px; padding: 0; border: none; background: transparent;\n color: #999; font-size: 16px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 2px; }\n.consola-popup-close:hover { background: rgba(0,0,0,0.06); color: #666; }\n`\n\nclass HtmlPopupReporter {\n constructor() {\n this.container = null\n this.messages = []\n this.messageId = 0\n this.init()\n }\n\n init() {\n if (typeof document === 'undefined') return\n\n const doInit = () => {\n if (!document.body) {\n setTimeout(doInit, 10)\n return\n }\n\n let container = document.querySelector('#consola-popup-container')\n if (!container) {\n const style = document.createElement('style')\n style.textContent = POPUP_STYLES\n document.head.append(style)\n container = document.createElement('div')\n container.id = 'consola-popup-container'\n document.body.append(container)\n }\n\n this.container = container\n this.animate()\n }\n\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', doInit)\n } else {\n doInit()\n }\n }\n\n getColorForType(type) {\n const colors = {\n trace: '#9E9E9E',\n debug: '#607D8B',\n info: '#2196F3',\n log: '#2196F3',\n warn: '#FFC107',\n error: '#D32F2F',\n fatal: '#7B1FA2',\n success: '#4CAF50',\n start: '#00BCD4',\n box: '#9E9E9E',\n ready: '#4CAF50',\n fail: '#D32F2F'\n }\n return colors[type] || colors.log || '#616161'\n }\n\n getTypeLabel(type) {\n return type || 'log'\n }\n\n getFileInfo() {\n try {\n const stack = new Error('Stack trace').stack\n if (!stack) return null\n\n const skipPatterns = ['HtmlPopupReporter', 'CanvasPopupReporter', 'browser.js', 'consola', 'createLogger']\n const lines = stack.split('\\n').slice(4, 15)\n\n for (const line of lines) {\n const trimmed = line.trim()\n const shouldSkip = skipPatterns.some(pattern => trimmed.includes(pattern))\n\n if (!shouldSkip) {\n const match =\n trimmed.match(/\\(?([^()]+):(\\d+):(\\d+)\\)?/) || trimmed.match(/at\\s+[^(]*\\(?([^:]+):(\\d+):(\\d+)\\)?/)\n\n if (match) {\n let file = match[1].trim()\n const lineNum = match[2]\n\n // Очищаємо ім'я файлу\n if (file.includes('://')) {\n file = file.slice(file.indexOf('://') + 3).slice(file.indexOf('/'))\n }\n if (file.includes('/src/')) {\n file = file.slice(file.indexOf('/src/') + 5)\n }\n const queryIndex = file.indexOf('?')\n if (queryIndex > 0) file = file.slice(0, queryIndex)\n const hashIndex = file.indexOf('#')\n if (hashIndex > 0) file = file.slice(0, hashIndex)\n if (file.startsWith('/')) file = file.slice(1)\n\n if (file && lineNum) {\n return { file, line: parseInt(lineNum, 10), column: parseInt(match[3], 10), fullPath: match[0] }\n }\n }\n }\n }\n } catch {\n // Ігноруємо помилки\n }\n return null\n }\n\n formatMessage(logObj) {\n const args = logObj.args || []\n if (args.length === 0) return ''\n\n const message = args\n .map(arg => {\n if (arg instanceof Error) {\n let msg = `${arg.name || 'Error'}: ${arg.message || ''}`\n if (arg.stack && arg.stack !== arg.message) {\n msg += '\\n' + arg.stack.split('\\n').slice(0, 3).join('\\n')\n }\n return msg\n }\n if (arg === null) return 'null'\n if (arg === undefined) return 'undefined'\n if (typeof arg === 'object') {\n try {\n const str = arg.toString?.()\n if (str && str !== '[object Object]') return str\n return JSON.stringify(arg, null, 2)\n } catch {\n return String(arg)\n }\n }\n return String(arg)\n })\n .join(' ')\n\n return message.length > POPUP_MAX_MESSAGE_LENGTH ? message.slice(0, POPUP_MAX_MESSAGE_LENGTH) + '...' : message\n }\n\n log(logObj) {\n if (!this.container) return\n\n const text = this.formatMessage(logObj)\n if (!text) return\n\n const type = logObj.type || 'log'\n const color = this.getColorForType(type)\n const typeLabel = this.getTypeLabel(type)\n const id = this.messageId++\n const fileInfo = this.getFileInfo()\n\n const popup = document.createElement('div')\n popup.className = 'consola-popup'\n popup.dataset.id = String(id)\n popup.style.bottom = `${window.innerHeight}px`\n popup.style.backgroundColor = '#fff'\n\n const label = document.createElement('span')\n label.className = 'consola-popup-label'\n label.style.backgroundColor = color\n label.textContent = typeLabel\n\n const content = document.createElement('div')\n content.className = 'consola-popup-content'\n\n const textEl = document.createElement('div')\n textEl.className = 'consola-popup-text'\n textEl.textContent = text\n\n content.append(textEl)\n\n if (fileInfo) {\n const fileLink = document.createElement('span')\n fileLink.className = 'consola-popup-filelink'\n fileLink.textContent = `${fileInfo.file}:${fileInfo.line}`\n fileLink.role = 'button'\n fileLink.tabIndex = 0\n fileLink.addEventListener('click', e => {\n e.preventDefault()\n console.log(`%c${fileInfo.file}:${fileInfo.line}`, 'color: #1976D2; text-decoration: underline;')\n })\n content.append(fileLink)\n }\n\n const closeBtn = document.createElement('button')\n closeBtn.type = 'button'\n closeBtn.className = 'consola-popup-close'\n closeBtn.setAttribute('aria-label', 'Close')\n closeBtn.textContent = '×'\n closeBtn.addEventListener('click', () => {\n const idx = this.messages.findIndex(m => m.id === id)\n if (idx !== -1) {\n const entry = this.messages[idx]\n if (entry.el && entry.el.parentNode) entry.el.remove()\n this.messages.splice(idx, 1)\n }\n })\n\n popup.append(label, content, closeBtn)\n this.container.append(popup)\n\n const height = popup.offsetHeight\n this.messages.push({\n id,\n el: popup,\n targetBottom: 20,\n currentBottom: window.innerHeight,\n height\n })\n }\n\n animate() {\n if (!this.container) return\n\n let offset = 20\n for (let i = this.messages.length - 1; i >= 0; i--) {\n const msg = this.messages[i]\n if (msg.el && msg.el.parentNode) {\n const h = msg.el.offsetHeight\n msg.height = h\n msg.targetBottom = offset\n msg.currentBottom += (msg.targetBottom - msg.currentBottom) * 0.1\n msg.el.style.bottom = `${Math.round(msg.currentBottom)}px`\n offset += h + 10\n }\n }\n\n requestAnimationFrame(() => this.animate())\n }\n}\n\n// Отримання змінних середовища з Vite (import.meta.env)\nconst getViteEnvVar = name => {\n try {\n // eslint-disable-next-line no-undef\n const viteName = `VITE_${name}`\n // eslint-disable-next-line no-undef\n return import.meta?.env?.[viteName]\n } catch {\n return null\n }\n}\n\n// Перевіряємо змінну середовища VITE_CONSOLA_POPUP_DEBUG\nlet isPopupDebugEnabled = false\n\n// Vite замінює import.meta.env.VITE_* під час збірки\n// Використовуємо прямий доступ до import.meta.env, оскільки Vite обробляє це під час збірки\nif (typeof document !== 'undefined') {\n try {\n // Vite замінює цей код під час збірки\n // eslint-disable-next-line no-undef\n const envValue = import.meta.env?.VITE_CONSOLA_POPUP_DEBUG\n if (envValue !== undefined && envValue !== null && envValue !== '') {\n // Vite завжди повертає рядки для змінних середовища\n isPopupDebugEnabled = String(envValue).toLowerCase() === 'true' || envValue === true\n }\n } catch {\n // Ігноруємо помилки, якщо import.meta недоступний\n }\n}\n\nif (!isPopupDebugEnabled && typeof process !== 'undefined' && process.env) {\n const processValue = process.env.VITE_CONSOLA_POPUP_DEBUG\n if (processValue) {\n isPopupDebugEnabled = String(processValue).toLowerCase() === 'true'\n }\n}\n\n// Створюємо один екземпляр репортера, якщо потрібно\n// НЕ встановлюємо options.reporters, щоб стандартний BrowserReporter працював\n// Додаємо наш репортер після створення екземпляра через addReporter\nlet htmlPopupReporter = null\nif (isPopupDebugEnabled && typeof document !== 'undefined') {\n htmlPopupReporter = new HtmlPopupReporter()\n}\n\nconst defaultConsola = consola.create(options)\n\n// Додаємо HTML репортер до default екземпляра, якщо потрібно (не замінює стандартний)\nif (isPopupDebugEnabled && typeof document !== 'undefined' && htmlPopupReporter) {\n defaultConsola.addReporter(htmlPopupReporter)\n}\n\n// Перевіряємо змінні середовища Vite для OpenTelemetry експорту\nlet openTelemetryReporter = null\nconst otelEndpoint = getViteEnvVar('OTEL_EXPORTER_OTLP_LOGS_ENDPOINT')\n\nif (otelEndpoint) {\n openTelemetryReporter = new OpenTelemetryReporter()\n defaultConsola.addReporter(openTelemetryReporter)\n}\n\nexport default defaultConsola\n\n// Експортуємо consola з нашими опціями, а не базовий\nexport { defaultConsola as consola }\n\n// Експортуємо OpenTelemetryReporter та createOpenTelemetryReporter для прямого використання\nexport { createOpenTelemetryReporter, OpenTelemetryReporter } from './otel-reporter.js'\n\n/**\n * pass import.meta.url\n * example: const consola = createLogger(import.meta.url)\n *\n * @param {String} _url - The import.meta.url or file URL to use for logger creation\n * @returns {Consola} A consola logger instance\n */\nexport const createLogger = _url => {\n return defaultConsola\n}\n","/// <reference path=\"./web-serial.d.ts\" />\nimport { WebPlugin } from '@capacitor/core'\nimport { consola } from '@nitra/consola'\n\nexport class ZebraWeb extends WebPlugin {\n async print({ zpl }) {\n try {\n consola.debug('Запит на підключення до принтера...', 'info')\n\n // Запитуємо порт (Web Serial API)\n const serial = navigator.serial\n if (!serial) throw new Error('Web Serial API не підтримується в цьому браузері')\n const port = await serial.requestPort()\n consola.debug(\"Порт вибрано, відкриваємо з'єднання...\", 'info')\n\n // Відкриваємо з'єднання з налаштуваннями для Zebra принтера\n await port.open({\n baudRate: 9600, // Можна спробувати 115200 якщо не працює\n dataBits: 8,\n parity: 'none',\n stopBits: 1,\n flowControl: 'none'\n })\n\n consola.debug(\"З'єднання відкрито!\", 'success')\n\n // Отримуємо writer для відправки даних\n const writer = port.writable.getWriter()\n\n // Оновлюємо стан\n consola.debug('Принтер готовий до друку', 'success')\n\n if (!port || !writer) {\n consola.debug('Помилка: Принтер не підключено', 'error')\n return\n }\n\n consola.debug(`Відправка ZPL команди: ${zpl.slice(0, 50)}...`, 'info')\n\n // Конвертуємо текст в Uint8Array\n const encoder = new TextEncoder()\n const data = encoder.encode(zpl)\n\n // Відправляємо дані\n await writer.write(data)\n\n // Чекаємо трохи для обробки принтером\n // await new Promise(resolve => setTimeout(resolve, 500))\n\n consola.debug(`✓ Команда відправлена (${data.length} байт)`, 'success')\n consola.debug('print from web capacitor plugin', zpl)\n return {\n success: true\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n consola.debug(`Помилка підключення: ${message}`, 'error')\n\n // Спробуємо перепідключитися\n // await disconnect()\n throw error\n }\n }\n\n getPairedDevices() {\n return {\n devices: [\n { address: '00:00:00:00:00:00', name: 'Virtual Printer' },\n { address: '11:11:11:11:11:11', name: 'Virtual Headphone' }\n ]\n }\n }\n}\n","import { registerPlugin } from '@capacitor/core'\nimport { Preferences } from '@capacitor/preferences'\nimport { normalizePrintArg } from './utils/validate.js'\n\nconst ZebraPlugin = registerPlugin('Zebra', {\n web: () => import('./web.js').then(m => new m.ZebraWeb())\n})\n\nconst Zebra = {\n /**\n * Приймає лише zpl як рядок; address для нативних платформ береться з Preferences (після setPrinterAddress або вибору пристрою).\n * @param {string} zpl - ZPL-рядок для друку\n * @returns {Promise<{success?: boolean, devices?: Array<{address: string, name: string}>, message?: string}>} Результат друку або список пристроїв\n */\n async print(zpl) {\n const zplNormalized = normalizePrintArg(zpl)\n\n const { value: address } = await Preferences.get({ key: 'printer_address' })\n const addressTrimmed = typeof address === 'string' ? address.trim() : ''\n if (!addressTrimmed) {\n const { devices } = await ZebraPlugin.getPairedDevices()\n if (devices?.length > 0) {\n return { success: false, message: 'device list', devices }\n }\n return { success: false, message: 'No paired devices found' }\n }\n return ZebraPlugin.print({ zpl: zplNormalized, address: addressTrimmed })\n },\n getPairedDevices() {\n return ZebraPlugin.getPairedDevices()\n }\n}\n\nexport { Zebra }\n"],"x_google_ignoreList":[0,1,3,4,5,6],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;CACa,iBAAb,cAAoC,UAAU;EAC1C,cAAc;AACV,SAAM,GAAG,UAAU;AACnB,QAAK,QAAQ;;EAEjB,MAAM,UAAU,EAAE,SAAS;AACvB,OAAI,OAAO,UAAU,SACjB,MAAK,QAAQ;;EAGrB,MAAM,IAAI,SAAS;AAEf,UAAO,EAAE,OADK,KAAK,KAAK,QAAQ,KAAK,YAAY,QAAQ,IAAI,CAAC,EAC9C;;EAEpB,MAAM,IAAI,SAAS;AACf,QAAK,KAAK,QAAQ,KAAK,YAAY,QAAQ,IAAI,EAAE,QAAQ,MAAM;;EAEnE,MAAM,OAAO,SAAS;AAClB,QAAK,KAAK,WAAW,KAAK,YAAY,QAAQ,IAAI,CAAC;;EAEvD,MAAM,OAAO;AAET,UAAO,EAAE,MADI,KAAK,SAAS,CAAC,KAAK,MAAM,EAAE,UAAU,KAAK,OAAO,OAAO,CAAC,EACxD;;EAEnB,MAAM,QAAQ;AACV,QAAK,MAAM,OAAO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BAAgB,kBAAkB,IAAI;EAE5C,MAAM,EAAE,OAAO,YAAY,MAAM,YAAY,IAAI,EAAE,KAAK,mBAAmB,CAAC;EAC5E,MAAM,iBAAiB,OAAO,YAAY,WAAW,QAAQ,MAAM,GAAG;AACtE,MAAI,CAAC,gBAAgB;GACnB,MAAM,EAAE,YAAY,MAAM,YAAY,kBAAkB;AACxD,OAAI,SAAS,SAAS,EACpB,QAAO;IAAE,SAAS;IAAO,SAAS;IAAe;IAAS;AAE5D,UAAO;IAAE,SAAS;IAAO,SAAS;IAA2B;;AAE/D,SAAO,YAAY,MAAM;GAAE,KAAK;GAAe,SAAS;GAAgB,CAAC;;CAE3E,mBAAmB;AACjB,SAAO,YAAY,kBAAkB;;CAExC"}
|
|
@@ -23,16 +23,20 @@ import ExternalAccessory
|
|
|
23
23
|
/// Невелика затримка між черговими завданнями, щоб дати прошивці час стабілізуватися
|
|
24
24
|
private let cooldownInterval: TimeInterval = 1.0
|
|
25
25
|
|
|
26
|
-
///
|
|
27
|
-
private static
|
|
28
|
-
|
|
29
|
-
private func
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
/// Один раз реєструємося для нотифікацій EA — потрібно для коректного доступу до аксесуарів при холодному запуску (без Xcode).
|
|
27
|
+
private static var didRegisterForAccessoryNotifications = false
|
|
28
|
+
private static let registerLock = NSLock()
|
|
29
|
+
private func ensureRegisteredForAccessoryNotifications() {
|
|
30
|
+
Zebra.registerLock.lock()
|
|
31
|
+
defer { Zebra.registerLock.unlock() }
|
|
32
|
+
guard !Zebra.didRegisterForAccessoryNotifications else { return }
|
|
33
|
+
EAAccessoryManager.shared().registerForLocalNotifications()
|
|
34
|
+
Zebra.didRegisterForAccessoryNotifications = true
|
|
35
|
+
logDebug("EAAccessoryManager.registerForLocalNotifications() called")
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
/// Представляє інформацію про підключений аксесуар, яку використовує плагін
|
|
35
|
-
public struct DeviceInfo {
|
|
39
|
+
public struct DeviceInfo: Sendable {
|
|
36
40
|
public let address: String
|
|
37
41
|
public let name: String
|
|
38
42
|
public init(address: String, name: String) {
|
|
@@ -42,7 +46,7 @@ import ExternalAccessory
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
/// Представляє успішний результат друку
|
|
45
|
-
public struct PrintResult {
|
|
49
|
+
public struct PrintResult: Sendable {
|
|
46
50
|
public let address: String
|
|
47
51
|
public init(address: String) {
|
|
48
52
|
self.address = address
|
|
@@ -50,7 +54,7 @@ import ExternalAccessory
|
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
/// Можливі помилки під час друку
|
|
53
|
-
public enum ZebraError: LocalizedError {
|
|
57
|
+
public enum ZebraError: LocalizedError, Sendable {
|
|
54
58
|
case addressMissing // Адреса принтера не вказана
|
|
55
59
|
case zplEmpty // ZPL команда порожня
|
|
56
60
|
/// Пристрій не знайдено: запитувана адреса та список підключених аксесуарів (назва + адреса), щоб показувати їх у помилці
|
|
@@ -90,12 +94,10 @@ import ExternalAccessory
|
|
|
90
94
|
private let timeout: TimeInterval
|
|
91
95
|
private var totalWritten = 0
|
|
92
96
|
private var completion: ((Result<PrintResult, ZebraError>) -> Void)?
|
|
93
|
-
private weak var owner: Zebra?
|
|
94
97
|
private var startTime = Date()
|
|
95
98
|
private let session: EASession
|
|
96
99
|
|
|
97
|
-
init(owner: Zebra, session: EASession, output: OutputStream, data: [UInt8], address: String, timeout: TimeInterval = 5.0, completion: @escaping (Result<PrintResult, ZebraError>) -> Void) {
|
|
98
|
-
self.owner = owner
|
|
100
|
+
init(owner _: Zebra, session: EASession, output: OutputStream, data: [UInt8], address: String, timeout: TimeInterval = 5.0, completion: @escaping (Result<PrintResult, ZebraError>) -> Void) {
|
|
99
101
|
self.session = session
|
|
100
102
|
self.output = output
|
|
101
103
|
self.data = data
|
|
@@ -117,18 +119,18 @@ import ExternalAccessory
|
|
|
117
119
|
output.delegate = self
|
|
118
120
|
output.schedule(in: runLoop, forMode: mode)
|
|
119
121
|
output.open()
|
|
120
|
-
|
|
122
|
+
logDebug("StreamWriter started, bytes= \(self.data.count)")
|
|
121
123
|
startTime = Date()
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
/// Після запису всіх байтів дає час на флаш буфера (iOS може не встигнути відправити на пристрій при миттєвому
|
|
126
|
+
/// Після запису всіх байтів дає час на флаш буфера (iOS може не встигнути відправити на пристрій при миттєвому закритті, особливо при запуску без Xcode).
|
|
125
127
|
private func flushThenClose() {
|
|
126
|
-
let flushDuration: TimeInterval = 0.
|
|
128
|
+
let flushDuration: TimeInterval = 0.75
|
|
127
129
|
let deadline = Date().addingTimeInterval(flushDuration)
|
|
128
130
|
while Date() < deadline {
|
|
129
|
-
RunLoop.current.run(mode: .default, before: Date().addingTimeInterval(0.
|
|
131
|
+
RunLoop.current.run(mode: .default, before: Date().addingTimeInterval(0.1))
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
logDebug("Flush done, closing stream")
|
|
132
134
|
close(with: .success(PrintResult(address: address)))
|
|
133
135
|
}
|
|
134
136
|
|
|
@@ -159,26 +161,26 @@ import ExternalAccessory
|
|
|
159
161
|
completion(result)
|
|
160
162
|
}
|
|
161
163
|
completion = nil
|
|
162
|
-
|
|
164
|
+
logDebug("StreamWriter finished with \(String(describing: result))")
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
func stream(_ aStream: Stream, handle eventCode: Stream.Event) {
|
|
166
168
|
// Події input-потоку ігноруємо (потрібен лише для коректного життєвого циклу сесії)
|
|
167
169
|
guard aStream === output else { return }
|
|
168
170
|
if Date().timeIntervalSince(startTime) > timeout {
|
|
169
|
-
|
|
171
|
+
logDebug("StreamWriter timeout")
|
|
170
172
|
close(with: .failure(.writeFailed("Таймаут запису")))
|
|
171
173
|
return
|
|
172
174
|
}
|
|
173
175
|
switch eventCode {
|
|
174
176
|
case .openCompleted:
|
|
175
177
|
// Потік відкрито
|
|
176
|
-
|
|
178
|
+
logDebug("Stream open completed")
|
|
177
179
|
case .hasSpaceAvailable:
|
|
178
180
|
// Є простір для запису, пишемо дані порціями
|
|
179
181
|
if totalWritten >= data.count {
|
|
180
182
|
// Усі байти записані — даємо час на флаш буфера перед закриттям (iOS часто не встигає відправити на пристрій)
|
|
181
|
-
|
|
183
|
+
logDebug("All bytes written, flushing before close...")
|
|
182
184
|
flushThenClose()
|
|
183
185
|
return
|
|
184
186
|
}
|
|
@@ -187,7 +189,7 @@ import ExternalAccessory
|
|
|
187
189
|
let wrote = output.write(Array(data[totalWritten..<(totalWritten + chunkSize)]), maxLength: chunkSize)
|
|
188
190
|
if wrote <= 0 {
|
|
189
191
|
let reason = output.streamError?.localizedDescription ?? "Невідома помилка потоку"
|
|
190
|
-
|
|
192
|
+
logDebug("StreamWriter write failed: \(reason)")
|
|
191
193
|
close(with: .failure(.writeFailed(reason)))
|
|
192
194
|
return
|
|
193
195
|
}
|
|
@@ -195,11 +197,11 @@ import ExternalAccessory
|
|
|
195
197
|
case .errorOccurred:
|
|
196
198
|
// Сталася помилка потоку
|
|
197
199
|
let reason = output.streamError?.localizedDescription ?? "Невідома помилка потоку"
|
|
198
|
-
|
|
200
|
+
logDebug("Stream error: \(reason)")
|
|
199
201
|
close(with: .failure(.writeFailed(reason)))
|
|
200
202
|
case .endEncountered:
|
|
201
203
|
// Потік закінчився, перевіряємо чи всі дані записані
|
|
202
|
-
|
|
204
|
+
logDebug("Stream end encountered, bytes= \(self.totalWritten)")
|
|
203
205
|
if totalWritten >= data.count {
|
|
204
206
|
close(with: .success(PrintResult(address: address)))
|
|
205
207
|
} else {
|
|
@@ -225,7 +227,19 @@ import ExternalAccessory
|
|
|
225
227
|
|
|
226
228
|
/// Повертає список підключених EA аксесуарів у вигляді DeviceInfo, вибираючи серійний номер або ім'я як адресу
|
|
227
229
|
public func getConnectedAccessories() -> [DeviceInfo] {
|
|
228
|
-
|
|
230
|
+
ensureRegisteredForAccessoryNotifications()
|
|
231
|
+
// Якщо аксесуарів немає, чекаємо 0.6 с і повторюємо спробу до 3 разів (щоб дати системі час підхопити нове підключення)
|
|
232
|
+
let maxAttempts = 3
|
|
233
|
+
let retryDelay: TimeInterval = 0.6
|
|
234
|
+
var accessories = EAAccessoryManager.shared().connectedAccessories
|
|
235
|
+
for attempt in 1...maxAttempts {
|
|
236
|
+
if !accessories.isEmpty { break }
|
|
237
|
+
if attempt < maxAttempts {
|
|
238
|
+
logDebug("connectedAccessories attempt: \(attempt)")
|
|
239
|
+
Thread.sleep(forTimeInterval: retryDelay)
|
|
240
|
+
accessories = EAAccessoryManager.shared().connectedAccessories
|
|
241
|
+
}
|
|
242
|
+
}
|
|
229
243
|
return accessories.compactMap { accessory in
|
|
230
244
|
let address = accessory.serialNumber.isEmpty ? accessory.name : accessory.serialNumber
|
|
231
245
|
if address.isEmpty {
|
|
@@ -238,14 +252,14 @@ import ExternalAccessory
|
|
|
238
252
|
/// Виводить діагностичну інформацію щодо підключених аксесуарів та протоколів у Info.plist
|
|
239
253
|
public func diagnoseEnvironment() {
|
|
240
254
|
let accessories = EAAccessoryManager.shared().connectedAccessories
|
|
241
|
-
|
|
255
|
+
logDebug("Connected accessories count: \(accessories.count)")
|
|
242
256
|
for a in accessories {
|
|
243
|
-
|
|
257
|
+
logDebug("Accessory: name=\(a.name) serial=\(a.serialNumber) protocols=\(a.protocolStrings)")
|
|
244
258
|
}
|
|
245
259
|
if let supported = Bundle.main.object(forInfoDictionaryKey: "UISupportedExternalAccessoryProtocols") as? [String] {
|
|
246
|
-
|
|
260
|
+
logDebug("Info.plist UISupportedExternalAccessoryProtocols: \(supported)")
|
|
247
261
|
} else {
|
|
248
|
-
|
|
262
|
+
logDebug("Info.plist UISupportedExternalAccessoryProtocols: MISSING or not an array")
|
|
249
263
|
}
|
|
250
264
|
}
|
|
251
265
|
|
|
@@ -256,10 +270,10 @@ import ExternalAccessory
|
|
|
256
270
|
for proto in protocolsToTry {
|
|
257
271
|
for attempt in 1...retries {
|
|
258
272
|
if let session = EASession(accessory: accessory, forProtocol: proto) {
|
|
259
|
-
|
|
273
|
+
logDebug("EASession open success on attempt \(attempt) protocol: \(proto)")
|
|
260
274
|
return (session, proto)
|
|
261
275
|
} else {
|
|
262
|
-
|
|
276
|
+
logDebug("EASession open failed attempt \(attempt) protocol: \(proto)")
|
|
263
277
|
Thread.sleep(forTimeInterval: delay)
|
|
264
278
|
}
|
|
265
279
|
}
|
|
@@ -285,17 +299,25 @@ import ExternalAccessory
|
|
|
285
299
|
payload += "\r\n"
|
|
286
300
|
}
|
|
287
301
|
let zplBytes = Array(payload.utf8)
|
|
288
|
-
|
|
302
|
+
logDebug("printZpl called with address=\(trimmedAddress) zplLength=\(zplBytes.count)")
|
|
289
303
|
|
|
290
304
|
DispatchQueue.main.async { [weak self] in
|
|
291
305
|
guard let self = self else { return }
|
|
306
|
+
self.ensureRegisteredForAccessoryNotifications()
|
|
292
307
|
let accessories = EAAccessoryManager.shared().connectedAccessories
|
|
293
|
-
|
|
308
|
+
logDebug("EA connectedAccessories count= \(accessories.count)")
|
|
294
309
|
|
|
295
310
|
// Шукаємо аксесуар, що відповідає адресі (serialNumber або name)
|
|
296
311
|
let availableList = self.getConnectedAccessories()
|
|
312
|
+
|
|
313
|
+
if availableList.isEmpty {
|
|
314
|
+
logDebug("No accessories found")
|
|
315
|
+
completion(.failure(.accessoryNotFound(requestedAddress: trimmedAddress, availableAccessories: availableList)))
|
|
316
|
+
return
|
|
317
|
+
}
|
|
318
|
+
|
|
297
319
|
guard let accessory = accessories.first(where: { self.accessoryMatches($0, address: trimmedAddress) }) else {
|
|
298
|
-
|
|
320
|
+
logDebug("No accessory matched address: \(trimmedAddress)")
|
|
299
321
|
// У failure передаємо не лише адресу, а й список доступних аксесуарів (назви та адреси) для показу в помилці
|
|
300
322
|
completion(.failure(.accessoryNotFound(requestedAddress: trimmedAddress, availableAccessories: availableList)))
|
|
301
323
|
return
|
|
@@ -303,30 +325,30 @@ import ExternalAccessory
|
|
|
303
325
|
|
|
304
326
|
// Обираємо протокол для з’єднання
|
|
305
327
|
let protocolString = self.preferredProtocol(for: accessory)
|
|
306
|
-
|
|
307
|
-
|
|
328
|
+
logDebug("Chosen accessory: \(accessory.name) serial=\(accessory.serialNumber)")
|
|
329
|
+
logDebug("Selected protocol: \(protocolString)")
|
|
308
330
|
if let supported = Bundle.main.object(forInfoDictionaryKey: "UISupportedExternalAccessoryProtocols") as? [String] {
|
|
309
331
|
if !supported.contains(protocolString) {
|
|
310
|
-
|
|
332
|
+
logDebug("WARNING: Selected protocol not present in Info.plist UISupportedExternalAccessoryProtocols")
|
|
311
333
|
}
|
|
312
334
|
} else {
|
|
313
|
-
|
|
335
|
+
logDebug("WARNING: UISupportedExternalAccessoryProtocols missing in Info.plist")
|
|
314
336
|
}
|
|
315
337
|
|
|
316
|
-
|
|
338
|
+
logDebug("Attempting to open EASession with retries and fallback protocols...")
|
|
317
339
|
Thread.sleep(forTimeInterval: 0.1)
|
|
318
340
|
let fallback = accessory.protocolStrings
|
|
319
341
|
// Відкриваємо сесію, пробуємо ретраї і fallback протоколи
|
|
320
342
|
guard let result = self.openSessionWithRetries(accessory: accessory, preferredProtocol: protocolString, fallbackProtocols: fallback) else {
|
|
321
|
-
|
|
343
|
+
logDebug("EASession failed after retries and fallback")
|
|
322
344
|
completion(.failure(.sessionFailed("EASession повернув nil")))
|
|
323
345
|
return
|
|
324
346
|
}
|
|
325
347
|
let session = result.session
|
|
326
348
|
let protocolUsed = result.protocolUsed
|
|
327
|
-
|
|
349
|
+
logDebug("Using protocol for session: \(protocolUsed)")
|
|
328
350
|
guard let outputStream = session.outputStream else {
|
|
329
|
-
|
|
351
|
+
logDebug("Session opened but outputStream is nil")
|
|
330
352
|
completion(.failure(.sessionFailed("Відсутній outputStream")))
|
|
331
353
|
return
|
|
332
354
|
}
|
|
@@ -342,9 +364,9 @@ import ExternalAccessory
|
|
|
342
364
|
}
|
|
343
365
|
writer.start()
|
|
344
366
|
|
|
345
|
-
// Запускаємо RunLoop, щоб обробляти події стріму
|
|
367
|
+
// Запускаємо RunLoop, щоб обробляти події стріму (довші інтервали — надійніший flush при запуску без Xcode)
|
|
346
368
|
while group.wait(timeout: .now()) == .timedOut {
|
|
347
|
-
RunLoop.current.run(mode: .default, before: Date().addingTimeInterval(0.
|
|
369
|
+
RunLoop.current.run(mode: .default, before: Date().addingTimeInterval(0.25))
|
|
348
370
|
}
|
|
349
371
|
}
|
|
350
372
|
}
|
|
@@ -370,3 +392,35 @@ import ExternalAccessory
|
|
|
370
392
|
}
|
|
371
393
|
}
|
|
372
394
|
|
|
395
|
+
// MARK: - Actor-based API (Swift Concurrency)
|
|
396
|
+
|
|
397
|
+
/// Actor для безпечної роботи з принтером Zebra з підтримкою Swift Concurrency.
|
|
398
|
+
/// Усі виклики серіалізуються через actor isolation.
|
|
399
|
+
public actor ZebraActor {
|
|
400
|
+
private let zebra = Zebra()
|
|
401
|
+
|
|
402
|
+
/// Зберігає адресу принтера у UserDefaults
|
|
403
|
+
public func setPrinterAddress(_ address: String) {
|
|
404
|
+
zebra.setPrinterAddress(address)
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/// Повертає збережену адресу принтера, якщо є
|
|
408
|
+
public func getStoredAddress() -> String? {
|
|
409
|
+
zebra.getStoredAddress()
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/// Повертає список підключених EA аксесуарів
|
|
413
|
+
public func getConnectedAccessories() -> [Zebra.DeviceInfo] {
|
|
414
|
+
zebra.getConnectedAccessories()
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/// Друкує ZPL на принтері за вказаною адресою (async/await API)
|
|
418
|
+
public func printZpl(address: String, zpl: String) async throws -> Zebra.PrintResult {
|
|
419
|
+
try await withCheckedThrowingContinuation { continuation in
|
|
420
|
+
zebra.printZpl(address: address, zpl: zpl) { result in
|
|
421
|
+
continuation.resume(with: result)
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
/// Спільна функція дебаг-логування для модуля Zebra.
|
|
4
|
+
/// У Release не виконується й не обчислює повідомлення (zero cost).
|
|
5
|
+
#if DEBUG
|
|
6
|
+
func logDebug(_ message: @autoclosure @escaping () -> String) {
|
|
7
|
+
Logger(subsystem: "com.nitra.zebra", category: "Zebra").debug("\(message(), privacy: .public)")
|
|
8
|
+
}
|
|
9
|
+
#else
|
|
10
|
+
func logDebug(_ message: @autoclosure @escaping () -> String) {}
|
|
11
|
+
#endif
|
|
@@ -19,8 +19,8 @@ public class ZebraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
19
19
|
CAPPluginMethod(name: "print", returnType: CAPPluginReturnPromise)
|
|
20
20
|
]
|
|
21
21
|
|
|
22
|
-
///
|
|
23
|
-
private let implementation =
|
|
22
|
+
/// Actor для роботи з принтером Zebra (Swift Concurrency)
|
|
23
|
+
private let implementation = ZebraActor()
|
|
24
24
|
|
|
25
25
|
// MARK: - Методи плагіна
|
|
26
26
|
|
|
@@ -35,29 +35,26 @@ public class ZebraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
35
35
|
call.reject("Параметр 'address' обов'язковий для iOS (серійний номер або ім'я пристрою).")
|
|
36
36
|
return
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
])
|
|
38
|
+
Task {
|
|
39
|
+
await implementation.setPrinterAddress(address)
|
|
40
|
+
logDebug("setPrinterAddress: \(address)")
|
|
41
|
+
await MainActor.run {
|
|
42
|
+
call.resolve(["address": address])
|
|
43
|
+
}
|
|
44
|
+
}
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
/// Отримує список підключених пристроїв Zebra
|
|
49
48
|
/// - Parameter call: Виклик без параметрів
|
|
50
49
|
@objc func getPairedDevices(_ call: CAPPluginCall) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"devices": list
|
|
60
|
-
])
|
|
50
|
+
Task {
|
|
51
|
+
let devices = await implementation.getConnectedAccessories()
|
|
52
|
+
logDebug("getPairedDevices: \(devices.count) device(s)")
|
|
53
|
+
let list = devices.map { ["address": $0.address, "name": $0.name] }
|
|
54
|
+
await MainActor.run {
|
|
55
|
+
call.resolve(["devices": list])
|
|
56
|
+
}
|
|
57
|
+
}
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
/// Друкує ZPL команди на принтері Zebra
|
|
@@ -69,47 +66,54 @@ public class ZebraPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
69
66
|
call.reject("Параметр 'address' обов'язковий (серійний номер або ім'я пристрою).")
|
|
70
67
|
return
|
|
71
68
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// Успішний друк - повертаємо лише success
|
|
69
|
+
Task {
|
|
70
|
+
logDebug("print address=\(address) zplLength=\(zpl.utf8.count)")
|
|
71
|
+
do {
|
|
72
|
+
_ = try await implementation.printZpl(address: address, zpl: zpl)
|
|
73
|
+
logDebug("print success")
|
|
74
|
+
await MainActor.run {
|
|
79
75
|
call.resolve(["success": true])
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
}
|
|
77
|
+
} catch let error as Zebra.ZebraError {
|
|
78
|
+
logDebug("print failed: \(error.localizedDescription)")
|
|
79
|
+
// Помилка друку - визначаємо код помилки
|
|
80
|
+
await MainActor.run {
|
|
83
81
|
let code: String
|
|
84
82
|
switch error {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
83
|
+
case .addressMissing:
|
|
84
|
+
code = "ADDRESS_MISSING"
|
|
85
|
+
case .zplEmpty:
|
|
86
|
+
code = "ZPL_EMPTY"
|
|
87
|
+
case .accessoryNotFound(let requestedAddress, let availableAccessories):
|
|
88
|
+
code = "ACCESSORY_NOT_FOUND"
|
|
89
|
+
// Передаємо в JS запитувану адресу та список доступних пристроїв (name, address), щоб показувати їх у UI
|
|
90
|
+
let accessoriesPayload = availableAccessories.map { ["name": $0.name, "address": $0.address] }
|
|
91
|
+
call.reject(
|
|
92
|
+
error.localizedDescription,
|
|
93
|
+
code,
|
|
94
|
+
error,
|
|
95
|
+
["requestedAddress": requestedAddress, "availableAccessories": accessoriesPayload]
|
|
96
|
+
)
|
|
97
|
+
return
|
|
98
|
+
case .sessionFailed:
|
|
99
|
+
code = "SESSION_FAILED"
|
|
100
|
+
case .writeFailed:
|
|
101
|
+
code = "CONNECTION_FAILED"
|
|
102
|
+
case .protocolMissing:
|
|
103
|
+
code = "PROTOCOL_MISSING"
|
|
104
|
+
@unknown default:
|
|
105
|
+
code = "UNKNOWN"
|
|
106
106
|
}
|
|
107
|
-
|
|
108
107
|
// Повертаємо помилку з описом
|
|
109
108
|
call.reject(error.localizedDescription, code, error)
|
|
110
109
|
}
|
|
110
|
+
} catch {
|
|
111
|
+
logDebug("print failed (unknown): \(error.localizedDescription)")
|
|
112
|
+
await MainActor.run {
|
|
113
|
+
call.reject(error.localizedDescription, "UNKNOWN", error)
|
|
114
|
+
}
|
|
111
115
|
}
|
|
112
|
-
}
|
|
116
|
+
}
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
|
|
@@ -2,14 +2,17 @@ import XCTest
|
|
|
2
2
|
@testable import ZebraPlugin
|
|
3
3
|
|
|
4
4
|
class ZebraTests: XCTestCase {
|
|
5
|
-
func
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let result = implementation.echo(value)
|
|
5
|
+
func testZebraActorSetAndGetAddress() async {
|
|
6
|
+
let actor = ZebraActor()
|
|
7
|
+
await actor.setPrinterAddress("test-address")
|
|
8
|
+
let stored = await actor.getStoredAddress()
|
|
9
|
+
XCTAssertEqual(stored, "test-address")
|
|
10
|
+
}
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
func testZebraActorGetConnectedAccessories() async {
|
|
13
|
+
let actor = ZebraActor()
|
|
14
|
+
let devices = await actor.getConnectedAccessories()
|
|
15
|
+
XCTAssertNotNil(devices)
|
|
16
|
+
XCTAssertTrue(devices is [Zebra.DeviceInfo])
|
|
14
17
|
}
|
|
15
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/zebra",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Zebra printer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"capacitor",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
36
36
|
"verify:ios": "xcodebuild -scheme NitraZebra -destination generic/platform=iOS",
|
|
37
|
+
"test:ios": "swift test --sdk $(xcrun --sdk iphonesimulator --show-sdk-path) -Xswiftc -target -Xswiftc arm64-apple-ios16.0-simulator",
|
|
37
38
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
38
39
|
"verify:web": "npm run build",
|
|
39
40
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|