(function(global2, factory) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory(require("vue")) : typeof define === "function" && define.amd ? define(["vue"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.Vssue = factory(global2.Vue)); })(this, function(vue) { "use strict"; const _sfc_main$c = { name: "Iconfont" }; const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; const _hoisted_1$a = /* @__PURE__ */ vue.createStaticVNode('', 13); const _hoisted_14$1 = [ _hoisted_1$a ]; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return vue.withDirectives((vue.openBlock(), vue.createElementBlock("svg", null, _hoisted_14$1, 512)), [ [vue.vShow, false] ]); } const Iconfont = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render]]); const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({ __name: "TransitionFade", props: { group: { type: Boolean, default: false }, tag: { default: "div" } }, setup(__props) { const props = __props; return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(props.group ? "TransitionGroup" : "Transition"), { name: "fade", mode: "out-in", "appear:": "", true: "", tag: props.group ? props.tag : null }, { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default") ]), _: 3 }, 8, ["tag"]); }; } }); var shams = function hasSymbols2() { if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") { return false; } if (typeof Symbol.iterator === "symbol") { return true; } var obj = {}; var sym = Symbol("test"); var symObj = Object(sym); if (typeof sym === "string") { return false; } if (Object.prototype.toString.call(sym) !== "[object Symbol]") { return false; } if (Object.prototype.toString.call(symObj) !== "[object Symbol]") { return false; } var symVal = 42; obj[sym] = symVal; for (sym in obj) { return false; } if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) { return false; } if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) { return false; } var syms = Object.getOwnPropertySymbols(obj); if (syms.length !== 1 || syms[0] !== sym) { return false; } if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } if (typeof Object.getOwnPropertyDescriptor === "function") { var descriptor = Object.getOwnPropertyDescriptor(obj, sym); if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } } return true; }; var origSymbol = typeof Symbol !== "undefined" && Symbol; var hasSymbolSham = shams; var hasSymbols$1 = function hasNativeSymbols() { if (typeof origSymbol !== "function") { return false; } if (typeof Symbol !== "function") { return false; } if (typeof origSymbol("foo") !== "symbol") { return false; } if (typeof Symbol("bar") !== "symbol") { return false; } return hasSymbolSham(); }; var test = { foo: {} }; var $Object = Object; var hasProto$1 = function hasProto2() { return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object); }; var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; var slice = Array.prototype.slice; var toStr = Object.prototype.toString; var funcType = "[object Function]"; var implementation$1 = function bind2(that) { var target = this; if (typeof target !== "function" || toStr.call(target) !== funcType) { throw new TypeError(ERROR_MESSAGE + target); } var args = slice.call(arguments, 1); var bound; var binder = function() { if (this instanceof bound) { var result = target.apply( this, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; var boundLength = Math.max(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs.push("$" + i); } bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder); if (target.prototype) { var Empty = function Empty2() { }; Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; }; var implementation = implementation$1; var functionBind = Function.prototype.bind || implementation; var bind$1 = functionBind; var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty); var undefined$1; var $SyntaxError = SyntaxError; var $Function = Function; var $TypeError = TypeError; var getEvalledConstructor = function(expressionSyntax) { try { return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")(); } catch (e) { } }; var $gOPD = Object.getOwnPropertyDescriptor; if ($gOPD) { try { $gOPD({}, ""); } catch (e) { $gOPD = null; } } var throwTypeError = function() { throw new $TypeError(); }; var ThrowTypeError = $gOPD ? function() { try { arguments.callee; return throwTypeError; } catch (calleeThrows) { try { return $gOPD(arguments, "callee").get; } catch (gOPDthrows) { return throwTypeError; } } }() : throwTypeError; var hasSymbols = hasSymbols$1(); var hasProto = hasProto$1(); var getProto = Object.getPrototypeOf || (hasProto ? function(x) { return x.__proto__; } : null); var needsEval = {}; var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array); var INTRINSICS = { "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError, "%Array%": Array, "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer, "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1, "%AsyncFromSyncIteratorPrototype%": undefined$1, "%AsyncFunction%": needsEval, "%AsyncGenerator%": needsEval, "%AsyncGeneratorFunction%": needsEval, "%AsyncIteratorPrototype%": needsEval, "%Atomics%": typeof Atomics === "undefined" ? undefined$1 : Atomics, "%BigInt%": typeof BigInt === "undefined" ? undefined$1 : BigInt, "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined$1 : BigInt64Array, "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined$1 : BigUint64Array, "%Boolean%": Boolean, "%DataView%": typeof DataView === "undefined" ? undefined$1 : DataView, "%Date%": Date, "%decodeURI%": decodeURI, "%decodeURIComponent%": decodeURIComponent, "%encodeURI%": encodeURI, "%encodeURIComponent%": encodeURIComponent, "%Error%": Error, "%eval%": eval, "%EvalError%": EvalError, "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array, "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array, "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry, "%Function%": $Function, "%GeneratorFunction%": needsEval, "%Int8Array%": typeof Int8Array === "undefined" ? undefined$1 : Int8Array, "%Int16Array%": typeof Int16Array === "undefined" ? undefined$1 : Int16Array, "%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array, "%isFinite%": isFinite, "%isNaN%": isNaN, "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1, "%JSON%": typeof JSON === "object" ? JSON : undefined$1, "%Map%": typeof Map === "undefined" ? undefined$1 : Map, "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined$1 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()), "%Math%": Math, "%Number%": Number, "%Object%": Object, "%parseFloat%": parseFloat, "%parseInt%": parseInt, "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise, "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy, "%RangeError%": RangeError, "%ReferenceError%": ReferenceError, "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect, "%RegExp%": RegExp, "%Set%": typeof Set === "undefined" ? undefined$1 : Set, "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined$1 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()), "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer, "%String%": String, "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined$1, "%Symbol%": hasSymbols ? Symbol : undefined$1, "%SyntaxError%": $SyntaxError, "%ThrowTypeError%": ThrowTypeError, "%TypedArray%": TypedArray, "%TypeError%": $TypeError, "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined$1 : Uint8Array, "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray, "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array, "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array, "%URIError%": URIError, "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap, "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef, "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet }; if (getProto) { try { null.error; } catch (e) { var errorProto = getProto(getProto(e)); INTRINSICS["%Error.prototype%"] = errorProto; } } var doEval = function doEval2(name) { var value; if (name === "%AsyncFunction%") { value = getEvalledConstructor("async function () {}"); } else if (name === "%GeneratorFunction%") { value = getEvalledConstructor("function* () {}"); } else if (name === "%AsyncGeneratorFunction%") { value = getEvalledConstructor("async function* () {}"); } else if (name === "%AsyncGenerator%") { var fn = doEval2("%AsyncGeneratorFunction%"); if (fn) { value = fn.prototype; } } else if (name === "%AsyncIteratorPrototype%") { var gen = doEval2("%AsyncGenerator%"); if (gen && getProto) { value = getProto(gen.prototype); } } INTRINSICS[name] = value; return value; }; var LEGACY_ALIASES = { "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"], "%ArrayPrototype%": ["Array", "prototype"], "%ArrayProto_entries%": ["Array", "prototype", "entries"], "%ArrayProto_forEach%": ["Array", "prototype", "forEach"], "%ArrayProto_keys%": ["Array", "prototype", "keys"], "%ArrayProto_values%": ["Array", "prototype", "values"], "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"], "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"], "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"], "%BooleanPrototype%": ["Boolean", "prototype"], "%DataViewPrototype%": ["DataView", "prototype"], "%DatePrototype%": ["Date", "prototype"], "%ErrorPrototype%": ["Error", "prototype"], "%EvalErrorPrototype%": ["EvalError", "prototype"], "%Float32ArrayPrototype%": ["Float32Array", "prototype"], "%Float64ArrayPrototype%": ["Float64Array", "prototype"], "%FunctionPrototype%": ["Function", "prototype"], "%Generator%": ["GeneratorFunction", "prototype"], "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"], "%Int8ArrayPrototype%": ["Int8Array", "prototype"], "%Int16ArrayPrototype%": ["Int16Array", "prototype"], "%Int32ArrayPrototype%": ["Int32Array", "prototype"], "%JSONParse%": ["JSON", "parse"], "%JSONStringify%": ["JSON", "stringify"], "%MapPrototype%": ["Map", "prototype"], "%NumberPrototype%": ["Number", "prototype"], "%ObjectPrototype%": ["Object", "prototype"], "%ObjProto_toString%": ["Object", "prototype", "toString"], "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"], "%PromisePrototype%": ["Promise", "prototype"], "%PromiseProto_then%": ["Promise", "prototype", "then"], "%Promise_all%": ["Promise", "all"], "%Promise_reject%": ["Promise", "reject"], "%Promise_resolve%": ["Promise", "resolve"], "%RangeErrorPrototype%": ["RangeError", "prototype"], "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"], "%RegExpPrototype%": ["RegExp", "prototype"], "%SetPrototype%": ["Set", "prototype"], "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"], "%StringPrototype%": ["String", "prototype"], "%SymbolPrototype%": ["Symbol", "prototype"], "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"], "%TypedArrayPrototype%": ["TypedArray", "prototype"], "%TypeErrorPrototype%": ["TypeError", "prototype"], "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"], "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"], "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"], "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"], "%URIErrorPrototype%": ["URIError", "prototype"], "%WeakMapPrototype%": ["WeakMap", "prototype"], "%WeakSetPrototype%": ["WeakSet", "prototype"] }; var bind = functionBind; var hasOwn$1 = src; var $concat = bind.call(Function.call, Array.prototype.concat); var $spliceApply = bind.call(Function.apply, Array.prototype.splice); var $replace = bind.call(Function.call, String.prototype.replace); var $strSlice = bind.call(Function.call, String.prototype.slice); var $exec = bind.call(Function.call, RegExp.prototype.exec); var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; var reEscapeChar = /\\(\\)?/g; var stringToPath = function stringToPath2(string) { var first = $strSlice(string, 0, 1); var last = $strSlice(string, -1); if (first === "%" && last !== "%") { throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); } else if (last === "%" && first !== "%") { throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); } var result = []; $replace(string, rePropName, function(match, number2, quote, subString) { result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number2 || match; }); return result; }; var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { var intrinsicName = name; var alias; if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) { alias = LEGACY_ALIASES[intrinsicName]; intrinsicName = "%" + alias[0] + "%"; } if (hasOwn$1(INTRINSICS, intrinsicName)) { var value = INTRINSICS[intrinsicName]; if (value === needsEval) { value = doEval(intrinsicName); } if (typeof value === "undefined" && !allowMissing) { throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!"); } return { alias, name: intrinsicName, value }; } throw new $SyntaxError("intrinsic " + name + " does not exist!"); }; var getIntrinsic = function GetIntrinsic2(name, allowMissing) { if (typeof name !== "string" || name.length === 0) { throw new $TypeError("intrinsic name must be a non-empty string"); } if (arguments.length > 1 && typeof allowMissing !== "boolean") { throw new $TypeError('"allowMissing" argument must be a boolean'); } if ($exec(/^%?[^%]*%?$/, name) === null) { throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name"); } var parts = stringToPath(name); var intrinsicBaseName = parts.length > 0 ? parts[0] : ""; var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing); var intrinsicRealName = intrinsic.name; var value = intrinsic.value; var skipFurtherCaching = false; var alias = intrinsic.alias; if (alias) { intrinsicBaseName = alias[0]; $spliceApply(parts, $concat([0, 1], alias)); } for (var i = 1, isOwn = true; i < parts.length; i += 1) { var part = parts[i]; var first = $strSlice(part, 0, 1); var last = $strSlice(part, -1); if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { throw new $SyntaxError("property names with quotes must have matching quotes"); } if (part === "constructor" || !isOwn) { skipFurtherCaching = true; } intrinsicBaseName += "." + part; intrinsicRealName = "%" + intrinsicBaseName + "%"; if (hasOwn$1(INTRINSICS, intrinsicRealName)) { value = INTRINSICS[intrinsicRealName]; } else if (value != null) { if (!(part in value)) { if (!allowMissing) { throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available."); } return void 0; } if ($gOPD && i + 1 >= parts.length) { var desc = $gOPD(value, part); isOwn = !!desc; if (isOwn && "get" in desc && !("originalValue" in desc.get)) { value = desc.get; } else { value = value[part]; } } else { isOwn = hasOwn$1(value, part); value = value[part]; } if (isOwn && !skipFurtherCaching) { INTRINSICS[intrinsicRealName] = value; } } } return value; }; var callBind$1 = { exports: {} }; (function(module2) { var bind2 = functionBind; var GetIntrinsic2 = getIntrinsic; var $apply = GetIntrinsic2("%Function.prototype.apply%"); var $call = GetIntrinsic2("%Function.prototype.call%"); var $reflectApply = GetIntrinsic2("%Reflect.apply%", true) || bind2.call($call, $apply); var $gOPD2 = GetIntrinsic2("%Object.getOwnPropertyDescriptor%", true); var $defineProperty = GetIntrinsic2("%Object.defineProperty%", true); var $max = GetIntrinsic2("%Math.max%"); if ($defineProperty) { try { $defineProperty({}, "a", { value: 1 }); } catch (e) { $defineProperty = null; } } module2.exports = function callBind2(originalFunction) { var func = $reflectApply(bind2, $call, arguments); if ($gOPD2 && $defineProperty) { var desc = $gOPD2(func, "length"); if (desc.configurable) { $defineProperty( func, "length", { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } ); } } return func; }; var applyBind = function applyBind2() { return $reflectApply(bind2, $apply, arguments); }; if ($defineProperty) { $defineProperty(module2.exports, "apply", { value: applyBind }); } else { module2.exports.apply = applyBind; } })(callBind$1); var GetIntrinsic$1 = getIntrinsic; var callBind = callBind$1.exports; var $indexOf = callBind(GetIntrinsic$1("String.prototype.indexOf")); var callBound$1 = function callBoundIntrinsic(name, allowMissing) { var intrinsic = GetIntrinsic$1(name, !!allowMissing); if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) { return callBind(intrinsic); } return intrinsic; }; var GetIntrinsic = getIntrinsic; var callBound = callBound$1; GetIntrinsic("%TypeError%"); GetIntrinsic("%WeakMap%", true); GetIntrinsic("%Map%", true); callBound("WeakMap.prototype.get", true); callBound("WeakMap.prototype.set", true); callBound("WeakMap.prototype.has", true); callBound("Map.prototype.get", true); callBound("Map.prototype.set", true); callBound("Map.prototype.has", true); (function() { var array = []; for (var i = 0; i < 256; ++i) { array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase()); } return array; })(); var MILLISECONDS_IN_MINUTE$2 = 6e4; var getTimezoneOffsetInMilliseconds$1 = function getTimezoneOffsetInMilliseconds2(dirtyDate) { var date = new Date(dirtyDate.getTime()); var baseTimezoneOffset = date.getTimezoneOffset(); date.setSeconds(0, 0); var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE$2; return baseTimezoneOffset * MILLISECONDS_IN_MINUTE$2 + millisecondsPartOfTimezoneOffset; }; function isDate$3(argument) { return argument instanceof Date; } var is_date = isDate$3; var getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds$1; var isDate$2 = is_date; var MILLISECONDS_IN_HOUR = 36e5; var MILLISECONDS_IN_MINUTE$1 = 6e4; var DEFAULT_ADDITIONAL_DIGITS = 2; var parseTokenDateTimeDelimeter = /[T ]/; var parseTokenPlainTime = /:/; var parseTokenYY = /^(\d{2})$/; var parseTokensYYY = [ /^([+-]\d{2})$/, /^([+-]\d{3})$/, /^([+-]\d{4})$/ ]; var parseTokenYYYY = /^(\d{4})/; var parseTokensYYYYY = [ /^([+-]\d{4})/, /^([+-]\d{5})/, /^([+-]\d{6})/ ]; var parseTokenMM = /^-(\d{2})$/; var parseTokenDDD = /^-?(\d{3})$/; var parseTokenMMDD = /^-?(\d{2})-?(\d{2})$/; var parseTokenWww = /^-?W(\d{2})$/; var parseTokenWwwD = /^-?W(\d{2})-?(\d{1})$/; var parseTokenHH = /^(\d{2}([.,]\d*)?)$/; var parseTokenHHMM = /^(\d{2}):?(\d{2}([.,]\d*)?)$/; var parseTokenHHMMSS = /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/; var parseTokenTimezone = /([Z+-].*)$/; var parseTokenTimezoneZ = /^(Z)$/; var parseTokenTimezoneHH = /^([+-])(\d{2})$/; var parseTokenTimezoneHHMM = /^([+-])(\d{2}):?(\d{2})$/; function parse$8(argument, dirtyOptions) { if (isDate$2(argument)) { return new Date(argument.getTime()); } else if (typeof argument !== "string") { return new Date(argument); } var options = dirtyOptions || {}; var additionalDigits = options.additionalDigits; if (additionalDigits == null) { additionalDigits = DEFAULT_ADDITIONAL_DIGITS; } else { additionalDigits = Number(additionalDigits); } var dateStrings = splitDateString(argument); var parseYearResult = parseYear(dateStrings.date, additionalDigits); var year = parseYearResult.year; var restDateString = parseYearResult.restDateString; var date = parseDate(restDateString, year); if (date) { var timestamp = date.getTime(); var time = 0; var offset; if (dateStrings.time) { time = parseTime(dateStrings.time); } if (dateStrings.timezone) { offset = parseTimezone(dateStrings.timezone) * MILLISECONDS_IN_MINUTE$1; } else { var fullTime = timestamp + time; var fullTimeDate = new Date(fullTime); offset = getTimezoneOffsetInMilliseconds(fullTimeDate); var fullTimeDateNextDay = new Date(fullTime); fullTimeDateNextDay.setDate(fullTimeDate.getDate() + 1); var offsetDiff = getTimezoneOffsetInMilliseconds(fullTimeDateNextDay) - getTimezoneOffsetInMilliseconds(fullTimeDate); if (offsetDiff > 0) { offset += offsetDiff; } } return new Date(timestamp + time + offset); } else { return new Date(argument); } } function splitDateString(dateString) { var dateStrings = {}; var array = dateString.split(parseTokenDateTimeDelimeter); var timeString; if (parseTokenPlainTime.test(array[0])) { dateStrings.date = null; timeString = array[0]; } else { dateStrings.date = array[0]; timeString = array[1]; } if (timeString) { var token = parseTokenTimezone.exec(timeString); if (token) { dateStrings.time = timeString.replace(token[1], ""); dateStrings.timezone = token[1]; } else { dateStrings.time = timeString; } } return dateStrings; } function parseYear(dateString, additionalDigits) { var parseTokenYYY = parseTokensYYY[additionalDigits]; var parseTokenYYYYY = parseTokensYYYYY[additionalDigits]; var token; token = parseTokenYYYY.exec(dateString) || parseTokenYYYYY.exec(dateString); if (token) { var yearString = token[1]; return { year: parseInt(yearString, 10), restDateString: dateString.slice(yearString.length) }; } token = parseTokenYY.exec(dateString) || parseTokenYYY.exec(dateString); if (token) { var centuryString = token[1]; return { year: parseInt(centuryString, 10) * 100, restDateString: dateString.slice(centuryString.length) }; } return { year: null }; } function parseDate(dateString, year) { if (year === null) { return null; } var token; var date; var month; var week; if (dateString.length === 0) { date = new Date(0); date.setUTCFullYear(year); return date; } token = parseTokenMM.exec(dateString); if (token) { date = new Date(0); month = parseInt(token[1], 10) - 1; date.setUTCFullYear(year, month); return date; } token = parseTokenDDD.exec(dateString); if (token) { date = new Date(0); var dayOfYear = parseInt(token[1], 10); date.setUTCFullYear(year, 0, dayOfYear); return date; } token = parseTokenMMDD.exec(dateString); if (token) { date = new Date(0); month = parseInt(token[1], 10) - 1; var day = parseInt(token[2], 10); date.setUTCFullYear(year, month, day); return date; } token = parseTokenWww.exec(dateString); if (token) { week = parseInt(token[1], 10) - 1; return dayOfISOYear(year, week); } token = parseTokenWwwD.exec(dateString); if (token) { week = parseInt(token[1], 10) - 1; var dayOfWeek = parseInt(token[2], 10) - 1; return dayOfISOYear(year, week, dayOfWeek); } return null; } function parseTime(timeString) { var token; var hours; var minutes; token = parseTokenHH.exec(timeString); if (token) { hours = parseFloat(token[1].replace(",", ".")); return hours % 24 * MILLISECONDS_IN_HOUR; } token = parseTokenHHMM.exec(timeString); if (token) { hours = parseInt(token[1], 10); minutes = parseFloat(token[2].replace(",", ".")); return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1; } token = parseTokenHHMMSS.exec(timeString); if (token) { hours = parseInt(token[1], 10); minutes = parseInt(token[2], 10); var seconds = parseFloat(token[3].replace(",", ".")); return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1 + seconds * 1e3; } return null; } function parseTimezone(timezoneString) { var token; var absoluteOffset; token = parseTokenTimezoneZ.exec(timezoneString); if (token) { return 0; } token = parseTokenTimezoneHH.exec(timezoneString); if (token) { absoluteOffset = parseInt(token[2], 10) * 60; return token[1] === "+" ? -absoluteOffset : absoluteOffset; } token = parseTokenTimezoneHHMM.exec(timezoneString); if (token) { absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10); return token[1] === "+" ? -absoluteOffset : absoluteOffset; } return 0; } function dayOfISOYear(isoYear, week, day) { week = week || 0; day = day || 0; var date = new Date(0); date.setUTCFullYear(isoYear, 0, 4); var fourthOfJanuaryDay = date.getUTCDay() || 7; var diff = week * 7 + day + 1 - fourthOfJanuaryDay; date.setUTCDate(date.getUTCDate() + diff); return date; } var parse_1 = parse$8; var parse$7 = parse_1; function startOfYear$1(dirtyDate) { var cleanDate = parse$7(dirtyDate); var date = new Date(0); date.setFullYear(cleanDate.getFullYear(), 0, 1); date.setHours(0, 0, 0, 0); return date; } var start_of_year = startOfYear$1; var parse$6 = parse_1; function startOfDay$1(dirtyDate) { var date = parse$6(dirtyDate); date.setHours(0, 0, 0, 0); return date; } var start_of_day = startOfDay$1; var startOfDay = start_of_day; var MILLISECONDS_IN_MINUTE = 6e4; var MILLISECONDS_IN_DAY = 864e5; function differenceInCalendarDays$1(dirtyDateLeft, dirtyDateRight) { var startOfDayLeft = startOfDay(dirtyDateLeft); var startOfDayRight = startOfDay(dirtyDateRight); var timestampLeft = startOfDayLeft.getTime() - startOfDayLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE; var timestampRight = startOfDayRight.getTime() - startOfDayRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE; return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY); } var difference_in_calendar_days = differenceInCalendarDays$1; var parse$5 = parse_1; var startOfYear = start_of_year; var differenceInCalendarDays = difference_in_calendar_days; function getDayOfYear$1(dirtyDate) { var date = parse$5(dirtyDate); var diff = differenceInCalendarDays(date, startOfYear(date)); var dayOfYear = diff + 1; return dayOfYear; } var get_day_of_year = getDayOfYear$1; var parse$4 = parse_1; function startOfWeek$1(dirtyDate, dirtyOptions) { var weekStartsOn = dirtyOptions ? Number(dirtyOptions.weekStartsOn) || 0 : 0; var date = parse$4(dirtyDate); var day = date.getDay(); var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; date.setDate(date.getDate() - diff); date.setHours(0, 0, 0, 0); return date; } var start_of_week = startOfWeek$1; var startOfWeek = start_of_week; function startOfISOWeek$3(dirtyDate) { return startOfWeek(dirtyDate, { weekStartsOn: 1 }); } var start_of_iso_week = startOfISOWeek$3; var parse$3 = parse_1; var startOfISOWeek$2 = start_of_iso_week; function getISOYear$2(dirtyDate) { var date = parse$3(dirtyDate); var year = date.getFullYear(); var fourthOfJanuaryOfNextYear = new Date(0); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); var startOfNextYear = startOfISOWeek$2(fourthOfJanuaryOfNextYear); var fourthOfJanuaryOfThisYear = new Date(0); fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); var startOfThisYear = startOfISOWeek$2(fourthOfJanuaryOfThisYear); if (date.getTime() >= startOfNextYear.getTime()) { return year + 1; } else if (date.getTime() >= startOfThisYear.getTime()) { return year; } else { return year - 1; } } var get_iso_year = getISOYear$2; var getISOYear$1 = get_iso_year; var startOfISOWeek$1 = start_of_iso_week; function startOfISOYear$1(dirtyDate) { var year = getISOYear$1(dirtyDate); var fourthOfJanuary = new Date(0); fourthOfJanuary.setFullYear(year, 0, 4); fourthOfJanuary.setHours(0, 0, 0, 0); var date = startOfISOWeek$1(fourthOfJanuary); return date; } var start_of_iso_year = startOfISOYear$1; var parse$2 = parse_1; var startOfISOWeek = start_of_iso_week; var startOfISOYear = start_of_iso_year; var MILLISECONDS_IN_WEEK = 6048e5; function getISOWeek$1(dirtyDate) { var date = parse$2(dirtyDate); var diff = startOfISOWeek(date).getTime() - startOfISOYear(date).getTime(); return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; } var get_iso_week = getISOWeek$1; var isDate$1 = is_date; function isValid$1(dirtyDate) { if (isDate$1(dirtyDate)) { return !isNaN(dirtyDate); } else { throw new TypeError(toString.call(dirtyDate) + " is not an instance of Date"); } } var is_valid = isValid$1; function buildDistanceInWordsLocale$1() { var distanceInWordsLocale = { lessThanXSeconds: { one: "less than a second", other: "less than {{count}} seconds" }, xSeconds: { one: "1 second", other: "{{count}} seconds" }, halfAMinute: "half a minute", lessThanXMinutes: { one: "less than a minute", other: "less than {{count}} minutes" }, xMinutes: { one: "1 minute", other: "{{count}} minutes" }, aboutXHours: { one: "about 1 hour", other: "about {{count}} hours" }, xHours: { one: "1 hour", other: "{{count}} hours" }, xDays: { one: "1 day", other: "{{count}} days" }, aboutXMonths: { one: "about 1 month", other: "about {{count}} months" }, xMonths: { one: "1 month", other: "{{count}} months" }, aboutXYears: { one: "about 1 year", other: "about {{count}} years" }, xYears: { one: "1 year", other: "{{count}} years" }, overXYears: { one: "over 1 year", other: "over {{count}} years" }, almostXYears: { one: "almost 1 year", other: "almost {{count}} years" } }; function localize(token, count, options) { options = options || {}; var result; if (typeof distanceInWordsLocale[token] === "string") { result = distanceInWordsLocale[token]; } else if (count === 1) { result = distanceInWordsLocale[token].one; } else { result = distanceInWordsLocale[token].other.replace("{{count}}", count); } if (options.addSuffix) { if (options.comparison > 0) { return "in " + result; } else { return result + " ago"; } } return result; } return { localize }; } var build_distance_in_words_locale = buildDistanceInWordsLocale$1; var commonFormatterKeys = [ "M", "MM", "Q", "D", "DD", "DDD", "DDDD", "d", "E", "W", "WW", "YY", "YYYY", "GG", "GGGG", "H", "HH", "h", "hh", "m", "mm", "s", "ss", "S", "SS", "SSS", "Z", "ZZ", "X", "x" ]; function buildFormattingTokensRegExp$1(formatters2) { var formatterKeys = []; for (var key in formatters2) { if (formatters2.hasOwnProperty(key)) { formatterKeys.push(key); } } var formattingTokens = commonFormatterKeys.concat(formatterKeys).sort().reverse(); var formattingTokensRegExp = new RegExp( "(\\[[^\\[]*\\])|(\\\\)?(" + formattingTokens.join("|") + "|.)", "g" ); return formattingTokensRegExp; } var build_formatting_tokens_reg_exp = buildFormattingTokensRegExp$1; var buildFormattingTokensRegExp = build_formatting_tokens_reg_exp; function buildFormatLocale$1() { var months3char = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var monthsFull = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var weekdays2char = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]; var weekdays3char = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var weekdaysFull = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var meridiemUppercase = ["AM", "PM"]; var meridiemLowercase = ["am", "pm"]; var meridiemFull = ["a.m.", "p.m."]; var formatters2 = { "MMM": function(date) { return months3char[date.getMonth()]; }, "MMMM": function(date) { return monthsFull[date.getMonth()]; }, "dd": function(date) { return weekdays2char[date.getDay()]; }, "ddd": function(date) { return weekdays3char[date.getDay()]; }, "dddd": function(date) { return weekdaysFull[date.getDay()]; }, "A": function(date) { return date.getHours() / 12 >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]; }, "a": function(date) { return date.getHours() / 12 >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]; }, "aa": function(date) { return date.getHours() / 12 >= 1 ? meridiemFull[1] : meridiemFull[0]; } }; var ordinalFormatters = ["M", "D", "DDD", "d", "Q", "W"]; ordinalFormatters.forEach(function(formatterToken) { formatters2[formatterToken + "o"] = function(date, formatters3) { return ordinal(formatters3[formatterToken](date)); }; }); return { formatters: formatters2, formattingTokensRegExp: buildFormattingTokensRegExp(formatters2) }; } function ordinal(number2) { var rem100 = number2 % 100; if (rem100 > 20 || rem100 < 10) { switch (rem100 % 10) { case 1: return number2 + "st"; case 2: return number2 + "nd"; case 3: return number2 + "rd"; } } return number2 + "th"; } var build_format_locale = buildFormatLocale$1; var buildDistanceInWordsLocale = build_distance_in_words_locale; var buildFormatLocale = build_format_locale; var en = { distanceInWords: buildDistanceInWordsLocale(), format: buildFormatLocale() }; var getDayOfYear = get_day_of_year; var getISOWeek = get_iso_week; var getISOYear = get_iso_year; var parse$1 = parse_1; var isValid = is_valid; var enLocale = en; function format$1(dirtyDate, dirtyFormatStr, dirtyOptions) { var formatStr = dirtyFormatStr ? String(dirtyFormatStr) : "YYYY-MM-DDTHH:mm:ss.SSSZ"; var options = dirtyOptions || {}; var locale = options.locale; var localeFormatters = enLocale.format.formatters; var formattingTokensRegExp = enLocale.format.formattingTokensRegExp; if (locale && locale.format && locale.format.formatters) { localeFormatters = locale.format.formatters; if (locale.format.formattingTokensRegExp) { formattingTokensRegExp = locale.format.formattingTokensRegExp; } } var date = parse$1(dirtyDate); if (!isValid(date)) { return "Invalid Date"; } var formatFn = buildFormatFn(formatStr, localeFormatters, formattingTokensRegExp); return formatFn(date); } var formatters = { "M": function(date) { return date.getMonth() + 1; }, "MM": function(date) { return addLeadingZeros(date.getMonth() + 1, 2); }, "Q": function(date) { return Math.ceil((date.getMonth() + 1) / 3); }, "D": function(date) { return date.getDate(); }, "DD": function(date) { return addLeadingZeros(date.getDate(), 2); }, "DDD": function(date) { return getDayOfYear(date); }, "DDDD": function(date) { return addLeadingZeros(getDayOfYear(date), 3); }, "d": function(date) { return date.getDay(); }, "E": function(date) { return date.getDay() || 7; }, "W": function(date) { return getISOWeek(date); }, "WW": function(date) { return addLeadingZeros(getISOWeek(date), 2); }, "YY": function(date) { return addLeadingZeros(date.getFullYear(), 4).substr(2); }, "YYYY": function(date) { return addLeadingZeros(date.getFullYear(), 4); }, "GG": function(date) { return String(getISOYear(date)).substr(2); }, "GGGG": function(date) { return getISOYear(date); }, "H": function(date) { return date.getHours(); }, "HH": function(date) { return addLeadingZeros(date.getHours(), 2); }, "h": function(date) { var hours = date.getHours(); if (hours === 0) { return 12; } else if (hours > 12) { return hours % 12; } else { return hours; } }, "hh": function(date) { return addLeadingZeros(formatters["h"](date), 2); }, "m": function(date) { return date.getMinutes(); }, "mm": function(date) { return addLeadingZeros(date.getMinutes(), 2); }, "s": function(date) { return date.getSeconds(); }, "ss": function(date) { return addLeadingZeros(date.getSeconds(), 2); }, "S": function(date) { return Math.floor(date.getMilliseconds() / 100); }, "SS": function(date) { return addLeadingZeros(Math.floor(date.getMilliseconds() / 10), 2); }, "SSS": function(date) { return addLeadingZeros(date.getMilliseconds(), 3); }, "Z": function(date) { return formatTimezone(date.getTimezoneOffset(), ":"); }, "ZZ": function(date) { return formatTimezone(date.getTimezoneOffset()); }, "X": function(date) { return Math.floor(date.getTime() / 1e3); }, "x": function(date) { return date.getTime(); } }; function buildFormatFn(formatStr, localeFormatters, formattingTokensRegExp) { var array = formatStr.match(formattingTokensRegExp); var length = array.length; var i; var formatter; for (i = 0; i < length; i++) { formatter = localeFormatters[array[i]] || formatters[array[i]]; if (formatter) { array[i] = formatter; } else { array[i] = removeFormattingTokens(array[i]); } } return function(date) { var output = ""; for (var i2 = 0; i2 < length; i2++) { if (array[i2] instanceof Function) { output += array[i2](date, formatters); } else { output += array[i2]; } } return output; }; } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/)) { return input.replace(/^\[|]$/g, ""); } return input.replace(/\\/g, ""); } function formatTimezone(offset, delimeter) { delimeter = delimeter || ""; var sign = offset > 0 ? "-" : "+"; var absOffset = Math.abs(offset); var hours = Math.floor(absOffset / 60); var minutes = absOffset % 60; return sign + addLeadingZeros(hours, 2) + delimeter + addLeadingZeros(minutes, 2); } function addLeadingZeros(number2, targetLength) { var output = Math.abs(number2).toString(); while (output.length < targetLength) { output = "0" + output; } return output; } var format_1 = format$1; const formatDateTime = (str) => { const dateTime = format_1(str, "YYYY-MM-DD HH:mm:ss"); return dateTime; }; const getCleanURL = (fullURL) => { const noHash = fullURL.split("#")[0] || ""; const cleanURL = noHash.split("?")[0] || ""; return cleanURL; }; /*! * shared v9.2.2 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const inBrowser = typeof window !== "undefined"; let mark; let measure; if (process.env.NODE_ENV !== "production") { const perf2 = inBrowser && window.performance; if (perf2 && perf2.mark && perf2.measure && perf2.clearMarks && perf2.clearMeasures) { mark = (tag) => perf2.mark(tag); measure = (name, startTag, endTag) => { perf2.measure(name, startTag, endTag); perf2.clearMarks(startTag); perf2.clearMarks(endTag); }; } } const RE_ARGS = /\{([0-9a-zA-Z]+)\}/g; function format(message, ...args) { if (args.length === 1 && isObject(args[0])) { args = args[0]; } if (!args || !args.hasOwnProperty) { args = {}; } return message.replace(RE_ARGS, (match, identifier) => { return args.hasOwnProperty(identifier) ? args[identifier] : ""; }); } const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol"; const makeSymbol = (name) => hasSymbol ? Symbol(name) : name; const generateFormatCacheKey = (locale, key, source) => friendlyJSONstringify({ l: locale, k: key, s: source }); const friendlyJSONstringify = (json) => JSON.stringify(json).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\u0027/g, "\\u0027"); const isNumber = (val) => typeof val === "number" && isFinite(val); const isDate = (val) => toTypeString(val) === "[object Date]"; const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; const isEmptyObject = (val) => isPlainObject(val) && Object.keys(val).length === 0; function warn(msg, err) { if (typeof console !== "undefined") { console.warn(`[intlify] ` + msg); if (err) { console.warn(err.stack); } } } const assign = Object.assign; let _globalThis; const getGlobalThis = () => { return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); }; function escapeHtml(rawText) { return rawText.replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); } const hasOwnProperty = Object.prototype.hasOwnProperty; function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); } const isArray = Array.isArray; const isFunction = (val) => typeof val === "function"; const isString = (val) => typeof val === "string"; const isBoolean = (val) => typeof val === "boolean"; const isObject = (val) => val !== null && typeof val === "object"; const objectToString = Object.prototype.toString; const toTypeString = (value) => objectToString.call(value); const isPlainObject = (val) => toTypeString(val) === "[object Object]"; const toDisplayString = (val) => { return val == null ? "" : isArray(val) || isPlainObject(val) && val.toString === objectToString ? JSON.stringify(val, null, 2) : String(val); }; const RANGE = 2; function generateCodeFrame(source, start = 0, end = source.length) { const lines = source.split(/\r?\n/); let count = 0; const res = []; for (let i = 0; i < lines.length; i++) { count += lines[i].length + 1; if (count >= start) { for (let j = i - RANGE; j <= i + RANGE || end > count; j++) { if (j < 0 || j >= lines.length) continue; const line = j + 1; res.push(`${line}${" ".repeat(3 - String(line).length)}| ${lines[j]}`); const lineLength = lines[j].length; if (j === i) { const pad = start - (count - lineLength) + 1; const length = Math.max(1, end > count ? lineLength - pad : end - start); res.push(` | ` + " ".repeat(pad) + "^".repeat(length)); } else if (j > i) { if (end > count) { const length = Math.max(Math.min(end - count, lineLength), 1); res.push(` | ` + "^".repeat(length)); } count += lineLength + 1; } } break; } } return res.join("\n"); } function createEmitter() { const events = /* @__PURE__ */ new Map(); const emitter = { events, on(event, handler) { const handlers = events.get(event); const added = handlers && handlers.push(handler); if (!added) { events.set(event, [handler]); } }, off(event, handler) { const handlers = events.get(event); if (handlers) { handlers.splice(handlers.indexOf(handler) >>> 0, 1); } }, emit(event, payload) { (events.get(event) || []).slice().map((handler) => handler(payload)); (events.get("*") || []).slice().map((handler) => handler(event, payload)); } }; return emitter; } /*! * message-compiler v9.2.2 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const CompileErrorCodes = { EXPECTED_TOKEN: 1, INVALID_TOKEN_IN_PLACEHOLDER: 2, UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3, UNKNOWN_ESCAPE_SEQUENCE: 4, INVALID_UNICODE_ESCAPE_SEQUENCE: 5, UNBALANCED_CLOSING_BRACE: 6, UNTERMINATED_CLOSING_BRACE: 7, EMPTY_PLACEHOLDER: 8, NOT_ALLOW_NEST_PLACEHOLDER: 9, INVALID_LINKED_FORMAT: 10, MUST_HAVE_MESSAGES_IN_PLURAL: 11, UNEXPECTED_EMPTY_LINKED_MODIFIER: 12, UNEXPECTED_EMPTY_LINKED_KEY: 13, UNEXPECTED_LEXICAL_ANALYSIS: 14, __EXTEND_POINT__: 15 }; const errorMessages$2 = { [CompileErrorCodes.EXPECTED_TOKEN]: `Expected token: '{0}'`, [CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]: `Invalid token in placeholder: '{0}'`, [CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]: `Unterminated single quote in placeholder`, [CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]: `Unknown escape sequence: \\{0}`, [CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]: `Invalid unicode escape sequence: {0}`, [CompileErrorCodes.UNBALANCED_CLOSING_BRACE]: `Unbalanced closing brace`, [CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]: `Unterminated closing brace`, [CompileErrorCodes.EMPTY_PLACEHOLDER]: `Empty placeholder`, [CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]: `Not allowed nest placeholder`, [CompileErrorCodes.INVALID_LINKED_FORMAT]: `Invalid linked format`, [CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]: `Plural must have messages`, [CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]: `Unexpected empty linked modifier`, [CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]: `Unexpected empty linked key`, [CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]: `Unexpected lexical analysis in token: '{0}'` }; function createCompileError(code2, loc, options = {}) { const { domain, messages: messages2, args } = options; const msg = process.env.NODE_ENV !== "production" ? format((messages2 || errorMessages$2)[code2] || "", ...args || []) : code2; const error = new SyntaxError(String(msg)); error.code = code2; if (loc) { error.location = loc; } error.domain = domain; return error; } function defaultOnError(error) { throw error; } function createPosition(line, column, offset) { return { line, column, offset }; } function createLocation(start, end, source) { const loc = { start, end }; if (source != null) { loc.source = source; } return loc; } const CHAR_SP = " "; const CHAR_CR = "\r"; const CHAR_LF = "\n"; const CHAR_LS = String.fromCharCode(8232); const CHAR_PS = String.fromCharCode(8233); function createScanner(str) { const _buf = str; let _index = 0; let _line = 1; let _column = 1; let _peekOffset = 0; const isCRLF = (index3) => _buf[index3] === CHAR_CR && _buf[index3 + 1] === CHAR_LF; const isLF = (index3) => _buf[index3] === CHAR_LF; const isPS = (index3) => _buf[index3] === CHAR_PS; const isLS = (index3) => _buf[index3] === CHAR_LS; const isLineEnd = (index3) => isCRLF(index3) || isLF(index3) || isPS(index3) || isLS(index3); const index2 = () => _index; const line = () => _line; const column = () => _column; const peekOffset = () => _peekOffset; const charAt = (offset) => isCRLF(offset) || isPS(offset) || isLS(offset) ? CHAR_LF : _buf[offset]; const currentChar = () => charAt(_index); const currentPeek = () => charAt(_index + _peekOffset); function next() { _peekOffset = 0; if (isLineEnd(_index)) { _line++; _column = 0; } if (isCRLF(_index)) { _index++; } _index++; _column++; return _buf[_index]; } function peek() { if (isCRLF(_index + _peekOffset)) { _peekOffset++; } _peekOffset++; return _buf[_index + _peekOffset]; } function reset() { _index = 0; _line = 1; _column = 1; _peekOffset = 0; } function resetPeek(offset = 0) { _peekOffset = offset; } function skipToPeek() { const target = _index + _peekOffset; while (target !== _index) { next(); } _peekOffset = 0; } return { index: index2, line, column, peekOffset, charAt, currentChar, currentPeek, next, peek, reset, resetPeek, skipToPeek }; } const EOF = void 0; const LITERAL_DELIMITER = "'"; const ERROR_DOMAIN$1 = "tokenizer"; function createTokenizer(source, options = {}) { const location = options.location !== false; const _scnr = createScanner(source); const currentOffset = () => _scnr.index(); const currentPosition = () => createPosition(_scnr.line(), _scnr.column(), _scnr.index()); const _initLoc = currentPosition(); const _initOffset = currentOffset(); const _context = { currentType: 14, offset: _initOffset, startLoc: _initLoc, endLoc: _initLoc, lastType: 14, lastOffset: _initOffset, lastStartLoc: _initLoc, lastEndLoc: _initLoc, braceNest: 0, inLinked: false, text: "" }; const context = () => _context; const { onError } = options; function emitError(code2, pos, offset, ...args) { const ctx = context(); pos.column += offset; pos.offset += offset; if (onError) { const loc = createLocation(ctx.startLoc, pos); const err = createCompileError(code2, loc, { domain: ERROR_DOMAIN$1, args }); onError(err); } } function getToken(context2, type, value) { context2.endLoc = currentPosition(); context2.currentType = type; const token = { type }; if (location) { token.loc = createLocation(context2.startLoc, context2.endLoc); } if (value != null) { token.value = value; } return token; } const getEndToken = (context2) => getToken(context2, 14); function eat(scnr, ch) { if (scnr.currentChar() === ch) { scnr.next(); return ch; } else { emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch); return ""; } } function peekSpaces(scnr) { let buf = ""; while (scnr.currentPeek() === CHAR_SP || scnr.currentPeek() === CHAR_LF) { buf += scnr.currentPeek(); scnr.peek(); } return buf; } function skipSpaces(scnr) { const buf = peekSpaces(scnr); scnr.skipToPeek(); return buf; } function isIdentifierStart(ch) { if (ch === EOF) { return false; } const cc = ch.charCodeAt(0); return cc >= 97 && cc <= 122 || cc >= 65 && cc <= 90 || cc === 95; } function isNumberStart(ch) { if (ch === EOF) { return false; } const cc = ch.charCodeAt(0); return cc >= 48 && cc <= 57; } function isNamedIdentifierStart(scnr, context2) { const { currentType } = context2; if (currentType !== 2) { return false; } peekSpaces(scnr); const ret = isIdentifierStart(scnr.currentPeek()); scnr.resetPeek(); return ret; } function isListIdentifierStart(scnr, context2) { const { currentType } = context2; if (currentType !== 2) { return false; } peekSpaces(scnr); const ch = scnr.currentPeek() === "-" ? scnr.peek() : scnr.currentPeek(); const ret = isNumberStart(ch); scnr.resetPeek(); return ret; } function isLiteralStart(scnr, context2) { const { currentType } = context2; if (currentType !== 2) { return false; } peekSpaces(scnr); const ret = scnr.currentPeek() === LITERAL_DELIMITER; scnr.resetPeek(); return ret; } function isLinkedDotStart(scnr, context2) { const { currentType } = context2; if (currentType !== 8) { return false; } peekSpaces(scnr); const ret = scnr.currentPeek() === "."; scnr.resetPeek(); return ret; } function isLinkedModifierStart(scnr, context2) { const { currentType } = context2; if (currentType !== 9) { return false; } peekSpaces(scnr); const ret = isIdentifierStart(scnr.currentPeek()); scnr.resetPeek(); return ret; } function isLinkedDelimiterStart(scnr, context2) { const { currentType } = context2; if (!(currentType === 8 || currentType === 12)) { return false; } peekSpaces(scnr); const ret = scnr.currentPeek() === ":"; scnr.resetPeek(); return ret; } function isLinkedReferStart(scnr, context2) { const { currentType } = context2; if (currentType !== 10) { return false; } const fn = () => { const ch = scnr.currentPeek(); if (ch === "{") { return isIdentifierStart(scnr.peek()); } else if (ch === "@" || ch === "%" || ch === "|" || ch === ":" || ch === "." || ch === CHAR_SP || !ch) { return false; } else if (ch === CHAR_LF) { scnr.peek(); return fn(); } else { return isIdentifierStart(ch); } }; const ret = fn(); scnr.resetPeek(); return ret; } function isPluralStart(scnr) { peekSpaces(scnr); const ret = scnr.currentPeek() === "|"; scnr.resetPeek(); return ret; } function detectModuloStart(scnr) { const spaces = peekSpaces(scnr); const ret = scnr.currentPeek() === "%" && scnr.peek() === "{"; scnr.resetPeek(); return { isModulo: ret, hasSpace: spaces.length > 0 }; } function isTextStart(scnr, reset = true) { const fn = (hasSpace = false, prev = "", detectModulo = false) => { const ch = scnr.currentPeek(); if (ch === "{") { return prev === "%" ? false : hasSpace; } else if (ch === "@" || !ch) { return prev === "%" ? true : hasSpace; } else if (ch === "%") { scnr.peek(); return fn(hasSpace, "%", true); } else if (ch === "|") { return prev === "%" || detectModulo ? true : !(prev === CHAR_SP || prev === CHAR_LF); } else if (ch === CHAR_SP) { scnr.peek(); return fn(true, CHAR_SP, detectModulo); } else if (ch === CHAR_LF) { scnr.peek(); return fn(true, CHAR_LF, detectModulo); } else { return true; } }; const ret = fn(); reset && scnr.resetPeek(); return ret; } function takeChar(scnr, fn) { const ch = scnr.currentChar(); if (ch === EOF) { return EOF; } if (fn(ch)) { scnr.next(); return ch; } return null; } function takeIdentifierChar(scnr) { const closure = (ch) => { const cc = ch.charCodeAt(0); return cc >= 97 && cc <= 122 || cc >= 65 && cc <= 90 || cc >= 48 && cc <= 57 || cc === 95 || cc === 36; }; return takeChar(scnr, closure); } function takeDigit(scnr) { const closure = (ch) => { const cc = ch.charCodeAt(0); return cc >= 48 && cc <= 57; }; return takeChar(scnr, closure); } function takeHexDigit(scnr) { const closure = (ch) => { const cc = ch.charCodeAt(0); return cc >= 48 && cc <= 57 || cc >= 65 && cc <= 70 || cc >= 97 && cc <= 102; }; return takeChar(scnr, closure); } function getDigits(scnr) { let ch = ""; let num = ""; while (ch = takeDigit(scnr)) { num += ch; } return num; } function readModulo(scnr) { skipSpaces(scnr); const ch = scnr.currentChar(); if (ch !== "%") { emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch); } scnr.next(); return "%"; } function readText(scnr) { let buf = ""; while (true) { const ch = scnr.currentChar(); if (ch === "{" || ch === "}" || ch === "@" || ch === "|" || !ch) { break; } else if (ch === "%") { if (isTextStart(scnr)) { buf += ch; scnr.next(); } else { break; } } else if (ch === CHAR_SP || ch === CHAR_LF) { if (isTextStart(scnr)) { buf += ch; scnr.next(); } else if (isPluralStart(scnr)) { break; } else { buf += ch; scnr.next(); } } else { buf += ch; scnr.next(); } } return buf; } function readNamedIdentifier(scnr) { skipSpaces(scnr); let ch = ""; let name = ""; while (ch = takeIdentifierChar(scnr)) { name += ch; } if (scnr.currentChar() === EOF) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); } return name; } function readListIdentifier(scnr) { skipSpaces(scnr); let value = ""; if (scnr.currentChar() === "-") { scnr.next(); value += `-${getDigits(scnr)}`; } else { value += getDigits(scnr); } if (scnr.currentChar() === EOF) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); } return value; } function readLiteral(scnr) { skipSpaces(scnr); eat(scnr, `'`); let ch = ""; let literal = ""; const fn = (x) => x !== LITERAL_DELIMITER && x !== CHAR_LF; while (ch = takeChar(scnr, fn)) { if (ch === "\\") { literal += readEscapeSequence(scnr); } else { literal += ch; } } const current = scnr.currentChar(); if (current === CHAR_LF || current === EOF) { emitError(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, currentPosition(), 0); if (current === CHAR_LF) { scnr.next(); eat(scnr, `'`); } return literal; } eat(scnr, `'`); return literal; } function readEscapeSequence(scnr) { const ch = scnr.currentChar(); switch (ch) { case "\\": case `'`: scnr.next(); return `\\${ch}`; case "u": return readUnicodeEscapeSequence(scnr, ch, 4); case "U": return readUnicodeEscapeSequence(scnr, ch, 6); default: emitError(CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE, currentPosition(), 0, ch); return ""; } } function readUnicodeEscapeSequence(scnr, unicode, digits) { eat(scnr, unicode); let sequence = ""; for (let i = 0; i < digits; i++) { const ch = takeHexDigit(scnr); if (!ch) { emitError(CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE, currentPosition(), 0, `\\${unicode}${sequence}${scnr.currentChar()}`); break; } sequence += ch; } return `\\${unicode}${sequence}`; } function readInvalidIdentifier(scnr) { skipSpaces(scnr); let ch = ""; let identifiers = ""; const closure = (ch2) => ch2 !== "{" && ch2 !== "}" && ch2 !== CHAR_SP && ch2 !== CHAR_LF; while (ch = takeChar(scnr, closure)) { identifiers += ch; } return identifiers; } function readLinkedModifier(scnr) { let ch = ""; let name = ""; while (ch = takeIdentifierChar(scnr)) { name += ch; } return name; } function readLinkedRefer(scnr) { const fn = (detect = false, buf) => { const ch = scnr.currentChar(); if (ch === "{" || ch === "%" || ch === "@" || ch === "|" || !ch) { return buf; } else if (ch === CHAR_SP) { return buf; } else if (ch === CHAR_LF) { buf += ch; scnr.next(); return fn(detect, buf); } else { buf += ch; scnr.next(); return fn(true, buf); } }; return fn(false, ""); } function readPlural(scnr) { skipSpaces(scnr); const plural = eat(scnr, "|"); skipSpaces(scnr); return plural; } function readTokenInPlaceholder(scnr, context2) { let token = null; const ch = scnr.currentChar(); switch (ch) { case "{": if (context2.braceNest >= 1) { emitError(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER, currentPosition(), 0); } scnr.next(); token = getToken(context2, 2, "{"); skipSpaces(scnr); context2.braceNest++; return token; case "}": if (context2.braceNest > 0 && context2.currentType === 2) { emitError(CompileErrorCodes.EMPTY_PLACEHOLDER, currentPosition(), 0); } scnr.next(); token = getToken(context2, 3, "}"); context2.braceNest--; context2.braceNest > 0 && skipSpaces(scnr); if (context2.inLinked && context2.braceNest === 0) { context2.inLinked = false; } return token; case "@": if (context2.braceNest > 0) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); } token = readTokenInLinked(scnr, context2) || getEndToken(context2); context2.braceNest = 0; return token; default: let validNamedIdentifier = true; let validListIdentifier = true; let validLiteral = true; if (isPluralStart(scnr)) { if (context2.braceNest > 0) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); } token = getToken(context2, 1, readPlural(scnr)); context2.braceNest = 0; context2.inLinked = false; return token; } if (context2.braceNest > 0 && (context2.currentType === 5 || context2.currentType === 6 || context2.currentType === 7)) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); context2.braceNest = 0; return readToken(scnr, context2); } if (validNamedIdentifier = isNamedIdentifierStart(scnr, context2)) { token = getToken(context2, 5, readNamedIdentifier(scnr)); skipSpaces(scnr); return token; } if (validListIdentifier = isListIdentifierStart(scnr, context2)) { token = getToken(context2, 6, readListIdentifier(scnr)); skipSpaces(scnr); return token; } if (validLiteral = isLiteralStart(scnr, context2)) { token = getToken(context2, 7, readLiteral(scnr)); skipSpaces(scnr); return token; } if (!validNamedIdentifier && !validListIdentifier && !validLiteral) { token = getToken(context2, 13, readInvalidIdentifier(scnr)); emitError(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER, currentPosition(), 0, token.value); skipSpaces(scnr); return token; } break; } return token; } function readTokenInLinked(scnr, context2) { const { currentType } = context2; let token = null; const ch = scnr.currentChar(); if ((currentType === 8 || currentType === 9 || currentType === 12 || currentType === 10) && (ch === CHAR_LF || ch === CHAR_SP)) { emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0); } switch (ch) { case "@": scnr.next(); token = getToken(context2, 8, "@"); context2.inLinked = true; return token; case ".": skipSpaces(scnr); scnr.next(); return getToken(context2, 9, "."); case ":": skipSpaces(scnr); scnr.next(); return getToken(context2, 10, ":"); default: if (isPluralStart(scnr)) { token = getToken(context2, 1, readPlural(scnr)); context2.braceNest = 0; context2.inLinked = false; return token; } if (isLinkedDotStart(scnr, context2) || isLinkedDelimiterStart(scnr, context2)) { skipSpaces(scnr); return readTokenInLinked(scnr, context2); } if (isLinkedModifierStart(scnr, context2)) { skipSpaces(scnr); return getToken(context2, 12, readLinkedModifier(scnr)); } if (isLinkedReferStart(scnr, context2)) { skipSpaces(scnr); if (ch === "{") { return readTokenInPlaceholder(scnr, context2) || token; } else { return getToken(context2, 11, readLinkedRefer(scnr)); } } if (currentType === 8) { emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0); } context2.braceNest = 0; context2.inLinked = false; return readToken(scnr, context2); } } function readToken(scnr, context2) { let token = { type: 14 }; if (context2.braceNest > 0) { return readTokenInPlaceholder(scnr, context2) || getEndToken(context2); } if (context2.inLinked) { return readTokenInLinked(scnr, context2) || getEndToken(context2); } const ch = scnr.currentChar(); switch (ch) { case "{": return readTokenInPlaceholder(scnr, context2) || getEndToken(context2); case "}": emitError(CompileErrorCodes.UNBALANCED_CLOSING_BRACE, currentPosition(), 0); scnr.next(); return getToken(context2, 3, "}"); case "@": return readTokenInLinked(scnr, context2) || getEndToken(context2); default: if (isPluralStart(scnr)) { token = getToken(context2, 1, readPlural(scnr)); context2.braceNest = 0; context2.inLinked = false; return token; } const { isModulo, hasSpace } = detectModuloStart(scnr); if (isModulo) { return hasSpace ? getToken(context2, 0, readText(scnr)) : getToken(context2, 4, readModulo(scnr)); } if (isTextStart(scnr)) { return getToken(context2, 0, readText(scnr)); } break; } return token; } function nextToken() { const { currentType, offset, startLoc, endLoc } = _context; _context.lastType = currentType; _context.lastOffset = offset; _context.lastStartLoc = startLoc; _context.lastEndLoc = endLoc; _context.offset = currentOffset(); _context.startLoc = currentPosition(); if (_scnr.currentChar() === EOF) { return getToken(_context, 14); } return readToken(_scnr, _context); } return { nextToken, currentOffset, currentPosition, context }; } const ERROR_DOMAIN = "parser"; const KNOWN_ESCAPES = /(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g; function fromEscapeSequence(match, codePoint4, codePoint6) { switch (match) { case `\\\\`: return `\\`; case `\\'`: return `'`; default: { const codePoint = parseInt(codePoint4 || codePoint6, 16); if (codePoint <= 55295 || codePoint >= 57344) { return String.fromCodePoint(codePoint); } return "\uFFFD"; } } } function createParser(options = {}) { const location = options.location !== false; const { onError } = options; function emitError(tokenzer, code2, start, offset, ...args) { const end = tokenzer.currentPosition(); end.offset += offset; end.column += offset; if (onError) { const loc = createLocation(start, end); const err = createCompileError(code2, loc, { domain: ERROR_DOMAIN, args }); onError(err); } } function startNode(type, offset, loc) { const node = { type, start: offset, end: offset }; if (location) { node.loc = { start: loc, end: loc }; } return node; } function endNode(node, offset, pos, type) { node.end = offset; if (type) { node.type = type; } if (location && node.loc) { node.loc.end = pos; } } function parseText(tokenizer, value) { const context = tokenizer.context(); const node = startNode(3, context.offset, context.startLoc); node.value = value; endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } function parseList(tokenizer, index2) { const context = tokenizer.context(); const { lastOffset: offset, lastStartLoc: loc } = context; const node = startNode(5, offset, loc); node.index = parseInt(index2, 10); tokenizer.nextToken(); endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } function parseNamed(tokenizer, key) { const context = tokenizer.context(); const { lastOffset: offset, lastStartLoc: loc } = context; const node = startNode(4, offset, loc); node.key = key; tokenizer.nextToken(); endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } function parseLiteral(tokenizer, value) { const context = tokenizer.context(); const { lastOffset: offset, lastStartLoc: loc } = context; const node = startNode(9, offset, loc); node.value = value.replace(KNOWN_ESCAPES, fromEscapeSequence); tokenizer.nextToken(); endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } function parseLinkedModifier(tokenizer) { const token = tokenizer.nextToken(); const context = tokenizer.context(); const { lastOffset: offset, lastStartLoc: loc } = context; const node = startNode(8, offset, loc); if (token.type !== 12) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER, context.lastStartLoc, 0); node.value = ""; endNode(node, offset, loc); return { nextConsumeToken: token, node }; } if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } node.value = token.value || ""; endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return { node }; } function parseLinkedKey(tokenizer, value) { const context = tokenizer.context(); const node = startNode(7, context.offset, context.startLoc); node.value = value; endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } function parseLinked(tokenizer) { const context = tokenizer.context(); const linkedNode = startNode(6, context.offset, context.startLoc); let token = tokenizer.nextToken(); if (token.type === 9) { const parsed = parseLinkedModifier(tokenizer); linkedNode.modifier = parsed.node; token = parsed.nextConsumeToken || tokenizer.nextToken(); } if (token.type !== 10) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } token = tokenizer.nextToken(); if (token.type === 2) { token = tokenizer.nextToken(); } switch (token.type) { case 11: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } linkedNode.key = parseLinkedKey(tokenizer, token.value || ""); break; case 5: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } linkedNode.key = parseNamed(tokenizer, token.value || ""); break; case 6: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } linkedNode.key = parseList(tokenizer, token.value || ""); break; case 7: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } linkedNode.key = parseLiteral(tokenizer, token.value || ""); break; default: emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY, context.lastStartLoc, 0); const nextContext = tokenizer.context(); const emptyLinkedKeyNode = startNode(7, nextContext.offset, nextContext.startLoc); emptyLinkedKeyNode.value = ""; endNode(emptyLinkedKeyNode, nextContext.offset, nextContext.startLoc); linkedNode.key = emptyLinkedKeyNode; endNode(linkedNode, nextContext.offset, nextContext.startLoc); return { nextConsumeToken: token, node: linkedNode }; } endNode(linkedNode, tokenizer.currentOffset(), tokenizer.currentPosition()); return { node: linkedNode }; } function parseMessage(tokenizer) { const context = tokenizer.context(); const startOffset = context.currentType === 1 ? tokenizer.currentOffset() : context.offset; const startLoc = context.currentType === 1 ? context.endLoc : context.startLoc; const node = startNode(2, startOffset, startLoc); node.items = []; let nextToken = null; do { const token = nextToken || tokenizer.nextToken(); nextToken = null; switch (token.type) { case 0: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } node.items.push(parseText(tokenizer, token.value || "")); break; case 6: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } node.items.push(parseList(tokenizer, token.value || "")); break; case 5: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } node.items.push(parseNamed(tokenizer, token.value || "")); break; case 7: if (token.value == null) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token)); } node.items.push(parseLiteral(tokenizer, token.value || "")); break; case 8: const parsed = parseLinked(tokenizer); node.items.push(parsed.node); nextToken = parsed.nextConsumeToken || null; break; } } while (context.currentType !== 14 && context.currentType !== 1); const endOffset = context.currentType === 1 ? context.lastOffset : tokenizer.currentOffset(); const endLoc = context.currentType === 1 ? context.lastEndLoc : tokenizer.currentPosition(); endNode(node, endOffset, endLoc); return node; } function parsePlural(tokenizer, offset, loc, msgNode) { const context = tokenizer.context(); let hasEmptyMessage = msgNode.items.length === 0; const node = startNode(1, offset, loc); node.cases = []; node.cases.push(msgNode); do { const msg = parseMessage(tokenizer); if (!hasEmptyMessage) { hasEmptyMessage = msg.items.length === 0; } node.cases.push(msg); } while (context.currentType !== 14); if (hasEmptyMessage) { emitError(tokenizer, CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL, loc, 0); } endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } function parseResource(tokenizer) { const context = tokenizer.context(); const { offset, startLoc } = context; const msgNode = parseMessage(tokenizer); if (context.currentType === 14) { return msgNode; } else { return parsePlural(tokenizer, offset, startLoc, msgNode); } } function parse2(source) { const tokenizer = createTokenizer(source, assign({}, options)); const context = tokenizer.context(); const node = startNode(0, context.offset, context.startLoc); if (location && node.loc) { node.loc.source = source; } node.body = parseResource(tokenizer); if (context.currentType !== 14) { emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, source[context.offset] || ""); } endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition()); return node; } return { parse: parse2 }; } function getTokenCaption(token) { if (token.type === 14) { return "EOF"; } const name = (token.value || "").replace(/\r?\n/gu, "\\n"); return name.length > 10 ? name.slice(0, 9) + "\u2026" : name; } function createTransformer(ast, options = {}) { const _context = { ast, helpers: /* @__PURE__ */ new Set() }; const context = () => _context; const helper = (name) => { _context.helpers.add(name); return name; }; return { context, helper }; } function traverseNodes(nodes, transformer) { for (let i = 0; i < nodes.length; i++) { traverseNode(nodes[i], transformer); } } function traverseNode(node, transformer) { switch (node.type) { case 1: traverseNodes(node.cases, transformer); transformer.helper("plural"); break; case 2: traverseNodes(node.items, transformer); break; case 6: const linked = node; traverseNode(linked.key, transformer); transformer.helper("linked"); transformer.helper("type"); break; case 5: transformer.helper("interpolate"); transformer.helper("list"); break; case 4: transformer.helper("interpolate"); transformer.helper("named"); break; } } function transform(ast, options = {}) { const transformer = createTransformer(ast); transformer.helper("normalize"); ast.body && traverseNode(ast.body, transformer); const context = transformer.context(); ast.helpers = Array.from(context.helpers); } function createCodeGenerator(ast, options) { const { sourceMap, filename, breakLineCode, needIndent: _needIndent } = options; const _context = { source: ast.loc.source, filename, code: "", column: 1, line: 1, offset: 0, map: void 0, breakLineCode, needIndent: _needIndent, indentLevel: 0 }; const context = () => _context; function push(code2, node) { _context.code += code2; } function _newline(n, withBreakLine = true) { const _breakLineCode = withBreakLine ? breakLineCode : ""; push(_needIndent ? _breakLineCode + ` `.repeat(n) : _breakLineCode); } function indent(withNewLine = true) { const level = ++_context.indentLevel; withNewLine && _newline(level); } function deindent(withNewLine = true) { const level = --_context.indentLevel; withNewLine && _newline(level); } function newline() { _newline(_context.indentLevel); } const helper = (key) => `_${key}`; const needIndent = () => _context.needIndent; return { context, push, indent, deindent, newline, helper, needIndent }; } function generateLinkedNode(generator, node) { const { helper } = generator; generator.push(`${helper("linked")}(`); generateNode(generator, node.key); if (node.modifier) { generator.push(`, `); generateNode(generator, node.modifier); generator.push(`, _type`); } else { generator.push(`, undefined, _type`); } generator.push(`)`); } function generateMessageNode(generator, node) { const { helper, needIndent } = generator; generator.push(`${helper("normalize")}([`); generator.indent(needIndent()); const length = node.items.length; for (let i = 0; i < length; i++) { generateNode(generator, node.items[i]); if (i === length - 1) { break; } generator.push(", "); } generator.deindent(needIndent()); generator.push("])"); } function generatePluralNode(generator, node) { const { helper, needIndent } = generator; if (node.cases.length > 1) { generator.push(`${helper("plural")}([`); generator.indent(needIndent()); const length = node.cases.length; for (let i = 0; i < length; i++) { generateNode(generator, node.cases[i]); if (i === length - 1) { break; } generator.push(", "); } generator.deindent(needIndent()); generator.push(`])`); } } function generateResource(generator, node) { if (node.body) { generateNode(generator, node.body); } else { generator.push("null"); } } function generateNode(generator, node) { const { helper } = generator; switch (node.type) { case 0: generateResource(generator, node); break; case 1: generatePluralNode(generator, node); break; case 2: generateMessageNode(generator, node); break; case 6: generateLinkedNode(generator, node); break; case 8: generator.push(JSON.stringify(node.value), node); break; case 7: generator.push(JSON.stringify(node.value), node); break; case 5: generator.push(`${helper("interpolate")}(${helper("list")}(${node.index}))`, node); break; case 4: generator.push(`${helper("interpolate")}(${helper("named")}(${JSON.stringify(node.key)}))`, node); break; case 9: generator.push(JSON.stringify(node.value), node); break; case 3: generator.push(JSON.stringify(node.value), node); break; default: if (process.env.NODE_ENV !== "production") { throw new Error(`unhandled codegen node type: ${node.type}`); } } } const generate = (ast, options = {}) => { const mode = isString(options.mode) ? options.mode : "normal"; const filename = isString(options.filename) ? options.filename : "message.intl"; const sourceMap = !!options.sourceMap; const breakLineCode = options.breakLineCode != null ? options.breakLineCode : mode === "arrow" ? ";" : "\n"; const needIndent = options.needIndent ? options.needIndent : mode !== "arrow"; const helpers = ast.helpers || []; const generator = createCodeGenerator(ast, { mode, filename, sourceMap, breakLineCode, needIndent }); generator.push(mode === "normal" ? `function __msg__ (ctx) {` : `(ctx) => {`); generator.indent(needIndent); if (helpers.length > 0) { generator.push(`const { ${helpers.map((s) => `${s}: _${s}`).join(", ")} } = ctx`); generator.newline(); } generator.push(`return `); generateNode(generator, ast); generator.deindent(needIndent); generator.push(`}`); const { code: code2, map } = generator.context(); return { ast, code: code2, map: map ? map.toJSON() : void 0 }; }; function baseCompile(source, options = {}) { const assignedOptions = assign({}, options); const parser = createParser(assignedOptions); const ast = parser.parse(source); transform(ast, assignedOptions); return generate(ast, assignedOptions); } /*! * devtools-if v9.2.2 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const IntlifyDevToolsHooks = { I18nInit: "i18n:init", FunctionTranslate: "function:translate" }; /*! * core-base v9.2.2 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const pathStateMachine = []; pathStateMachine[0] = { ["w"]: [0], ["i"]: [3, 0], ["["]: [4], ["o"]: [7] }; pathStateMachine[1] = { ["w"]: [1], ["."]: [2], ["["]: [4], ["o"]: [7] }; pathStateMachine[2] = { ["w"]: [2], ["i"]: [3, 0], ["0"]: [3, 0] }; pathStateMachine[3] = { ["i"]: [3, 0], ["0"]: [3, 0], ["w"]: [1, 1], ["."]: [2, 1], ["["]: [4, 1], ["o"]: [7, 1] }; pathStateMachine[4] = { ["'"]: [5, 0], ['"']: [6, 0], ["["]: [ 4, 2 ], ["]"]: [1, 3], ["o"]: 8, ["l"]: [4, 0] }; pathStateMachine[5] = { ["'"]: [4, 0], ["o"]: 8, ["l"]: [5, 0] }; pathStateMachine[6] = { ['"']: [4, 0], ["o"]: 8, ["l"]: [6, 0] }; const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/; function isLiteral(exp) { return literalValueRE.test(exp); } function stripQuotes(str) { const a = str.charCodeAt(0); const b = str.charCodeAt(str.length - 1); return a === b && (a === 34 || a === 39) ? str.slice(1, -1) : str; } function getPathCharType(ch) { if (ch === void 0 || ch === null) { return "o"; } const code2 = ch.charCodeAt(0); switch (code2) { case 91: case 93: case 46: case 34: case 39: return ch; case 95: case 36: case 45: return "i"; case 9: case 10: case 13: case 160: case 65279: case 8232: case 8233: return "w"; } return "i"; } function formatSubPath(path) { const trimmed = path.trim(); if (path.charAt(0) === "0" && isNaN(parseInt(path))) { return false; } return isLiteral(trimmed) ? stripQuotes(trimmed) : "*" + trimmed; } function parse(path) { const keys = []; let index2 = -1; let mode = 0; let subPathDepth = 0; let c; let key; let newChar; let type; let transition; let action; let typeMap; const actions = []; actions[0] = () => { if (key === void 0) { key = newChar; } else { key += newChar; } }; actions[1] = () => { if (key !== void 0) { keys.push(key); key = void 0; } }; actions[2] = () => { actions[0](); subPathDepth++; }; actions[3] = () => { if (subPathDepth > 0) { subPathDepth--; mode = 4; actions[0](); } else { subPathDepth = 0; if (key === void 0) { return false; } key = formatSubPath(key); if (key === false) { return false; } else { actions[1](); } } }; function maybeUnescapeQuote() { const nextChar = path[index2 + 1]; if (mode === 5 && nextChar === "'" || mode === 6 && nextChar === '"') { index2++; newChar = "\\" + nextChar; actions[0](); return true; } } while (mode !== null) { index2++; c = path[index2]; if (c === "\\" && maybeUnescapeQuote()) { continue; } type = getPathCharType(c); typeMap = pathStateMachine[mode]; transition = typeMap[type] || typeMap["l"] || 8; if (transition === 8) { return; } mode = transition[0]; if (transition[1] !== void 0) { action = actions[transition[1]]; if (action) { newChar = c; if (action() === false) { return; } } } if (mode === 7) { return keys; } } } const cache = /* @__PURE__ */ new Map(); function resolveWithKeyValue(obj, path) { return isObject(obj) ? obj[path] : null; } function resolveValue(obj, path) { if (!isObject(obj)) { return null; } let hit = cache.get(path); if (!hit) { hit = parse(path); if (hit) { cache.set(path, hit); } } if (!hit) { return null; } const len = hit.length; let last = obj; let i = 0; while (i < len) { const val = last[hit[i]]; if (val === void 0) { return null; } last = val; i++; } return last; } const DEFAULT_MODIFIER = (str) => str; const DEFAULT_MESSAGE = (ctx) => ""; const DEFAULT_MESSAGE_DATA_TYPE = "text"; const DEFAULT_NORMALIZE = (values) => values.length === 0 ? "" : values.join(""); const DEFAULT_INTERPOLATE = toDisplayString; function pluralDefault(choice, choicesLength) { choice = Math.abs(choice); if (choicesLength === 2) { return choice ? choice > 1 ? 1 : 0 : 1; } return choice ? Math.min(choice, 2) : 0; } function getPluralIndex(options) { const index2 = isNumber(options.pluralIndex) ? options.pluralIndex : -1; return options.named && (isNumber(options.named.count) || isNumber(options.named.n)) ? isNumber(options.named.count) ? options.named.count : isNumber(options.named.n) ? options.named.n : index2 : index2; } function normalizeNamed(pluralIndex, props) { if (!props.count) { props.count = pluralIndex; } if (!props.n) { props.n = pluralIndex; } } function createMessageContext(options = {}) { const locale = options.locale; const pluralIndex = getPluralIndex(options); const pluralRule = isObject(options.pluralRules) && isString(locale) && isFunction(options.pluralRules[locale]) ? options.pluralRules[locale] : pluralDefault; const orgPluralRule = isObject(options.pluralRules) && isString(locale) && isFunction(options.pluralRules[locale]) ? pluralDefault : void 0; const plural = (messages2) => { return messages2[pluralRule(pluralIndex, messages2.length, orgPluralRule)]; }; const _list = options.list || []; const list = (index2) => _list[index2]; const _named = options.named || {}; isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named); const named = (key) => _named[key]; function message(key) { const msg = isFunction(options.messages) ? options.messages(key) : isObject(options.messages) ? options.messages[key] : false; return !msg ? options.parent ? options.parent.message(key) : DEFAULT_MESSAGE : msg; } const _modifier = (name) => options.modifiers ? options.modifiers[name] : DEFAULT_MODIFIER; const normalize = isPlainObject(options.processor) && isFunction(options.processor.normalize) ? options.processor.normalize : DEFAULT_NORMALIZE; const interpolate = isPlainObject(options.processor) && isFunction(options.processor.interpolate) ? options.processor.interpolate : DEFAULT_INTERPOLATE; const type = isPlainObject(options.processor) && isString(options.processor.type) ? options.processor.type : DEFAULT_MESSAGE_DATA_TYPE; const linked = (key, ...args) => { const [arg1, arg2] = args; let type2 = "text"; let modifier = ""; if (args.length === 1) { if (isObject(arg1)) { modifier = arg1.modifier || modifier; type2 = arg1.type || type2; } else if (isString(arg1)) { modifier = arg1 || modifier; } } else if (args.length === 2) { if (isString(arg1)) { modifier = arg1 || modifier; } if (isString(arg2)) { type2 = arg2 || type2; } } let msg = message(key)(ctx); if (type2 === "vnode" && isArray(msg) && modifier) { msg = msg[0]; } return modifier ? _modifier(modifier)(msg, type2) : msg; }; const ctx = { ["list"]: list, ["named"]: named, ["plural"]: plural, ["linked"]: linked, ["message"]: message, ["type"]: type, ["interpolate"]: interpolate, ["normalize"]: normalize }; return ctx; } let devtools = null; function setDevToolsHook(hook) { devtools = hook; } function initI18nDevTools(i18n2, version2, meta) { devtools && devtools.emit(IntlifyDevToolsHooks.I18nInit, { timestamp: Date.now(), i18n: i18n2, version: version2, meta }); } const translateDevTools = /* @__PURE__ */ createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate); function createDevToolsHook(hook) { return (payloads) => devtools && devtools.emit(hook, payloads); } const CoreWarnCodes = { NOT_FOUND_KEY: 1, FALLBACK_TO_TRANSLATE: 2, CANNOT_FORMAT_NUMBER: 3, FALLBACK_TO_NUMBER_FORMAT: 4, CANNOT_FORMAT_DATE: 5, FALLBACK_TO_DATE_FORMAT: 6, __EXTEND_POINT__: 7 }; const warnMessages$1 = { [CoreWarnCodes.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale messages.`, [CoreWarnCodes.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`, [CoreWarnCodes.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`, [CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`, [CoreWarnCodes.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`, [CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.` }; function getWarnMessage$1(code2, ...args) { return format(warnMessages$1[code2], ...args); } function fallbackWithSimple(ctx, fallback, start) { return [.../* @__PURE__ */ new Set([ start, ...isArray(fallback) ? fallback : isObject(fallback) ? Object.keys(fallback) : isString(fallback) ? [fallback] : [start] ])]; } function fallbackWithLocaleChain(ctx, fallback, start) { const startLocale = isString(start) ? start : DEFAULT_LOCALE; const context = ctx; if (!context.__localeChainCache) { context.__localeChainCache = /* @__PURE__ */ new Map(); } let chain = context.__localeChainCache.get(startLocale); if (!chain) { chain = []; let block = [start]; while (isArray(block)) { block = appendBlockToChain(chain, block, fallback); } const defaults = isArray(fallback) || !isPlainObject(fallback) ? fallback : fallback["default"] ? fallback["default"] : null; block = isString(defaults) ? [defaults] : defaults; if (isArray(block)) { appendBlockToChain(chain, block, false); } context.__localeChainCache.set(startLocale, chain); } return chain; } function appendBlockToChain(chain, block, blocks) { let follow = true; for (let i = 0; i < block.length && isBoolean(follow); i++) { const locale = block[i]; if (isString(locale)) { follow = appendLocaleToChain(chain, block[i], blocks); } } return follow; } function appendLocaleToChain(chain, locale, blocks) { let follow; const tokens = locale.split("-"); do { const target = tokens.join("-"); follow = appendItemToChain(chain, target, blocks); tokens.splice(-1, 1); } while (tokens.length && follow === true); return follow; } function appendItemToChain(chain, target, blocks) { let follow = false; if (!chain.includes(target)) { follow = true; if (target) { follow = target[target.length - 1] !== "!"; const locale = target.replace(/!/g, ""); chain.push(locale); if ((isArray(blocks) || isPlainObject(blocks)) && blocks[locale]) { follow = blocks[locale]; } } } return follow; } const VERSION$1 = "9.2.2"; const NOT_REOSLVED = -1; const DEFAULT_LOCALE = "en-US"; const MISSING_RESOLVE_VALUE = ""; const capitalize = (str) => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}`; function getDefaultLinkedModifiers() { return { upper: (val, type) => { return type === "text" && isString(val) ? val.toUpperCase() : type === "vnode" && isObject(val) && "__v_isVNode" in val ? val.children.toUpperCase() : val; }, lower: (val, type) => { return type === "text" && isString(val) ? val.toLowerCase() : type === "vnode" && isObject(val) && "__v_isVNode" in val ? val.children.toLowerCase() : val; }, capitalize: (val, type) => { return type === "text" && isString(val) ? capitalize(val) : type === "vnode" && isObject(val) && "__v_isVNode" in val ? capitalize(val.children) : val; } }; } let _compiler; function registerMessageCompiler(compiler) { _compiler = compiler; } let _resolver; function registerMessageResolver(resolver) { _resolver = resolver; } let _fallbacker; function registerLocaleFallbacker(fallbacker) { _fallbacker = fallbacker; } let _additionalMeta = null; const setAdditionalMeta = (meta) => { _additionalMeta = meta; }; const getAdditionalMeta = () => _additionalMeta; let _fallbackContext = null; const setFallbackContext = (context) => { _fallbackContext = context; }; const getFallbackContext = () => _fallbackContext; let _cid = 0; function createCoreContext(options = {}) { const version2 = isString(options.version) ? options.version : VERSION$1; const locale = isString(options.locale) ? options.locale : DEFAULT_LOCALE; const fallbackLocale = isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || isString(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : locale; const messages2 = isPlainObject(options.messages) ? options.messages : { [locale]: {} }; const datetimeFormats = isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [locale]: {} }; const numberFormats = isPlainObject(options.numberFormats) ? options.numberFormats : { [locale]: {} }; const modifiers = assign({}, options.modifiers || {}, getDefaultLinkedModifiers()); const pluralRules = options.pluralRules || {}; const missing = isFunction(options.missing) ? options.missing : null; const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true; const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true; const fallbackFormat = !!options.fallbackFormat; const unresolving = !!options.unresolving; const postTranslation = isFunction(options.postTranslation) ? options.postTranslation : null; const processor = isPlainObject(options.processor) ? options.processor : null; const warnHtmlMessage = isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true; const escapeParameter = !!options.escapeParameter; const messageCompiler = isFunction(options.messageCompiler) ? options.messageCompiler : _compiler; const messageResolver = isFunction(options.messageResolver) ? options.messageResolver : _resolver || resolveWithKeyValue; const localeFallbacker = isFunction(options.localeFallbacker) ? options.localeFallbacker : _fallbacker || fallbackWithSimple; const fallbackContext = isObject(options.fallbackContext) ? options.fallbackContext : void 0; const onWarn = isFunction(options.onWarn) ? options.onWarn : warn; const internalOptions = options; const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters) ? internalOptions.__datetimeFormatters : /* @__PURE__ */ new Map(); const __numberFormatters = isObject(internalOptions.__numberFormatters) ? internalOptions.__numberFormatters : /* @__PURE__ */ new Map(); const __meta = isObject(internalOptions.__meta) ? internalOptions.__meta : {}; _cid++; const context = { version: version2, cid: _cid, locale, fallbackLocale, messages: messages2, modifiers, pluralRules, missing, missingWarn, fallbackWarn, fallbackFormat, unresolving, postTranslation, processor, warnHtmlMessage, escapeParameter, messageCompiler, messageResolver, localeFallbacker, fallbackContext, onWarn, __meta }; { context.datetimeFormats = datetimeFormats; context.numberFormats = numberFormats; context.__datetimeFormatters = __datetimeFormatters; context.__numberFormatters = __numberFormatters; } if (process.env.NODE_ENV !== "production") { context.__v_emitter = internalOptions.__v_emitter != null ? internalOptions.__v_emitter : void 0; } if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) { initI18nDevTools(context, version2, __meta); } return context; } function isTranslateFallbackWarn(fallback, key) { return fallback instanceof RegExp ? fallback.test(key) : fallback; } function isTranslateMissingWarn(missing, key) { return missing instanceof RegExp ? missing.test(key) : missing; } function handleMissing(context, key, locale, missingWarn, type) { const { missing, onWarn } = context; if (process.env.NODE_ENV !== "production") { const emitter = context.__v_emitter; if (emitter) { emitter.emit("missing", { locale, key, type, groupId: `${type}:${key}` }); } } if (missing !== null) { const ret = missing(context, locale, key, type); return isString(ret) ? ret : key; } else { if (process.env.NODE_ENV !== "production" && isTranslateMissingWarn(missingWarn, key)) { onWarn(getWarnMessage$1(CoreWarnCodes.NOT_FOUND_KEY, { key, locale })); } return key; } } function updateFallbackLocale(ctx, locale, fallback) { const context = ctx; context.__localeChainCache = /* @__PURE__ */ new Map(); ctx.localeFallbacker(ctx, fallback, locale); } const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/; const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`; function checkHtmlMessage(source, options) { const warnHtmlMessage = isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true; if (warnHtmlMessage && RE_HTML_TAG.test(source)) { warn(format(WARN_MESSAGE, { source })); } } const defaultOnCacheKey = (source) => source; let compileCache = /* @__PURE__ */ Object.create(null); function compileToFunction(source, options = {}) { { process.env.NODE_ENV !== "production" && checkHtmlMessage(source, options); const onCacheKey = options.onCacheKey || defaultOnCacheKey; const key = onCacheKey(source); const cached = compileCache[key]; if (cached) { return cached; } let occurred = false; const onError = options.onError || defaultOnError; options.onError = (err) => { occurred = true; onError(err); }; const { code: code2 } = baseCompile(source, options); const msg = new Function(`return ${code2}`)(); return !occurred ? compileCache[key] = msg : msg; } } let code$2 = CompileErrorCodes.__EXTEND_POINT__; const inc$2 = () => ++code$2; const CoreErrorCodes = { INVALID_ARGUMENT: code$2, INVALID_DATE_ARGUMENT: inc$2(), INVALID_ISO_DATE_ARGUMENT: inc$2(), __EXTEND_POINT__: inc$2() }; function createCoreError(code2) { return createCompileError(code2, null, process.env.NODE_ENV !== "production" ? { messages: errorMessages$1 } : void 0); } const errorMessages$1 = { [CoreErrorCodes.INVALID_ARGUMENT]: "Invalid arguments", [CoreErrorCodes.INVALID_DATE_ARGUMENT]: "The date provided is an invalid Date object.Make sure your Date represents a valid date.", [CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT]: "The argument provided is not a valid ISO date string" }; const NOOP_MESSAGE_FUNCTION = () => ""; const isMessageFunction = (val) => isFunction(val); function translate(context, ...args) { const { fallbackFormat, postTranslation, unresolving, messageCompiler, fallbackLocale, messages: messages2 } = context; const [key, options] = parseTranslateArgs(...args); const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn; const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn; const escapeParameter = isBoolean(options.escapeParameter) ? options.escapeParameter : context.escapeParameter; const resolvedMessage = !!options.resolvedMessage; const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) ? !isBoolean(options.default) ? options.default : !messageCompiler ? () => key : key : fallbackFormat ? !messageCompiler ? () => key : key : ""; const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== ""; const locale = isString(options.locale) ? options.locale : context.locale; escapeParameter && escapeParams(options); let [formatScope, targetLocale, message] = !resolvedMessage ? resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) : [ key, locale, messages2[locale] || {} ]; let format2 = formatScope; let cacheBaseKey = key; if (!resolvedMessage && !(isString(format2) || isMessageFunction(format2))) { if (enableDefaultMsg) { format2 = defaultMsgOrKey; cacheBaseKey = format2; } } if (!resolvedMessage && (!(isString(format2) || isMessageFunction(format2)) || !isString(targetLocale))) { return unresolving ? NOT_REOSLVED : key; } if (process.env.NODE_ENV !== "production" && isString(format2) && context.messageCompiler == null) { warn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${key}'.`); return key; } let occurred = false; const errorDetector = () => { occurred = true; }; const msg = !isMessageFunction(format2) ? compileMessageFormat(context, key, targetLocale, format2, cacheBaseKey, errorDetector) : format2; if (occurred) { return format2; } const ctxOptions = getMessageContextOptions(context, targetLocale, message, options); const msgContext = createMessageContext(ctxOptions); const messaged = evaluateMessage(context, msg, msgContext); const ret = postTranslation ? postTranslation(messaged, key) : messaged; if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) { const payloads = { timestamp: Date.now(), key: isString(key) ? key : isMessageFunction(format2) ? format2.key : "", locale: targetLocale || (isMessageFunction(format2) ? format2.locale : ""), format: isString(format2) ? format2 : isMessageFunction(format2) ? format2.source : "", message: ret }; payloads.meta = assign({}, context.__meta, getAdditionalMeta() || {}); translateDevTools(payloads); } return ret; } function escapeParams(options) { if (isArray(options.list)) { options.list = options.list.map((item) => isString(item) ? escapeHtml(item) : item); } else if (isObject(options.named)) { Object.keys(options.named).forEach((key) => { if (isString(options.named[key])) { options.named[key] = escapeHtml(options.named[key]); } }); } } function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) { const { messages: messages2, onWarn, messageResolver: resolveValue2, localeFallbacker } = context; const locales = localeFallbacker(context, fallbackLocale, locale); let message = {}; let targetLocale; let format2 = null; let from = locale; let to = null; const type = "translate"; for (let i = 0; i < locales.length; i++) { targetLocale = to = locales[i]; if (process.env.NODE_ENV !== "production" && locale !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key)) { onWarn(getWarnMessage$1(CoreWarnCodes.FALLBACK_TO_TRANSLATE, { key, target: targetLocale })); } if (process.env.NODE_ENV !== "production" && locale !== targetLocale) { const emitter = context.__v_emitter; if (emitter) { emitter.emit("fallback", { type, key, from, to, groupId: `${type}:${key}` }); } } message = messages2[targetLocale] || {}; let start = null; let startTag; let endTag; if (process.env.NODE_ENV !== "production" && inBrowser) { start = window.performance.now(); startTag = "intlify-message-resolve-start"; endTag = "intlify-message-resolve-end"; mark && mark(startTag); } if ((format2 = resolveValue2(message, key)) === null) { format2 = message[key]; } if (process.env.NODE_ENV !== "production" && inBrowser) { const end = window.performance.now(); const emitter = context.__v_emitter; if (emitter && start && format2) { emitter.emit("message-resolve", { type: "message-resolve", key, message: format2, time: end - start, groupId: `${type}:${key}` }); } if (startTag && endTag && mark && measure) { mark(endTag); measure("intlify message resolve", startTag, endTag); } } if (isString(format2) || isFunction(format2)) break; const missingRet = handleMissing( context, key, targetLocale, missingWarn, type ); if (missingRet !== key) { format2 = missingRet; } from = to; } return [format2, targetLocale, message]; } function compileMessageFormat(context, key, targetLocale, format2, cacheBaseKey, errorDetector) { const { messageCompiler, warnHtmlMessage } = context; if (isMessageFunction(format2)) { const msg2 = format2; msg2.locale = msg2.locale || targetLocale; msg2.key = msg2.key || key; return msg2; } if (messageCompiler == null) { const msg2 = () => format2; msg2.locale = targetLocale; msg2.key = key; return msg2; } let start = null; let startTag; let endTag; if (process.env.NODE_ENV !== "production" && inBrowser) { start = window.performance.now(); startTag = "intlify-message-compilation-start"; endTag = "intlify-message-compilation-end"; mark && mark(startTag); } const msg = messageCompiler(format2, getCompileOptions(context, targetLocale, cacheBaseKey, format2, warnHtmlMessage, errorDetector)); if (process.env.NODE_ENV !== "production" && inBrowser) { const end = window.performance.now(); const emitter = context.__v_emitter; if (emitter && start) { emitter.emit("message-compilation", { type: "message-compilation", message: format2, time: end - start, groupId: `${"translate"}:${key}` }); } if (startTag && endTag && mark && measure) { mark(endTag); measure("intlify message compilation", startTag, endTag); } } msg.locale = targetLocale; msg.key = key; msg.source = format2; return msg; } function evaluateMessage(context, msg, msgCtx) { let start = null; let startTag; let endTag; if (process.env.NODE_ENV !== "production" && inBrowser) { start = window.performance.now(); startTag = "intlify-message-evaluation-start"; endTag = "intlify-message-evaluation-end"; mark && mark(startTag); } const messaged = msg(msgCtx); if (process.env.NODE_ENV !== "production" && inBrowser) { const end = window.performance.now(); const emitter = context.__v_emitter; if (emitter && start) { emitter.emit("message-evaluation", { type: "message-evaluation", value: messaged, time: end - start, groupId: `${"translate"}:${msg.key}` }); } if (startTag && endTag && mark && measure) { mark(endTag); measure("intlify message evaluation", startTag, endTag); } } return messaged; } function parseTranslateArgs(...args) { const [arg1, arg2, arg3] = args; const options = {}; if (!isString(arg1) && !isNumber(arg1) && !isMessageFunction(arg1)) { throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT); } const key = isNumber(arg1) ? String(arg1) : isMessageFunction(arg1) ? arg1 : arg1; if (isNumber(arg2)) { options.plural = arg2; } else if (isString(arg2)) { options.default = arg2; } else if (isPlainObject(arg2) && !isEmptyObject(arg2)) { options.named = arg2; } else if (isArray(arg2)) { options.list = arg2; } if (isNumber(arg3)) { options.plural = arg3; } else if (isString(arg3)) { options.default = arg3; } else if (isPlainObject(arg3)) { assign(options, arg3); } return [key, options]; } function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) { return { warnHtmlMessage, onError: (err) => { errorDetector && errorDetector(err); if (process.env.NODE_ENV !== "production") { const message = `Message compilation error: ${err.message}`; const codeFrame = err.location && generateCodeFrame(source, err.location.start.offset, err.location.end.offset); const emitter = context.__v_emitter; if (emitter) { emitter.emit("compile-error", { message: source, error: err.message, start: err.location && err.location.start.offset, end: err.location && err.location.end.offset, groupId: `${"translate"}:${key}` }); } console.error(codeFrame ? `${message} ${codeFrame}` : message); } else { throw err; } }, onCacheKey: (source2) => generateFormatCacheKey(locale, key, source2) }; } function getMessageContextOptions(context, locale, message, options) { const { modifiers, pluralRules, messageResolver: resolveValue2, fallbackLocale, fallbackWarn, missingWarn, fallbackContext } = context; const resolveMessage = (key) => { let val = resolveValue2(message, key); if (val == null && fallbackContext) { const [, , message2] = resolveMessageFormat(fallbackContext, key, locale, fallbackLocale, fallbackWarn, missingWarn); val = resolveValue2(message2, key); } if (isString(val)) { let occurred = false; const errorDetector = () => { occurred = true; }; const msg = compileMessageFormat(context, key, locale, val, key, errorDetector); return !occurred ? msg : NOOP_MESSAGE_FUNCTION; } else if (isMessageFunction(val)) { return val; } else { return NOOP_MESSAGE_FUNCTION; } }; const ctxOptions = { locale, modifiers, pluralRules, messages: resolveMessage }; if (context.processor) { ctxOptions.processor = context.processor; } if (options.list) { ctxOptions.list = options.list; } if (options.named) { ctxOptions.named = options.named; } if (isNumber(options.plural)) { ctxOptions.pluralIndex = options.plural; } return ctxOptions; } const intlDefined = typeof Intl !== "undefined"; const Availabilities = { dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== "undefined", numberFormat: intlDefined && typeof Intl.NumberFormat !== "undefined" }; function datetime(context, ...args) { const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context; const { __datetimeFormatters } = context; if (process.env.NODE_ENV !== "production" && !Availabilities.dateTimeFormat) { onWarn(getWarnMessage$1(CoreWarnCodes.CANNOT_FORMAT_DATE)); return MISSING_RESOLVE_VALUE; } const [key, value, options, overrides] = parseDateTimeArgs(...args); const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn; const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn; const part = !!options.part; const locale = isString(options.locale) ? options.locale : context.locale; const locales = localeFallbacker( context, fallbackLocale, locale ); if (!isString(key) || key === "") { return new Intl.DateTimeFormat(locale, overrides).format(value); } let datetimeFormat = {}; let targetLocale; let format2 = null; let from = locale; let to = null; const type = "datetime format"; for (let i = 0; i < locales.length; i++) { targetLocale = to = locales[i]; if (process.env.NODE_ENV !== "production" && locale !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key)) { onWarn(getWarnMessage$1(CoreWarnCodes.FALLBACK_TO_DATE_FORMAT, { key, target: targetLocale })); } if (process.env.NODE_ENV !== "production" && locale !== targetLocale) { const emitter = context.__v_emitter; if (emitter) { emitter.emit("fallback", { type, key, from, to, groupId: `${type}:${key}` }); } } datetimeFormat = datetimeFormats[targetLocale] || {}; format2 = datetimeFormat[key]; if (isPlainObject(format2)) break; handleMissing(context, key, targetLocale, missingWarn, type); from = to; } if (!isPlainObject(format2) || !isString(targetLocale)) { return unresolving ? NOT_REOSLVED : key; } let id = `${targetLocale}__${key}`; if (!isEmptyObject(overrides)) { id = `${id}__${JSON.stringify(overrides)}`; } let formatter = __datetimeFormatters.get(id); if (!formatter) { formatter = new Intl.DateTimeFormat(targetLocale, assign({}, format2, overrides)); __datetimeFormatters.set(id, formatter); } return !part ? formatter.format(value) : formatter.formatToParts(value); } const DATETIME_FORMAT_OPTIONS_KEYS = [ "localeMatcher", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "formatMatcher", "hour12", "timeZone", "dateStyle", "timeStyle", "calendar", "dayPeriod", "numberingSystem", "hourCycle", "fractionalSecondDigits" ]; function parseDateTimeArgs(...args) { const [arg1, arg2, arg3, arg4] = args; const options = {}; let overrides = {}; let value; if (isString(arg1)) { const matches = arg1.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/); if (!matches) { throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT); } const dateTime = matches[3] ? matches[3].trim().startsWith("T") ? `${matches[1].trim()}${matches[3].trim()}` : `${matches[1].trim()}T${matches[3].trim()}` : matches[1].trim(); value = new Date(dateTime); try { value.toISOString(); } catch (e) { throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT); } } else if (isDate(arg1)) { if (isNaN(arg1.getTime())) { throw createCoreError(CoreErrorCodes.INVALID_DATE_ARGUMENT); } value = arg1; } else if (isNumber(arg1)) { value = arg1; } else { throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT); } if (isString(arg2)) { options.key = arg2; } else if (isPlainObject(arg2)) { Object.keys(arg2).forEach((key) => { if (DATETIME_FORMAT_OPTIONS_KEYS.includes(key)) { overrides[key] = arg2[key]; } else { options[key] = arg2[key]; } }); } if (isString(arg3)) { options.locale = arg3; } else if (isPlainObject(arg3)) { overrides = arg3; } if (isPlainObject(arg4)) { overrides = arg4; } return [options.key || "", value, options, overrides]; } function clearDateTimeFormat(ctx, locale, format2) { const context = ctx; for (const key in format2) { const id = `${locale}__${key}`; if (!context.__datetimeFormatters.has(id)) { continue; } context.__datetimeFormatters.delete(id); } } function number(context, ...args) { const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context; const { __numberFormatters } = context; if (process.env.NODE_ENV !== "production" && !Availabilities.numberFormat) { onWarn(getWarnMessage$1(CoreWarnCodes.CANNOT_FORMAT_NUMBER)); return MISSING_RESOLVE_VALUE; } const [key, value, options, overrides] = parseNumberArgs(...args); const missingWarn = isBoolean(options.missingWarn) ? options.missingWarn : context.missingWarn; const fallbackWarn = isBoolean(options.fallbackWarn) ? options.fallbackWarn : context.fallbackWarn; const part = !!options.part; const locale = isString(options.locale) ? options.locale : context.locale; const locales = localeFallbacker( context, fallbackLocale, locale ); if (!isString(key) || key === "") { return new Intl.NumberFormat(locale, overrides).format(value); } let numberFormat = {}; let targetLocale; let format2 = null; let from = locale; let to = null; const type = "number format"; for (let i = 0; i < locales.length; i++) { targetLocale = to = locales[i]; if (process.env.NODE_ENV !== "production" && locale !== targetLocale && isTranslateFallbackWarn(fallbackWarn, key)) { onWarn(getWarnMessage$1(CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT, { key, target: targetLocale })); } if (process.env.NODE_ENV !== "production" && locale !== targetLocale) { const emitter = context.__v_emitter; if (emitter) { emitter.emit("fallback", { type, key, from, to, groupId: `${type}:${key}` }); } } numberFormat = numberFormats[targetLocale] || {}; format2 = numberFormat[key]; if (isPlainObject(format2)) break; handleMissing(context, key, targetLocale, missingWarn, type); from = to; } if (!isPlainObject(format2) || !isString(targetLocale)) { return unresolving ? NOT_REOSLVED : key; } let id = `${targetLocale}__${key}`; if (!isEmptyObject(overrides)) { id = `${id}__${JSON.stringify(overrides)}`; } let formatter = __numberFormatters.get(id); if (!formatter) { formatter = new Intl.NumberFormat(targetLocale, assign({}, format2, overrides)); __numberFormatters.set(id, formatter); } return !part ? formatter.format(value) : formatter.formatToParts(value); } const NUMBER_FORMAT_OPTIONS_KEYS = [ "localeMatcher", "style", "currency", "currencyDisplay", "currencySign", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits", "compactDisplay", "notation", "signDisplay", "unit", "unitDisplay", "roundingMode", "roundingPriority", "roundingIncrement", "trailingZeroDisplay" ]; function parseNumberArgs(...args) { const [arg1, arg2, arg3, arg4] = args; const options = {}; let overrides = {}; if (!isNumber(arg1)) { throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT); } const value = arg1; if (isString(arg2)) { options.key = arg2; } else if (isPlainObject(arg2)) { Object.keys(arg2).forEach((key) => { if (NUMBER_FORMAT_OPTIONS_KEYS.includes(key)) { overrides[key] = arg2[key]; } else { options[key] = arg2[key]; } }); } if (isString(arg3)) { options.locale = arg3; } else if (isPlainObject(arg3)) { overrides = arg3; } if (isPlainObject(arg4)) { overrides = arg4; } return [options.key || "", value, options, overrides]; } function clearNumberFormat(ctx, locale, format2) { const context = ctx; for (const key in format2) { const id = `${locale}__${key}`; if (!context.__numberFormatters.has(id)) { continue; } context.__numberFormatters.delete(id); } } { if (typeof __INTLIFY_PROD_DEVTOOLS__ !== "boolean") { getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false; } } function getDevtoolsGlobalHook() { return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__; } function getTarget() { return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}; } const isProxyAvailable = typeof Proxy === "function"; const HOOK_SETUP = "devtools-plugin:setup"; const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set"; let supported; let perf; function isPerformanceSupported() { var _a; if (supported !== void 0) { return supported; } if (typeof window !== "undefined" && window.performance) { supported = true; perf = window.performance; } else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) { supported = true; perf = global.perf_hooks.performance; } else { supported = false; } return supported; } function now() { return isPerformanceSupported() ? perf.now() : Date.now(); } class ApiProxy { constructor(plugin, hook) { this.target = null; this.targetQueue = []; this.onQueue = []; this.plugin = plugin; this.hook = hook; const defaultSettings = {}; if (plugin.settings) { for (const id in plugin.settings) { const item = plugin.settings[id]; defaultSettings[id] = item.defaultValue; } } const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`; let currentSettings = Object.assign({}, defaultSettings); try { const raw = localStorage.getItem(localSettingsSaveId); const data = JSON.parse(raw); Object.assign(currentSettings, data); } catch (e) { } this.fallbacks = { getSettings() { return currentSettings; }, setSettings(value) { try { localStorage.setItem(localSettingsSaveId, JSON.stringify(value)); } catch (e) { } currentSettings = value; }, now() { return now(); } }; if (hook) { hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => { if (pluginId === this.plugin.id) { this.fallbacks.setSettings(value); } }); } this.proxiedOn = new Proxy({}, { get: (_target, prop) => { if (this.target) { return this.target.on[prop]; } else { return (...args) => { this.onQueue.push({ method: prop, args }); }; } } }); this.proxiedTarget = new Proxy({}, { get: (_target, prop) => { if (this.target) { return this.target[prop]; } else if (prop === "on") { return this.proxiedOn; } else if (Object.keys(this.fallbacks).includes(prop)) { return (...args) => { this.targetQueue.push({ method: prop, args, resolve: () => { } }); return this.fallbacks[prop](...args); }; } else { return (...args) => { return new Promise((resolve) => { this.targetQueue.push({ method: prop, args, resolve }); }); }; } } }); } async setRealTarget(target) { this.target = target; for (const item of this.onQueue) { this.target.on[item.method](...item.args); } for (const item of this.targetQueue) { item.resolve(await this.target[item.method](...item.args)); } } } function setupDevtoolsPlugin(pluginDescriptor, setupFn) { const descriptor = pluginDescriptor; const target = getTarget(); const hook = getDevtoolsGlobalHook(); const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy; if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) { hook.emit(HOOK_SETUP, pluginDescriptor, setupFn); } else { const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null; const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || []; list.push({ pluginDescriptor: descriptor, setupFn, proxy }); if (proxy) setupFn(proxy.proxiedTarget); } } /*! * vue-devtools v9.2.2 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const VueDevToolsLabels = { ["vue-devtools-plugin-vue-i18n"]: "Vue I18n devtools", ["vue-i18n-resource-inspector"]: "I18n Resources", ["vue-i18n-timeline"]: "Vue I18n" }; const VueDevToolsPlaceholders = { ["vue-i18n-resource-inspector"]: "Search for scopes ..." }; const VueDevToolsTimelineColors = { ["vue-i18n-timeline"]: 16764185 }; /*! * vue-i18n v9.2.2 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const VERSION = "9.2.2"; function initFeatureFlags() { let needWarn = false; if (typeof __VUE_I18N_FULL_INSTALL__ !== "boolean") { needWarn = true; getGlobalThis().__VUE_I18N_FULL_INSTALL__ = true; } if (typeof __VUE_I18N_LEGACY_API__ !== "boolean") { needWarn = true; getGlobalThis().__VUE_I18N_LEGACY_API__ = true; } if (typeof __INTLIFY_PROD_DEVTOOLS__ !== "boolean") { getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false; } if (process.env.NODE_ENV !== "production" && needWarn) { console.warn(`You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.`); } } let code$1 = CoreWarnCodes.__EXTEND_POINT__; const inc$1 = () => ++code$1; const I18nWarnCodes = { FALLBACK_TO_ROOT: code$1, NOT_SUPPORTED_PRESERVE: inc$1(), NOT_SUPPORTED_FORMATTER: inc$1(), NOT_SUPPORTED_PRESERVE_DIRECTIVE: inc$1(), NOT_SUPPORTED_GET_CHOICE_INDEX: inc$1(), COMPONENT_NAME_LEGACY_COMPATIBLE: inc$1(), NOT_FOUND_PARENT_SCOPE: inc$1() }; const warnMessages = { [I18nWarnCodes.FALLBACK_TO_ROOT]: `Fall back to {type} '{key}' with root locale.`, [I18nWarnCodes.NOT_SUPPORTED_PRESERVE]: `Not supported 'preserve'.`, [I18nWarnCodes.NOT_SUPPORTED_FORMATTER]: `Not supported 'formatter'.`, [I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE]: `Not supported 'preserveDirectiveContent'.`, [I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX]: `Not supported 'getChoiceIndex'.`, [I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE]: `Component name legacy compatible: '{name}' -> 'i18n'`, [I18nWarnCodes.NOT_FOUND_PARENT_SCOPE]: `Not found parent scope. use the global scope.` }; function getWarnMessage(code2, ...args) { return format(warnMessages[code2], ...args); } let code = CompileErrorCodes.__EXTEND_POINT__; const inc = () => ++code; const I18nErrorCodes = { UNEXPECTED_RETURN_TYPE: code, INVALID_ARGUMENT: inc(), MUST_BE_CALL_SETUP_TOP: inc(), NOT_INSLALLED: inc(), NOT_AVAILABLE_IN_LEGACY_MODE: inc(), REQUIRED_VALUE: inc(), INVALID_VALUE: inc(), CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN: inc(), NOT_INSLALLED_WITH_PROVIDE: inc(), UNEXPECTED_ERROR: inc(), NOT_COMPATIBLE_LEGACY_VUE_I18N: inc(), BRIDGE_SUPPORT_VUE_2_ONLY: inc(), MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION: inc(), NOT_AVAILABLE_COMPOSITION_IN_LEGACY: inc(), __EXTEND_POINT__: inc() }; function createI18nError(code2, ...args) { return createCompileError(code2, null, process.env.NODE_ENV !== "production" ? { messages: errorMessages, args } : void 0); } const errorMessages = { [I18nErrorCodes.UNEXPECTED_RETURN_TYPE]: "Unexpected return type in composer", [I18nErrorCodes.INVALID_ARGUMENT]: "Invalid argument", [I18nErrorCodes.MUST_BE_CALL_SETUP_TOP]: "Must be called at the top of a `setup` function", [I18nErrorCodes.NOT_INSLALLED]: "Need to install with `app.use` function", [I18nErrorCodes.UNEXPECTED_ERROR]: "Unexpected error", [I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE]: "Not available in legacy mode", [I18nErrorCodes.REQUIRED_VALUE]: `Required in value: {0}`, [I18nErrorCodes.INVALID_VALUE]: `Invalid value`, [I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]: `Cannot setup vue-devtools plugin`, [I18nErrorCodes.NOT_INSLALLED_WITH_PROVIDE]: "Need to install with `provide` function", [I18nErrorCodes.NOT_COMPATIBLE_LEGACY_VUE_I18N]: "Not compatible legacy VueI18n.", [I18nErrorCodes.BRIDGE_SUPPORT_VUE_2_ONLY]: "vue-i18n-bridge support Vue 2.x only", [I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]: "Must define \u2018i18n\u2019 option or custom block in Composition API with using local scope in Legacy API mode", [I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]: "Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly" }; const TransrateVNodeSymbol = /* @__PURE__ */ makeSymbol("__transrateVNode"); const DatetimePartsSymbol = /* @__PURE__ */ makeSymbol("__datetimeParts"); const NumberPartsSymbol = /* @__PURE__ */ makeSymbol("__numberParts"); const EnableEmitter = /* @__PURE__ */ makeSymbol("__enableEmitter"); const DisableEmitter = /* @__PURE__ */ makeSymbol("__disableEmitter"); const SetPluralRulesSymbol = makeSymbol("__setPluralRules"); makeSymbol("__intlifyMeta"); const InejctWithOption = /* @__PURE__ */ makeSymbol("__injectWithOption"); function handleFlatJson(obj) { if (!isObject(obj)) { return obj; } for (const key in obj) { if (!hasOwn(obj, key)) { continue; } if (!key.includes(".")) { if (isObject(obj[key])) { handleFlatJson(obj[key]); } } else { const subKeys = key.split("."); const lastIndex = subKeys.length - 1; let currentObj = obj; for (let i = 0; i < lastIndex; i++) { if (!(subKeys[i] in currentObj)) { currentObj[subKeys[i]] = {}; } currentObj = currentObj[subKeys[i]]; } currentObj[subKeys[lastIndex]] = obj[key]; delete obj[key]; if (isObject(currentObj[subKeys[lastIndex]])) { handleFlatJson(currentObj[subKeys[lastIndex]]); } } } return obj; } function getLocaleMessages(locale, options) { const { messages: messages2, __i18n, messageResolver, flatJson } = options; const ret = isPlainObject(messages2) ? messages2 : isArray(__i18n) ? {} : { [locale]: {} }; if (isArray(__i18n)) { __i18n.forEach((custom) => { if ("locale" in custom && "resource" in custom) { const { locale: locale2, resource } = custom; if (locale2) { ret[locale2] = ret[locale2] || {}; deepCopy(resource, ret[locale2]); } else { deepCopy(resource, ret); } } else { isString(custom) && deepCopy(JSON.parse(custom), ret); } }); } if (messageResolver == null && flatJson) { for (const key in ret) { if (hasOwn(ret, key)) { handleFlatJson(ret[key]); } } } return ret; } const isNotObjectOrIsArray = (val) => !isObject(val) || isArray(val); function deepCopy(src2, des) { if (isNotObjectOrIsArray(src2) || isNotObjectOrIsArray(des)) { throw createI18nError(I18nErrorCodes.INVALID_VALUE); } for (const key in src2) { if (hasOwn(src2, key)) { if (isNotObjectOrIsArray(src2[key]) || isNotObjectOrIsArray(des[key])) { des[key] = src2[key]; } else { deepCopy(src2[key], des[key]); } } } } function getComponentOptions(instance) { return instance.type; } function adjustI18nResources(global2, options, componentOptions) { let messages2 = isObject(options.messages) ? options.messages : {}; if ("__i18nGlobal" in componentOptions) { messages2 = getLocaleMessages(global2.locale.value, { messages: messages2, __i18n: componentOptions.__i18nGlobal }); } const locales = Object.keys(messages2); if (locales.length) { locales.forEach((locale) => { global2.mergeLocaleMessage(locale, messages2[locale]); }); } { if (isObject(options.datetimeFormats)) { const locales2 = Object.keys(options.datetimeFormats); if (locales2.length) { locales2.forEach((locale) => { global2.mergeDateTimeFormat(locale, options.datetimeFormats[locale]); }); } } if (isObject(options.numberFormats)) { const locales2 = Object.keys(options.numberFormats); if (locales2.length) { locales2.forEach((locale) => { global2.mergeNumberFormat(locale, options.numberFormats[locale]); }); } } } } function createTextNode(key) { return vue.createVNode(vue.Text, null, key, 0); } const DEVTOOLS_META = "__INTLIFY_META__"; let composerID = 0; function defineCoreMissingHandler(missing) { return (ctx, locale, key, type) => { return missing(locale, key, vue.getCurrentInstance() || void 0, type); }; } const getMetaInfo = () => { const instance = vue.getCurrentInstance(); let meta = null; return instance && (meta = getComponentOptions(instance)[DEVTOOLS_META]) ? { [DEVTOOLS_META]: meta } : null; }; function createComposer(options = {}, VueI18nLegacy) { const { __root } = options; const _isGlobal = __root === void 0; let _inheritLocale = isBoolean(options.inheritLocale) ? options.inheritLocale : true; const _locale = vue.ref( __root && _inheritLocale ? __root.locale.value : isString(options.locale) ? options.locale : DEFAULT_LOCALE ); const _fallbackLocale = vue.ref( __root && _inheritLocale ? __root.fallbackLocale.value : isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value ); const _messages = vue.ref(getLocaleMessages(_locale.value, options)); const _datetimeFormats = vue.ref(isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} }); const _numberFormats = vue.ref(isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} }); let _missingWarn = __root ? __root.missingWarn : isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true; let _fallbackWarn = __root ? __root.fallbackWarn : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true; let _fallbackRoot = __root ? __root.fallbackRoot : isBoolean(options.fallbackRoot) ? options.fallbackRoot : true; let _fallbackFormat = !!options.fallbackFormat; let _missing = isFunction(options.missing) ? options.missing : null; let _runtimeMissing = isFunction(options.missing) ? defineCoreMissingHandler(options.missing) : null; let _postTranslation = isFunction(options.postTranslation) ? options.postTranslation : null; let _warnHtmlMessage = __root ? __root.warnHtmlMessage : isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true; let _escapeParameter = !!options.escapeParameter; const _modifiers = __root ? __root.modifiers : isPlainObject(options.modifiers) ? options.modifiers : {}; let _pluralRules = options.pluralRules || __root && __root.pluralRules; let _context; const getCoreContext = () => { _isGlobal && setFallbackContext(null); const ctxOptions = { version: VERSION, locale: _locale.value, fallbackLocale: _fallbackLocale.value, messages: _messages.value, modifiers: _modifiers, pluralRules: _pluralRules, missing: _runtimeMissing === null ? void 0 : _runtimeMissing, missingWarn: _missingWarn, fallbackWarn: _fallbackWarn, fallbackFormat: _fallbackFormat, unresolving: true, postTranslation: _postTranslation === null ? void 0 : _postTranslation, warnHtmlMessage: _warnHtmlMessage, escapeParameter: _escapeParameter, messageResolver: options.messageResolver, __meta: { framework: "vue" } }; { ctxOptions.datetimeFormats = _datetimeFormats.value; ctxOptions.numberFormats = _numberFormats.value; ctxOptions.__datetimeFormatters = isPlainObject(_context) ? _context.__datetimeFormatters : void 0; ctxOptions.__numberFormatters = isPlainObject(_context) ? _context.__numberFormatters : void 0; } if (process.env.NODE_ENV !== "production") { ctxOptions.__v_emitter = isPlainObject(_context) ? _context.__v_emitter : void 0; } const ctx = createCoreContext(ctxOptions); _isGlobal && setFallbackContext(ctx); return ctx; }; _context = getCoreContext(); updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); function trackReactivityValues() { return [ _locale.value, _fallbackLocale.value, _messages.value, _datetimeFormats.value, _numberFormats.value ]; } const locale = vue.computed({ get: () => _locale.value, set: (val) => { _locale.value = val; _context.locale = _locale.value; } }); const fallbackLocale = vue.computed({ get: () => _fallbackLocale.value, set: (val) => { _fallbackLocale.value = val; _context.fallbackLocale = _fallbackLocale.value; updateFallbackLocale(_context, _locale.value, val); } }); const messages2 = vue.computed(() => _messages.value); const datetimeFormats = /* @__PURE__ */ vue.computed(() => _datetimeFormats.value); const numberFormats = /* @__PURE__ */ vue.computed(() => _numberFormats.value); function getPostTranslationHandler() { return isFunction(_postTranslation) ? _postTranslation : null; } function setPostTranslationHandler(handler) { _postTranslation = handler; _context.postTranslation = handler; } function getMissingHandler() { return _missing; } function setMissingHandler(handler) { if (handler !== null) { _runtimeMissing = defineCoreMissingHandler(handler); } _missing = handler; _context.missing = _runtimeMissing; } function isResolvedTranslateMessage(type, arg) { return type !== "translate" || !arg.resolvedMessage; } const wrapWithDeps = (fn, argumentParser, warnType, fallbackSuccess, fallbackFail, successCondition) => { trackReactivityValues(); let ret; if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) { try { setAdditionalMeta(getMetaInfo()); if (!_isGlobal) { _context.fallbackContext = __root ? getFallbackContext() : void 0; } ret = fn(_context); } finally { setAdditionalMeta(null); if (!_isGlobal) { _context.fallbackContext = void 0; } } } else { ret = fn(_context); } if (isNumber(ret) && ret === NOT_REOSLVED) { const [key, arg2] = argumentParser(); if (process.env.NODE_ENV !== "production" && __root && isString(key) && isResolvedTranslateMessage(warnType, arg2)) { if (_fallbackRoot && (isTranslateFallbackWarn(_fallbackWarn, key) || isTranslateMissingWarn(_missingWarn, key))) { warn(getWarnMessage(I18nWarnCodes.FALLBACK_TO_ROOT, { key, type: warnType })); } if (process.env.NODE_ENV !== "production") { const { __v_emitter: emitter } = _context; if (emitter && _fallbackRoot) { emitter.emit("fallback", { type: warnType, key, to: "global", groupId: `${warnType}:${key}` }); } } } return __root && _fallbackRoot ? fallbackSuccess(__root) : fallbackFail(key); } else if (successCondition(ret)) { return ret; } else { throw createI18nError(I18nErrorCodes.UNEXPECTED_RETURN_TYPE); } }; function t(...args) { return wrapWithDeps((context) => Reflect.apply(translate, null, [context, ...args]), () => parseTranslateArgs(...args), "translate", (root) => Reflect.apply(root.t, root, [...args]), (key) => key, (val) => isString(val)); } function rt(...args) { const [arg1, arg2, arg3] = args; if (arg3 && !isObject(arg3)) { throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT); } return t(...[arg1, arg2, assign({ resolvedMessage: true }, arg3 || {})]); } function d(...args) { return wrapWithDeps((context) => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), "datetime format", (root) => Reflect.apply(root.d, root, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString(val)); } function n(...args) { return wrapWithDeps((context) => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), "number format", (root) => Reflect.apply(root.n, root, [...args]), () => MISSING_RESOLVE_VALUE, (val) => isString(val)); } function normalize(values) { return values.map((val) => isString(val) || isNumber(val) || isBoolean(val) ? createTextNode(String(val)) : val); } const interpolate = (val) => val; const processor = { normalize, interpolate, type: "vnode" }; function transrateVNode(...args) { return wrapWithDeps( (context) => { let ret; const _context2 = context; try { _context2.processor = processor; ret = Reflect.apply(translate, null, [_context2, ...args]); } finally { _context2.processor = null; } return ret; }, () => parseTranslateArgs(...args), "translate", (root) => root[TransrateVNodeSymbol](...args), (key) => [createTextNode(key)], (val) => isArray(val) ); } function numberParts(...args) { return wrapWithDeps( (context) => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), "number format", (root) => root[NumberPartsSymbol](...args), () => [], (val) => isString(val) || isArray(val) ); } function datetimeParts(...args) { return wrapWithDeps( (context) => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), "datetime format", (root) => root[DatetimePartsSymbol](...args), () => [], (val) => isString(val) || isArray(val) ); } function setPluralRules(rules) { _pluralRules = rules; _context.pluralRules = _pluralRules; } function te(key, locale2) { const targetLocale = isString(locale2) ? locale2 : _locale.value; const message = getLocaleMessage(targetLocale); return _context.messageResolver(message, key) !== null; } function resolveMessages(key) { let messages3 = null; const locales = fallbackWithLocaleChain(_context, _fallbackLocale.value, _locale.value); for (let i = 0; i < locales.length; i++) { const targetLocaleMessages = _messages.value[locales[i]] || {}; const messageValue = _context.messageResolver(targetLocaleMessages, key); if (messageValue != null) { messages3 = messageValue; break; } } return messages3; } function tm(key) { const messages3 = resolveMessages(key); return messages3 != null ? messages3 : __root ? __root.tm(key) || {} : {}; } function getLocaleMessage(locale2) { return _messages.value[locale2] || {}; } function setLocaleMessage(locale2, message) { _messages.value[locale2] = message; _context.messages = _messages.value; } function mergeLocaleMessage(locale2, message) { _messages.value[locale2] = _messages.value[locale2] || {}; deepCopy(message, _messages.value[locale2]); _context.messages = _messages.value; } function getDateTimeFormat(locale2) { return _datetimeFormats.value[locale2] || {}; } function setDateTimeFormat(locale2, format2) { _datetimeFormats.value[locale2] = format2; _context.datetimeFormats = _datetimeFormats.value; clearDateTimeFormat(_context, locale2, format2); } function mergeDateTimeFormat(locale2, format2) { _datetimeFormats.value[locale2] = assign(_datetimeFormats.value[locale2] || {}, format2); _context.datetimeFormats = _datetimeFormats.value; clearDateTimeFormat(_context, locale2, format2); } function getNumberFormat(locale2) { return _numberFormats.value[locale2] || {}; } function setNumberFormat(locale2, format2) { _numberFormats.value[locale2] = format2; _context.numberFormats = _numberFormats.value; clearNumberFormat(_context, locale2, format2); } function mergeNumberFormat(locale2, format2) { _numberFormats.value[locale2] = assign(_numberFormats.value[locale2] || {}, format2); _context.numberFormats = _numberFormats.value; clearNumberFormat(_context, locale2, format2); } composerID++; if (__root && inBrowser) { vue.watch(__root.locale, (val) => { if (_inheritLocale) { _locale.value = val; _context.locale = val; updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); } }); vue.watch(__root.fallbackLocale, (val) => { if (_inheritLocale) { _fallbackLocale.value = val; _context.fallbackLocale = val; updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); } }); } const composer = { id: composerID, locale, fallbackLocale, get inheritLocale() { return _inheritLocale; }, set inheritLocale(val) { _inheritLocale = val; if (val && __root) { _locale.value = __root.locale.value; _fallbackLocale.value = __root.fallbackLocale.value; updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); } }, get availableLocales() { return Object.keys(_messages.value).sort(); }, messages: messages2, get modifiers() { return _modifiers; }, get pluralRules() { return _pluralRules || {}; }, get isGlobal() { return _isGlobal; }, get missingWarn() { return _missingWarn; }, set missingWarn(val) { _missingWarn = val; _context.missingWarn = _missingWarn; }, get fallbackWarn() { return _fallbackWarn; }, set fallbackWarn(val) { _fallbackWarn = val; _context.fallbackWarn = _fallbackWarn; }, get fallbackRoot() { return _fallbackRoot; }, set fallbackRoot(val) { _fallbackRoot = val; }, get fallbackFormat() { return _fallbackFormat; }, set fallbackFormat(val) { _fallbackFormat = val; _context.fallbackFormat = _fallbackFormat; }, get warnHtmlMessage() { return _warnHtmlMessage; }, set warnHtmlMessage(val) { _warnHtmlMessage = val; _context.warnHtmlMessage = val; }, get escapeParameter() { return _escapeParameter; }, set escapeParameter(val) { _escapeParameter = val; _context.escapeParameter = val; }, t, getLocaleMessage, setLocaleMessage, mergeLocaleMessage, getPostTranslationHandler, setPostTranslationHandler, getMissingHandler, setMissingHandler, [SetPluralRulesSymbol]: setPluralRules }; { composer.datetimeFormats = datetimeFormats; composer.numberFormats = numberFormats; composer.rt = rt; composer.te = te; composer.tm = tm; composer.d = d; composer.n = n; composer.getDateTimeFormat = getDateTimeFormat; composer.setDateTimeFormat = setDateTimeFormat; composer.mergeDateTimeFormat = mergeDateTimeFormat; composer.getNumberFormat = getNumberFormat; composer.setNumberFormat = setNumberFormat; composer.mergeNumberFormat = mergeNumberFormat; composer[InejctWithOption] = options.__injectWithOption; composer[TransrateVNodeSymbol] = transrateVNode; composer[DatetimePartsSymbol] = datetimeParts; composer[NumberPartsSymbol] = numberParts; } if (process.env.NODE_ENV !== "production") { composer[EnableEmitter] = (emitter) => { _context.__v_emitter = emitter; }; composer[DisableEmitter] = () => { _context.__v_emitter = void 0; }; } return composer; } function convertComposerOptions(options) { const locale = isString(options.locale) ? options.locale : DEFAULT_LOCALE; const fallbackLocale = isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : locale; const missing = isFunction(options.missing) ? options.missing : void 0; const missingWarn = isBoolean(options.silentTranslationWarn) || isRegExp(options.silentTranslationWarn) ? !options.silentTranslationWarn : true; const fallbackWarn = isBoolean(options.silentFallbackWarn) || isRegExp(options.silentFallbackWarn) ? !options.silentFallbackWarn : true; const fallbackRoot = isBoolean(options.fallbackRoot) ? options.fallbackRoot : true; const fallbackFormat = !!options.formatFallbackMessages; const modifiers = isPlainObject(options.modifiers) ? options.modifiers : {}; const pluralizationRules = options.pluralizationRules; const postTranslation = isFunction(options.postTranslation) ? options.postTranslation : void 0; const warnHtmlMessage = isString(options.warnHtmlInMessage) ? options.warnHtmlInMessage !== "off" : true; const escapeParameter = !!options.escapeParameterHtml; const inheritLocale = isBoolean(options.sync) ? options.sync : true; if (process.env.NODE_ENV !== "production" && options.formatter) { warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER)); } if (process.env.NODE_ENV !== "production" && options.preserveDirectiveContent) { warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE)); } let messages2 = options.messages; if (isPlainObject(options.sharedMessages)) { const sharedMessages = options.sharedMessages; const locales = Object.keys(sharedMessages); messages2 = locales.reduce((messages3, locale2) => { const message = messages3[locale2] || (messages3[locale2] = {}); assign(message, sharedMessages[locale2]); return messages3; }, messages2 || {}); } const { __i18n, __root, __injectWithOption } = options; const datetimeFormats = options.datetimeFormats; const numberFormats = options.numberFormats; const flatJson = options.flatJson; return { locale, fallbackLocale, messages: messages2, flatJson, datetimeFormats, numberFormats, missing, missingWarn, fallbackWarn, fallbackRoot, fallbackFormat, modifiers, pluralRules: pluralizationRules, postTranslation, warnHtmlMessage, escapeParameter, messageResolver: options.messageResolver, inheritLocale, __i18n, __root, __injectWithOption }; } function createVueI18n(options = {}, VueI18nLegacy) { { const composer = createComposer(convertComposerOptions(options)); const vueI18n = { id: composer.id, get locale() { return composer.locale.value; }, set locale(val) { composer.locale.value = val; }, get fallbackLocale() { return composer.fallbackLocale.value; }, set fallbackLocale(val) { composer.fallbackLocale.value = val; }, get messages() { return composer.messages.value; }, get datetimeFormats() { return composer.datetimeFormats.value; }, get numberFormats() { return composer.numberFormats.value; }, get availableLocales() { return composer.availableLocales; }, get formatter() { process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER)); return { interpolate() { return []; } }; }, set formatter(val) { process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER)); }, get missing() { return composer.getMissingHandler(); }, set missing(handler) { composer.setMissingHandler(handler); }, get silentTranslationWarn() { return isBoolean(composer.missingWarn) ? !composer.missingWarn : composer.missingWarn; }, set silentTranslationWarn(val) { composer.missingWarn = isBoolean(val) ? !val : val; }, get silentFallbackWarn() { return isBoolean(composer.fallbackWarn) ? !composer.fallbackWarn : composer.fallbackWarn; }, set silentFallbackWarn(val) { composer.fallbackWarn = isBoolean(val) ? !val : val; }, get modifiers() { return composer.modifiers; }, get formatFallbackMessages() { return composer.fallbackFormat; }, set formatFallbackMessages(val) { composer.fallbackFormat = val; }, get postTranslation() { return composer.getPostTranslationHandler(); }, set postTranslation(handler) { composer.setPostTranslationHandler(handler); }, get sync() { return composer.inheritLocale; }, set sync(val) { composer.inheritLocale = val; }, get warnHtmlInMessage() { return composer.warnHtmlMessage ? "warn" : "off"; }, set warnHtmlInMessage(val) { composer.warnHtmlMessage = val !== "off"; }, get escapeParameterHtml() { return composer.escapeParameter; }, set escapeParameterHtml(val) { composer.escapeParameter = val; }, get preserveDirectiveContent() { process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE)); return true; }, set preserveDirectiveContent(val) { process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE)); }, get pluralizationRules() { return composer.pluralRules || {}; }, __composer: composer, t(...args) { const [arg1, arg2, arg3] = args; const options2 = {}; let list = null; let named = null; if (!isString(arg1)) { throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT); } const key = arg1; if (isString(arg2)) { options2.locale = arg2; } else if (isArray(arg2)) { list = arg2; } else if (isPlainObject(arg2)) { named = arg2; } if (isArray(arg3)) { list = arg3; } else if (isPlainObject(arg3)) { named = arg3; } return Reflect.apply(composer.t, composer, [ key, list || named || {}, options2 ]); }, rt(...args) { return Reflect.apply(composer.rt, composer, [...args]); }, tc(...args) { const [arg1, arg2, arg3] = args; const options2 = { plural: 1 }; let list = null; let named = null; if (!isString(arg1)) { throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT); } const key = arg1; if (isString(arg2)) { options2.locale = arg2; } else if (isNumber(arg2)) { options2.plural = arg2; } else if (isArray(arg2)) { list = arg2; } else if (isPlainObject(arg2)) { named = arg2; } if (isString(arg3)) { options2.locale = arg3; } else if (isArray(arg3)) { list = arg3; } else if (isPlainObject(arg3)) { named = arg3; } return Reflect.apply(composer.t, composer, [ key, list || named || {}, options2 ]); }, te(key, locale) { return composer.te(key, locale); }, tm(key) { return composer.tm(key); }, getLocaleMessage(locale) { return composer.getLocaleMessage(locale); }, setLocaleMessage(locale, message) { composer.setLocaleMessage(locale, message); }, mergeLocaleMessage(locale, message) { composer.mergeLocaleMessage(locale, message); }, d(...args) { return Reflect.apply(composer.d, composer, [...args]); }, getDateTimeFormat(locale) { return composer.getDateTimeFormat(locale); }, setDateTimeFormat(locale, format2) { composer.setDateTimeFormat(locale, format2); }, mergeDateTimeFormat(locale, format2) { composer.mergeDateTimeFormat(locale, format2); }, n(...args) { return Reflect.apply(composer.n, composer, [...args]); }, getNumberFormat(locale) { return composer.getNumberFormat(locale); }, setNumberFormat(locale, format2) { composer.setNumberFormat(locale, format2); }, mergeNumberFormat(locale, format2) { composer.mergeNumberFormat(locale, format2); }, getChoiceIndex(choice, choicesLength) { process.env.NODE_ENV !== "production" && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX)); return -1; }, __onComponentInstanceCreated(target) { const { componentInstanceCreatedListener } = options; if (componentInstanceCreatedListener) { componentInstanceCreatedListener(target, vueI18n); } } }; if (process.env.NODE_ENV !== "production") { vueI18n.__enableEmitter = (emitter) => { const __composer = composer; __composer[EnableEmitter] && __composer[EnableEmitter](emitter); }; vueI18n.__disableEmitter = () => { const __composer = composer; __composer[DisableEmitter] && __composer[DisableEmitter](); }; } return vueI18n; } } const baseFormatProps = { tag: { type: [String, Object] }, locale: { type: String }, scope: { type: String, validator: (val) => val === "parent" || val === "global", default: "parent" }, i18n: { type: Object } }; function getInterpolateArg({ slots }, keys) { if (keys.length === 1 && keys[0] === "default") { const ret = slots.default ? slots.default() : []; return ret.reduce((slot, current) => { return slot = [ ...slot, ...isArray(current.children) ? current.children : [current] ]; }, []); } else { return keys.reduce((arg, key) => { const slot = slots[key]; if (slot) { arg[key] = slot(); } return arg; }, {}); } } function getFragmentableTag(tag) { return vue.Fragment; } const Translation = { name: "i18n-t", props: assign({ keypath: { type: String, required: true }, plural: { type: [Number, String], validator: (val) => isNumber(val) || !isNaN(val) } }, baseFormatProps), setup(props, context) { const { slots, attrs } = context; const i18n2 = props.i18n || useI18n({ useScope: props.scope, __useComponent: true }); return () => { const keys = Object.keys(slots).filter((key) => key !== "_"); const options = {}; if (props.locale) { options.locale = props.locale; } if (props.plural !== void 0) { options.plural = isString(props.plural) ? +props.plural : props.plural; } const arg = getInterpolateArg(context, keys); const children = i18n2[TransrateVNodeSymbol](props.keypath, arg, options); const assignedAttrs = assign({}, attrs); const tag = isString(props.tag) || isObject(props.tag) ? props.tag : getFragmentableTag(); return vue.h(tag, assignedAttrs, children); }; } }; function isVNode(target) { return isArray(target) && !isString(target[0]); } function renderFormatter(props, context, slotKeys, partFormatter) { const { slots, attrs } = context; return () => { const options = { part: true }; let overrides = {}; if (props.locale) { options.locale = props.locale; } if (isString(props.format)) { options.key = props.format; } else if (isObject(props.format)) { if (isString(props.format.key)) { options.key = props.format.key; } overrides = Object.keys(props.format).reduce((options2, prop) => { return slotKeys.includes(prop) ? assign({}, options2, { [prop]: props.format[prop] }) : options2; }, {}); } const parts = partFormatter(...[props.value, options, overrides]); let children = [options.key]; if (isArray(parts)) { children = parts.map((part, index2) => { const slot = slots[part.type]; const node = slot ? slot({ [part.type]: part.value, index: index2, parts }) : [part.value]; if (isVNode(node)) { node[0].key = `${part.type}-${index2}`; } return node; }); } else if (isString(parts)) { children = [parts]; } const assignedAttrs = assign({}, attrs); const tag = isString(props.tag) || isObject(props.tag) ? props.tag : getFragmentableTag(); return vue.h(tag, assignedAttrs, children); }; } const NumberFormat = { name: "i18n-n", props: assign({ value: { type: Number, required: true }, format: { type: [String, Object] } }, baseFormatProps), setup(props, context) { const i18n2 = props.i18n || useI18n({ useScope: "parent", __useComponent: true }); return renderFormatter(props, context, NUMBER_FORMAT_OPTIONS_KEYS, (...args) => i18n2[NumberPartsSymbol](...args)); } }; const DatetimeFormat = { name: "i18n-d", props: assign({ value: { type: [Number, Date], required: true }, format: { type: [String, Object] } }, baseFormatProps), setup(props, context) { const i18n2 = props.i18n || useI18n({ useScope: "parent", __useComponent: true }); return renderFormatter(props, context, DATETIME_FORMAT_OPTIONS_KEYS, (...args) => i18n2[DatetimePartsSymbol](...args)); } }; function getComposer$2(i18n2, instance) { const i18nInternal = i18n2; if (i18n2.mode === "composition") { return i18nInternal.__getInstance(instance) || i18n2.global; } else { const vueI18n = i18nInternal.__getInstance(instance); return vueI18n != null ? vueI18n.__composer : i18n2.global.__composer; } } function vTDirective(i18n2) { const _process = (binding) => { const { instance, modifiers, value } = binding; if (!instance || !instance.$) { throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR); } const composer = getComposer$2(i18n2, instance.$); if (process.env.NODE_ENV !== "production" && modifiers.preserve) { warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE)); } const parsedValue = parseValue(value); return [ Reflect.apply(composer.t, composer, [...makeParams(parsedValue)]), composer ]; }; const register = (el, binding) => { const [textContent, composer] = _process(binding); if (inBrowser && i18n2.global === composer) { el.__i18nWatcher = vue.watch(composer.locale, () => { binding.instance && binding.instance.$forceUpdate(); }); } el.__composer = composer; el.textContent = textContent; }; const unregister = (el) => { if (inBrowser && el.__i18nWatcher) { el.__i18nWatcher(); el.__i18nWatcher = void 0; delete el.__i18nWatcher; } if (el.__composer) { el.__composer = void 0; delete el.__composer; } }; const update = (el, { value }) => { if (el.__composer) { const composer = el.__composer; const parsedValue = parseValue(value); el.textContent = Reflect.apply(composer.t, composer, [ ...makeParams(parsedValue) ]); } }; const getSSRProps = (binding) => { const [textContent] = _process(binding); return { textContent }; }; return { created: register, unmounted: unregister, beforeUpdate: update, getSSRProps }; } function parseValue(value) { if (isString(value)) { return { path: value }; } else if (isPlainObject(value)) { if (!("path" in value)) { throw createI18nError(I18nErrorCodes.REQUIRED_VALUE, "path"); } return value; } else { throw createI18nError(I18nErrorCodes.INVALID_VALUE); } } function makeParams(value) { const { path, locale, args, choice, plural } = value; const options = {}; const named = args || {}; if (isString(locale)) { options.locale = locale; } if (isNumber(choice)) { options.plural = choice; } if (isNumber(plural)) { options.plural = plural; } return [path, named, options]; } function apply(app, i18n2, ...options) { const pluginOptions = isPlainObject(options[0]) ? options[0] : {}; const useI18nComponentName = !!pluginOptions.useI18nComponentName; const globalInstall = isBoolean(pluginOptions.globalInstall) ? pluginOptions.globalInstall : true; if (process.env.NODE_ENV !== "production" && globalInstall && useI18nComponentName) { warn(getWarnMessage(I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE, { name: Translation.name })); } if (globalInstall) { app.component(!useI18nComponentName ? Translation.name : "i18n", Translation); app.component(NumberFormat.name, NumberFormat); app.component(DatetimeFormat.name, DatetimeFormat); } { app.directive("t", vTDirective(i18n2)); } } const VUE_I18N_COMPONENT_TYPES = "vue-i18n: composer properties"; let devtoolsApi; async function enableDevTools(app, i18n2) { return new Promise((resolve, reject) => { try { setupDevtoolsPlugin({ id: "vue-devtools-plugin-vue-i18n", label: VueDevToolsLabels["vue-devtools-plugin-vue-i18n"], packageName: "vue-i18n", homepage: "https://vue-i18n.intlify.dev", logo: "https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png", componentStateTypes: [VUE_I18N_COMPONENT_TYPES], app }, (api) => { devtoolsApi = api; api.on.visitComponentTree(({ componentInstance, treeNode }) => { updateComponentTreeTags(componentInstance, treeNode, i18n2); }); api.on.inspectComponent(({ componentInstance, instanceData }) => { if (componentInstance.vnode.el && componentInstance.vnode.el.__VUE_I18N__ && instanceData) { if (i18n2.mode === "legacy") { if (componentInstance.vnode.el.__VUE_I18N__ !== i18n2.global.__composer) { inspectComposer(instanceData, componentInstance.vnode.el.__VUE_I18N__); } } else { inspectComposer(instanceData, componentInstance.vnode.el.__VUE_I18N__); } } }); api.addInspector({ id: "vue-i18n-resource-inspector", label: VueDevToolsLabels["vue-i18n-resource-inspector"], icon: "language", treeFilterPlaceholder: VueDevToolsPlaceholders["vue-i18n-resource-inspector"] }); api.on.getInspectorTree((payload) => { if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector") { registerScope(payload, i18n2); } }); const roots = /* @__PURE__ */ new Map(); api.on.getInspectorState(async (payload) => { if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector") { api.unhighlightElement(); inspectScope(payload, i18n2); if (payload.nodeId === "global") { if (!roots.has(payload.app)) { const [root] = await api.getComponentInstances(payload.app); roots.set(payload.app, root); } api.highlightElement(roots.get(payload.app)); } else { const instance = getComponentInstance(payload.nodeId, i18n2); instance && api.highlightElement(instance); } } }); api.on.editInspectorState((payload) => { if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector") { editScope(payload, i18n2); } }); api.addTimelineLayer({ id: "vue-i18n-timeline", label: VueDevToolsLabels["vue-i18n-timeline"], color: VueDevToolsTimelineColors["vue-i18n-timeline"] }); resolve(true); }); } catch (e) { console.error(e); reject(false); } }); } function getI18nScopeLable(instance) { return instance.type.name || instance.type.displayName || instance.type.__file || "Anonymous"; } function updateComponentTreeTags(instance, treeNode, i18n2) { const global2 = i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer; if (instance && instance.vnode.el && instance.vnode.el.__VUE_I18N__) { if (instance.vnode.el.__VUE_I18N__ !== global2) { const tag = { label: `i18n (${getI18nScopeLable(instance)} Scope)`, textColor: 0, backgroundColor: 16764185 }; treeNode.tags.push(tag); } } } function inspectComposer(instanceData, composer) { const type = VUE_I18N_COMPONENT_TYPES; instanceData.state.push({ type, key: "locale", editable: true, value: composer.locale.value }); instanceData.state.push({ type, key: "availableLocales", editable: false, value: composer.availableLocales }); instanceData.state.push({ type, key: "fallbackLocale", editable: true, value: composer.fallbackLocale.value }); instanceData.state.push({ type, key: "inheritLocale", editable: true, value: composer.inheritLocale }); instanceData.state.push({ type, key: "messages", editable: false, value: getLocaleMessageValue(composer.messages.value) }); { instanceData.state.push({ type, key: "datetimeFormats", editable: false, value: composer.datetimeFormats.value }); instanceData.state.push({ type, key: "numberFormats", editable: false, value: composer.numberFormats.value }); } } function getLocaleMessageValue(messages2) { const value = {}; Object.keys(messages2).forEach((key) => { const v = messages2[key]; if (isFunction(v) && "source" in v) { value[key] = getMessageFunctionDetails(v); } else if (isObject(v)) { value[key] = getLocaleMessageValue(v); } else { value[key] = v; } }); return value; } const ESC = { "<": "<", ">": ">", '"': """, "&": "&" }; function escape(s) { return s.replace(/[<>"&]/g, escapeChar); } function escapeChar(a) { return ESC[a] || a; } function getMessageFunctionDetails(func) { const argString = func.source ? `("${escape(func.source)}")` : `(?)`; return { _custom: { type: "function", display: `\u0192 ${argString}` } }; } function registerScope(payload, i18n2) { payload.rootNodes.push({ id: "global", label: "Global Scope" }); const global2 = i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer; for (const [keyInstance, instance] of i18n2.__instances) { const composer = i18n2.mode === "composition" ? instance : instance.__composer; if (global2 === composer) { continue; } payload.rootNodes.push({ id: composer.id.toString(), label: `${getI18nScopeLable(keyInstance)} Scope` }); } } function getComponentInstance(nodeId, i18n2) { let instance = null; if (nodeId !== "global") { for (const [component, composer] of i18n2.__instances.entries()) { if (composer.id.toString() === nodeId) { instance = component; break; } } } return instance; } function getComposer$1(nodeId, i18n2) { if (nodeId === "global") { return i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer; } else { const instance = Array.from(i18n2.__instances.values()).find((item) => item.id.toString() === nodeId); if (instance) { return i18n2.mode === "composition" ? instance : instance.__composer; } else { return null; } } } function inspectScope(payload, i18n2) { const composer = getComposer$1(payload.nodeId, i18n2); if (composer) { payload.state = makeScopeInspectState(composer); } return null; } function makeScopeInspectState(composer) { const state = {}; const localeType = "Locale related info"; const localeStates = [ { type: localeType, key: "locale", editable: true, value: composer.locale.value }, { type: localeType, key: "fallbackLocale", editable: true, value: composer.fallbackLocale.value }, { type: localeType, key: "availableLocales", editable: false, value: composer.availableLocales }, { type: localeType, key: "inheritLocale", editable: true, value: composer.inheritLocale } ]; state[localeType] = localeStates; const localeMessagesType = "Locale messages info"; const localeMessagesStates = [ { type: localeMessagesType, key: "messages", editable: false, value: getLocaleMessageValue(composer.messages.value) } ]; state[localeMessagesType] = localeMessagesStates; { const datetimeFormatsType = "Datetime formats info"; const datetimeFormatsStates = [ { type: datetimeFormatsType, key: "datetimeFormats", editable: false, value: composer.datetimeFormats.value } ]; state[datetimeFormatsType] = datetimeFormatsStates; const numberFormatsType = "Datetime formats info"; const numberFormatsStates = [ { type: numberFormatsType, key: "numberFormats", editable: false, value: composer.numberFormats.value } ]; state[numberFormatsType] = numberFormatsStates; } return state; } function addTimelineEvent(event, payload) { if (devtoolsApi) { let groupId; if (payload && "groupId" in payload) { groupId = payload.groupId; delete payload.groupId; } devtoolsApi.addTimelineEvent({ layerId: "vue-i18n-timeline", event: { title: event, groupId, time: Date.now(), meta: {}, data: payload || {}, logType: event === "compile-error" ? "error" : event === "fallback" || event === "missing" ? "warning" : "default" } }); } } function editScope(payload, i18n2) { const composer = getComposer$1(payload.nodeId, i18n2); if (composer) { const [field] = payload.path; if (field === "locale" && isString(payload.state.value)) { composer.locale.value = payload.state.value; } else if (field === "fallbackLocale" && (isString(payload.state.value) || isArray(payload.state.value) || isObject(payload.state.value))) { composer.fallbackLocale.value = payload.state.value; } else if (field === "inheritLocale" && isBoolean(payload.state.value)) { composer.inheritLocale = payload.state.value; } } } function defineMixin(vuei18n, composer, i18n2) { return { beforeCreate() { const instance = vue.getCurrentInstance(); if (!instance) { throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR); } const options = this.$options; if (options.i18n) { const optionsI18n = options.i18n; if (options.__i18n) { optionsI18n.__i18n = options.__i18n; } optionsI18n.__root = composer; if (this === this.$root) { this.$i18n = mergeToRoot(vuei18n, optionsI18n); } else { optionsI18n.__injectWithOption = true; this.$i18n = createVueI18n(optionsI18n); } } else if (options.__i18n) { if (this === this.$root) { this.$i18n = mergeToRoot(vuei18n, options); } else { this.$i18n = createVueI18n({ __i18n: options.__i18n, __injectWithOption: true, __root: composer }); } } else { this.$i18n = vuei18n; } if (options.__i18nGlobal) { adjustI18nResources(composer, options, options); } vuei18n.__onComponentInstanceCreated(this.$i18n); i18n2.__setInstance(instance, this.$i18n); this.$t = (...args) => this.$i18n.t(...args); this.$rt = (...args) => this.$i18n.rt(...args); this.$tc = (...args) => this.$i18n.tc(...args); this.$te = (key, locale) => this.$i18n.te(key, locale); this.$d = (...args) => this.$i18n.d(...args); this.$n = (...args) => this.$i18n.n(...args); this.$tm = (key) => this.$i18n.tm(key); }, mounted() { if ((process.env.NODE_ENV !== "production" || false) && true && this.$el && this.$i18n) { this.$el.__VUE_I18N__ = this.$i18n.__composer; const emitter = this.__v_emitter = createEmitter(); const _vueI18n = this.$i18n; _vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter); emitter.on("*", addTimelineEvent); } }, unmounted() { const instance = vue.getCurrentInstance(); if (!instance) { throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR); } if ((process.env.NODE_ENV !== "production" || false) && true && this.$el && this.$el.__VUE_I18N__) { if (this.__v_emitter) { this.__v_emitter.off("*", addTimelineEvent); delete this.__v_emitter; } if (this.$i18n) { const _vueI18n = this.$i18n; _vueI18n.__disableEmitter && _vueI18n.__disableEmitter(); delete this.$el.__VUE_I18N__; } } delete this.$t; delete this.$rt; delete this.$tc; delete this.$te; delete this.$d; delete this.$n; delete this.$tm; i18n2.__deleteInstance(instance); delete this.$i18n; } }; } function mergeToRoot(root, options) { root.locale = options.locale || root.locale; root.fallbackLocale = options.fallbackLocale || root.fallbackLocale; root.missing = options.missing || root.missing; root.silentTranslationWarn = options.silentTranslationWarn || root.silentFallbackWarn; root.silentFallbackWarn = options.silentFallbackWarn || root.silentFallbackWarn; root.formatFallbackMessages = options.formatFallbackMessages || root.formatFallbackMessages; root.postTranslation = options.postTranslation || root.postTranslation; root.warnHtmlInMessage = options.warnHtmlInMessage || root.warnHtmlInMessage; root.escapeParameterHtml = options.escapeParameterHtml || root.escapeParameterHtml; root.sync = options.sync || root.sync; root.__composer[SetPluralRulesSymbol](options.pluralizationRules || root.pluralizationRules); const messages2 = getLocaleMessages(root.locale, { messages: options.messages, __i18n: options.__i18n }); Object.keys(messages2).forEach((locale) => root.mergeLocaleMessage(locale, messages2[locale])); if (options.datetimeFormats) { Object.keys(options.datetimeFormats).forEach((locale) => root.mergeDateTimeFormat(locale, options.datetimeFormats[locale])); } if (options.numberFormats) { Object.keys(options.numberFormats).forEach((locale) => root.mergeNumberFormat(locale, options.numberFormats[locale])); } return root; } const I18nInjectionKey = /* @__PURE__ */ makeSymbol("global-vue-i18n"); function createI18n(options = {}, VueI18nLegacy) { const __legacyMode = __VUE_I18N_LEGACY_API__ && isBoolean(options.legacy) ? options.legacy : __VUE_I18N_LEGACY_API__; const __globalInjection = isBoolean(options.globalInjection) ? options.globalInjection : true; const __allowComposition = __VUE_I18N_LEGACY_API__ && __legacyMode ? !!options.allowComposition : true; const __instances = /* @__PURE__ */ new Map(); const [globalScope, __global] = createGlobal(options, __legacyMode); const symbol = makeSymbol(process.env.NODE_ENV !== "production" ? "vue-i18n" : ""); function __getInstance(component) { return __instances.get(component) || null; } function __setInstance(component, instance) { __instances.set(component, instance); } function __deleteInstance(component) { __instances.delete(component); } { const i18n2 = { get mode() { return __VUE_I18N_LEGACY_API__ && __legacyMode ? "legacy" : "composition"; }, get allowComposition() { return __allowComposition; }, async install(app, ...options2) { if ((process.env.NODE_ENV !== "production" || false) && true) { app.__VUE_I18N__ = i18n2; } app.__VUE_I18N_SYMBOL__ = symbol; app.provide(app.__VUE_I18N_SYMBOL__, i18n2); if (!__legacyMode && __globalInjection) { injectGlobalFields(app, i18n2.global); } if (__VUE_I18N_FULL_INSTALL__) { apply(app, i18n2, ...options2); } if (__VUE_I18N_LEGACY_API__ && __legacyMode) { app.mixin(defineMixin(__global, __global.__composer, i18n2)); } const unmountApp = app.unmount; app.unmount = () => { i18n2.dispose(); unmountApp(); }; if ((process.env.NODE_ENV !== "production" || false) && true) { const ret = await enableDevTools(app, i18n2); if (!ret) { throw createI18nError(I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN); } const emitter = createEmitter(); if (__legacyMode) { const _vueI18n = __global; _vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter); } else { const _composer = __global; _composer[EnableEmitter] && _composer[EnableEmitter](emitter); } emitter.on("*", addTimelineEvent); } }, get global() { return __global; }, dispose() { globalScope.stop(); }, __instances, __getInstance, __setInstance, __deleteInstance }; return i18n2; } } function useI18n(options = {}) { const instance = vue.getCurrentInstance(); if (instance == null) { throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP); } if (!instance.isCE && instance.appContext.app != null && !instance.appContext.app.__VUE_I18N_SYMBOL__) { throw createI18nError(I18nErrorCodes.NOT_INSLALLED); } const i18n2 = getI18nInstance(instance); const global2 = getGlobalComposer(i18n2); const componentOptions = getComponentOptions(instance); const scope = getScope(options, componentOptions); if (__VUE_I18N_LEGACY_API__) { if (i18n2.mode === "legacy" && !options.__useComponent) { if (!i18n2.allowComposition) { throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE); } return useI18nForLegacy(instance, scope, global2, options); } } if (scope === "global") { adjustI18nResources(global2, options, componentOptions); return global2; } if (scope === "parent") { let composer2 = getComposer(i18n2, instance, options.__useComponent); if (composer2 == null) { if (process.env.NODE_ENV !== "production") { warn(getWarnMessage(I18nWarnCodes.NOT_FOUND_PARENT_SCOPE)); } composer2 = global2; } return composer2; } const i18nInternal = i18n2; let composer = i18nInternal.__getInstance(instance); if (composer == null) { const composerOptions = assign({}, options); if ("__i18n" in componentOptions) { composerOptions.__i18n = componentOptions.__i18n; } if (global2) { composerOptions.__root = global2; } composer = createComposer(composerOptions); setupLifeCycle(i18nInternal, instance, composer); i18nInternal.__setInstance(instance, composer); } return composer; } function createGlobal(options, legacyMode, VueI18nLegacy) { const scope = vue.effectScope(); { const obj = __VUE_I18N_LEGACY_API__ && legacyMode ? scope.run(() => createVueI18n(options)) : scope.run(() => createComposer(options)); if (obj == null) { throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR); } return [scope, obj]; } } function getI18nInstance(instance) { { const i18n2 = vue.inject(!instance.isCE ? instance.appContext.app.__VUE_I18N_SYMBOL__ : I18nInjectionKey); if (!i18n2) { throw createI18nError(!instance.isCE ? I18nErrorCodes.UNEXPECTED_ERROR : I18nErrorCodes.NOT_INSLALLED_WITH_PROVIDE); } return i18n2; } } function getScope(options, componentOptions) { return isEmptyObject(options) ? "__i18n" in componentOptions ? "local" : "global" : !options.useScope ? "local" : options.useScope; } function getGlobalComposer(i18n2) { return i18n2.mode === "composition" ? i18n2.global : i18n2.global.__composer; } function getComposer(i18n2, target, useComponent = false) { let composer = null; const root = target.root; let current = target.parent; while (current != null) { const i18nInternal = i18n2; if (i18n2.mode === "composition") { composer = i18nInternal.__getInstance(current); } else { if (__VUE_I18N_LEGACY_API__) { const vueI18n = i18nInternal.__getInstance(current); if (vueI18n != null) { composer = vueI18n.__composer; if (useComponent && composer && !composer[InejctWithOption]) { composer = null; } } } } if (composer != null) { break; } if (root === current) { break; } current = current.parent; } return composer; } function setupLifeCycle(i18n2, target, composer) { let emitter = null; { vue.onMounted(() => { if ((process.env.NODE_ENV !== "production" || false) && true && target.vnode.el) { target.vnode.el.__VUE_I18N__ = composer; emitter = createEmitter(); const _composer = composer; _composer[EnableEmitter] && _composer[EnableEmitter](emitter); emitter.on("*", addTimelineEvent); } }, target); vue.onUnmounted(() => { if ((process.env.NODE_ENV !== "production" || false) && true && target.vnode.el && target.vnode.el.__VUE_I18N__) { emitter && emitter.off("*", addTimelineEvent); const _composer = composer; _composer[DisableEmitter] && _composer[DisableEmitter](); delete target.vnode.el.__VUE_I18N__; } i18n2.__deleteInstance(target); }, target); } } function useI18nForLegacy(instance, scope, root, options = {}) { const isLocale = scope === "local"; const _composer = vue.shallowRef(null); if (isLocale && instance.proxy && !(instance.proxy.$options.i18n || instance.proxy.$options.__i18n)) { throw createI18nError(I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION); } const _inheritLocale = isBoolean(options.inheritLocale) ? options.inheritLocale : true; const _locale = vue.ref( isLocale && _inheritLocale ? root.locale.value : isString(options.locale) ? options.locale : DEFAULT_LOCALE ); const _fallbackLocale = vue.ref( isLocale && _inheritLocale ? root.fallbackLocale.value : isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value ); const _messages = vue.ref(getLocaleMessages(_locale.value, options)); const _datetimeFormats = vue.ref(isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} }); const _numberFormats = vue.ref(isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} }); const _missingWarn = isLocale ? root.missingWarn : isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true; const _fallbackWarn = isLocale ? root.fallbackWarn : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true; const _fallbackRoot = isLocale ? root.fallbackRoot : isBoolean(options.fallbackRoot) ? options.fallbackRoot : true; const _fallbackFormat = !!options.fallbackFormat; const _missing = isFunction(options.missing) ? options.missing : null; const _postTranslation = isFunction(options.postTranslation) ? options.postTranslation : null; const _warnHtmlMessage = isLocale ? root.warnHtmlMessage : isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true; const _escapeParameter = !!options.escapeParameter; const _modifiers = isLocale ? root.modifiers : isPlainObject(options.modifiers) ? options.modifiers : {}; const _pluralRules = options.pluralRules || isLocale && root.pluralRules; function trackReactivityValues() { return [ _locale.value, _fallbackLocale.value, _messages.value, _datetimeFormats.value, _numberFormats.value ]; } const locale = vue.computed({ get: () => { return _composer.value ? _composer.value.locale.value : _locale.value; }, set: (val) => { if (_composer.value) { _composer.value.locale.value = val; } _locale.value = val; } }); const fallbackLocale = vue.computed({ get: () => { return _composer.value ? _composer.value.fallbackLocale.value : _fallbackLocale.value; }, set: (val) => { if (_composer.value) { _composer.value.fallbackLocale.value = val; } _fallbackLocale.value = val; } }); const messages2 = vue.computed(() => { if (_composer.value) { return _composer.value.messages.value; } else { return _messages.value; } }); const datetimeFormats = vue.computed(() => _datetimeFormats.value); const numberFormats = vue.computed(() => _numberFormats.value); function getPostTranslationHandler() { return _composer.value ? _composer.value.getPostTranslationHandler() : _postTranslation; } function setPostTranslationHandler(handler) { if (_composer.value) { _composer.value.setPostTranslationHandler(handler); } } function getMissingHandler() { return _composer.value ? _composer.value.getMissingHandler() : _missing; } function setMissingHandler(handler) { if (_composer.value) { _composer.value.setMissingHandler(handler); } } function warpWithDeps(fn) { trackReactivityValues(); return fn(); } function t(...args) { return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.t, null, [...args])) : warpWithDeps(() => ""); } function rt(...args) { return _composer.value ? Reflect.apply(_composer.value.rt, null, [...args]) : ""; } function d(...args) { return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.d, null, [...args])) : warpWithDeps(() => ""); } function n(...args) { return _composer.value ? warpWithDeps(() => Reflect.apply(_composer.value.n, null, [...args])) : warpWithDeps(() => ""); } function tm(key) { return _composer.value ? _composer.value.tm(key) : {}; } function te(key, locale2) { return _composer.value ? _composer.value.te(key, locale2) : false; } function getLocaleMessage(locale2) { return _composer.value ? _composer.value.getLocaleMessage(locale2) : {}; } function setLocaleMessage(locale2, message) { if (_composer.value) { _composer.value.setLocaleMessage(locale2, message); _messages.value[locale2] = message; } } function mergeLocaleMessage(locale2, message) { if (_composer.value) { _composer.value.mergeLocaleMessage(locale2, message); } } function getDateTimeFormat(locale2) { return _composer.value ? _composer.value.getDateTimeFormat(locale2) : {}; } function setDateTimeFormat(locale2, format2) { if (_composer.value) { _composer.value.setDateTimeFormat(locale2, format2); _datetimeFormats.value[locale2] = format2; } } function mergeDateTimeFormat(locale2, format2) { if (_composer.value) { _composer.value.mergeDateTimeFormat(locale2, format2); } } function getNumberFormat(locale2) { return _composer.value ? _composer.value.getNumberFormat(locale2) : {}; } function setNumberFormat(locale2, format2) { if (_composer.value) { _composer.value.setNumberFormat(locale2, format2); _numberFormats.value[locale2] = format2; } } function mergeNumberFormat(locale2, format2) { if (_composer.value) { _composer.value.mergeNumberFormat(locale2, format2); } } const wrapper = { get id() { return _composer.value ? _composer.value.id : -1; }, locale, fallbackLocale, messages: messages2, datetimeFormats, numberFormats, get inheritLocale() { return _composer.value ? _composer.value.inheritLocale : _inheritLocale; }, set inheritLocale(val) { if (_composer.value) { _composer.value.inheritLocale = val; } }, get availableLocales() { return _composer.value ? _composer.value.availableLocales : Object.keys(_messages.value); }, get modifiers() { return _composer.value ? _composer.value.modifiers : _modifiers; }, get pluralRules() { return _composer.value ? _composer.value.pluralRules : _pluralRules; }, get isGlobal() { return _composer.value ? _composer.value.isGlobal : false; }, get missingWarn() { return _composer.value ? _composer.value.missingWarn : _missingWarn; }, set missingWarn(val) { if (_composer.value) { _composer.value.missingWarn = val; } }, get fallbackWarn() { return _composer.value ? _composer.value.fallbackWarn : _fallbackWarn; }, set fallbackWarn(val) { if (_composer.value) { _composer.value.missingWarn = val; } }, get fallbackRoot() { return _composer.value ? _composer.value.fallbackRoot : _fallbackRoot; }, set fallbackRoot(val) { if (_composer.value) { _composer.value.fallbackRoot = val; } }, get fallbackFormat() { return _composer.value ? _composer.value.fallbackFormat : _fallbackFormat; }, set fallbackFormat(val) { if (_composer.value) { _composer.value.fallbackFormat = val; } }, get warnHtmlMessage() { return _composer.value ? _composer.value.warnHtmlMessage : _warnHtmlMessage; }, set warnHtmlMessage(val) { if (_composer.value) { _composer.value.warnHtmlMessage = val; } }, get escapeParameter() { return _composer.value ? _composer.value.escapeParameter : _escapeParameter; }, set escapeParameter(val) { if (_composer.value) { _composer.value.escapeParameter = val; } }, t, getPostTranslationHandler, setPostTranslationHandler, getMissingHandler, setMissingHandler, rt, d, n, tm, te, getLocaleMessage, setLocaleMessage, mergeLocaleMessage, getDateTimeFormat, setDateTimeFormat, mergeDateTimeFormat, getNumberFormat, setNumberFormat, mergeNumberFormat }; function sync(composer) { composer.locale.value = _locale.value; composer.fallbackLocale.value = _fallbackLocale.value; Object.keys(_messages.value).forEach((locale2) => { composer.mergeLocaleMessage(locale2, _messages.value[locale2]); }); Object.keys(_datetimeFormats.value).forEach((locale2) => { composer.mergeDateTimeFormat(locale2, _datetimeFormats.value[locale2]); }); Object.keys(_numberFormats.value).forEach((locale2) => { composer.mergeNumberFormat(locale2, _numberFormats.value[locale2]); }); composer.escapeParameter = _escapeParameter; composer.fallbackFormat = _fallbackFormat; composer.fallbackRoot = _fallbackRoot; composer.fallbackWarn = _fallbackWarn; composer.missingWarn = _missingWarn; composer.warnHtmlMessage = _warnHtmlMessage; } vue.onBeforeMount(() => { if (instance.proxy == null || instance.proxy.$i18n == null) { throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY); } const composer = _composer.value = instance.proxy.$i18n.__composer; if (scope === "global") { _locale.value = composer.locale.value; _fallbackLocale.value = composer.fallbackLocale.value; _messages.value = composer.messages.value; _datetimeFormats.value = composer.datetimeFormats.value; _numberFormats.value = composer.numberFormats.value; } else if (isLocale) { sync(composer); } }); return wrapper; } const globalExportProps = [ "locale", "fallbackLocale", "availableLocales" ]; const globalExportMethods = ["t", "rt", "d", "n", "tm"]; function injectGlobalFields(app, composer) { const i18n2 = /* @__PURE__ */ Object.create(null); globalExportProps.forEach((prop) => { const desc = Object.getOwnPropertyDescriptor(composer, prop); if (!desc) { throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR); } const wrap = vue.isRef(desc.value) ? { get() { return desc.value.value; }, set(val) { desc.value.value = val; } } : { get() { return desc.get && desc.get(); } }; Object.defineProperty(i18n2, prop, wrap); }); app.config.globalProperties.$i18n = i18n2; globalExportMethods.forEach((method) => { const desc = Object.getOwnPropertyDescriptor(composer, method); if (!desc || !desc.value) { throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR); } Object.defineProperty(app.config.globalProperties, `$${method}`, desc); }); } registerMessageCompiler(compileToFunction); registerMessageResolver(resolveValue); registerLocaleFallbacker(fallbackWithLocaleChain); { initFeatureFlags(); } if (process.env.NODE_ENV !== "production" || __INTLIFY_PROD_DEVTOOLS__) { const target = getGlobalThis(); target.__INTLIFY__ = true; setDevToolsHook(target.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__); } if (process.env.NODE_ENV !== "production") ; const _hoisted_1$9 = ["xlink:href"]; const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({ __name: "VssueIcon", props: { name: null, title: { default: "" } }, setup(__props) { const props = __props; return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("svg", { "aria-hidden": "", class: vue.normalizeClass(["vssue-icon", `vssue-icon-${props.name}`]) }, [ vue.createElementVNode("title", null, vue.toDisplayString(props.title), 1), vue.createElementVNode("use", { "xlink:href": `#vssue-icon-${props.name}` }, null, 8, _hoisted_1$9) ], 2); }; } }); const _hoisted_1$8 = { class: "vssue-comment-avatar" }; const _hoisted_2$4 = ["href", "title"]; const _hoisted_3$3 = ["src", "alt"]; const _hoisted_4$3 = { class: "vssue-comment-body" }; const _hoisted_5$3 = { class: "vssue-comment-header" }; const _hoisted_6$3 = { class: "vssue-comment-author" }; const _hoisted_7$3 = ["href", "title"]; const _hoisted_8$3 = { class: "vssue-comment-created-at" }; const _hoisted_9$2 = { class: "vssue-comment-main" }; const _hoisted_10$2 = ["rows"]; const _hoisted_11$1 = ["innerHTML"]; const _hoisted_12$1 = { class: "vssue-comment-footer" }; const _hoisted_13 = { key: 0, class: "vssue-comment-hint" }; const _hoisted_14 = { key: 1, class: "vssue-comment-reactions" }; const _hoisted_15 = ["title", "onClick"]; const _hoisted_16 = { class: "vssue-comment-reaction-number" }; const _hoisted_17 = { class: "vssue-comment-operations" }; const _hoisted_18 = ["title"]; const _hoisted_19 = ["title"]; const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueComment", props: { comment: null }, emits: ["editComment", "error", "reply-comment"], setup(__props, { emit: emits }) { const props = __props; const { t } = useI18n(); const vssue = vue.inject("vssue"); const input = vue.ref(null); const editMode = vue.ref(false); const editContent = vue.ref(props.comment.contentRaw); const creatingReactions = vue.ref([]); const isPutingComment = vue.ref(false); const isDeletingComment = vue.ref(false); const currentUser = vue.computed(() => vssue.VssueState.user ? vssue.VssueState.user.username : null); const content = vue.computed(() => props.comment.content); const author = vue.computed(() => props.comment.author); const createdAt = vue.computed(() => formatDateTime(props.comment.createdAt)); vue.computed(() => formatDateTime(props.comment.updatedAt)); const showReactions = vue.computed(() => { var _a; return Boolean( ((_a = vssue.VssueState.API) == null ? void 0 : _a.platform.meta.reactable) && props.comment.reactions && editMode.value ); }); const reactionKeys = vue.computed(() => ["heart", "like", "unlike"]); const editContentRows = vue.computed(() => editContent.value.split("\n").length - 1); const editInputRows = vue.computed(() => editContentRows.value < 3 ? 5 : editContentRows.value + 2); const postReaction = async ({ reaction }) => { try { if (creatingReactions.value.includes(reaction)) return; creatingReactions.value.push(reaction); const success = await vssue.VssueState.postCommentReaction({ commentId: props.comment.id, reaction }); if (!success) { emits( "error", new Error( t("reactionGiven", { reaction: t(reaction) }) ) ); } const reactions = await vssue.VssueState.getCommentReactions({ commentId: props.comment.id }); if (reactions) emits("editComment", reactions); } finally { creatingReactions.value.splice( creatingReactions.value.findIndex((item) => item === reaction), 1 ); } }; const enterEdit = () => { editMode.value = true; vue.nextTick(() => { var _a; (_a = input.value) == null ? void 0 : _a.focus(); }); }; const resetEdit = () => { editMode.value = false; editContent.value = props.comment.contentRaw; }; const putComment = async () => { try { if (vssue.isPending.value) return; if (editContent.value !== props.comment.contentRaw) { isPutingComment.value = true; vssue.VssueState.isUpdatingComment = true; const comment = await vssue.putComment({ commentId: props.comment.id, content: editContent.value }); if (comment) { vssue.VssueState.comments.data.splice( vssue.VssueState.comments.data.findIndex( (item) => item.id === comment.id ), 1, comment ); } } editMode.value = false; } finally { isPutingComment.value = false; vssue.VssueState.isUpdatingComment = false; } }; const deleteComment = async () => { try { if (vssue.isPending.value) return; if (!window.confirm(t("deleteConfirm"))) return; isDeletingComment.value = true; vssue.VssueState.isUpdatingComment = true; const success = await vssue.deleteComment({ commentId: props.comment.id }); if (success) { vssue.VssueState.comments.count -= 1; if (vssue.VssueState.comments.data.length > 1) { vssue.VssueState.comments.data.splice( vssue.VssueState.comments.data.findIndex( (item) => item.id === props.comment.id ), 1 ); } if (vssue.VssueState.query.page > 1 && vssue.VssueState.query.page > Math.ceil(vssue.VssueState.comments.count / vssue.VssueState.query.perPage)) vssue.VssueState.query.page -= 1; else await vssue.getComments(); } else { vssue.$emit( "error", new Error(t("deleteFailed")) ); } } finally { isDeletingComment.value = false; vssue.VssueState.isUpdatingComment = false; } }; return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(["vssue-comment", { "vssue-comment-edit-mode": editMode.value, "vssue-comment-disabled": isDeletingComment.value || isPutingComment.value }]) }, [ vue.createElementVNode("div", _hoisted_1$8, [ vue.createElementVNode("a", { href: vue.unref(author).homepage, title: vue.unref(author).username, target: "_blank", rel: "noopener noreferrer" }, [ vue.createElementVNode("img", { src: vue.unref(author).avatar, alt: vue.unref(author).username }, null, 8, _hoisted_3$3) ], 8, _hoisted_2$4) ]), vue.createElementVNode("div", _hoisted_4$3, [ vue.renderSlot(_ctx.$slots, "body", {}, () => [ vue.createElementVNode("div", _hoisted_5$3, [ vue.createElementVNode("span", _hoisted_6$3, [ vue.createElementVNode("a", { href: vue.unref(author).homepage, title: vue.unref(author).username, target: "_blank", rel: "noopener noreferrer" }, vue.toDisplayString(vue.unref(author).username), 9, _hoisted_7$3) ]), vue.createElementVNode("span", _hoisted_8$3, vue.toDisplayString(vue.unref(createdAt)), 1) ]), vue.createElementVNode("div", _hoisted_9$2, [ editMode.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("textarea", { key: 0, ref_key: "input", ref: input, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => editContent.value = $event), class: "vssue-edit-comment-input", rows: vue.unref(editInputRows), onKeyup: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => putComment(), ["ctrl"]), ["enter"])) }, null, 40, _hoisted_10$2)), [ [vue.vModelText, editContent.value] ]) : (vue.openBlock(), vue.createElementBlock("article", { key: 1, class: "markdown-body", innerHTML: vue.unref(content) }, null, 8, _hoisted_11$1)) ]), vue.createElementVNode("div", _hoisted_12$1, [ editMode.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_13, vue.toDisplayString(vue.unref(t)("editMode")), 1)) : vue.createCommentVNode("", true), vue.unref(showReactions) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(reactionKeys), (reaction) => { var _a, _b; return vue.openBlock(), vue.createElementBlock("span", { key: reaction, class: "vssue-comment-reaction", title: vue.unref(t)( creatingReactions.value.includes(reaction) ? "loading" : reaction ), onClick: ($event) => postReaction({ reaction }) }, [ vue.createVNode(_sfc_main$a, { name: creatingReactions.value.includes(reaction) ? "loading" : reaction, title: vue.unref(t)( creatingReactions.value.includes(reaction) ? "loading" : reaction ) }, null, 8, ["name", "title"]), vue.createElementVNode("span", _hoisted_16, vue.toDisplayString((_b = (_a = __props.comment) == null ? void 0 : _a.reactions) == null ? void 0 : _b[reaction]), 1) ], 8, _hoisted_15); }), 128)) ])) : vue.createCommentVNode("", true), vue.createElementVNode("span", _hoisted_17, [ __props.comment.author.username === vue.unref(currentUser) && editMode.value ? (vue.openBlock(), vue.createElementBlock("span", { key: 0, class: vue.normalizeClass(["vssue-comment-operation", { "vssue-comment-operation-muted": isPutingComment.value }]), title: vue.unref(t)(isPutingComment.value ? "loading" : "submit"), onClick: _cache[2] || (_cache[2] = ($event) => putComment()) }, [ vue.withDirectives(vue.createVNode(_sfc_main$a, { name: "loading", title: vue.unref(t)("loading") }, null, 8, ["title"]), [ [vue.vShow, isPutingComment.value] ]), vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)("submit")), 1) ], 10, _hoisted_18)) : vue.createCommentVNode("", true), __props.comment.author.username === vue.unref(currentUser) && editMode.value ? (vue.openBlock(), vue.createElementBlock("span", { key: 1, class: "vssue-comment-operation vssue-comment-operation-muted", title: vue.unref(t)("cancel"), onClick: _cache[3] || (_cache[3] = ($event) => resetEdit()) }, vue.toDisplayString(vue.unref(t)("cancel")), 9, _hoisted_19)) : vue.createCommentVNode("", true), __props.comment.author.username === vue.unref(currentUser) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { key: 2, class: "vssue-comment-operation", onClick: _cache[4] || (_cache[4] = ($event) => enterEdit()) }, [ vue.createVNode(_sfc_main$a, { name: "edit", title: vue.unref(t)("edit") }, null, 8, ["title"]) ], 512)), [ [vue.vShow, !editMode.value] ]) : vue.createCommentVNode("", true), __props.comment.author.username === vue.unref(currentUser) || vue.unref(vssue).isAdmin.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { key: 3, class: "vssue-comment-operation", onClick: _cache[5] || (_cache[5] = ($event) => deleteComment()) }, [ vue.createVNode(_sfc_main$a, { name: isDeletingComment.value ? "loading" : "delete", title: vue.unref(t)(isDeletingComment.value ? "loading" : "delete") }, null, 8, ["name", "title"]) ], 512)), [ [vue.vShow, !editMode.value] ]) : vue.createCommentVNode("", true), vue.withDirectives(vue.createElementVNode("span", { class: "vssue-comment-operation", onClick: _cache[6] || (_cache[6] = ($event) => vue.unref(vssue).setReplyContent(__props.comment)) }, [ vue.createVNode(_sfc_main$a, { name: "reply", title: vue.unref(t)("reply") }, null, 8, ["title"]) ], 512), [ [vue.vShow, !editMode.value] ]) ]) ]) ]) ]) ], 2); }; } }); const _hoisted_1$7 = { class: "vssue-pagination" }; const _hoisted_2$3 = { class: "vssue-pagination-per-page" }; const _hoisted_3$2 = ["disabled"]; const _hoisted_4$2 = ["value"]; const _hoisted_5$2 = ["title"]; const _hoisted_6$2 = { class: "vssue-pagination-page" }; const _hoisted_7$2 = ["title"]; const _hoisted_8$2 = ["disabled"]; const _hoisted_9$1 = ["value"]; const _hoisted_10$1 = ["textContent"]; const _hoisted_11 = ["textContent"]; const _hoisted_12 = ["title"]; const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({ __name: "VssuePagination", setup(__props) { const { t } = useI18n(); const vssue = vue.inject("vssue"); const disabled = vue.computed(() => vssue.isPending.value); const pageCount = vue.computed(() => { const pageCount2 = Math.ceil( vssue.VssueState.comments.count / vssue.VssueState.comments.perPage ); return pageCount2 > 1 ? pageCount2 : 1; }); const perPageOptions = vue.computed(() => { const perPageOptions2 = [5, 10, 20, 50]; if (!perPageOptions2.includes(vssue.VssueState.options.perPage) && vssue.VssueState.options.perPage < 100) perPageOptions2.push(vssue.VssueState.options.perPage); return perPageOptions2.sort((a, b) => a - b); }); const page = vue.computed({ get() { return vssue.VssueState.query.page > pageCount.value ? pageCount.value : vssue.VssueState.query.page; }, set(val) { if (val > 0 && val <= pageCount.value) vssue.VssueState.query.page = val; } }); const perPage = vue.computed({ get() { return vssue.VssueState.query.perPage; }, set(val) { if (perPageOptions.value.includes(val)) vssue.VssueState.query.perPage = val; } }); return (_ctx, _cache) => { var _a; return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [ vue.createElementVNode("div", _hoisted_2$3, [ vue.createElementVNode("label", null, [ vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(perPage) ? perPage.value = $event : null), class: "vssue-pagination-select", disabled: vue.unref(disabled) }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(perPageOptions), (val) => { return vue.openBlock(), vue.createElementBlock("option", { key: val, value: val }, vue.toDisplayString(val), 9, _hoisted_4$2); }), 128)) ], 8, _hoisted_3$2), [ [vue.vModelSelect, vue.unref(perPage)] ]), vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(t)("perPage")), 1) ]), ((_a = vue.unref(vssue).VssueState.API) == null ? void 0 : _a.platform.meta.sortable) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0, class: vue.normalizeClass(["vssue-pagination-link", { disabled: vue.unref(disabled) }]), title: vue.unref(t)("sort"), onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(vssue).VssueState.query.sort = vue.unref(vssue).VssueState.query.sort === "asc" ? "desc" : "asc") }, vue.toDisplayString(vue.unref(vssue).VssueState.query.sort === "asc" ? `\u2191` : `\u2193`), 11, _hoisted_5$2)) : vue.createCommentVNode("", true) ]), vue.createElementVNode("div", _hoisted_6$2, [ vue.createElementVNode("span", { class: vue.normalizeClass(["vssue-pagination-link", { disabled: vue.unref(page) === 1 || vue.unref(disabled) }]), title: vue.unref(t)("prev"), onClick: _cache[2] || (_cache[2] = ($event) => page.value -= 1), textContent: `<` }, null, 10, _hoisted_7$2), vue.createElementVNode("label", null, [ vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(t)("page")), 1), vue.withDirectives(vue.createElementVNode("select", { "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.isRef(page) ? page.value = $event : null), class: "vssue-pagination-select", disabled: vue.unref(disabled) }, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pageCount), (val) => { return vue.openBlock(), vue.createElementBlock("option", { key: val, value: val }, vue.toDisplayString(val), 9, _hoisted_9$1); }), 128)) ], 8, _hoisted_8$2), [ [vue.vShow, vue.unref(pageCount) > 1], [vue.vModelSelect, vue.unref(page)] ]), vue.withDirectives(vue.createElementVNode("span", { textContent: vue.toDisplayString(vue.unref(page)) }, null, 8, _hoisted_10$1), [ [vue.vShow, vue.unref(pageCount) < 2] ]), vue.createElementVNode("span", { textContent: vue.toDisplayString(` / ${vue.unref(pageCount)} `) }, null, 8, _hoisted_11) ]), vue.createElementVNode("span", { class: vue.normalizeClass(["vssue-pagination-link", { disabled: vue.unref(page) === vue.unref(pageCount) || vue.unref(disabled) }]), title: vue.unref(t)("next"), onClick: _cache[4] || (_cache[4] = ($event) => page.value += 1), textContent: `>` }, null, 10, _hoisted_12) ]) ]); }; } }); const _hoisted_1$6 = { class: "vssue-comments" }; const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueComments", setup(__props) { const vssue = vue.inject("vssue"); return (_ctx, _cache) => { var _a; return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [ vue.createVNode(_sfc_main$8), vue.createVNode(_sfc_main$b, { group: "" }, { default: vue.withCtx(() => { var _a2; return [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList((_a2 = vue.unref(vssue).VssueState.comments) == null ? void 0 : _a2.data, (comment) => { return vue.openBlock(), vue.createBlock(_sfc_main$9, { key: comment.id, comment, onEditComment: ($event) => comment.reactions = $event, onReplyComment: _cache[0] || (_cache[0] = () => { }) }, null, 8, ["comment", "onEditComment"]); }), 128)) ]; }), _: 1 }), vue.withDirectives(vue.createVNode(_sfc_main$8, null, null, 512), [ [vue.vShow, (((_a = vue.unref(vssue).VssueState.comments) == null ? void 0 : _a.data.length) || 0) > 5] ]) ]); }; } }); const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueButton", props: { type: { default: "default" } }, setup(__props) { const props = __props; return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("button", { class: vue.normalizeClass(["vssue-button", `vssue-button-${props.type}`]) }, [ vue.renderSlot(_ctx.$slots, "default") ], 2); }; } }); const _hoisted_1$5 = { class: "vssue-new-comment" }; const _hoisted_2$2 = { class: "vssue-comment-avatar" }; const _hoisted_3$1 = ["href", "title"]; const _hoisted_4$1 = ["src", "alt"]; const _hoisted_5$1 = { class: "vssue-new-comment-body" }; const _hoisted_6$1 = ["rows", "disabled", "placeholder"]; const _hoisted_7$1 = { class: "vssue-new-comment-footer" }; const _hoisted_8$1 = { key: 0, class: "vssue-current-user" }; const _hoisted_9 = { key: 1, class: "vssue-current-user" }; const _hoisted_10 = { class: "vssue-new-comment-operations" }; const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueNewComment", setup(__props) { const { t } = useI18n(); const vssue = vue.inject("vssue"); const input = vue.ref(null); const content = vue.ref(""); const user = vue.computed(() => vssue.VssueState.user); const platform = vue.computed(() => { var _a; return (_a = vssue.VssueState.API) == null ? void 0 : _a.platform.name; }); const loading = vue.computed(() => vssue.VssueState.isCreatingComment); const isInputDisabled = vue.computed(() => loading.value || user.value === null || vssue.VssueState.issue === null); const isSubmitDisabled = vue.computed(() => content.value === "" || vssue.isPending.value || vssue.VssueState.issue === null); const contentRows = vue.computed(() => content.value.split("\n").length - 1); const inputRows = vue.computed(() => contentRows.value < 3 ? 5 : contentRows.value + 2); vue.watch(() => vssue.VssueState.replyContent, (replyContent) => { content.value = `${replyContent} ${content.value}`; vue.nextTick(() => { var _a; (_a = input.value) == null ? void 0 : _a.focus(); }); }); const submit = async () => { if (isSubmitDisabled.value) return; await vssue.postComment({ content: content.value }); content.value = ""; await vssue.getComments(); }; return (_ctx, _cache) => { var _a; return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [ vue.createElementVNode("div", _hoisted_2$2, [ vue.unref(user) ? (vue.openBlock(), vue.createElementBlock("a", { key: 0, href: vue.unref(user).homepage, title: vue.unref(user).username, target: "_blank", rel: "noopener noreferrer" }, [ vue.createElementVNode("img", { src: vue.unref(user).avatar, alt: vue.unref(user).username }, null, 8, _hoisted_4$1) ], 8, _hoisted_3$1)) : (vue.openBlock(), vue.createBlock(_sfc_main$a, { key: 1, name: ((_a = vue.unref(platform)) == null ? void 0 : _a.toLowerCase()) || "", title: vue.unref(t)("loginToComment", { platform: vue.unref(platform) }), onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(vssue).login()) }, null, 8, ["name", "title"])) ]), vue.createElementVNode("div", _hoisted_5$1, [ vue.withDirectives(vue.createElementVNode("textarea", { ref_key: "input", ref: input, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => content.value = $event), class: "vssue-new-comment-input", rows: vue.unref(inputRows), disabled: vue.unref(isInputDisabled), placeholder: vue.unref(t)(vue.unref(user) ? "placeholder" : "noLoginPlaceHolder"), spellcheck: false, "aria-label": "leave a comment", onKeyup: _cache[2] || (_cache[2] = vue.withKeys(vue.withModifiers(($event) => submit(), ["ctrl"]), ["enter"])) }, null, 40, _hoisted_6$1), [ [vue.vModelText, content.value] ]) ]), vue.createElementVNode("div", _hoisted_7$1, [ vue.unref(user) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$1, [ vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(t)("currentUser")) + " - " + vue.toDisplayString(vue.unref(user).username) + " - ", 1), vue.createElementVNode("a", { class: "vssue-logout", onClick: _cache[3] || (_cache[3] = ($event) => vue.unref(vssue).logout()) }, vue.toDisplayString(vue.unref(t)("logout")), 1) ])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_9, vue.toDisplayString(vue.unref(t)("loginToComment", { platform: vue.unref(platform) })), 1)), vue.createElementVNode("div", _hoisted_10, [ vue.unref(user) ? (vue.openBlock(), vue.createBlock(_sfc_main$6, { key: 0, class: "vssue-button-submit-comment", type: "primary", disabled: vue.unref(isSubmitDisabled), onClick: _cache[4] || (_cache[4] = ($event) => submit()) }, { default: vue.withCtx(() => [ vue.withDirectives(vue.createVNode(_sfc_main$a, { name: "loading" }, null, 512), [ [vue.vShow, vue.unref(loading)] ]), vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)(vue.unref(loading) ? "submitting" : "submitComment")), 1) ]), _: 1 }, 8, ["disabled"])) : (vue.openBlock(), vue.createBlock(_sfc_main$6, { key: 1, class: "vssue-button-login", type: "primary", title: vue.unref(t)("loginToComment", { platform: vue.unref(platform) }), onClick: _cache[5] || (_cache[5] = ($event) => vue.unref(vssue).login()) }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(vue.unref(t)("login", { platform: vue.unref(platform) })), 1) ]), _: 1 }, 8, ["title"])) ]) ]) ]); }; } }); const _hoisted_1$4 = { class: "vssue-notice" }; const _hoisted_2$1 = ["textContent"]; const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueNotice", setup(__props) { const vssue = vue.inject("vssue"); const progress = vue.reactive({ show: false, percent: 0, timer: null, speed: 200 }); const alert = vue.reactive({ show: false, message: null, timer: null }); const progressStart = () => { progress.show = true; progress.percent = 0; progress.timer = window.setInterval(() => { progress.percent += 5; if (progress.percent > 94 && progress.timer !== null) window.clearInterval(progress.timer); }, progress.speed); }; const progressDone = () => { progress.percent = 100; if (progress.timer !== null) window.clearTimeout(progress.timer); progress.timer = null; window.setTimeout(() => { progress.show = false; }, progress.speed); }; const alertHide = () => { alert.show = false; if (alert.timer !== null) window.clearTimeout(alert.timer); alert.timer = null; }; vue.watch(() => vssue.VssueState.isLoadingComments, (val) => { if (vssue.VssueState.comments) { if (val) progressStart(); else progressDone(); } }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [ vue.withDirectives(vue.createElementVNode("div", { class: "vssue-progress", style: vue.normalizeStyle({ width: `${progress.percent}%`, transition: `all ${progress.speed}ms linear` }) }, null, 4), [ [vue.vShow, progress.show] ]), vue.createVNode(_sfc_main$b, null, { default: vue.withCtx(() => [ vue.withDirectives(vue.createElementVNode("div", { class: "vssue-alert", onClick: _cache[0] || (_cache[0] = ($event) => alertHide()), textContent: vue.toDisplayString(alert.message) }, null, 8, _hoisted_2$1), [ [vue.vShow, alert.show] ]) ]), _: 1 }) ]); }; } }); const _hoisted_1$3 = { class: "vssue-status-info" }; const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueStatus", setup(__props) { const { t } = useI18n(); const vssue = vue.inject("vssue"); const status = vue.computed(() => { if (vssue.VssueState.isFailed) { return "failed"; } else if (vssue.VssueState.isInitializing) { return "initializing"; } else if (vssue.VssueState.isIssueNotCreated && !vssue.VssueState.isCreatingIssue) { if (vssue.isAdmin.value || !vssue.isLogined.value) return "issueNotCreated"; else return "failed"; } else if (vssue.VssueState.isLoginRequired) { return "loginRequired"; } else if (!vssue.VssueState.comments || vssue.VssueState.isCreatingIssue) { return "loadingComments"; } else if (vssue.VssueState.comments.data.length === 0) { return "noComments"; } else { return null; } }); const handleClick = () => { if (status.value === "issueNotCreated") vssue.postIssue(); else if (status.value === "loginRequired") vssue.login(); }; return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(_sfc_main$b, null, { default: vue.withCtx(() => [ vue.unref(status) ? (vue.openBlock(), vue.createElementBlock("div", { key: vue.unref(status), class: "vssue-status" }, [ ["failed", "loadingComments", "initializing"].includes(vue.unref(status)) ? (vue.openBlock(), vue.createBlock(_sfc_main$a, { key: 0, name: vue.unref(status) === "failed" ? "error" : "loading" }, null, 8, ["name"])) : vue.createCommentVNode("", true), vue.createElementVNode("p", _hoisted_1$3, [ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent( ["issueNotCreated", "loginRequired"].includes(vue.unref(status)) ? "a" : "span" ), { onClick: handleClick }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(vue.unref(t)(vue.unref(status))), 1) ]), _: 1 })) ]) ])) : vue.createCommentVNode("", true) ]), _: 1 }); }; } }); const _hoisted_1$2 = { key: 0, class: "vssue-body" }; const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueBody", setup(__props) { const vssue = vue.inject("vssue"); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(_sfc_main$b, null, { default: vue.withCtx(() => [ !vue.unref(vssue).VssueState.isInitializing ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [ vue.unref(vssue).VssueState.API ? (vue.openBlock(), vue.createBlock(_sfc_main$5, { key: 0 })) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$4), vue.createVNode(_sfc_main$b, null, { default: vue.withCtx(() => [ vue.unref(vssue).VssueState.comments && vue.unref(vssue).VssueState.comments.data.length > 0 ? (vue.openBlock(), vue.createBlock(_sfc_main$7, { key: 0 })) : (vue.openBlock(), vue.createBlock(_sfc_main$3, { key: 1 })) ]), _: 1 }) ])) : (vue.openBlock(), vue.createBlock(_sfc_main$3, { key: 1 })) ]), _: 1 }); }; } }); const _hoisted_1$1 = { class: "vssue-header" }; const _hoisted_2 = ["href"]; const _hoisted_3 = { class: "vssue-header-powered-by" }; const _hoisted_4 = /* @__PURE__ */ vue.createElementVNode("span", null, "Powered by", -1); const _hoisted_5 = { key: 0 }; const _hoisted_6 = ["href", "title"]; const _hoisted_7 = /* @__PURE__ */ vue.createElementVNode("span", null, "&", -1); const _hoisted_8 = ["title"]; const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({ __name: "VssueHeader", setup(__props) { const vssue = vue.inject("vssue"); const { t } = useI18n(); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [ vue.createElementVNode("a", { class: "vssue-header-comments-count", href: vue.unref(vssue).VssueState.issue ? vue.unref(vssue).VssueState.issue.link : void 0, target: "_blank", rel: "noopener noreferrer" }, [ vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(vssue).VssueState.comments ? vue.unref(t)("comments", { count: vue.unref(vssue).VssueState.comments.count }, vue.unref(vssue).VssueState.comments.count) : vue.unref(t)("comments", 0)), 1) ], 8, _hoisted_2), vue.createElementVNode("span", _hoisted_3, [ _hoisted_4, vue.unref(vssue).VssueState.API ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5, [ vue.createElementVNode("a", { href: vue.unref(vssue).VssueState.API.platform.link, title: `${vue.unref(vssue).VssueState.API.platform.name} API ${vue.unref(vssue).VssueState.API.platform.version}`, target: "_blank", rel: "noopener noreferrer" }, vue.toDisplayString(vue.unref(vssue).VssueState.API.platform.name), 9, _hoisted_6), _hoisted_7 ])) : vue.createCommentVNode("", true), vue.createElementVNode("a", { href: "https://github.com/liamrad/vssue", title: `Vssue-Vue3 v${vue.unref(vssue).version.value}`, target: "_blank", rel: "noopener noreferrer" }, " Vssue ", 8, _hoisted_8) ]) ]); }; } }); const version = "0.1.2"; const messages$8 = { login: "Anmelden mit {platform}", logout: "Abmelden", currentUser: "Aktueller Benutzer", loading: "Laden", submit: "Absenden", submitting: "Sendet", submitComment: "Kommentar absenden", cancel: "Abbrechen", edit: "Bearbeiten", editMode: "Bearbeitungsmodus", delete: "L\xF6schen", reply: "Antworten", heart: "Herz", like: "Gef\xE4llt mir", unlike: "Gef\xE4llt mir nicht", perPage: "Kommentare pro Seite", sort: "Klicken, um die Sortierrichtung zu \xE4ndern", page: "Seite", prev: "Vorherige Seite", next: "N\xE4chste Seite", comments: "Kommentare | {count} Kommentar | {count} Kommentare", loginToComment: "Mit {platform} Konto anmelden, um einen Kommentar zu hinterlassen", placeholder: "Hinterlasse einen Kommentar. Formatierung mit Markdown wird unterst\xFCtzt. Strg + Enter zum Absenden.", noLoginPlaceHolder: "Anmelden, um einen Kommentar zu hinterlassen. Formatierung mit Markdown wird unterst\xFCtzt.", failed: "Kommentare konnten nicht geladen werden", initializing: "Initialisierung...", issueNotCreated: "Klicken, um ein Issue zu erstellen", loadingComments: "Lade Kommentare...", loginRequired: "Anmelden, um Kommentare zu sehen", noComments: "Noch keine Kommentare. Hinterlasse den ersten Kommentar!", reactionGiven: "Reaktion '{reaction}' bereits gegeben", deleteConfirm: "M\xF6chten Sie diesen Kommentar wirklich l\xF6schen?", deleteFailed: "Kommentar konnte nicht gel\xF6scht werden" }; const messages$7 = { login: "Login with {platform}", logout: "Logout", currentUser: "Current User", loading: "Loading", submit: "Submit", submitting: "Submitting", submitComment: "Submit Comment", cancel: "Cancel", edit: "Edit", editMode: "Edit Mode", delete: "Delete", reply: "Reply", heart: "Heart", like: "Like", unlike: "Unlike", perPage: "Comments per page", sort: "Click to change the sort direction", page: "Page", prev: "Previous Page", next: "Next Page", comments: "Comments | {count} Comment | {count} Comments", loginToComment: "Login with {platform} account to leave a comment", placeholder: "Leave a comment. Styling with Markdown is supported. Ctrl + Enter to submit.", noLoginPlaceHolder: "Login to leave a comment. Styling with Markdown is supported. ", failed: "Failed to load comments", initializing: "Initializing...", issueNotCreated: "Click to create issue", loadingComments: "Loading comments...", loginRequired: "Login to view comments", noComments: "No comments yet. Leave the first comment !", reactionGiven: "Already given '{reaction}' reaction", deleteConfirm: "Confirm to delete this comment ?", deleteFailed: "Failed to delete comment" }; const messages$6 = { login: "\u4F7F\u7528 {platform} \u767B\u5F55", logout: "\u9000\u51FA\u767B\u5F55", currentUser: "\u5F53\u524D\u7528\u6237", loading: "\u52A0\u8F7D\u4E2D", submit: "\u63D0\u4EA4", submitting: "\u53D1\u8868\u4E2D", submitComment: "\u53D1\u8868\u8BC4\u8BBA", cancel: "\u53D6\u6D88", edit: "\u7F16\u8F91", editMode: "\u7F16\u8F91\u6A21\u5F0F", delete: "\u5220\u9664", reply: "\u56DE\u590D", heart: "\u559C\u6B22", like: "\u8D5E", unlike: "\u8E29", perPage: "\u6BCF\u9875\u8BC4\u8BBA\u6570", sort: "\u70B9\u51FB\u6539\u53D8\u6392\u5E8F\u65B9\u5F0F", page: "\u9875\u6570", prev: "\u4E0A\u4E00\u9875", next: "\u4E0B\u4E00\u9875", comments: "\u8BC4\u8BBA | {count} \u6761\u8BC4\u8BBA | {count} \u6761\u8BC4\u8BBA", loginToComment: "\u4F7F\u7528 {platform} \u5E10\u53F7\u767B\u5F55\u540E\u53D1\u8868\u8BC4\u8BBA", placeholder: "\u7559\u4E0B\u4F60\u7684\u8BC4\u8BBA\u4E28\u652F\u6301 Markdown \u8BED\u6CD5\u4E28Ctrl + Enter \u53D1\u8868\u8BC4\u8BBA", noLoginPlaceHolder: "\u767B\u5F55\u540E\u624D\u80FD\u53D1\u8868\u8BC4\u8BBA\u4E28\u652F\u6301 Markdown \u8BED\u6CD5", failed: "\u8BC4\u8BBA\u52A0\u8F7D\u5931\u8D25", initializing: "\u6B63\u5728\u521D\u59CB\u5316...", issueNotCreated: "\u70B9\u51FB\u521B\u5EFA Issue", loadingComments: "\u6B63\u5728\u52A0\u8F7D\u8BC4\u8BBA...", loginRequired: "\u767B\u5F55\u540E\u67E5\u770B\u8BC4\u8BBA", noComments: "\u8FD8\u6CA1\u6709\u8BC4\u8BBA\uFF0C\u6765\u53D1\u8868\u7B2C\u4E00\u6761\u8BC4\u8BBA\u5427\uFF01", reactionGiven: "\u5DF2\u7ECF\u6DFB\u52A0\u8FC7 '{reaction}' \u4E86", deleteConfirm: "\u786E\u8BA4\u8981\u5220\u9664\u8BE5\u8BC4\u8BBA\u5417\uFF1F", deleteFailed: "\u8BC4\u8BBA\u5220\u9664\u5931\u8D25" }; const messages$5 = { login: "\u4F7F\u7528 {platform} \u767B\u5165", logout: "\u767B\u51FA", currentUser: "\u7576\u524D\u7528\u6236", loading: "\u8F09\u5165\u4E2D", submit: "\u63D0\u4EA4", submitting: "\u767C\u8868\u4E2D", submitComment: "\u767C\u8868\u8A55\u8AD6", cancel: "\u53D6\u6D88", edit: "\u7DE8\u8F2F", editMode: "\u7DE8\u8F2F\u6A21\u5F0F", delete: "\u522A\u9664", reply: "\u56DE\u8986", heart: "\u559C\u6B61", like: "\u8D0A", unlike: "\u8E29", perPage: "\u6BCF\u9801\u8A55\u8AD6\u6578", sort: "\u9EDE\u64CA\u6539\u8B8A\u6392\u5E8F\u65B9\u5F0F", page: "\u9801\u6578", prev: "\u4E0A\u4E00\u9801", next: "\u4E0B\u4E00\u9801", comments: "\u8A55\u8AD6 | {count} \u689D\u8A55\u8AD6 | {count} \u689D\u8A55\u8AD6", loginToComment: "\u4F7F\u7528 {platform} \u5E33\u865F\u767B\u5165\u5F8C\u767C\u8868\u8A55\u8AD6", placeholder: "\u7559\u4E0B\u4F60\u7684\u8A55\u8AD6\u4E28\u652F\u6301 Markdown \u8A9E\u6CD5\u4E28Ctrl + Enter \u767C\u8868\u8A55\u8AD6", noLoginPlaceHolder: "\u767B\u5165\u5F8C\u624D\u80FD\u767C\u8868\u8A55\u8AD6\u4E28\u652F\u6301 Markdown \u8A9E\u6CD5", failed: "\u8A55\u8AD6\u52A0\u8F09\u5931\u6557", initializing: "\u6B63\u5728\u521D\u59CB\u5316...", issueNotCreated: "\u9EDE\u64CA\u5275\u5EFA Issue", loadingComments: "\u6B63\u5728\u52A0\u8F09\u8A55\u8AD6...", loginRequired: "\u767B\u5165\u5F8C\u67E5\u770B\u8A55\u8AD6", noComments: "\u9084\u6C92\u6709\u8A55\u8AD6\uFF0C\u4F86\u767C\u8868\u7B2C\u4E00\u689D\u8A55\u8AD6\u5427\uFF01", reactionGiven: "\u5DF2\u7D93\u9EDE\u64CA\u904E '{reaction}' \u4E86", deleteConfirm: "\u78BA\u8A8D\u8981\u522A\u9664\u8A72\u8A55\u8AD6\u55CE\uFF1F", deleteFailed: "\u8A55\u8AD6\u522A\u9664\u5931\u6557" }; const messages$4 = { login: "Entrar com {platform}", logout: "Sair", currentUser: "Usu\xE1rio Atual", loading: "Carregando", submit: "Enviar", submitting: "Enviando", submitComment: "Enviar Coment\xE1rio", cancel: "Cancelar", edit: "Editar", editMode: "Modo de Edi\xE7\xE3o", delete: "Apagar", reply: "Responder", heart: "Heart", like: "Like", unlike: "Unlike", perPage: "Coment\xE1rios por p\xE1gina", sort: "Clique para alterar a ordena\xE7\xE3o", page: "P\xE1gina", prev: "P\xE1gina Anterior", next: "Pr\xF3xima P\xE1gina", comments: "Coment\xE1rios | {count} Coment\xE1rio | {count} Coment\xE1rios", loginToComment: "Entre com uma conta {platform} para deixar um coment\xE1rio", placeholder: "Deixe um coment\xE1rio. Estilos com Markdown suportados. Ctrl + Enter para enviar.", noLoginPlaceHolder: "Entre para deixar um coment\xE1rio. Estilos com Markdown suportados. ", failed: "Falha ao carregar coment\xE1rios", initializing: "Inicializando...", issueNotCreated: "Click to create issue", loadingComments: "Carregando coment\xE1rios...", loginRequired: "Entrar para visualizar coment\xE1rios", noComments: "Nenhum coment\xE1rio. Deixe o primeiro coment\xE1rio!", reactionGiven: "J\xE1 reagiu com '{reaction}'", deleteConfirm: "Apagar este coment\xE1rio?", deleteFailed: "Falha ao apagar coment\xE1rio" }; const messages$3 = { login: "{platform} \u3067\u30ED\u30B0\u30A4\u30F3", logout: "\u30ED\u30B0\u30A2\u30A6\u30C8", currentUser: "\u73FE\u5728\u306E\u30E6\u30FC\u30B6\u30FC", loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D", submit: "\u9001\u4FE1", submitting: "\u9001\u4FE1\u4E2D", submitComment: "\u30B3\u30E1\u30F3\u30C8\u3092\u9001\u4FE1", cancel: "\u30AD\u30E3\u30F3\u30BB\u30EB", edit: "\u7DE8\u96C6", editMode: "\u7DE8\u96C6\u30E2\u30FC\u30C9", delete: "\u524A\u9664", reply: "\u8FD4\u4FE1", heart: "\u30CF\u30FC\u30C8", like: "\u9AD8\u8A55\u4FA1", unlike: "\u4F4E\u8A55\u4FA1", perPage: "\u30B3\u30E1\u30F3\u30C8/\u30DA\u30FC\u30B8", sort: "\u4E26\u3073\u9806\u3092\u5909\u66F4\u3059\u308B\u306B\u306F\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044", page: "\u30DA\u30FC\u30B8", prev: "\u524D\u306E\u30DA\u30FC\u30B8", next: "\u6B21\u306E\u30DA\u30FC\u30B8", comments: "\u30B3\u30E1\u30F3\u30C8 | {count} \u30B3\u30E1\u30F3\u30C8 | {count} \u30B3\u30E1\u30F3\u30C8", loginToComment: "\u30B3\u30E1\u30F3\u30C8\u3092\u6B8B\u3059\u306B\u306F {platform} \u30A2\u30AB\u30A6\u30F3\u30C8\u3067\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044\u3002", placeholder: "\u30B3\u30E1\u30F3\u30C8\u3092\u6B8B\u3057\u3066\u304F\u3060\u3055\u3044\u3002Markdown \u8A18\u6CD5\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u3059\u3002 Ctrl + Enter \u3067\u9001\u4FE1\u3067\u304D\u307E\u3059\u3002", noLoginPlaceHolder: "\u30B3\u30E1\u30F3\u30C8\u3092\u6B8B\u3059\u306B\u306F\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30DE\u30FC\u30AF\u30C0\u30A6\u30F3\u8A18\u6CD5\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u3059\u3002", failed: "\u30B3\u30E1\u30F3\u30C8\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F", initializing: "\u521D\u671F\u5316\u4E2D...", issueNotCreated: "Click to create issue", loadingComments: "\u30B3\u30E1\u30F3\u30C8\u306E\u8AAD\u307F\u8FBC\u307F\u4E2D...", loginRequired: "\u30B3\u30E1\u30F3\u30C8\u3092\u898B\u308B\u306B\u306F\u30ED\u30B0\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044", noComments: "\u307E\u3060\u30B3\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u521D\u306E\u30B3\u30E1\u30F3\u30C8\u3092\u6B8B\u3057\u307E\u3057\u3087\u3046\uFF01", reactionGiven: "\u65E2\u306B '{reaction}' \u306E\u30EA\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u3057\u3066\u3044\u307E\u3059", deleteConfirm: "\u672C\u5F53\u306B\u30B3\u30E1\u30F3\u30C8\u3092\u524A\u9664\u3057\u3066\u3082\u3044\u3044\u3067\u3059\u304B\uFF1F", deleteFailed: "\u30B3\u30E1\u30F3\u30C8\u306E\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F" }; const messages$2 = { login: "\u05D4\u05EA\u05D7\u05D1\u05E8\u05D5 \u05E2\u05DD {platform}", logout: "\u05D4\u05EA\u05E0\u05EA\u05E7\u05D5", currentUser: "\u05DE\u05E9\u05EA\u05DE\u05E9/\u05EA \u05E0\u05D5\u05DB\u05D7\u05D9/\u05EA", loading: "\u05D8\u05D5\u05E2\u05DF", submit: "\u05E9\u05DC\u05D9\u05D7\u05D4", submitting: "\u05E9\u05D5\u05DC\u05D7", submitComment: "\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05D2\u05D5\u05D1\u05D4", cancel: "\u05D1\u05D9\u05D8\u05DC", edit: "\u05E2\u05E8\u05D9\u05DB\u05D4", editMode: "\u05DE\u05E6\u05D1 \u05E2\u05E8\u05D9\u05DB\u05D4", delete: "\u05DE\u05D7\u05D9\u05E7\u05D4", reply: "\u05EA\u05E9\u05D5\u05D1\u05D4", heart: "\u05DC\u05D1", like: "\u05DC\u05D9\u05D9\u05E7", unlike: "\u05D0\u05E0\u05DC\u05D9\u05D9\u05E7", perPage: "\u05EA\u05D2\u05D5\u05D1\u05D5\u05EA \u05DC\u05D3\u05E3", sort: "\u05DC\u05D7\u05E6\u05D5 \u05DB\u05D3\u05D9 \u05DC\u05E9\u05E0\u05D5\u05EA \u05D0\u05EA \u05DB\u05D9\u05D5\u05D5\u05DF \u05D4\u05DE\u05D9\u05D5\u05DF", page: "\u05D3\u05E3", prev: "\u05D4\u05D3\u05E3 \u05D4\u05E7\u05D5\u05D3\u05DD", next: "\u05D4\u05D3\u05E3 \u05D4\u05D1\u05D0", comments: "\u05EA\u05D2\u05D5\u05D1\u05D5\u05EA | {count} \u05EA\u05D2\u05D5\u05D1\u05D4 | {count} \u05EA\u05D2\u05D5\u05D1\u05D5\u05EA", loginToComment: "\u05D4\u05EA\u05D7\u05D1\u05E8\u05D5 \u05E2\u05DD \u05D7\u05E9\u05D1\u05D5\u05DF {platform} \u05DB\u05D3\u05D9 \u05DC\u05D4\u05E9\u05D0\u05D9\u05E8 \u05EA\u05D2\u05D5\u05D1\u05D4", placeholder: "\u05D4\u05E9\u05D0\u05D9\u05E8\u05D5 \u05EA\u05D2\u05D5\u05D1\u05D4. \u05D9\u05E9 \u05EA\u05DE\u05D9\u05DB\u05D4 \u05D1\u05E2\u05D9\u05E6\u05D5\u05D1 \u05D1\u05E2\u05D6\u05E8\u05EA Markdown. Ctrl + Enter \u05DB\u05D3\u05D9 \u05DC\u05E9\u05DC\u05D5\u05D7.", noLoginPlaceHolder: "\u05D4\u05EA\u05D7\u05D1\u05E8\u05D5 \u05DB\u05D3\u05D9 \u05DC\u05D4\u05E9\u05D0\u05D9\u05E8 \u05EA\u05D2\u05D5\u05D1\u05D4. \u05D9\u05E9 \u05EA\u05DE\u05D9\u05DB\u05D4 \u05D1\u05E2\u05D9\u05E6\u05D5\u05D1 \u05D1\u05E2\u05D6\u05E8\u05EA Markdown. ", failed: "\u05DB\u05E9\u05DC\u05D5\u05DF \u05D1\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05EA\u05D2\u05D5\u05D1\u05D5\u05EA", initializing: "\u05DE\u05D0\u05EA\u05D7\u05DC...", issueNotCreated: "\u05DC\u05D7\u05E6\u05D5 \u05DC\u05D9\u05E6\u05D9\u05E8\u05EA issue", loadingComments: "\u05D8\u05D5\u05E2\u05DF \u05EA\u05D2\u05D5\u05D1\u05D5\u05EA...", loginRequired: "\u05D4\u05EA\u05D7\u05D1\u05E8\u05D5 \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E4\u05D5\u05EA \u05D1\u05EA\u05D2\u05D5\u05D1\u05D5\u05EA", noComments: "\u05E2\u05D3\u05D9\u05D9\u05DF \u05D0\u05D9\u05DF \u05EA\u05D2\u05D5\u05D1\u05D5\u05EA. \u05D4\u05E9\u05D0\u05D9\u05E8\u05D5 \u05EA\u05D2\u05D5\u05D1\u05D4 \u05E8\u05D0\u05E9\u05D5\u05E0\u05D4 !", reactionGiven: "\u05DB\u05D1\u05E8 \u05E0\u05D9\u05EA\u05DF \u05D7\u05D9\u05D5\u05D5\u05D9 '{reaction}'", deleteConfirm: "\u05D1\u05D8\u05D5\u05D7\u05D9\u05DD \u05D1\u05DE\u05D7\u05D9\u05E7\u05EA \u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 ?", deleteFailed: "\u05DB\u05E9\u05DC\u05D5\u05DF \u05D1\u05DE\u05D7\u05D9\u05E7\u05EA \u05D4\u05EA\u05D2\u05D5\u05D1\u05D4" }; const messages$1 = { login: "{platform} \uB85C\uADF8\uC778", logout: "\uB85C\uADF8\uC544\uC6C3", currentUser: "\uD604\uC7AC \uC720\uC800", loading: "\uB85C\uB529\uC911", submit: "\uB4F1\uB85D", submitting: "\uB4F1\uB85D\uC911", submitComment: "\uB313\uAE00 \uB4F1\uB85D", cancel: "\uCDE8\uC18C", edit: "\uD3B8\uC9D1", editMode: "\uD3B8\uC9D1 \uBAA8\uB4DC", delete: "\uC0AD\uC81C", reply: "\uD68C\uC2E0", heart: "\uD558\uD2B8", like: "\uC88B\uC544\uC694", unlike: "\uC2EB\uC5B4\uC694", perPage: "\uB313\uAE00 / \uD398\uC774\uC9C0", sort: "\uD074\uB9AD\uD558\uC5EC \uC815\uB82C \uBC29\uC2DD \uBCC0\uACBD", page: "\uD398\uC774\uC9C0", prev: "\uC774\uC804 \uD398\uC774\uC9C0", next: "\uB2E4\uC74C \uD398\uC774\uC9C0", comments: "\uB313\uAE00 | {count}\uAC1C\uC758 \uB313\uAE00 | {count}\uAC1C\uC758 \uB313\uAE00", loginToComment: "\uB313\uAE00\uC744 \uB0A8\uAE30\uB824\uBA74 {platform} \uB85C\uADF8\uC778\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.", placeholder: "\uB313\uAE00\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694. \uB9C8\uD06C\uB2E4\uC6B4 \uBB38\uBC95\uC744 \uC9C0\uC6D0\uD569\uB2C8\uB2E4. Ctrl + Enter \uB2E8\uCD95\uD0A4\uB85C \uB4F1\uB85D\uB429\uB2C8\uB2E4.", noLoginPlaceHolder: "\uB85C\uADF8\uC778 \uD6C4 \uB313\uAE00\uC744 \uB0A8\uACA8\uC8FC\uC138\uC694. \uB9C8\uD06C\uB2E4\uC6B4 \uBB38\uBC95\uC744 \uC9C0\uC6D0\uD569\uB2C8\uB2E4.", failed: "\uB313\uAE00 \uBD88\uB7EC\uC624\uAE30\uC5D0 \uC2E4\uD328\uD558\uC600\uC2B5\uB2C8\uB2E4", initializing: "\uCD08\uAE30\uD654\uC911...", issueNotCreated: "\uD074\uB9AD\uD558\uC5EC \uC0C8 \uC774\uC288\uB97C \uC0DD\uC131\uD569\uB2C8\uB2E4", loadingComments: "\uB313\uAE00\uC744 \uBD88\uB7EC\uC624\uB294 \uC911\uC785\uB2C8\uB2E4...", loginRequired: "\uB313\uAE00\uC744 \uBCF4\uB824\uBA74 \uB85C\uADF8\uC778\uC774 \uD544\uC694\uD569\uB2C8\uB2E4", noComments: "\uB313\uAE00\uC774 \uD558\uB098\uB3C4 \uC5C6\uC2B5\uB2C8\uB2E4. \uCCAB \uB313\uAE00\uC744 \uB0A8\uACA8\uBCF4\uC138\uC694!", reactionGiven: "\uC774\uBBF8 '{reaction}' \uBC18\uC751\uC744 \uB0A8\uACBC\uC2B5\uB2C8\uB2E4", deleteConfirm: "\uC815\uB9D0 \uB313\uAE00\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?", deleteFailed: "\uB313\uAE00 \uC0AD\uC81C\uC5D0 \uC2E4\uD328\uD558\uC600\uC2B5\uB2C8\uB2E4" }; const messages = { login: "Se connecter avec {platform}", logout: "Se d\xE9connecter", currentUser: "Utilisateur actuel", loading: "Chargement", submit: "Poster", submitting: "En cours d'envoi", submitComment: "Ajouter un commentaire", cancel: "Annuler", edit: "\xC9diter", editMode: "Mode \xE9dition", delete: "Supprimer", reply: "R\xE9pondre", heart: "Adorer", like: "Approuver", unlike: "D\xE9sapprouver", perPage: "Commentaires par pages", sort: "Cliquez pour changer l'ordre de tri", page: "Page", prev: "Page pr\xE9c\xE9dente", next: "Page suivante", comments: "Commentaires | {count} Commentaires | {count} Commentaires", loginToComment: "Se connecter avec votre compte {platform} pour laisser un commentaire", placeholder: "Laisser un commentaire. Le Markdown est support\xE9. Ctrl + Enter pour poster.", noLoginPlaceHolder: "Connectez-vous pour laisser un commentaire. Le Markdown est support\xE9. ", failed: "Impossible de charger les commentaires", initializing: "Initialisation...", issueNotCreated: "Cliquez pour cr\xE9er un commentaire", loadingComments: "Chargment des commentaires...", loginRequired: "Se connecter pour voir les commentaires", noComments: "Il n'y a pas de commentaire pour le moment. Laissez le premier commentaire !", reactionGiven: "R\xE9action '{reaction}' d\xE9j\xE0 donn\xE9e", deleteConfirm: "Voulez-vous vraiment supprimer ce commentaire?", deleteFailed: "Impossible de cr\xE9er le commentaire" }; const i18n = createI18n({ legacy: false, locale: "en", fallbackLocale: "de", messages: { "en": messages$7, "en-US": messages$7, "de": messages$8, "de-DE": messages$8, "zh": messages$6, "zh-CN": messages$6, "zh-TW": messages$5, "pt": messages$4, "pt-BR": messages$4, "ja": messages$3, "ja-JP": messages$3, "he": messages$2, "he-IL": messages$2, "ko": messages$1, "ko-KR": messages$1, "fr": messages, "fr-FR": messages } }); function useVssueStore() { let { locale, messages: messages2 } = i18n.global; const VssueState = vue.reactive({ options: null, title: "Vusse", issueId: null, API: null, accessToken: null, user: null, issue: null, comments: null, query: { page: 1, perPage: 10, sort: "desc" }, isInitializing: true, isIssueNotCreated: false, isLoginRequired: false, isFailed: false, isCreatingIssue: false, isLoadingComments: false, isCreatingComment: false, isUpdatingComment: false, replyContent: "" }); const version$1 = vue.computed(() => version); const issueTitle = vue.computed(() => { if (VssueState.options === null) return ""; return typeof VssueState.title === "function" ? VssueState.title(VssueState.options) : `${VssueState.options.prefix}${VssueState.title}`; }); const isPending = vue.computed(() => VssueState.isLoadingComments || VssueState.isCreatingComment || VssueState.isUpdatingComment); const isLogined = vue.computed(() => VssueState.accessToken !== null && VssueState.user !== null); const isAdmin = vue.computed(() => { return VssueState.options !== null && VssueState.accessToken !== null && VssueState.user !== null && (VssueState.user.username === VssueState.options.owner || VssueState.options.admins.includes(VssueState.user.username)); }); const accessTokenKey = vue.computed(() => { return VssueState.API ? `Vssue.${VssueState.API.platform.name.toLowerCase()}.access_token` : ""; }); vue.watch(() => VssueState.query.perPage, () => { VssueState.query.page = 1; getComments(); }); vue.watch(() => [VssueState.query.page, VssueState.query.sort], () => { getComments(); }); function setOptions(options) { VssueState.options = Object.assign( { labels: "Vssue".split(","), state: "Vssue", prefix: "[Vssue]", admins: [], perPage: 10, proxy: (url) => `${{ "VITE_COMMENT_TITLE": "Vusse", "VITE_COMMENT_LABELS": "Vssue", "VITE_COMMENT_PREFIX": "[Vssue]", "VITE_COMMENT_STATE": "Vssue", "BASE_URL": "/", "MODE": "production", "DEV": false, "PROD": true }.VITE_COMMENT_PROXY}${url}`, issueContent: ({ url }) => url, autoCreateIssue: false }, { ...VssueState.options ? VssueState.options : {} }, options ); const requiredOptions = ["api", "owner", "repo", "clientId"]; for (const opt of requiredOptions) { if (!VssueState.options[opt]) console.warn(`[Vssue] the option '${opt}' is required`); } if (VssueState.options.locale) { locale = VssueState.options.locale; } else { const locales = Object.keys(messages2); const navLangs = window.navigator.languages; locale = navLangs.filter((item) => locales.includes(item)).shift() || "en"; } } async function init() { try { await initStore(); await initComments(); } catch (e) { if (e.response && [401, 403].includes(e.response.status)) { VssueState.isLoginRequired = true; } else { VssueState.isFailed = true; } console.error(e); } } async function initStore() { try { if (!VssueState.options) throw new Error("Options are required to initialize Vssue"); VssueState.API = null; VssueState.accessToken = null; VssueState.user = null; VssueState.issue = null; VssueState.comments = null; VssueState.query = { page: 1, perPage: VssueState.options.perPage, sort: "desc" }; VssueState.isInitializing = true; VssueState.isIssueNotCreated = false; VssueState.isLoginRequired = false; VssueState.isFailed = false; VssueState.isCreatingIssue = false; VssueState.isLoadingComments = false; VssueState.isCreatingComment = false; VssueState.isUpdatingComment = false; const APIConstructor = VssueState.options.api; VssueState.API = new APIConstructor({ baseURL: VssueState.options.baseURL, labels: VssueState.options.labels, state: VssueState.options.state, owner: VssueState.options.owner, repo: VssueState.options.repo, clientId: VssueState.options.clientId, clientSecret: VssueState.options.clientSecret, proxy: VssueState.options.proxy }); await handleAuth(); } finally { VssueState.isInitializing = false; } } async function initComments() { if (!VssueState.API || !VssueState.options) return; if (VssueState.issueId) { const [issue, comments] = await Promise.all([ VssueState.API.getIssue({ accessToken: VssueState.accessToken, issueId: VssueState.issueId }), VssueState.API.getComments({ accessToken: VssueState.accessToken, issueId: VssueState.issueId, query: VssueState.query }) ]); VssueState.issue = issue; VssueState.comments = comments; } else { VssueState.issue = await VssueState.API.getIssue({ accessToken: VssueState.accessToken, issueTitle: issueTitle.value }); if (VssueState.issue === null) { VssueState.isIssueNotCreated = true; if (VssueState.options.autoCreateIssue) await postIssue(); } else { await getComments(); } } } async function postIssue() { if (!VssueState.API || !VssueState.options || VssueState.issue || VssueState.issueId) return; if (!isLogined.value) login(); if (!isAdmin.value) return; try { VssueState.isCreatingIssue = true; const issue = await VssueState.API.postIssue({ title: issueTitle.value, content: await VssueState.options.issueContent({ options: VssueState.options, url: getCleanURL(window.location.href) }), accessToken: VssueState.accessToken }); VssueState.issue = issue; VssueState.isIssueNotCreated = false; await getComments(); } catch (e) { VssueState.isFailed = true; } finally { VssueState.isCreatingIssue = false; } } async function getComments(emits) { try { if (!VssueState.API || !VssueState.issue || VssueState.isLoadingComments) return; VssueState.isLoadingComments = true; const comments = await VssueState.API.getComments({ accessToken: VssueState.accessToken, issueId: VssueState.issue.id, query: VssueState.query }); VssueState.comments = comments; if (VssueState.query.page !== comments.page) VssueState.query.page = comments.page; if (VssueState.query.perPage !== comments.perPage) VssueState.query.perPage = comments.perPage; return comments; } catch (e) { if (e.response && [401, 403].includes(e.response.status) && !isLogined.value) { VssueState.isLoginRequired = true; } else { emits == null ? void 0 : emits("error", e); throw e; } } finally { VssueState.isLoadingComments = false; } } async function postComment({ content }, emits) { try { if (!VssueState.API || !VssueState.issue || VssueState.isCreatingComment) return; VssueState.isCreatingComment = true; const comment = await VssueState.API.postComment({ accessToken: VssueState.accessToken, content, issueId: VssueState.issue.id }); return comment; } catch (e) { emits == null ? void 0 : emits("error", e); throw e; } finally { VssueState.isCreatingComment = false; } } async function putComment({ commentId, content }, emits) { try { if (!VssueState.API || !VssueState.issue) return; const comment = await VssueState.API.putComment({ accessToken: VssueState.accessToken, issueId: VssueState.issue.id, commentId, content }); return comment; } catch (e) { emits == null ? void 0 : emits("error", e); throw e; } } async function deleteComment({ commentId }, emits) { try { if (!VssueState.API || !VssueState.issue) return; const success = await VssueState.API.deleteComment({ accessToken: VssueState.accessToken, issueId: VssueState.issue.id, commentId }); return success; } catch (e) { emits == null ? void 0 : emits("error", e); throw e; } } async function getCommentReactions({ commentId }, emits) { try { if (!VssueState.API || !VssueState.issue) return; const reactions = await VssueState.API.getCommentReactions({ accessToken: VssueState.accessToken, issueId: VssueState.issue.id, commentId }); return reactions; } catch (e) { emits == null ? void 0 : emits("error", e); throw e; } } async function postCommentReaction({ commentId, reaction }, emits) { try { if (!VssueState.API || !VssueState.issue) return false; const success = await VssueState.API.postCommentReaction({ accessToken: VssueState.accessToken, issueId: VssueState.issue.id, commentId, reaction }); return success; } catch (e) { emits == null ? void 0 : emits("error", e); throw e; } } function login() { if (!VssueState.API) return; VssueState.API.redirectAuth(); } function logout() { setAccessToken(null); VssueState.user = null; } async function handleAuth() { if (!VssueState.API) return; const accessToken = await VssueState.API.handleAuth(); if (accessToken) { setAccessToken(accessToken); VssueState.user = await VssueState.API.getUser({ accessToken }); } else if (getAccessToken()) { VssueState.user = await VssueState.API.getUser({ accessToken: VssueState.accessToken }); } else { setAccessToken(null); VssueState.user = null; } } function getAccessToken() { VssueState.accessToken = window.localStorage.getItem(accessTokenKey.value); return VssueState.accessToken; } function setAccessToken(token) { if (token === null) window.localStorage.removeItem(accessTokenKey.value); else window.localStorage.setItem(accessTokenKey.value, token); VssueState.accessToken = token; } function setReplyContent(comment) { const quotedComment = comment.contentRaw.replace(/\n/g, "\n> "); VssueState.replyContent = `@${comment.author.username} > ${quotedComment} `; } return { VssueState, version: version$1, issueTitle, isPending, isLogined, isAdmin, accessTokenKey, setOptions, init, initStore, initComments, postIssue, getComments, postComment, putComment, deleteComment, getCommentReactions, postCommentReaction, login, logout, handleAuth, getAccessToken, setAccessToken, setReplyContent }; } const _hoisted_1 = { class: "vssue" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ __name: "Vssue", props: { title: { type: [String, Function], default: "" }, issueId: { default: "" }, options: { default: () => ({}) } }, setup(__props) { const props = __props; const vssue = useVssueStore(); vue.provide("vssue", vssue); vue.onMounted(() => { if (props.title) vssue.VssueState.title = props.title; if (props.issueId) vssue.VssueState.issueId = props.issueId; vssue.setOptions(props.options); vssue.init(); }); vue.watch(() => props.options, () => { vssue.setOptions(props.options); }, { deep: true }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createVNode(Iconfont), vue.createVNode(_sfc_main$1), vue.createVNode(_sfc_main$2) ]); }; } }); const index$1 = ""; const githubMarkdown = ""; const index = (app, options) => { app.use(i18n); app.component("Vssue", { props: { title: { type: String, required: false, default: void 0 }, issueId: { type: [Number, String], required: false, default: void 0 }, options: { type: Object, required: false, default: void 0 } }, setup(props) { return () => vue.h(_sfc_main, { title: props.title, issueId: props.issueId, options: Object.assign({}, options, props.options) }); } }); }; return index; });