1import { m as mount_css, a as prefix_css, _ as __vitePreload } from './index-dc71b4a2.js'; 2 3/** @returns {void} */ 4function noop$2() {} 5 6const identity = (x) => x; 7 8function run(fn) { 9 return fn(); 10} 11 12/** 13 * @param {Function[]} fns 14 * @returns {void} 15 */ 16function run_all(fns) { 17 fns.forEach(run); 18} 19 20/** 21 * @param {any} thing 22 * @returns {thing is Function} 23 */ 24function is_function(thing) { 25 return typeof thing === 'function'; 26} 27 28/** @returns {boolean} */ 29function safe_not_equal$4(a, b) { 30 return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function'; 31} 32 33function subscribe(store, ...callbacks) { 34 if (store == null) { 35 for (const callback of callbacks) { 36 callback(undefined); 37 } 38 return noop$2; 39 } 40 const unsub = store.subscribe(...callbacks); 41 return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; 42} 43 44/** 45 * Get the current value from a store by subscribing and immediately unsubscribing. 46 * 47 * https://svelte.dev/docs/svelte-store#get 48 * @template T 49 * @param {import('../store/public.js').Readable<T>} store 50 * @returns {T} 51 */ 52function get_store_value(store) { 53 let value; 54 subscribe(store, (_) => (value = _))(); 55 return value; 56} 57 58/** @param {number | string} value 59 * @returns {[number, string]} 60 */ 61function split_css_unit(value) { 62 const split = typeof value === 'string' && value.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); 63 return split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px']; 64} 65 66const is_client = typeof window !== 'undefined'; 67 68/** @type {() => number} */ 69let now = is_client ? () => window.performance.now() : () => Date.now(); 70 71let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop$2; 72 73const tasks = new Set(); 74 75/** 76 * @param {number} now 77 * @returns {void} 78 */ 79function run_tasks(now) { 80 tasks.forEach((task) => { 81 if (!task.c(now)) { 82 tasks.delete(task); 83 task.f(); 84 } 85 }); 86 if (tasks.size !== 0) raf(run_tasks); 87} 88 89/** 90 * Creates a new task that runs on each raf frame 91 * until it returns a falsy value or is aborted 92 * @param {import('./private.js').TaskCallback} callback 93 * @returns {import('./private.js').Task} 94 */ 95function loop(callback) { 96 /** @type {import('./private.js').TaskEntry} */ 97 let task; 98 if (tasks.size === 0) raf(run_tasks); 99 return { 100 promise: new Promise((fulfill) => { 101 tasks.add((task = { c: callback, f: fulfill })); 102 }), 103 abort() { 104 tasks.delete(task); 105 } 106 }; 107} 108 109const subscriber_queue = []; 110 111/** 112 * Creates a `Readable` store that allows reading by subscription. 113 * 114 * https://svelte.dev/docs/svelte-store#readable 115 * @template T 116 * @param {T} [value] initial value 117 * @param {import('./public.js').StartStopNotifier<T>} [start] 118 * @returns {import('./public.js').Readable<T>} 119 */ 120function readable(value, start) { 121 return { 122 subscribe: writable(value, start).subscribe 123 }; 124} 125 126/** 127 * Create a `Writable` store that allows both updating and reading by subscription. 128 * 129 * https://svelte.dev/docs/svelte-store#writable 130 * @template T 131 * @param {T} [value] initial value 132 * @param {import('./public.js').StartStopNotifier<T>} [start] 133 * @returns {import('./public.js').Writable<T>} 134 */ 135function writable(value, start = noop$2) { 136 /** @type {import('./public.js').Unsubscriber} */ 137 let stop; 138 /** @type {Set<import('./private.js').SubscribeInvalidateTuple<T>>} */ 139 const subscribers = new Set(); 140 /** @param {T} new_value 141 * @returns {void} 142 */ 143 function set(new_value) { 144 if (safe_not_equal$4(value, new_value)) { 145 value = new_value; 146 if (stop) { 147 // store is ready 148 const run_queue = !subscriber_queue.length; 149 for (const subscriber of subscribers) { 150 subscriber[1](); 151 subscriber_queue.push(subscriber, value); 152 } 153 if (run_queue) { 154 for (let i = 0; i < subscriber_queue.length; i += 2) { 155 subscriber_queue[i][0](subscriber_queue[i + 1]); 156 } 157 subscriber_queue.length = 0; 158 } 159 } 160 } 161 } 162 163 /** 164 * @param {import('./public.js').Updater<T>} fn 165 * @returns {void} 166 */ 167 function update(fn) { 168 set(fn(value)); 169 } 170 171 /** 172 * @param {import('./public.js').Subscriber<T>} run 173 * @param {import('./private.js').Invalidator<T>}
173 [invalidate] 174 * @returns {import('./public.js').Unsubscriber} 175 */ 176 function subscribe(run, invalidate = noop$2) { 177 /** @type {import('./private.js').SubscribeInvalidateTuple<T>} */ 178 const subscriber = [run, invalidate]; 179 subscribers.add(subscriber); 180 if (subscribers.size === 1) { 181 stop = start(set, update) || noop$2; 182 } 183 run(value); 184 return () => { 185 subscribers.delete(subscriber); 186 if (subscribers.size === 0 && stop) { 187 stop(); 188 stop = null; 189 } 190 }; 191 } 192 return { set, update, subscribe }; 193} 194 195/** 196 * Derived value store by synchronizing one or more readable stores and 197 * applying an aggregation function over its input values. 198 * 199 * https://svelte.dev/docs/svelte-store#derived 200 * @template {import('./private.js').Stores} S 201 * @template T 202 * @overload 203 * @param {S} stores - input stores 204 * @param {(values: import('./private.js').StoresValues<S>, set: (value: T) => void, update: (fn: import('./public.js').Updater<T>) => void) => import('./public.js').Unsubscriber | void} fn - function callback that aggregates the values 205 * @param {T} [initial_value] - initial value 206 * @returns {import('./public.js').Readable<T>} 207 */ 208 209/** 210 * Derived value store by synchronizing one or more readable stores and 211 * applying an aggregation function over its input values. 212 * 213 * https://svelte.dev/docs/svelte-store#derived 214 * @template {import('./private.js').Stores} S 215 * @template T 216 * @overload 217 * @param {S} stores - input stores 218 * @param {(values: import('./private.js').StoresValues<S>) => T} fn - function callback that aggregates the values 219 * @param {T} [initial_value] - initial value 220 * @returns {import('./public.js').Readable<T>} 221 */ 222 223/** 224 * @template {import('./private.js').Stores} S 225 * @template T 226 * @param {S} stores 227 * @param {Function} fn 228 * @param {T} [initial_value] 229 * @returns {import('./public.js').Readable<T>} 230 */ 231function derived(stores, fn, initial_value) { 232 const single = !Array.isArray(stores); 233 /** @type {Array<import('./public.js').Readable<any>>} */ 234 const stores_array = single ? [stores] : stores; 235 if (!stores_array.every(Boolean)) { 236 throw new Error('derived() expects stores as input, got a falsy value'); 237 } 238 const auto = fn.length < 2; 239 return readable(initial_value, (set, update) => { 240 let started = false; 241 const values = []; 242 let pending = 0; 243 let cleanup = noop$2; 244 const sync = () => { 245 if (pending) { 246 return; 247 } 248 cleanup(); 249 const result = fn(single ? values[0] : values, set, update); 250 if (auto) { 251 set(result); 252 } else { 253 cleanup = is_function(result) ? result : noop$2; 254 } 255 }; 256 const unsubscribers = stores_array.map((store, i) => 257 subscribe( 258 store, 259 (value) => { 260 values[i] = value; 261 pending &= ~(1 << i); 262 if (started) { 263 sync(); 264 } 265 }, 266 () => { 267 pending |= 1 << i; 268 } 269 ) 270 ); 271 started = true; 272 sync(); 273 return function stop() { 274 run_all(unsubscribers); 275 cleanup(); 276 // We need to set this to false because callbacks can still happen despite having unsubscribed: 277 // Callbacks might already be placed in the queue which doesn't know it should no longer 278 // invoke this derived store. 279 started = false; 280 }; 281 }); 282} 283 284const space_logo = ""+new URL('spaces-a79177ad.svg', import.meta.url).href+""; 285 286var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 287 288function getDefaultExportFromCjs (x) { 289 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; 290} 291 292function getAugmentedNamespace(n) { 293 if (n.__esModule) return n; 294 var f = n.default; 295 if (typeof f == "function") { 296 var a = function a () { 297 if (this instanceof a) { 298 var args = [null]; 299 args.push.apply(args, arguments); 300 var Ctor = Function.bind.apply(f, args); 301 return new Ctor(); 302 } 303 return f.apply(this, arguments); 304 }; 305 a.prototype = f.prototype; 306 } else a = {}; 307 Object.defineProperty(a, '__esModule', {value: true}); 308 Object.keys(n).forEach(function (k) { 309 var d = Object.getOwnPropertyDescriptor(n, k); 310 Object.defineProperty(a, k, d.get ? d : { 311 enumerable: true, 312 get: function () { 313 return n[k]; 314 } 315 }); 316 }); 317 return a; 318} 319 320var isMergeableObject = function isMergeableObject(value) { 321 return isNonNullObject(value) 322 && !isSpecial(value) 323}; 324 325function isNonNullObject(value) { 326 return !!value && typeof value === 'object' 327} 328 329function isSpecial(value) { 330 var stringValue = Object.prototype.toString.call(value); 331 332 return stringValue === '[object RegExp]' 333 || stringValue === '[object Date]' 334 || isReactElement(value) 335} 336 337// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 338var canUseSymbol = typeof Symbol === 'function' && Symbol.for; 339var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; 340 341function isReactElement(value) { 342 return value.$$typeof === REACT_ELEMENT_TYPE 343} 344 345function emptyTarget(val) { 346 return Array.isArray(val) ? [] : {} 347} 348 349function cloneUnlessOtherwiseSpecified(value, options) { 350 return (options.clone !== false && options.isMergeableObject(value)) 351 ? deepmerge(emptyTarget(value), value, options) 352 : value 353} 354 355function defaultArrayMerge(target, source, options) { 356 return target.concat(source).map(function(element) { 357 return cloneUnlessOtherwiseSpecified(element, options) 358 }) 359} 360 361function getMergeFunction(key, options) { 362 if (!options.customMerge) { 363 return deepmerge 364 } 365 var customMerge = options.customMerge(key); 366 return typeof customMerge === 'function' ? customMerge : deepmerge 367} 368 369function getEnumerableOwnPropertySymbols(target) { 370 return Object.getOwnPropertySymbols 371 ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 372 return Object.propertyIsEnumerable.call(target, symbol) 373 }) 374 : [] 375} 376 377function getKeys(target) { 378 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) 379} 380 381function propertyIsOnObject(object, property) { 382 try { 383 return property in object 384 } catch(_) { 385 return false 386 } 387} 388 389// Protects from prototype poisoning and unexpected merging up the prototype chain.
390function propertyIsUnsafe(target, key) { 391 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, 392 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, 393 && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. 394} 395 396function mergeObject(target, source, options) { 397 var destination = {}; 398 if (options.isMergeableObject(target)) { 399 getKeys(target).forEach(function(key) { 400 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 401 }); 402 } 403 getKeys(source).forEach(function(key) { 404 if (propertyIsUnsafe(target, key)) { 405 return 406 } 407 408 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 409 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 410 } else { 411 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 412 } 413 }); 414 return destination 415} 416 417function deepmerge(target, source, options) { 418 options = options || {}; 419 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 420 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 421 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() 422 // implementations can use it. The caller may not replace it. 423 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 424 425 var sourceIsArray = Array.isArray(source); 426 var targetIsArray = Array.isArray(target); 427 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 428 429 if (!sourceAndTargetTypesMatch) { 430 return cloneUnlessOtherwiseSpecified(source, options) 431 } else if (sourceIsArray) { 432 return options.arrayMerge(target, source, options) 433 } else { 434 return mergeObject(target, source, options) 435 } 436} 437 438deepmerge.all = function deepmergeAll(array, options) { 439 if (!Array.isArray(array)) { 440 throw new Error('first argument should be an array') 441 } 442 443 return array.reduce(function(prev, next) { 444 return deepmerge(prev, next, options) 445 }, {}) 446}; 447 448var deepmerge_1 = deepmerge; 449 450var cjs = deepmerge_1; 451 452const deepmerge$1 = /*@__PURE__*/getDefaultExportFromCjs(cjs); 453 454var lib$3 = {}; 455 456var tslib = {exports: {}}; 457 458/****************************************************************************** 459Copyright (c) Microsoft Corporation. 460 461Permission to use, copy, modify, and/or distribute this software for any 462purpose with or without fee is hereby granted. 463 464THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 465REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 466AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 467INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 468LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 469OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 470PERFORMANCE OF THIS SOFTWARE. 471***************************************************************************** */ 472 473(function (module) { 474 /* global global, define, Symbol, Reflect, Promise, SuppressedError */ 475 var __extends; 476 var __assign; 477 var __rest; 478 var __decorate; 479 var __param; 480 var __esDecorate; 481 var __runInitializers; 482 var __propKey; 483 var __setFunctionName; 484 var __metadata; 485 var __awaiter; 486 var __generator; 487 var __exportStar; 488 var __values; 489 var __read; 490 var __spread; 491 var __spreadArrays; 492 var __spreadArray; 493 var __await; 494 var __asyncGenerator; 495 var __asyncDelegator; 496 var __asyncValues;
vendor: 13,519 bytes, lines 497-754
497 var __makeTemplateObject; 498 var __importStar; 499 var __importDefault; 500 var __classPrivateFieldGet; 501 var __classPrivateFieldSet; 502 var __classPrivateFieldIn; 503 var __createBinding; 504 var __addDisposableResource; 505 var __disposeResources; 506 (function (factory) { 507 var root = typeof commonjsGlobal === "object" ? commonjsGlobal : typeof self === "object" ? self : typeof this === "object" ? this : {}; 508 { 509 factory(createExporter(root, createExporter(module.exports))); 510 } 511 function createExporter(exports, previous) { 512 if (exports !== root) { 513 if (typeof Object.create === "function") { 514 Object.defineProperty(exports, "__esModule", { value: true }); 515 } 516 else { 517 exports.__esModule = true; 518 } 519 } 520 return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; 521 } 522 }) 523 (function (exporter) { 524 var extendStatics = Object.setPrototypeOf || 525 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 526 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 527 528 __extends = function (d, b) { 529 if (typeof b !== "function" && b !== null) 530 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 531 extendStatics(d, b); 532 function __() { this.constructor = d; } 533 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 534 }; 535 536 __assign = Object.assign || function (t) { 537 for (var s, i = 1, n = arguments.length; i < n; i++) { 538 s = arguments[i]; 539 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 540 } 541 return t; 542 }; 543 544 __rest = function (s, e) { 545 var t = {}; 546 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 547 t[p] = s[p]; 548 if (s != null && typeof Object.getOwnPropertySymbols === "function") 549 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 550 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 551 t[p[i]] = s[p[i]]; 552 } 553 return t; 554 }; 555 556 __decorate = function (decorators, target, key, desc) { 557 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 558 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 559 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 560 return c > 3 && r && Object.defineProperty(target, key, r), r; 561 }; 562 563 __param = function (paramIndex, decorator) { 564 return function (target, key) { decorator(target, key, paramIndex); } 565 }; 566 567 __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { 568 function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } 569 var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; 570 var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; 571 var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); 572 var _, done = false; 573 for (var i = decorators.length - 1; i >= 0; i--) { 574 var context = {}; 575 for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; 576 for (var p in contextIn.access) context.access[p] = contextIn.access[p]; 577 context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; 578 var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); 579 if (kind === "accessor") { 580 if (result === void 0) continue; 581 if (result === null || typeof result !== "object") throw new TypeError("Object expected"); 582 if (_ = accept(result.get)) descriptor.get = _; 583 if (_ = accept(result.set)) descriptor.set = _; 584 if (_ = accept(result.init)) initializers.unshift(_); 585 } 586 else if (_ = accept(result)) { 587 if (kind === "field") initializers.unshift(_); 588 else descriptor[key] = _; 589 } 590 } 591 if (target) Object.defineProperty(target, contextIn.name, descriptor); 592 done = true; 593 }; 594 595 __runInitializers = function (thisArg, initializers, value) { 596 var useValue = arguments.length > 2; 597 for (var i = 0; i < initializers.length; i++) { 598 value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); 599 } 600 return useValue ? value : void 0; 601 }; 602 603 __propKey = function (x) { 604 return typeof x === "symbol" ? x : "".concat(x); 605 }; 606 607 __setFunctionName = function (f, name, prefix) { 608 if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; 609 return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); 610 }; 611 612 __metadata = function (metadataKey, metadataValue) { 613 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); 614 }; 615 616 __awaiter = function (thisArg, _arguments, P, generator) { 617 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 618 return new (P || (P = Promise))(function (resolve, reject) { 619 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 620 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 621 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 622 step((generator = generator.apply(thisArg, _arguments || [])).next()); 623 }); 624 }; 625 626 __generator = function (thisArg, body) { 627 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 628 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 629 function verb(n) { return function (v) { return step([n, v]); }; } 630 function step(op) { 631 if (f) throw new TypeError("Generator is already executing."); 632 while (g && (g = 0, op[0] && (_ = 0)), _) try { 633 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 634 if (y = 0, t) op = [op[0] & 2, t.value]; 635 switch (op[0]) { 636 case 0: case 1: t = op; break; 637 case 4: _.label++; return { value: op[1], done: false }; 638 case 5: _.label++; y = op[1]; op = [0]; continue; 639 case 7: op = _.ops.pop(); _.trys.pop(); continue; 640 default: 641 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 642 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 643 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 644 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 645 if (t[2]) _.ops.pop(); 646 _.trys.pop(); continue; 647 } 648 op = body.call(thisArg, _); 649 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 650 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 651 } 652 }; 653 654 __exportStar = function(m, o) { 655 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); 656 }; 657 658 __createBinding = Object.create ? (function(o, m, k, k2) { 659 if (k2 === undefined) k2 = k; 660 var desc = Object.getOwnPropertyDescriptor(m, k); 661 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 662 desc = { enumerable: true, get: function() { return m[k]; } }; 663 } 664 Object.defineProperty(o, k2, desc); 665 }) : (function(o, m, k, k2) { 666 if (k2 === undefined) k2 = k; 667 o[k2] = m[k]; 668 }); 669 670 __values = function (o) { 671 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 672 if (m) return m.call(o); 673 if (o && typeof o.length === "number") return { 674 next: function () { 675 if (o && i >= o.length) o = void 0; 676 return { value: o && o[i++], done: !o }; 677 } 678 }; 679 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 680 }; 681 682 __read = function (o, n) { 683 var m = typeof Symbol === "function" && o[Symbol.iterator]; 684 if (!m) return o; 685 var i = m.call(o), r, ar = [], e; 686 try { 687 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 688 } 689 catch (error) { e = { error: error }; } 690 finally { 691 try { 692 if (r && !r.done && (m = i["return"])) m.call(i); 693 } 694 finally { if (e) throw e.error; } 695 } 696 return ar; 697 }; 698 699 /** @deprecated */ 700 __spread = function () { 701 for (var ar = [], i = 0; i < arguments.length; i++) 702 ar = ar.concat(__read(arguments[i])); 703 return ar; 704 }; 705 706 /** @deprecated */ 707 __spreadArrays = function () { 708 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 709 for (var r = Array(s), k = 0, i = 0; i < il; i++) 710 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 711 r[k] = a[j]; 712 return r; 713 }; 714 715 __spreadArray = function (to, from, pack) { 716 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 717 if (ar || !(i in from)) { 718 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 719 ar[i] = from[i]; 720 } 721 } 722 return to.concat(ar || Array.prototype.slice.call(from)); 723 }; 724 725 __await = function (v) { 726 return this instanceof __await ? (this.v = v, this) : new __await(v); 727 }; 728 729 __asyncGenerator = function (thisArg, _arguments, generator) { 730 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 731 var g = generator.apply(thisArg, _arguments || []), i, q = []; 732 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; 733 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } 734 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } 735 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } 736 function fulfill(value) { resume("next", value); } 737 function reject(value) { resume("throw", value); } 738 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } 739 }; 740 741 __asyncDelegator = function (o) { 742 var i, p; 743 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; 744 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } 745 }; 746 747 __asyncValues = function (o) { 748 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); 749 var m = o[Symbol.asyncIterator], i; 750 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); 751 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } 752 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } 753 }; 754
755 __makeTemplateObject = function (cooked, raw) { 756 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } 757 return cooked; 758 }; 759 760 var __setModuleDefault = Object.create ? (function(o, v) { 761 Object.defineProperty(o, "default", { enumerable: true, value: v }); 762 }) : function(o, v) { 763 o["default"] = v; 764 }; 765 766 __importStar = function (mod) { 767 if (mod && mod.__esModule) return mod; 768 var result = {}; 769 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 770 __setModuleDefault(result, mod); 771 return result; 772 }; 773 774 __importDefault = function (mod) { 775 return (mod && mod.__esModule) ? mod : { "default": mod }; 776 }; 777 778 __classPrivateFieldGet = function (receiver, state, kind, f) { 779 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); 780 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); 781 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); 782 }; 783 784 __classPrivateFieldSet = function (receiver, state, value, kind, f) { 785 if (kind === "m") throw new TypeError("Private method is not writable"); 786 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); 787 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); 788 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; 789 }; 790 791 __classPrivateFieldIn = function (state, receiver) { 792 if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); 793 return typeof state === "function" ? receiver === state : state.has(receiver); 794 }; 795 796 __addDisposableResource = function (env, value, async) { 797 if (value !== null && value !== void 0) { 798 if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); 799 var dispose; 800 if (async) { 801 if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); 802 dispose = value[Symbol.asyncDispose]; 803 } 804 if (dispose === void 0) { 805 if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); 806 dispose = value[Symbol.dispose]; 807 } 808 if (typeof dispose !== "function") throw new TypeError("Object not disposable."); 809 env.stack.push({ value: value, dispose: dispose, async: async }); 810 } 811 else if (async) { 812 env.stack.push({ async: true }); 813 } 814 return value; 815 }; 816 817 var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { 818 var e = new Error(message); 819 return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; 820 }; 821 822 __disposeResources = function (env) { 823 function fail(e) { 824 env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; 825 env.hasError = true; 826 } 827 function next() { 828 while (env.stack.length) { 829 var rec = env.stack.pop(); 830 try { 831 var result = rec.dispose && rec.dispose.call(rec.value); 832 if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); 833 } 834 catch (e) { 835 fail(e); 836 } 837 } 838 if (env.hasError) throw env.error; 839 } 840 return next(); 841 }; 842 843 exporter("__extends", __extends); 844 exporter("__assign", __assign); 845 exporter("__rest", __rest); 846 exporter("__decorate", __decorate); 847 exporter("__param", __param); 848 exporter("__esDecorate", __esDecorate);
849 exporter("__runInitializers", __runInitializers); 850 exporter("__propKey", __propKey); 851 exporter("__setFunctionName", __setFunctionName); 852 exporter("__metadata", __metadata); 853 exporter("__awaiter", __awaiter); 854 exporter("__generator", __generator); 855 exporter("__exportStar", __exportStar); 856 exporter("__createBinding", __createBinding); 857 exporter("__values", __values); 858 exporter("__read", __read); 859 exporter("__spread", __spread); 860 exporter("__spreadArrays", __spreadArrays); 861 exporter("__spreadArray", __spreadArray); 862 exporter("__await", __await); 863 exporter("__asyncGenerator", __asyncGenerator); 864 exporter("__asyncDelegator", __asyncDelegator); 865 exporter("__asyncValues", __asyncValues); 866 exporter("__makeTemplateObject", __makeTemplateObject); 867 exporter("__importStar", __importStar); 868 exporter("__importDefault", __importDefault); 869 exporter("__classPrivateFieldGet", __classPrivateFieldGet); 870 exporter("__classPrivateFieldSet", __classPrivateFieldSet); 871 exporter("__classPrivateFieldIn", __classPrivateFieldIn); 872 exporter("__addDisposableResource", __addDisposableResource); 873 exporter("__disposeResources", __disposeResources); 874 }); 875} (tslib)); 876 877var tslibExports = tslib.exports; 878 879var core = {}; 880 881var lib$2 = {}; 882 883var error$1 = {}; 884 885Object.defineProperty(error$1, "__esModule", { value: true }); 886error$1.ErrorKind = void 0; 887var ErrorKind; 888(function (ErrorKind) { 889 /** Argument is unclosed (e.g. `{0`) */ 890 ErrorKind[ErrorKind["EXPECT_ARGUMENT_CLOSING_BRACE"] = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE"; 891 /** Argument is empty (e.g. `{}`). */ 892 ErrorKind[ErrorKind["EMPTY_ARGUMENT"] = 2] = "EMPTY_ARGUMENT"; 893 /** Argument is malformed (e.g. `{foo!}``) */ 894 ErrorKind[ErrorKind["MALFORMED_ARGUMENT"] = 3] = "MALFORMED_ARGUMENT"; 895 /** Expect an argument type (e.g. `{foo,}`) */ 896 ErrorKind[ErrorKind["EXPECT_ARGUMENT_TYPE"] = 4] = "EXPECT_ARGUMENT_TYPE"; 897 /** Unsupported argument type (e.g. `{foo,foo}`) */ 898 ErrorKind[ErrorKind["INVALID_ARGUMENT_TYPE"] = 5] = "INVALID_ARGUMENT_TYPE"; 899 /** Expect an argument style (e.g. `{foo, number, }`) */ 900 ErrorKind[ErrorKind["EXPECT_ARGUMENT_STYLE"] = 6] = "EXPECT_ARGUMENT_STYLE"; 901 /** The number skeleton is invalid. */ 902 ErrorKind[ErrorKind["INVALID_NUMBER_SKELETON"] = 7] = "INVALID_NUMBER_SKELETON"; 903 /** The date time skeleton is invalid. */ 904 ErrorKind[ErrorKind["INVALID_DATE_TIME_SKELETON"] = 8] = "INVALID_DATE_TIME_SKELETON"; 905 /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */ 906 ErrorKind[ErrorKind["EXPECT_NUMBER_SKELETON"] = 9] = "EXPECT_NUMBER_SKELETON"; 907 /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */ 908 ErrorKind[ErrorKind["EXPECT_DATE_TIME_SKELETON"] = 10] = "EXPECT_DATE_TIME_SKELETON"; 909 /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */ 910 ErrorKind[ErrorKind["UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"] = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE"; 911 /** Missing select argument options (e.g. `{foo, select}`) */ 912 ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_OPTIONS"] = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS"; 913 /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */ 914 ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"] = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE"; 915 /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */ 916 ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"] = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE"; 917 /** Expecting a selector in `select` argument (e.g `{foo, select}`) */ 918 ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR"] = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR"; 919 /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */ 920 ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR"] = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR"; 921 /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */ 922 ErrorKind[ErrorKind["EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"] = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT"; 923 /** 924 * Expecting a message fragment after the `plural` or `selectordinal` selector 925 * (e.g. `{foo, plural, one}`) 926 */ 927 ErrorKind[ErrorKind["EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"] = 18] = "
927EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT"; 928 /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */ 929 ErrorKind[ErrorKind["INVALID_PLURAL_ARGUMENT_SELECTOR"] = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR"; 930 /** 931 * Duplicate selectors in `plural` or `selectordinal` argument. 932 * (e.g. {foo, plural, one {#} one {#}}) 933 */ 934 ErrorKind[ErrorKind["DUPLICATE_PLURAL_ARGUMENT_SELECTOR"] = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR"; 935 /** Duplicate selectors in `select` argument. 936 * (e.g. {foo, select, apple {apple} apple {apple}}) 937 */ 938 ErrorKind[ErrorKind["DUPLICATE_SELECT_ARGUMENT_SELECTOR"] = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR"; 939 /** Plural or select argument option must have `other` clause. */ 940 ErrorKind[ErrorKind["MISSING_OTHER_CLAUSE"] = 22] = "MISSING_OTHER_CLAUSE"; 941 /** The tag is malformed. (e.g. `<bold!>foo</bold!>) */ 942 ErrorKind[ErrorKind["INVALID_TAG"] = 23] = "INVALID_TAG"; 943 /** The tag name is invalid. (e.g. `<123>foo</123>`) */ 944 ErrorKind[ErrorKind["INVALID_TAG_NAME"] = 25] = "INVALID_TAG_NAME"; 945 /** The closing tag does not match the opening tag. (e.g. `<bold>foo</italic>`) */ 946 ErrorKind[ErrorKind["UNMATCHED_CLOSING_TAG"] = 26] = "UNMATCHED_CLOSING_TAG"; 947 /** The opening tag has unmatched closing tag. (e.g. `<bold>foo`) */ 948 ErrorKind[ErrorKind["UNCLOSED_TAG"] = 27] = "UNCLOSED_TAG"; 949})(ErrorKind || (error$1.ErrorKind = ErrorKind = {})); 950 951var parser = {}; 952 953var types = {}; 954 955Object.defineProperty(types, "__esModule", { value: true }); 956types.createNumberElement = types.createLiteralElement = types.isDateTimeSkeleton = types.isNumberSkeleton = types.isTagElement = types.isPoundElement = types.isPluralElement = types.isSelectElement = types.isTimeElement = types.isDateElement = types.isNumberElement = types.isArgumentElement = types.isLiteralElement = types.SKELETON_TYPE = types.TYPE = void 0; 957var TYPE; 958(function (TYPE) { 959 /** 960 * Raw text 961 */ 962 TYPE[TYPE["literal"] = 0] = "literal"; 963 /** 964 * Variable w/o any format, e.g `var` in `this is a {var}` 965 */ 966 TYPE[TYPE["argument"] = 1] = "argument"; 967 /** 968 * Variable w/ number format 969 */ 970 TYPE[TYPE["number"] = 2] = "number"; 971 /** 972 * Variable w/ date format 973 */ 974 TYPE[TYPE["date"] = 3] = "date"; 975 /** 976 * Variable w/ time format 977 */ 978 TYPE[TYPE["time"] = 4] = "time"; 979 /** 980 * Variable w/ select format 981 */ 982 TYPE[TYPE["select"] = 5] = "select"; 983 /** 984 * Variable w/ plural format 985 */ 986 TYPE[TYPE["plural"] = 6] = "plural"; 987 /** 988 * Only possible within plural argument. 989 * This is the `#` symbol that will be substituted with the count. 990 */ 991 TYPE[TYPE["pound"] = 7] = "pound"; 992 /** 993 * XML-like tag 994 */ 995 TYPE[TYPE["tag"] = 8] = "tag"; 996})(TYPE || (types.TYPE = TYPE = {})); 997var SKELETON_TYPE; 998(function (SKELETON_TYPE) { 999 SKELETON_TYPE[SKELETON_TYPE["number"] = 0] = "number"; 1000 SKELETON_TYPE[SKELETON_TYPE["dateTime"] = 1] = "dateTime"; 1001})(SKELETON_TYPE || (types.SKELETON_TYPE = SKELETON_TYPE = {})); 1002/** 1003 * Type Guards 1004 */ 1005function isLiteralElement(el) { 1006 return el.type === TYPE.literal; 1007} 1008types.isLiteralElement = isLiteralElement; 1009function isArgumentElement(el) { 1010 return el.type === TYPE.argument; 1011} 1012types.isArgumentElement = isArgumentElement; 1013function isNumberElement(el) { 1014 return el.type === TYPE.number; 1015} 1016types.isNumberElement = isNumberElement; 1017function isDateElement(el) { 1018 return el.type === TYPE.date; 1019} 1020types.isDateElement = isDateElement; 1021function isTimeElement(el) { 1022 return el.type === TYPE.time; 1023} 1024types.isTimeElement = isTimeElement; 1025function isSelectElement(el) { 1026 return el.type === TYPE.select; 1027} 1028types.isSelectElement = isSelectElement; 1029function isPluralElement(el) { 1030 return el.type === TYPE.plural; 1031} 1032types.isPluralElement = isPluralElement; 1033function isPoundElement(el) { 1034 return el.type === TYPE.pound; 1035} 1036types.isPoundElement = isPoundElement; 1037function isTagElement(el) { 1038 return el.type === TYPE.tag; 1039} 1040types.isTagElement = isTagElement; 1041function isNumberSkeleton(el) { 1042 return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number); 1043} 1044types.isNumberSkeleton = isNumberSkeleton; 1045function isDateTimeSkeleton(el) { 1046 return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime); 1047} 1048types.isDateTimeSkeleton = isDateTimeSkeleton; 1049function createLiteralElement(value) { 1050 return { 1051 type: TYPE.literal, 1052 value: value, 1053 }; 1054} 1055types.createLiteralElement = createLiteralElement; 1056function createNumberElement(value, style) { 1057 return { 1058 type: TYPE.number, 1059 value: value, 1060 style: style, 1061 }; 1062} 1063types.createNumberElement = createNumberElement; 1064 1065var regex_generated$1 = {}; 1066 1067Object.defineProperty(regex_generated$1, "__esModule", { value: true }); 1068regex_generated$1.WHITE_SPACE_REGEX = regex_generated$1.SPACE_SEPARATOR_REGEX = void 0; 1069// @generated from regex-gen.ts 1070regex_generated$1.SPACE_SEPARATOR_REGEX = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/; 1071regex_generated$1.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/; 1072 1073var lib$1 = {}; 1074 1075var dateTime = {}; 1076 1077var hasRequiredDateTime; 1078 1079function requireDateTime () { 1080 if (hasRequiredDateTime) return dateTime; 1081 hasRequiredDateTime = 1; 1082 Object.defineProperty(dateTime, "__esModule", { value: true }); 1083 dateTime.parseDateTimeSkeleton = void 0; 1084 /** 1085 * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table 1086 * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
1087 * with some tweaks 1088 */ 1089 var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g; 1090 /** 1091 * Parse Date time skeleton into Intl.DateTimeFormatOptions 1092 * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table 1093 * @public 1094 * @param skeleton skeleton string 1095 */ 1096 function parseDateTimeSkeleton(skeleton) { 1097 var result = {}; 1098 skeleton.replace(DATE_TIME_REGEX, function (match) { 1099 var len = match.length; 1100 switch (match[0]) { 1101 // Era 1102 case 'G': 1103 result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short'; 1104 break; 1105 // Year 1106 case 'y': 1107 result.year = len === 2 ? '2-digit' : 'numeric'; 1108 break; 1109 case 'Y': 1110 case 'u': 1111 case 'U': 1112 case 'r': 1113 throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead'); 1114 // Quarter 1115 case 'q': 1116 case 'Q': 1117 throw new RangeError('`q/Q` (quarter) patterns are not supported'); 1118 // Month 1119 case 'M': 1120 case 'L': 1121 result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1]; 1122 break; 1123 // Week 1124 case 'w': 1125 case 'W': 1126 throw new RangeError('`w/W` (week) patterns are not supported'); 1127 case 'd': 1128 result.day = ['numeric', '2-digit'][len - 1]; 1129 break; 1130 case 'D': 1131 case 'F': 1132 case 'g': 1133 throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead'); 1134 // Weekday 1135 case 'E': 1136 result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short'; 1137 break; 1138 case 'e': 1139 if (len < 4) { 1140 throw new RangeError('`e..eee` (weekday) patterns are not supported'); 1141 } 1142 result.weekday = ['short', 'long', 'narrow', 'short'][len - 4]; 1143 break; 1144 case 'c': 1145 if (len < 4) { 1146 throw new RangeError('`c..ccc` (weekday) patterns are not supported'); 1147 } 1148 result.weekday = ['short', 'long', 'narrow', 'short'][len - 4]; 1149 break; 1150 // Period 1151 case 'a': // AM, PM 1152 result.hour12 = true; 1153 break; 1154 case 'b': // am, pm, noon, midnight 1155 case 'B': // flexible day periods 1156 throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead'); 1157 // Hour 1158 case 'h': 1159 result.hourCycle = 'h12'; 1160 result.hour = ['numeric', '2-digit'][len - 1]; 1161 break; 1162 case 'H': 1163 result.hourCycle = 'h23'; 1164 result.hour = ['numeric', '2-digit'][len - 1]; 1165 break; 1166 case 'K': 1167 result.hourCycle = 'h11'; 1168 result.hour = ['numeric', '2-digit'][len - 1]; 1169 break; 1170 case 'k': 1171 result.hourCycle = 'h24'; 1172 result.hour = ['numeric', '2-digit'][len - 1]; 1173 break; 1174 case 'j': 1175 case 'J': 1176 case 'C': 1177 throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead'); 1178 // Minute 1179 case 'm': 1180 result.minute = ['numeric', '2-digit'][len - 1]; 1181 break; 1182 // Second 1183 case 's': 1184 result.second = ['numeric', '2-digit'][len - 1]; 1185 break; 1186 case 'S': 1187 case 'A': 1188 throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead'); 1189 // Zone 1190 case 'z': // 1..3, 4: specific non-location format 1191 result.timeZoneName = len < 4 ? 'short' : 'long'; 1192 break; 1193 case 'Z': // 1..3, 4, 5: The ISO8601 varios formats 1194 case 'O': // 1, 4: miliseconds in day short, long 1195 case 'v': // 1, 4: generic non-location format 1196 case 'V': // 1, 2, 3, 4: time zone ID or city 1197 case 'X': // 1, 2, 3, 4: The ISO8601 varios formats 1198 case 'x': // 1, 2, 3, 4: The ISO8601 varios formats 1199 throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead'); 1200 } 1201 return ''; 1202 }); 1203 return result; 1204 } 1205 dateTime.parseDateTimeSkeleton = parseDateTimeSkeleton; 1206 return dateTime; 1207} 1208 1209var number$4 = {}; 1210 1211var regex_generated = {}; 1212 1213var hasRequiredRegex_generated; 1214 1215function requireRegex_generated () { 1216 if (hasRequiredRegex_generated) return regex_generated; 1217 hasRequiredRegex_generated = 1; 1218 Object.defineProperty(regex_generated, "__esModule", { value: true }); 1219 regex_generated.WHITE_SPACE_REGEX = void 0; 1220 // @generated from regex-gen.ts 1221 regex_generated.WHITE_SPACE_REGEX = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i; 1222 return regex_generated; 1223} 1224 1225var hasRequiredNumber; 1226 1227function requireNumber () { 1228 if (hasRequiredNumber) return number$4; 1229 hasRequiredNumber = 1; 1230 Object.defineProperty(number$4, "__esModule", { value: true }); 1231 number$4.parseNumberSkeleton = number$4.parseNumberSkeletonFromString = void 0; 1232 var tslib_1 = tslibExports; 1233 var regex_generated_1 = requireRegex_generated(); 1234 function parseNumberSkeletonFromString(skeleton) { 1235 if (skeleton.length === 0) { 1236 throw new Error('Number skeleton cannot be empty'); 1237 } 1238 // Parse the skeleton 1239 var stringTokens = skeleton 1240 .split(regex_generated_1.WHITE_SPACE_REGEX) 1241 .filter(function (x) { return x.length > 0; }); 1242 var tokens = [];
vendor: 4,319 bytes, lines 1243-1379
1243 for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) { 1244 var stringToken = stringTokens_1[_i]; 1245 var stemAndOptions = stringToken.split('/'); 1246 if (stemAndOptions.length === 0) { 1247 throw new Error('Invalid number skeleton'); 1248 } 1249 var stem = stemAndOptions[0], options = stemAndOptions.slice(1); 1250 for (var _a = 0, options_1 = options; _a < options_1.length; _a++) { 1251 var option = options_1[_a]; 1252 if (option.length === 0) { 1253 throw new Error('Invalid number skeleton'); 1254 } 1255 } 1256 tokens.push({ stem: stem, options: options }); 1257 } 1258 return tokens; 1259 } 1260 number$4.parseNumberSkeletonFromString = parseNumberSkeletonFromString; 1261 function icuUnitToEcma(unit) { 1262 return unit.replace(/^(.*?)-/, ''); 1263 } 1264 var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g; 1265 var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g; 1266 var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g; 1267 var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/; 1268 function parseSignificantPrecision(str) { 1269 var result = {}; 1270 if (str[str.length - 1] === 'r') { 1271 result.roundingPriority = 'morePrecision'; 1272 } 1273 else if (str[str.length - 1] === 's') { 1274 result.roundingPriority = 'lessPrecision'; 1275 } 1276 str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) { 1277 // @@@ case 1278 if (typeof g2 !== 'string') { 1279 result.minimumSignificantDigits = g1.length; 1280 result.maximumSignificantDigits = g1.length; 1281 } 1282 // @@@+ case 1283 else if (g2 === '+') { 1284 result.minimumSignificantDigits = g1.length; 1285 } 1286 // .### case 1287 else if (g1[0] === '#') { 1288 result.maximumSignificantDigits = g1.length; 1289 } 1290 // .@@## or .@@@ case 1291 else { 1292 result.minimumSignificantDigits = g1.length; 1293 result.maximumSignificantDigits = 1294 g1.length + (typeof g2 === 'string' ? g2.length : 0); 1295 } 1296 return ''; 1297 }); 1298 return result; 1299 } 1300 function parseSign(str) { 1301 switch (str) { 1302 case 'sign-auto': 1303 return { 1304 signDisplay: 'auto', 1305 }; 1306 case 'sign-accounting': 1307 case '()': 1308 return { 1309 currencySign: 'accounting', 1310 }; 1311 case 'sign-always': 1312 case '+!': 1313 return { 1314 signDisplay: 'always', 1315 }; 1316 case 'sign-accounting-always': 1317 case '()!': 1318 return { 1319 signDisplay: 'always', 1320 currencySign: 'accounting', 1321 }; 1322 case 'sign-except-zero': 1323 case '+?': 1324 return { 1325 signDisplay: 'exceptZero', 1326 }; 1327 case 'sign-accounting-except-zero': 1328 case '()?': 1329 return { 1330 signDisplay: 'exceptZero', 1331 currencySign: 'accounting', 1332 }; 1333 case 'sign-never': 1334 case '+_': 1335 return { 1336 signDisplay: 'never', 1337 }; 1338 } 1339 } 1340 function parseConciseScientificAndEngineeringStem(stem) { 1341 // Engineering 1342 var result; 1343 if (stem[0] === 'E' && stem[1] === 'E') { 1344 result = { 1345 notation: 'engineering', 1346 }; 1347 stem = stem.slice(2); 1348 } 1349 else if (stem[0] === 'E') { 1350 result = { 1351 notation: 'scientific', 1352 }; 1353 stem = stem.slice(1); 1354 } 1355 if (result) { 1356 var signDisplay = stem.slice(0, 2); 1357 if (signDisplay === '+!') { 1358 result.signDisplay = 'always'; 1359 stem = stem.slice(2); 1360 } 1361 else if (signDisplay === '+?') { 1362 result.signDisplay = 'exceptZero'; 1363 stem = stem.slice(2); 1364 } 1365 if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) { 1366 throw new Error('Malformed concise eng/scientific notation'); 1367 } 1368 result.minimumIntegerDigits = stem.length; 1369 } 1370 return result; 1371 } 1372 function parseNotationOptions(opt) { 1373 var result = {}; 1374 var signOpts = parseSign(opt); 1375 if (signOpts) { 1376 return signOpts; 1377 } 1378 return result; 1379 }
vendor: 7,106 bytes, lines 1380-1534
1380 /** 1381 * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options 1382 */ 1383 function parseNumberSkeleton(tokens) { 1384 var result = {}; 1385 for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { 1386 var token = tokens_1[_i]; 1387 switch (token.stem) { 1388 case 'percent': 1389 case '%': 1390 result.style = 'percent'; 1391 continue; 1392 case '%x100': 1393 result.style = 'percent'; 1394 result.scale = 100; 1395 continue; 1396 case 'currency': 1397 result.style = 'currency'; 1398 result.currency = token.options[0]; 1399 continue; 1400 case 'group-off': 1401 case ',_': 1402 result.useGrouping = false; 1403 continue; 1404 case 'precision-integer': 1405 case '.': 1406 result.maximumFractionDigits = 0; 1407 continue; 1408 case 'measure-unit': 1409 case 'unit': 1410 result.style = 'unit'; 1411 result.unit = icuUnitToEcma(token.options[0]); 1412 continue; 1413 case 'compact-short': 1414 case 'K': 1415 result.notation = 'compact'; 1416 result.compactDisplay = 'short'; 1417 continue; 1418 case 'compact-long': 1419 case 'KK': 1420 result.notation = 'compact'; 1421 result.compactDisplay = 'long'; 1422 continue; 1423 case 'scientific': 1424 result = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (tslib_1.__assign(tslib_1.__assign({}, all), parseNotationOptions(opt))); }, {})); 1425 continue; 1426 case 'engineering': 1427 result = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (tslib_1.__assign(tslib_1.__assign({}, all), parseNotationOptions(opt))); }, {})); 1428 continue; 1429 case 'notation-simple': 1430 result.notation = 'standard'; 1431 continue; 1432 // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h 1433 case 'unit-width-narrow': 1434 result.currencyDisplay = 'narrowSymbol'; 1435 result.unitDisplay = 'narrow'; 1436 continue; 1437 case 'unit-width-short': 1438 result.currencyDisplay = 'code'; 1439 result.unitDisplay = 'short'; 1440 continue; 1441 case 'unit-width-full-name': 1442 result.currencyDisplay = 'name'; 1443 result.unitDisplay = 'long'; 1444 continue; 1445 case 'unit-width-iso-code': 1446 result.currencyDisplay = 'symbol'; 1447 continue; 1448 case 'scale': 1449 result.scale = parseFloat(token.options[0]); 1450 continue; 1451 // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width 1452 case 'integer-width': 1453 if (token.options.length > 1) { 1454 throw new RangeError('integer-width stems only accept a single optional option'); 1455 } 1456 token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) { 1457 if (g1) { 1458 result.minimumIntegerDigits = g2.length; 1459 } 1460 else if (g3 && g4) { 1461 throw new Error('We currently do not support maximum integer digits'); 1462 } 1463 else if (g5) { 1464 throw new Error('We currently do not support exact integer digits'); 1465 } 1466 return ''; 1467 }); 1468 continue; 1469 } 1470 // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width 1471 if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) { 1472 result.minimumIntegerDigits = token.stem.length; 1473 continue; 1474 } 1475 if (FRACTION_PRECISION_REGEX.test(token.stem)) { 1476 // Precision 1477 // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision 1478 // precision-integer case 1479 if (token.options.length > 1) { 1480 throw new RangeError('Fraction-precision stems only accept a single optional option'); 1481 } 1482 token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) { 1483 // .000* case (before ICU67 it was .000+) 1484 if (g2 === '*') { 1485 result.minimumFractionDigits = g1.length; 1486 } 1487 // .### case 1488 else if (g3 && g3[0] === '#') { 1489 result.maximumFractionDigits = g3.length; 1490 } 1491 // .00## case 1492 else if (g4 && g5) { 1493 result.minimumFractionDigits = g4.length; 1494 result.maximumFractionDigits = g4.length + g5.length; 1495 } 1496 else { 1497 result.minimumFractionDigits = g1.length; 1498 result.maximumFractionDigits = g1.length; 1499 } 1500 return ''; 1501 }); 1502 var opt = token.options[0]; 1503 // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display 1504 if (opt === 'w') { 1505 result = tslib_1.__assign(tslib_1.__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' }); 1506 } 1507 else if (opt) { 1508 result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(opt)); 1509 } 1510 continue; 1511 } 1512 // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision 1513 if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) { 1514 result = tslib_1.__assign(tslib_1.__assign({}, result), parseSignificantPrecision(token.stem)); 1515 continue; 1516 } 1517 var signOpts = parseSign(token.stem); 1518 if (signOpts) { 1519 result = tslib_1.__assign(tslib_1.__assign({}, result), signOpts); 1520 } 1521 var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem); 1522 if (conciseScientificAndEngineeringOpts) { 1523 result = tslib_1.__assign(tslib_1.__assign({}, result), conciseScientificAndEngineeringOpts); 1524 } 1525 } 1526 return result; 1527 } 1528 number$4.parseNumberSkeleton = parseNumberSkeleton; 1529 return number$4; 1530} 1531 1532(function (exports) { 1533 Object.defineProperty(exports, "__esModule", { value: true }); 1534 var tslib_1 = tslibExports;
1535 tslib_1.__exportStar(requireDateTime(), exports); 1536 tslib_1.__exportStar(requireNumber(), exports); 1537} (lib$1)); 1538 1539var dateTimePatternGenerator = {}; 1540 1541var timeData_generated = {}; 1542 1543Object.defineProperty(timeData_generated, "__esModule", { value: true }); 1544timeData_generated.timeData = void 0; 1545// @generated from time-data-gen.ts 1546// prettier-ignore 1547timeData_generated.timeData = { 1548 "001": [ 1549 "H", 1550 "h" 1551 ], 1552 "AC": [ 1553 "H", 1554 "h", 1555 "hb", 1556 "hB" 1557 ], 1558 "AD": [ 1559 "H", 1560 "hB" 1561 ], 1562 "AE": [ 1563 "h", 1564 "hB", 1565 "hb", 1566 "H" 1567 ], 1568 "AF": [ 1569 "H", 1570 "hb", 1571 "hB", 1572 "h" 1573 ], 1574 "AG": [ 1575 "h", 1576 "hb", 1577 "H", 1578 "hB" 1579 ], 1580 "AI": [ 1581 "H", 1582 "h", 1583 "hb", 1584 "hB" 1585 ], 1586 "AL": [ 1587 "h", 1588 "H", 1589 "hB" 1590 ], 1591 "AM": [ 1592 "H", 1593 "hB" 1594 ], 1595 "AO": [ 1596 "H", 1597 "hB" 1598 ], 1599 "AR": [ 1600 "H", 1601 "h", 1602 "hB", 1603 "hb" 1604 ], 1605 "AS": [ 1606 "h", 1607 "H" 1608 ], 1609 "AT": [ 1610 "H", 1611 "hB" 1612 ], 1613 "AU": [ 1614 "h", 1615 "hb", 1616 "H", 1617 "hB" 1618 ], 1619 "AW": [ 1620 "H", 1621 "hB" 1622 ], 1623 "AX": [ 1624 "H" 1625 ], 1626 "AZ": [ 1627 "H", 1628 "hB", 1629 "h" 1630 ], 1631 "BA": [ 1632 "H", 1633 "hB", 1634 "h" 1635 ], 1636 "BB": [ 1637 "h", 1638 "hb", 1639 "H", 1640 "hB" 1641 ], 1642 "BD": [ 1643 "h", 1644 "hB", 1645 "H" 1646 ], 1647 "BE": [ 1648 "H", 1649 "hB" 1650 ], 1651 "BF": [ 1652 "H", 1653 "hB" 1654 ], 1655 "BG": [ 1656 "H", 1657 "hB", 1658 "h" 1659 ], 1660 "BH": [ 1661 "h", 1662 "hB", 1663 "hb", 1664 "H" 1665 ], 1666 "BI": [ 1667 "H", 1668 "h" 1669 ], 1670 "BJ": [ 1671 "H", 1672 "hB" 1673 ], 1674 "BL": [ 1675 "H", 1676 "hB" 1677 ], 1678 "BM": [ 1679 "h", 1680 "hb", 1681 "H", 1682 "hB" 1683 ], 1684 "BN": [ 1685 "hb", 1686 "hB", 1687 "h", 1688 "H" 1689 ], 1690 "BO": [ 1691 "H", 1692 "hB", 1693 "h", 1694 "hb" 1695 ], 1696 "BQ": [ 1697 "H" 1698 ], 1699 "BR": [ 1700 "H", 1701 "hB" 1702 ], 1703 "BS": [ 1704 "h", 1705 "hb", 1706 "H", 1707 "hB" 1708 ], 1709 "BT": [ 1710 "h", 1711 "H" 1712 ], 1713 "BW": [ 1714 "H", 1715 "h", 1716 "hb", 1717 "hB" 1718 ], 1719 "BY": [ 1720 "H", 1721 "h" 1722 ], 1723 "BZ": [ 1724 "H", 1725 "h", 1726 "hb", 1727 "hB" 1728 ], 1729 "CA": [ 1730 "h", 1731 "hb", 1732 "H", 1733 "hB" 1734 ], 1735 "CC": [ 1736 "H", 1737 "h", 1738 "hb", 1739 "hB" 1740 ], 1741 "CD": [ 1742 "hB", 1743 "H" 1744 ], 1745 "CF": [ 1746 "H", 1747 "h", 1748 "hB" 1749 ], 1750 "CG": [ 1751 "H", 1752 "hB" 1753 ], 1754 "CH": [ 1755 "H", 1756 "hB", 1757 "h" 1758 ], 1759 "CI": [ 1760 "H", 1761 "hB" 1762 ], 1763 "CK": [ 1764 "H", 1765 "h", 1766 "hb", 1767 "hB" 1768 ], 1769 "CL": [ 1770 "H", 1771 "h", 1772 "hB", 1773 "hb" 1774 ], 1775 "CM": [ 1776 "H", 1777 "h", 1778 "hB" 1779 ], 1780 "CN": [ 1781 "H", 1782 "hB", 1783 "hb", 1784 "h" 1785 ], 1786 "CO": [ 1787 "h", 1788 "H", 1789 "hB", 1790 "hb" 1791 ], 1792 "CP": [ 1793 "H" 1794 ], 1795 "CR": [ 1796 "H", 1797 "h", 1798 "hB", 1799 "hb" 1800 ], 1801 "CU": [ 1802 "H", 1803 "h", 1804 "hB", 1805 "hb" 1806 ], 1807 "CV": [ 1808 "H", 1809 "hB" 1810 ], 1811 "CW": [ 1812 "H", 1813 "hB" 1814 ], 1815 "CX": [ 1816 "H", 1817 "h", 1818 "hb", 1819 "hB" 1820 ], 1821 "CY": [ 1822 "h", 1823 "H", 1824 "hb", 1825 "hB" 1826 ], 1827 "CZ": [ 1828 "H" 1829 ], 1830 "DE": [ 1831 "H", 1832 "hB" 1833 ], 1834 "DG": [ 1835 "H", 1836 "h", 1837 "hb", 1838 "hB" 1839 ], 1840 "DJ": [ 1841 "h", 1842 "H" 1843 ], 1844 "DK": [ 1845 "H" 1846 ], 1847 "DM": [ 1848 "h", 1849 "hb", 1850 "H", 1851 "hB" 1852 ], 1853 "DO": [ 1854 "h", 1855 "H", 1856 "hB", 1857 "hb" 1858 ], 1859 "DZ": [ 1860 "h", 1861 "hB", 1862 "hb", 1863 "H" 1864 ], 1865 "EA": [ 1866 "H", 1867 "h", 1868 "hB", 1869 "hb" 1870 ], 1871 "EC": [ 1872 "H", 1873 "hB", 1874 "h", 1875 "hb" 1876 ], 1877 "EE": [ 1878 "H", 1879 "hB" 1880 ], 1881 "EG": [ 1882 "h", 1883 "hB", 1884 "hb", 1885 "H" 1886 ], 1887 "EH": [ 1888 "h", 1889 "hB", 1890 "hb", 1891 "H" 1892 ], 1893 "ER": [ 1894 "h", 1895 "H" 1896 ], 1897 "ES": [ 1898 "H", 1899 "hB", 1900 "h", 1901 "hb" 1902 ], 1903 "ET": [ 1904 "hB", 1905 "hb", 1906 "h", 1907 "H" 1908 ], 1909 "FI": [ 1910 "H" 1911 ], 1912 "FJ": [ 1913 "h", 1914 "hb", 1915 "H", 1916 "hB" 1917 ], 1918 "FK": [ 1919 "H", 1920 "h", 1921 "hb", 1922 "hB" 1923 ], 1924 "FM": [ 1925 "h", 1926 "hb", 1927 "H", 1928 "hB" 1929 ], 1930 "FO": [ 1931 "H", 1932 "h" 1933 ], 1934 "FR": [ 1935 "H", 1936 "hB" 1937 ], 1938 "GA": [ 1939 "H", 1940 "hB" 1941 ], 1942 "GB": [ 1943 "H", 1944 "h", 1945 "hb", 1946 "hB" 1947 ], 1948 "GD": [ 1949 "h", 1950 "hb", 1951 "H", 1952 "hB" 1953 ], 1954 "GE": [ 1955 "H", 1956 "hB", 1957 "h" 1958 ], 1959 "GF": [ 1960 "H", 1961 "hB" 1962 ], 1963 "GG": [ 1964 "H", 1965 "h", 1966 "hb", 1967 "hB" 1968 ], 1969 "GH": [ 1970 "h", 1971 "H" 1972 ], 1973 "GI": [ 1974 "H", 1975 "h", 1976 "hb", 1977 "hB" 1978 ], 1979 "GL": [ 1980 "H", 1981 "h" 1982 ], 1983 "GM": [ 1984 "h", 1985 "hb", 1986 "H", 1987 "hB" 1988 ], 1989 "GN": [ 1990 "H", 1991 "hB" 1992 ], 1993 "GP": [ 1994 "H", 1995 "hB" 1996 ], 1997 "GQ": [ 1998 "H", 1999 "hB", 2000 "h", 2001 "hb" 2002 ], 2003 "GR": [ 2004 "h", 2005 "H", 2006 "hb", 2007 "hB" 2008 ], 2009 "GT": [ 2010 "H", 2011 "h", 2012 "hB", 2013 "hb" 2014 ], 2015 "GU": [ 2016 "h", 2017 "hb", 2018 "H", 2019 "hB" 2020 ],
2021 "GW": [ 2022 "H", 2023 "hB" 2024 ], 2025 "GY": [ 2026 "h", 2027 "hb", 2028 "H", 2029 "hB" 2030 ], 2031 "HK": [ 2032 "h", 2033 "hB", 2034 "hb", 2035 "H" 2036 ], 2037 "HN": [ 2038 "H", 2039 "h", 2040 "hB", 2041 "hb" 2042 ], 2043 "HR": [ 2044 "H", 2045 "hB" 2046 ], 2047 "HU": [ 2048 "H", 2049 "h" 2050 ], 2051 "IC": [ 2052 "H", 2053 "h", 2054 "hB", 2055 "hb" 2056 ], 2057 "ID": [ 2058 "H" 2059 ], 2060 "IE": [ 2061 "H", 2062 "h", 2063 "hb", 2064 "hB" 2065 ], 2066 "IL": [ 2067 "H", 2068 "hB" 2069 ], 2070 "IM": [ 2071 "H", 2072 "h", 2073 "hb", 2074 "hB" 2075 ], 2076 "IN": [ 2077 "h", 2078 "H" 2079 ], 2080 "IO": [ 2081 "H", 2082 "h", 2083 "hb", 2084 "hB" 2085 ], 2086 "IQ": [ 2087 "h", 2088 "hB", 2089 "hb", 2090 "H" 2091 ], 2092 "IR": [ 2093 "hB", 2094 "H" 2095 ], 2096 "IS": [ 2097 "H" 2098 ], 2099 "IT": [ 2100 "H", 2101 "hB" 2102 ], 2103 "JE": [ 2104 "H", 2105 "h", 2106 "hb", 2107 "hB" 2108 ], 2109 "JM": [ 2110 "h", 2111 "hb", 2112 "H", 2113 "hB" 2114 ], 2115 "JO": [ 2116 "h", 2117 "hB", 2118 "hb", 2119 "H" 2120 ], 2121 "JP": [ 2122 "H", 2123 "K", 2124 "h" 2125 ], 2126 "KE": [ 2127 "hB", 2128 "hb", 2129 "H", 2130 "h" 2131 ], 2132 "KG": [ 2133 "H", 2134 "h", 2135 "hB", 2136 "hb" 2137 ], 2138 "KH": [ 2139 "hB", 2140 "h", 2141 "H", 2142 "hb" 2143 ], 2144 "KI": [ 2145 "h", 2146 "hb", 2147 "H", 2148 "hB" 2149 ], 2150 "KM": [ 2151 "H", 2152 "h", 2153 "hB", 2154 "hb" 2155 ], 2156 "KN": [ 2157 "h", 2158 "hb", 2159 "H", 2160 "hB" 2161 ], 2162 "KP": [ 2163 "h", 2164 "H", 2165 "hB", 2166 "hb" 2167 ], 2168 "KR": [ 2169 "h", 2170 "H", 2171 "hB", 2172 "hb" 2173 ], 2174 "KW": [ 2175 "h", 2176 "hB", 2177 "hb", 2178 "H" 2179 ], 2180 "KY": [ 2181 "h", 2182 "hb", 2183 "H", 2184 "hB" 2185 ], 2186 "KZ": [ 2187 "H", 2188 "hB" 2189 ], 2190 "LA": [ 2191 "H", 2192 "hb", 2193 "hB", 2194 "h" 2195 ], 2196 "LB": [ 2197 "h", 2198 "hB", 2199 "hb", 2200 "H" 2201 ], 2202 "LC": [ 2203 "h", 2204 "hb", 2205 "H", 2206 "hB" 2207 ], 2208 "LI": [ 2209 "H", 2210 "hB", 2211 "h" 2212 ], 2213 "LK": [ 2214 "H", 2215 "h", 2216 "hB", 2217 "hb" 2218 ], 2219 "LR": [ 2220 "h", 2221 "hb", 2222 "H", 2223 "hB" 2224 ], 2225 "LS": [ 2226 "h", 2227 "H" 2228 ], 2229 "LT": [ 2230 "H", 2231 "h", 2232 "hb", 2233 "hB" 2234 ], 2235 "LU": [ 2236 "H", 2237 "h", 2238 "hB" 2239 ], 2240 "LV": [ 2241 "H", 2242 "hB", 2243 "hb", 2244 "h" 2245 ], 2246 "LY": [ 2247 "h", 2248 "hB", 2249 "hb", 2250 "H" 2251 ], 2252 "MA": [ 2253 "H", 2254 "h", 2255 "hB", 2256 "hb" 2257 ], 2258 "MC": [ 2259 "H", 2260 "hB" 2261 ], 2262 "MD": [ 2263 "H", 2264 "hB" 2265 ], 2266 "ME": [ 2267 "H", 2268 "hB", 2269 "h" 2270 ], 2271 "MF": [ 2272 "H", 2273 "hB" 2274 ], 2275 "MG": [ 2276 "H", 2277 "h" 2278 ], 2279 "MH": [ 2280 "h", 2281 "hb", 2282 "H", 2283 "hB" 2284 ], 2285 "MK": [ 2286 "H", 2287 "h", 2288 "hb", 2289 "hB" 2290 ], 2291 "ML": [ 2292 "H" 2293 ], 2294 "MM": [ 2295 "hB", 2296 "hb", 2297 "H", 2298 "h" 2299 ], 2300 "MN": [ 2301 "H", 2302 "h", 2303 "hb", 2304 "hB" 2305 ], 2306 "MO": [ 2307 "h", 2308 "hB", 2309 "hb", 2310 "H" 2311 ], 2312 "MP": [ 2313 "h", 2314 "hb", 2315 "H", 2316 "hB" 2317 ], 2318 "MQ": [ 2319 "H", 2320 "hB" 2321 ], 2322 "MR": [ 2323 "h", 2324 "hB", 2325 "hb", 2326 "H" 2327 ], 2328 "MS": [ 2329 "H", 2330 "h", 2331 "hb", 2332 "hB" 2333 ], 2334 "MT": [ 2335 "H", 2336 "h" 2337 ], 2338 "MU": [ 2339 "H", 2340 "h" 2341 ], 2342 "MV": [ 2343 "H", 2344 "h" 2345 ], 2346 "MW": [ 2347 "h", 2348 "hb", 2349 "H", 2350 "hB" 2351 ], 2352 "MX": [ 2353 "H", 2354 "h", 2355 "hB", 2356 "hb" 2357 ], 2358 "MY": [ 2359 "hb", 2360 "hB", 2361 "h", 2362 "H" 2363 ], 2364 "MZ": [ 2365 "H", 2366 "hB" 2367 ], 2368 "NA": [ 2369 "h", 2370 "H", 2371 "hB", 2372 "hb" 2373 ], 2374 "NC": [ 2375 "H", 2376 "hB" 2377 ], 2378 "NE": [ 2379 "H" 2380 ], 2381 "NF": [ 2382 "H", 2383 "h", 2384 "hb", 2385 "hB" 2386 ], 2387 "NG": [ 2388 "H", 2389 "h", 2390 "hb", 2391 "hB" 2392 ], 2393 "NI": [ 2394 "H", 2395 "h", 2396 "hB", 2397 "hb" 2398 ], 2399 "NL": [ 2400 "H", 2401 "hB" 2402 ], 2403 "NO": [ 2404 "H", 2405 "h" 2406 ], 2407 "NP": [ 2408 "H", 2409 "h", 2410 "hB" 2411 ], 2412 "NR": [ 2413 "H", 2414 "h", 2415 "hb", 2416 "hB" 2417 ], 2418 "NU": [ 2419 "H", 2420 "h", 2421 "hb", 2422 "hB" 2423 ], 2424 "NZ": [ 2425 "h", 2426 "hb", 2427 "H", 2428 "hB" 2429 ], 2430 "OM": [ 2431 "h", 2432 "hB", 2433 "hb", 2434 "H" 2435 ], 2436 "PA": [ 2437 "h", 2438 "H", 2439 "hB", 2440 "hb" 2441 ], 2442 "PE": [ 2443 "H", 2444 "hB", 2445 "h", 2446 "hb" 2447 ], 2448 "PF": [ 2449 "H", 2450 "h", 2451 "hB" 2452 ], 2453 "PG": [ 2454 "h", 2455 "H" 2456 ], 2457 "PH": [ 2458 "h", 2459 "hB", 2460 "hb", 2461 "H" 2462 ], 2463 "PK": [ 2464 "h", 2465 "hB", 2466 "H" 2467 ], 2468 "PL": [ 2469 "H", 2470 "h" 2471 ], 2472 "PM": [ 2473 "H", 2474 "hB" 2475 ], 2476 "PN": [ 2477 "H", 2478 "h", 2479 "hb", 2480 "hB" 2481 ], 2482 "PR": [ 2483 "h", 2484 "H", 2485 "hB", 2486 "hb" 2487 ], 2488 "PS": [ 2489 "h", 2490 "hB", 2491 "hb", 2492 "H" 2493 ], 2494 "PT": [ 2495 "H", 2496 "hB" 2497 ], 2498 "PW": [ 2499 "h", 2500 "H" 2501 ], 2502 "PY": [ 2503 "H", 2504 "h", 2505 "hB", 2506 "hb" 2507 ], 2508 "QA": [ 2509 "h", 2510 "hB", 2511 "hb", 2512 "H" 2513 ], 2514 "RE": [ 2515 "H", 2516 "hB" 2517 ], 2518 "RO": [ 2519 "H", 2520 "hB" 2521 ], 2522 "RS": [ 2523 "H", 2524 "hB", 2525 "h" 2526 ], 2527 "RU": [ 2528 "H" 2529 ], 2530 "RW": [ 2531 "H", 2532 "h" 2533 ], 2534 "SA": [ 2535 "h", 2536 "hB", 2537 "hb", 2538 "H" 2539 ], 2540 "SB": [ 2541 "h", 2542 "hb", 2543 "H", 2544 "hB" 2545 ], 2546 "SC": [ 2547 "H", 2548 "h", 2549 "hB" 2550 ], 2551 "SD": [ 2552 "h", 2553 "hB", 2554 "hb", 2555 "H" 2556 ], 2557 "SE": [ 2558 "H" 2559 ], 2560 "SG": [ 2561 "h", 2562 "hb", 2563 "H", 2564 "hB" 2565 ], 2566 "SH": [ 2567 "H", 2568 "h", 2569 "hb", 2570 "hB" 2571 ], 2572 "SI": [ 2573 "H", 2574 "hB" 2575 ], 2576 "SJ": [ 2577 "H" 2578 ], 2579 "SK": [ 2580 "H" 2581 ], 2582 "SL": [ 2583 "h", 2584 "hb", 2585 "H", 2586 "hB" 2587 ], 2588 "SM": [ 2589 "H", 2590 "h", 2591 "hB" 2592 ], 2593 "SN": [ 2594 "H", 2595 "h", 2596 "hB" 2597 ], 2598 "SO": [ 2599 "h", 2600 "H" 2601 ], 2602 "SR": [ 2603 "H", 2604 "hB" 2605 ], 2606 "SS": [ 2607 "h", 2608 "hb", 2609 "H", 2610 "hB" 2611 ], 2612 "ST": [ 2613 "H", 2614 "hB" 2615 ], 2616 "SV": [ 2617 "H", 2618 "h", 2619 "hB", 2620 "hb" 2621 ], 2622 "SX": [ 2623 "H", 2624 "h", 2625 "hb", 2626 "hB" 2627 ], 2628 "SY": [ 2629 "h", 2630 "hB", 2631 "hb", 2632 "H" 2633 ], 2634 "SZ": [ 2635 "h", 2636 "hb", 2637 "H", 2638 "hB" 2639 ], 2640 "TA": [ 2641 "H", 2642 "h", 2643 "hb", 2644 "hB" 2645 ], 2646 "TC": [ 2647 "h", 2648 "hb", 2649 "H", 2650 "hB" 2651 ], 2652 "TD": [ 2653 "h", 2654 "H", 2655 "hB" 2656 ], 2657 "TF": [ 2658 "H", 2659 "h", 2660 "hB" 2661 ], 2662 "TG": [ 2663 "H", 2664 "hB" 2665 ], 2666 "TH": [ 2667 "H", 2668 "h" 2669 ], 2670 "TJ": [ 2671 "H", 2672 "h" 2673 ], 2674 "TL": [ 2675 "H", 2676 "hB", 2677 "hb", 2678 "h" 2679 ], 2680 "TM": [ 2681 "H", 2682 "h" 2683 ], 2684 "TN": [ 2685 "h", 2686 "hB", 2687 "hb", 2688 "H" 2689 ], 2690 "TO": [ 2691 "h", 2692 "H" 2693 ], 2694 "TR": [ 2695 "H", 2696 "hB" 2697 ], 2698 "TT": [ 2699 "h", 2700 "hb", 2701 "H", 2702 "hB" 2703 ], 2704 "TW": [ 2705 "hB", 2706 "hb", 2707 "h", 2708 "H" 2709 ], 2710 "TZ": [ 2711 "hB", 2712 "hb", 2713 "H", 2714 "h" 2715 ], 2716 "UA": [ 2717 "H", 2718 "hB", 2719 "h" 2720 ], 2721 "UG": [ 2722 "hB", 2723 "hb", 2724 "H", 2725 "h" 2726 ], 2727 "UM": [ 2728 "h", 2729 "hb", 2730 "H", 2731 "hB" 2732 ], 2733 "US": [ 2734 "h", 2735 "hb", 2736 "H", 2737 "hB" 2738 ], 2739 "UY": [ 2740 "H", 2741 "h", 2742 "hB", 2743 "hb" 2744 ], 2745 "UZ": [ 2746 "H", 2747 "hB", 2748 "h" 2749 ], 2750 "VA": [ 2751 "H", 2752 "h", 2753 "hB" 2754 ], 2755 "VC": [ 2756 "h", 2757 "hb", 2758 "H", 2759 "hB" 2760 ], 2761 "VE": [ 2762 "h", 2763 "H", 2764 "hB", 2765 "hb" 2766 ], 2767 "VG": [ 2768 "h", 2769 "hb", 2770 "H", 2771 "hB" 2772 ], 2773 "VI": [ 2774 "h", 2775 "hb", 2776 "H", 2777 "hB" 2778 ], 2779 "VN": [ 2780 "H", 2781 "h" 2782 ], 2783 "VU": [ 2784 "h", 2785 "H" 2786 ], 2787 "WF": [ 2788 "H", 2789 "hB" 2790 ], 2791 "WS": [ 2792 "h", 2793 "H" 2794 ], 2795 "XK": [ 2796 "H", 2797 "hB", 2798 "h" 2799 ], 2800 "YE": [ 2801 "h", 2802 "hB", 2803 "hb", 2804 "H" 2805 ], 2806 "YT": [ 2807 "H", 2808 "hB" 2809 ], 2810 "ZA": [ 2811 "H", 2812 "h", 2813 "hb", 2814 "hB" 2815 ], 2816 "ZM": [ 2817 "h", 2818 "hb", 2819 "H", 2820 "hB" 2821 ], 2822 "ZW": [ 2823 "H", 2824 "h" 2825 ], 2826 "af-ZA": [ 2827 "H", 2828 "h", 2829 "hB", 2830 "hb" 2831 ], 2832 "ar-001": [ 2833 "h", 2834 "hB", 2835 "hb", 2836 "H" 2837 ], 2838 "ca-ES": [ 2839 "H", 2840 "h", 2841 "hB" 2842 ], 2843 "en-001": [ 2844 "h", 2845 "hb", 2846 "H", 2847 "hB" 2848 ], 2849 "es-BO": [ 2850 "H", 2851 "h", 2852 "hB", 2853 "hb" 2854 ], 2855 "es-BR": [ 2856 "H", 2857 "h", 2858 "hB", 2859 "hb" 2860 ], 2861 "es-EC": [ 2862 "H", 2863 "h", 2864 "hB", 2865 "hb" 2866 ], 2867 "es-ES": [ 2868 "H", 2869 "h", 2870 "hB", 2871 "hb" 2872 ], 2873 "es-GQ": [ 2874 "H", 2875 "h", 2876 "hB", 2877 "hb" 2878 ], 2879 "es-PE": [ 2880 "H", 2881 "h", 2882 "hB", 2883 "hb" 2884 ], 2885 "fr-CA": [ 2886 "H", 2887 "h", 2888 "hB" 2889 ], 2890 "gl-ES": [ 2891 "H", 2892 "h", 2893 "hB" 2894 ], 2895 "gu-IN": [ 2896 "hB", 2897 "hb", 2898 "h", 2899 "H" 2900 ], 2901 "hi-IN": [ 2902 "hB", 2903 "h", 2904 "H" 2905 ], 2906 "it-CH": [ 2907 "H", 2908 "h", 2909 "hB" 2910 ], 2911 "it-IT": [ 2912 "H", 2913 "h", 2914 "hB" 2915 ], 2916 "kn-IN": [ 2917 "hB", 2918 "h", 2919 "H" 2920 ], 2921 "ml-IN": [ 2922 "hB", 2923 "h", 2924 "H" 2925 ], 2926 "mr-IN": [ 2927 "hB", 2928 "hb", 2929 "h", 2930 "H" 2931 ], 2932 "pa-IN": [ 2933 "hB", 2934 "hb", 2935 "h", 2936 "H" 2937 ], 2938 "ta-IN": [ 2939 "hB", 2940 "h", 2941 "hb", 2942 "H" 2943 ], 2944 "te-IN": [ 2945 "hB", 2946 "h", 2947 "H" 2948 ], 2949 "zu-ZA": [ 2950 "H", 2951 "hB", 2952 "hb", 2953 "h" 2954 ] 2955}; 2956 2957Object.defineProperty(dateTimePatternGenerator, "__esModule", { value: true }); 2958dateTimePatternGenerator.getBestPattern = void 0; 2959var time_data_generated_1 = timeData_generated; 2960/** 2961 * Returns the best matching date time pattern if a date time skeleton 2962 * pattern is provided with a locale. Follows the Unicode specification: 2963 * https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns 2964 * @param skeleton date time skeleton pattern that possibly includes j, J or C 2965 * @param locale 2966 */ 2967function getBestPattern(skeleton, locale) { 2968 var skeletonCopy = ''; 2969 for (var patternPos = 0; patternPos < skeleton.length; patternPos++) { 2970 var patternChar = skeleton.charAt(patternPos); 2971 if (patternChar === 'j') { 2972 var extraLength = 0; 2973 while (patternPos + 1 < skeleton.length && 2974 skeleton.charAt(patternPos + 1) === patternChar) { 2975 extraLength++; 2976 patternPos++; 2977 } 2978 var hourLen = 1 + (extraLength & 1); 2979 var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1); 2980 var dayPeriodChar = 'a'; 2981 var hourChar = getDefaultHourSymbolFromLocale(locale); 2982 if (hourChar == 'H' || hourChar == 'k') { 2983 dayPeriodLen = 0; 2984 } 2985 while (dayPeriodLen-- > 0) { 2986 skeletonCopy += dayPeriodChar; 2987 } 2988 while (hourLen-- > 0) { 2989 skeletonCopy = hourChar + skeletonCopy; 2990 } 2991 } 2992 else if (patternChar === 'J') { 2993 skeletonCopy += 'H'; 2994 } 2995 else { 2996 skeletonCopy += patternChar; 2997 } 2998 } 2999 return skeletonCopy; 3000} 3001dateTimePatternGenerator.getBestPattern = getBestPattern; 3002/** 3003 * Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle) 3004 * of the given `locale` to the corresponding time pattern. 3005 * @param locale 3006 */ 3007function getDefaultHourSymbolFromLocale(locale) { 3008 var hourCycle = locale.hourCycle; 3009 if (hourCycle === undefined && 3010 // @ts-ignore hourCycle(s) is not identified yet 3011 locale.hourCycles && 3012 // @ts-ignore 3013 locale.hourCycles.length) { 3014 // @ts-ignore 3015 hourCycle = locale.hourCycles[0]; 3016 } 3017 if (hourCycle) { 3018 switch (hourCycle) { 3019 case 'h24': 3020 return 'k'; 3021 case 'h23': 3022 return 'H'; 3023 case 'h12': 3024 return 'h'; 3025 case 'h11': 3026 return 'K'; 3027 default: 3028 throw new Error('Invalid hourCycle'); 3029 } 3030 } 3031 // TODO: Once hourCycle is fully supported remove the following with data generation 3032 var languageTag = locale.language; 3033 var regionTag; 3034 if (languageTag !== 'root') { 3035 regionTag = locale.maximize().region; 3036 } 3037 var hourCycles = time_data_generated_1.timeData[regionTag || ''] || 3038 time_data_generated_1.timeData[languageTag || ''] || 3039 time_data_generated_1.timeData["".concat(languageTag, "-001")] || 3040 time_data_generated_1.timeData['001']; 3041 return hourCycles[0]; 3042} 3043 3044var _a; 3045Object.defineProperty(parser, "__esModule", { value: true }); 3046parser.Parser = void 0; 3047var tslib_1$2 = tslibExports; 3048var error_1$1 = error$1; 3049var types_1 = types; 3050var regex_generated_1 = regex_generated$1; 3051var icu_skeleton_parser_1 = lib$1; 3052var date_time_pattern_generator_1 = dateTimePatternGenerator; 3053var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(regex_generated_1.SPACE_SEPARATOR_REGEX.source, "*")); 3054var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(regex_generated_1.SPACE_SEPARATOR_REGEX.source, "*$")); 3055function createLocation(start, end) { 3056 return { start: start, end: end }; 3057} 3058// #region Ponyfills 3059// Consolidate these variables up top for easier toggling during debugging 3060var hasNativeStartsWith = !!String.prototype.startsWith && '_a'.startsWith('a', 1); 3061var hasNativeFromCodePoint = !!String.fromCodePoint; 3062var hasNativeFromEntries = !!Object.fromEntries; 3063var hasNativeCodePointAt = !!String.prototype.codePointAt; 3064var hasTrimStart = !!String.prototype.trimStart; 3065var hasTrimEnd = !!String.prototype.trimEnd; 3066var hasNativeIsSafeInteger = !!Number.isSafeInteger; 3067var isSafeInteger = hasNativeIsSafeInteger 3068 ? Number.isSafeInteger 3069 : function (n) { 3070 return (typeof n === 'number' && 3071 isFinite(n) && 3072 Math.floor(n) === n && 3073 Math.abs(n) <= 0x1fffffffffffff); 3074 }; 3075// IE11 does not support y and u. 3076var REGEX_SUPPORTS_U_AND_Y = true; 3077try { 3078 var re = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu'); 3079 /** 3080 * legacy Edge or Xbox One browser 3081 * Unicode flag support: supported 3082 * Pattern_Syntax support: not supported 3083 * See https://github.com/formatjs/formatjs/issues/2822 3084 */ 3085 REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a'; 3086} 3087catch (_) { 3088 REGEX_SUPPORTS_U_AND_Y = false;
vendor: 6,958 bytes, lines 3089-3283
3089} 3090var startsWith = hasNativeStartsWith 3091 ? // Native 3092 function startsWith(s, search, position) { 3093 return s.startsWith(search, position); 3094 } 3095 : // For IE11 3096 function startsWith(s, search, position) { 3097 return s.slice(position, position + search.length) === search; 3098 }; 3099var fromCodePoint = hasNativeFromCodePoint 3100 ? String.fromCodePoint 3101 : // IE11 3102 function fromCodePoint() { 3103 var codePoints = []; 3104 for (var _i = 0; _i < arguments.length; _i++) { 3105 codePoints[_i] = arguments[_i]; 3106 } 3107 var elements = ''; 3108 var length = codePoints.length; 3109 var i = 0; 3110 var code; 3111 while (length > i) { 3112 code = codePoints[i++]; 3113 if (code > 0x10ffff) 3114 throw RangeError(code + ' is not a valid code point'); 3115 elements += 3116 code < 0x10000 3117 ? String.fromCharCode(code) 3118 : String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00); 3119 } 3120 return elements; 3121 }; 3122var fromEntries = 3123// native 3124hasNativeFromEntries 3125 ? Object.fromEntries 3126 : // Ponyfill 3127 function fromEntries(entries) { 3128 var obj = {}; 3129 for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { 3130 var _a = entries_1[_i], k = _a[0], v = _a[1]; 3131 obj[k] = v; 3132 } 3133 return obj; 3134 }; 3135var codePointAt = hasNativeCodePointAt 3136 ? // Native 3137 function codePointAt(s, index) { 3138 return s.codePointAt(index); 3139 } 3140 : // IE 11 3141 function codePointAt(s, index) { 3142 var size = s.length; 3143 if (index < 0 || index >= size) { 3144 return undefined; 3145 } 3146 var first = s.charCodeAt(index); 3147 var second; 3148 return first < 0xd800 || 3149 first > 0xdbff || 3150 index + 1 === size || 3151 (second = s.charCodeAt(index + 1)) < 0xdc00 || 3152 second > 0xdfff 3153 ? first 3154 : ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000; 3155 }; 3156var trimStart = hasTrimStart 3157 ? // Native 3158 function trimStart(s) { 3159 return s.trimStart(); 3160 } 3161 : // Ponyfill 3162 function trimStart(s) { 3163 return s.replace(SPACE_SEPARATOR_START_REGEX, ''); 3164 }; 3165var trimEnd = hasTrimEnd 3166 ? // Native 3167 function trimEnd(s) { 3168 return s.trimEnd(); 3169 } 3170 : // Ponyfill 3171 function trimEnd(s) { 3172 return s.replace(SPACE_SEPARATOR_END_REGEX, ''); 3173 }; 3174// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11. 3175function RE(s, flag) { 3176 return new RegExp(s, flag); 3177} 3178// #endregion 3179var matchIdentifierAtIndex; 3180if (REGEX_SUPPORTS_U_AND_Y) { 3181 // Native 3182 var IDENTIFIER_PREFIX_RE_1 = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu'); 3183 matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) { 3184 var _a; 3185 IDENTIFIER_PREFIX_RE_1.lastIndex = index; 3186 var match = IDENTIFIER_PREFIX_RE_1.exec(s); 3187 return (_a = match[1]) !== null && _a !== void 0 ? _a : ''; 3188 }; 3189} 3190else { 3191 // IE11 3192 matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) { 3193 var match = []; 3194 while (true) { 3195 var c = codePointAt(s, index); 3196 if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) { 3197 break; 3198 } 3199 match.push(c); 3200 index += c >= 0x10000 ? 2 : 1; 3201 } 3202 return fromCodePoint.apply(void 0, match); 3203 }; 3204} 3205var Parser = /** @class */ (function () { 3206 function Parser(message, options) { 3207 if (options === void 0) { options = {}; } 3208 this.message = message; 3209 this.position = { offset: 0, line: 1, column: 1 }; 3210 this.ignoreTag = !!options.ignoreTag; 3211 this.locale = options.locale; 3212 this.requiresOtherClause = !!options.requiresOtherClause; 3213 this.shouldParseSkeletons = !!options.shouldParseSkeletons; 3214 } 3215 Parser.prototype.parse = function () { 3216 if (this.offset() !== 0) { 3217 throw Error('parser can only be used once'); 3218 } 3219 return this.parseMessage(0, '', false); 3220 }; 3221 Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) { 3222 var elements = []; 3223 while (!this.isEOF()) { 3224 var char = this.char(); 3225 if (char === 123 /* `{` */) { 3226 var result = this.parseArgument(nestingLevel, expectingCloseTag); 3227 if (result.err) { 3228 return result; 3229 } 3230 elements.push(result.val); 3231 } 3232 else if (char === 125 /* `}` */ && nestingLevel > 0) { 3233 break; 3234 } 3235 else if (char === 35 /* `#` */ && 3236 (parentArgType === 'plural' || parentArgType === 'selectordinal')) { 3237 var position = this.clonePosition(); 3238 this.bump(); 3239 elements.push({ 3240 type: types_1.TYPE.pound, 3241 location: createLocation(position, this.clonePosition()), 3242 }); 3243 } 3244 else if (char === 60 /* `<` */ && 3245 !this.ignoreTag && 3246 this.peek() === 47 // char code for '/' 3247 ) { 3248 if (expectingCloseTag) { 3249 break; 3250 } 3251 else { 3252 return this.error(error_1$1.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition())); 3253 } 3254 } 3255 else if (char === 60 /* `<` */ && 3256 !this.ignoreTag && 3257 _isAlpha(this.peek() || 0)) { 3258 var result = this.parseTag(nestingLevel, parentArgType); 3259 if (result.err) { 3260 return result; 3261 } 3262 elements.push(result.val); 3263 } 3264 else { 3265 var result = this.parseLiteral(nestingLevel, parentArgType); 3266 if (result.err) { 3267 return result; 3268 } 3269 elements.push(result.val); 3270 } 3271 } 3272 return { val: elements, err: null }; 3273 }; 3274 /** 3275 * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the 3276 * [custom element name][] except that a dash is NOT always mandatory and uppercase letters 3277 * are accepted: 3278 * 3279 * ``` 3280 * tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">" 3281 * tagName ::= [a-z] (PENChar)* 3282 * PENChar ::= 3283 * "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6
3283] | [#xD8-#xF6] | [#xF8-#x37D] | 3284 * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] | 3285 * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] 3286 * ``` 3287 * 3288 * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name 3289 * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do 3290 * since other tag-based engines like React allow it 3291 */ 3292 Parser.prototype.parseTag = function (nestingLevel, parentArgType) { 3293 var startPosition = this.clonePosition(); 3294 this.bump(); // `<` 3295 var tagName = this.parseTagName(); 3296 this.bumpSpace(); 3297 if (this.bumpIf('/>')) { 3298 // Self closing tag 3299 return { 3300 val: { 3301 type: types_1.TYPE.literal, 3302 value: "<".concat(tagName, "/>"), 3303 location: createLocation(startPosition, this.clonePosition()), 3304 }, 3305 err: null, 3306 }; 3307 } 3308 else if (this.bumpIf('>')) { 3309 var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true); 3310 if (childrenResult.err) { 3311 return childrenResult; 3312 } 3313 var children = childrenResult.val; 3314 // Expecting a close tag 3315 var endTagStartPosition = this.clonePosition(); 3316 if (this.bumpIf('</')) { 3317 if (this.isEOF() || !_isAlpha(this.char())) { 3318 return this.error(error_1$1.ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition())); 3319 } 3320 var closingTagNameStartPosition = this.clonePosition(); 3321 var closingTagName = this.parseTagName(); 3322 if (tagName !== closingTagName) { 3323 return this.error(error_1$1.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(closingTagNameStartPosition, this.clonePosition())); 3324 } 3325 this.bumpSpace(); 3326 if (!this.bumpIf('>')) { 3327 return this.error(error_1$1.ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition())); 3328 } 3329 return { 3330 val: { 3331 type: types_1.TYPE.tag, 3332 value: tagName, 3333 children: children, 3334 location: createLocation(startPosition, this.clonePosition()), 3335 }, 3336 err: null, 3337 }; 3338 } 3339 else { 3340 return this.error(error_1$1.ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition())); 3341 } 3342 } 3343 else { 3344 return this.error(error_1$1.ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition())); 3345 } 3346 }; 3347 /** 3348 * This method assumes that the caller has peeked ahead for the first tag character. 3349 */ 3350 Parser.prototype.parseTagName = function () { 3351 var startOffset = this.offset(); 3352 this.bump(); // the first tag name character 3353 while (!this.isEOF() && _isPotentialElementNameChar(this.char())) { 3354 this.bump(); 3355 } 3356 return this.message.slice(startOffset, this.offset()); 3357 }; 3358 Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) { 3359 var start = this.clonePosition(); 3360 var value = ''; 3361 while (true) { 3362 var parseQuoteResult = this.tryParseQuote(parentArgType); 3363 if (parseQuoteResult) { 3364 value += parseQuoteResult; 3365 continue; 3366 } 3367 var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType); 3368 if (parseUnquotedResult) { 3369 value += parseUnquotedResult; 3370 continue; 3371 } 3372 var parseLeftAngleResult = this.tryParseLeftAngleBracket(); 3373 if (parseLeftAngleResult) { 3374 value += parseLeftAngleResult; 3375 continue; 3376 } 3377 break; 3378 } 3379 var location = createLocation(start, this.clonePosition()); 3380 return { 3381 val: { type: types_1.TYPE.literal, value: value, location: location }, 3382 err: null, 3383 }; 3384 }; 3385 Parser.prototype.tryParseLeftAngleBracket = function () { 3386 if (!this.isEOF() && 3387 this.char() === 60 /* `<` */ && 3388 (this.ignoreTag || 3389 // If at the opening tag or closing tag position, bail. 3390 !_isAlphaOrSlash(this.peek() || 0))) { 3391 this.bump(); // `<` 3392 return '<'; 3393 } 3394 return null; 3395 }; 3396 /** 3397 * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes 3398 * a character that requires quoting (that is, "only where needed"), and works the same in 3399 * nested messages as on the top level of the pattern. The new behavior is otherwise compatible. 3400 */ 3401 Parser.prototype.tryParseQuote = function (parentArgType) { 3402 if (this.isEOF() || this.char() !== 39 /* `'` */) { 3403 return null; 3404 } 3405 // Parse escaped char following the apostrophe, or early return if there is no escaped char. 3406 // Check if is valid escaped character 3407 switch (this.peek()) { 3408 case 39 /* `'` */:
vendor: 15,887 bytes, lines 3409-3759
3409 // double quote, should return as a single quote. 3410 this.bump(); 3411 this.bump(); 3412 return "'"; 3413 // '{', '<', '>', '}' 3414 case 123: 3415 case 60: 3416 case 62: 3417 case 125: 3418 break; 3419 case 35: // '#' 3420 if (parentArgType === 'plural' || parentArgType === 'selectordinal') { 3421 break; 3422 } 3423 return null; 3424 default: 3425 return null; 3426 } 3427 this.bump(); // apostrophe 3428 var codePoints = [this.char()]; // escaped char 3429 this.bump(); 3430 // read chars until the optional closing apostrophe is found 3431 while (!this.isEOF()) { 3432 var ch = this.char(); 3433 if (ch === 39 /* `'` */) { 3434 if (this.peek() === 39 /* `'` */) { 3435 codePoints.push(39); 3436 // Bump one more time because we need to skip 2 characters. 3437 this.bump(); 3438 } 3439 else { 3440 // Optional closing apostrophe. 3441 this.bump(); 3442 break; 3443 } 3444 } 3445 else { 3446 codePoints.push(ch); 3447 } 3448 this.bump(); 3449 } 3450 return fromCodePoint.apply(void 0, codePoints); 3451 }; 3452 Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) { 3453 if (this.isEOF()) { 3454 return null; 3455 } 3456 var ch = this.char(); 3457 if (ch === 60 /* `<` */ || 3458 ch === 123 /* `{` */ || 3459 (ch === 35 /* `#` */ && 3460 (parentArgType === 'plural' || parentArgType === 'selectordinal')) || 3461 (ch === 125 /* `}` */ && nestingLevel > 0)) { 3462 return null; 3463 } 3464 else { 3465 this.bump(); 3466 return fromCodePoint(ch); 3467 } 3468 }; 3469 Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) { 3470 var openingBracePosition = this.clonePosition(); 3471 this.bump(); // `{` 3472 this.bumpSpace(); 3473 if (this.isEOF()) { 3474 return this.error(error_1$1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())); 3475 } 3476 if (this.char() === 125 /* `}` */) { 3477 this.bump(); 3478 return this.error(error_1$1.ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition())); 3479 } 3480 // argument name 3481 var value = this.parseIdentifierIfPossible().value; 3482 if (!value) { 3483 return this.error(error_1$1.ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition())); 3484 } 3485 this.bumpSpace(); 3486 if (this.isEOF()) { 3487 return this.error(error_1$1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())); 3488 } 3489 switch (this.char()) { 3490 // Simple argument: `{name}` 3491 case 125 /* `}` */: { 3492 this.bump(); // `}` 3493 return { 3494 val: { 3495 type: types_1.TYPE.argument, 3496 // value does not include the opening and closing braces. 3497 value: value, 3498 location: createLocation(openingBracePosition, this.clonePosition()), 3499 }, 3500 err: null, 3501 }; 3502 } 3503 // Argument with options: `{name, format, ...}` 3504 case 44 /* `,` */: { 3505 this.bump(); // `,` 3506 this.bumpSpace(); 3507 if (this.isEOF()) { 3508 return this.error(error_1$1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())); 3509 } 3510 return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition); 3511 } 3512 default: 3513 return this.error(error_1$1.ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition())); 3514 } 3515 }; 3516 /** 3517 * Advance the parser until the end of the identifier, if it is currently on 3518 * an identifier character. Return an empty string otherwise. 3519 */ 3520 Parser.prototype.parseIdentifierIfPossible = function () { 3521 var startingPosition = this.clonePosition(); 3522 var startOffset = this.offset(); 3523 var value = matchIdentifierAtIndex(this.message, startOffset); 3524 var endOffset = startOffset + value.length; 3525 this.bumpTo(endOffset); 3526 var endPosition = this.clonePosition(); 3527 var location = createLocation(startingPosition, endPosition); 3528 return { value: value, location: location }; 3529 }; 3530 Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) { 3531 var _a; 3532 // Parse this range: 3533 // {name, type, style} 3534 // ^---^ 3535 var typeStartPosition = this.clonePosition(); 3536 var argType = this.parseIdentifierIfPossible().value; 3537 var typeEndPosition = this.clonePosition(); 3538 switch (argType) { 3539 case '': 3540 // Expecting a style string number, date, time, plural, selectordinal, or select. 3541 return this.error(error_1$1.ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition)); 3542 case 'number': 3543 case 'date': 3544 case 'time': { 3545 // Parse this range: 3546 // {name, number, style} 3547 // ^-------^ 3548 this.bumpSpace(); 3549 var styleAndLocation = null; 3550 if (this.bumpIf(',')) { 3551 this.bumpSpace(); 3552 var styleStartPosition = this.clonePosition(); 3553 var result = this.parseSimpleArgStyleIfPossible(); 3554 if (result.err) { 3555 return result; 3556 } 3557 var style = trimEnd(result.val); 3558 if (style.length === 0) { 3559 return this.error(error_1$1.ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition())); 3560 } 3561 var styleLocation = createLocation(styleStartPosition, this.clonePosition()); 3562 styleAndLocation = { style: style, styleLocation: styleLocation }; 3563 } 3564 var argCloseResult = this.tryParseArgumentClose(openingBracePosition); 3565 if (argCloseResult.err) { 3566 return argCloseResult; 3567 } 3568 var location_1 = createLocation(openingBracePosition, this.clonePosition()); 3569 // Extract style or skeleton 3570 if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) { 3571 // Skeleton starts with `::`. 3572 var skeleton = trimStart(styleAndLocation.style.slice(2)); 3573 if (argType === 'number') { 3574 var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation); 3575 if (result.err) { 3576 return result; 3577 } 3578 return { 3579 val: { type: types_1.TYPE.number, value: value, location: location_1, style: result.val }, 3580 err: null, 3581 }; 3582 } 3583 else { 3584 if (skeleton.length === 0) { 3585 return this.error(error_1$1.ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1); 3586 } 3587 var dateTimePattern = skeleton; 3588 // Get "best match" pattern only if locale is passed, if not, let it 3589 // pass as-is where `parseDateTimeSkeleton()` will throw an error 3590 // for unsupported patterns. 3591 if (this.locale) { 3592 dateTimePattern = (0, date_time_pattern_generator_1.getBestPattern)(skeleton, this.locale); 3593 } 3594 var style = { 3595 type: types_1.SKELETON_TYPE.dateTime, 3596 pattern: dateTimePattern, 3597 location: styleAndLocation.styleLocation, 3598 parsedOptions: this.shouldParseSkeletons 3599 ? (0, icu_skeleton_parser_1.parseDateTimeSkeleton)(dateTimePattern) 3600 : {}, 3601 }; 3602 var type = argType === 'date' ? types_1.TYPE.date : types_1.TYPE.time; 3603 return { 3604 val: { type: type, value: value, location: location_1, style: style }, 3605 err: null, 3606 }; 3607 } 3608 } 3609 // Regular style or no style. 3610 return { 3611 val: { 3612 type: argType === 'number' 3613 ? types_1.TYPE.number 3614 : argType === 'date' 3615 ? types_1.TYPE.date 3616 : types_1.TYPE.time, 3617 value: value, 3618 location: location_1, 3619 style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null, 3620 }, 3621 err: null, 3622 }; 3623 } 3624 case 'plural': 3625 case 'selectordinal': 3626 case 'select': { 3627 // Parse this range: 3628 // {name, plural, options} 3629 // ^---------^ 3630 var typeEndPosition_1 = this.clonePosition(); 3631 this.bumpSpace(); 3632 if (!this.bumpIf(',')) { 3633 return this.error(error_1$1.ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, tslib_1$2.__assign({}, typeEndPosition_1))); 3634 } 3635 this.bumpSpace(); 3636 // Parse offset: 3637 // {name, plural, offset:1, options} 3638 // ^-----^ 3639 // 3640 // or the first option: 3641 // 3642 // {name, plural, one {...} other {...}} 3643 // ^--^ 3644 var identifierAndLocation = this.parseIdentifierIfPossible(); 3645 var pluralOffset = 0; 3646 if (argType !== 'select' && identifierAndLocation.value === 'offset') { 3647 if (!this.bumpIf(':')) { 3648 return this.error(error_1$1.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition())); 3649 } 3650 this.bumpSpace(); 3651 var result = this.tryParseDecimalInteger(error_1$1.ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, error_1$1.ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE); 3652 if (result.err) { 3653 return result; 3654 } 3655 // Parse another identifier for option parsing 3656 this.bumpSpace(); 3657 identifierAndLocation = this.parseIdentifierIfPossible(); 3658 pluralOffset = result.val; 3659 } 3660 var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation); 3661 if (optionsResult.err) { 3662 return optionsResult; 3663 } 3664 var argCloseResult = this.tryParseArgumentClose(openingBracePosition); 3665 if (argCloseResult.err) { 3666 return argCloseResult; 3667 } 3668 var location_2 = createLocation(openingBracePosition, this.clonePosition()); 3669 if (argType === 'select') { 3670 return { 3671 val: { 3672 type: types_1.TYPE.select, 3673 value: value, 3674 options: fromEntries(optionsResult.val), 3675 location: location_2, 3676 }, 3677 err: null, 3678 }; 3679 } 3680 else { 3681 return { 3682 val: { 3683 type: types_1.TYPE.plural, 3684 value: value, 3685 options: fromEntries(optionsResult.val), 3686 offset: pluralOffset, 3687 pluralType: argType === 'plural' ? 'cardinal' : 'ordinal', 3688 location: location_2, 3689 }, 3690 err: null, 3691 }; 3692 } 3693 } 3694 default: 3695 return this.error(error_1$1.ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition)); 3696 } 3697 }; 3698 Parser.prototype.tryParseArgumentClose = function (openingBracePosition) { 3699 // Parse: {value, number, ::currency/GBP } 3700 // 3701 if (this.isEOF() || this.char() !== 125 /* `}` */) { 3702 return this.error(error_1$1.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition())); 3703 } 3704 this.bump(); // `}` 3705 return { val: true, err: null }; 3706 }; 3707 /** 3708 * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659 3709 */ 3710 Parser.prototype.parseSimpleArgStyleIfPossible = function () { 3711 var nestedBraces = 0; 3712 var startPosition = this.clonePosition(); 3713 while (!this.isEOF()) { 3714 var ch = this.char(); 3715 switch (ch) { 3716 case 39 /* `'` */: { 3717 // Treat apostrophe as quoting but include it in the style part. 3718 // Find the end of the quoted literal text. 3719 this.bump(); 3720 var apostrophePosition = this.clonePosition(); 3721 if (!this.bumpUntil("'")) { 3722 return this.error(error_1$1.ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition())); 3723 } 3724 this.bump(); 3725 break; 3726 } 3727 case 123 /* `{` */: { 3728 nestedBraces += 1; 3729 this.bump(); 3730 break; 3731 } 3732 case 125 /* `}` */: { 3733 if (nestedBraces > 0) { 3734 nestedBraces -= 1; 3735 } 3736 else { 3737 return { 3738 val: this.message.slice(startPosition.offset, this.offset()), 3739 err: null, 3740 }; 3741 } 3742 break; 3743 } 3744 default: 3745 this.bump(); 3746 break; 3747 } 3748 } 3749 return { 3750 val: this.message.slice(startPosition.offset, this.offset()), 3751 err: null, 3752 }; 3753 }; 3754 Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) { 3755 var tokens = []; 3756 try { 3757 tokens = (0, icu_skeleton_parser_1.parseNumberSkeletonFromString)(skeleton); 3758 } 3759 catch (e) {
3760 return this.error(error_1$1.ErrorKind.INVALID_NUMBER_SKELETON, location); 3761 } 3762 return { 3763 val: { 3764 type: types_1.SKELETON_TYPE.number, 3765 tokens: tokens, 3766 location: location, 3767 parsedOptions: this.shouldParseSkeletons 3768 ? (0, icu_skeleton_parser_1.parseNumberSkeleton)(tokens) 3769 : {}, 3770 }, 3771 err: null, 3772 }; 3773 }; 3774 /** 3775 * @param nesting_level The current nesting level of messages. 3776 * This can be positive when parsing message fragment in select or plural argument options. 3777 * @param parent_arg_type The parent argument's type. 3778 * @param parsed_first_identifier If provided, this is the first identifier-like selector of 3779 * the argument. It is a by-product of a previous parsing attempt. 3780 * @param expecting_close_tag If true, this message is directly or indirectly nested inside 3781 * between a pair of opening and closing tags. The nested message will not parse beyond 3782 * the closing tag boundary. 3783 */ 3784 Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) { 3785 var _a; 3786 var hasOtherClause = false; 3787 var options = []; 3788 var parsedSelectors = new Set(); 3789 var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location; 3790 // Parse: 3791 // one {one apple} 3792 // ^--^ 3793 while (true) { 3794 if (selector.length === 0) { 3795 var startPosition = this.clonePosition(); 3796 if (parentArgType !== 'select' && this.bumpIf('=')) { 3797 // Try parse `={number}` selector 3798 var result = this.tryParseDecimalInteger(error_1$1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, error_1$1.ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR); 3799 if (result.err) { 3800 return result; 3801 } 3802 selectorLocation = createLocation(startPosition, this.clonePosition()); 3803 selector = this.message.slice(startPosition.offset, this.offset()); 3804 } 3805 else { 3806 break; 3807 } 3808 } 3809 // Duplicate selector clauses 3810 if (parsedSelectors.has(selector)) { 3811 return this.error(parentArgType === 'select' 3812 ? error_1$1.ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR 3813 : error_1$1.ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation); 3814 } 3815 if (selector === 'other') { 3816 hasOtherClause = true; 3817 } 3818 // Parse: 3819 // one {one apple} 3820 // ^----------^ 3821 this.bumpSpace(); 3822 var openingBracePosition = this.clonePosition(); 3823 if (!this.bumpIf('{')) { 3824 return this.error(parentArgType === 'select' 3825 ? error_1$1.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT 3826 : error_1$1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition())); 3827 } 3828 var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag); 3829 if (fragmentResult.err) { 3830 return fragmentResult; 3831 } 3832 var argCloseResult = this.tryParseArgumentClose(openingBracePosition); 3833 if (argCloseResult.err) { 3834 return argCloseResult; 3835 } 3836 options.push([ 3837 selector, 3838 { 3839 value: fragmentResult.val, 3840 location: createLocation(openingBracePosition, this.clonePosition()), 3841 }, 3842 ]); 3843 // Keep track of the existing selectors 3844 parsedSelectors.add(selector); 3845 // Prep next selector clause. 3846 this.bumpSpace(); 3847 (_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location); 3848 } 3849 if (options.length === 0) { 3850 return this.error(parentArgType === 'select' 3851 ? error_1$1.ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR 3852 : error_1$1.ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition())); 3853 } 3854 if (this.requiresOtherClause && !hasOtherClause) { 3855 return this.error(error_1$1.
vendor: 5,705 bytes, lines 3855-4019
3855ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition())); 3856 } 3857 return { val: options, err: null }; 3858 }; 3859 Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) { 3860 var sign = 1; 3861 var startingPosition = this.clonePosition(); 3862 if (this.bumpIf('+')) ; 3863 else if (this.bumpIf('-')) { 3864 sign = -1; 3865 } 3866 var hasDigits = false; 3867 var decimal = 0; 3868 while (!this.isEOF()) { 3869 var ch = this.char(); 3870 if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) { 3871 hasDigits = true; 3872 decimal = decimal * 10 + (ch - 48); 3873 this.bump(); 3874 } 3875 else { 3876 break; 3877 } 3878 } 3879 var location = createLocation(startingPosition, this.clonePosition()); 3880 if (!hasDigits) { 3881 return this.error(expectNumberError, location); 3882 } 3883 decimal *= sign; 3884 if (!isSafeInteger(decimal)) { 3885 return this.error(invalidNumberError, location); 3886 } 3887 return { val: decimal, err: null }; 3888 }; 3889 Parser.prototype.offset = function () { 3890 return this.position.offset; 3891 }; 3892 Parser.prototype.isEOF = function () { 3893 return this.offset() === this.message.length; 3894 }; 3895 Parser.prototype.clonePosition = function () { 3896 // This is much faster than `Object.assign` or spread. 3897 return { 3898 offset: this.position.offset, 3899 line: this.position.line, 3900 column: this.position.column, 3901 }; 3902 }; 3903 /** 3904 * Return the code point at the current position of the parser. 3905 * Throws if the index is out of bound. 3906 */ 3907 Parser.prototype.char = function () { 3908 var offset = this.position.offset; 3909 if (offset >= this.message.length) { 3910 throw Error('out of bound'); 3911 } 3912 var code = codePointAt(this.message, offset); 3913 if (code === undefined) { 3914 throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary")); 3915 } 3916 return code; 3917 }; 3918 Parser.prototype.error = function (kind, location) { 3919 return { 3920 val: null, 3921 err: { 3922 kind: kind, 3923 message: this.message, 3924 location: location, 3925 }, 3926 }; 3927 }; 3928 /** Bump the parser to the next UTF-16 code unit. */ 3929 Parser.prototype.bump = function () { 3930 if (this.isEOF()) { 3931 return; 3932 } 3933 var code = this.char(); 3934 if (code === 10 /* '\n' */) { 3935 this.position.line += 1; 3936 this.position.column = 1; 3937 this.position.offset += 1; 3938 } 3939 else { 3940 this.position.column += 1; 3941 // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair. 3942 this.position.offset += code < 0x10000 ? 1 : 2; 3943 } 3944 }; 3945 /** 3946 * If the substring starting at the current position of the parser has 3947 * the given prefix, then bump the parser to the character immediately 3948 * following the prefix and return true. Otherwise, don't bump the parser 3949 * and return false. 3950 */ 3951 Parser.prototype.bumpIf = function (prefix) { 3952 if (startsWith(this.message, prefix, this.offset())) { 3953 for (var i = 0; i < prefix.length; i++) { 3954 this.bump(); 3955 } 3956 return true; 3957 } 3958 return false; 3959 }; 3960 /** 3961 * Bump the parser until the pattern character is found and return `true`. 3962 * Otherwise bump to the end of the file and return `false`. 3963 */ 3964 Parser.prototype.bumpUntil = function (pattern) { 3965 var currentOffset = this.offset(); 3966 var index = this.message.indexOf(pattern, currentOffset); 3967 if (index >= 0) { 3968 this.bumpTo(index); 3969 return true; 3970 } 3971 else { 3972 this.bumpTo(this.message.length); 3973 return false; 3974 } 3975 }; 3976 /** 3977 * Bump the parser to the target offset. 3978 * If target offset is beyond the end of the input, bump the parser to the end of the input. 3979 */ 3980 Parser.prototype.bumpTo = function (targetOffset) { 3981 if (this.offset() > targetOffset) { 3982 throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset())); 3983 } 3984 targetOffset = Math.min(targetOffset, this.message.length); 3985 while (true) { 3986 var offset = this.offset(); 3987 if (offset === targetOffset) { 3988 break; 3989 } 3990 if (offset > targetOffset) { 3991 throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary")); 3992 } 3993 this.bump(); 3994 if (this.isEOF()) { 3995 break; 3996 } 3997 } 3998 }; 3999 /** advance the parser through all whitespace to the next non-whitespace code unit. */ 4000 Parser.prototype.bumpSpace = function () { 4001 while (!this.isEOF() && _isWhiteSpace(this.char())) { 4002 this.bump(); 4003 } 4004 }; 4005 /** 4006 * Peek at the *next* Unicode codepoint in the input without advancing the parser. 4007 * If the input has been exhausted, then this returns null. 4008 */ 4009 Parser.prototype.peek = function () { 4010 if (this.isEOF()) { 4011 return null; 4012 } 4013 var code = this.char(); 4014 var offset = this.offset(); 4015 var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1)); 4016 return nextCode !== null && nextCode !== void 0 ? nextCode : null; 4017 }; 4018 return Parser; 4019}());
vendor: 2,669 bytes, lines 4020-4109
4020parser.Parser = Parser; 4021/** 4022 * This check if codepoint is alphabet (lower & uppercase) 4023 * @param codepoint 4024 * @returns 4025 */ 4026function _isAlpha(codepoint) { 4027 return ((codepoint >= 97 && codepoint <= 122) || 4028 (codepoint >= 65 && codepoint <= 90)); 4029} 4030function _isAlphaOrSlash(codepoint) { 4031 return _isAlpha(codepoint) || codepoint === 47; /* '/' */ 4032} 4033/** See `parseTag` function docs. */ 4034function _isPotentialElementNameChar(c) { 4035 return (c === 45 /* '-' */ || 4036 c === 46 /* '.' */ || 4037 (c >= 48 && c <= 57) /* 0..9 */ || 4038 c === 95 /* '_' */ || 4039 (c >= 97 && c <= 122) /** a..z */ || 4040 (c >= 65 && c <= 90) /* A..Z */ || 4041 c == 0xb7 || 4042 (c >= 0xc0 && c <= 0xd6) || 4043 (c >= 0xd8 && c <= 0xf6) || 4044 (c >= 0xf8 && c <= 0x37d) || 4045 (c >= 0x37f && c <= 0x1fff) || 4046 (c >= 0x200c && c <= 0x200d) || 4047 (c >= 0x203f && c <= 0x2040) || 4048 (c >= 0x2070 && c <= 0x218f) || 4049 (c >= 0x2c00 && c <= 0x2fef) || 4050 (c >= 0x3001 && c <= 0xd7ff) || 4051 (c >= 0xf900 && c <= 0xfdcf) || 4052 (c >= 0xfdf0 && c <= 0xfffd) || 4053 (c >= 0x10000 && c <= 0xeffff)); 4054} 4055/** 4056 * Code point equivalent of regex `\p{White_Space}`. 4057 * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt 4058 */ 4059function _isWhiteSpace(c) { 4060 return ((c >= 0x0009 && c <= 0x000d) || 4061 c === 0x0020 || 4062 c === 0x0085 || 4063 (c >= 0x200e && c <= 0x200f) || 4064 c === 0x2028 || 4065 c === 0x2029); 4066} 4067/** 4068 * Code point equivalent of regex `\p{Pattern_Syntax}`. 4069 * See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt 4070 */ 4071function _isPatternSyntax(c) { 4072 return ((c >= 0x0021 && c <= 0x0023) || 4073 c === 0x0024 || 4074 (c >= 0x0025 && c <= 0x0027) || 4075 c === 0x0028 || 4076 c === 0x0029 || 4077 c === 0x002a || 4078 c === 0x002b || 4079 c === 0x002c || 4080 c === 0x002d || 4081 (c >= 0x002e && c <= 0x002f) || 4082 (c >= 0x003a && c <= 0x003b) || 4083 (c >= 0x003c && c <= 0x003e) || 4084 (c >= 0x003f && c <= 0x0040) || 4085 c === 0x005b || 4086 c === 0x005c || 4087 c === 0x005d || 4088 c === 0x005e || 4089 c === 0x0060 || 4090 c === 0x007b || 4091 c === 0x007c || 4092 c === 0x007d || 4093 c === 0x007e || 4094 c === 0x00a1 || 4095 (c >= 0x00a2 && c <= 0x00a5) || 4096 c === 0x00a6 || 4097 c === 0x00a7 || 4098 c === 0x00a9 || 4099 c === 0x00ab || 4100 c === 0x00ac || 4101 c === 0x00ae || 4102 c === 0x00b0 || 4103 c === 0x00b1 || 4104 c === 0x00b6 || 4105 c === 0x00bb || 4106 c === 0x00bf || 4107 c === 0x00d7 || 4108 c === 0x00f7 || 4109 (c >
4109= 0x2010 && c <= 0x2015) || 4110 (c >= 0x2016 && c <= 0x2017) || 4111 c === 0x2018 || 4112 c === 0x2019 || 4113 c === 0x201a || 4114 (c >= 0x201b && c <= 0x201c) || 4115 c === 0x201d || 4116 c === 0x201e || 4117 c === 0x201f || 4118 (c >= 0x2020 && c <= 0x2027) || 4119 (c >= 0x2030 && c <= 0x2038) || 4120 c === 0x2039 || 4121 c === 0x203a || 4122 (c >= 0x203b && c <= 0x203e) || 4123 (c >= 0x2041 && c <= 0x2043) || 4124 c === 0x2044 || 4125 c === 0x2045 || 4126 c === 0x2046 || 4127 (c >= 0x2047 && c <= 0x2051) || 4128 c === 0x2052 || 4129 c === 0x2053 || 4130 (c >= 0x2055 && c <= 0x205e) || 4131 (c >= 0x2190 && c <= 0x2194) || 4132 (c >= 0x2195 && c <= 0x2199) || 4133 (c >= 0x219a && c <= 0x219b) || 4134 (c >= 0x219c && c <= 0x219f) || 4135 c === 0x21a0 || 4136 (c >= 0x21a1 && c <= 0x21a2) || 4137 c === 0x21a3 || 4138 (c >= 0x21a4 && c <= 0x21a5) || 4139 c === 0x21a6 || 4140 (c >= 0x21a7 && c <= 0x21ad) || 4141 c === 0x21ae || 4142 (c >= 0x21af && c <= 0x21cd) || 4143 (c >= 0x21ce && c <= 0x21cf) || 4144 (c >= 0x21d0 && c <= 0x21d1) || 4145 c === 0x21d2 || 4146 c === 0x21d3 || 4147 c === 0x21d4 || 4148 (c >= 0x21d5 && c <= 0x21f3) || 4149 (c >= 0x21f4 && c <= 0x22ff) || 4150 (c >= 0x2300 && c <= 0x2307) || 4151 c === 0x2308 || 4152 c === 0x2309 || 4153 c === 0x230a || 4154 c === 0x230b || 4155 (c >= 0x230c && c <= 0x231f) || 4156 (c >= 0x2320 && c <= 0x2321) || 4157 (c >= 0x2322 && c <= 0x2328) || 4158 c === 0x2329 || 4159 c === 0x232a || 4160 (c >= 0x232b && c <= 0x237b) || 4161 c === 0x237c || 4162 (c >= 0x237d && c <= 0x239a) || 4163 (c >= 0x239b && c <= 0x23b3) || 4164 (c >= 0x23b4 && c <= 0x23db) || 4165 (c >= 0x23dc && c <= 0x23e1) || 4166 (c >= 0x23e2 && c <= 0x2426) || 4167 (c >= 0x2427 && c <= 0x243f) || 4168 (c >= 0x2440 && c <= 0x244a) || 4169 (c >= 0x244b && c <= 0x245f) || 4170 (c >= 0x2500 && c <= 0x25b6) || 4171 c === 0x25b7 || 4172 (c >= 0x25b8 && c <= 0x25c0) || 4173 c === 0x25c1 || 4174 (c >= 0x25c2 && c <= 0x25f7) || 4175 (c >= 0x25f8 && c <= 0x25ff) || 4176 (c >= 0x2600 && c <= 0x266e) || 4177 c === 0x266f || 4178 (c >= 0x2670 && c <= 0x2767) || 4179 c === 0x2768 || 4180 c === 0x2769 || 4181 c === 0x276a || 4182 c === 0x276b || 4183 c === 0x276c || 4184 c === 0x276d || 4185 c === 0x276e || 4186 c === 0x276f || 4187 c === 0x2770 || 4188 c === 0x2771 || 4189 c === 0x2772 || 4190 c === 0x2773 || 4191 c === 0x2774 || 4192 c === 0x2775 || 4193 (c >= 0x2794 && c <= 0x27bf) || 4194 (c >= 0x27c0 && c <= 0x27c4) || 4195 c === 0x27c5 || 4196 c === 0x27c6 || 4197 (c >= 0x27c7 && c <= 0x27e5) || 4198 c === 0x27e6 || 4199 c === 0x27e7 || 4200 c === 0x27e8 || 4201 c === 0x27e9 || 4202 c === 0x27ea || 4203 c === 0x27eb || 4204 c === 0x27ec || 4205 c === 0x27ed || 4206 c === 0x27ee || 4207 c === 0x27ef || 4208 (c >= 0x27f0 && c <= 0x27ff) || 4209 (c >= 0x2800 && c <= 0x28ff) || 4210 (c >= 0x2900 && c <= 0x2982) || 4211 c === 0x2983 || 4212 c === 0x2984 || 4213 c === 0x2985 || 4214 c === 0x2986 || 4215 c === 0x2987 || 4216 c === 0x2988 || 4217 c === 0x2989 || 4218 c === 0x298a || 4219 c === 0x298b || 4220 c === 0x298c || 4221 c === 0x298d || 4222 c === 0x298e || 4223 c === 0x298f || 4224 c === 0x2990 || 4225 c === 0x2991 || 4226 c === 0x2992 || 4227 c === 0x2993 || 4228 c === 0x2994 || 4229 c === 0x2995 || 4230 c === 0x2996 || 4231 c === 0x2997 || 4232 c === 0x2998 || 4233 (c >= 0x2999 && c <= 0x29d7) || 4234 c === 0x29d8 || 4235 c === 0x29d9 || 4236 c === 0x29da || 4237 c === 0x29db || 4238 (c >= 0x29dc && c <= 0x29fb) || 4239 c === 0x29fc || 4240 c === 0x29fd || 4241 (c >= 0x29fe && c <= 0x2aff) || 4242 (c >= 0x2b00 && c <= 0x2b2f) || 4243 (c >= 0x2b30 && c <= 0x2b44) || 4244 (c >= 0x2b45 && c <= 0x2b46) || 4245 (c >= 0x2b47 && c <= 0x2b4c) || 4246 (c >= 0x2b4d && c <= 0x2b73) || 4247 (c >= 0x2b74 && c <= 0x2b75) || 4248 (c >= 0x2b76 && c <= 0x2b95) || 4249 c === 0x2b96 || 4250 (c >= 0x2b97 && c <= 0x2bff) || 4251 (c >= 0x2e00 && c <= 0x2e01) || 4252 c === 0x2e02 || 4253 c === 0x2e03 || 4254 c === 0x2e04 || 4255 c === 0x2e05 || 4256 (c >= 0x2e06 && c <= 0x2e08) || 4257 c === 0x2e09 || 4258 c === 0x2e0a || 4259 c === 0x2e0b || 4260 c === 0x2e0c || 4261 c === 0x2e0d || 4262 (c >= 0x2e0e && c <= 0x2e16) || 4263 c === 0x2e17 || 4264 (c >= 0x2e18 && c <= 0x2e19) || 4265 c === 0x2e1a || 4266 c === 0x2e1b || 4267 c === 0x2e1c || 4268 c === 0x2e1d || 4269 (c >= 0x2e1e && c <= 0x2e1f) || 4270 c === 0x2e20 || 4271 c === 0x2e21 || 4272 c === 0x2e22 || 4273 c === 0x2e23 || 4274 c === 0x2e24 || 4275 c === 0x2e25 || 4276 c === 0x2e26 || 4277 c === 0x2e27 || 4278 c === 0x2e28 || 4279 c === 0x2e29 || 4280 (c >= 0x2e2a && c <= 0x2e2e) || 4281 c === 0x2e2f || 4282 (c >= 0x2e30 && c <= 0x2e39) || 4283 (c >= 0x2e3a && c <= 0x2e3b) || 4284 (c >= 0x2e3c && c <= 0x2e3f) || 4285 c === 0x2e40 || 4286 c === 0x2e41 || 4287 c === 0x2e42 || 4288 (c >= 0x2e43 && c <= 0x2e4f) || 4289 (c >= 0x2e50 && c <= 0x2e51) || 4290 c === 0x2e52 || 4291 (c >= 0x2e53 && c <= 0x2e7f) || 4292 (c >= 0x3001 && c <= 0x3003) || 4293 c === 0x3008 || 4294 c === 0x3009 || 4295 c === 0x300a || 4296 c === 0x300b || 4297 c === 0x300c || 4298 c === 0x300d || 4299 c === 0x300e || 4300 c === 0x300f || 4301 c === 0x3010 || 4302 c === 0x3011 || 4303 (c >= 0x3012 && c <= 0x3013) || 4304 c === 0x3014 || 4305 c === 0x3015 || 4306 c === 0x3016 || 4307 c === 0x3017 || 4308 c === 0x3018 || 4309 c === 0x3019 || 4310 c === 0x301a || 4311 c === 0x301b || 4312 c === 0x301c || 4313 c === 0x301d || 4314 (c >= 0x301e && c <= 0x301f) || 4315 c === 0x3020 || 4316 c === 0x3030 || 4317 c === 0xfd3e || 4318 c === 0xfd3f || 4319 (c >= 0xfe45 && c <= 0xfe46)); 4320} 4321 4322(function (exports) { 4323 Object.defineProperty(exports, "__esModule", { value: true }); 4324 exports._Parser = exports.parse = void 0; 4325 var tslib_1 = tslibExports; 4326 var error_1 = error$1; 4327 var parser_1 = parser; 4328 var types_1 = types; 4329 function pruneLocation(els) {
4330 els.forEach(function (el) { 4331 delete el.location; 4332 if ((0, types_1.isSelectElement)(el) || (0, types_1.isPluralElement)(el)) { 4333 for (var k in el.options) { 4334 delete el.options[k].location; 4335 pruneLocation(el.options[k].value); 4336 } 4337 } 4338 else if ((0, types_1.isNumberElement)(el) && (0, types_1.isNumberSkeleton)(el.style)) { 4339 delete el.style.location; 4340 } 4341 else if (((0, types_1.isDateElement)(el) || (0, types_1.isTimeElement)(el)) && 4342 (0, types_1.isDateTimeSkeleton)(el.style)) { 4343 delete el.style.location; 4344 } 4345 else if ((0, types_1.isTagElement)(el)) { 4346 pruneLocation(el.children); 4347 } 4348 }); 4349 } 4350 function parse(message, opts) { 4351 if (opts === void 0) { opts = {}; } 4352 opts = tslib_1.__assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts); 4353 var result = new parser_1.Parser(message, opts).parse(); 4354 if (result.err) { 4355 var error = SyntaxError(error_1.ErrorKind[result.err.kind]); 4356 // @ts-expect-error Assign to error object 4357 error.location = result.err.location; 4358 // @ts-expect-error Assign to error object 4359 error.originalMessage = result.err.message; 4360 throw error; 4361 } 4362 if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) { 4363 pruneLocation(result.val); 4364 } 4365 return result.val; 4366 } 4367 exports.parse = parse; 4368 tslib_1.__exportStar(types, exports); 4369 // only for testing 4370 exports._Parser = parser_1.Parser; 4371} (lib$2)); 4372 4373// 4374// Main 4375// 4376function memoize(fn, options) { 4377 var cache = options && options.cache ? options.cache : cacheDefault; 4378 var serializer = options && options.serializer ? options.serializer : serializerDefault; 4379 var strategy = options && options.strategy ? options.strategy : strategyDefault; 4380 return strategy(fn, { 4381 cache: cache, 4382 serializer: serializer, 4383 }); 4384} 4385// 4386// Strategy 4387// 4388function isPrimitive(value) { 4389 return (value == null || typeof value === 'number' || typeof value === 'boolean'); // || typeof value === "string" 'unsafe' primitive for our needs 4390} 4391function monadic(fn, cache, serializer, arg) { 4392 var cacheKey = isPrimitive(arg) ? arg : serializer(arg); 4393 var computedValue = cache.get(cacheKey); 4394 if (typeof computedValue === 'undefined') { 4395 computedValue = fn.call(this, arg); 4396 cache.set(cacheKey, computedValue); 4397 } 4398 return computedValue; 4399} 4400function variadic(fn, cache, serializer) { 4401 var args = Array.prototype.slice.call(arguments, 3); 4402 var cacheKey = serializer(args); 4403 var computedValue = cache.get(cacheKey); 4404 if (typeof computedValue === 'undefined') { 4405 computedValue = fn.apply(this, args); 4406 cache.set(cacheKey, computedValue); 4407 } 4408 return computedValue; 4409} 4410function assemble(fn, context, strategy, cache, serialize) { 4411 return strategy.bind(context, fn, cache, serialize); 4412} 4413function strategyDefault(fn, options) { 4414 var strategy = fn.length === 1 ? monadic : variadic; 4415 return assemble(fn, this, strategy, options.cache.create(), options.serializer); 4416} 4417function strategyVariadic(fn, options) { 4418 return assemble(fn, this, variadic, options.cache.create(), options.serializer); 4419} 4420function strategyMonadic(fn, options) { 4421 return assemble(fn, this, monadic, options.cache.create(), options.serializer); 4422} 4423// 4424// Serializer 4425// 4426var serializerDefault = function () { 4427 return JSON.stringify(arguments); 4428}; 4429// 4430// Cache 4431// 4432function ObjectWithoutPrototypeCache() { 4433 this.cache = Object.create(null); 4434} 4435ObjectWithoutPrototypeCache.prototype.get = function (key) { 4436 return this.cache[key]; 4437}; 4438ObjectWithoutPrototypeCache.prototype.set = function (key, value) { 4439 this.cache[key] = value; 4440}; 4441var cacheDefault = { 4442 create: function create() { 4443 // @ts-ignore 4444 return new ObjectWithoutPrototypeCache(); 4445 }, 4446}; 4447var strategies = { 4448 variadic: strategyVariadic, 4449 monadic: strategyMonadic, 4450}; 4451 4452const lib = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 4453 __proto__: null, 4454 memoize, 4455 strategies 4456}, Symbol.toStringTag, { value: 'Module' })); 4457 4458const require$$2 = /*@__PURE__*/getAugmentedNamespace(lib); 4459 4460var formatters = {}; 4461 4462var error = {}; 4463 4464Object.defineProperty(error, "__esModule", { value: true }); 4465error.MissingValueError = error.InvalidValueTypeError = error.InvalidValueError = error.FormatError = error.ErrorCode = void 0; 4466var tslib_1$1 = tslibExports; 4467var ErrorCode; 4468(function (ErrorCode) { 4469 // When we have a placeholder but no value to format 4470 ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
4471 // When value supplied is invalid 4472 ErrorCode["INVALID_VALUE"] = "INVALID_VALUE"; 4473 // When we need specific Intl API but it's not available 4474 ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API"; 4475})(ErrorCode || (error.ErrorCode = ErrorCode = {})); 4476var FormatError = /** @class */ (function (_super) { 4477 tslib_1$1.__extends(FormatError, _super); 4478 function FormatError(msg, code, originalMessage) { 4479 var _this = _super.call(this, msg) || this; 4480 _this.code = code; 4481 _this.originalMessage = originalMessage; 4482 return _this; 4483 } 4484 FormatError.prototype.toString = function () { 4485 return "[formatjs Error: ".concat(this.code, "] ").concat(this.message); 4486 }; 4487 return FormatError; 4488}(Error)); 4489error.FormatError = FormatError; 4490var InvalidValueError = /** @class */ (function (_super) { 4491 tslib_1$1.__extends(InvalidValueError, _super); 4492 function InvalidValueError(variableId, value, options, originalMessage) { 4493 return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this; 4494 } 4495 return InvalidValueError; 4496}(FormatError)); 4497error.InvalidValueError = InvalidValueError; 4498var InvalidValueTypeError = /** @class */ (function (_super) { 4499 tslib_1$1.__extends(InvalidValueTypeError, _super); 4500 function InvalidValueTypeError(value, type, originalMessage) { 4501 return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this; 4502 } 4503 return InvalidValueTypeError; 4504}(FormatError)); 4505error.InvalidValueTypeError = InvalidValueTypeError; 4506var MissingValueError = /** @class */ (function (_super) { 4507 tslib_1$1.__extends(MissingValueError, _super); 4508 function MissingValueError(variableId, originalMessage) { 4509 return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this; 4510 } 4511 return MissingValueError; 4512}(FormatError)); 4513error.MissingValueError = MissingValueError; 4514 4515Object.defineProperty(formatters, "__esModule", { value: true }); 4516formatters.formatToParts = formatters.isFormatXMLElementFn = formatters.PART_TYPE = void 0; 4517var icu_messageformat_parser_1$1 = lib$2; 4518var error_1 = error; 4519var PART_TYPE; 4520(function (PART_TYPE) { 4521 PART_TYPE[PART_TYPE["literal"] = 0] = "literal"; 4522 PART_TYPE[PART_TYPE["object"] = 1] = "object"; 4523})(PART_TYPE || (formatters.PART_TYPE = PART_TYPE = {})); 4524function mergeLiteral(parts) { 4525 if (parts.length < 2) { 4526 return parts; 4527 } 4528 return parts.reduce(function (all, part) { 4529 var lastPart = all[all.length - 1]; 4530 if (!lastPart || 4531 lastPart.type !== PART_TYPE.literal || 4532 part.type !== PART_TYPE.literal) { 4533 all.push(part); 4534 } 4535 else { 4536 lastPart.value += part.value; 4537 } 4538 return all; 4539 }, []); 4540} 4541function isFormatXMLElementFn(el) { 4542 return typeof el === 'function'; 4543} 4544formatters.isFormatXMLElementFn = isFormatXMLElementFn; 4545// TODO(skeleton): add skeleton support 4546function formatToParts(els, locales, formatters, formats, values, currentPluralValue, 4547// For debugging 4548originalMessage) { 4549 // Hot path for straight simple msg translations 4550 if (els.length === 1 && (0, icu_messageformat_parser_1$1.isLiteralElement)(els[0])) { 4551 return [ 4552 { 4553 type: PART_TYPE.literal, 4554 value: els[0].value, 4555 }, 4556 ]; 4557 } 4558 var result = []; 4559 for (var _i = 0, els_1 = els; _i < els_1.length; _i++) { 4560 var el = els_1[_i]; 4561 // Exit early for string parts. 4562 if ((0, icu_messageformat_parser_1$1.isLiteralElement)(el)) { 4563 result.push({ 4564 type: PART_TYPE.literal, 4565 value: el.value, 4566 }); 4567 continue; 4568 } 4569 // TODO: should this part be literal type? 4570 // Replace `#` in plural rules with the actual numeric value. 4571 if ((0, icu_messageformat_parser_1$1.isPoundElement)(el)) { 4572 if (typeof currentPluralValue === 'number') { 4573 result.push({ 4574 type: PART_TYPE.literal, 4575 value: formatters.getNumberFormat(locales).format(currentPluralValue), 4576 }); 4577 } 4578 continue; 4579 } 4580 var varName = el.value; 4581 // Enforce that all required values are provided by the caller. 4582 if (!(values && varName in values)) { 4583 throw new error_1.MissingValueError(varName, originalMessage); 4584 } 4585 var value = values[varName]; 4586 if ((0, icu_messageformat_parser_1$1.isArgumentElement)(el)) { 4587 if (!value || typeof value === 'string' || typeof value === 'number') { 4588 value = 4589 typeof value === 'string' || typeof value === 'number' 4590 ? String(value) 4591 : ''; 4592 } 4593 result.push({ 4594 type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object, 4595 value: value, 4596 }); 4597 continue; 4598 } 4599 // Recursively format plural and select parts' option â which can be a 4600 // nested pattern structure. The choosing of the option to use is 4601 // abstracted-by and delegated-to the part helper object. 4602 if ((0, icu_messageformat_parser_1$1.isDateElement)(el)) { 4603 var style = typeof el.style === 'string' 4604 ? formats.date[el.style] 4605 : (0, icu_messageformat_parser_1$1.isDateTimeSkeleton)(el.style) 4606 ? el.style.parsedOptions 4607 : undefined; 4608 result.push({ 4609 type: PART_TYPE.literal, 4610 value: formatters 4611 .getDateTimeFormat(locales, style) 4612 .format(value), 4613 }); 4614 continue; 4615 } 4616 if ((0, icu_messageformat_parser_1$1.isTimeElement)(el)) { 4617 var style = typeof el.style === 'string' 4618 ? formats.time[el.style] 4619 : (0, icu_messageformat_parser_1$1.isDateTimeSkeleton)(el.style) 4620 ? el.style.parsedOptions 4621 : formats.time.medium; 4622 result.push({ 4623 type: PART_TYPE.literal, 4624 value: formatters 4625 .getDateTimeFormat(locales, style) 4626 .format(value), 4627 }); 4628 continue; 4629 } 4630 if ((0, icu_messageformat_parser_1$1.isNumberElement)(el)) { 4631 var style = typeof el.style === 'string' 4632 ? formats.number[el.style] 4633 : (0, icu_messageformat_parser_1$1.isNumberSkeleton)(el.style) 4634 ? el.style.parsedOptions 4635 : undefined; 4636 if (style && style.scale) { 4637 value = 4638 value * 4639 (style.scale || 1); 4640 } 4641 result.push({ 4642 type: PART_TYPE.literal, 4643 value: formatters 4644 .getNumberFormat(locales, style) 4645 .format(value), 4646 }); 4647 continue; 4648 } 4649 if ((0, icu_messageformat_parser_1$1.isTagElement)(el)) { 4650 var children = el.children, value_1 = el.value;
4651 var formatFn = values[value_1]; 4652 if (!isFormatXMLElementFn(formatFn)) { 4653 throw new error_1.InvalidValueTypeError(value_1, 'function', originalMessage); 4654 } 4655 var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue); 4656 var chunks = formatFn(parts.map(function (p) { return p.value; })); 4657 if (!Array.isArray(chunks)) { 4658 chunks = [chunks]; 4659 } 4660 result.push.apply(result, chunks.map(function (c) { 4661 return { 4662 type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object, 4663 value: c, 4664 }; 4665 })); 4666 } 4667 if ((0, icu_messageformat_parser_1$1.isSelectElement)(el)) { 4668 var opt = el.options[value] || el.options.other; 4669 if (!opt) { 4670 throw new error_1.InvalidValueError(el.value, value, Object.keys(el.options), originalMessage); 4671 } 4672 result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values)); 4673 continue; 4674 } 4675 if ((0, icu_messageformat_parser_1$1.isPluralElement)(el)) { 4676 var opt = el.options["=".concat(value)]; 4677 if (!opt) { 4678 if (!Intl.PluralRules) { 4679 throw new error_1.FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", error_1.ErrorCode.MISSING_INTL_API, originalMessage); 4680 } 4681 var rule = formatters 4682 .getPluralRules(locales, { type: el.pluralType }) 4683 .select(value - (el.offset || 0)); 4684 opt = el.options[rule] || el.options.other; 4685 } 4686 if (!opt) { 4687 throw new error_1.InvalidValueError(el.value, value, Object.keys(el.options), originalMessage); 4688 } 4689 result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0))); 4690 continue; 4691 } 4692 } 4693 return mergeLiteral(result); 4694} 4695formatters.formatToParts = formatToParts; 4696 4697/* 4698Copyright (c) 2014, Yahoo! Inc. All rights reserved. 4699Copyrights licensed under the New BSD License. 4700See the accompanying LICENSE file for terms. 4701*/ 4702Object.defineProperty(core, "__esModule", { value: true }); 4703core.IntlMessageFormat = void 0; 4704var tslib_1 = tslibExports; 4705var icu_messageformat_parser_1 = lib$2; 4706var fast_memoize_1 = require$$2; 4707var formatters_1 = formatters; 4708// -- MessageFormat -------------------------------------------------------- 4709function mergeConfig(c1, c2) { 4710 if (!c2) { 4711 return c1; 4712 } 4713 return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) { 4714 all[k] = tslib_1.__assign(tslib_1.__assign({}, c1[k]), (c2[k] || {})); 4715 return all; 4716 }, {})); 4717} 4718function mergeConfigs(defaultConfig, configs) { 4719 if (!configs) { 4720 return defaultConfig; 4721 } 4722 return Object.keys(defaultConfig).reduce(function (all, k) { 4723 all[k] = mergeConfig(defaultConfig[k], configs[k]); 4724 return all; 4725 }, tslib_1.__assign({}, defaultConfig)); 4726} 4727function createFastMemoizeCache(store) { 4728 return { 4729 create: function () { 4730 return { 4731 get: function (key) { 4732 return store[key]; 4733 }, 4734 set: function (key, value) { 4735 store[key] = value; 4736 }, 4737 }; 4738 }, 4739 }; 4740} 4741function createDefaultFormatters(cache) { 4742 if (cache === void 0) { cache = { 4743 number: {}, 4744 dateTime: {}, 4745 pluralRules: {}, 4746 }; } 4747 return { 4748 getNumberFormat: (0, fast_memoize_1.memoize)(function () { 4749 var _a; 4750 var args = []; 4751 for (var _i = 0; _i < arguments.length; _i++) { 4752 args[_i] = arguments[_i]; 4753 } 4754 return new ((_a = Intl.NumberFormat).bind.apply(_a, tslib_1.__spreadArray([void 0], args, false)))(); 4755 }, { 4756 cache: createFastMemoizeCache(cache.number), 4757 strategy: fast_memoize_1.strategies.variadic, 4758 }), 4759 getDateTimeFormat: (0, fast_memoize_1.memoize)(function () { 4760 var _a; 4761 var args = []; 4762 for (var _i = 0; _i < arguments.length; _i++) { 4763 args[_i] = arguments[_i]; 4764 } 4765 return new ((_a = Intl.DateTimeFormat).bind.apply(_a, tslib_1.__spreadArray([void 0], args, false)))(); 4766 }, { 4767 cache: createFastMemoizeCache(cache.dateTime), 4768 strategy: fast_memoize_1.strategies.variadic, 4769 }), 4770 getPluralRules: (0, fast_memoize_1.memoize)(function () { 4771 var _a; 4772 var args = []; 4773 for (var _i = 0; _i < arguments.length; _i++) { 4774 args[_i] = arguments[_i]; 4775 } 4776 return new ((_a = Intl.PluralRules).bind.apply(_a, tslib_1.__spreadArray([void 0], args, false)))(); 4777 }, { 4778 cache: createFastMemoizeCache(cache.pluralRules), 4779 strategy: fast_memoize_1.strategies.variadic, 4780 }), 4781 }; 4782} 4783var IntlMessageFormat = /** @class */ (function () { 4784 function IntlMessageFormat(message, locales, overrideFormats, opts) { 4785 var _this = this; 4786 if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; } 4787 this.formatterCache = { 4788 number: {}, 4789 dateTime: {}, 4790 pluralRules: {}, 4791 }; 4792 this.format = function (values) { 4793 var parts = _this.formatToParts(values); 4794 // Hot path for straight simple msg translations 4795 if (parts.length === 1) { 4796 return parts[0].value; 4797 } 4798 var result = parts.reduce(function (all, part) { 4799 if (!all.length || 4800 part.type !== formatters_1.PART_TYPE.literal || 4801 typeof all[all.length - 1] !== 'string') { 4802 all.push(part.value); 4803 } 4804 else { 4805 all[all.length - 1] += part.value; 4806 } 4807 return all; 4808 }, []); 4809 if (result.length <= 1) { 4810 return result[0] || ''; 4811 } 4812 return result; 4813 }; 4814 this.formatToParts = function (values) { 4815 return (0, formatters_1.formatToParts)(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message); 4816 }; 4817 this.resolvedOptions = function () { 4818 var _a; 4819 return ({ 4820 locale: ((_a = _this.resolvedLocale) === null || _a === void 0 ? void 0 : _a.toString()) || 4821 Intl.NumberFormat.supportedLocalesOf(_this.locales)[0], 4822 }); 4823 }; 4824 this.getAst = function () { return _this.ast; }; 4825 // Defined first because it's used to build the format pattern. 4826 this.locales = locales; 4827 this.resolvedLocale = IntlMessageFormat.resolveLocale(locales); 4828 if (typeof message === 'string') { 4829 this.message = message; 4830 if (!IntlMessageFormat.__parse) { 4831 throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`'); 4832 } 4833 var _a = opts || {}; _a.formatters; var parseOpts = tslib_1.__rest(_a, ["formatters"]); 4834 // Parse string messages into an AST. 4835 this.ast = IntlMessageFormat.__parse(message, tslib_1.__assign(tslib_1.__assign({}, parseOpts), { locale: this.resolvedLocale })); 4836 } 4837 else { 4838 this.ast = message; 4839 } 4840 if (!Array.isArray(this.ast)) { 4841 throw new TypeError('A message must be provided as a String or AST.'); 4842 } 4843 // Creates a new object with the specified `formats` merged with the default 4844 // formats. 4845 this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats); 4846 this.formatters = 4847 (opts && opts.formatters) || createDefaultFormatters(this.formatterCache); 4848 } 4849 Object.defineProperty(IntlMessageFormat, "defaultLocale", { 4850 get: function () { 4851 if (!IntlMessageFormat.memoizedDefaultLocale) { 4852 IntlMessageFormat.memoizedDefaultLocale = 4853 new Intl.NumberFormat().resolvedOptions().locale; 4854 } 4855 return IntlMessageFormat.memoizedDefaultLocale; 4856 }, 4857 enumerable: false, 4858 configurable: true 4859 }); 4860 IntlMessageFormat.memoizedDefaultLocale = null; 4861 IntlMessageFormat.resolveLocale = function (locales) { 4862 if (typeof Intl.Locale === 'undefined') { 4863 return; 4864 } 4865 var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales); 4866 if (supportedLocales.length > 0) { 4867 return new Intl.Locale(supportedLocales[0]); 4868 } 4869 return new Intl.Locale(typeof locales === 'string' ? locales : locales[0]); 4870 }; 4871 IntlMessageFormat.__parse = icu_messageformat_parser_1.parse; 4872 // Default format options used as the prototype of the `formats` provided to the 4873 // constructor. These are used when constructing the internal Intl.NumberFormat 4874 // and Intl.DateTimeFormat instances. 4875 IntlMessageFormat.formats = { 4876 number: { 4877 integer: { 4878 maximumFractionDigits: 0, 4879 }, 4880 currency: { 4881 style: 'currency', 4882 }, 4883 percent: { 4884 style: 'percent', 4885 }, 4886 }, 4887 date: { 4888 short: { 4889 month: 'numeric', 4890 day: 'numeric', 4891 year: '2-digit', 4892 }, 4893 medium: { 4894 month: 'short', 4895 day: 'numeric', 4896 year: 'numeric', 4897 }, 4898 long: { 4899 month: 'long', 4900 day: 'numeric', 4901 year: 'numeric', 4902 }, 4903 full: { 4904 weekday: 'long', 4905 month: 'long', 4906 day: 'numeric', 4907 year: 'numeric', 4908 }, 4909 }, 4910 time: { 4911 short: { 4912 hour: 'numeric', 4913 minute: 'numeric', 4914 }, 4915 medium: { 4916 hour: 'numeric', 4917 minute: 'numeric', 4918 second: 'numeric', 4919 }, 4920 long: { 4921 hour: 'numeric', 4922 minute: 'numeric', 4923 second: 'numeric', 4924 timeZoneName: 'short', 4925 }, 4926 full: { 4927 hour: 'numeric', 4928 minute: 'numeric', 4929 second: 'numeric', 4930 timeZoneName: 'short', 4931 }, 4932 }, 4933 }; 4934 return IntlMessageFormat; 4935}()); 4936core.IntlMessageFormat = IntlMessageFormat; 4937 4938(function (exports) { 4939 /* 4940 Copyright (c) 2014, Yahoo! Inc. All rights reserved. 4941 Copyrights licensed under the New BSD License.
4942 See the accompanying LICENSE file for terms. 4943 */ 4944 Object.defineProperty(exports, "__esModule", { value: true }); 4945 var tslib_1 = tslibExports; 4946 var core_1 = core; 4947 tslib_1.__exportStar(formatters, exports); 4948 tslib_1.__exportStar(core, exports); 4949 tslib_1.__exportStar(error, exports); 4950 exports.default = core_1.IntlMessageFormat; 4951} (lib$3)); 4952 4953function delve(obj, fullKey) { 4954 if (fullKey == null) 4955 return void 0; 4956 if (fullKey in obj) { 4957 return obj[fullKey]; 4958 } 4959 const keys = fullKey.split("."); 4960 let result = obj; 4961 for (let p = 0; p < keys.length; p++) { 4962 if (typeof result === "object") { 4963 if (p > 0) { 4964 const partialKey = keys.slice(p, keys.length).join("."); 4965 if (partialKey in result) { 4966 result = result[partialKey]; 4967 break; 4968 } 4969 } 4970 result = result[keys[p]]; 4971 } else { 4972 result = void 0; 4973 } 4974 } 4975 return result; 4976} 4977 4978const lookupCache = {}; 4979const addToCache = (path, locale, message) => { 4980 if (!message) 4981 return message; 4982 if (!(locale in lookupCache)) 4983 lookupCache[locale] = {}; 4984 if (!(path in lookupCache[locale])) 4985 lookupCache[locale][path] = message; 4986 return message; 4987}; 4988const lookup = (path, refLocale) => { 4989 if (refLocale == null) 4990 return void 0; 4991 if (refLocale in lookupCache && path in lookupCache[refLocale]) { 4992 return lookupCache[refLocale][path]; 4993 } 4994 const locales = getPossibleLocales(refLocale); 4995 for (let i = 0; i < locales.length; i++) { 4996 const locale = locales[i]; 4997 const message = getMessageFromDictionary(locale, path); 4998 if (message) { 4999 return addToCache(path, refLocale, message); 5000 } 5001 } 5002 return void 0; 5003}; 5004 5005let dictionary; 5006const $dictionary = writable({}); 5007function getLocaleDictionary(locale) { 5008 return dictionary[locale] || null; 5009} 5010function hasLocaleDictionary(locale) { 5011 return locale in dictionary; 5012} 5013function getMessageFromDictionary(locale, id) { 5014 if (!hasLocaleDictionary(locale)) { 5015 return null; 5016 } 5017 const localeDictionary = getLocaleDictionary(locale); 5018 const match = delve(localeDictionary, id); 5019 return match; 5020} 5021function getClosestAvailableLocale(refLocale) { 5022 if (refLocale == null) 5023 return void 0; 5024 const relatedLocales = getPossibleLocales(refLocale); 5025 for (let i = 0; i < relatedLocales.length; i++) { 5026 const locale = relatedLocales[i]; 5027 if (hasLocaleDictionary(locale)) { 5028 return locale; 5029 } 5030 } 5031 return void 0; 5032} 5033function addMessages(locale, ...partials) { 5034 delete lookupCache[locale]; 5035 $dictionary.update((d) => { 5036 d[locale] = deepmerge$1.all([d[locale] || {}, ...partials]); 5037 return d; 5038 }); 5039} 5040derived( 5041 [$dictionary], 5042 ([dictionary2]) => Object.keys(dictionary2) 5043); 5044$dictionary.subscribe((newDictionary) => dictionary = newDictionary); 5045 5046const queue = {}; 5047function removeLoaderFromQueue(locale, loader) { 5048 queue[locale].delete(loader); 5049 if (queue[locale].size === 0) { 5050 delete queue[locale]; 5051 } 5052} 5053function getLocaleQueue(locale) { 5054 return queue[locale]; 5055} 5056function getLocalesQueues(locale) { 5057 return getPossibleLocales(locale).map((localeItem) => { 5058 const localeQueue = getLocaleQueue(localeItem); 5059 return [localeItem, localeQueue ? [...localeQueue] : []]; 5060 }).filter(([, localeQueue]) => localeQueue.length > 0); 5061} 5062function hasLocaleQueue(locale) { 5063 if (locale == null) 5064 return false; 5065 return getPossibleLocales(locale).some( 5066 (localeQueue) => { 5067 var _a; 5068 return (_a = getLocaleQueue(localeQueue)) == null ? void 0 : _a.size; 5069 } 5070 ); 5071} 5072function loadLocaleQueue(locale, localeQueue) { 5073 const allLoadersPromise = Promise.all( 5074 localeQueue.map((loader) => { 5075 removeLoaderFromQueue(locale, loader); 5076 return loader().then((partial) => partial.default || partial); 5077 }) 5078 ); 5079 return allLoadersPromise.then((partials) => addMessages(locale, ...partials)); 5080} 5081const activeFlushes = {}; 5082function flush(locale) { 5083 if (!hasLocaleQueue(locale)) { 5084 if (locale in activeFlushes) { 5085 return activeFlushes[locale]; 5086 } 5087 return Promise.resolve(); 5088 } 5089 const queues = getLocalesQueues(locale); 5090 activeFlushes[locale] = Promise.all( 5091 queues.map( 5092 ([localeName, localeQueue]) => loadLocaleQueue(localeName, localeQueue) 5093 ) 5094 ).then(() => { 5095 if (hasLocaleQueue(locale)) { 5096 return flush(locale); 5097 } 5098 delete activeFlushes[locale]; 5099 }); 5100 return activeFlushes[locale]; 5101} 5102 5103var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; 5104var __hasOwnProp$2 = Object.prototype.hasOwnProperty; 5105var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; 5106var __objRest$1 = (source, exclude) => { 5107 var target = {}; 5108 for (var prop in source) 5109 if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0) 5110 target[prop] = source[prop]; 5111 if (source != null && __getOwnPropSymbols$2) 5112 for (var prop of __getOwnPropSymbols$2(source)) { 5113 if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop)) 5114 target[prop] = source[prop]; 5115 } 5116 return target; 5117}; 5118const defaultFormats = { 5119 number: { 5120 scientific: { notation: "scientific" }, 5121 engineering: { notation: "engineering" }, 5122 compactLong: { notation: "compact", compactDisplay: "long" }, 5123 compactShort: { notation: "compact", compactDisplay: "short" } 5124 }, 5125 date: {
5126 short: { month: "numeric", day: "numeric", year: "2-digit" }, 5127 medium: { month: "short", day: "numeric", year: "numeric" }, 5128 long: { month: "long", day: "numeric", year: "numeric" }, 5129 full: { weekday: "long", month: "long", day: "numeric", year: "numeric" } 5130 }, 5131 time: { 5132 short: { hour: "numeric", minute: "numeric" }, 5133 medium: { hour: "numeric", minute: "numeric", second: "numeric" }, 5134 long: { 5135 hour: "numeric", 5136 minute: "numeric", 5137 second: "numeric", 5138 timeZoneName: "short" 5139 }, 5140 full: { 5141 hour: "numeric", 5142 minute: "numeric", 5143 second: "numeric", 5144 timeZoneName: "short" 5145 } 5146 } 5147}; 5148function defaultMissingKeyHandler({ locale, id }) { 5149 console.warn( 5150 `[svelte-i18n] The message "${id}" was not found in "${getPossibleLocales( 5151 locale 5152 ).join('", "')}".${hasLocaleQueue(getCurrentLocale()) ? ` 5153 5154Note: there are at least one loader still registered to this locale that wasn't executed.` : ""}` 5155 ); 5156} 5157const defaultOptions = { 5158 fallbackLocale: null, 5159 loadingDelay: 200, 5160 formats: defaultFormats, 5161 warnOnMissingMessages: true, 5162 handleMissingMessage: void 0, 5163 ignoreTag: true 5164}; 5165const options = defaultOptions; 5166function getOptions() { 5167 return options; 5168} 5169function init$4(opts) { 5170 const _a = opts, { formats } = _a, rest = __objRest$1(_a, ["formats"]); 5171 let initialLocale = opts.fallbackLocale; 5172 if (opts.initialLocale) { 5173 try { 5174 if (lib$3.IntlMessageFormat.resolveLocale(opts.initialLocale)) { 5175 initialLocale = opts.initialLocale; 5176 } 5177 } catch (e) { 5178 console.warn( 5179 `[svelte-i18n] The initial locale "${opts.initialLocale}" is not a valid locale.` 5180 ); 5181 } 5182 } 5183 if (rest.warnOnMissingMessages) { 5184 delete rest.warnOnMissingMessages; 5185 if (rest.handleMissingMessage == null) { 5186 rest.handleMissingMessage = defaultMissingKeyHandler; 5187 } else { 5188 console.warn( 5189 '[svelte-i18n] The "warnOnMissingMessages" option is deprecated. Please use the "handleMissingMessage" option instead.' 5190 ); 5191 } 5192 } 5193 Object.assign(options, rest, { initialLocale }); 5194 if (formats) { 5195 if ("number" in formats) { 5196 Object.assign(options.formats.number, formats.number); 5197 } 5198 if ("date" in formats) { 5199 Object.assign(options.formats.date, formats.date); 5200 } 5201 if ("time" in formats) { 5202 Object.assign(options.formats.time, formats.time); 5203 } 5204 } 5205 return $locale.set(initialLocale); 5206} 5207 5208const $isLoading = writable(false); 5209 5210var __defProp$1 = Object.defineProperty; 5211var __defProps = Object.defineProperties; 5212var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 5213var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; 5214var __hasOwnProp$1 = Object.prototype.hasOwnProperty; 5215var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; 5216var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 5217var __spreadValues$1 = (a, b) => { 5218 for (var prop in b || (b = {})) 5219 if (__hasOwnProp$1.call(b, prop)) 5220 __defNormalProp$1(a, prop, b[prop]); 5221 if (__getOwnPropSymbols$1) 5222 for (var prop of __getOwnPropSymbols$1(b)) { 5223 if (__propIsEnum$1.call(b, prop)) 5224 __defNormalProp$1(a, prop, b[prop]); 5225 } 5226 return a; 5227}; 5228var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); 5229let current; 5230const internalLocale = writable(null); 5231function getSubLocales(refLocale) { 5232 return refLocale.split("-").map((_, i, arr) => arr.slice(0, i + 1).join("-")).reverse(); 5233} 5234function getPossibleLocales(refLocale, fallbackLocale = getOptions().fallbackLocale) { 5235 const locales = getSubLocales(refLocale); 5236 if (fallbackLocale) { 5237 return [.../* @__PURE__ */ new Set([...locales, ...getSubLocales(fallbackLocale)])]; 5238 } 5239 return locales; 5240} 5241function getCurrentLocale() { 5242 return current != null ? current : void 0; 5243} 5244internalLocale.subscribe((newLocale) => { 5245 current = newLocale != null ? newLocale : void 0; 5246 if (typeof window !== "undefined" && newLocale != null) { 5247 document.documentElement.setAttribute("lang", newLocale); 5248 } 5249}); 5250const set = (newLocale) => { 5251 if (newLocale && getClosestAvailableLocale(newLocale) && hasLocaleQueue(newLocale)) { 5252 const { loadingDelay } = getOptions(); 5253 let loadingTimer; 5254 if (typeof window !== "undefined" && getCurrentLocale() != null && loadingDelay) { 5255 loadingTimer = window.setTimeout( 5256 () => $isLoading.set(true), 5257 loadingDelay 5258 ); 5259 } else { 5260 $isLoading.set(true); 5261 } 5262 return flush(newLocale).then(() => { 5263 internalLocale.set(newLocale); 5264 }).finally(() => { 5265 clearTimeout(loadingTimer); 5266 $isLoading.set(false); 5267 }); 5268 } 5269 return internalLocale.set(newLocale); 5270}; 5271const $locale = __spreadProps(__spreadValues$1({}, internalLocale), { 5272 set 5273}); 5274const getLocaleFromNavigator = () => { 5275 if (typeof window === "undefined") 5276 return null; 5277 return window.navigator.language || window.navigator.languages[0]; 5278}; 5279 5280const monadicMemoize = (fn) => { 5281 const cache = /* @__PURE__ */ Object.create(null); 5282 const memoizedFn = (arg) => { 5283 const cacheKey = JSON.stringify(arg); 5284 if (cacheKey in cache) { 5285 return cache[cacheKey]; 5286 } 5287 return cache[cacheKey] = fn(arg); 5288 }; 5289 return memoizedFn; 5290}; 5291 5292var __defProp = Object.defineProperty; 5293var __getOwnPropSymbols = Object.getOwnPropertySymbols; 5294var __hasOwnProp = Object.prototype.hasOwnProperty; 5295var __propIsEnum = Object.prototype.propertyIsEnumerable; 5296var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 5297var __spreadValues = (a, b) => { 5298 for (var prop in b || (b = {})) 5299 if (__hasOwnProp.call(b, prop)) 5300 __defNormalProp(a, prop, b[prop]); 5301 if (__getOwnPropSymbols) 5302 for (var prop of __getOwnPropSymbols(b)) { 5303 if (__propIsEnum.call(b, prop)) 5304 __defNormalProp(a, prop, b[prop]); 5305 } 5306 return a; 5307}; 5308var __objRest = (source, exclude) => { 5309 var target = {}; 5310 for (var prop in source) 5311 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 5312 target[prop] = source[prop]; 5313 if (source != null && __getOwnPropSymbols) 5314 for (var prop of __getOwnPropSymbols(source)) { 5315 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 5316 target[prop] = source[prop]; 5317 } 5318 return target; 5319}; 5320const getIntlFormatterOptions = (type, name) => { 5321 const { formats } = getOptions(); 5322 if (type in formats && name in formats[type]) { 5323 return formats[type][name]; 5324 } 5325 throw new Error(`[svelte-i18n] Unknown "${name}" ${type} format.`); 5326}; 5327const createNumberFormatter = monadicMemoize( 5328 (_a) => { 5329 var _b = _a, { locale, format } = _b, options = __objRest(_b, ["locale", "format"]); 5330 if (locale == null) { 5331 throw new Error('[svelte-i18n] A "locale" must be set to format numbers'); 5332 } 5333 if (format) { 5334 options = getIntlFormatterOptions("number", format); 5335 } 5336 return new Intl.NumberFormat(locale, options); 5337 } 5338); 5339const createDateFormatter = monadicMemoize( 5340 (_c) => { 5341 var _d = _c, { locale, format } = _d, options = __objRest(_d, ["locale", "format"]); 5342 if (locale == null) { 5343 throw new Error('[svelte-i18n] A "locale" must be set to format dates'); 5344 } 5345 if (format) { 5346 options = getIntlFormatterOptions("date", format); 5347 } else if (Object.keys(options).length === 0) { 5348 options = getIntlFormatterOptions("date", "short"); 5349 } 5350 return new Intl.DateTimeFormat(locale, options); 5351 } 5352); 5353const createTimeFormatter = monadicMemoize( 5354 (_e) => { 5355 var _f = _e, { locale, format } = _f, options = __objRest(_f, ["locale", "format"]); 5356 if (locale == null) { 5357 throw new Error( 5358 '[svelte-i18n] A "locale" must be set to format time values' 5359 ); 5360 } 5361 if (format) { 5362 options = getIntlFormatterOptions("time", format); 5363 } else if (Object.keys(options).length === 0) { 5364 options = getIntlFormatterOptions("time", "short"); 5365 } 5366 return new Intl.DateTimeFormat(locale, options); 5367 } 5368); 5369const getNumberFormatter = (_g = {}) => { 5370 var _h = _g, { 5371 locale = getCurrentLocale() 5372 } = _h, args = __objRest(_h, [ 5373 "locale" 5374 ]); 5375 return createNumberFormatter(__spreadValues({ locale }, args)); 5376}; 5377const getDateFormatter = (_i = {}) => { 5378 var _j = _i, { 5379 locale = getCurrentLocale() 5380 } = _j, args = __objRest(_j, [ 5381 "locale" 5382 ]); 5383 return createDateFormatter(__spreadValues({ locale }, args)); 5384}; 5385const getTimeFormatter = (_k = {}) => { 5386 var _l = _k, { 5387 locale = getCurrentLocale() 5388 } = _l, args = __objRest(_l, [ 5389 "locale" 5390 ]); 5391 return createTimeFormatter(__spreadValues({ locale }, args)); 5392}; 5393const getMessageFormatter = monadicMemoize( 5394 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 5395 (message, locale = getCurrentLocale()) => new lib$3.IntlMessageFormat(message, locale, getOptions().formats, { 5396 ignoreTag: getOptions().ignoreTag 5397 }) 5398); 5399 5400const formatMessage = (id, options = {}) => { 5401 var _a, _b, _c, _d; 5402 let messageObj = options; 5403 if (typeof id === "object") { 5404 messageObj = id; 5405 id = messageObj.id; 5406 } 5407 const { 5408 values, 5409 locale = getCurrentLocale(), 5410 default: defaultValue 5411 } = messageObj; 5412 if (locale == null) { 5413 throw new Error( 5414 "[svelte-i18n] Cannot format a message without first setting the initial locale." 5415 ); 5416 } 5417 let message = lookup(id, locale); 5418 if (!message) { 5419 message = (_d = (_c = (_b = (_a = getOptions()).handleMissingMessage) == null ? void 0 : _b.call(_a, { locale, id, defaultValue })) != null ? _c : defaultValue) != null ? _d : id; 5420 } else if (typeof message !== "string") { 5421 console.warn(
5422 `[svelte-i18n] Message with id "${id}" must be of type "string", found: "${typeof message}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.` 5423 ); 5424 return message; 5425 } 5426 if (!values) { 5427 return message; 5428 } 5429 let result = message; 5430 try { 5431 result = getMessageFormatter(message, locale).format(values); 5432 } catch (e) { 5433 if (e instanceof Error) { 5434 console.warn( 5435 `[svelte-i18n] Message "${id}" has syntax error:`, 5436 e.message 5437 ); 5438 } 5439 } 5440 return result; 5441}; 5442const formatTime = (t, options) => { 5443 return getTimeFormatter(options).format(t); 5444}; 5445const formatDate = (d, options) => { 5446 return getDateFormatter(options).format(d); 5447}; 5448const formatNumber = (n, options) => { 5449 return getNumberFormatter(options).format(n); 5450}; 5451const getJSON = (id, locale = getCurrentLocale()) => { 5452 return lookup(id, locale); 5453}; 5454const $format = derived([$locale, $dictionary], () => formatMessage); 5455derived([$locale], () => formatTime); 5456derived([$locale], () => formatDate); 5457derived([$locale], () => formatNumber); 5458derived([$locale, $dictionary], () => getJSON); 5459 5460const Embed_svelte_svelte_type_style_lang = ''; 5461 5462/* src/Embed.svelte generated by Svelte v4.2.2 */ 5463const { 5464 SvelteComponent: SvelteComponent$3, 5465 append: append$3, 5466 attr: attr$3, 5467 binding_callbacks: binding_callbacks$2, 5468 component_subscribe: component_subscribe$2, 5469 create_slot: create_slot$1, 5470 detach: detach$3, 5471 element: element$3, 5472 get_all_dirty_from_scope: get_all_dirty_from_scope$1, 5473 get_slot_changes: get_slot_changes$1, 5474 init: init$3, 5475 insert: insert$3, 5476 safe_not_equal: safe_not_equal$3, 5477 set_data: set_data$2, 5478 set_style: set_style$2, 5479 space: space_1$1, 5480 text: text$2, 5481 toggle_class: toggle_class$2, 5482 transition_in: transition_in$2, 5483 transition_out: transition_out$2, 5484 update_slot_base: update_slot_base$1 5485} = window.__gradio__svelte__internal; 5486function create_if_block$2(ctx) { 5487 let div; 5488 let span0; 5489 let a0; 5490 let t0; 5491 let a0_href_value; 5492 let t1; 5493 let span1; 5494 let t2_value = /*$_*/ ctx[8]("common.built_with") + ""; 5495 let t2; 5496 let t3; 5497 let a1; 5498 let t5; 5499 let t6; 5500 let span3; 5501 let t7_value = /*$_*/ ctx[8]("common.hosted_on") + ""; 5502 let t7; 5503 let t8; 5504 let a2; 5505 5506 return { 5507 c() { 5508 div = element$3("div"); 5509 span0 = element$3("span"); 5510 a0 = element$3("a"); 5511 t0 = text$2(/*space*/ ctx[4]); 5512 t1 = space_1$1(); 5513 span1 = element$3("span"); 5514 t2 = text$2(t2_value); 5515 t3 = space_1$1(); 5516 a1 = element$3("a"); 5517 a1.textContent = "Gradio"; 5518 t5 = text$2("."); 5519 t6 = space_1$1(); 5520 span3 = element$3("span"); 5521 t7 = text$2(t7_value); 5522 t8 = space_1$1(); 5523 a2 = element$3("a"); 5524 a2.innerHTML = `<span class="space-logo svelte-182fdeq"><img src="${space_logo}" alt="Hugging Face Space" class="svelte-182fdeq"/></span> Spaces`; 5525 attr$3(a0, "href", a0_href_value = "https://huggingface.co/spaces/" + /*space*/ ctx[4]); 5526 attr$3(a0, "class", "title svelte-182fdeq"); 5527 attr$3(span0, "class", "svelte-182fdeq"); 5528 attr$3(a1, "class", "gradio svelte-182fdeq"); 5529 attr$3(a1, "href", "https://gradio.app"); 5530 attr$3(span1, "class", "svelte-182fdeq"); 5531 attr$3(a2, "class", "hf svelte-182fdeq"); 5532 attr$3(a2, "href", "https://huggingface.co/spaces"); 5533 attr$3(span3, "class", "svelte-182fdeq"); 5534 attr$3(div, "class", "info svelte-182fdeq"); 5535 }, 5536 m(target, anchor) { 5537 insert$3(target, div, anchor); 5538 append$3(div, span0); 5539 append$3(span0, a0); 5540 append$3(a0, t0); 5541 append$3(div, t1); 5542 append$3(div, span1); 5543 append$3(span1, t2); 5544 append$3(span1, t3); 5545 append$3(span1, a1); 5546 append$3(span1, t5); 5547 append$3(div, t6); 5548 append$3(div, span3); 5549 append$3(span3, t7); 5550 append$3(span3, t8); 5551 append$3(span3, a2); 5552 }, 5553 p(ctx, dirty) { 5554 if (dirty & /*space*/ 16) set_data$2(t0, /*space*/ ctx[4]); 5555 5556 if (dirty & /*space*/ 16 && a0_href_value !== (a0_href_value = "https://huggingface.co/spaces/" + /*space*/ ctx[4])) { 5557 attr$3(a0, "href", a0_href_value); 5558 } 5559 5560 if (dirty & /*$_*/ 256 && t2_value !== (t2_value = /*$_*/ ctx[8]("common.built_with") + "")) set_data$2(t2, t2_value); 5561 if (dirty & /*$_*/ 256 && t7_value !== (t7_value = /*$_*/ ctx[8]("common.hosted_on") + "")) set_data$2(t7, t7_value); 5562 }, 5563 d(detaching) { 5564 if (detaching) { 5565 detach$3(div); 5566 } 5567 } 5568 }; 5569} 5570 5571function create_fragment$3(ctx) { 5572 let div1; 5573 let div0; 5574 let t; 5575 let div1_class_value; 5576 let current; 5577 const default_slot_template = /*#slots*/ ctx[10].default; 5578 const default_slot = create_slot$1(default_slot_template, ctx, /*$$scope*/ ctx[9], null); 5579 let if_block = /*display*/ ctx[5] && /*space*/ ctx[4] && /*info*/ ctx[6] && create_if_block$2(ctx); 5580 5581 return { 5582 c() { 5583 div1 = element$3("div"); 5584 div0 = element$3("div"); 5585 if (default_slot) default_slot.c(); 5586 t = space_1$1(); 5587 if (if_block) if_block.c(); 5588 attr$3(div0, "class", "main svelte-182fdeq"); 5589 attr$3(div1, "class", div1_class_value = "gradio-container gradio-container-" + /*version*/ ctx[1] + " svelte-182fdeq"); 5590 attr$3(div1, "data-iframe-height", "");
5591 toggle_class$2(div1, "app", !/*display*/ ctx[5] && !/*is_embed*/ ctx[3]); 5592 toggle_class$2(div1, "embed-container", /*display*/ ctx[5]); 5593 toggle_class$2(div1, "with-info", /*info*/ ctx[6]); 5594 5595 set_style$2(div1, "min-height", /*loaded*/ ctx[7] 5596 ? "initial" 5597 : /*initial_height*/ ctx[2]); 5598 5599 set_style$2(div1, "flex-grow", !/*display*/ ctx[5] ? "1" : "auto"); 5600 }, 5601 m(target, anchor) { 5602 insert$3(target, div1, anchor); 5603 append$3(div1, div0); 5604 5605 if (default_slot) { 5606 default_slot.m(div0, null); 5607 } 5608 5609 append$3(div1, t); 5610 if (if_block) if_block.m(div1, null); 5611 /*div1_binding*/ ctx[11](div1); 5612 current = true; 5613 }, 5614 p(ctx, [dirty]) { 5615 if (default_slot) { 5616 if (default_slot.p && (!current || dirty & /*$$scope*/ 512)) { 5617 update_slot_base$1( 5618 default_slot, 5619 default_slot_template, 5620 ctx, 5621 /*$$scope*/ ctx[9], 5622 !current 5623 ? get_all_dirty_from_scope$1(/*$$scope*/ ctx[9]) 5624 : get_slot_changes$1(default_slot_template, /*$$scope*/ ctx[9], dirty, null), 5625 null 5626 ); 5627 } 5628 } 5629 5630 if (/*display*/ ctx[5] && /*space*/ ctx[4] && /*info*/ ctx[6]) { 5631 if (if_block) { 5632 if_block.p(ctx, dirty); 5633 } else { 5634 if_block = create_if_block$2(ctx); 5635 if_block.c(); 5636 if_block.m(div1, null); 5637 } 5638 } else if (if_block) { 5639 if_block.d(1); 5640 if_block = null; 5641 } 5642 5643 if (!current || dirty & /*version*/ 2 && div1_class_value !== (div1_class_value = "gradio-container gradio-container-" + /*version*/ ctx[1] + " svelte-182fdeq")) { 5644 attr$3(div1, "class", div1_class_value); 5645 } 5646 5647 if (!current || dirty & /*version, display, is_embed*/ 42) { 5648 toggle_class$2(div1, "app", !/*display*/ ctx[5] && !/*is_embed*/ ctx[3]); 5649 } 5650 5651 if (!current || dirty & /*version, display*/ 34) { 5652 toggle_class$2(div1, "embed-container", /*display*/ ctx[5]); 5653 } 5654 5655 if (!current || dirty & /*version, info*/ 66) { 5656 toggle_class$2(div1, "with-info", /*info*/ ctx[6]); 5657 } 5658 5659 if (dirty & /*loaded, initial_height*/ 132) { 5660 set_style$2(div1, "min-height", /*loaded*/ ctx[7] 5661 ? "initial" 5662 : /*initial_height*/ ctx[2]); 5663 } 5664 5665 if (dirty & /*display*/ 32) { 5666 set_style$2(div1, "flex-grow", !/*display*/ ctx[5] ? "1" : "auto"); 5667 } 5668 }, 5669 i(local) { 5670 if (current) return; 5671 transition_in$2(default_slot, local); 5672 current = true; 5673 }, 5674 o(local) { 5675 transition_out$2(default_slot, local); 5676 current = false; 5677 }, 5678 d(detaching) { 5679 if (detaching) { 5680 detach$3(div1); 5681 } 5682 5683 if (default_slot) default_slot.d(detaching); 5684 if (if_block) if_block.d(); 5685 /*div1_binding*/ ctx[11](null); 5686 } 5687 }; 5688} 5689 5690function instance$3($$self, $$props, $$invalidate) { 5691 let $_; 5692 component_subscribe$2($$self, $format, $$value => $$invalidate(8, $_ = $$value)); 5693 let { $$slots: slots = {}, $$scope } = $$props; 5694 let { wrapper } = $$props; 5695 let { version } = $$props; 5696 let { initial_height } = $$props; 5697 let { is_embed } = $$props; 5698 let { space } = $$props; 5699 let { display } = $$props; 5700 let { info } = $$props; 5701 let { loaded } = $$props; 5702 5703 function div1_binding($$value) { 5704 binding_callbacks$2[$$value ? 'unshift' : 'push'](() => { 5705 wrapper = $$value; 5706 $$invalidate(0, wrapper); 5707 }); 5708 } 5709 5710 $$self.$$set = $$props => {
5711 if ('wrapper' in $$props) $$invalidate(0, wrapper = $$props.wrapper); 5712 if ('version' in $$props) $$invalidate(1, version = $$props.version); 5713 if ('initial_height' in $$props) $$invalidate(2, initial_height = $$props.initial_height); 5714 if ('is_embed' in $$props) $$invalidate(3, is_embed = $$props.is_embed); 5715 if ('space' in $$props) $$invalidate(4, space = $$props.space); 5716 if ('display' in $$props) $$invalidate(5, display = $$props.display); 5717 if ('info' in $$props) $$invalidate(6, info = $$props.info); 5718 if ('loaded' in $$props) $$invalidate(7, loaded = $$props.loaded); 5719 if ('$$scope' in $$props) $$invalidate(9, $$scope = $$props.$$scope); 5720 }; 5721 5722 return [ 5723 wrapper, 5724 version, 5725 initial_height, 5726 is_embed, 5727 space, 5728 display, 5729 info, 5730 loaded, 5731 $_, 5732 $$scope, 5733 slots, 5734 div1_binding 5735 ]; 5736} 5737 5738class Embed extends SvelteComponent$3 { 5739 constructor(options) { 5740 super(); 5741 5742 init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { 5743 wrapper: 0, 5744 version: 1, 5745 initial_height: 2, 5746 is_embed: 3, 5747 space: 4, 5748 display: 5, 5749 info: 6, 5750 loaded: 7 5751 }); 5752 } 5753} 5754 5755function pretty_si(num) { 5756 let units = ["", "k", "M", "G", "T", "P", "E", "Z"]; 5757 let i = 0; 5758 while (num > 1e3 && i < units.length - 1) { 5759 num /= 1e3; 5760 i++; 5761 } 5762 let unit = units[i]; 5763 return (Number.isInteger(num) ? num : num.toFixed(1)) + unit; 5764} 5765 5766/** 5767 * @param {any} obj 5768 * @returns {boolean} 5769 */ 5770function is_date(obj) { 5771 return Object.prototype.toString.call(obj) === '[object Date]'; 5772} 5773 5774/** 5775 * @template T 5776 * @param {import('./private.js').TickContext<T>} ctx 5777 * @param {T} last_value 5778 * @param {T} current_value 5779 * @param {T} target_value 5780 * @returns {T} 5781 */ 5782function tick_spring(ctx, last_value, current_value, target_value) { 5783 if (typeof current_value === 'number' || is_date(current_value)) { 5784 // @ts-ignore 5785 const delta = target_value - current_value; 5786 // @ts-ignore 5787 const velocity = (current_value - last_value) / (ctx.dt || 1 / 60); // guard div by 0 5788 const spring = ctx.opts.stiffness * delta; 5789 const damper = ctx.opts.damping * velocity; 5790 const acceleration = (spring - damper) * ctx.inv_mass; 5791 const d = (velocity + acceleration) * ctx.dt; 5792 if (Math.abs(d) < ctx.opts.precision && Math.abs(delta) < ctx.opts.precision) { 5793 return target_value; // settled 5794 } else { 5795 ctx.settled = false; // signal loop to keep ticking 5796 // @ts-ignore 5797 return is_date(current_value) ? new Date(current_value.getTime() + d) : current_value + d; 5798 } 5799 } else if (Array.isArray(current_value)) { 5800 // @ts-ignore 5801 return current_value.map((_, i) => 5802 tick_spring(ctx, last_value[i], current_value[i], target_value[i]) 5803 ); 5804 } else if (typeof current_value === 'object') { 5805 const next_value = {}; 5806 for (const k in current_value) { 5807 // @ts-ignore 5808 next_value[k] = tick_spring(ctx, last_value[k], current_value[k], target_value[k]); 5809 } 5810 // @ts-ignore 5811 return next_value; 5812 } else { 5813 throw new Error(`Cannot spring ${typeof current_value} values`); 5814 } 5815} 5816 5817/** 5818 * The spring function in Svelte creates a store whose value is animated, with a motion that simulates the behavior of a spring. This means when the value changes, instead of transitioning at a steady rate, it "bounces" like a spring would, depending on the physics parameters provided. This adds a level of realism to the transitions and can enhance the user experience. 5819 * 5820 * https://svelte.dev/docs/svelte-motion#spring 5821 * @template [T=any] 5822 * @param {T} [value] 5823 * @param {import('./private.js').SpringOpts} [opts] 5824 * @returns {import('./public.js').Spring<T>} 5825 */ 5826function spring(value, opts = {}) { 5827 const store = writable(value); 5828 const { stiffness = 0.15, damping = 0.8, precision = 0.01 } = opts; 5829 /** @type {number} */ 5830 let last_time; 5831 /** @type {import('../internal/private.js').Task} */ 5832 let task; 5833 /** @type {object} */ 5834 let current_token; 5835 /** @type {T} */ 5836 let last_value = value; 5837 /** @type {T} */ 5838 let target_value = value; 5839 let inv_mass = 1; 5840 let inv_mass_recovery_rate = 0; 5841 let cancel_task = false; 5842 /** 5843 * @param {T} new_value 5844 * @param {import('./private.js').SpringUpdateOpts} opts 5845 * @returns {Promise<void>} 5846 */ 5847 function set(new_value, opts = {}) { 5848 target_value = new_value; 5849 const token = (current_token = {}); 5850 if (value == null || opts.hard || (spring.stiffness >= 1 && spring.damping >= 1)) { 5851 cancel_task = true; // cancel any running animation 5852 last_time = now(); 5853 last_value = new_value; 5854 store.set((value = target_value)); 5855 return Promise.resolve(); 5856 } else if (opts.soft) { 5857 const rate = opts.soft === true ? 0.5 : +opts.soft; 5858 inv_mass_recovery_rate = 1 / (rate * 60); 5859 inv_mass = 0; // infinite mass, unaffected by spring forces 5860 } 5861 if (!task) { 5862 last_time = now(); 5863 cancel_task = false;
5864 task = loop((now) => { 5865 if (cancel_task) { 5866 cancel_task = false; 5867 task = null; 5868 return false; 5869 } 5870 inv_mass = Math.min(inv_mass + inv_mass_recovery_rate, 1); 5871 const ctx = { 5872 inv_mass, 5873 opts: spring, 5874 settled: true, 5875 dt: ((now - last_time) * 60) / 1000 5876 }; 5877 const next_value = tick_spring(ctx, last_value, value, target_value); 5878 last_time = now; 5879 last_value = value; 5880 store.set((value = next_value)); 5881 if (ctx.settled) { 5882 task = null; 5883 } 5884 return !ctx.settled; 5885 }); 5886 } 5887 return new Promise((fulfil) => { 5888 task.promise.then(() => { 5889 if (token === current_token) fulfil(); 5890 }); 5891 }); 5892 } 5893 /** @type {import('./public.js').Spring<T>} */ 5894 const spring = { 5895 set, 5896 update: (fn, opts) => set(fn(target_value, value), opts), 5897 subscribe: store.subscribe, 5898 stiffness, 5899 damping, 5900 precision 5901 }; 5902 return spring; 5903} 5904 5905const Loader_svelte_svelte_type_style_lang = ''; 5906 5907/* home/runner/work/gradio/gradio/js/statustracker/static/Loader.svelte generated by Svelte v4.2.2 */ 5908const { 5909 SvelteComponent: SvelteComponent$2, 5910 append: append$2, 5911 attr: attr$2, 5912 component_subscribe: component_subscribe$1, 5913 detach: detach$2, 5914 element: element$2, 5915 init: init$2, 5916 insert: insert$2, 5917 noop: noop$1, 5918 safe_not_equal: safe_not_equal$2, 5919 set_style: set_style$1, 5920 svg_element, 5921 toggle_class: toggle_class$1 5922} = window.__gradio__svelte__internal; 5923const { onMount: onMount$1 } = window.__gradio__svelte__internal; 5924function create_fragment$2(ctx) { 5925 let div; 5926 let svg; 5927 let g0; 5928 let path0; 5929 let path1; 5930 let path2; 5931 let path3; 5932 let g1; 5933 let path4; 5934 let path5; 5935 let path6; 5936 let path7; 5937 5938 return { 5939 c() { 5940 div = element$2("div"); 5941 svg = svg_element("svg"); 5942 g0 = svg_element("g"); 5943 path0 = svg_element("path"); 5944 path1 = svg_element("path"); 5945 path2 = svg_element("path"); 5946 path3 = svg_element("path"); 5947 g1 = svg_element("g"); 5948 path4 = svg_element("path"); 5949 path5 = svg_element("path"); 5950 path6 = svg_element("path"); 5951 path7 = svg_element("path"); 5952 attr$2(path0, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"); 5953 attr$2(path0, "fill", "#FF7C00"); 5954 attr$2(path0, "fill-opacity", "0.4"); 5955 attr$2(path0, "class", "svelte-zyxd38"); 5956 attr$2(path1, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"); 5957 attr$2(path1, "fill", "#FF7C00"); 5958 attr$2(path1, "class", "svelte-zyxd38"); 5959 attr$2(path2, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"); 5960 attr$2(path2, "fill", "#FF7C00"); 5961 attr$2(path2, "fill-opacity", "0.4"); 5962 attr$2(path2, "class", "svelte-zyxd38"); 5963 attr$2(path3, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"); 5964 attr$2(path3, "fill", "#FF7C00"); 5965 attr$2(path3, "class", "svelte-zyxd38"); 5966 set_style$1(g0, "transform", "translate(" + /*$top*/ ctx[1][0] + "px, " + /*$top*/ ctx[1][1] + "px)"); 5967 attr$2(path4, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"); 5968 attr$2(path4, "fill", "#FF7C00"); 5969 attr$2(path4, "fill-opacity", "0.4"); 5970 attr$2(path4, "class", "svelte-zyxd38"); 5971 attr$2(path5, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"); 5972 attr$2(path5, "fill", "#FF7C00"); 5973 attr$2(path5, "class", "svelte-zyxd38"); 5974 attr$2(path6, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"); 5975 attr$2(path6, "fill", "#FF7C00"); 5976 attr$2(path6, "fill-opacity", "0.4"); 5977 attr$2(path6, "class", "svelte-zyxd38"); 5978 attr$2(path7, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"); 5979 attr$2(path7, "fill", "#FF7C00"); 5980 attr$2(path7, "class", "svelte-zyxd38"); 5981 set_style$1(g1, "transform", "translate(" + /*$bottom*/ ctx[2][0] + "px, " + /*$bottom*/ ctx[2][1] + "px)"); 5982 attr$2(svg, "viewBox", "-1200 -1200 3000 3000"); 5983 attr$2(svg, "fill", "none"); 5984 attr$2(svg, "xmlns", "http://www.w3.org/2000/svg"); 5985 attr$2(svg, "class", "svelte-zyxd38"); 5986 attr$2(div, "class", "svelte-zyxd38"); 5987 toggle_class$1(div, "margin", /*margin*/ ctx[0]); 5988 }, 5989 m(target, anchor) { 5990 insert$2(target, div, anchor); 5991 append$2(div, svg); 5992 append$2(svg, g0); 5993 append$2(g0, path0); 5994 append$2(g0, path1); 5995 append$2(g0, path2); 5996 append$2(g0, path3); 5997 append$2(svg, g1); 5998 append$2(g1, path4); 5999 append$2(g1, path5); 6000 append$2(g1, path6); 6001 append$2(g1, path7); 6002 }, 6003 p(ctx, [dirty]) {
6004 if (dirty & /*$top*/ 2) { 6005 set_style$1(g0, "transform", "translate(" + /*$top*/ ctx[1][0] + "px, " + /*$top*/ ctx[1][1] + "px)"); 6006 } 6007 6008 if (dirty & /*$bottom*/ 4) { 6009 set_style$1(g1, "transform", "translate(" + /*$bottom*/ ctx[2][0] + "px, " + /*$bottom*/ ctx[2][1] + "px)"); 6010 } 6011 6012 if (dirty & /*margin*/ 1) { 6013 toggle_class$1(div, "margin", /*margin*/ ctx[0]); 6014 } 6015 }, 6016 i: noop$1, 6017 o: noop$1, 6018 d(detaching) { 6019 if (detaching) { 6020 detach$2(div); 6021 } 6022 } 6023 }; 6024} 6025 6026function instance$2($$self, $$props, $$invalidate) { 6027 let $top; 6028 let $bottom; 6029 let { margin = true } = $$props; 6030 const top = spring([0, 0]); 6031 component_subscribe$1($$self, top, value => $$invalidate(1, $top = value)); 6032 const bottom = spring([0, 0]); 6033 component_subscribe$1($$self, bottom, value => $$invalidate(2, $bottom = value)); 6034 let dismounted; 6035 6036 async function animate() { 6037 await Promise.all([top.set([125, 140]), bottom.set([-125, -140])]); 6038 await Promise.all([top.set([-125, 140]), bottom.set([125, -140])]); 6039 await Promise.all([top.set([-125, 0]), bottom.set([125, -0])]); 6040 await Promise.all([top.set([125, 0]), bottom.set([-125, 0])]); 6041 } 6042 6043 async function run() { 6044 await animate(); 6045 if (!dismounted) run(); 6046 } 6047 6048 async function loading() { 6049 await Promise.all([top.set([125, 0]), bottom.set([-125, 0])]); 6050 run(); 6051 } 6052 6053 onMount$1(() => { 6054 loading(); 6055 return () => dismounted = true; 6056 }); 6057 6058 $$self.$$set = $$props => {
6059 if ('margin' in $$props) $$invalidate(0, margin = $$props.margin); 6060 }; 6061 6062 return [margin, $top, $bottom, top, bottom]; 6063} 6064 6065class Loader extends SvelteComponent$2 { 6066 constructor(options) { 6067 super(); 6068 init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { margin: 0 }); 6069 } 6070} 6071 6072const index_svelte_svelte_type_style_lang = ''; 6073 6074/* home/runner/work/gradio/gradio/js/statustracker/static/index.svelte generated by Svelte v4.2.2 */ 6075const { 6076 SvelteComponent: SvelteComponent$1, 6077 append: append$1, 6078 attr: attr$1, 6079 binding_callbacks: binding_callbacks$1, 6080 check_outros: check_outros$1, 6081 create_component: create_component$1, 6082 create_slot, 6083 destroy_component: destroy_component$1, 6084 destroy_each, 6085 detach: detach$1, 6086 element: element$1, 6087 empty: empty$1, 6088 ensure_array_like, 6089 get_all_dirty_from_scope, 6090 get_slot_changes, 6091 group_outros: group_outros$1, 6092 init: init$1, 6093 insert: insert$1, 6094 mount_component: mount_component$1, 6095 noop, 6096 safe_not_equal: safe_not_equal$1, 6097 set_data: set_data$1, 6098 set_style, 6099 space, 6100 text: text$1, 6101 toggle_class, 6102 transition_in: transition_in$1, 6103 transition_out: transition_out$1, 6104 update_slot_base 6105} = window.__gradio__svelte__internal;const { tick } = window.__gradio__svelte__internal;const { onDestroy } = window.__gradio__svelte__internal;const get_error_slot_changes = dirty => ({}); 6106const get_error_slot_context = ctx => ({}); 6107 6108function get_each_context(ctx, list, i) { 6109 const child_ctx = ctx.slice(); 6110 child_ctx[38] = list[i]; 6111 child_ctx[40] = i; 6112 return child_ctx; 6113} 6114 6115function get_each_context_1(ctx, list, i) { 6116 const child_ctx = ctx.slice(); 6117 child_ctx[38] = list[i]; 6118 return child_ctx; 6119} 6120 6121// (249:30) 6122function create_if_block_17(ctx) { 6123 let span; 6124 let t0_value = /*i18n*/ ctx[1]("common.error") + ""; 6125 let t0; 6126 let t1; 6127 let current; 6128 const error_slot_template = /*#slots*/ ctx[29].error; 6129 const error_slot = create_slot(error_slot_template, ctx, /*$$scope*/ ctx[28], get_error_slot_context); 6130 6131 return { 6132 c() { 6133 span = element$1("span"); 6134 t0 = text$1(t0_value); 6135 t1 = space(); 6136 if (error_slot) error_slot.c(); 6137 attr$1(span, "class", "error svelte-12bm2fk"); 6138 }, 6139 m(target, anchor) { 6140 insert$1(target, span, anchor); 6141 append$1(span, t0); 6142 insert$1(target, t1, anchor); 6143 6144 if (error_slot) { 6145 error_slot.m(target, anchor); 6146 } 6147 6148 current = true; 6149 }, 6150 p(ctx, dirty) { 6151 if ((!current || dirty[0] & /*i18n*/ 2) && t0_value !== (t0_value = /*i18n*/ ctx[1]("common.error") + "")) set_data$1(t0, t0_value); 6152 6153 if (error_slot) { 6154 if (error_slot.p && (!current || dirty[0] & /*$$scope*/ 268435456)) { 6155 update_slot_base( 6156 error_slot, 6157 error_slot_template, 6158 ctx, 6159 /*$$scope*/ ctx[28], 6160 !current 6161 ? get_all_dirty_from_scope(/*$$scope*/ ctx[28]) 6162 : get_slot_changes(error_slot_template, /*$$scope*/ ctx[28], dirty, get_error_slot_changes), 6163 get_error_slot_context 6164 ); 6165 } 6166 } 6167 }, 6168 i(local) { 6169 if (current) return; 6170 transition_in$1(error_slot, local); 6171 current = true; 6172 }, 6173 o(local) { 6174 transition_out$1(error_slot, local); 6175 current = false; 6176 }, 6177 d(detaching) { 6178 if (detaching) { 6179 detach$1(span); 6180 detach$1(t1); 6181 } 6182 6183 if (error_slot) error_slot.d(detaching); 6184 } 6185 }; 6186} 6187 6188// (177:1) {#if status === "pending"} 6189function create_if_block$1(ctx) { 6190 let t0; 6191 let div; 6192 let t1; 6193 let t2; 6194 let current_block_type_index; 6195 let if_block3; 6196 let t3; 6197 let if_block4_anchor; 6198 let current; 6199 let if_block0 = /*variant*/ ctx[8] === "default" && /*show_eta_bar*/ ctx[18] && /*show_progress*/ ctx[6] === "full" && create_if_block_16(ctx); 6200 6201 function select_block_type_1(ctx, dirty) { 6202 if (/*progress*/ ctx[7]) return create_if_block_11; 6203 if (/*queue_position*/ ctx[2] !== null && /*queue_size*/ ctx[3] !== undefined && /*queue_position*/ ctx[2] >= 0) return create_if_block_14; 6204 if (/*queue_position*/ ctx[2] === 0) return create_if_block_15; 6205 } 6206 6207 let current_block_type = select_block_type_1(ctx); 6208 let if_block1 = current_block_type && current_block_type(ctx); 6209 let if_block2 = /*timer*/ ctx[5] && create_if_block_10(ctx); 6210 const if_block_creators = [create_if_block_2$1, create_if_block_9]; 6211 const if_blocks = []; 6212 6213 function select_block_type_3(ctx, dirty) { 6214 if (/*last_progress_level*/ ctx[15] != null) return 0; 6215 if (/*show_progress*/ ctx[6] === "full") return 1; 6216 return -1; 6217 } 6218 6219 if (~(current_block_type_index = select_block_type_3(ctx))) { 6220 if_block3 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 6221 } 6222 6223 let if_block4 = !/*timer*/ ctx[5] && create_if_block_1$1(ctx); 6224 6225 return { 6226 c() { 6227 if (if_block0) if_block0.c(); 6228 t0 = space(); 6229 div = element$1("div"); 6230 if (if_block1) if_block1.c(); 6231 t1 = space(); 6232 if (if_block2) if_block2.c(); 6233 t2 = space(); 6234 if (if_block3) if_block3.c(); 6235 t3 = space(); 6236 if (if_block4) if_block4.c(); 6237 if_block4_anchor = empty$1(); 6238 attr$1(div, "class", "progress-text svelte-12bm2fk"); 6239 toggle_class(div, "meta-text-center", /*variant*/ ctx[8] === "center"); 6240 toggle_class(div, "meta-text", /*variant*/ ctx[8] === "default"); 6241 }, 6242 m(target, anchor) { 6243 if (if_block0) if_block0.m(target, anchor); 6244 insert$1(target, t0, anchor); 6245 insert$1(target, div, anchor); 6246 if (if_block1) if_block1.m(div, null); 6247 append$1(div, t1); 6248 if (if_block2) if_block2.m(div, null); 6249 insert$1(target, t2, anchor); 6250 6251 if (~current_block_type_index) { 6252 if_blocks[current_block_type_index].m(target, anchor); 6253 } 6254
6255 insert$1(target, t3, anchor); 6256 if (if_block4) if_block4.m(target, anchor); 6257 insert$1(target, if_block4_anchor, anchor); 6258 current = true; 6259 }, 6260 p(ctx, dirty) { 6261 if (/*variant*/ ctx[8] === "default" && /*show_eta_bar*/ ctx[18] && /*show_progress*/ ctx[6] === "full") { 6262 if (if_block0) { 6263 if_block0.p(ctx, dirty); 6264 } else { 6265 if_block0 = create_if_block_16(ctx); 6266 if_block0.c(); 6267 if_block0.m(t0.parentNode, t0); 6268 } 6269 } else if (if_block0) { 6270 if_block0.d(1); 6271 if_block0 = null; 6272 } 6273 6274 if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block1) { 6275 if_block1.p(ctx, dirty); 6276 } else { 6277 if (if_block1) if_block1.d(1); 6278 if_block1 = current_block_type && current_block_type(ctx); 6279 6280 if (if_block1) { 6281 if_block1.c(); 6282 if_block1.m(div, t1); 6283 } 6284 } 6285 6286 if (/*timer*/ ctx[5]) { 6287 if (if_block2) { 6288 if_block2.p(ctx, dirty); 6289 } else { 6290 if_block2 = create_if_block_10(ctx); 6291 if_block2.c(); 6292 if_block2.m(div, null); 6293 } 6294 } else if (if_block2) { 6295 if_block2.d(1); 6296 if_block2 = null; 6297 } 6298 6299 if (!current || dirty[0] & /*variant*/ 256) { 6300 toggle_class(div, "meta-text-center", /*variant*/ ctx[8] === "center"); 6301 } 6302 6303 if (!current || dirty[0] & /*variant*/ 256) { 6304 toggle_class(div, "meta-text", /*variant*/ ctx[8] === "default"); 6305 } 6306 6307 let previous_block_index = current_block_type_index; 6308 current_block_type_index = select_block_type_3(ctx); 6309 6310 if (current_block_type_index === previous_block_index) { 6311 if (~current_block_type_index) { 6312 if_blocks[current_block_type_index].p(ctx, dirty); 6313 } 6314 } else { 6315 if (if_block3) { 6316 group_outros$1(); 6317 6318 transition_out$1(if_blocks[previous_block_index], 1, 1, () => { 6319 if_blocks[previous_block_index] = null; 6320 }); 6321 6322 check_outros$1(); 6323 } 6324 6325 if (~current_block_type_index) { 6326 if_block3 = if_blocks[current_block_type_index]; 6327 6328 if (!if_block3) { 6329 if_block3 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 6330 if_block3.c(); 6331 } else { 6332 if_block3.p(ctx, dirty); 6333 } 6334 6335 transition_in$1(if_block3, 1); 6336 if_block3.m(t3.parentNode, t3); 6337 } else { 6338 if_block3 = null; 6339 } 6340 } 6341 6342 if (!/*timer*/ ctx[5]) { 6343 if (if_block4) { 6344 if_block4.p(ctx, dirty); 6345 } else { 6346 if_block4 = create_if_block_1$1(ctx); 6347 if_block4.c(); 6348 if_block4.m(if_block4_anchor.parentNode, if_block4_anchor); 6349 } 6350 } else if (if_block4) { 6351 if_block4.d(1); 6352 if_block4 = null; 6353 } 6354 }, 6355 i(local) { 6356 if (current) return; 6357 transition_in$1(if_block3); 6358 current = true; 6359 }, 6360 o(local) { 6361 transition_out$1(if_block3); 6362 current = false; 6363 }, 6364 d(detaching) { 6365 if (detaching) { 6366 detach$1(t0); 6367 detach$1(div); 6368 detach$1(t2); 6369 detach$1(t3); 6370 detach$1(if_block4_anchor); 6371 } 6372 6373 if (if_block0) if_block0.d(detaching); 6374 6375 if (if_block1) { 6376 if_block1.d(); 6377 } 6378 6379 if (if_block2) if_block2.d(); 6380 6381 if (~current_block_type_index) { 6382 if_blocks[current_block_type_index].d(detaching); 6383 } 6384 6385 if (if_block4) if_block4.d(detaching); 6386 } 6387 }; 6388} 6389 6390// (178:2) {#if variant === "default" && show_eta_bar && show_progress === "full"} 6391function create_if_block_16(ctx) { 6392 let div; 6393 let style_transform = `translateX(${(/*eta_level*/ ctx[17] || 0) * 100 - 100}%)`; 6394 6395 return { 6396 c() { 6397 div = element$1("div"); 6398 attr$1(div, "class", "eta-bar svelte-12bm2fk"); 6399 set_style(div, "transform", style_transform); 6400 }, 6401 m(target, anchor) { 6402 insert$1(target, div, anchor); 6403 }, 6404 p(ctx, dirty) { 6405 if (dirty[0] & /*eta_level*/ 131072 && style_transform !== (style_transform = `translateX(${(/*eta_level*/ ctx[17] || 0) * 100 - 100}%)`)) { 6406 set_style(div, "transform", style_transform); 6407 } 6408 }, 6409 d(detaching) { 6410 if (detaching) { 6411 detach$1(div); 6412 } 6413 } 6414 }; 6415} 6416 6417// (202:34) 6418function create_if_block_15(ctx) { 6419 let t; 6420 6421 return { 6422 c() { 6423 t = text$1("processing |"); 6424 }, 6425 m(target, anchor) { 6426 insert$1(target, t, anchor); 6427 }, 6428 p: noop, 6429 d(detaching) { 6430 if (detaching) { 6431 detach$1(t); 6432 } 6433 } 6434 }; 6435} 6436 6437// (200:88) 6438function create_if_block_14(ctx) { 6439 let t0; 6440 let t1_value = /*queue_position*/ ctx[2] + 1 + ""; 6441 let t1; 6442 let t2; 6443 let t3; 6444 let t4; 6445 6446 return { 6447 c() { 6448 t0 = text$1("queue: "); 6449 t1 = text$1(t1_value); 6450 t2 = text$1("/"); 6451 t3 = text$1(/*queue_size*/ ctx[3]); 6452 t4 = text$1(" |"); 6453 }, 6454 m(target, anchor) { 6455 insert$1(target, t0, anchor); 6456 insert$1(target, t1, anchor); 6457 insert$1(target, t2, anchor);
6458 insert$1(target, t3, anchor); 6459 insert$1(target, t4, anchor); 6460 }, 6461 p(ctx, dirty) { 6462 if (dirty[0] & /*queue_position*/ 4 && t1_value !== (t1_value = /*queue_position*/ ctx[2] + 1 + "")) set_data$1(t1, t1_value); 6463 if (dirty[0] & /*queue_size*/ 8) set_data$1(t3, /*queue_size*/ ctx[3]); 6464 }, 6465 d(detaching) { 6466 if (detaching) { 6467 detach$1(t0); 6468 detach$1(t1); 6469 detach$1(t2); 6470 detach$1(t3); 6471 detach$1(t4); 6472 } 6473 } 6474 }; 6475} 6476 6477// (189:3) {#if progress} 6478function create_if_block_11(ctx) { 6479 let each_1_anchor; 6480 let each_value_1 = ensure_array_like(/*progress*/ ctx[7]); 6481 let each_blocks = []; 6482 6483 for (let i = 0; i < each_value_1.length; i += 1) { 6484 each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); 6485 } 6486 6487 return { 6488 c() { 6489 for (let i = 0; i < each_blocks.length; i += 1) { 6490 each_blocks[i].c(); 6491 } 6492 6493 each_1_anchor = empty$1(); 6494 }, 6495 m(target, anchor) { 6496 for (let i = 0; i < each_blocks.length; i += 1) { 6497 if (each_blocks[i]) { 6498 each_blocks[i].m(target, anchor); 6499 } 6500 } 6501 6502 insert$1(target, each_1_anchor, anchor); 6503 }, 6504 p(ctx, dirty) { 6505 if (dirty[0] & /*progress*/ 128) { 6506 each_value_1 = ensure_array_like(/*progress*/ ctx[7]); 6507 let i; 6508 6509 for (i = 0; i < each_value_1.length; i += 1) { 6510 const child_ctx = get_each_context_1(ctx, each_value_1, i); 6511 6512 if (each_blocks[i]) { 6513 each_blocks[i].p(child_ctx, dirty); 6514 } else { 6515 each_blocks[i] = create_each_block_1(child_ctx); 6516 each_blocks[i].c(); 6517 each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); 6518 } 6519 } 6520 6521 for (; i < each_blocks.length; i += 1) { 6522 each_blocks[i].d(1); 6523 } 6524 6525 each_blocks.length = each_value_1.length; 6526 } 6527 }, 6528 d(detaching) { 6529 if (detaching) { 6530 detach$1(each_1_anchor); 6531 } 6532 6533 destroy_each(each_blocks, detaching); 6534 } 6535 }; 6536} 6537 6538// (191:5) {#if p.index != null} 6539function create_if_block_12(ctx) { 6540 let t0; 6541 let t1_value = /*p*/ ctx[38].unit + ""; 6542 let t1; 6543 let t2; 6544 let t3_value = " " + ""; 6545 let t3; 6546 6547 function select_block_type_2(ctx, dirty) { 6548 if (/*p*/ ctx[38].length != null) return create_if_block_13; 6549 return create_else_block$1; 6550 } 6551 6552 let current_block_type = select_block_type_2(ctx); 6553 let if_block = current_block_type(ctx); 6554 6555 return { 6556 c() { 6557 if_block.c(); 6558 t0 = space(); 6559 t1 = text$1(t1_value); 6560 t2 = text$1(" | "); 6561 t3 = text$1(t3_value); 6562 }, 6563 m(target, anchor) { 6564 if_block.m(target, anchor); 6565 insert$1(target, t0, anchor); 6566 insert$1(target, t1, anchor); 6567 insert$1(target, t2, anchor); 6568 insert$1(target, t3, anchor); 6569 }, 6570 p(ctx, dirty) { 6571 if (current_block_type === (current_block_type = select_block_type_2(ctx)) && if_block) { 6572 if_block.p(ctx, dirty); 6573 } else { 6574 if_block.d(1); 6575 if_block = current_block_type(ctx); 6576 6577 if (if_block) { 6578 if_block.c(); 6579 if_block.m(t0.parentNode, t0); 6580 } 6581 } 6582 6583 if (dirty[0] & /*progress*/ 128 && t1_value !== (t1_value = /*p*/ ctx[38].unit + "")) set_data$1(t1, t1_value); 6584 }, 6585 d(detaching) { 6586 if (detaching) { 6587 detach$1(t0); 6588 detach$1(t1); 6589 detach$1(t2); 6590 detach$1(t3); 6591 } 6592 6593 if_block.d(detaching); 6594 } 6595 }; 6596} 6597 6598// (194:6) {:else} 6599function create_else_block$1(ctx) { 6600 let t_value = pretty_si(/*p*/ ctx[38].index || 0) + ""; 6601 let t; 6602 6603 return { 6604 c() { 6605 t = text$1(t_value); 6606 }, 6607 m(target, anchor) { 6608 insert$1(target, t, anchor); 6609 }, 6610 p(ctx, dirty) { 6611 if (dirty[0] & /*progress*/ 128 && t_value !== (t_value = pretty_si(/*p*/ ctx[38].index || 0) + "")) set_data$1(t, t_value); 6612 }, 6613 d(detaching) { 6614 if (detaching) { 6615 detach$1(t); 6616 } 6617 } 6618 }; 6619} 6620 6621// (192:6) {#if p.length != null} 6622function create_if_block_13(ctx) { 6623 let t0_value = pretty_si(/*p*/ ctx[38].index || 0) + ""; 6624 let t0; 6625 let t1; 6626 let t2_value = pretty_si(/*p*/ ctx[38].length) + ""; 6627 let t2; 6628 6629 return { 6630 c() { 6631 t0 = text$1(t0_value); 6632 t1 = text$1("/"); 6633 t2 = text$1(t2_value); 6634 }, 6635 m(target, anchor) { 6636 insert$1(target, t0, anchor); 6637 insert$1(target, t1, anchor); 6638 insert$1(target, t2, anchor); 6639 }, 6640 p(ctx, dirty) { 6641 if (dirty[0] & /*progress*/ 128 && t0_value !== (t0_value = pretty_si(/*p*/ ctx[38].index || 0) + "")) set_data$1(t0, t0_value);
6642 if (dirty[0] & /*progress*/ 128 && t2_value !== (t2_value = pretty_si(/*p*/ ctx[38].length) + "")) set_data$1(t2, t2_value); 6643 }, 6644 d(detaching) { 6645 if (detaching) { 6646 detach$1(t0); 6647 detach$1(t1); 6648 detach$1(t2); 6649 } 6650 } 6651 }; 6652} 6653 6654// (190:4) {#each progress as p} 6655function create_each_block_1(ctx) { 6656 let if_block_anchor; 6657 let if_block = /*p*/ ctx[38].index != null && create_if_block_12(ctx); 6658 6659 return { 6660 c() { 6661 if (if_block) if_block.c(); 6662 if_block_anchor = empty$1(); 6663 }, 6664 m(target, anchor) { 6665 if (if_block) if_block.m(target, anchor); 6666 insert$1(target, if_block_anchor, anchor); 6667 }, 6668 p(ctx, dirty) { 6669 if (/*p*/ ctx[38].index != null) { 6670 if (if_block) { 6671 if_block.p(ctx, dirty); 6672 } else { 6673 if_block = create_if_block_12(ctx); 6674 if_block.c(); 6675 if_block.m(if_block_anchor.parentNode, if_block_anchor); 6676 } 6677 } else if (if_block) { 6678 if_block.d(1); 6679 if_block = null; 6680 } 6681 }, 6682 d(detaching) { 6683 if (detaching) { 6684 detach$1(if_block_anchor); 6685 } 6686 6687 if (if_block) if_block.d(detaching); 6688 } 6689 }; 6690} 6691 6692// (206:3) {#if timer} 6693function create_if_block_10(ctx) { 6694 let t0; 6695 let t1_value = (/*eta*/ ctx[0] ? `/${/*formatted_eta*/ ctx[19]}` : "") + ""; 6696 let t1; 6697 let t2; 6698 6699 return { 6700 c() { 6701 t0 = text$1(/*formatted_timer*/ ctx[20]); 6702 t1 = text$1(t1_value); 6703 t2 = text$1("s"); 6704 }, 6705 m(target, anchor) { 6706 insert$1(target, t0, anchor); 6707 insert$1(target, t1, anchor); 6708 insert$1(target, t2, anchor); 6709 }, 6710 p(ctx, dirty) { 6711 if (dirty[0] & /*formatted_timer*/ 1048576) set_data$1(t0, /*formatted_timer*/ ctx[20]); 6712 if (dirty[0] & /*eta, formatted_eta*/ 524289 && t1_value !== (t1_value = (/*eta*/ ctx[0] ? `/${/*formatted_eta*/ ctx[19]}` : "") + "")) set_data$1(t1, t1_value); 6713 }, 6714 d(detaching) { 6715 if (detaching) { 6716 detach$1(t0); 6717 detach$1(t1); 6718 detach$1(t2); 6719 } 6720 } 6721 }; 6722} 6723 6724// (242:37) 6725function create_if_block_9(ctx) { 6726 let loader; 6727 let current; 6728 6729 loader = new Loader({ 6730 props: { margin: /*variant*/ ctx[8] === "default" } 6731 }); 6732 6733 return { 6734 c() { 6735 create_component$1(loader.$$.fragment); 6736 }, 6737 m(target, anchor) { 6738 mount_component$1(loader, target, anchor); 6739 current = true; 6740 }, 6741 p(ctx, dirty) { 6742 const loader_changes = {}; 6743 if (dirty[0] & /*variant*/ 256) loader_changes.margin = /*variant*/ ctx[8] === "default"; 6744 loader.$set(loader_changes); 6745 }, 6746 i(local) { 6747 if (current) return; 6748 transition_in$1(loader.$$.fragment, local); 6749 current = true; 6750 }, 6751 o(local) { 6752 transition_out$1(loader.$$.fragment, local); 6753 current = false; 6754 }, 6755 d(detaching) { 6756 destroy_component$1(loader, detaching); 6757 } 6758 }; 6759} 6760 6761// (211:2) {#if last_progress_level != null} 6762function create_if_block_2$1(ctx) { 6763 let div3; 6764 let div0; 6765 let t; 6766 let div2; 6767 let div1; 6768 let style_width = `${/*last_progress_level*/ ctx[15] * 100}%`; 6769 let if_block = /*progress*/ ctx[7] != null && create_if_block_3$1(ctx); 6770 6771 return { 6772 c() { 6773 div3 = element$1("div"); 6774 div0 = element$1("div"); 6775 if (if_block) if_block.c(); 6776 t = space(); 6777 div2 = element$1("div"); 6778 div1 = element$1("div"); 6779 attr$1(div0, "class", "progress-level-inner svelte-12bm2fk"); 6780 attr$1(div1, "class", "progress-bar svelte-12bm2fk"); 6781 set_style(div1, "width", style_width); 6782 attr$1(div2, "class", "progress-bar-wrap svelte-12bm2fk"); 6783 attr$1(div3, "class", "progress-level svelte-12bm2fk"); 6784 }, 6785 m(target, anchor) { 6786 insert$1(target, div3, anchor); 6787 append$1(div3, div0); 6788 if (if_block) if_block.m(div0, null); 6789 append$1(div3, t); 6790 append$1(div3, div2); 6791 append$1(div2, div1); 6792 /*div1_binding*/ ctx[30](div1); 6793 }, 6794 p(ctx, dirty) { 6795 if (/*progress*/ ctx[7] != null) { 6796 if (if_block) { 6797 if_block.p(ctx, dirty); 6798 } else { 6799 if_block = create_if_block_3$1(ctx); 6800 if_block.c(); 6801 if_block.m(div0, null); 6802 } 6803 } else if (if_block) { 6804 if_block.d(1); 6805 if_block = null; 6806 } 6807 6808 if (dirty[0] & /*last_progress_level*/ 32768 && style_width !== (style_width = `${/*last_progress_level*/ ctx[15] * 100}%`)) { 6809 set_style(div1, "width", style_width); 6810 } 6811 }, 6812 i: noop, 6813 o: noop, 6814 d(detaching) { 6815 if (detaching) { 6816 detach$1(div3); 6817 } 6818 6819 if (if_block) if_block.d(); 6820 /*div1_binding*/ ctx[30](null); 6821 } 6822 }; 6823} 6824 6825// (214:5) {#if progress != null} 6826function create_if_block_3$1(ctx) { 6827 let each_1_anchor; 6828 let each_value = ensure_array_like(/*progress*/ ctx[7]); 6829 let each_blocks = []; 6830 6831 for (let i = 0; i < each_value.length; i += 1) { 6832 each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); 6833 } 6834 6835 return { 6836 c() { 6837 for (let i = 0; i < each_blocks.length; i += 1) { 6838 each_blocks[i].c(); 6839 } 6840 6841 each_1_anchor = empty$1(); 6842 }, 6843 m(target, anchor) { 6844 for (let i = 0; i < each_blocks.length; i += 1) { 6845 if (each_blocks[i]) { 6846 each_blocks[i].m(target, anchor); 6847 } 6848 } 6849 6850 insert$1(target, each_1_anchor, anchor); 6851 }, 6852 p(ctx, dirty) {
6853 if (dirty[0] & /*progress_level, progress*/ 16512) { 6854 each_value = ensure_array_like(/*progress*/ ctx[7]); 6855 let i; 6856 6857 for (i = 0; i < each_value.length; i += 1) { 6858 const child_ctx = get_each_context(ctx, each_value, i); 6859 6860 if (each_blocks[i]) { 6861 each_blocks[i].p(child_ctx, dirty); 6862 } else { 6863 each_blocks[i] = create_each_block(child_ctx); 6864 each_blocks[i].c(); 6865 each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); 6866 } 6867 } 6868 6869 for (; i < each_blocks.length; i += 1) { 6870 each_blocks[i].d(1); 6871 } 6872 6873 each_blocks.length = each_value.length; 6874 } 6875 }, 6876 d(detaching) { 6877 if (detaching) { 6878 detach$1(each_1_anchor); 6879 } 6880 6881 destroy_each(each_blocks, detaching); 6882 } 6883 }; 6884} 6885 6886// (216:7) {#if p.desc != null || (progress_level && progress_level[i] != null)} 6887function create_if_block_4(ctx) { 6888 let t0; 6889 let t1; 6890 let t2; 6891 let if_block3_anchor; 6892 let if_block0 = /*i*/ ctx[40] !== 0 && create_if_block_8(); 6893 let if_block1 = /*p*/ ctx[38].desc != null && create_if_block_7(ctx); 6894 let if_block2 = /*p*/ ctx[38].desc != null && /*progress_level*/ ctx[14] && /*progress_level*/ ctx[14][/*i*/ ctx[40]] != null && create_if_block_6(); 6895 let if_block3 = /*progress_level*/ ctx[14] != null && create_if_block_5(ctx); 6896 6897 return { 6898 c() { 6899 if (if_block0) if_block0.c(); 6900 t0 = space(); 6901 if (if_block1) if_block1.c(); 6902 t1 = space(); 6903 if (if_block2) if_block2.c(); 6904 t2 = space(); 6905 if (if_block3) if_block3.c(); 6906 if_block3_anchor = empty$1(); 6907 }, 6908 m(target, anchor) { 6909 if (if_block0) if_block0.m(target, anchor); 6910 insert$1(target, t0, anchor); 6911 if (if_block1) if_block1.m(target, anchor); 6912 insert$1(target, t1, anchor); 6913 if (if_block2) if_block2.m(target, anchor); 6914 insert$1(target, t2, anchor); 6915 if (if_block3) if_block3.m(target, anchor); 6916 insert$1(target, if_block3_anchor, anchor); 6917 }, 6918 p(ctx, dirty) { 6919 if (/*p*/ ctx[38].desc != null) { 6920 if (if_block1) { 6921 if_block1.p(ctx, dirty); 6922 } else { 6923 if_block1 = create_if_block_7(ctx); 6924 if_block1.c(); 6925 if_block1.m(t1.parentNode, t1); 6926 } 6927 } else if (if_block1) { 6928 if_block1.d(1); 6929 if_block1 = null; 6930 } 6931 6932 if (/*p*/ ctx[38].desc != null && /*progress_level*/ ctx[14] && /*progress_level*/ ctx[14][/*i*/ ctx[40]] != null) { 6933 if (if_block2) ; else { 6934 if_block2 = create_if_block_6(); 6935 if_block2.c(); 6936 if_block2.m(t2.parentNode, t2); 6937 } 6938 } else if (if_block2) { 6939 if_block2.d(1); 6940 if_block2 = null; 6941 } 6942 6943 if (/*progress_level*/ ctx[14] != null) { 6944 if (if_block3) { 6945 if_block3.p(ctx, dirty); 6946 } else { 6947 if_block3 = create_if_block_5(ctx); 6948 if_block3.c(); 6949 if_block3.m(if_block3_anchor.parentNode, if_block3_anchor); 6950 } 6951 } else if (if_block3) { 6952 if_block3.d(1); 6953 if_block3 = null; 6954 } 6955 }, 6956 d(detaching) { 6957 if (detaching) { 6958 detach$1(t0); 6959 detach$1(t1); 6960 detach$1(t2); 6961 detach$1(if_block3_anchor); 6962 } 6963 6964 if (if_block0) if_block0.d(detaching); 6965 if (if_block1) if_block1.d(detaching); 6966 if (if_block2) if_block2.d(detaching); 6967 if (if_block3) if_block3.d(detaching); 6968 } 6969 }; 6970} 6971 6972// (217:8) {#if i !== 0} 6973function create_if_block_8(ctx) { 6974 let t; 6975 6976 return { 6977 c() { 6978 t = text$1("Â /"); 6979 }, 6980 m(target, anchor) { 6981 insert$1(target, t, anchor); 6982 }, 6983 d(detaching) { 6984 if (detaching) { 6985 detach$1(t); 6986 } 6987 } 6988 }; 6989} 6990 6991// (220:8) {#if p.desc != null} 6992function create_if_block_7(ctx) { 6993 let t_value = /*p*/ ctx[38].desc + ""; 6994 let t; 6995 6996 return { 6997 c() { 6998 t = text$1(t_value); 6999 }, 7000 m(target, anchor) { 7001 insert$1(target, t, anchor); 7002 }, 7003 p(ctx, dirty) { 7004 if (dirty[0] & /*progress*/ 128 && t_value !== (t_value = /*p*/ ctx[38].desc + "")) set_data$1(t, t_value); 7005 }, 7006 d(detaching) { 7007 if (detaching) { 7008 detach$1(t); 7009 } 7010 } 7011 }; 7012} 7013 7014// (223:8) {#if p.desc != null && progress_level && progress_level[i] != null} 7015function create_if_block_6(ctx) { 7016 let t; 7017 7018 return { 7019 c() { 7020 t = text$1("-"); 7021 }, 7022 m(target, anchor) { 7023 insert$1(target, t, anchor); 7024 }, 7025 d(detaching) { 7026 if (detaching) { 7027 detach$1(t); 7028 } 7029 } 7030 }; 7031} 7032 7033// (226:8) {#if progress_level != null} 7034function create_if_block_5(ctx) { 7035 let t0_value = (100 * (/*progress_level*/ ctx[14][/*i*/ ctx[40]] || 0)).toFixed(1) + ""; 7036 let t0; 7037 let t1; 7038 7039 return { 7040 c() { 7041 t0 = text$1(t0_value); 7042 t1 = text$1("%"); 7043 }, 7044 m(target, anchor) { 7045 insert$1(target, t0, anchor); 7046 insert$1(target, t1, anchor); 7047 }, 7048 p(ctx, dirty) {
7049 if (dirty[0] & /*progress_level*/ 16384 && t0_value !== (t0_value = (100 * (/*progress_level*/ ctx[14][/*i*/ ctx[40]] || 0)).toFixed(1) + "")) set_data$1(t0, t0_value); 7050 }, 7051 d(detaching) { 7052 if (detaching) { 7053 detach$1(t0); 7054 detach$1(t1); 7055 } 7056 } 7057 }; 7058} 7059 7060// (215:6) {#each progress as p, i} 7061function create_each_block(ctx) { 7062 let if_block_anchor; 7063 let if_block = (/*p*/ ctx[38].desc != null || /*progress_level*/ ctx[14] && /*progress_level*/ ctx[14][/*i*/ ctx[40]] != null) && create_if_block_4(ctx); 7064 7065 return { 7066 c() { 7067 if (if_block) if_block.c(); 7068 if_block_anchor = empty$1(); 7069 }, 7070 m(target, anchor) { 7071 if (if_block) if_block.m(target, anchor); 7072 insert$1(target, if_block_anchor, anchor); 7073 }, 7074 p(ctx, dirty) { 7075 if (/*p*/ ctx[38].desc != null || /*progress_level*/ ctx[14] && /*progress_level*/ ctx[14][/*i*/ ctx[40]] != null) { 7076 if (if_block) { 7077 if_block.p(ctx, dirty); 7078 } else { 7079 if_block = create_if_block_4(ctx); 7080 if_block.c(); 7081 if_block.m(if_block_anchor.parentNode, if_block_anchor); 7082 } 7083 } else if (if_block) { 7084 if_block.d(1); 7085 if_block = null; 7086 } 7087 }, 7088 d(detaching) { 7089 if (detaching) { 7090 detach$1(if_block_anchor); 7091 } 7092 7093 if (if_block) if_block.d(detaching); 7094 } 7095 }; 7096} 7097 7098// (246:2) {#if !timer} 7099function create_if_block_1$1(ctx) { 7100 let p_1; 7101 let t; 7102 7103 return { 7104 c() { 7105 p_1 = element$1("p"); 7106 t = text$1(/*loading_text*/ ctx[9]); 7107 attr$1(p_1, "class", "loading svelte-12bm2fk"); 7108 }, 7109 m(target, anchor) { 7110 insert$1(target, p_1, anchor); 7111 append$1(p_1, t); 7112 }, 7113 p(ctx, dirty) { 7114 if (dirty[0] & /*loading_text*/ 512) set_data$1(t, /*loading_text*/ ctx[9]); 7115 }, 7116 d(detaching) { 7117 if (detaching) { 7118 detach$1(p_1); 7119 } 7120 } 7121 }; 7122} 7123 7124function create_fragment$1(ctx) { 7125 let div; 7126 let current_block_type_index; 7127 let if_block; 7128 let div_class_value; 7129 let current; 7130 const if_block_creators = [create_if_block$1, create_if_block_17]; 7131 const if_blocks = []; 7132 7133 function select_block_type(ctx, dirty) { 7134 if (/*status*/ ctx[4] === "pending") return 0; 7135 if (/*status*/ ctx[4] === "error") return 1; 7136 return -1; 7137 } 7138 7139 if (~(current_block_type_index = select_block_type(ctx))) { 7140 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 7141 } 7142 7143 return { 7144 c() { 7145 div = element$1("div"); 7146 if (if_block) if_block.c(); 7147 attr$1(div, "class", div_class_value = "wrap " + /*variant*/ ctx[8] + " " + /*show_progress*/ ctx[6] + " svelte-12bm2fk"); 7148 toggle_class(div, "hide", !/*status*/ ctx[4] || /*status*/ ctx[4] === "complete" || /*show_progress*/ ctx[6] === "hidden"); 7149 toggle_class(div, "translucent", /*variant*/ ctx[8] === "center" && (/*status*/ ctx[4] === "pending" || /*status*/ ctx[4] === "error") || /*translucent*/ ctx[11] || /*show_progress*/ ctx[6] === "minimal"); 7150 toggle_class(div, "generating", /*status*/ ctx[4] === "generating"); 7151 toggle_class(div, "border", /*border*/ ctx[12]); 7152 set_style(div, "position", /*absolute*/ ctx[10] ? "absolute" : "static"); 7153 set_style(div, "padding", /*absolute*/ ctx[10] ? "0" : "var(--size-8) 0"); 7154 }, 7155 m(target, anchor) { 7156 insert$1(target, div, anchor); 7157 7158 if (~current_block_type_index) { 7159 if_blocks[current_block_type_index].m(div, null); 7160 } 7161 7162 /*div_binding*/ ctx[31](div); 7163 current = true; 7164 }, 7165 p(ctx, dirty) { 7166 let previous_block_index = current_block_type_index; 7167 current_block_type_index = select_block_type(ctx); 7168 7169 if (current_block_type_index === previous_block_index) { 7170 if (~current_block_type_index) { 7171 if_blocks[current_block_type_index].p(ctx, dirty); 7172 } 7173 } else { 7174 if (if_block) { 7175 group_outros$1(); 7176 7177 transition_out$1(if_blocks[previous_block_index], 1, 1, () => { 7178 if_blocks[previous_block_index] = null; 7179 }); 7180 7181 check_outros$1(); 7182 } 7183 7184 if (~current_block_type_index) { 7185 if_block = if_blocks[current_block_type_index]; 7186 7187 if (!if_block) { 7188 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 7189 if_block.c(); 7190 } else { 7191 if_block.p(ctx, dirty); 7192 } 7193 7194 transition_in$1(if_block, 1); 7195 if_block.m(div, null); 7196 } else { 7197 if_block = null; 7198 } 7199 } 7200 7201 if (!current || dirty[0] & /*variant, show_progress*/ 320 && div_class_value !== (div_class_value = "wrap " + /*variant*/ ctx[8] + " " + /*show_progress*/ ctx[6] + " svelte-12bm2fk")) { 7202 attr$1(div, "class", div_class_value); 7203 } 7204 7205 if (!current || dirty[0] & /*variant, show_progress, status, show_progress*/ 336) { 7206 toggle_class(div, "hide", !/*status*/ ctx[4] || /*status*/ ctx[4] === "complete" || /*show_progress*/ ctx[6] === "hidden"); 7207 } 7208 7209 if (!current || dirty[0] & /*variant, show_progress, variant, status, translucent, show_progress*/ 2384) { 7210 toggle_class(div, "translucent", /*variant*/ ctx[8] === "center" && (/*status*/ ctx[4] === "pending" || /*status*/ ctx[4] === "error") || /*translucent*/ ctx[11] || /*show_progress*/ ctx[6] === "minimal"); 7211 } 7212 7213 if (!current || dirty[0] & /*variant, show_progress, status*/ 336) { 7214 toggle_class(div, "generating", /*status*/ ctx[4] === "generating"); 7215 } 7216 7217 if (!current || dirty[0] & /*variant, show_progress, border*/ 4416) { 7218 toggle_class(div, "border", /*border*/ ctx[12]); 7219 } 7220
7221 if (dirty[0] & /*absolute*/ 1024) { 7222 set_style(div, "position", /*absolute*/ ctx[10] ? "absolute" : "static"); 7223 } 7224 7225 if (dirty[0] & /*absolute*/ 1024) { 7226 set_style(div, "padding", /*absolute*/ ctx[10] ? "0" : "var(--size-8) 0"); 7227 } 7228 }, 7229 i(local) { 7230 if (current) return; 7231 transition_in$1(if_block); 7232 current = true; 7233 }, 7234 o(local) { 7235 transition_out$1(if_block); 7236 current = false; 7237 }, 7238 d(detaching) { 7239 if (detaching) { 7240 detach$1(div); 7241 } 7242 7243 if (~current_block_type_index) { 7244 if_blocks[current_block_type_index].d(); 7245 } 7246 7247 /*div_binding*/ ctx[31](null); 7248 } 7249 }; 7250} 7251 7252let items = []; 7253let called = false; 7254 7255async function scroll_into_view(el, enable = true) { 7256 if (window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && enable !== true) { 7257 return; 7258 } 7259 7260 items.push(el); 7261 if (!called) called = true; else return; 7262 await tick(); 7263 7264 requestAnimationFrame(() => { 7265 let min = [0, 0]; 7266 7267 for (let i = 0; i < items.length; i++) { 7268 const element = items[i]; 7269 const box = element.getBoundingClientRect(); 7270 7271 if (i === 0 || box.top + window.scrollY <= min[0]) { 7272 min[0] = box.top + window.scrollY; 7273 min[1] = i; 7274 } 7275 } 7276 7277 window.scrollTo({ top: min[0] - 20, behavior: "smooth" }); 7278 called = false; 7279 items = []; 7280 }); 7281} 7282 7283function instance$1($$self, $$props, $$invalidate) { 7284 let formatted_timer; 7285 let { $$slots: slots = {}, $$scope } = $$props; 7286 let { i18n } = $$props; 7287 let { eta = null } = $$props; 7288 let { queue_position } = $$props; 7289 let { queue_size } = $$props; 7290 let { status } = $$props; 7291 let { scroll_to_output = false } = $$props; 7292 let { timer = true } = $$props; 7293 let { show_progress = "full" } = $$props; 7294 let { message = null } = $$props; 7295 let { progress = null } = $$props; 7296 let { variant = "default" } = $$props; 7297 let { loading_text = "Loading..." } = $$props; 7298 let { absolute = true } = $$props; 7299 let { translucent = false } = $$props; 7300 let { border = false } = $$props; 7301 let { autoscroll } = $$props; 7302 let el; 7303 let _timer = false; 7304 let timer_start = 0; 7305 let timer_diff = 0; 7306 let old_eta = null; 7307 let eta_from_start = null; 7308 let eta_level = 0; 7309 let progress_level = null; 7310 let last_progress_level = undefined; 7311 let progress_bar = null; 7312 let show_eta_bar = true; 7313 7314 const start_timer = () => { 7315 $$invalidate(0, eta = $$invalidate(26, old_eta = $$invalidate(19, formatted_eta = null))); 7316 $$invalidate(24, timer_start = performance.now()); 7317 $$invalidate(25, timer_diff = 0); 7318 _timer = true; 7319 run(); 7320 }; 7321 7322 function run() { 7323 requestAnimationFrame(() => { 7324 $$invalidate(25, timer_diff = (performance.now() - timer_start) / 1000); 7325 if (_timer) run(); 7326 }); 7327 } 7328 7329 function stop_timer() { 7330 $$invalidate(25, timer_diff = 0); 7331 $$invalidate(0, eta = $$invalidate(26, old_eta = $$invalidate(19, formatted_eta = null))); 7332 if (!_timer) return; 7333 _timer = false; 7334 } 7335 7336 onDestroy(() => { 7337 if (_timer) stop_timer(); 7338 }); 7339 7340 let formatted_eta = null; 7341 7342 function div1_binding($$value) { 7343 binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { 7344 progress_bar = $$value; 7345 ((($$invalidate(16, progress_bar), $$invalidate(7, progress)), $$invalidate(14, progress_level)), $$invalidate(15, last_progress_level)); 7346 }); 7347 } 7348 7349 function div_binding($$value) { 7350 binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { 7351 el = $$value; 7352 $$invalidate(13, el); 7353 }); 7354 } 7355 7356 $$self.$$set = $$props => {
7357 if ('i18n' in $$props) $$invalidate(1, i18n = $$props.i18n); 7358 if ('eta' in $$props) $$invalidate(0, eta = $$props.eta); 7359 if ('queue_position' in $$props) $$invalidate(2, queue_position = $$props.queue_position); 7360 if ('queue_size' in $$props) $$invalidate(3, queue_size = $$props.queue_size); 7361 if ('status' in $$props) $$invalidate(4, status = $$props.status); 7362 if ('scroll_to_output' in $$props) $$invalidate(21, scroll_to_output = $$props.scroll_to_output); 7363 if ('timer' in $$props) $$invalidate(5, timer = $$props.timer); 7364 if ('show_progress' in $$props) $$invalidate(6, show_progress = $$props.show_progress); 7365 if ('message' in $$props) $$invalidate(22, message = $$props.message); 7366 if ('progress' in $$props) $$invalidate(7, progress = $$props.progress); 7367 if ('variant' in $$props) $$invalidate(8, variant = $$props.variant); 7368 if ('loading_text' in $$props) $$invalidate(9, loading_text = $$props.loading_text); 7369 if ('absolute' in $$props) $$invalidate(10, absolute = $$props.absolute); 7370 if ('translucent' in $$props) $$invali
7370date(11, translucent = $$props.translucent); 7371 if ('border' in $$props) $$invalidate(12, border = $$props.border); 7372 if ('autoscroll' in $$props) $$invalidate(23, autoscroll = $$props.autoscroll); 7373 if ('$$scope' in $$props) $$invalidate(28, $$scope = $$props.$$scope); 7374 }; 7375 7376 $$self.$$.update = () => { 7377 if ($$self.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/ 218103809) { 7378 { 7379 if (eta === null) { 7380 $$invalidate(0, eta = old_eta); 7381 } 7382 7383 if (eta != null && old_eta !== eta) { 7384 $$invalidate(27, eta_from_start = (performance.now() - timer_start) / 1000 + eta); 7385 $$invalidate(19, formatted_eta = eta_from_start.toFixed(1)); 7386 $$invalidate(26, old_eta = eta); 7387 } 7388 } 7389 } 7390 7391 if ($$self.$$.dirty[0] & /*eta_from_start, timer_diff*/ 167772160) { 7392 $$invalidate(17, eta_level = eta_from_start === null || eta_from_start <= 0 || !timer_diff 7393 ? null 7394 : Math.min(timer_diff / eta_from_start, 1)); 7395 } 7396 7397 if ($$self.$$.dirty[0] & /*progress*/ 128) { 7398 if (progress != null) { 7399 $$invalidate(18, show_eta_bar = false); 7400 } 7401 } 7402 7403 if ($$self.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/ 114816) { 7404 { 7405 if (progress != null) { 7406 $$invalidate(14, progress_level = progress.map(p => { 7407 if (p.index != null && p.length != null) { 7408 return p.index / p.length; 7409 } else if (p.progress != null) { 7410 return p.progress; 7411 } 7412 7413 return undefined; 7414 })); 7415 } else { 7416 $$invalidate(14, progress_level = null); 7417 } 7418 7419 if (progress_level) { 7420 $$invalidate(15, last_progress_level = progress_level[progress_level.length - 1]); 7421 7422 if (progress_bar) { 7423 if (last_progress_level === 0) { 7424 $$invalidate(16, progress_bar.style.transition = "0", progress_bar); 7425 } else { 7426 $$invalidate(16, progress_bar.style.transition = "150ms", progress_bar); 7427 } 7428 } 7429 } else { 7430 $$invalidate(15, last_progress_level = undefined); 7431 } 7432 } 7433 } 7434 7435 if ($$self.$$.dirty[0] & /*status*/ 16) { 7436 { 7437 if (status === "pending") { 7438 start_timer(); 7439 } else { 7440 stop_timer(); 7441 } 7442 } 7443 } 7444 7445 if ($$self.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/ 10493968) { 7446 el && scroll_to_output && (status === "pending" || status === "complete") && scroll_into_view(el, autoscroll); 7447 } 7448 7449 if ($$self.$$.dirty[0] & /*status, message*/ 4194320) ; 7450 7451 if ($$self.$$.dirty[0] & /*timer_diff*/ 33554432) { 7452 $$invalidate(20, formatted_timer = timer_diff.toFixed(1)); 7453 } 7454 }; 7455 7456 return [ 7457 eta, 7458 i18n, 7459 queue_position, 7460 queue_size, 7461 status, 7462 timer, 7463 show_progress, 7464 progress, 7465 variant, 7466 loading_text, 7467 absolute, 7468 translucent, 7469 border, 7470 el, 7471 progress_level, 7472 last_progress_level, 7473 progress_bar, 7474 eta_level, 7475 show_eta_bar, 7476 formatted_eta, 7477 formatted_timer, 7478 scroll_to_output, 7479 message, 7480 autoscroll, 7481 timer_start, 7482 timer_diff, 7483 old_eta, 7484 eta_from_start, 7485 $$scope, 7486 slots, 7487 div1_binding, 7488 div_binding 7489 ]; 7490} 7491 7492class Static extends SvelteComponent$1 { 7493 constructor(options) { 7494 super(); 7495 7496 init$1( 7497 this, 7498 options, 7499 instance$1, 7500 create_fragment$1, 7501 safe_not_equal$1, 7502 { 7503 i18n: 1, 7504 eta: 0, 7505 queue_position: 2, 7506 queue_size: 3, 7507 status: 4, 7508 scroll_to_output: 21, 7509 timer: 5, 7510 show_progress: 6, 7511 message: 22, 7512 progress: 7, 7513 variant: 8, 7514 loading_text: 9, 7515 absolute: 10, 7516 translucent: 11, 7517 border: 12, 7518 autoscroll: 23 7519 }, 7520 null, 7521 [-1, -1] 7522 ); 7523 } 7524} 7525 7526const DropdownArrow_svelte_svelte_type_style_lang = ''; 7527 7528const ToastContent_svelte_svelte_type_style_lang = ''; 7529 7530const Toast_svelte_svelte_type_style_lang = ''; 7531 7532const common$o = { 7533 built_with_gradio: "ØªÙ Ø§ÙØ¥Ùشاء بإستخدا٠Gradio", 7534 clear: "أ٠سØ", 7535 or: "Ø£Ù", 7536 submit: "أرسÙ" 7537}; 7538const upload_text$o = { 7539 click_to_upload: "إضغط ÙÙØªØÙ ÙÙ", 7540 drop_audio: "Ø£Ø³ÙØ· اÙÙ ÙÙ Ø§ÙØµÙت٠ÙÙØ§", 7541 drop_csv: "Ø£Ø³ÙØ· Ù ÙÙ Ø§ÙØ¨ÙØ§ÙØ§Øª ÙÙØ§", 7542 drop_file: "Ø£Ø³ÙØ· اÙÙ ÙÙ ÙÙØ§", 7543 drop_image: "Ø£Ø³ÙØ· Ø§ÙØµÙرة ÙÙØ§", 7544 drop_video: "Ø£Ø³ÙØ· اÙÙÙØ¯ÙÙ ÙÙØ§" 7545}; 7546const ar = { 7547 common: common$o, 7548 upload_text: upload_text$o 7549}; 7550 7551const __vite_glob_0_0 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7552 __proto__: null, 7553 common: common$o, 7554 default: ar, 7555 upload_text: upload_text$o 7556}, Symbol.toStringTag, { value: 'Module' })); 7557 7558const common$n = { 7559 built_with_gradio: "Construït amb gradio", 7560 clear: "Neteja", 7561 empty: "Buit", 7562 error: "Error", 7563 loading: "S'està carregant", 7564 or: "o", 7565 submit: "Envia" 7566}; 7567const upload_text$n = { 7568 click_to_upload: "Feu clic per pujar", 7569 drop_audio: "Deixeu anar l'à udio aquÃ", 7570 drop_csv: "Deixeu anar el CSV aquÃ", 7571 drop_file: "Deixeu anar el fitxer aquÃ", 7572 drop_image: "Deixeu anar la imatge aquÃ", 7573 drop_video: "Deixeu anar el vÃdeo aquÃ" 7574}; 7575const ca = { 7576 common: common$n, 7577 upload_text: upload_text$n 7578}; 7579 7580const __vite_glob_0_1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7581 __proto__: null, 7582 common: common$n, 7583 default: ca, 7584 upload_text: upload_text$n 7585}, Symbol.toStringTag, { value: 'Module' })); 7586 7587const annotated_image$3 = { 7588 annotated_image: "ÙÛÙÛÛ ÙÛØ´Ø§ÙÛ Ú©Ø±Ø§Ù" 7589}; 7590const audio$4 = { 7591 allow_recording_access: "تکاÛÛ ÚÛÚ¯Û Ø¨Ø¯Û Ø¨Û Ø¨ÛکارÙÛÙØ§ÙÛ Ù Ø§ÛکرÛÙÛÙÛÚ©Û Ø¨Û ØªÛ٠ارکردÙ.", 7592 audio: "دÛÙÚ¯", 7593 record_from_microphone: "تÛ٠ارکرد٠ÙÛ Ù Ø§ÛÚ©ÛÙÛ", 7594 stop_recording: "تÛ٠ارکرد٠بÙÛØ³ØªÛÙÛ" 7595}; 7596const blocks$3 = { 7597 connection_can_break: "ÙÛ Ù ÛØ¨Ø§ÛÙØ¯Ø§Ø Ù¾ÛÛÙÛÙØ¯ÛÛÛÚ©Û Ø¯ÛÚ©Ø±ÛØª بپÚÚÛØª ئÛÚ¯ÛØ± ئÛÙ ØªØ§Ø¨Û ÚØ§Ùاک ÙÛØ¨Ûت ÛØ§Ù Ø¦Ø§Ù ÛØ±ÛÚ©Û Ø¨ÚÛØªÛ Ø¯ÛØ®Û پشÙÙØ ئÛÙ ÛØ´ Ø´ÙÛÙÛ Ø®ÛØª ÙÛ ÚÛØ²Ø¯Ø§ ÙÛØ¯Ûست Ø¯ÛØ¯Ø§Øª.", 7598 long_requests_queue: "ÚÛØ²ÛÚ©Û Ø¯Ø±ÛÚÛ Ø¯Ø§ÙØ§Ú©Ø§Ø±Û Ù
7598ÛÛÛ. ئÛ٠سپÛÛØ³Û دÙÙØ¨Ø§Ø¯ Ø¨Ú©Û Ø¨ÛÛ ÚØ§ÙÛÚÙØ§Ù ÙÛØ¨Ûت.", 7599 lost_connection: "Ù¾ÛÛÙÛÙØ¯Û Ù¾ÚÚØ§ بÛÙÛÛ Ø¬ÛÙÛØ´ØªÙÛ Ù¾ÛÛØ¬. " 7600}; 7601const checkbox$3 = { 7602 checkbox: "بÛÚ©Ø³Û ÙÛÚµØ¨ÚØ§Ø±Ø¯Ù", 7603 checkbox_group: "گرÙÙ¾Û Ø¨ÛÚ©Ø³Û ÙÛÚµØ¨ÚØ§Ø±Ø¯Ù" 7604}; 7605const code$3 = { 7606 code: "Ú©ÛØ¯" 7607}; 7608const color_picker$3 = { 7609 color_picker: "ÚÛÙÚ¯ ÙÛÚµØ¨ÚØ§Ø±Ø¯Û" 7610}; 7611const common$m = { 7612 built_with: "Ø¯Ø±ÙØ³ØªÚ©Ø±Ø§ÙÛ ÙÛÚ¯ÛÚµ...", 7613 built_with_gradio: "Gradio Ø¯Ø±ÙØ³ØªÚ©Ø±Ø§ÙÛ Ø¨Û", 7614 clear: "خاÙÛÙکردÙÛÙÛ", 7615 download: "Ø¯Ø§Ø¨ÛØ²Ø§ÙدÙ", 7616 edit: "Ø¨ÚØ§Ø±Ú©Ø±Ø¯Ù", 7617 empty: "Ø¨ÛØªØ§Úµ", 7618 error: "ÙÛÚµÛ", 7619 hosted_on: "Ù ÛÙØ§ÙØ¯Ø§Ø±Û Ú©Ø±Ø§ÙÛ ÙÛ", 7620 loading: "بارکردÙ", 7621 logo: "ÙÛÚ¯Û", 7622 or: "ÛØ§Ù", 7623 remove: "ÙØ§Ø¨Ø±Ø¯Ù", 7624 share: "ÙØ§ÙØ¨ÛØ´Ú©Ø±Ø¯Ù", 7625 submit: "Ù¾ÛØ´Ú©ÛشکردÙ", 7626 undo: "Ù¾ÙÙÚکردÙÛÙÛ" 7627}; 7628const dataframe$3 = { 7629 incorrect_format: "ÙÛØ±Ù اتÛÚ©Û ÙÛÚµÛØ تÛÙÙØ§ ÙØ§ÛÙÛکاÙÛ CSV Ù TSV Ù¾Ø´ØªÚ¯ÛØ±Û دÛکرÛÙ", 7630 new_column: "ستÙÙÙÛ ÙÙÛ", 7631 new_row: "ÚÛØ²ÛÚ©Û ÙÙÛ" 7632}; 7633const dropdown$3 = { 7634 dropdown: "ÙÚÛØ¯Ø§ÙÛ Ø®ÙØ§Ø±" 7635}; 7636const errors$3 = { 7637 build_error: "ÙÛÚµÛÛ Ø¯Ø±ÙØ³ØªÚ©Ø±Ø¯Ù ÙÛÛÛ", 7638 config_error: "ÙÛÚµÛÛ ÚÛکخست٠ÙÛÛÛ", 7639 contact_page_author: "تکاÛÛ Ù¾ÛÛÙÛÙØ¯Û Ø¨Û ÙÙÙØ³ÛØ±Û Ù¾ÛÛØ¬ÛÙÛ Ø¨Ú©ÛÙ Ø¨Û Ø¦ÛÙÛÛ Ø¦Ø§Ú¯Ø§Ø¯Ø§Ø±ÛØ§Ù بکÛÙÛÙÛ.", 7640 no_app_file: "ÙÛÚ ÙØ§ÛÙÛÚ©Û Ø¦ÛÙ¾ ÙÛÛÛ", 7641 runtime_error: "ÙÛÚµÛÛÛÚ©Û runtime ÙÛÛÛ", 7642 space_not_working: "\"سپÛÛØ³ÛÚ©Û Ú©Ø§Ø±ÙØ§Ú©Ø§Øª ÚÙÙÚ©Û\" {0}", 7643 space_paused: "ÙÛØ²Ø§Ú©Û ÙÛØ³ØªØ§ÙÛ", 7644 use_via_api: "ÙÛ ÚÛÚ¯ÛÛ API بÛÚ©Ø§Ø±Û Ø¨ÙÛÙÛ" 7645}; 7646const file$3 = { 7647 uploading: "بارکردÙ..." 7648}; 7649const highlighted_text$3 = { 7650 highlighted_text: "دÛÙÛ ÚÛØ´Ù کراÙ" 7651}; 7652const image$3 = { 7653 allow_webcam_access: "تکاÛÛ ÚÛÚ¯Û Ø¨Ø¯Û Ø¨Û Ø¨ÛکارÙÛÙØ§ÙÛ ÙÛØ¨Ú©Ø§Ù ÛÚ©Û Ø¨Û ØªÛ٠ارکردÙ.", 7654 brush_color: "ÚÛÙÚ¯Û ÙÚµÚÛ", 7655 brush_radius: "تÛÚÚÛÙÛ ÙÚµÚÛ", 7656 image: "ÙÛÙÛ", 7657 remove_image: "ÙØ§Ø¨Ø±Ø¯ÙÛ ÙÛÙÛ", 7658 select_brush_color: "ÚÛÙÚ¯Û ÙÚµÚÛ ÙÛڵبÚÛØ±Û", 7659 start_drawing: "Ø¯ÛØ³Øª Ø¨Ú©Û Ø¨Û ÙÛÙÛÚ©ÛØ´Ø§Ù", 7660 use_brush: "ÙÚµÚÛ Ø¨ÛکاربÙÛÙÛ" 7661}; 7662const label$3 = { 7663 label: "ÙÛÛØ¨Úµ" 7664}; 7665const login$3 = { 7666 enable_cookies: "ئÛÚ¯ÛØ± ØªÛ Ø³ÛØ±Ø¯Ø§ÙÛ HuggingFace Space دÛÚ©ÛÛØª ÙÛ Ø¯ÛØ®Û ÙØ§Ø¯ÛØ§Ø±Ø¯Ø§Ø Ù¾ÛÙÛØ³ØªÛ Ú©ÙÙÚ©Û ÙØ§ÛÛÙÛ Ø³ÛÛÛÙ ÚØ§Ùاک بکÛÛØª.", 7667 incorrect_credentials: "بÚÙØ§Ùا٠ÛÛ ÙÛÚµÛ", 7668 login: "ÚÙÙÙâ ÚÙÙØ±ÙâÙÙâ" 7669}; 7670const number$3 = { 7671 number: "Ú٠ارÛ" 7672}; 7673const plot$3 = { 7674 plot: "ÙÛڵکارÛ" 7675}; 7676const radio$3 = { 7677 radio: "ÚØ§Ø¯ÛÛ" 7678}; 7679const slider$3 = { 7680 slider: "Ø®ÙÛØ³Ú©Û" 7681}; 7682const upload_text$m = { 7683 click_to_upload: "Ú©ÙÛÚ© Ø¨Ú©Û Ø¨Û Ø¨Ø§Ø±Ú©Ø±Ø¯Ù", 7684 drop_audio: "دÛÙÚ¯ ÙÛØ±Û دابÙÛ", 7685 drop_csv: "ÙÛØ±Ûدا CSV دابÙÛ", 7686 drop_file: "ÙØ§ÛÙ ÙÛØ±Û دابÙÛ", 7687 drop_image: "ÙÛÙÛ ÙÛØ±Ûدا دابÙÛ", 7688 drop_video: "Ú¤ÛØ¯ÛÛ ÙÛØ±Û دابÙÛ" 7689}; 7690const ckb = { 7691 "3D_model": { 7692 "3d_model": "Ù ÛØ¯ÛÙÛ Ø³Û ÚÛÙÛÙØ¯Û" 7693}, 7694 annotated_image: annotated_image$3, 7695 audio: audio$4, 7696 blocks: blocks$3, 7697 checkbox: checkbox$3, 7698 code: code$3, 7699 color_picker: color_picker$3, 7700 common: common$m, 7701 dataframe: dataframe$3, 7702 dropdown: dropdown$3, 7703 errors: errors$3, 7704 file: file$3, 7705 highlighted_text: highlighted_text$3, 7706 image: image$3, 7707 label: label$3, 7708 login: login$3, 7709 number: number$3, 7710 plot: plot$3, 7711 radio: radio$3, 7712 slider: slider$3, 7713 upload_text: upload_text$m 7714}; 7715 7716const __vite_glob_0_2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7717 __proto__: null, 7718 annotated_image: annotated_image$3, 7719 audio: audio$4, 7720 blocks: blocks$3, 7721 checkbox: checkbox$3, 7722 code: code$3, 7723 color_picker: color_picker$3, 7724 common: common$m, 7725 dataframe: dataframe$3, 7726 default: ckb, 7727 dropdown: dropdown$3, 7728 errors: errors$3, 7729 file: file$3, 7730 highlighted_text: highlighted_text$3, 7731 image: image$3, 7732 label: label$3, 7733 login: login$3, 7734 number: number$3, 7735 plot: plot$3, 7736 radio: radio$3, 7737 slider: slider$3, 7738 upload_text: upload_text$m 7739}, Symbol.toStringTag, { value: 'Module' })); 7740 7741const common$l = { 7742 built_with_gradio: "Mit Gradio erstellt", 7743 clear: "Löschen", 7744 or: "oder", 7745 submit: "Absenden" 7746}; 7747const upload_text$l = { 7748 click_to_upload: "Hochladen", 7749 drop_audio: "Audio hier ablegen", 7750 drop_csv: "CSV Datei hier ablegen", 7751 drop_file: "Datei hier ablegen", 7752 drop_image: "Bild hier ablegen", 7753 drop_video: "Video hier ablegen" 7754}; 7755const de = { 7756 common: common$l, 7757 upload_text: upload_text$l 7758}; 7759 7760const __vite_glob_0_3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7761 __proto__: null, 7762 common: common$l, 7763 default: de, 7764 upload_text: upload_text$l 7765}, Symbol.toStringTag, { value: 'Module' })); 7766 7767const annotated_image$2 = { 7768 annotated_image: "Annotated Image" 7769}; 7770const audio$3 = { 7771 allow_recording_access: "Please allow access to the microphone for recording.", 7772 audio: "Audio", 7773 record_from_microphone: "Record from microphone", 7774 stop_recording: "Stop recording",
7775 no_device_support: "Media devices could not be accessed. Check that you are running on a secure origin (https) or localhost (or you have passed a valid SSL certificate to ssl_verify), and you have allowed browser access to your device.", 7776 stop: "Stop", 7777 resume: "Resume", 7778 record: "Record", 7779 no_microphone: "No microphone found", 7780 pause: "Pause", 7781 play: "Play" 7782}; 7783const blocks$2 = { 7784 connection_can_break: "On mobile, the connection can break if this tab is unfocused or the device sleeps, losing your position in queue.", 7785 long_requests_queue: "There is a long queue of requests pending. Duplicate this Space to skip.", 7786 lost_connection: "Lost connection due to leaving page. Rejoining queue..." 7787}; 7788const checkbox$2 = { 7789 checkbox: "Checkbox", 7790 checkbox_group: "Checkbox Group" 7791}; 7792const code$2 = { 7793 code: "Code" 7794}; 7795const color_picker$2 = { 7796 color_picker: "Color Picker" 7797}; 7798const common$k = { 7799 built_with: "built with", 7800 built_with_gradio: "Built with Gradio", 7801 clear: "Clear", 7802 download: "Download", 7803 edit: "Edit", 7804 empty: "Empty", 7805 error: "Error", 7806 hosted_on: "Hosted on", 7807 loading: "Loading", 7808 logo: "logo", 7809 or: "or", 7810 remove: "Remove", 7811 share: "Share", 7812 submit: "Submit", 7813 undo: "Undo", 7814 no_devices: "No devices found" 7815}; 7816const dataframe$2 = { 7817 incorrect_format: "Incorrect format, only CSV and TSV files are supported", 7818 new_column: "New column", 7819 new_row: "New row" 7820}; 7821const dropdown$2 = { 7822 dropdown: "Dropdown" 7823}; 7824const errors$2 = { 7825 build_error: "there is a build error", 7826 config_error: "there is a config error", 7827 contact_page_author: "Please contact the author of the page to let them know.", 7828 no_app_file: "there is no app file", 7829 runtime_error: "there is a runtime error", 7830 space_not_working: "\"Space isn't working because\" {0}", 7831 space_paused: "the space is paused", 7832 use_via_api: "Use via API" 7833}; 7834const file$2 = { 7835 uploading: "Uploading..." 7836}; 7837const highlighted_text$2 = { 7838 highlighted_text: "Highlighted Text" 7839}; 7840const image$2 = { 7841 allow_webcam_access: "Please allow access to the webcam for recording.", 7842 brush_color: "Brush color", 7843 brush_radius: "Brush radius", 7844 image: "Image", 7845 remove_image: "Remove Image", 7846 select_brush_color: "Select brush color", 7847 start_drawing: "Start drawing", 7848 use_brush: "Use brush" 7849}; 7850const label$2 = { 7851 label: "Label" 7852}; 7853const login$2 = { 7854 enable_cookies: "If you are visiting a HuggingFace Space in Incognito mode, you must enable third party cookies.", 7855 incorrect_credentials: "Incorrect Credentials", 7856 login: "Login" 7857}; 7858const number$2 = { 7859 number: "Number" 7860}; 7861const plot$2 = { 7862 plot: "Plot" 7863}; 7864const radio$2 = { 7865 radio: "Radio" 7866}; 7867const slider$2 = { 7868 slider: "Slider" 7869}; 7870const upload_text$k = { 7871 click_to_upload: "Click to Upload", 7872 drop_audio: "Drop Audio Here", 7873 drop_csv: "Drop CSV Here", 7874 drop_file: "Drop File Here", 7875 drop_image: "Drop Image Here", 7876 drop_video: "Drop Video Here", 7877 drop_gallery: "Drop Image(s) Here", 7878 paste_clipboard: "Paste from Clipboard" 7879}; 7880const en = { 7881 "3D_model": { 7882 "3d_model": "3D Model" 7883}, 7884 annotated_image: annotated_image$2, 7885 audio: audio$3, 7886 blocks: blocks$2, 7887 checkbox: checkbox$2, 7888 code: code$2, 7889 color_picker: color_picker$2, 7890 common: common$k, 7891 dataframe: dataframe$2, 7892 dropdown: dropdown$2, 7893 errors: errors$2, 7894 file: file$2, 7895 highlighted_text: highlighted_text$2, 7896 image: image$2, 7897 label: label$2, 7898 login: login$2, 7899 number: number$2, 7900 plot: plot$2, 7901 radio: radio$2, 7902 slider: slider$2, 7903 upload_text: upload_text$k 7904}; 7905 7906const __vite_glob_0_4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7907 __proto__: null, 7908 annotated_image: annotated_image$2, 7909 audio: audio$3, 7910 blocks: blocks$2, 7911 checkbox: checkbox$2, 7912 code: code$2, 7913 color_picker: color_picker$2, 7914 common: common$k, 7915 dataframe: dataframe$2, 7916 default: en, 7917 dropdown: dropdown$2, 7918 errors: errors$2, 7919 file: file$2, 7920 highlighted_text: highlighted_text$2, 7921 image: image$2, 7922 label: label$2, 7923 login: login$2, 7924 number: number$2, 7925 plot: plot$2, 7926 radio: radio$2, 7927 slider: slider$2, 7928 upload_text: upload_text$k 7929}, Symbol.toStringTag, { value: 'Module' })); 7930 7931const common$j = { 7932 built_with_gradio: "Construido con Gradio", 7933 clear: "Limpiar", 7934 or: "o", 7935 submit: "Enviar" 7936}; 7937const upload_text$j = { 7938 click_to_upload: "Haga click para cargar", 7939 drop_audio: "Coloque el audio aquÃ", 7940 drop_csv: "Coloque el CSV aquÃ", 7941 drop_file: "Coloque el archivo aquÃ", 7942 drop_image: "Coloque la imagen aquÃ", 7943 drop_video: "Coloque el video aquÃ", 7944 drop_gallery: "Coloque las imagenes aquÃ" 7945}; 7946const es = { 7947 common: common$j, 7948 upload_text: upload_text$j 7949}; 7950 7951const __vite_glob_0_5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7952 __proto__: null, 7953 common: common$j, 7954 default: es, 7955 upload_text: upload_text$j 7956}, Symbol.toStringTag, { value: 'Module' })); 7957 7958const common$i = { 7959 built_with_gradio: "Gradiorekin eraikia", 7960 clear: "Garbitu", 7961 or: "edo", 7962 submit: "Bidali" 7963}; 7964const upload_text$i = { 7965 click_to_upload: "Klik egin kargatzeko", 7966 drop_audio: "Jarri hemen audioa", 7967 drop_csv: "Jarri hemen CSVa", 7968 drop_file: "Jarri hemen fitxategia", 7969 drop_image: "Jarri hemen irudia", 7970 drop_video: "Jarri hemen bideoa" 7971}; 7972const eu = { 7973 common: common$i, 7974 upload_text: upload_text$i 7975}; 7976 7977const __vite_glob_0_6 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 7978 __proto__: null, 7979 common: common$i, 7980 default: eu, 7981 upload_text: upload_text$i 7982}, Symbol.toStringTag, { value: 'Module' })); 7983 7984const common$h = { 7985 built_with_gradio: "ساخت٠شد٠با gradio", 7986 clear: "ØØ°Ù", 7987 or: "ÛØ§", 7988 submit: "ارساÙ" 7989}; 7990const upload_text$h = { 7991 click_to_upload: "Ø¨Ø±Ø§Û Ø¢Ù¾ÙÙØ¯ Ú©ÙÛÚ© Ú©ÙÛØ¯", 7992 drop_audio: "ØµÙØª را اÛÙØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯", 7993 drop_csv: "ÙØ§ÛÙ csv را اÛÙØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯", 7994 drop_file: "ÙØ§Û٠را اÛÙØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯", 7995 drop_image: "تصÙÛØ± را اÛÙØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯", 7996 drop_video: "ÙÛØ¯Û٠را اÛÙØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯" 7997}; 7998const fa = { 7999 common: common$h, 8000 upload_text: upload_text$h 8001}; 8002 8003const __vite_glob_0_7 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8004 __proto__: null, 8005 common: common$h, 8006 default: fa, 8007 upload_text: upload_text$h 8008}, Symbol.toStringTag, { value: 'Module' })); 8009 8010const audio$2 = { 8011 allow_recording_access: "Veuillez autoriser l'accès à l'enregistrement", 8012 audio: "Audio", 8013 record_from_microphone: "Enregistrer avec le microphone", 8014 stop_recording: "Arrêter l'enregistrement" 8015}; 8016const common$g = { 8017 built_with: "Construit avec", 8018 built_with_gradio: "Construit avec Gradio", 8019 clear: "Effacer", 8020 download: "Télécharger", 8021 edit: "Ãditer", 8022 error: "Erreur", 8023 loading: "Chargement", 8024 logo: "logo", 8025 or: "ou", 8026 remove: "Supprimer", 8027 share: "Partager", 8028 submit: "Soumettre" 8029}; 8030const upload_text$g = { 8031 click_to_upload: "Cliquer pour Télécharger", 8032 drop_audio: "Déposer l'Audio Ici", 8033 drop_csv: "Déposer le CSV Ici", 8034 drop_file: "Déposer le Fichier Ici", 8035 drop_image: "Déposer l'Image Ici", 8036 drop_video: "Déposer la Vidéo Ici" 8037}; 8038const fr = { 8039 audio: audio$2, 8040 common: common$g, 8041 upload_text: upload_text$g 8042}; 8043 8044const __vite_glob_0_8 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8045 __proto__: null, 8046 audio: audio$2, 8047 common: common$g, 8048 default: fr, 8049 upload_text: upload_text$g 8050}, Symbol.toStringTag, { value: 'Module' })); 8051 8052const common$f = { 8053 built_with_gradio: "×× ×× ×¢× ×ר×××", 8054 clear: "× ×§×", 8055 or: "××", 8056 submit: "ש××" 8057}; 8058const upload_text$f = { 8059 click_to_upload: "×××¥ ××× ×××¢××ת",
8060 drop_audio: "×ר×ר ×××× ×§×××¥ ש××¢", 8061 drop_csv: "×ר×ר csv ×§×××¥ ××××", 8062 drop_file: "×ר×ר ×§×××¥ ××××", 8063 drop_image: "×ר×ר ×§×××¥ ת××× × ××××", 8064 drop_video: "×ר×ר ×§×××¥ סר××× ××××" 8065}; 8066const he = { 8067 common: common$f, 8068 upload_text: upload_text$f 8069}; 8070 8071const __vite_glob_0_9 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8072 __proto__: null, 8073 common: common$f, 8074 default: he, 8075 upload_text: upload_text$f 8076}, Symbol.toStringTag, { value: 'Module' })); 8077 8078const common$e = { 8079 built_with_gradio: "Gradio सॠबना", 8080 clear: "हà¤à¤¾à¤¯à¥", 8081 or: "या", 8082 submit: "सबमिठà¤à¤°à¥" 8083}; 8084const upload_text$e = { 8085 click_to_upload: "ठपलà¥à¤¡ à¤à¥ लिठबà¤à¤¨ दबायà¥à¤", 8086 drop_audio: "यहाठà¤à¤¡à¤¿à¤¯à¥ डà¥à¤°à¥à¤ª à¤à¤°à¥à¤", 8087 drop_csv: "यहाठCSV डà¥à¤°à¥à¤ª à¤à¤°à¥à¤", 8088 drop_file: "यहाठFile डà¥à¤°à¥à¤ª à¤à¤°à¥à¤", 8089 drop_image: "यहाठà¤à¤®à¥à¤ डà¥à¤°à¥à¤ª à¤à¤°à¥à¤", 8090 drop_video: "यहाठवà¥à¤¡à¤¿à¤¯à¥ डà¥à¤°à¥à¤ª à¤à¤°à¥à¤" 8091}; 8092const hi = { 8093 common: common$e, 8094 upload_text: upload_text$e 8095}; 8096 8097const __vite_glob_0_10 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8098 __proto__: null, 8099 common: common$e, 8100 default: hi, 8101 upload_text: upload_text$e 8102}, Symbol.toStringTag, { value: 'Module' })); 8103 8104const common$d = { 8105 built_with_gradio: "gradioã§ä½ãã", 8106 clear: "ã¯ãªã¢", 8107 or: "ã¾ãã¯", 8108 submit: "éä¿¡" 8109}; 8110const upload_text$d = { 8111 click_to_upload: "ã¯ãªãã¯ãã¦ã¢ãããã¼ã", 8112 drop_audio: "ããã«é³å£°ããããã", 8113 drop_csv: "ããã«CSVããããã", 8114 drop_file: "ããã«ãã¡ã¤ã«ããããã", 8115 drop_image: "ããã«ç»åããããã", 8116 drop_video: "ããã«åç»ããããã" 8117}; 8118const ja = { 8119 common: common$d, 8120 upload_text: upload_text$d 8121}; 8122 8123const __vite_glob_0_11 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8124 __proto__: null, 8125 common: common$d, 8126 default: ja, 8127 upload_text: upload_text$d 8128}, Symbol.toStringTag, { value: 'Module' })); 8129 8130const common$c = { 8131 built_with_gradio: "gradioë¡ ì ìëììµëë¤", 8132 clear: "í´ë¦¬ì´", 8133 or: "ëë", 8134 submit: "ì ì¶í기" 8135}; 8136const upload_text$c = { 8137 click_to_upload: "í´ë¦í´ì ì ë¡ëí기", 8138 drop_audio: "ì¤ëì¤ë¥¼ ëì´ ëì¼ì¸ì", 8139 drop_csv: "CSVíì¼ì ëì´ ëì¼ì¸ì", 8140 drop_file: "íì¼ì ëì´ ëì¼ì¸ì", 8141 drop_image: "ì´ë¯¸ì§ë¥¼ ëì´ ëì¼ì¸ì", 8142 drop_video: "ë¹ëì¤ë¥¼ ëì´ ëì¼ì¸ì" 8143}; 8144const ko = { 8145 common: common$c, 8146 upload_text: upload_text$c 8147}; 8148 8149const __vite_glob_0_12 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8150 __proto__: null, 8151 common: common$c, 8152 default: ko, 8153 upload_text: upload_text$c 8154}, Symbol.toStringTag, { value: 'Module' })); 8155 8156const common$b = { 8157 built_with_gradio: "sukurta su gradio", 8158 clear: "Trinti", 8159 or: "arba", 8160 submit: "Pateikti" 8161}; 8162const upload_text$b = { 8163 click_to_upload: "SpustelÄkite norÄdami įkelti", 8164 drop_audio: "Ä®kelkite garso įraÅ¡Ä Äia", 8165 drop_csv: "Ä®kelkite CSV Äia", 8166 drop_file: "Ä®kelkite bylÄ Äia", 8167 drop_image: "Ä®kelkite paveikslÄlį Äia", 8168 drop_video: "Ä®kelkite vaizdo įraÅ¡Ä Äia" 8169}; 8170const lt = { 8171 common: common$b, 8172 upload_text: upload_text$b 8173}; 8174 8175const __vite_glob_0_13 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8176 __proto__: null, 8177 common: common$b, 8178 default: lt, 8179 upload_text: upload_text$b 8180}, Symbol.toStringTag, { value: 'Module' })); 8181 8182const common$a = { 8183 built_with_gradio: "gemaakt met gradio", 8184 clear: "Wis", 8185 or: "of", 8186 submit: "Zend in" 8187}; 8188const upload_text$a = { 8189 click_to_upload: "Klik om the Uploaden", 8190 drop_audio: "Sleep een Geluidsbestand hier", 8191 drop_csv: "Sleep een CSV hier", 8192 drop_file: "Sleep een Document hier", 8193 drop_image: "Sleep een Afbeelding hier", 8194 drop_video: "Sleep een Video hier" 8195}; 8196const nl = { 8197 common: common$a, 8198 upload_text: upload_text$a 8199}; 8200 8201const __vite_glob_0_14 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8202 __proto__: null, 8203 common: common$a, 8204 default: nl, 8205 upload_text: upload_text$a 8206}, Symbol.toStringTag, { value: 'Module' })); 8207 8208const common$9 = { 8209 built_with_gradio: "utworzone z gradio", 8210 clear: "WyczyÅÄ", 8211 or: "lub", 8212 submit: "Zatwierdź" 8213}; 8214const upload_text$9 = { 8215 click_to_upload: "Kliknij, aby przesÅaÄ", 8216 drop_audio: "PrzeciÄ gnij tutaj audio", 8217 drop_csv: "PrzeciÄ gnij tutaj CSV", 8218 drop_file: "PrzeciÄ gnij tutaj plik", 8219 drop_image: "PrzeciÄ gnij tutaj zdjÄcie", 8220 drop_video: "PrzeciÄ gnij tutaj video" 8221}; 8222const pl = { 8223 common: common$9, 8224 upload_text: upload_text$9 8225}; 8226 8227const __vite_glob_0_15 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8228 __proto__: null, 8229 common: common$9, 8230 default: pl, 8231 upload_text: upload_text$9 8232}, Symbol.toStringTag, { value: 'Module' })); 8233 8234const common$8 = { 8235 built_with_gradio: "ConstruÃdo com gradio", 8236 clear: "Limpar", 8237 error: "Erro", 8238 flag: "Marcar", 8239 loading: "Carregando", 8240 or: "ou", 8241 submit: "Enviar" 8242}; 8243const upload_text$8 = { 8244 click_to_upload: "Clique para o Upload", 8245 drop_audio: "Solte o Ãudio Aqui", 8246 drop_csv: "Solte o CSV Aqui", 8247 drop_file: "Solte o Arquivo Aqui", 8248 drop_image: "Solte a Imagem Aqui", 8249 drop_video: "Solte o VÃdeo Aqui" 8250}; 8251const ptBR = { 8252 common: common$8, 8253 upload_text: upload_text$8 8254}; 8255 8256const __vite_glob_0_16 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8257 __proto__: null, 8258 common: common$8, 8259 default: ptBR, 8260 upload_text: upload_text$8 8261}, Symbol.toStringTag, { value: 'Module' })); 8262 8263const annotated_image$1 = { 8264 annotated_image: "ÐнноÑиÑованное изобÑажение" 8265}; 8266const audio$1 = { 8267 allow_recording_access: "ÐожалÑйÑÑа, пÑедоÑÑавÑÑе доÑÑÑп к микÑоÑÐ¾Ð½Ñ Ð´Ð»Ñ Ð·Ð°Ð¿Ð¸Ñи.", 8268 audio: "ÐÑдио", 8269 record_from_microphone: "ÐапиÑаÑÑ Ñ Ð¼Ð¸ÐºÑоÑона", 8270 stop_recording: "ÐÑÑановиÑÑ Ð·Ð°Ð¿Ð¸ÑÑ", 8271 no_device_support: "Ðе ÑдалоÑÑ Ð¿Ð¾Ð»ÑÑиÑÑ Ð´Ð¾ÑÑÑп к медиаÑÑÑÑойÑÑвам. УбедиÑеÑÑ, ÑÑо Ð²Ñ ÑабоÑаеÑе на заÑиÑенном иÑÑоÑнике (https) или localhost (или пеÑедали дейÑÑвиÑелÑнÑй SSL-ÑеÑÑиÑÐ¸ÐºÐ°Ñ Ð² ssl_verify), и ÑазÑеÑили бÑаÑзеÑÑ Ð´Ð¾ÑÑÑп к ÑÑÑÑойÑÑвÑ.", 8272 stop: "СÑоп", 8273 resume: "ÐÑодолжиÑÑ", 8274 record: "ÐапиÑаÑÑ", 8275 no_microphone: "ÐикÑоÑон не найден", 8276 pause: "ÐаÑза", 8277 play: "ÐоÑпÑоизвеÑÑи" 8278}; 8279const blocks$1 = { 8280 connection_can_break: "Ðа мобилÑнÑÑ ÑÑÑÑойÑÑÐ²Ð°Ñ Ñоединение Ð¼Ð¾Ð¶ÐµÑ Ð¿ÑеÑваÑÑÑÑ, еÑли вкладка бÑÐ´ÐµÑ Ð¿ÐµÑеклÑÑена или ÑÑÑÑойÑÑво оÑклÑÑиÑÑÑ, ÑÑо пÑÐ¸Ð²ÐµÐ´ÐµÑ Ðº поÑеÑе ваÑей позиÑии в оÑеÑеди.", 8281 long_requests_queue: "ÐÑеÑÐµÐ´Ñ Ð·Ð°Ð¿ÑоÑов длиннаÑ. ÐÑодÑблиÑÑйÑе ÑÑо пÑоÑÑÑанÑÑво, ÑÑÐ¾Ð±Ñ Ð¿ÑопÑÑÑиÑÑ.", 8282 lost_connection: "ÐоÑеÑÑно Ñоединение из-за ÑÑ Ð¾Ð´Ð° Ñо ÑÑÑаниÑÑ. ÐовÑоÑное подклÑÑение..." 8283}; 8284const checkbox$1 = { 8285 checkbox: "ЧекбокÑ", 8286 checkbox_group: "ÐÑÑппа ÑекбокÑов" 8287}; 8288const code$1 = { 8289 code: "Ðод" 8290}; 8291const color_picker$1 = { 8292 color_picker: "ÐÑÐ±Ð¾Ñ ÑвеÑа" 8293};
8294const common$7 = { 8295 built_with: "Ñоздано Ñ", 8296 built_with_gradio: "Создано Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ Gradio", 8297 clear: "ÐÑиÑÑиÑÑ", 8298 download: "СкаÑаÑÑ", 8299 edit: "ÐзмениÑÑ", 8300 empty: "ÐÑÑÑо", 8301 error: "ÐÑибка", 8302 hosted_on: "РазмеÑено на", 8303 loading: "ÐагÑÑзка", 8304 logo: "логоÑип", 8305 or: "или", 8306 remove: "УдалиÑÑ", 8307 share: "ÐоделиÑÑÑÑ", 8308 submit: "ÐÑпÑавиÑÑ", 8309 undo: "ÐÑмениÑÑ", 8310 no_devices: "Ðе найдено ни одного ÑÑÑÑойÑÑва" 8311}; 8312const dataframe$1 = { 8313 incorrect_format: "ÐепÑавилÑнÑй ÑоÑмаÑ, поддеÑживаÑÑÑÑ ÑолÑко ÑÐ°Ð¹Ð»Ñ CSV и TSV", 8314 new_column: "ÐÐ¾Ð²Ð°Ñ ÐºÐ¾Ð»Ð¾Ð½ÐºÐ°", 8315 new_row: "ÐовÑй ÑÑд" 8316}; 8317const dropdown$1 = { 8318 dropdown: "Dropdown" 8319}; 8320const errors$1 = { 8321 build_error: "возникла оÑибка ÑбоÑки", 8322 config_error: "возникла оÑибка конÑигÑÑаÑии", 8323 contact_page_author: "ÐожалÑйÑÑа, ÑвÑжиÑеÑÑ Ñ Ð°Ð²ÑоÑом ÑÑÑаниÑÑ, ÑÑÐ¾Ð±Ñ ÑообÑиÑÑ ÐµÐ¼Ñ Ð¾Ð± ÑÑом.", 8324 no_app_file: "оÑÑÑÑÑÑвÑÐµÑ Ñайл пÑиложениÑ", 8325 runtime_error: "возникла пÑоблема Ñ Ð²Ñполнением", 8326 space_not_working: "\"ÐÑоÑÑÑанÑÑво не ÑабоÑаеÑ, поÑÐ¾Ð¼Ñ ÑÑо\" {0}", 8327 space_paused: "пÑоÑÑÑанÑÑво пÑиоÑÑановлено", 8328 use_via_api: "ÐÑполÑзоваÑÑ ÑеÑез API" 8329}; 8330const file$1 = { 8331 uploading: "ÐагÑÑжаем..." 8332}; 8333const highlighted_text$1 = { 8334 highlighted_text: "ÐÑделеннÑй ÑекÑÑ" 8335}; 8336const image$1 = { 8337 allow_webcam_access: "ÐожалÑйÑÑа, ÑазÑеÑиÑе доÑÑÑп к веб-камеÑе Ð´Ð»Ñ Ð·Ð°Ð¿Ð¸Ñи.", 8338 brush_color: "Ð¦Ð²ÐµÑ ÐºÐ¸ÑÑи", 8339 brush_radius: "РадиÑÑ ÐºÐ¸ÑÑи", 8340 image: "ÐзобÑажение", 8341 remove_image: "УдалиÑÑ Ð¸Ð·Ð¾Ð±Ñажение", 8342 select_brush_color: "ÐÑбеÑиÑе ÑÐ²ÐµÑ ÐºÐ¸ÑÑи", 8343 start_drawing: "ÐаÑниÑе ÑиÑоваÑÑ", 8344 use_brush: "ÐÑполÑзÑйÑе киÑÑÑ" 8345}; 8346const label$1 = { 8347 label: "Ðейбл" 8348}; 8349const login$1 = { 8350 enable_cookies: "ÐÑли Ð²Ñ Ð¿Ð¾ÑеÑаеÑе пÑоÑÑÑанÑÑво HuggingFace в Ñежиме инкогниÑо, Ð²Ñ Ð´Ð¾Ð»Ð¶Ð½Ñ ÑазÑеÑиÑÑ ÑÑоÑонние ÑÐ°Ð¹Ð»Ñ cookie.", 8351 incorrect_credentials: "ÐепÑавилÑнÑе ÑÑеÑнÑе даннÑе", 8352 login: "ÐÑ Ð¾Ð´ в ÑиÑÑемÑ" 8353}; 8354const number$1 = { 8355 number: "ЧиÑло" 8356}; 8357const plot$1 = { 8358 plot: "Ð¡Ñ ÐµÐ¼Ð°" 8359}; 8360const radio$1 = { 8361 radio: "Радио" 8362}; 8363const slider$1 = { 8364 slider: "СлайдеÑ" 8365}; 8366const upload_text$7 = { 8367 click_to_upload: "ÐажмиÑе, ÑÑÐ¾Ð±Ñ Ð·Ð°Ð³ÑÑзиÑÑ", 8368 drop_audio: "ÐеÑеÑаÑиÑе аÑдио ÑÑда", 8369 drop_csv: "ÐеÑеÑаÑиÑе Ñайл CSV ÑÑда", 8370 drop_file: "ÐеÑеÑаÑиÑе Ñайл ÑÑда", 8371 drop_image: "ÐеÑеÑаÑиÑе изобÑажение ÑÑда", 8372 drop_video: "ÐеÑеÑаÑиÑе видео ÑÑда", 8373 drop_gallery: "ÐеÑеÑаÑиÑе изобÑажение(-Ñ) ÑÑда", 8374 paste_clipboard: "ÐÑÑавка из бÑÑеÑа обмена" 8375}; 8376const ru = { 8377 "3D_model": { 8378 "3d_model": "3D-моделÑ" 8379}, 8380 annotated_image: annotated_image$1, 8381 audio: audio$1, 8382 blocks: blocks$1, 8383 checkbox: checkbox$1, 8384 code: code$1, 8385 color_picker: color_picker$1, 8386 common: common$7, 8387 dataframe: dataframe$1, 8388 dropdown: dropdown$1, 8389 errors: errors$1, 8390 file: file$1, 8391 highlighted_text: highlighted_text$1, 8392 image: image$1, 8393 label: label$1, 8394 login: login$1, 8395 number: number$1, 8396 plot: plot$1, 8397 radio: radio$1, 8398 slider: slider$1, 8399 upload_text: upload_text$7 8400}; 8401 8402const __vite_glob_0_17 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8403 __proto__: null, 8404 annotated_image: annotated_image$1, 8405 audio: audio$1, 8406 blocks: blocks$1, 8407 checkbox: checkbox$1, 8408 code: code$1, 8409 color_picker: color_picker$1, 8410 common: common$7, 8411 dataframe: dataframe$1, 8412 default: ru, 8413 dropdown: dropdown$1, 8414 errors: errors$1, 8415 file: file$1, 8416 highlighted_text: highlighted_text$1, 8417 image: image$1, 8418 label: label$1, 8419 login: login$1, 8420 number: number$1, 8421 plot: plot$1, 8422 radio: radio$1, 8423 slider: slider$1, 8424 upload_text: upload_text$7 8425}, Symbol.toStringTag, { value: 'Module' })); 8426 8427const common$6 = { 8428 built_with_gradio: "à®à®¿à®°à¯à®à®¿à®¯à¯ வà¯à®à®©à¯ à®à®°à¯à®µà®¾à®à¯à®à®ªà¯à®ª
8428à®à¯à®à®¤à¯", 8429 clear: "஠ழிà®à¯à®à®µà¯à®®à¯", 8430 or: "஠லà¯à®²à®¤à¯", 8431 submit: "à®à®®à®°à¯à®ªà¯à®ªà®¿à®à¯à®à®µà¯à®®à¯" 8432}; 8433const upload_text$6 = { 8434 click_to_upload: "பதிவà¯à®±à¯à®± à® à®´à¯à®¤à¯à®¤à®µà¯à®®à¯", 8435 drop_audio: "à®à®à®¿à®¯à¯à®µà¯ பதிவà¯à®±à¯à®±à®µà¯à®®à¯", 8436 drop_csv: "csv ஠பதிவà¯à®±à¯à®±à®µà¯à®®à¯", 8437 drop_file: "à®à¯à®ªà¯à®ªà¯ பதிவà¯à®±à¯à®±à®µà¯à®®à¯", 8438 drop_image: "பà®à®¤à¯à®¤à¯ பதிவà¯à®±à¯à®±à®µà¯à®®à¯", 8439 drop_video: "à®à®¾à®£à¯à®³à®¿à®¯à¯ பதிவà¯à®±à¯à®±à®µà¯à®®à¯" 8440}; 8441const ta = { 8442 common: common$6, 8443 upload_text: upload_text$6 8444}; 8445 8446const __vite_glob_0_18 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8447 __proto__: null, 8448 common: common$6, 8449 default: ta, 8450 upload_text: upload_text$6 8451}, Symbol.toStringTag, { value: 'Module' })); 8452 8453const common$5 = { 8454 built_with_gradio: "Gradio ile oluÅturulmuÅtur", 8455 clear: "Temizle", 8456 or: "veya", 8457 submit: "Yükle" 8458}; 8459const upload_text$5 = { 8460 click_to_upload: "Yüklemek için Tıkla", 8461 drop_audio: "Kaydı Buraya Sürükle", 8462 drop_csv: "CSV'yi Buraya Sürükle", 8463 drop_file: "Dosyayı Buraya Sürükle", 8464 drop_image: "Resmi Buraya Sürükle", 8465 drop_video: "Videoyu Buraya Sürükle" 8466}; 8467const tr = { 8468 common: common$5, 8469 upload_text: upload_text$5 8470}; 8471 8472const __vite_glob_0_19 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8473 __proto__: null, 8474 common: common$5, 8475 default: tr, 8476 upload_text: upload_text$5 8477}, Symbol.toStringTag, { value: 'Module' })); 8478 8479const common$4 = { 8480 built_with_gradio: "ÐÑоблено на оÑÐ½Ð¾Ð²Ñ gradio", 8481 clear: "ÐÑиÑÑиÑи", 8482 or: "або", 8483 submit: "ÐадÑÑлаÑи" 8484}; 8485const upload_text$4 = { 8486 click_to_upload: "ÐаÑиÑнÑÑÑ Ñоб заванÑажиÑи", 8487 drop_audio: "ÐеÑеÑÑгнÑÑÑ Ð°ÑдÑо ÑÑди", 8488 drop_csv: "ÐеÑеÑÑгнÑÑÑ CSV-Ñайл ÑÑди", 8489 drop_file: "ÐеÑеÑÑгнÑÑÑ Ñайл ÑÑди", 8490 drop_image: "ÐеÑеÑÑгнÑÑÑ Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð½Ñ ÑÑди", 8491 drop_video: "ÐеÑеÑÑгнÑÑÑ Ð²Ñдео ÑÑди" 8492}; 8493const uk = { 8494 common: common$4, 8495 upload_text: upload_text$4 8496}; 8497 8498const __vite_glob_0_20 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8499 __proto__: null, 8500 common: common$4, 8501 default: uk, 8502 upload_text: upload_text$4 8503}, Symbol.toStringTag, { value: 'Module' })); 8504 8505const common$3 = { 8506 built_with_gradio: "Ú©Û Ø³Ø§ØªÚ¾ Ø¨ÙØ§Ûا Ú¯ÛØ§ Gradio", 8507 clear: "Ûٹا دÛÚº", 8508 or: "ÛØ§", 8509 submit: "ج٠ع کرÛÚº" 8510}; 8511const upload_text$3 = { 8512 click_to_upload: "اپ ÙÙÚ Ú©Û ÙÛÛ Ú©ÙÚ© کرÛÚº", 8513 drop_audio: "ÛÛØ§Úº Ø¢ÚÛÙ ÚØ±Ø§Ù¾ کرÛÚº", 8514 drop_csv: "ÛÛØ§Úº ÙØ§Ø¦Ù ÚØ±Ø§Ù¾ کرÛÚº", 8515 drop_file: "ÛÛØ§Úº ÙØ§Ø¦Ù ÚØ±Ø§Ù¾ کرÛÚº", 8516 drop_image: "ÛÛØ§Úº تصÙÛØ± ÚØ±Ø§Ù¾ کرÛÚº", 8517 drop_video: "ÛÛØ§Úº ÙÛÚÛÙ ÚØ±Ø§Ù¾ کرÛÚº" 8518}; 8519const ur = { 8520 common: common$3, 8521 upload_text: upload_text$3 8522}; 8523 8524const __vite_glob_0_21 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8525 __proto__: null, 8526 common: common$3, 8527 default: ur, 8528 upload_text: upload_text$3 8529}, Symbol.toStringTag, { value: 'Module' })); 8530 8531const common$2 = { 8532 built_with_gradio: "gradio bilan qilingan", 8533 clear: "Tozalash", 8534 submit: "Yubor" 8535}; 8536const upload_text$2 = { 8537 click_to_upload: "Yuklash uchun Bosing", 8538 drop_audio: "Audioni Shu Yerga Tashlang", 8539 drop_csv: "CSVni Shu Yerga Tashlang", 8540 drop_file: "Faylni Shu Yerga Tashlang", 8541 drop_image: "Rasmni Shu Yerga Tashlang", 8542 drop_video: "Videoni Shu Yerga Tashlang" 8543}; 8544const uz = { 8545 common: common$2, 8546 upload_text: upload_text$2 8547}; 8548 8549const __vite_glob_0_22 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8550 __proto__: null, 8551 common: common$2, 8552 default: uz, 8553 upload_text: upload_text$2 8554}, Symbol.toStringTag, { value: 'Module' })); 8555 8556const annotated_image = { 8557 annotated_image: "æ æ³¨å¾å" 8558}; 8559const audio = { 8560 allow_recording_access: "请å 许访é®éº¦å é£ä»¥è¿è¡å½é³ã", 8561 audio: "é³é¢", 8562 record_from_microphone: "ä»éº¦å é£å½å¶", 8563 stop_recording: "忢å½å¶", 8564 no_device_support: "æ æ³è®¿é®åªä½è®¾å¤ãè¯·æ£æ¥æ¨æ¯å¦å¨å®å ¨æ¥æºï¼httpsï¼ææ¬å°ä¸»æºä¸è¿è¡ï¼æè æ¨å·²ç»éè¿ ssl_verify ä¼ éäºææç SSL è¯ä¹¦ï¼ï¼å¹¶ä¸æ¨å·²ç»å 许æµè§å¨è®¿é®æ¨ç设å¤ã", 8565 stop: "忢", 8566 resume: "ç»§ç»", 8567 record: "å½å¶", 8568 no_microphone: "æ¾ä¸å°éº¦å é£", 8569 pause: "æå", 8570 play: "ææ¾" 8571}; 8572const blocks = { 8573 connection_can_break: "å¨ç§»å¨è®¾å¤ä¸ï¼å¦ææ¤æ ç¾é¡µå¤±å»ç¦ç¹æè®¾å¤ä¼ç ï¼è¿æ¥å¯è½ä¼ä¸æï¼å¯¼è´æ¨å¨éåä¸å¤±å»ä½ç½®ã", 8574 long_requests_queue: "æä¸ä¸ªé¿æ¶é´çå¾ å¤ç请æ±éåãå¤å¶æ¤ç©ºé´ä»¥è·³è¿ã", 8575 lost_connection: "ç±äºç¦»å¼é¡µé¢ï¼è¿æ¥å·²ä¸¢å¤±ãéæ°å å ¥éå..." 8576}; 8577const checkbox = { 8578 checkbox: "å¤éæ¡", 8579 checkbox_group: "å¤éæ¡ç»" 8580}; 8581const code = {
8582 code: "代ç " 8583}; 8584const color_picker = { 8585 color_picker: "é¢è²éæ©å¨" 8586}; 8587const common$1 = { 8588 built_with: "æå»ºäº", 8589 built_with_gradio: "ä½¿ç¨ Gradio æå»º", 8590 clear: "æ¸ é¤", 8591 download: "ä¸è½½", 8592 edit: "ç¼è¾", 8593 empty: "空", 8594 error: "é误", 8595 hosted_on: "æç®¡å¨", 8596 loading: "å è½½ä¸", 8597 logo: "æ å¿", 8598 or: "æ", 8599 remove: "ç§»é¤", 8600 share: "å享", 8601 submit: "æäº¤", 8602 undo: "æ¤é" 8603}; 8604const dataframe = { 8605 incorrect_format: "æ ¼å¼ä¸æ£ç¡®ï¼ä» æ¯æ CSV å TSV æä»¶", 8606 new_column: "æ°å", 8607 new_row: "æ°è¡" 8608}; 8609const dropdown = { 8610 dropdown: "䏿èå" 8611}; 8612const errors = { 8613 build_error: "åå¨æå»ºé误", 8614 config_error: "åå¨é ç½®é误", 8615 contact_page_author: "请è系页é¢çä½è å¹¶åç¥ä»ä»¬ã", 8616 no_app_file: "ä¸åå¨åºç¨æä»¶", 8617 runtime_error: "åå¨è¿è¡æ¶é误", 8618 space_not_working: "\"ç©ºé´æ æ³å·¥ä½ï¼åå ï¼\" {0}", 8619 space_paused: "空é´å·²æå", 8620 use_via_api: "éè¿ API 使ç¨" 8621}; 8622const file = { 8623 uploading: "æ£å¨ä¸ä¼ ..." 8624}; 8625const highlighted_text = { 8626 highlighted_text: "é«äº®ææ¬" 8627}; 8628const image = { 8629 allow_webcam_access: "请å 许访é®ç½ç»æå头以è¿è¡å½å¶ã", 8630 brush_color: "ç»ç¬é¢è²", 8631 brush_radius: "ç»ç¬åå¾", 8632 image: "å¾å", 8633 remove_image: "ç§»é¤å¾å", 8634 select_brush_color: "éæ©ç»ç¬é¢è²", 8635 start_drawing: "å¼å§ç»ç»", 8636 use_brush: "使ç¨ç»ç¬" 8637}; 8638const label = { 8639 label: "æ ç¾" 8640}; 8641const login = { 8642 enable_cookies: "å¦ææ¨æ£å¨ä½¿ç¨é身模å¼è®¿é® HuggingFace 空é´ï¼æ¨å¿ é¡»å¯ç¨ç¬¬ä¸æ¹ cookieã", 8643 incorrect_credentials: "忮䏿£ç¡®", 8644 login: "ç»å½" 8645}; 8646const number = { 8647 number: "æ°å" 8648}; 8649const plot = { 8650 plot: "å¾è¡¨" 8651}; 8652const radio = { 8653 radio: "åéæ¡" 8654}; 8655const slider = { 8656 slider: "æ»å" 8657}; 8658const upload_text$1 = { 8659 click_to_upload: "ç¹å»ä¸ä¼ ", 8660 drop_audio: "å°é³é¢ææ¾å°æ¤å¤", 8661 drop_csv: "å° CSV æä»¶ææ¾å°æ¤å¤", 8662 drop_file: "å°æä»¶ææ¾å°æ¤å¤", 8663 drop_image: "å°å¾åææ¾å°æ¤å¤", 8664 drop_video: "å°è§é¢ææ¾å°æ¤å¤" 8665}; 8666const zhCN = { 8667 "3D_model": { 8668 "3d_model": "3D模å" 8669}, 8670 annotated_image: annotated_image, 8671 audio: audio, 8672 blocks: blocks, 8673 checkbox: checkbox, 8674 code: code, 8675 color_picker: color_picker, 8676 common: common$1, 8677 dataframe: dataframe, 8678 dropdown: dropdown, 8679 errors: errors, 8680 file: file, 8681 highlighted_text: highlighted_text, 8682 image: image, 8683 label: label, 8684 login: login, 8685 number: number, 8686 plot: plot, 8687 radio: radio, 8688 slider: slider, 8689 upload_text: upload_text$1 8690}; 8691 8692const __vite_glob_0_23 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8693 __proto__: null, 8694 annotated_image, 8695 audio, 8696 blocks, 8697 checkbox, 8698 code, 8699 color_picker, 8700 common: common$1, 8701 dataframe, 8702 default: zhCN, 8703 dropdown, 8704 errors, 8705 file, 8706 highlighted_text, 8707 image, 8708 label, 8709 login, 8710 number, 8711 plot, 8712 radio, 8713 slider, 8714 upload_text: upload_text$1 8715}, Symbol.toStringTag, { value: 'Module' })); 8716 8717const common = { 8718 built_with_gradio: "使ç¨Gradioæ§å»º", 8719 clear: "æ¸ é¤", 8720 or: "æ", 8721 submit: "æäº¤" 8722}; 8723const upload_text = { 8724 click_to_upload: "黿ä¸å³", 8725 drop_audio: "ææ¾é³è¨è³æ¤è", 8726 drop_csv: "ææ¾CSVè³æ¤è", 8727 drop_file: "ææ¾æªæ¡è³æ¤è", 8728 drop_image: "ææ¾åçè³æ¤è", 8729 drop_video: "ææ¾å½±çè³æ¤è" 8730}; 8731const zhTW = { 8732 common: common, 8733 upload_text: upload_text 8734}; 8735 8736const __vite_glob_0_24 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 8737 __proto__: null, 8738 common, 8739 default: zhTW, 8740 upload_text 8741}, Symbol.toStringTag, { value: 'Module' })); 8742 8743const langs = /* #__PURE__ */ Object.assign({"./lang/ar.json": __vite_glob_0_0,"./lang/ca.json": __vite_glob_0_1,"./lang/ckb.json": __vite_glob_0_2,"./lang/de.json": __vite_glob_0_3,"./lang/en.json": __vite_glob_0_4,"./lang/es.json": __vite_glob_0_5,"./lang/eu.json": __vite_glob_0_6,"./lang/fa.json": __vite_glob_0_7,"./lang/fr.json": __vite_glob_0_8,"./lang/he.json": __vite_glob_0_9,"./lang/hi.json": __vite_glob_0_10,"./lang/ja.json": __vite_glob_0_11,"./lang/ko.json": __vite_glob_0_12,"./lang/lt.json": __vite_glob_0_13,"./lang/nl.json": __vite_glob_0_14,"./lang/pl.json": __vite_glob_0_15,"./lang/pt-BR.json": __vite_glob_0_16,"./lang/ru.json": __vite_glob_0_17,"./lang/ta.json": __vite_glob_0_18,"./lang/tr.json": __vite_glob_0_19,"./lang/uk.json": __vite_glob_0_20,"./lang/ur.json": __vite_glob_0_21,"./lang/uz.json": __vite_glob_0_22,"./lang/zh-CN.json": __vite_glob_0_23,"./lang/zh-TW.json": __vite_glob_0_24 8744 8745}); 8746function process_langs() { 8747 let _langs = {}; 8748 for (const lang in langs) { 8749 const code = lang.split("/").pop().split(".").shift(); 8750 _langs[code] = langs[lang].default; 8751 } 8752 return _langs; 8753} 8754const processed_langs = process_langs(); 8755for (const lang in processed_langs) { 8756 addMessages(lang, processed_langs[lang]); 8757} 8758async function setupi18n() { 8759 await init$4({ 8760 fallbackLocale: "en", 8761 initialLocale: getLocaleFromNavigator() 8762 }); 8763} 8764 8765const { setContext: setContext$1, getContext } = window.__gradio__svelte__internal;const WORKER_PROXY_CONTEXT_KEY = "WORKER_PROXY_CONTEXT_KEY"; 8766function setWorkerProxyContext(workerProxy) { 8767 setContext$1(WORKER_PROXY_CONTEXT_KEY, workerProxy); 8768} 8769function getWorkerProxyContext() { 8770 return getContext(WORKER_PROXY_CONTEXT_KEY); 8771} 8772 8773const Index_svelte_svelte_type_style_lang = ''; 8774 8775const { 8776 SvelteComponent, 8777 add_flush_callback, 8778 append, 8779 assign, 8780 attr, 8781 bind, 8782 binding_callbacks, 8783 check_outros, 8784 component_subscribe, 8785 create_component, 8786 destroy_component, 8787 detach, 8788 element, 8789 empty, 8790 get_spread_object, 8791 get_spread_update, 8792 group_outros, 8793 init, 8794 insert, 8795 mount_component, 8796 safe_not_equal, 8797 set_data, 8798 space: space_1, 8799 text, 8800 transition_in, 8801 transition_out 8802} = window.__gradio__svelte__internal;const { onMount, setContext, createEventDispatcher }
8802 = window.__gradio__svelte__internal; 8803function create_if_block_2(ctx) { 8804 let statustracker; 8805 let current; 8806 8807 statustracker = new Static({ 8808 props: { 8809 absolute: !/*is_embed*/ ctx[4], 8810 status: /*loader_status*/ ctx[14], 8811 timer: false, 8812 queue_position: null, 8813 queue_size: null, 8814 translucent: true, 8815 loading_text: /*loading_text*/ ctx[15], 8816 i18n: /*$_*/ ctx[21], 8817 autoscroll: /*autoscroll*/ ctx[0], 8818 $$slots: { error: [create_error_slot] }, 8819 $$scope: { ctx } 8820 } 8821 }); 8822 8823 return { 8824 c() { 8825 create_component(statustracker.$$.fragment); 8826 }, 8827 m(target, anchor) { 8828 mount_component(statustracker, target, anchor); 8829 current = true; 8830 }, 8831 p(ctx, dirty) { 8832 const statustracker_changes = {}; 8833 if (dirty[0] & /*is_embed*/ 16) statustracker_changes.absolute = !/*is_embed*/ ctx[4]; 8834 if (dirty[0] & /*loader_status*/ 16384) statustracker_changes.status = /*loader_status*/ ctx[14]; 8835 if (dirty[0] & /*loading_text*/ 32768) statustracker_changes.loading_text = /*loading_text*/ ctx[15]; 8836 if (dirty[0] & /*$_*/ 2097152) statustracker_changes.i18n = /*$_*/ ctx[21]; 8837 if (dirty[0] & /*autoscroll*/ 1) statustracker_changes.autoscroll = /*autoscroll*/ ctx[0]; 8838 8839 if (dirty[0] & /*space, status, $_*/ 2105600 | dirty[1] & /*$$scope*/ 1048576) { 8840 statustracker_changes.$$scope = { dirty, ctx }; 8841 } 8842 8843 statustracker.$set(statustracker_changes); 8844 }, 8845 i(local) { 8846 if (current) return; 8847 transition_in(statustracker.$$.fragment, local); 8848 current = true; 8849 }, 8850 o(local) { 8851 transition_out(statustracker.$$.fragment, local); 8852 current = false; 8853 }, 8854 d(detaching) { 8855 destroy_component(statustracker, detaching); 8856 } 8857 }; 8858} 8859 8860// (308:4) {:else} 8861function create_else_block(ctx) { 8862 let p; 8863 let t_value = /*$_*/ ctx[21]("errors.contact_page_author") + ""; 8864 let t; 8865 8866 return { 8867 c() { 8868 p = element("p"); 8869 t = text(t_value); 8870 attr(p, "class", "svelte-y6l4b"); 8871 }, 8872 m(target, anchor) { 8873 insert(target, p, anchor); 8874 append(p, t); 8875 }, 8876 p(ctx, dirty) { 8877 if (dirty[0] & /*$_*/ 2097152 && t_value !== (t_value = /*$_*/ ctx[21]("errors.contact_page_author") + "")) set_data(t, t_value); 8878 }, 8879 d(detaching) { 8880 if (detaching) { 8881 detach(p); 8882 } 8883 } 8884 }; 8885} 8886 8887// (295:4) {#if (status.status === "space_error" || status.status === "paused") && status.discussions_enabled} 8888function create_if_block_3(ctx) { 8889 let p; 8890 let t0; 8891 let a; 8892 let t1; 8893 let a_href_value; 8894 let t2; 8895 8896 return { 8897 c() { 8898 p = element("p"); 8899 t0 = text("Please "); 8900 a = element("a"); 8901 t1 = text("contact the author of the space"); 8902 t2 = text(" to let them know."); 8903 attr(a, "href", a_href_value = "https://huggingface.co/spaces/" + /*space*/ ctx[8] + "/discussions/new?title=" + /*discussion_message*/ ctx[22].title(/*status*/ ctx[13]?.detail) + "&description=" + /*discussion_message*/ ctx[22].description(/*status*/ ctx[13]?.detail, location.origin)); 8904 attr(a, "class", "svelte-y6l4b"); 8905 attr(p, "class", "svelte-y6l4b"); 8906 }, 8907 m(target, anchor) { 8908 insert(target, p, anchor); 8909 append(p, t0); 8910 append(p, a); 8911 append(a, t1); 8912 append(p, t2); 8913 }, 8914 p(ctx, dirty) { 8915 if (dirty[0] & /*space, status*/ 8448 && a_href_value !== (a_href_value = "https://huggingface.co/spaces/" + /*space*/ ctx[8] + "/discussions/new?title=" + /*discussion_message*/ ctx[22].title(/*status*/ ctx[13]?.detail) + "&description=" + /*discussion_message*/ ctx[22].description(/*status*/ ctx[13]?.detail, location.origin))) { 8916 attr(a, "href", a_href_value); 8917 } 8918 }, 8919 d(detaching) { 8920 if (detaching) { 8921 detach(p); 8922 } 8923 } 8924 }; 8925} 8926 8927// (293:3) 8928function create_error_slot(ctx) { 8929 let div; 8930 let p; 8931 let strong; 8932 let t0_value = (/*status*/ ctx[13]?.message || "") + ""; 8933 let t0; 8934 let t1; 8935 8936 function select_block_type(ctx, dirty) { 8937 if ((/*status*/ ctx[13].status === "space_error" || /*status*/ ctx[13].status === "paused") && /*status*/ ctx[13].discussions_enabled) return create_if_block_3; 8938 return create_else_block; 8939 } 8940 8941 let current_block_type = select_block_type(ctx); 8942 let if_block = current_block_type(ctx); 8943 8944 return { 8945 c() { 8946 div = element("div"); 8947 p = element("p"); 8948 strong = element("strong"); 8949 t0 = text(t0_value); 8950 t1 = space_1(); 8951 if_block.c(); 8952 attr(p, "class", "svelte-y6l4b"); 8953 attr(div, "class", "error svelte-y6l4b"); 8954 attr(div, "slot", "error"); 8955 }, 8956 m(target, anchor) { 8957 insert(target, div, anchor); 8958 append(div, p); 8959 append(p, strong); 8960 append(strong, t0); 8961 append(div, t1); 8962 if_block.m(div, null); 8963 }, 8964 p(ctx, dirty) {
8965 if (dirty[0] & /*status*/ 8192 && t0_value !== (t0_value = (/*status*/ ctx[13]?.message || "") + "")) set_data(t0, t0_value); 8966 8967 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { 8968 if_block.p(ctx, dirty); 8969 } else { 8970 if_block.d(1); 8971 if_block = current_block_type(ctx); 8972 8973 if (if_block) { 8974 if_block.c(); 8975 if_block.m(div, null); 8976 } 8977 } 8978 }, 8979 d(detaching) { 8980 if (detaching) { 8981 detach(div); 8982 } 8983 8984 if_block.d(); 8985 } 8986 }; 8987} 8988 8989// (321:41) 8990function create_if_block_1(ctx) { 8991 let blocks; 8992 let updating_ready; 8993 let updating_render_complete; 8994 let current; 8995 8996 const blocks_spread_levels = [ 8997 { app: /*app*/ ctx[17] }, 8998 /*config*/ ctx[12], 8999 { 9000 fill_height: !/*is_embed*/ ctx[4] && /*config*/ ctx[12].fill_height 9001 }, 9002 { 9003 theme_mode: /*active_theme_mode*/ ctx[16] 9004 }, 9005 { 9006 control_page_title: /*control_page_title*/ ctx[5] 9007 }, 9008 { target: /*wrapper*/ ctx[9] }, 9009 { autoscroll: /*autoscroll*/ ctx[0] }, 9010 { show_footer: !/*is_embed*/ ctx[4] }, 9011 { app_mode: /*app_mode*/ ctx[3] }, 9012 { version: /*version*/ ctx[1] } 9013 ]; 9014 9015 function blocks_ready_binding(value) { 9016 /*blocks_ready_binding*/ ctx[34](value); 9017 } 9018 9019 function blocks_render_complete_binding(value) { 9020 /*blocks_render_complete_binding*/ ctx[35](value); 9021 } 9022 9023 let blocks_props = {}; 9024 9025 for (let i = 0; i < blocks_spread_levels.length; i += 1) { 9026 blocks_props = assign(blocks_props, blocks_spread_levels[i]); 9027 } 9028 9029 if (/*ready*/ ctx[10] !== void 0) { 9030 blocks_props.ready = /*ready*/ ctx[10]; 9031 } 9032 9033 if (/*render_complete*/ ctx[11] !== void 0) { 9034 blocks_props.render_complete = /*render_complete*/ ctx[11]; 9035 } 9036 9037 blocks = new /*Blocks*/ ctx[19]({ props: blocks_props }); 9038 binding_callbacks.push(() => bind(blocks, 'ready', blocks_ready_binding)); 9039 binding_callbacks.push(() => bind(blocks, 'render_complete', blocks_render_complete_binding)); 9040 9041 return { 9042 c() { 9043 create_component(blocks.$$.fragment); 9044 }, 9045 m(target, anchor) { 9046 mount_component(blocks, target, anchor); 9047 current = true; 9048 }, 9049 p(ctx, dirty) { 9050 const blocks_changes = (dirty[0] & /*app, config, is_embed, active_theme_mode, control_page_title, wrapper, autoscroll, app_mode, version*/ 201275) 9051 ? get_spread_update(blocks_spread_levels, [ 9052 dirty[0] & /*app*/ 131072 && { app: /*app*/ ctx[17] }, 9053 dirty[0] & /*config*/ 4096 && get_spread_object(/*config*/ ctx[12]), 9054 dirty[0] & /*is_embed, config*/ 4112 && { 9055 fill_height: !/*is_embed*/ ctx[4] && /*config*/ ctx[12].fill_height 9056 }, 9057 dirty[0] & /*active_theme_mode*/ 65536 && { 9058 theme_mode: /*active_theme_mode*/ ctx[16] 9059 }, 9060 dirty[0] & /*control_page_title*/ 32 && { 9061 control_page_title: /*control_page_title*/ ctx[5] 9062 }, 9063 dirty[0] & /*wrapper*/ 512 && { target: /*wrapper*/ ctx[9] }, 9064 dirty[0] & /*autoscroll*/ 1 && { autoscroll: /*autoscroll*/ ctx[0] }, 9065 dirty[0] & /*is_embed*/ 16 && { show_footer: !/*is_embed*/ ctx[4] }, 9066 dirty[0] & /*app_mode*/ 8 && { app_mode: /*app_mode*/ ctx[3] }, 9067 dirty[0] & /*version*/ 2 && { version: /*version*/ ctx[1] } 9068 ]) 9069 : {}; 9070 9071 if (!updating_ready && dirty[0] & /*ready*/ 1024) { 9072 updating_ready = true; 9073 blocks_changes.ready = /*ready*/ ctx[10]; 9074 add_flush_callback(() => updating_ready = false); 9075 } 9076 9077 if (!updating_render_complete && dirty[0] & /*render_complete*/ 2048) { 9078 updating_render_complete = true; 9079 blocks_changes.render_complete = /*render_complete*/ ctx[11]; 9080 add_flush_callback(() => updating_render_complete = false); 9081 } 9082 9083 blocks.$set(blocks_changes); 9084 }, 9085 i(local) { 9086 if (current) return; 9087 transition_in(blocks.$$.fragment, local); 9088 current = true; 9089 }, 9090 o(local) { 9091 transition_out(blocks.$$.fragment, local); 9092 current = false; 9093 }, 9094 d(detaching) { 9095 destroy_component(blocks, detaching); 9096 } 9097 }; 9098} 9099 9100// (314:1) {#if config?.auth_required && Login} 9101function create_if_block(ctx) { 9102 let login; 9103 let current; 9104 9105 login = new /*Login*/ ctx[20]({ 9106 props: { 9107 auth_message: /*config*/ ctx[12].auth_message, 9108 root: /*config*/ ctx[12].root, 9109 space_id: /*space*/ ctx[8], 9110 app_mode: /*app_mode*/ ctx[3] 9111 } 9112 }); 9113 9114 return { 9115 c() { 9116 create_component(login.$$.fragment); 9117 }, 9118 m(target, anchor) { 9119 mount_component(login, target, anchor); 9120 current = true; 9121 }, 9122 p(ctx, dirty) { 9123 const login_changes = {};
9124 if (dirty[0] & /*config*/ 4096) login_changes.auth_message = /*config*/ ctx[12].auth_message; 9125 if (dirty[0] & /*config*/ 4096) login_changes.root = /*config*/ ctx[12].root; 9126 if (dirty[0] & /*space*/ 256) login_changes.space_id = /*space*/ ctx[8]; 9127 if (dirty[0] & /*app_mode*/ 8) login_changes.app_mode = /*app_mode*/ ctx[3]; 9128 login.$set(login_changes); 9129 }, 9130 i(local) { 9131 if (current) return; 9132 transition_in(login.$$.fragment, local); 9133 current = true; 9134 }, 9135 o(local) { 9136 transition_out(login.$$.fragment, local); 9137 current = false; 9138 }, 9139 d(detaching) { 9140 destroy_component(login, detaching); 9141 } 9142 }; 9143} 9144 9145// (270:0) <Embed display={container && is_embed} {is_embed} info={!!space && info} {version} {initial_height} {space} loaded={loader_status === "complete"} bind:wrapper > 9146function create_default_slot(ctx) { 9147 let t; 9148 let current_block_type_index; 9149 let if_block1; 9150 let if_block1_anchor; 9151 let current; 9152 let if_block0 = (/*loader_status*/ ctx[14] === "pending" || /*loader_status*/ ctx[14] === "error") && !(/*config*/ ctx[12] && /*config*/ ctx[12]?.auth_required) && create_if_block_2(ctx); 9153 const if_block_creators = [create_if_block, create_if_block_1]; 9154 const if_blocks = []; 9155 9156 function select_block_type_1(ctx, dirty) { 9157 if (/*config*/ ctx[12]?.auth_required && /*Login*/ ctx[20]) return 0; 9158 if (/*config*/ ctx[12] && /*Blocks*/ ctx[19] && /*css_ready*/ ctx[18]) return 1; 9159 return -1; 9160 } 9161 9162 if (~(current_block_type_index = select_block_type_1(ctx))) { 9163 if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 9164 } 9165 9166 return { 9167 c() { 9168 if (if_block0) if_block0.c(); 9169 t = space_1(); 9170 if (if_block1) if_block1.c(); 9171 if_block1_anchor = empty(); 9172 }, 9173 m(target, anchor) { 9174 if (if_block0) if_block0.m(target, anchor); 9175 insert(target, t, anchor); 9176 9177 if (~current_block_type_index) { 9178 if_blocks[current_block_type_index].m(target, anchor); 9179 } 9180 9181 insert(target, if_block1_anchor, anchor); 9182 current = true; 9183 }, 9184 p(ctx, dirty) { 9185 if ((/*loader_status*/ ctx[14] === "pending" || /*loader_status*/ ctx[14] === "error") && !(/*config*/ ctx[12] && /*config*/ ctx[12]?.auth_required)) { 9186 if (if_block0) { 9187 if_block0.p(ctx, dirty); 9188 9189 if (dirty[0] & /*loader_status, config*/ 20480) { 9190 transition_in(if_block0, 1); 9191 } 9192 } else { 9193 if_block0 = create_if_block_2(ctx); 9194 if_block0.c(); 9195 transition_in(if_block0, 1); 9196 if_block0.m(t.parentNode, t); 9197 } 9198 } else if (if_block0) { 9199 group_outros(); 9200 9201 transition_out(if_block0, 1, 1, () => { 9202 if_block0 = null; 9203 }); 9204 9205 check_outros(); 9206 } 9207 9208 let previous_block_index = current_block_type_index; 9209 current_block_type_index = select_block_type_1(ctx); 9210 9211 if (current_block_type_index === previous_block_index) { 9212 if (~current_block_type_index) { 9213 if_blocks[current_block_type_index].p(ctx, dirty); 9214 } 9215 } else { 9216 if (if_block1) { 9217 group_outros(); 9218 9219 transition_out(if_blocks[previous_block_index], 1, 1, () => { 9220 if_blocks[previous_block_index] = null; 9221 }); 9222 9223 check_outros(); 9224 } 9225 9226 if (~current_block_type_index) { 9227 if_block1 = if_blocks[current_block_type_index]; 9228 9229 if (!if_block1) { 9230 if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 9231 if_block1.c(); 9232 } else { 9233 if_block1.p(ctx, dirty); 9234 } 9235 9236 transition_in(if_block1, 1); 9237 if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); 9238 } else { 9239 if_block1 = null; 9240 } 9241 } 9242 }, 9243 i(local) { 9244 if (current) return; 9245 transition_in(if_block0); 9246 transition_in(if_block1); 9247 current = true; 9248 }, 9249 o(local) { 9250 transition_out(if_block0); 9251 transition_out(if_block1); 9252 current = false; 9253 }, 9254 d(detaching) { 9255 if (detaching) { 9256 detach(t); 9257 detach(if_block1_anchor); 9258 } 9259 9260 if (if_block0) if_block0.d(detaching); 9261 9262 if (~current_block_type_index) { 9263 if_blocks[current_block_type_index].d(detaching); 9264 } 9265 } 9266 }; 9267} 9268 9269function create_fragment(ctx) { 9270 let embed; 9271 let updating_wrapper; 9272 let current; 9273 9274 function embed_wrapper_binding(value) { 9275 /*embed_wrapper_binding*/ ctx[36](value); 9276 } 9277 9278 let embed_props = { 9279 display: /*container*/ ctx[6] && /*is_embed*/ ctx[4], 9280 is_embed: /*is_embed*/ ctx[4], 9281 info: !!/*space*/ ctx[8] && /*info*/ ctx[7], 9282 version: /*version*/ ctx[1], 9283 initial_height: /*initial_height*/ ctx[2], 9284 space: /*space*/ ctx[8], 9285 loaded: /*loader_status*/ ctx[14] === "complete", 9286 $$slots: { default: [create_default_slot] }, 9287 $$scope: { ctx } 9288 }; 9289 9290 if (/*wrapper*/ ctx[9] !== void 0) { 9291 embed_props.wrapper = /*wrapper*/ ctx[9]; 9292 } 9293 9294 embed = new Embed({ props: embed_props }); 9295 binding_callbacks.push(() => bind(embed, 'wrapper', embed_wrapper_binding)); 9296 9297 return { 9298 c() { 9299 create_component(embed.$$.fragment); 9300 }, 9301 m(target, anchor) { 9302 mount_component(embed, target, anchor); 9303 current = true; 9304 }, 9305 p(ctx, dirty) { 9306 const embed_changes = {};
9307 if (dirty[0] & /*container, is_embed*/ 80) embed_changes.display = /*container*/ ctx[6] && /*is_embed*/ ctx[4]; 9308 if (dirty[0] & /*is_embed*/ 16) embed_changes.is_embed = /*is_embed*/ ctx[4]; 9309 if (dirty[0] & /*space, info*/ 384) embed_changes.info = !!/*space*/ ctx[8] && /*info*/ ctx[7]; 9310 if (dirty[0] & /*version*/ 2) embed_changes.version = /*version*/ ctx[1]; 9311 if (dirty[0] & /*initial_height*/ 4) embed_changes.initial_height = /*initial_height*/ ctx[2]; 9312 if (dirty[0] & /*space*/ 256) embed_changes.space = /*space*/ ctx[8]; 9313 if (dirty[0] & /*loader_status*/ 16384) embed_changes.loaded = /*loader_status*/ ctx[14] === "complete"; 9314 9315 if (dirty[0] & /*config, space, app_mode, Login, app, is_embed, active_theme_mode, control_page_title, wrapper, autoscroll, version, ready, render_complete, Blocks, css_ready, loader_status, loading_text, $_, status*/ 4194107 | dirty[1] & /*$$scope*/ 1048576) { 9316 embed_changes.$$scope = { dirty, ctx }; 9317 } 9318 9319 if (!updating_wrapper && dirty[0] & /*wrapper*/ 512) { 9320 updating_wrapper = true; 9321 embed_changes.wrapper = /*wrapper*/ ctx[9]; 9322 add_flush_callback(() => updating_wrapper = false); 9323 } 9324 9325 embed.$set(embed_changes); 9326 }, 9327 i(local) { 9328 if (current) return; 9329 transition_in(embed.$$.fragment, local); 9330 current = true; 9331 }, 9332 o(local) { 9333 transition_out(embed.$$.fragment, local); 9334 current = false; 9335 }, 9336 d(detaching) { 9337 destroy_component(embed, detaching); 9338 } 9339 }; 9340} 9341 9342let id = -1; 9343 9344function create_intersection_store() { 9345 const intersecting = writable({}); 9346 const els = new Map(); 9347 9348 const observer = new IntersectionObserver(entries => { 9349 entries.forEach(entry => { 9350 if (entry.isIntersecting) { 9351 let _el = els.get(entry.target); 9352 if (_el !== undefined) intersecting.update(s => ({ ...s, [_el]: true })); 9353 } 9354 }); 9355 }); 9356 9357 function register(_id, el) { 9358 els.set(el, _id); 9359 observer.observe(el); 9360 } 9361 9362 return { 9363 register, 9364 subscribe: intersecting.subscribe 9365 }; 9366} 9367 9368const intersecting = create_intersection_store(); 9369 9370async function add_custom_html_head(head_string) { 9371 if (head_string) { 9372 const parser = new DOMParser(); 9373 const parsed_head_html = Array.from(parser.parseFromString(head_string, "text/html").head.children); 9374 9375 if (parsed_head_html) { 9376 for (let head_element of parsed_head_html) { 9377 for (let head_element of parsed_head_html) { 9378 let newElement = document.createElement(head_element.tagName); 9379 9380 Array.from(head_element.attributes).forEach(attr => { 9381 newElement.setAttribute(attr.name, attr.value); 9382 }); 9383 9384 newElement.textContent = head_element.textContent; 9385 9386 if (newElement.tagName == "META" && newElement.getAttribute("property")) { 9387 const domMetaList = Array.from(document.head.getElementsByTagName("meta") ?? []); 9388 9389 const matched = domMetaList.find(el => { 9390 return el.getAttribute("property") == newElement.getAttribute("property") && !el.isEqualNode(newElement); 9391 }); 9392 9393 if (matched) { 9394 document.head.replaceChild(newElement, matched); 9395 continue; 9396 } 9397 } 9398 9399 document.head.appendChild(newElement); 9400 } 9401 } 9402 } 9403 } 9404} 9405 9406function instance($$self, $$props, $$invalidate) { 9407 let $_; 9408 let $intersecting; 9409 component_subscribe($$self, $format, $$value => $$invalidate(21, $_ = $$value)); 9410 component_subscribe($$self, intersecting, $$value => $$invalidate(33, $intersecting = $$value)); 9411 setupi18n(); 9412 const dispatch = createEventDispatcher(); 9413 let { autoscroll } = $$props; 9414 let { version } = $$props; 9415 let { initial_height } = $$props; 9416 let { app_mode } = $$props; 9417 let { is_embed } = $$props; 9418 let { theme_mode = "system" } = $$props; 9419 let { control_page_title } = $$props; 9420 let { container } = $$props; 9421 let { info } = $$props; 9422 let { eager } = $$props; 9423 let eventSource; 9424 let { mount_css: mount_css$1 = mount_css } = $$props; 9425 let { client } = $$props; 9426 let { upload_files } = $$props; 9427 let { worker_proxy = undefined } = $$props; 9428 9429 if (worker_proxy) { 9430 setWorkerProxyContext(worker_proxy); 9431 9432 worker_proxy.addEventListener("progress-update", event => { 9433 $$invalidate(15, loading_text = event.detail + "..."); 9434 }); 9435 } 9436 9437 let { fetch_implementation = fetch } = $$props; 9438 setContext("fetch_implementation", fetch_implementation); 9439 let { EventSource_factory = url => new EventSource(url) } = $$props; 9440 setContext("EventSource_factory", EventSource_factory); 9441 let { space } = $$props; 9442 let { host } = $$props; 9443 let { src } = $$props; 9444 let _id = id++; 9445 let loader_status = "pending"; 9446 let wrapper; 9447 let ready = false;
9448 let render_complete = false; 9449 let config; 9450 let loading_text = $_("common.loading") + "..."; 9451 let active_theme_mode; 9452 let api_url; 9453 let css_text_stylesheet = null; 9454 9455 async function mount_custom_css(css_string) { 9456 if (css_string) { 9457 css_text_stylesheet = prefix_css(css_string, version, css_text_stylesheet || undefined); 9458 } 9459 9460 await mount_css$1(config.root + "/theme.css", document.head); 9461 if (!config.stylesheets) return; 9462 9463 await Promise.all(config.stylesheets.map(stylesheet => { 9464 let absolute_link = stylesheet.startsWith("http:") || stylesheet.startsWith("https:"); 9465 9466 if (absolute_link) { 9467 return mount_css$1(stylesheet, document.head); 9468 } 9469 9470 return fetch(config.root + "/" + stylesheet).then(response => response.text()).then(css_string => { 9471 prefix_css(css_string, version); 9472 }); 9473 })); 9474 } 9475 9476 function handle_darkmode(target) { 9477 let url = new URL(window.location.toString()); 9478 let url_color_mode = url.searchParams.get("__theme"); 9479 $$invalidate(16, active_theme_mode = theme_mode || url_color_mode || "system"); 9480 9481 if (active_theme_mode === "dark" || active_theme_mode === "light") { 9482 darkmode(target, active_theme_mode); 9483 } else { 9484 $$invalidate(16, active_theme_mode = use_system_theme(target)); 9485 } 9486 9487 return active_theme_mode; 9488 } 9489 9490 function use_system_theme(target) { 9491 const theme = update_scheme(); 9492 window?.matchMedia("(prefers-color-scheme: dark)")?.addEventListener("change", update_scheme); 9493 9494 function update_scheme() { 9495 let _theme = (window?.matchMedia?.("(prefers-color-scheme: dark)").matches) 9496 ? "dark" 9497 : "light"; 9498 9499 darkmode(target, _theme); 9500 return _theme; 9501 } 9502 9503 return theme; 9504 } 9505 9506 function darkmode(target, theme) { 9507 const dark_class_element = is_embed ? target.parentElement : document.body; 9508 const bg_element = is_embed ? target : target.parentElement; 9509 bg_element.style.background = "var(--body-background-fill)"; 9510 9511 if (theme === "dark") { 9512 dark_class_element.classList.add("dark"); 9513 } else { 9514 dark_class_element.classList.remove("dark"); 9515 } 9516 } 9517 9518 let status = { 9519 message: "", 9520 load_status: "pending", 9521 status: "sleeping", 9522 detail: "SLEEPING" 9523 }; 9524 9525 let app; 9526 let css_ready = false; 9527 9528 function handle_status(_status) { 9529 $$invalidate(13, status = _status); 9530 } 9531 9532 onMount(async () => { 9533 if (window.__gradio_mode__ !== "website") { 9534 $$invalidate(16, active_theme_mode = handle_darkmode(wrapper)); 9535 } 9536 9537 //@ts-ignore 9538 const gradio_dev_mode = window.__GRADIO_DEV__; 9539 9540 //@ts-ignore 9541 const server_port = window.__GRADIO__SERVER_PORT__; 9542 9543 api_url = gradio_dev_mode === "dev" 9544 ? `http://localhost:${typeof server_port === "number" ? server_port : 7860}` 9545 : host || space || src || location.origin; 9546 9547 $$invalidate(17, app = await client(api_url, { status_callback: handle_status })); 9548 $$invalidate(12, config = app.config); 9549 window.__gradio_space__ = config.space_id; 9550 9551 $$invalidate(13, status = { 9552 message: "", 9553 load_status: "complete", 9554 status: "running", 9555 detail: "RUNNING" 9556 }); 9557 9558 await mount_custom_css(config.css); 9559 await add_custom_html_head(config.head); 9560 $$invalidate(18, css_ready = true); 9561 window.__is_colab__ = config.is_colab; 9562 dispatch("loaded"); 9563 9564 if (config.dev_mode) { 9565 setTimeout( 9566 () => { 9567 const { host } = new URL(api_url); 9568 let url = new URL(`http://${host}/dev/reload`); 9569 eventSource = new EventSource(url); 9570 9571 eventSource.onmessage = async function (event) { 9572 if (event.data === "CHANGE") { 9573 $$invalidate(17, app = await client(api_url, { status_callback: handle_status })); 9574 $$invalidate(12, config = app.config); 9575 window.__gradio_space__ = config.space_id; 9576 await mount_custom_css(config.css); 9577 } 9578 }; 9579 }, 9580 200 9581 ); 9582 } 9583 }); 9584 9585 setContext("upload_files", upload_files); 9586 let Blocks; 9587 let Login; 9588 9589 async function get_blocks() { 9590 $$invalidate(19, Blocks = (await __vitePreload(() => import('./Blocks-11034179.js').then(n => n.B),true?["./Blocks-11034179.js","./index-dc71b4a2.js","./index-33179a8d.css","./Button-ae8ac060.js","./Button-2a9911a9.css","./Blocks-2b5ac0cf.css"]:void 0,import.meta.url)).default); 9591 } 9592 9593 async function get_login() {
9594 $$invalidate(20, Login = (await __vitePreload(() => import('./Login-f03526e1.js'),true?["./Login-f03526e1.js","./Index-0d7ad3de.js","./Index-7ab72019.css","./Textbox-d78d0604.js","./Button-ae8ac060.js","./index-dc71b4a2.js","./index-33179a8d.css","./Button-2a9911a9.css","./BlockTitle-ceb1b9a7.js","./Info-c959cf91.js","./Check-f7edb5d9.js","./Copy-a69620a8.js","./Textbox-4c6022f4.css","./Index-24a33ce1.js","./Index-2abed479.css","./Login-e1405d21.css","./Example-e8628e88.css"]:void 0,import.meta.url)).default); 9595 } 9596 9597 function load_demo() { 9598 if (config.auth_required) get_login(); else get_blocks(); 9599 } 9600 9601 // todo @hannahblair: translate these messages 9602 const discussion_message = { 9603 readable_error: { 9604 NO_APP_FILE: $_("errors.no_app_file"), 9605 CONFIG_ERROR: $_("errors.config_error"), 9606 BUILD_ERROR: $_("errors.build_error"), 9607 RUNTIME_ERROR: $_("errors.runtime_error"), 9608 PAUSED: $_("errors.space_paused") 9609 }, 9610 title(error) { 9611 return encodeURIComponent($_("errors.space_not_working")); 9612 }, 9613 description(error, site) { 9614 return encodeURIComponent(`Hello,\n\nFirstly, thanks for creating this space!\n\nI noticed that the space isn't working correctly because there is ${this.readable_error[error] || "an error"}.\n\nIt would be great if you could take a look at this because this space is being embedded on ${site}.\n\nThanks!`); 9615 } 9616 }; 9617 9618 onMount(async () => { 9619 intersecting.register(_id, wrapper); 9620 }); 9621 9622 function blocks_ready_binding(value) { 9623 ready = value; 9624 $$invalidate(10, ready); 9625 } 9626 9627 function blocks_render_complete_binding(value) { 9628 render_complete = value; 9629 $$invalidate(11, render_complete); 9630 } 9631 9632 function embed_wrapper_binding(value) { 9633 wrapper = value; 9634 $$invalidate(9, wrapper); 9635 } 9636 9637 $$self.$$set = $$props => {
9638 if ('autoscroll' in $$props) $$invalidate(0, autoscroll = $$props.autoscroll); 9639 if ('version' in $$props) $$invalidate(1, version = $$props.version); 9640 if ('initial_height' in $$props) $$invalidate(2, initial_height = $$props.initial_height); 9641 if ('app_mode' in $$props) $$invalidate(3, app_mode = $$props.app_mode); 9642 if ('is_embed' in $$props) $$invalidate(4, is_embed = $$props.is_embed); 9643 if ('theme_mode' in $$props) $$invalidate(23, theme_mode = $$props.theme_mode); 9644 if ('control_page_title' in $$props) $$invalidate(5, control_page_title = $$props.control_page_title); 9645 if ('container' in $$props) $$invalidate(6, container = $$props.container); 9646 if ('info' in $$props) $$invalidate(7, info = $$props.info); 9647 if ('eager' in $$props) $$invalidate(24, eager = $$props.eager); 9648 if ('mount_css' in $$props) $$invalidate(25, mount_css$1 = $$props.mount_css); 9649 if ('client' in $$props) $$invalidate(26, client = $$props.client); 9650 if ('upload_files' in $$props) $$invalidate(27, upload_files = $$props.upload_files);
9651 if ('worker_proxy' in $$props) $$invalidate(28, worker_proxy = $$props.worker_proxy); 9652 if ('fetch_implementation' in $$props) $$invalidate(29, fetch_implementation = $$props.fetch_implementation); 9653 if ('EventSource_factory' in $$props) $$invalidate(30, EventSource_factory = $$props.EventSource_factory); 9654 if ('space' in $$props) $$invalidate(8, space = $$props.space); 9655 if ('host' in $$props) $$invalidate(31, host = $$props.host); 9656 if ('src' in $$props) $$invalidate(32, src = $$props.src); 9657 }; 9658 9659 $$self.$$.update = () => { 9660 if ($$self.$$.dirty[0] & /*config*/ 4096) { 9661 if (config?.app_id) { 9662 config.app_id; 9663 } 9664 } 9665 9666 if ($$self.$$.dirty[0] & /*ready, status*/ 9216) { 9667 $$invalidate(14, loader_status = !ready && status.load_status !== "error" 9668 ? "pending" 9669 : !ready && status.load_status === "error" 9670 ? "error" 9671 : status.load_status); 9672 } 9673 9674 if ($$self.$$.dirty[0] & /*config, eager*/ 16781312 | $$self.$$.dirty[1] & /*$intersecting*/ 4) { 9675 config && (eager || $intersecting[_id]) && load_demo(); 9676 } 9677 9678 if ($$self.$$.dirty[0] & /*render_complete, wrapper*/ 2560) { 9679 if (render_complete) { 9680 wrapper.dispatchEvent(new CustomEvent("render", 9681 { 9682 bubbles: true, 9683 cancelable: false, 9684 composed: true 9685 })); 9686 } 9687 } 9688 }; 9689 9690 return [ 9691 autoscroll, 9692 version, 9693 initial_height, 9694 app_mode, 9695 is_embed, 9696 control_page_title, 9697 container, 9698 info, 9699 space, 9700 wrapper, 9701 ready, 9702 render_complete, 9703 config, 9704 status, 9705 loader_status, 9706 loading_text, 9707 active_theme_mode, 9708 app, 9709 css_ready, 9710 Blocks, 9711 Login, 9712 $_, 9713 discussion_message, 9714 theme_mode, 9715 eager, 9716 mount_css$1, 9717 client, 9718 upload_files, 9719 worker_proxy, 9720 fetch_implementation, 9721 EventSource_factory, 9722 host, 9723 src, 9724 $intersecting, 9725 blocks_ready_binding, 9726 blocks_render_complete_binding, 9727 embed_wrapper_binding 9728 ]; 9729} 9730 9731class Index extends SvelteComponent { 9732 constructor(options) { 9733 super(); 9734 9735 init( 9736 this, 9737 options, 9738 instance, 9739 create_fragment, 9740 safe_not_equal, 9741 { 9742 autoscroll: 0, 9743 version: 1, 9744 initial_height: 2, 9745 app_mode: 3, 9746 is_embed: 4, 9747 theme_mode: 23, 9748 control_page_title: 5, 9749 container: 6, 9750 info: 7, 9751 eager: 24, 9752 mount_css: 25, 9753 client: 26, 9754 upload_files: 27, 9755 worker_proxy: 28, 9756 fetch_implementation: 29, 9757 EventSource_factory: 30, 9758 space: 8, 9759 host: 31, 9760 src: 32 9761 }, 9762 null, 9763 [-1, -1] 9764 ); 9765 } 9766} 9767 9768const Index$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 9769 __proto__: null, 9770 default: Index 9771}, Symbol.toStringTag, { value: 'Module' })); 9772 9773export { $format as $, Index$1 as I, Loader as L, Static as S, getDefaultExportFromCjs as a, is_function as b, commonjsGlobal as c, get_store_value as d, setupi18n as e, getAugmentedNamespace as f, getWorkerProxyContext as g, spring as h, identity as i, split_css_unit as s, writable as w }; 9774//# sourceMappingURL=Index-e8ffd830.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.