vendor: 1,531 bytes, lines 1-46
1var __create = Object.create; 2var __getProtoOf = Object.getPrototypeOf; 3var __defProp = Object.defineProperty; 4var __getOwnPropNames = Object.getOwnPropertyNames; 5var __hasOwnProp = Object.prototype.hasOwnProperty; 6function __accessProp(key) { 7 return this[key]; 8} 9var __toESMCache_node; 10var __toESMCache_esm; 11var __toESM = (mod, isNodeMode, target) => { 12 var canCache = mod != null && typeof mod === "object"; 13 if (canCache) { 14 var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap; 15 var cached = cache.get(mod); 16 if (cached) 17 return cached; 18 } 19 target = mod != null ? __create(__getProtoOf(mod)) : {}; 20 const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target; 21 for (let key of __getOwnPropNames(mod)) 22 if (!__hasOwnProp.call(to, key)) 23 __defProp(to, key, { 24 get: __accessProp.bind(mod, key), 25 enumerable: true 26 }); 27 if (canCache) 28 cache.set(mod, to); 29 return to; 30}; 31var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); 32var __returnValue = (v) => v; 33function __exportSetter(name, newValue) { 34 this[name] = __returnValue.bind(null, newValue); 35} 36var __export = (target, all) => { 37 for (var name in all) 38 __defProp(target, name, { 39 get: all[name], 40 enumerable: true, 41 configurable: true, 42 set: __exportSetter.bind(all, name) 43 }); 44}; 45var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res); 46
vendor: 278 bytes, lines 47-55
47// node_modules/@rails/actioncable/src/adapters.js 48var adapters_default; 49var init_adapters = __esm(() => { 50 adapters_default = { 51 logger: typeof console !== "undefined" ? console : undefined, 52 WebSocket: typeof WebSocket !== "undefined" ? WebSocket : undefined 53 }; 54}); 55
vendor: 316 bytes, lines 56-69
56// node_modules/@rails/actioncable/src/logger.js 57var logger_default; 58var init_logger = __esm(() => { 59 init_adapters(); 60 logger_default = { 61 log(...messages) { 62 if (this.enabled) { 63 messages.push(Date.now()); 64 adapters_default.logger.log("[ActionCable]", ...messages); 65 } 66 } 67 }; 68}); 69
vendor: 3,525 bytes, lines 70-169
70// node_modules/@rails/actioncable/src/connection_monitor.js 71class ConnectionMonitor { 72 constructor(connection) { 73 this.visibilityDidChange = this.visibilityDidChange.bind(this); 74 this.connection = connection; 75 this.reconnectAttempts = 0; 76 } 77 start() { 78 if (!this.isRunning()) { 79 this.startedAt = now(); 80 delete this.stoppedAt; 81 this.startPolling(); 82 addEventListener("visibilitychange", this.visibilityDidChange); 83 logger_default.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`); 84 } 85 } 86 stop() { 87 if (this.isRunning()) { 88 this.stoppedAt = now(); 89 this.stopPolling(); 90 removeEventListener("visibilitychange", this.visibilityDidChange); 91 logger_default.log("ConnectionMonitor stopped"); 92 } 93 } 94 isRunning() { 95 return this.startedAt && !this.stoppedAt; 96 } 97 recordPing() { 98 this.pingedAt = now(); 99 } 100 recordConnect() { 101 this.reconnectAttempts = 0; 102 this.recordPing(); 103 delete this.disconnectedAt; 104 logger_default.log("ConnectionMonitor recorded connect"); 105 } 106 recordDisconnect() { 107 this.disconnectedAt = now(); 108 logger_default.log("ConnectionMonitor recorded disconnect"); 109 } 110 startPolling() { 111 this.stopPolling(); 112 this.poll(); 113 } 114 stopPolling() { 115 clearTimeout(this.pollTimeout); 116 } 117 poll() { 118 this.pollTimeout = setTimeout(() => { 119 this.reconnectIfStale(); 120 this.poll(); 121 }, this.getPollInterval()); 122 } 123 getPollInterval() { 124 const { staleThreshold, reconnectionBackoffRate } = this.constructor; 125 const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10)); 126 const jitterMax = this.reconnectAttempts === 0 ? 1 : reconnectionBackoffRate; 127 const jitter = jitterMax * Math.random(); 128 return staleThreshold * 1000 * backoff * (1 + jitter); 129 } 130 reconnectIfStale() { 131 if (this.connectionIsStale()) { 132 logger_default.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`); 133 this.reconnectAttempts++; 134 if (this.disconnectedRecently()) { 135 logger_default.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`); 136 } else { 137 logger_default.log("ConnectionMonitor reopening"); 138 this.connection.reopen(); 139 } 140 } 141 } 142 get refreshedAt() { 143 return this.pingedAt ? this.pingedAt : this.startedAt; 144 } 145 connectionIsStale() { 146 return secondsSince(this.refreshedAt) > this.constructor.staleThreshold; 147 } 148 disconnectedRecently() { 149 return this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold; 150 } 151 visibilityDidChange() { 152 if (document.visibilityState === "visible") { 153 setTimeout(() => { 154 if (this.connectionIsStale() || !this.connection.isOpen()) { 155 logger_default.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`); 156 this.connection.reopen(); 157 } 158 }, 200); 159 } 160 } 161} 162var now = () => new Date().getTime(), secondsSince = (time) => (now() - time) / 1000, connection_monitor_default; 163var init_connection_monitor = __esm(() => { 164 init_logger(); 165 ConnectionMonitor.staleThreshold = 6; 166 ConnectionMonitor.reconnectionBackoffRate = 0.15; 167 connection_monitor_default = ConnectionMonitor; 168}); 169
vendor: 621 bytes, lines 170-194
170// node_modules/@rails/actioncable/src/internal.js 171var internal_default; 172var init_internal = __esm(() => { 173 internal_default = { 174 message_types: { 175 welcome: "welcome", 176 disconnect: "disconnect", 177 ping: "ping", 178 confirmation: "confirm_subscription", 179 rejection: "reject_subscription" 180 }, 181 disconnect_reasons: { 182 unauthorized: "unauthorized", 183 invalid_request: "invalid_request", 184 server_restart: "server_restart", 185 remote: "remote" 186 }, 187 default_mount_path: "/cable", 188 protocols: [ 189 "actioncable-v1-json", 190 "actioncable-unsupported" 191 ] 192 }; 193}); 194
vendor: 5,255 bytes, lines 195-358
195// node_modules/@rails/actioncable/src/connection.js 196class Connection { 197 constructor(consumer) { 198 this.open = this.open.bind(this); 199 this.consumer = consumer; 200 this.subscriptions = this.consumer.subscriptions; 201 this.monitor = new connection_monitor_default(this); 202 this.disconnected = true; 203 } 204 send(data) { 205 if (this.isOpen()) { 206 this.webSocket.send(JSON.stringify(data)); 207 return true; 208 } else { 209 return false; 210 } 211 } 212 open() { 213 if (this.isActive()) { 214 logger_default.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`); 215 return false; 216 } else { 217 const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]; 218 logger_default.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`); 219 if (this.webSocket) { 220 this.uninstallEventHandlers(); 221 } 222 this.webSocket = new adapters_default.WebSocket(this.consumer.url, socketProtocols); 223 this.installEventHandlers(); 224 this.monitor.start(); 225 return true; 226 } 227 } 228 close({ allowReconnect } = { allowReconnect: true }) { 229 if (!allowReconnect) { 230 this.monitor.stop(); 231 } 232 if (this.isOpen()) { 233 return this.webSocket.close(); 234 } 235 } 236 reopen() { 237 logger_default.log(`Reopening WebSocket, current state is ${this.getState()}`); 238 if (this.isActive()) { 239 try { 240 return this.close(); 241 } catch (error) { 242 logger_default.log("Failed to reopen WebSocket", error); 243 } finally { 244 logger_default.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`); 245 setTimeout(this.open, this.constructor.reopenDelay); 246 } 247 } else { 248 return this.open(); 249 } 250 } 251 getProtocol() { 252 if (this.webSocket) { 253 return this.webSocket.protocol; 254 } 255 } 256 isOpen() { 257 return this.isState("open"); 258 } 259 isActive() { 260 return this.isState("open", "connecting"); 261 } 262 triedToReconnect() { 263 return this.monitor.reconnectAttempts > 0; 264 } 265 isProtocolSupported() { 266 return indexOf.call(supportedProtocols, this.getProtocol()) >= 0; 267 } 268 isState(...states) { 269 return indexOf.call(states, this.getState()) >= 0; 270 } 271 getState() { 272 if (this.webSocket) { 273 for (let state in adapters_default.WebSocket) { 274 if (adapters_default.WebSocket[state] === this.webSocket.readyState) { 275 return state.toLowerCase(); 276 } 277 } 278 } 279 return null; 280 } 281 installEventHandlers() { 282 for (let eventName in this.events) { 283 const handler = this.events[eventName].bind(this); 284 this.webSocket[`on${eventName}`] = handler; 285 } 286 } 287 uninstallEventHandlers() { 288 for (let eventName in this.events) { 289 this.webSocket[`on${eventName}`] = function() {}; 290 } 291 } 292} 293var message_types, protocols, supportedProtocols, indexOf, connection_default; 294var init_connection = __esm(() => { 295 init_adapters(); 296 init_connection_monitor(); 297 init_internal(); 298 init_logger(); 299 ({ message_types, protocols } = internal_default); 300 supportedProtocols = protocols.slice(0, protocols.length - 1); 301 indexOf = [].indexOf; 302 Connection.reopenDelay = 500; 303 Connection.prototype.events = { 304 message(event) { 305 if (!this.isProtocolSupported()) { 306 return; 307 } 308 const { identifier, message, reason, reconnect, type } = JSON.parse(event.data); 309 switch (type) { 310 case message_types.welcome: 311 if (this.triedToReconnect()) { 312 this.reconnectAttempted = true; 313 } 314 this.monitor.recordConnect(); 315 return this.subscriptions.reload(); 316 case message_types.disconnect: 317 logger_default.log(`Disconnecting. Reason: ${reason}`); 318 return this.close({ allowReconnect: reconnect }); 319 case message_types.ping: 320 return this.monitor.recordPing(); 321 case message_types.confirmation: 322 this.subscriptions.confirmSubscription(identifier); 323 if (this.reconnectAttempted) { 324 this.reconnectAttempted = false; 325 return this.subscriptions.notify(identifier, "connected", { reconnected: true }); 326 } else { 327 return this.subscriptions.notify(identifier, "connected", { reconnected: false }); 328 } 329 case message_types.rejection: 330 return this.subscriptions.reject(identifier); 331 default: 332 return this.subscriptions.notify(identifier, "received", message); 333 } 334 }, 335 open() { 336 logger_default.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`); 337 this.disconnected = false; 338 if (!this.isProtocolSupported()) { 339 logger_default.log("Protocol is unsupported. Stopping monitor and disconnecting."); 340 return this.close({ allowReconnect: false }); 341 } 342 }, 343 close(event) { 344 logger_default.log("WebSocket onclose event"); 345 if (this.disconnected) { 346 return; 347 } 348 this.disconnected = true; 349 this.monitor.recordDisconnect(); 350 return this.subscriptions.notifyAll("disconnected", { willAttemptReconnect: this.monitor.isRunning() }); 351 }, 352 error() { 353 logger_default.log("WebSocket onerror event"); 354 } 355 }; 356 connection_default = Connection; 357}); 358
vendor: 725 bytes, lines 359-386
359// node_modules/@rails/actioncable/src/subscription.js 360class Subscription { 361 constructor(consumer, params = {}, mixin) { 362 this.consumer = consumer; 363 this.identifier = JSON.stringify(params); 364 extend(this, mixin); 365 } 366 perform(action, data = {}) { 367 data.action = action; 368 return this.send(data); 369 } 370 send(data) { 371 return this.consumer.send({ command: "message", identifier: this.identifier, data: JSON.stringify(data) }); 372 } 373 unsubscribe() { 374 return this.consumer.subscriptions.remove(this); 375 } 376} 377var extend = function(object, properties) { 378 if (properties != null) { 379 for (let key in properties) { 380 const value = properties[key]; 381 object[key] = value; 382 } 383 } 384 return object; 385}; 386
vendor: 1,516 bytes, lines 387-429
387// node_modules/@rails/actioncable/src/subscription_guarantor.js 388class SubscriptionGuarantor { 389 constructor(subscriptions) { 390 this.subscriptions = subscriptions; 391 this.pendingSubscriptions = []; 392 } 393 guarantee(subscription) { 394 if (this.pendingSubscriptions.indexOf(subscription) == -1) { 395 logger_default.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`); 396 this.pendingSubscriptions.push(subscription); 397 } else { 398 logger_default.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`); 399 } 400 this.startGuaranteeing(); 401 } 402 forget(subscription) { 403 logger_default.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`); 404 this.pendingSubscriptions = this.pendingSubscriptions.filter((s) => s !== subscription); 405 } 406 startGuaranteeing() { 407 this.stopGuaranteeing(); 408 this.retrySubscribing(); 409 } 410 stopGuaranteeing() { 411 clearTimeout(this.retryTimeout); 412 } 413 retrySubscribing() { 414 this.retryTimeout = setTimeout(() => { 415 if (this.subscriptions && typeof this.subscriptions.subscribe === "function") { 416 this.pendingSubscriptions.map((subscription) => { 417 logger_default.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`); 418 this.subscriptions.subscribe(subscription); 419 }); 420 } 421 }, 500); 422 } 423} 424var subscription_guarantor_default; 425var init_subscription_guarantor = __esm(() => { 426 init_logger(); 427 subscription_guarantor_default = SubscriptionGuarantor; 428}); 429
vendor: 2,562 bytes, lines 430-505
430// node_modules/@rails/actioncable/src/subscriptions.js 431class Subscriptions { 432 constructor(consumer) { 433 this.consumer = consumer; 434 this.guarantor = new subscription_guarantor_default(this); 435 this.subscriptions = []; 436 } 437 create(channelName, mixin) { 438 const channel = channelName; 439 const params = typeof channel === "object" ? channel : { channel }; 440 const subscription = new Subscription(this.consumer, params, mixin); 441 return this.add(subscription); 442 } 443 add(subscription) { 444 this.subscriptions.push(subscription); 445 this.consumer.ensureActiveConnection(); 446 this.notify(subscription, "initialized"); 447 this.subscribe(subscription); 448 return subscription; 449 } 450 remove(subscription) { 451 this.forget(subscription); 452 if (!this.findAll(subscription.identifier).length) { 453 this.sendCommand(subscription, "unsubscribe"); 454 } 455 return subscription; 456 } 457 reject(identifier) { 458 return this.findAll(identifier).map((subscription) => { 459 this.forget(subscription); 460 this.notify(subscription, "rejected"); 461 return subscription; 462 }); 463 } 464 forget(subscription) { 465 this.guarantor.forget(subscription); 466 this.subscriptions = this.subscriptions.filter((s) => s !== subscription); 467 return subscription; 468 } 469 findAll(identifier) { 470 return this.subscriptions.filter((s) => s.identifier === identifier); 471 } 472 reload() { 473 return this.subscriptions.map((subscription) => this.subscribe(subscription)); 474 } 475 notifyAll(callbackName, ...args) { 476 return this.subscriptions.map((subscription) => this.notify(subscription, callbackName, ...args)); 477 } 478 notify(subscription, callbackName, ...args) { 479 let subscriptions; 480 if (typeof subscription === "string") { 481 subscriptions = this.findAll(subscription); 482 } else { 483 subscriptions = [subscription]; 484 } 485 return subscriptions.map((subscription2) => typeof subscription2[callbackName] === "function" ? subscription2[callbackName](...args) : undefined); 486 } 487 subscribe(subscription) { 488 if (this.sendCommand(subscription, "subscribe")) { 489 this.guarantor.guarantee(subscription); 490 } 491 } 492 confirmSubscription(identifier) { 493 logger_default.log(`Subscription confirmed ${identifier}`); 494 this.findAll(identifier).map((subscription) => this.guarantor.forget(subscription)); 495 } 496 sendCommand(subscription, command) { 497 const { identifier } = subscription; 498 return this.consumer.send({ command, identifier }); 499 } 500} 501var init_subscriptions = __esm(() => { 502 init_subscription_guarantor(); 503 init_logger(); 504}); 505
vendor: 1,108 bytes, lines 506-553
506// node_modules/@rails/actioncable/src/consumer.js 507class Consumer { 508 constructor(url) { 509 this._url = url; 510 this.subscriptions = new Subscriptions(this); 511 this.connection = new connection_default(this); 512 this.subprotocols = []; 513 } 514 get url() { 515 return createWebSocketURL(this._url); 516 } 517 send(data) { 518 return this.connection.send(data); 519 } 520 connect() { 521 return this.connection.open(); 522 } 523 disconnect() { 524 return this.connection.close({ allowReconnect: false }); 525 } 526 ensureActiveConnection() { 527 if (!this.connection.isActive()) { 528 return this.connection.open(); 529 } 530 } 531 addSubProtocol(subprotocol) { 532 this.subprotocols = [...this.subprotocols, subprotocol]; 533 } 534} 535function createWebSocketURL(url) { 536 if (typeof url === "function") { 537 url = url(); 538 } 539 if (url && !/^wss?:/i.test(url)) { 540 const a = document.createElement("a"); 541 a.href = url; 542 a.href = a.href; 543 a.protocol = a.protocol.replace("http", "ws"); 544 return a.href; 545 } else { 546 return url; 547 } 548} 549var init_consumer = __esm(() => { 550 init_connection(); 551 init_subscriptions(); 552}); 553
vendor: 1,091 bytes, lines 554-589
554// node_modules/@rails/actioncable/src/index.js 555var exports_src = {}; 556__export(exports_src, { 557 logger: () => logger_default, 558 getConfig: () => getConfig, 559 createWebSocketURL: () => createWebSocketURL, 560 createConsumer: () => createConsumer, 561 adapters: () => adapters_default, 562 Subscriptions: () => Subscriptions, 563 SubscriptionGuarantor: () => subscription_guarantor_default, 564 Subscription: () => Subscription, 565 INTERNAL: () => internal_default, 566 Consumer: () => Consumer, 567 ConnectionMonitor: () => connection_monitor_default, 568 Connection: () => connection_default 569}); 570function createConsumer(url = getConfig("url") || internal_default.default_mount_path) { 571 return new Consumer(url); 572} 573function getConfig(name) { 574 const element = document.head.querySelector(`meta[name='action-cable-${name}']`); 575 if (element) { 576 return element.getAttribute("content"); 577 } 578} 579var init_src = __esm(() => { 580 init_connection(); 581 init_connection_monitor(); 582 init_consumer(); 583 init_internal(); 584 init_subscriptions(); 585 init_subscription_guarantor(); 586 init_adapters(); 587 init_logger(); 588}); 589
vendor: 215,445 bytes, lines 590-6423
590// node_modules/jquery/dist/jquery.js 591var require_jquery = __commonJS((exports, module) => { 592 /*! 593 * jQuery JavaScript Library v3.7.1 594 * https://jquery.com/ 595 * 596 * Copyright OpenJS Foundation and other contributors 597 * Released under the MIT license 598 * https://jquery.org/license 599 * 600 * Date: 2023-08-28T13:37Z 601 */ 602 (function(global, factory) { 603 if (typeof module === "object" && typeof module.exports === "object") { 604 module.exports = global.document ? factory(global, true) : function(w2) { 605 if (!w2.document) { 606 throw new Error("jQuery requires a window with a document"); 607 } 608 return factory(w2); 609 }; 610 } else { 611 factory(global); 612 } 613 })(typeof window !== "undefined" ? window : exports, function(window2, noGlobal) { 614 var arr = []; 615 var getProto = Object.getPrototypeOf; 616 var slice = arr.slice; 617 var flat = arr.flat ? function(array) { 618 return arr.flat.call(array); 619 } : function(array) { 620 return arr.concat.apply([], array); 621 }; 622 var push = arr.push; 623 var indexOf2 = arr.indexOf; 624 var class2type = {}; 625 var toString = class2type.toString; 626 var hasOwn = class2type.hasOwnProperty; 627 var fnToString = hasOwn.toString; 628 var ObjectFunctionString = fnToString.call(Object); 629 var support = {}; 630 var isFunction = function isFunction2(obj) { 631 return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function"; 632 }; 633 var isWindow = function isWindow2(obj) { 634 return obj != null && obj === obj.window; 635 }; 636 var document2 = window2.document; 637 var preservedScriptAttributes = { 638 type: true, 639 src: true, 640 nonce: true, 641 noModule: true 642 }; 643 function DOMEval(code, node, doc) { 644 doc = doc || document2; 645 var i, val, script = doc.createElement("script"); 646 script.text = code; 647 if (node) { 648 for (i in preservedScriptAttributes) { 649 val = node[i] || node.getAttribute && node.getAttribute(i); 650 if (val) { 651 script.setAttribute(i, val); 652 } 653 } 654 } 655 doc.head.appendChild(script).parentNode.removeChild(script); 656 } 657 function toType2(obj) { 658 if (obj == null) { 659 return obj + ""; 660 } 661 return typeof obj === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj; 662 } 663 var version = "3.7.1", rhtmlSuffix = /HTML$/i, jQuery2 = function(selector, context) { 664 return new jQuery2.fn.init(selector, context); 665 }; 666 jQuery2.fn = jQuery2.prototype = { 667 jquery: version, 668 constructor: jQuery2, 669 length: 0, 670 toArray: function() { 671 return slice.call(this); 672 }, 673 get: function(num) { 674 if (num == null) { 675 return slice.call(this); 676 } 677 return num < 0 ? this[num + this.length] : this[num]; 678 }, 679 pushStack: function(elems) { 680 var ret = jQuery2.merge(this.constructor(), elems); 681 ret.prevObject = this; 682 return ret; 683 }, 684 each: function(callback) { 685 return jQuery2.each(this, callback); 686 }, 687 map: function(callback) { 688 return this.pushStack(jQuery2.map(this, function(elem, i) { 689 return callback.call(elem, i, elem); 690 })); 691 }, 692 slice: function() { 693 return this.pushStack(slice.apply(this, arguments)); 694 }, 695 first: function() { 696 return this.eq(0); 697 }, 698 last: function() { 699 return this.eq(-1); 700 }, 701 even: function() { 702 return this.pushStack(jQuery2.grep(this, function(_elem, i) { 703 return (i + 1) % 2; 704 })); 705 }, 706 odd: function() { 707 return this.pushStack(jQuery2.grep(this, function(_elem, i) { 708 return i % 2; 709 })); 710 }, 711 eq: function(i) { 712 var len = this.length, j = +i + (i < 0 ? len : 0); 713 return this.pushStack(j >= 0 && j < len ? [this[j]] : []); 714 }, 715 end: function() { 716 return this.prevObject || this.constructor(); 717 }, 718 push, 719 sort: arr.sort, 720 splice: arr.splice 721 }; 722 jQuery2.extend = jQuery2.fn.extend = function() { 723 var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; 724 if (typeof target === "boolean") { 725 deep = target; 726 target = arguments[i] || {}; 727 i++; 728 } 729 if (typeof target !== "object" && !isFunction(target)) { 730 target = {}; 731 } 732 if (i === length) { 733 target = this; 734 i--; 735 } 736 for (;i < length; i++) { 737 if ((options = arguments[i]) != null) { 738 for (name in options) { 739 copy = options[name]; 740 if (name === "__proto__" || target === copy) { 741 continue; 742 } 743 if (deep && copy && (jQuery2.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) { 744 src = target[name]; 745 if (copyIsArray && !Array.isArray(src)) { 746 clone = []; 747 } else if (!copyIsArray && !jQuery2.isPlainObject(src)) { 748 clone = {}; 749 } else { 750 clone = src; 751 } 752 copyIsArray = false; 753 target[name] = jQuery2.extend(deep, clone, copy); 754 } else if (copy !== undefined) { 755 target[name] = copy; 756 } 757 } 758 } 759 } 760 return target; 761 }; 762 jQuery2.extend({ 763 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), 764 isReady: true, 765 error: function(msg) { 766 throw new Error(msg); 767 }, 768 noop: function() {}, 769 isPlainObject: function(obj) { 770 var proto, Ctor; 771 if (!obj || toString.call(obj) !== "[object Object]") { 772 return false; 773 } 774 proto = getProto(obj); 775 if (!proto) { 776 return true; 777 } 778 Ctor = hasOwn.call(proto, "constructor") && proto.constructor; 779 return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; 780 }, 781 isEmptyObject: function(obj) { 782 var name; 783 for (name in obj) { 784 return false; 785 } 786 return true; 787 }, 788 globalEval: function(code, options, doc) { 789 DOMEval(code, { nonce: options && options.nonce }, doc); 790 }, 791 each: function(obj, callback) { 792 var length, i = 0; 793 if (isArrayLike(obj)) { 794 length = obj.length; 795 for (;i < length; i++) { 796 if (callback.call(obj[i], i, obj[i]) === false) { 797 break; 798 } 799 } 800 } else { 801 for (i in obj) { 802 if (callback.call(obj[i], i, obj[i]) === false) { 803 break; 804 } 805 } 806 } 807 return obj; 808 }, 809 text: function(elem) { 810 var node, ret = "", i = 0, nodeType = elem.nodeType; 811 if (!nodeType) { 812 while (node = elem[i++]) { 813 ret += jQuery2.text(node); 814 } 815 } 816 if (nodeType === 1 || nodeType === 11) { 817 return elem.textContent; 818 } 819 if (nodeType === 9) { 820 return elem.documentElement.textContent; 821 } 822 if (nodeType === 3 || nodeType === 4) { 823 return elem.nodeValue; 824 } 825 return ret; 826 }, 827 makeArray: function(arr2, results) { 828 var ret = results || []; 829 if (arr2 != null) { 830 if (isArrayLike(Object(arr2))) { 831 jQuery2.merge(ret, typeof arr2 === "string" ? [arr2] : arr2); 832 } else { 833 push.call(ret, arr2); 834 } 835 } 836 return ret; 837 }, 838 inArray: function(elem, arr2, i) { 839 return arr2 == null ? -1 : indexOf2.call(arr2, elem, i); 840 }, 841 isXMLDoc: function(elem) { 842 var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement; 843 return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML"); 844 }, 845 merge: function(first, second) { 846 var len = +second.length, j = 0, i = first.length; 847 for (;j < len; j++) { 848 first[i++] = second[j]; 849 } 850 first.length = i; 851 return first; 852 }, 853 grep: function(elems, callback, invert) { 854 var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; 855 for (;i < length; i++) { 856 callbackInverse = !callback(elems[i], i); 857 if (callbackInverse !== callbackExpect) { 858 matches.push(elems[i]); 859 } 860 } 861 return matches; 862 }, 863 map: function(elems, callback, arg) { 864 var length, value, i = 0, ret = []; 865 if (isArrayLike(elems)) { 866 length = elems.length; 867 for (;i < length; i++) { 868 value = callback(elems[i], i, arg); 869 if (value != null) { 870 ret.push(value); 871 } 872 } 873 } else { 874 for (i in elems) { 875 value = callback(elems[i], i, arg); 876 if (value != null) { 877 ret.push(value); 878 } 879 } 880 } 881 return flat(ret); 882 }, 883 guid: 1, 884 support 885 }); 886 if (typeof Symbol === "function") { 887 jQuery2.fn[Symbol.iterator] = arr[Symbol.iterator]; 888 } 889 jQuery2.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(_i, name) { 890 class2type["[object " + name + "]"] = name.toLowerCase(); 891 }); 892 function isArrayLike(obj) { 893 var length = !!obj && "length" in obj && obj.length, type = toType2(obj); 894 if (isFunction(obj) || isWindow(obj)) { 895 return false; 896 } 897 return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj; 898 } 899 function nodeName(elem, name) { 900 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 901 } 902 var pop = arr.pop; 903 var sort = arr.sort; 904 var splice = arr.splice; 905 var whitespace = "[\\x20\\t\\r\\n\\f]"; 906 var rtrimCSS = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"); 907 jQuery2.contains = function(a, b2) { 908 var bup = b2 && b2.parentNode; 909 return a === bup || !!(bup && bup.nodeType === 1 && (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); 910 }; 911 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 912 function fcssescape(ch, asCodePoint) { 913 if (asCodePoint) { 914 if (ch === "\x00") { 915 return "�"; 916 } 917 return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " "; 918 } 919 return "\\" + ch; 920 } 921 jQuery2.escapeSelector = function(sel) { 922 return (sel + "").replace(rcssescape, fcssescape); 923 }; 924 var preferredDoc = document2, pushNative = push; 925 (function() { 926 var i, Expr, outermostContext, sortInput, hasDuplicate, push2 = pushNative, document3, documentElement2, documentIsHTML, rbuggyQSA, matches, expando = jQuery2.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b2) { 927 if (a === b2) { 928 hasDuplicate = true; 929 } 930 return 0; 931 }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + "loop|multiple|open|readonly|required|scoped", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\x00-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + `('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|` + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + ".*" + ")\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = { 932 ID: new RegExp("^#(" + identifier + ")"), 933 CLASS: new RegExp("^\\.(" + identifier + ")"), 934 TAG: new RegExp("^(" + identifier + "|[*])"), 935 ATTR: new RegExp("^" + attributes), 936 PSEUDO: new RegExp("^" + pseudos), 937 CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 938 bool: new RegExp("^(?:" + booleans + ")$", "i"), 939 needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 940 }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape, nonHex) { 941 var high = "0x" + escape.slice(1) - 65536; 942 if (nonHex) { 943 return nonHex; 944 } 945 return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); 946 }, unloadHandler = function() { 947 setDocument(); 948 }, inDisabledFieldset = addCombinator(function(elem) { 949 return elem.disabled === true && nodeName(elem, "fieldset"); 950 }, { dir: "parentNode", next: "legend" }); 951 function safeActiveElement() { 952 try { 953 return document3.activeElement; 954 } catch (err) {} 955 } 956 try { 957 push2.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); 958 arr[preferredDoc.childNodes.length].nodeType; 959 } catch (e) { 960 push2 = { 961 apply: function(target, els) { 962 pushNative.apply(target, slice.call(els)); 963 }, 964 call: function(target) { 965 pushNative.apply(target, slice.call(arguments, 1)); 966 } 967 }; 968 } 969 function find(selector, context, results, seed) { 970 var m2, i2, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9; 971 results = results || []; 972 if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { 973 return results; 974 } 975 if (!seed) { 976 setDocument(context); 977 context = context || document3; 978 if (documentIsHTML) { 979 if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) { 980 if (m2 = match[1]) { 981 if (nodeType === 9) { 982 if (elem = context.getElementById(m2)) { 983 if (elem.id === m2) { 984 push2.call(results, elem); 985 return results; 986 } 987 } else { 988 return results; 989 } 990 } else { 991 if (newContext && (elem = newContext.getElementById(m2)) && find.contains(context, elem) && elem.id === m2) { 992 push2.call(results, elem); 993 return results; 994 } 995 } 996 } else if (match[2]) { 997 push2.apply(results, context.getElementsByTagName(selector)); 998 return results; 999 } else if ((m2 = match[3]) && context.getElementsByClassName) { 1000 push2.apply(results, context.getElementsByClassName(m2)); 1001 return results; 1002 } 1003 } 1004 if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) { 1005 newSelector = selector; 1006 newContext = context; 1007 if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) { 1008 newContext = rsibling.test(selector) && testContext(context.parentNode) || context; 1009 if (newContext != context || !support.scope) { 1010 if (nid = context.getAttribute("id")) { 1011 nid = jQuery2.escapeSelector(nid); 1012 } else { 1013 context.setAttribute("id", nid = expando); 1014 } 1015 } 1016 groups = tokenize2(selector); 1017 i2 = groups.length; 1018 while (i2--) { 1019 groups[i2] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i2]); 1020 } 1021 newSelector = groups.join(","); 1022 } 1023 try { 1024 push2.apply(results, newContext.querySelectorAll(newSelector)); 1025 return results; 1026 } catch (qsaError) { 1027 nonnativeSelectorCache(selector, true); 1028 } finally { 1029 if (nid === expando) { 1030 context.removeAttribute("id"); 1031 } 1032 } 1033 } 1034 } 1035 } 1036 return select(selector.replace(rtrimCSS, "$1"), context, results, seed); 1037 } 1038 function createCache() { 1039 var keys = []; 1040 function cache2(key, value) { 1041 if (keys.push(key + " ") > Expr.cacheLength) { 1042 delete cache2[keys.shift()]; 1043 } 1044 return cache2[key + " "] = value; 1045 } 1046 return cache2; 1047 } 1048 function markFunction(fn2) { 1049 fn2[expando] = true; 1050 return fn2; 1051 } 1052 function assert(fn2) { 1053 var el = document3.createElement("fieldset"); 1054 try { 1055 return !!fn2(el); 1056 } catch (e) { 1057 return false; 1058 } finally { 1059 if (el.parentNode) { 1060 el.parentNode.removeChild(el); 1061 } 1062 el = null; 1063 } 1064 } 1065 function createInputPseudo(type) { 1066 return function(elem) { 1067 return nodeName(elem, "input") && elem.type === type; 1068 }; 1069 } 1070 function createButtonPseudo(type) { 1071 return function(elem) { 1072 return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type; 1073 }; 1074 } 1075 function createDisabledPseudo(disabled) { 1076 return function(elem) { 1077 if ("form" in elem) { 1078 if (elem.parentNode && elem.disabled === false) { 1079 if ("label" in elem) { 1080 if ("label" in elem.parentNode) { 1081 return elem.parentNode.disabled === disabled; 1082 } else { 1083 return elem.disabled === disabled; 1084 } 1085 } 1086 return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled; 1087 } 1088 return elem.disabled === disabled; 1089 } else if ("label" in elem) { 1090 return elem.disabled === disabled; 1091 } 1092 return false; 1093 }; 1094 } 1095 function createPositionalPseudo(fn2) { 1096 return markFunction(function(argument) { 1097 argument = +argument; 1098 return markFunction(function(seed, matches2) { 1099 var j, matchIndexes = fn2([], seed.length, argument), i2 = matchIndexes.length; 1100 while (i2--) { 1101 if (seed[j = matchIndexes[i2]]) { 1102 seed[j] = !(matches2[j] = seed[j]); 1103 } 1104 } 1105 }); 1106 }); 1107 } 1108 function testContext(context) { 1109 return context && typeof context.getElementsByTagName !== "undefined" && context; 1110 } 1111 function setDocument(node) { 1112 var subWindow, doc = node ? node.ownerDocument || node : preferredDoc; 1113 if (doc == document3 || doc.nodeType !== 9 || !doc.documentElement) { 1114 return document3; 1115 } 1116 document3 = doc; 1117 documentElement2 = document3.documentElement; 1118 documentIsHTML = !jQuery2.isXMLDoc(document3); 1119 matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector; 1120 if (documentElement2.msMatchesSelector && preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) { 1121 subWindow.addEventListener("unload", unloadHandler); 1122 } 1123 support.getById = assert(function(el) { 1124 documentElement2.appendChild(el).id = jQuery2.expando; 1125 return !document3.getElementsByName || !document3.getElementsByName(jQuery2.expando).length; 1126 }); 1127 support.disconnectedMatch = assert(function(el) { 1128 return matches.call(el, "*"); 1129 }); 1130 support.scope = assert(function() { 1131 return document3.querySelectorAll(":scope"); 1132 }); 1133 support.cssHas = assert(function() { 1134 try { 1135 document3.querySelector(":has(*,:jqfake)"); 1136 return false; 1137 } catch (e) { 1138 return true; 1139 } 1140 }); 1141 if (support.getById) { 1142 Expr.filter.ID = function(id) { 1143 var attrId = id.replace(runescape, funescape); 1144 return function(elem) { 1145 return elem.getAttribute("id") === attrId; 1146 }; 1147 }; 1148 Expr.find.ID = function(id, context) { 1149 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 1150 var elem = context.getElementById(id); 1151 return elem ? [elem] : []; 1152 } 1153 }; 1154 } else { 1155 Expr.filter.ID = function(id) { 1156 var attrId = id.replace(runescape, funescape); 1157 return function(elem) { 1158 var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); 1159 return node2 && node2.value === attrId; 1160 }; 1161 }; 1162 Expr.find.ID = function(id, context) { 1163 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 1164 var node2, i2, elems, elem = context.getElementById(id); 1165 if (elem) { 1166 node2 = elem.getAttributeNode("id"); 1167 if (node2 && node2.value === id) { 1168 return [elem]; 1169 } 1170 elems = context.getElementsByName(id); 1171 i2 = 0; 1172 while (elem = elems[i2++]) { 1173 node2 = elem.getAttributeNode("id"); 1174 if (node2 && node2.value === id) { 1175 return [elem]; 1176 } 1177 } 1178 } 1179 return []; 1180 } 1181 }; 1182 } 1183 Expr.find.TAG = function(tag, context) { 1184 if (typeof context.getElementsByTagName !== "undefined") { 1185 return context.getElementsByTagName(tag); 1186 } else { 1187 return context.querySelectorAll(tag); 1188 } 1189 }; 1190 Expr.find.CLASS = function(className, context) { 1191 if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) { 1192 return context.getElementsByClassName(className); 1193 } 1194 }; 1195 rbuggyQSA = []; 1196 assert(function(el) { 1197 var input; 1198 documentElement2.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a>" + "<select id='" + expando + "-\r\\' disabled='disabled'>" + "<option selected=''></option></select>"; 1199 if (!el.querySelectorAll("[selected]").length) { 1200 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 1201 } 1202 if (!el.querySelectorAll("[id~=" + expando + "-]").length) { 1203 rbuggyQSA.push("~="); 1204 } 1205 if (!el.querySelectorAll("a#" + expando + "+*").length) { 1206 rbuggyQSA.push(".#.+[+~]"); 1207 } 1208 if (!el.querySelectorAll(":checked").length) { 1209 rbuggyQSA.push(":checked"); 1210 } 1211 input = document3.createElement("input"); 1212 input.setAttribute("type", "hidden"); 1213 el.appendChild(input).setAttribute("name", "D"); 1214 documentElement2.appendChild(el).disabled = true; 1215 if (el.querySelectorAll(":disabled").length !== 2) { 1216 rbuggyQSA.push(":enabled", ":disabled"); 1217 } 1218 input = document3.createElement("input"); 1219 input.setAttribute("name", ""); 1220 el.appendChild(input); 1221 if (!el.querySelectorAll("[name='']").length) { 1222 rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`); 1223 } 1224 }); 1225 if (!support.cssHas) { 1226 rbuggyQSA.push(":has"); 1227 } 1228 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 1229 sortOrder = function(a, b2) { 1230 if (a === b2) { 1231 hasDuplicate = true; 1232 return 0; 1233 } 1234 var compare = !a.compareDocumentPosition - !b2.compareDocumentPosition; 1235 if (compare) { 1236 return compare; 1237 } 1238 compare = (a.ownerDocument || a) == (b2.ownerDocument || b2) ? a.compareDocumentPosition(b2) : 1; 1239 if (compare & 1 || !support.sortDetached && b2.compareDocumentPosition(a) === compare) { 1240 if (a === document3 || a.ownerDocument == preferredDoc && find.contains(preferredDoc, a)) { 1241 return -1; 1242 } 1243 if (b2 === document3 || b2.ownerDocument == preferredDoc && find.contains(preferredDoc, b2)) { 1244 return 1; 1245 } 1246 return sortInput ? indexOf2.call(sortInput, a) - indexOf2.call(sortInput, b2) : 0; 1247 } 1248 return compare & 4 ? -1 : 1; 1249 }; 1250 return document3; 1251 } 1252 find.matches = function(expr, elements) { 1253 return find(expr, null, null, elements); 1254 }; 1255 find.matchesSelector = function(elem, expr) { 1256 setDocument(elem); 1257 if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) { 1258 try { 1259 var ret = matches.call(elem, expr); 1260 if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { 1261 return ret; 1262 } 1263 } catch (e) { 1264 nonnativeSelectorCache(expr, true); 1265 } 1266 } 1267 return find(expr, document3, null, [elem]).length > 0; 1268 }; 1269 find.contains = function(context, elem) { 1270 if ((context.ownerDocument || context) != document3) { 1271 setDocument(context); 1272 } 1273 return jQuery2.contains(context, elem); 1274 }; 1275 find.attr = function(elem, name) { 1276 if ((elem.ownerDocument || elem) != document3) { 1277 setDocument(elem); 1278 } 1279 var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : undefined; 1280 if (val !== undefined) { 1281 return val; 1282 } 1283 return elem.getAttribute(name); 1284 }; 1285 find.error = function(msg) { 1286 throw new Error("Syntax error, unrecognized expression: " + msg); 1287 }; 1288 jQuery2.uniqueSort = function(results) { 1289 var elem, duplicates = [], j = 0, i2 = 0; 1290 hasDuplicate = !support.sortStable; 1291 sortInput = !support.sortStable && slice.call(results, 0); 1292 sort.call(results, sortOrder); 1293 if (hasDuplicate) { 1294 while (elem = results[i2++]) { 1295 if (elem === results[i2]) { 1296 j = duplicates.push(i2); 1297 } 1298 } 1299 while (j--) { 1300 splice.call(results, duplicates[j], 1); 1301 } 1302 } 1303 sortInput = null; 1304 return results; 1305 }; 1306 jQuery2.fn.uniqueSort = function() { 1307 return this.pushStack(jQuery2.uniqueSort(slice.apply(this))); 1308 }; 1309 Expr = jQuery2.expr = { 1310 cacheLength: 50, 1311 createPseudo: markFunction, 1312 match: matchExpr, 1313 attrHandle: {}, 1314 find: {}, 1315 relative: { 1316 ">": { dir: "parentNode", first: true }, 1317 " ": { dir: "parentNode" }, 1318 "+": { dir: "previousSibling", first: true }, 1319 "~": { dir: "previousSibling" } 1320 }, 1321 preFilter: { 1322 ATTR: function(match) { 1323 match[1] = match[1].replace(runescape, funescape); 1324 match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape); 1325 if (match[2] === "~=") { 1326 match[3] = " " + match[3] + " "; 1327 } 1328 return match.slice(0, 4); 1329 }, 1330 CHILD: function(match) { 1331 match[1] = match[1].toLowerCase(); 1332 if (match[1].slice(0, 3) === "nth") { 1333 if (!match[3]) { 1334 find.error(match[0]); 1335 } 1336 match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd")); 1337 match[5] = +(match[7] + match[8] || match[3] === "odd"); 1338 } else if (match[3]) { 1339 find.error(match[0]); 1340 } 1341 return match; 1342 }, 1343 PSEUDO: function(match) { 1344 var excess, unquoted = !match[6] && match[2]; 1345 if (matchExpr.CHILD.test(match[0])) { 1346 return null; 1347 } 1348 if (match[3]) { 1349 match[2] = match[4] || match[5] || ""; 1350 } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize2(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 1351 match[0] = match[0].slice(0, excess); 1352 match[2] = unquoted.slice(0, excess); 1353 } 1354 return match.slice(0, 3); 1355 } 1356 }, 1357 filter: { 1358 TAG: function(nodeNameSelector) { 1359 var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 1360 return nodeNameSelector === "*" ? function() { 1361 return true; 1362 } : function(elem) { 1363 return nodeName(elem, expectedNodeName); 1364 }; 1365 }, 1366 CLASS: function(className) { 1367 var pattern = classCache[className + " "]; 1368 return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) { 1369 return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""); 1370 }); 1371 }, 1372 ATTR: function(name, operator, check) { 1373 return function(elem) { 1374 var result = find.attr(elem, name); 1375 if (result == null) { 1376 return operator === "!="; 1377 } 1378 if (!operator) { 1379 return true; 1380 } 1381 result += ""; 1382 if (operator === "=") { 1383 return result === check; 1384 } 1385 if (operator === "!=") { 1386 return result !== check; 1387 } 1388 if (operator === "^=") { 1389 return check && result.indexOf(check) === 0; 1390 } 1391 if (operator === "*=") { 1392 return check && result.indexOf(check) > -1; 1393 } 1394 if (operator === "$=") { 1395 return check && result.slice(-check.length) === check; 1396 } 1397 if (operator === "~=") { 1398 return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1; 1399 } 1400 if (operator === "|=") { 1401 return result === check || result.slice(0, check.length + 1) === check + "-"; 1402 } 1403 return false; 1404 }; 1405 }, 1406 CHILD: function(type, what, _argument, first, last) { 1407 var simple = type.slice(0, 3) !== "nth", forward = type.slice(-4) !== "last", ofType = what === "of-type"; 1408 return first === 1 && last === 0 ? function(elem) { 1409 return !!elem.parentNode; 1410 } : function(elem, _context, xml) { 1411 var cache2, outerCache, node, nodeIndex, start3, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; 1412 if (parent) { 1413 if (simple) { 1414 while (dir2) { 1415 node = elem; 1416 while (node = node[dir2]) { 1417 if (ofType ? nodeName(node, name) : node.nodeType === 1) { 1418 return false; 1419 } 1420 } 1421 start3 = dir2 = type === "only" && !start3 && "nextSibling"; 1422 } 1423 return true; 1424 } 1425 start3 = [forward ? parent.firstChild : parent.lastChild]; 1426 if (forward && useCache) { 1427 outerCache = parent[expando] || (parent[expando] = {}); 1428 cache2 = outerCache[type] || []; 1429 nodeIndex = cache2[0] === dirruns && cache2[1]; 1430 diff = nodeIndex && cache2[2]; 1431 node = nodeIndex && parent.childNodes[nodeIndex]; 1432 while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start3.pop()) { 1433 if (node.nodeType === 1 && ++diff && node === elem) { 1434 outerCache[type] = [dirruns, nodeIndex, diff]; 1435 break; 1436 } 1437 } 1438 } else { 1439 if (useCache) { 1440 outerCache = elem[expando] || (elem[expando] = {}); 1441 cache2 = outerCache[type] || []; 1442 nodeIndex = cache2[0] === dirruns && cache2[1]; 1443 diff = nodeIndex; 1444 } 1445 if (diff === false) { 1446 while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start3.pop()) { 1447 if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) { 1448 if (useCache) { 1449 outerCache = node[expando] || (node[expando] = {}); 1450 outerCache[type] = [dirruns, diff]; 1451 } 1452 if (node === elem) { 1453 break; 1454 } 1455 } 1456 } 1457 } 1458 } 1459 diff -= last; 1460 return diff === first || diff % first === 0 && diff / first >= 0; 1461 } 1462 }; 1463 }, 1464 PSEUDO: function(pseudo, argument) { 1465 var args, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find.error("unsupported pseudo: " + pseudo); 1466 if (fn2[expando]) { 1467 return fn2(argument); 1468 } 1469 if (fn2.length > 1) { 1470 args = [pseudo, pseudo, "", argument]; 1471 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) { 1472 var idx, matched = fn2(seed, argument), i2 = matched.length; 1473 while (i2--) { 1474 idx = indexOf2.call(seed, matched[i2]); 1475 seed[idx] = !(matches2[idx] = matched[i2]); 1476 } 1477 }) : function(elem) { 1478 return fn2(elem, 0, args); 1479 }; 1480 } 1481 return fn2; 1482 } 1483 }, 1484 pseudos: { 1485 not: markFunction(function(selector) { 1486 var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1")); 1487 return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) { 1488 var elem, unmatched = matcher(seed, null, xml, []), i2 = seed.length; 1489 while (i2--) { 1490 if (elem = unmatched[i2]) { 1491 seed[i2] = !(matches2[i2] = elem); 1492 } 1493 } 1494 }) : function(elem, _context, xml) { 1495 input[0] = elem; 1496 matcher(input, null, xml, results); 1497 input[0] = null; 1498 return !results.pop(); 1499 }; 1500 }), 1501 has: markFunction(function(selector) { 1502 return function(elem) { 1503 return find(selector, elem).length > 0; 1504 }; 1505 }), 1506 contains: markFunction(function(text) { 1507 text = text.replace(runescape, funescape); 1508 return function(elem) { 1509 return (elem.textContent || jQuery2.text(elem)).indexOf(text) > -1; 1510 }; 1511 }), 1512 lang: markFunction(function(lang) { 1513 if (!ridentifier.test(lang || "")) { 1514 find.error("unsupported lang: " + lang); 1515 } 1516 lang = lang.replace(runescape, funescape).toLowerCase(); 1517 return function(elem) { 1518 var elemLang; 1519 do { 1520 if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) { 1521 elemLang = elemLang.toLowerCase(); 1522 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 1523 } 1524 } while ((elem = elem.parentNode) && elem.nodeType === 1); 1525 return false; 1526 }; 1527 }), 1528 target: function(elem) { 1529 var hash3 = window2.location && window2.location.hash; 1530 return hash3 && hash3.slice(1) === elem.id; 1531 }, 1532 root: function(elem) { 1533 return elem === documentElement2; 1534 }, 1535 focus: function(elem) { 1536 return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex); 1537 }, 1538 enabled: createDisabledPseudo(false), 1539 disabled: createDisabledPseudo(true), 1540 checked: function(elem) { 1541 return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected; 1542 }, 1543 selected: function(elem) { 1544 if (elem.parentNode) { 1545 elem.parentNode.selectedIndex; 1546 } 1547 return elem.selected === true; 1548 }, 1549 empty: function(elem) { 1550 for (elem = elem.firstChild;elem; elem = elem.nextSibling) { 1551 if (elem.nodeType < 6) { 1552 return false; 1553 } 1554 } 1555 return true; 1556 }, 1557 parent: function(elem) { 1558 return !Expr.pseudos.empty(elem); 1559 }, 1560 header: function(elem) { 1561 return rheader.test(elem.nodeName); 1562 }, 1563 input: function(elem) { 1564 return rinputs.test(elem.nodeName); 1565 }, 1566 button: function(elem) { 1567 return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button"); 1568 }, 1569 text: function(elem) { 1570 var attr; 1571 return nodeName(elem, "input") && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text"); 1572 }, 1573 first: createPositionalPseudo(function() { 1574 return [0]; 1575 }), 1576 last: createPositionalPseudo(function(_matchIndexes, length) { 1577 return [length - 1]; 1578 }), 1579 eq: createPositionalPseudo(function(_matchIndexes, length, argument) { 1580 return [argument < 0 ? argument + length : argument]; 1581 }), 1582 even: createPositionalPseudo(function(matchIndexes, length) { 1583 var i2 = 0; 1584 for (;i2 < length; i2 += 2) { 1585 matchIndexes.push(i2); 1586 } 1587 return matchIndexes; 1588 }), 1589 odd: createPositionalPseudo(function(matchIndexes, length) { 1590 var i2 = 1; 1591 for (;i2 < length; i2 += 2) { 1592 matchIndexes.push(i2); 1593 } 1594 return matchIndexes; 1595 }), 1596 lt: createPositionalPseudo(function(matchIndexes, length, argument) { 1597 var i2; 1598 if (argument < 0) { 1599 i2 = argument + length; 1600 } else if (argument > length) { 1601 i2 = length; 1602 } else { 1603 i2 = argument; 1604 } 1605 for (;--i2 >= 0; ) { 1606 matchIndexes.push(i2); 1607 } 1608 return matchIndexes; 1609 }), 1610 gt: createPositionalPseudo(function(matchIndexes, length, argument) { 1611 var i2 = argument < 0 ? argument + length : argument; 1612 for (;++i2 < length; ) { 1613 matchIndexes.push(i2); 1614 } 1615 return matchIndexes; 1616 }) 1617 } 1618 }; 1619 Expr.pseudos.nth = Expr.pseudos.eq; 1620 for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { 1621 Expr.pseudos[i] = createInputPseudo(i); 1622 } 1623 for (i in { submit: true, reset: true }) { 1624 Expr.pseudos[i] = createButtonPseudo(i); 1625 } 1626 function setFilters() {} 1627 setFilters.prototype = Expr.filters = Expr.pseudos; 1628 Expr.setFilters = new setFilters; 1629 function tokenize2(selector, parseOnly) { 1630 var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "]; 1631 if (cached) { 1632 return parseOnly ? 0 : cached.slice(0); 1633 } 1634 soFar = selector; 1635 groups = []; 1636 preFilters = Expr.preFilter; 1637 while (soFar) { 1638 if (!matched || (match = rcomma.exec(soFar))) { 1639 if (match) { 1640 soFar = soFar.slice(match[0].length) || soFar; 1641 } 1642 groups.push(tokens = []); 1643 } 1644 matched = false; 1645 if (match = rleadingCombinator.exec(soFar)) { 1646 matched = match.shift(); 1647 tokens.push({ 1648 value: matched, 1649 type: match[0].replace(rtrimCSS, " ") 1650 }); 1651 soFar = soFar.slice(matched.length); 1652 } 1653 for (type in Expr.filter) { 1654 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) { 1655 matched = match.shift(); 1656 tokens.push({ 1657 value: matched, 1658 type, 1659 matches: match 1660 }); 1661 soFar = soFar.slice(matched.length); 1662 } 1663 } 1664 if (!matched) { 1665 break; 1666 } 1667 } 1668 if (parseOnly) { 1669 return soFar.length; 1670 } 1671 return soFar ? find.error(selector) : tokenCache(selector, groups).slice(0); 1672 } 1673 function toSelector(tokens) { 1674 var i2 = 0, len = tokens.length, selector = ""; 1675 for (;i2 < len; i2++) { 1676 selector += tokens[i2].value; 1677 } 1678 return selector; 1679 } 1680 function addCombinator(matcher, combinator, base) { 1681 var { dir: dir2, next: skip } = combinator, key = skip || dir2, checkNonElements = base && key === "parentNode", doneName = done++; 1682 return combinator.first ? function(elem, context, xml) { 1683 while (elem = elem[dir2]) { 1684 if (elem.nodeType === 1 || checkNonElements) { 1685 return matcher(elem, context, xml); 1686 } 1687 } 1688 return false; 1689 } : function(elem, context, xml) { 1690 var oldCache, outerCache, newCache = [dirruns, doneName]; 1691 if (xml) { 1692 while (elem = elem[dir2]) { 1693 if (elem.nodeType === 1 || checkNonElements) { 1694 if (matcher(elem, context, xml)) { 1695 return true; 1696 } 1697 } 1698 } 1699 } else { 1700 while (elem = elem[dir2]) { 1701 if (elem.nodeType === 1 || checkNonElements) { 1702 outerCache = elem[expando] || (elem[expando] = {}); 1703 if (skip && nodeName(elem, skip)) { 1704 elem = elem[dir2] || elem; 1705 } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) { 1706 return newCache[2] = oldCache[2]; 1707 } else { 1708 outerCache[key] = newCache; 1709 if (newCache[2] = matcher(elem, context, xml)) { 1710 return true; 1711 } 1712 } 1713 } 1714 } 1715 } 1716 return false; 1717 }; 1718 } 1719 function elementMatcher(matchers) { 1720 return matchers.length > 1 ? function(elem, context, xml) { 1721 var i2 = matchers.length; 1722 while (i2--) { 1723 if (!matchers[i2](elem, context, xml)) { 1724 return false; 1725 } 1726 } 1727 return true; 1728 } : matchers[0]; 1729 } 1730 function multipleContexts(selector, contexts, results) { 1731 var i2 = 0, len = contexts.length; 1732 for (;i2 < len; i2++) { 1733 find(selector, contexts[i2], results); 1734 } 1735 return results; 1736 } 1737 function condense(unmatched, map, filter, context, xml) { 1738 var elem, newUnmatched = [], i2 = 0, len = unmatched.length, mapped = map != null; 1739 for (;i2 < len; i2++) { 1740 if (elem = unmatched[i2]) { 1741 if (!filter || filter(elem, context, xml)) { 1742 newUnmatched.push(elem); 1743 if (mapped) { 1744 map.push(i2); 1745 } 1746 } 1747 } 1748 } 1749 return newUnmatched; 1750 } 1751 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { 1752 if (postFilter && !postFilter[expando]) { 1753 postFilter = setMatcher(postFilter); 1754 } 1755 if (postFinder && !postFinder[expando]) { 1756 postFinder = setMatcher(postFinder, postSelector); 1757 } 1758 return markFunction(function(seed, results, context, xml) { 1759 var temp, i2, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems; 1760 if (matcher) { 1761 matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results; 1762 matcher(matcherIn, matcherOut, context, xml); 1763 } else { 1764 matcherOut = matcherIn; 1765 } 1766 if (postFilter) { 1767 temp = condense(matcherOut, postMap); 1768 postFilter(temp, [], context, xml); 1769 i2 = temp.length; 1770 while (i2--) { 1771 if (elem = temp[i2]) { 1772 matcherOut[postMap[i2]] = !(matcherIn[postMap[i2]] = elem); 1773 } 1774 } 1775 } 1776 if (seed) { 1777 if (postFinder || preFilter) { 1778 if (postFinder) { 1779 temp = []; 1780 i2 = matcherOut.length; 1781 while (i2--) { 1782 if (elem = matcherOut[i2]) { 1783 temp.push(matcherIn[i2] = elem); 1784 } 1785 } 1786 postFinder(null, matcherOut = [], temp, xml); 1787 } 1788 i2 = matcherOut.length; 1789 while (i2--) { 1790 if ((elem = matcherOut[i2]) && (temp = postFinder ? indexOf2.call(seed, elem) : preMap[i2]) > -1) { 1791 seed[temp] = !(results[temp] = elem); 1792 } 1793 } 1794 } 1795 } else { 1796 matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut); 1797 if (postFinder) { 1798 postFinder(null, results, matcherOut, xml); 1799 } else { 1800 push2.apply(results, matcherOut); 1801 } 1802 } 1803 }); 1804 } 1805 function matcherFromTokens(tokens) { 1806 var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i2 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) { 1807 return elem === checkContext; 1808 }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) { 1809 return indexOf2.call(checkContext, elem) > -1; 1810 }, implicitRelative, true), matchers = [function(elem, context, xml) { 1811 var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); 1812 checkContext = null; 1813 return ret; 1814 }]; 1815 for (;i2 < len; i2++) { 1816 if (matcher = Expr.relative[tokens[i2].type]) { 1817 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 1818 } else { 1819 matcher = Expr.filter[tokens[i2].type].apply(null, tokens[i2].matches); 1820 if (matcher[expando]) { 1821 j = ++i2; 1822 for (;j < len; j++) { 1823 if (Expr.relative[tokens[j].type]) { 1824 break; 1825 } 1826 } 1827 return setMatcher(i2 > 1 && elementMatcher(matchers), i2 > 1 && toSelector(tokens.slice(0, i2 - 1).concat({ value: tokens[i2 - 2].type === " " ? "*" : "" })).replace(rtrimCSS, "$1"), matcher, i2 < j && matcherFromTokens(tokens.slice(i2, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens)); 1828 } 1829 matchers.push(matcher); 1830 } 1831 } 1832 return elementMatcher(matchers); 1833 } 1834 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 1835 var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) { 1836 var elem, j, matcher, matchedCount = 0, i2 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length; 1837 if (outermost) { 1838 outermostContext = context == document3 || context || outermost; 1839 } 1840 for (;i2 !== len && (elem = elems[i2]) != null; i2++) { 1841 if (byElement && elem) { 1842 j = 0; 1843 if (!context && elem.ownerDocument != document3) { 1844 setDocument(elem); 1845 xml = !documentIsHTML; 1846 } 1847 while (matcher = elementMatchers[j++]) { 1848 if (matcher(elem, context || document3, xml)) { 1849 push2.call(results, elem); 1850 break; 1851 } 1852 } 1853 if (outermost) { 1854 dirruns = dirrunsUnique; 1855 } 1856 } 1857 if (bySet) { 1858 if (elem = !matcher && elem) { 1859 matchedCount--; 1860 } 1861 if (seed) { 1862 unmatched.push(elem); 1863 } 1864 } 1865 } 1866 matchedCount += i2; 1867 if (bySet && i2 !== matchedCount) { 1868 j = 0; 1869 while (matcher = setMatchers[j++]) { 1870 matcher(unmatched, setMatched, context, xml); 1871 } 1872 if (seed) { 1873 if (matchedCount > 0) { 1874 while (i2--) { 1875 if (!(unmatched[i2] || setMatched[i2])) { 1876 setMatched[i2] = pop.call(results); 1877 } 1878 } 1879 } 1880 setMatched = condense(setMatched); 1881 } 1882 push2.apply(results, setMatched); 1883 if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) { 1884 jQuery2.uniqueSort(results); 1885 } 1886 } 1887 if (outermost) { 1888 dirruns = dirrunsUnique; 1889 outermostContext = contextBackup; 1890 } 1891 return unmatched; 1892 }; 1893 return bySet ? markFunction(superMatcher) : superMatcher; 1894 } 1895 function compile(selector, match) { 1896 var i2, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "]; 1897 if (!cached) { 1898 if (!match) { 1899 match = tokenize2(selector); 1900 } 1901 i2 = match.length; 1902 while (i2--) { 1903 cached = matcherFromTokens(match[i2]); 1904 if (cached[expando]) { 1905 setMatchers.push(cached); 1906 } else { 1907 elementMatchers.push(cached); 1908 } 1909 } 1910 cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); 1911 cached.selector = selector; 1912 } 1913 return cached; 1914 } 1915 function select(selector, context, results, seed) { 1916 var i2, tokens, token, type, find2, compiled = typeof selector === "function" && selector, match = !seed && tokenize2(selector = compiled.selector || selector); 1917 results = results || []; 1918 if (match.length === 1) { 1919 tokens = match[0] = match[0].slice(0); 1920 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { 1921 context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0]; 1922 if (!context) { 1923 return results; 1924 } else if (compiled) { 1925 context = context.parentNode; 1926 } 1927 selector = selector.slice(tokens.shift().value.length); 1928 } 1929 i2 = matchExpr.needsContext.test(selector) ? 0 : tokens.length; 1930 while (i2--) { 1931 token = tokens[i2]; 1932 if (Expr.relative[type = token.type]) { 1933 break; 1934 } 1935 if (find2 = Expr.find[type]) { 1936 if (seed = find2(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) { 1937 tokens.splice(i2, 1); 1938 selector = seed.length && toSelector(tokens); 1939 if (!selector) { 1940 push2.apply(results, seed); 1941 return results; 1942 } 1943 break; 1944 } 1945 } 1946 } 1947 } 1948 (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context); 1949 return results; 1950 } 1951 support.sortStable = expando.split("").sort(sortOrder).join("") === expando; 1952 setDocument(); 1953 support.sortDetached = assert(function(el) { 1954 return el.compareDocumentPosition(document3.createElement("fieldset")) & 1; 1955 }); 1956 jQuery2.find = find; 1957 jQuery2.expr[":"] = jQuery2.expr.pseudos; 1958 jQuery2.unique = jQuery2.uniqueSort; 1959 find.compile = compile; 1960 find.select = select; 1961 find.setDocument = setDocument; 1962 find.tokenize = tokenize2; 1963 find.escape = jQuery2.escapeSelector; 1964 find.getText = jQuery2.text; 1965 find.isXML = jQuery2.isXMLDoc; 1966 find.selectors = jQuery2.expr; 1967 find.support = jQuery2.support; 1968 find.uniqueSort = jQuery2.uniqueSort; 1969 })(); 1970 var dir = function(elem, dir2, until) { 1971 var matched = [], truncate = until !== undefined; 1972 while ((elem = elem[dir2]) && elem.nodeType !== 9) { 1973 if (elem.nodeType === 1) { 1974 if (truncate && jQuery2(elem).is(until)) { 1975 break; 1976 } 1977 matched.push(elem); 1978 } 1979 } 1980 return matched; 1981 }; 1982 var siblings = function(n2, elem) { 1983 var matched = []; 1984 for (;n2; n2 = n2.nextSibling) { 1985 if (n2.nodeType === 1 && n2 !== elem) { 1986 matched.push(n2); 1987 } 1988 } 1989 return matched; 1990 }; 1991 var rneedsContext = jQuery2.expr.match.needsContext; 1992 var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i; 1993 function winnow(elements, qualifier, not) { 1994 if (isFunction(qualifier)) { 1995 return jQuery2.grep(elements, function(elem, i) { 1996 return !!qualifier.call(elem, i, elem) !== not; 1997 }); 1998 } 1999 if (qualifier.nodeType) { 2000 return jQuery2.grep(elements, function(elem) { 2001 return elem === qualifier !== not; 2002 }); 2003 } 2004 if (typeof qualifier !== "string") { 2005 return jQuery2.grep(elements, function(elem) { 2006 return indexOf2.call(qualifier, elem) > -1 !== not; 2007 }); 2008 } 2009 return jQuery2.filter(qualifier, elements, not); 2010 } 2011 jQuery2.filter = function(expr, elems, not) { 2012 var elem = elems[0]; 2013 if (not) { 2014 expr = ":not(" + expr + ")"; 2015 } 2016 if (elems.length === 1 && elem.nodeType === 1) { 2017 return jQuery2.find.matchesSelector(elem, expr) ? [elem] : []; 2018 } 2019 return jQuery2.find.matches(expr, jQuery2.grep(elems, function(elem2) { 2020 return elem2.nodeType === 1; 2021 })); 2022 }; 2023 jQuery2.fn.extend({ 2024 find: function(selector) { 2025 var i, ret, len = this.length, self = this; 2026 if (typeof selector !== "string") { 2027 return this.pushStack(jQuery2(selector).filter(function() { 2028 for (i = 0;i < len; i++) { 2029 if (jQuery2.contains(self[i], this)) { 2030 return true; 2031 } 2032 } 2033 })); 2034 } 2035 ret = this.pushStack([]); 2036 for (i = 0;i < len; i++) { 2037 jQuery2.find(selector, self[i], ret); 2038 } 2039 return len > 1 ? jQuery2.uniqueSort(ret) : ret; 2040 }, 2041 filter: function(selector) { 2042 return this.pushStack(winnow(this, selector || [], false)); 2043 }, 2044 not: function(selector) { 2045 return this.pushStack(winnow(this, selector || [], true)); 2046 }, 2047 is: function(selector) { 2048 return !!winnow(this, typeof selector === "string" && rneedsContext.test(selector) ? jQuery2(selector) : selector || [], false).length; 2049 } 2050 }); 2051 var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery2.fn.init = function(selector, context, root) { 2052 var match, elem; 2053 if (!selector) { 2054 return this; 2055 } 2056 root = root || rootjQuery; 2057 if (typeof selector === "string") { 2058 if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) { 2059 match = [null, selector, null]; 2060 } else { 2061 match = rquickExpr.exec(selector); 2062 } 2063 if (match && (match[1] || !context)) { 2064 if (match[1]) { 2065 context = context instanceof jQuery2 ? context[0] : context; 2066 jQuery2.merge(this, jQuery2.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document2, true)); 2067 if (rsingleTag.test(match[1]) && jQuery2.isPlainObject(context)) { 2068 for (match in context) { 2069 if (isFunction(this[match])) { 2070 this[match](context[match]); 2071 } else { 2072 this.attr(match, context[match]); 2073 } 2074 } 2075 } 2076 return this; 2077 } else { 2078 elem = document2.getElementById(match[2]); 2079 if (elem) { 2080 this[0] = elem; 2081 this.length = 1; 2082 } 2083 return this; 2084 } 2085 } else if (!context || context.jquery) { 2086 return (context || root).find(selector); 2087 } else { 2088 return this.constructor(context).find(selector); 2089 } 2090 } else if (selector.nodeType) { 2091 this[0] = selector; 2092 this.length = 1; 2093 return this; 2094 } else if (isFunction(selector)) { 2095 return root.ready !== undefined ? root.ready(selector) : selector(jQuery2); 2096 } 2097 return jQuery2.makeArray(selector, this); 2098 }; 2099 init.prototype = jQuery2.fn; 2100 rootjQuery = jQuery2(document2); 2101 var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = { 2102 children: true, 2103 contents: true, 2104 next: true, 2105 prev: true 2106 }; 2107 jQuery2.fn.extend({ 2108 has: function(target) { 2109 var targets = jQuery2(target, this), l2 = targets.length; 2110 return this.filter(function() { 2111 var i = 0; 2112 for (;i < l2; i++) { 2113 if (jQuery2.contains(this, targets[i])) { 2114 return true; 2115 } 2116 } 2117 }); 2118 }, 2119 closest: function(selectors, context) { 2120 var cur, i = 0, l2 = this.length, matched = [], targets = typeof selectors !== "string" && jQuery2(selectors); 2121 if (!rneedsContext.test(selectors)) { 2122 for (;i < l2; i++) { 2123 for (cur = this[i];cur && cur !== context; cur = cur.parentNode) { 2124 if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : cur.nodeType === 1 && jQuery2.find.matchesSelector(cur, selectors))) { 2125 matched.push(cur); 2126 break; 2127 } 2128 } 2129 } 2130 } 2131 return this.pushStack(matched.length > 1 ? jQuery2.uniqueSort(matched) : matched); 2132 }, 2133 index: function(elem) { 2134 if (!elem) { 2135 return this[0] && this[0].parentNode ? this.first().prevAll().length : -1; 2136 } 2137 if (typeof elem === "string") { 2138 return indexOf2.call(jQuery2(elem), this[0]); 2139 } 2140 return indexOf2.call(this, elem.jquery ? elem[0] : elem); 2141 }, 2142 add: function(selector, context) { 2143 return this.pushStack(jQuery2.uniqueSort(jQuery2.merge(this.get(), jQuery2(selector, context)))); 2144 }, 2145 addBack: function(selector) { 2146 return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector)); 2147 } 2148 }); 2149 function sibling(cur, dir2) { 2150 while ((cur = cur[dir2]) && cur.nodeType !== 1) {} 2151 return cur; 2152 } 2153 jQuery2.each({ 2154 parent: function(elem) { 2155 var parent = elem.parentNode; 2156 return parent && parent.nodeType !== 11 ? parent : null; 2157 }, 2158 parents: function(elem) { 2159 return dir(elem, "parentNode"); 2160 }, 2161 parentsUntil: function(elem, _i, until) { 2162 return dir(elem, "parentNode", until); 2163 }, 2164 next: function(elem) { 2165 return sibling(elem, "nextSibling"); 2166 }, 2167 prev: function(elem) { 2168 return sibling(elem, "previousSibling"); 2169 }, 2170 nextAll: function(elem) { 2171 return dir(elem, "nextSibling"); 2172 }, 2173 prevAll: function(elem) { 2174 return dir(elem, "previousSibling"); 2175 }, 2176 nextUntil: function(elem, _i, until) { 2177 return dir(elem, "nextSibling", until); 2178 }, 2179 prevUntil: function(elem, _i, until) { 2180 return dir(elem, "previousSibling", until); 2181 }, 2182 siblings: function(elem) { 2183 return siblings((elem.parentNode || {}).firstChild, elem); 2184 }, 2185 children: function(elem) { 2186 return siblings(elem.firstChild); 2187 }, 2188 contents: function(elem) { 2189 if (elem.contentDocument != null && getProto(elem.contentDocument)) { 2190 return elem.contentDocument; 2191 } 2192 if (nodeName(elem, "template")) { 2193 elem = elem.content || elem; 2194 } 2195 return jQuery2.merge([], elem.childNodes); 2196 } 2197 }, function(name, fn2) { 2198 jQuery2.fn[name] = function(until, selector) { 2199 var matched = jQuery2.map(this, fn2, until); 2200 if (name.slice(-5) !== "Until") { 2201 selector = until; 2202 } 2203 if (selector && typeof selector === "string") { 2204 matched = jQuery2.filter(selector, matched); 2205 } 2206 if (this.length > 1) { 2207 if (!guaranteedUnique[name]) { 2208 jQuery2.uniqueSort(matched); 2209 } 2210 if (rparentsprev.test(name)) { 2211 matched.reverse(); 2212 } 2213 } 2214 return this.pushStack(matched); 2215 }; 2216 }); 2217 var rnothtmlwhite = /[^\x20\t\r\n\f]+/g; 2218 function createOptions(options) { 2219 var object = {}; 2220 jQuery2.each(options.match(rnothtmlwhite) || [], function(_, flag) { 2221 object[flag] = true; 2222 }); 2223 return object; 2224 } 2225 jQuery2.Callbacks = function(options) { 2226 options = typeof options === "string" ? createOptions(options) : jQuery2.extend({}, options); 2227 var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() { 2228 locked = locked || options.once; 2229 fired = firing = true; 2230 for (;queue.length; firingIndex = -1) { 2231 memory = queue.shift(); 2232 while (++firingIndex < list.length) { 2233 if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) { 2234 firingIndex = list.length; 2235 memory = false; 2236 } 2237 } 2238 } 2239 if (!options.memory) { 2240 memory = false; 2241 } 2242 firing = false; 2243 if (locked) { 2244 if (memory) { 2245 list = []; 2246 } else { 2247 list = ""; 2248 } 2249 } 2250 }, self = { 2251 add: function() { 2252 if (list) { 2253 if (memory && !firing) { 2254 firingIndex = list.length - 1; 2255 queue.push(memory); 2256 } 2257 (function add2(args) { 2258 jQuery2.each(args, function(_, arg) { 2259 if (isFunction(arg)) { 2260 if (!options.unique || !self.has(arg)) { 2261 list.push(arg); 2262 } 2263 } else if (arg && arg.length && toType2(arg) !== "string") { 2264 add2(arg); 2265 } 2266 }); 2267 })(arguments); 2268 if (memory && !firing) { 2269 fire(); 2270 } 2271 } 2272 return this; 2273 }, 2274 remove: function() { 2275 jQuery2.each(arguments, function(_, arg) { 2276 var index; 2277 while ((index = jQuery2.inArray(arg, list, index)) > -1) { 2278 list.splice(index, 1); 2279 if (index <= firingIndex) { 2280 firingIndex--; 2281 } 2282 } 2283 }); 2284 return this; 2285 }, 2286 has: function(fn2) { 2287 return fn2 ? jQuery2.inArray(fn2, list) > -1 : list.length > 0; 2288 }, 2289 empty: function() { 2290 if (list) { 2291 list = []; 2292 } 2293 return this; 2294 }, 2295 disable: function() { 2296 locked = queue = []; 2297 list = memory = ""; 2298 return this; 2299 }, 2300 disabled: function() { 2301 return !list; 2302 }, 2303 lock: function() { 2304 locked = queue = []; 2305 if (!memory && !firing) { 2306 list = memory = ""; 2307 } 2308 return this; 2309 }, 2310 locked: function() { 2311 return !!locked; 2312 }, 2313 fireWith: function(context, args) { 2314 if (!locked) { 2315 args = args || []; 2316 args = [context, args.slice ? args.slice() : args]; 2317 queue.push(args); 2318 if (!firing) { 2319 fire(); 2320 } 2321 } 2322 return this; 2323 }, 2324 fire: function() { 2325 self.fireWith(this, arguments); 2326 return this; 2327 }, 2328 fired: function() { 2329 return !!fired; 2330 } 2331 }; 2332 return self; 2333 }; 2334 function Identity(v2) { 2335 return v2; 2336 } 2337 function Thrower(ex) { 2338 throw ex; 2339 } 2340 function adoptValue(value, resolve, reject, noValue) { 2341 var method; 2342 try { 2343 if (value && isFunction(method = value.promise)) { 2344 method.call(value).done(resolve).fail(reject); 2345 } else if (value && isFunction(method = value.then)) { 2346 method.call(value, resolve, reject); 2347 } else { 2348 resolve.apply(undefined, [value].slice(noValue)); 2349 } 2350 } catch (value2) { 2351 reject.apply(undefined, [value2]); 2352 } 2353 } 2354 jQuery2.extend({ 2355 Deferred: function(func) { 2356 var tuples = [ 2357 [ 2358 "notify", 2359 "progress", 2360 jQuery2.Callbacks("memory"), 2361 jQuery2.Callbacks("memory"), 2362 2 2363 ], 2364 [ 2365 "resolve", 2366 "done", 2367 jQuery2.Callbacks("once memory"), 2368 jQuery2.Callbacks("once memory"), 2369 0, 2370 "resolved" 2371 ], 2372 [ 2373 "reject", 2374 "fail", 2375 jQuery2.Callbacks("once memory"), 2376 jQuery2.Callbacks("once memory"), 2377 1, 2378 "rejected" 2379 ] 2380 ], state = "pending", promise = { 2381 state: function() { 2382 return state; 2383 }, 2384 always: function() { 2385 deferred.done(arguments).fail(arguments); 2386 return this; 2387 }, 2388 catch: function(fn2) { 2389 return promise.then(null, fn2); 2390 }, 2391 pipe: function() { 2392 var fns = arguments; 2393 return jQuery2.Deferred(function(newDefer) { 2394 jQuery2.each(tuples, function(_i, tuple) { 2395 var fn2 = isFunction(fns[tuple[4]]) && fns[tuple[4]]; 2396 deferred[tuple[1]](function() { 2397 var returned = fn2 && fn2.apply(this, arguments); 2398 if (returned && isFunction(returned.promise)) { 2399 returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject); 2400 } else { 2401 newDefer[tuple[0] + "With"](this, fn2 ? [returned] : arguments); 2402 } 2403 }); 2404 }); 2405 fns = null; 2406 }).promise(); 2407 }, 2408 then: function(onFulfilled, onRejected, onProgress) { 2409 var maxDepth = 0; 2410 function resolve(depth, deferred2, handler, special) { 2411 return function() { 2412 var that = this, args = arguments, mightThrow = function() { 2413 var returned, then; 2414 if (depth < maxDepth) { 2415 return; 2416 } 2417 returned = handler.apply(that, args); 2418 if (returned === deferred2.promise()) { 2419 throw new TypeError("Thenable self-resolution"); 2420 } 2421 then = returned && (typeof returned === "object" || typeof returned === "function") && returned.then; 2422 if (isFunction(then)) { 2423 if (special) { 2424 then.call(returned, resolve(maxDepth, deferred2, Identity, special), resolve(maxDepth, deferred2, Thrower, special)); 2425 } else { 2426 maxDepth++; 2427 then.call(returned, resolve(maxDepth, deferred2, Identity, special), resolve(maxDepth, deferred2, Thrower, special), resolve(maxDepth, deferred2, Identity, deferred2.notifyWith)); 2428 } 2429 } else { 2430 if (handler !== Identity) { 2431 that = undefined; 2432 args = [returned]; 2433 } 2434 (special || deferred2.resolveWith)(that, args); 2435 } 2436 }, process = special ? mightThrow : function() { 2437 try { 2438 mightThrow(); 2439 } catch (e) { 2440 if (jQuery2.Deferred.exceptionHook) { 2441 jQuery2.Deferred.exceptionHook(e, process.error); 2442 } 2443 if (depth + 1 >= maxDepth) { 2444 if (handler !== Thrower) { 2445 that = undefined; 2446 args = [e]; 2447 } 2448 deferred2.rejectWith(that, args); 2449 } 2450 } 2451 }; 2452 if (depth) { 2453 process(); 2454 } else { 2455 if (jQuery2.Deferred.getErrorHook) { 2456 process.error = jQuery2.Deferred.getErrorHook(); 2457 } else if (jQuery2.Deferred.getStackHook) { 2458 process.error = jQuery2.Deferred.getStackHook(); 2459 } 2460 window2.setTimeout(process); 2461 } 2462 }; 2463 } 2464 return jQuery2.Deferred(function(newDefer) { 2465 tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith)); 2466 tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity)); 2467 tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower)); 2468 }).promise(); 2469 }, 2470 promise: function(obj) { 2471 return obj != null ? jQuery2.extend(obj, promise) : promise; 2472 } 2473 }, deferred = {}; 2474 jQuery2.each(tuples, function(i, tuple) { 2475 var list = tuple[2], stateString = tuple[5]; 2476 promise[tuple[1]] = list.add; 2477 if (stateString) { 2478 list.add(function() { 2479 state = stateString; 2480 }, tuples[3 - i][2].disable, tuples[3 - i][3].disable, tuples[0][2].lock, tuples[0][3].lock); 2481 } 2482 list.add(tuple[3].fire); 2483 deferred[tuple[0]] = function() { 2484 deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments); 2485 return this; 2486 }; 2487 deferred[tuple[0] + "With"] = list.fireWith; 2488 }); 2489 promise.promise(deferred); 2490 if (func) { 2491 func.call(deferred, deferred); 2492 } 2493 return deferred; 2494 }, 2495 when: function(singleValue) { 2496 var remaining = arguments.length, i = remaining, resolveContexts = Array(i), resolveValues = slice.call(arguments), primary = jQuery2.Deferred(), updateFunc = function(i2) { 2497 return function(value) { 2498 resolveContexts[i2] = this; 2499 resolveValues[i2] = arguments.length > 1 ? slice.call(arguments) : value; 2500 if (!--remaining) { 2501 primary.resolveWith(resolveContexts, resolveValues); 2502 } 2503 }; 2504 }; 2505 if (remaining <= 1) { 2506 adoptValue(singleValue, primary.done(updateFunc(i)).resolve, primary.reject, !remaining); 2507 if (primary.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) { 2508 return primary.then(); 2509 } 2510 } 2511 while (i--) { 2512 adoptValue(resolveValues[i], updateFunc(i), primary.reject); 2513 } 2514 return primary.promise(); 2515 } 2516 }); 2517 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 2518 jQuery2.Deferred.exceptionHook = function(error2, asyncError) { 2519 if (window2.console && window2.console.warn && error2 && rerrorNames.test(error2.name)) { 2520 window2.console.warn("jQuery.Deferred exception: " + error2.message, error2.stack, asyncError); 2521 } 2522 }; 2523 jQuery2.readyException = function(error2) { 2524 window2.setTimeout(function() { 2525 throw error2; 2526 }); 2527 }; 2528 var readyList = jQuery2.Deferred(); 2529 jQuery2.fn.ready = function(fn2) { 2530 readyList.then(fn2).catch(function(error2) { 2531 jQuery2.readyException(error2); 2532 }); 2533 return this; 2534 }; 2535 jQuery2.extend({ 2536 isReady: false, 2537 readyWait: 1, 2538 ready: function(wait) { 2539 if (wait === true ? --jQuery2.readyWait : jQuery2.isReady) { 2540 return; 2541 } 2542 jQuery2.isReady = true; 2543 if (wait !== true && --jQuery2.readyWait > 0) { 2544 return; 2545 } 2546 readyList.resolveWith(document2, [jQuery2]); 2547 } 2548 }); 2549 jQuery2.ready.then = readyList.then; 2550 function completed() { 2551 document2.removeEventListener("DOMContentLoaded", completed); 2552 window2.removeEventListener("load", completed); 2553 jQuery2.ready(); 2554 } 2555 if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) { 2556 window2.setTimeout(jQuery2.ready); 2557 } else { 2558 document2.addEventListener("DOMContentLoaded", completed); 2559 window2.addEventListener("load", completed); 2560 } 2561 var access = function(elems, fn2, key, value, chainable, emptyGet, raw) { 2562 var i = 0, len = elems.length, bulk = key == null; 2563 if (toType2(key) === "object") { 2564 chainable = true; 2565 for (i in key) { 2566 access(elems, fn2, i, key[i], true, emptyGet, raw); 2567 } 2568 } else if (value !== undefined) { 2569 chainable = true; 2570 if (!isFunction(value)) { 2571 raw = true; 2572 } 2573 if (bulk) { 2574 if (raw) { 2575 fn2.call(elems, value); 2576 fn2 = null; 2577 } else { 2578 bulk = fn2; 2579 fn2 = function(elem, _key, value2) { 2580 return bulk.call(jQuery2(elem), value2); 2581 }; 2582 } 2583 } 2584 if (fn2) { 2585 for (;i < len; i++) { 2586 fn2(elems[i], key, raw ? value : value.call(elems[i], i, fn2(elems[i], key))); 2587 } 2588 } 2589 } 2590 if (chainable) { 2591 return elems; 2592 } 2593 if (bulk) { 2594 return fn2.call(elems); 2595 } 2596 return len ? fn2(elems[0], key) : emptyGet; 2597 }; 2598 var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g; 2599 function fcamelCase(_all, letter) { 2600 return letter.toUpperCase(); 2601 } 2602 function camelCase(string) { 2603 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 2604 } 2605 var acceptData = function(owner) { 2606 return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType; 2607 }; 2608 function Data2() { 2609 this.expando = jQuery2.expando + Data2.uid++; 2610 } 2611 Data2.uid = 1; 2612 Data2.prototype = { 2613 cache: function(owner) { 2614 var value = owner[this.expando]; 2615 if (!value) { 2616 value = {}; 2617 if (acceptData(owner)) { 2618 if (owner.nodeType) { 2619 owner[this.expando] = value; 2620 } else { 2621 Object.defineProperty(owner, this.expando, { 2622 value, 2623 configurable: true 2624 }); 2625 } 2626 } 2627 } 2628 return value; 2629 }, 2630 set: function(owner, data, value) { 2631 var prop, cache2 = this.cache(owner); 2632 if (typeof data === "string") { 2633 cache2[camelCase(data)] = value; 2634 } else { 2635 for (prop in data) { 2636 cache2[camelCase(prop)] = data[prop]; 2637 } 2638 } 2639 return cache2; 2640 }, 2641 get: function(owner, key) { 2642 return key === undefined ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase(key)]; 2643 }, 2644 access: function(owner, key, value) { 2645 if (key === undefined || key && typeof key === "string" && value === undefined) { 2646 return this.get(owner, key); 2647 } 2648 this.set(owner, key, value); 2649 return value !== undefined ? value : key; 2650 }, 2651 remove: function(owner, key) { 2652 var i, cache2 = owner[this.expando]; 2653 if (cache2 === undefined) { 2654 return; 2655 } 2656 if (key !== undefined) { 2657 if (Array.isArray(key)) { 2658 key = key.map(camelCase); 2659 } else { 2660 key = camelCase(key); 2661 key = key in cache2 ? [key] : key.match(rnothtmlwhite) || []; 2662 } 2663 i = key.length; 2664 while (i--) { 2665 delete cache2[key[i]]; 2666 } 2667 } 2668 if (key === undefined || jQuery2.isEmptyObject(cache2)) { 2669 if (owner.nodeType) { 2670 owner[this.expando] = undefined; 2671 } else { 2672 delete owner[this.expando]; 2673 } 2674 } 2675 }, 2676 hasData: function(owner) { 2677 var cache2 = owner[this.expando]; 2678 return cache2 !== undefined && !jQuery2.isEmptyObject(cache2); 2679 } 2680 }; 2681 var dataPriv = new Data2; 2682 var dataUser = new Data2; 2683 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; 2684 function getData(data) { 2685 if (data === "true") { 2686 return true; 2687 } 2688 if (data === "false") { 2689 return false; 2690 } 2691 if (data === "null") { 2692 return null; 2693 } 2694 if (data === +data + "") { 2695 return +data; 2696 } 2697 if (rbrace.test(data)) { 2698 return JSON.parse(data); 2699 } 2700 return data; 2701 } 2702 function dataAttr(elem, key, data) { 2703 var name; 2704 if (data === undefined && elem.nodeType === 1) { 2705 name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); 2706 data = elem.getAttribute(name); 2707 if (typeof data === "string") { 2708 try { 2709 data = getData(data); 2710 } catch (e) {} 2711 dataUser.set(elem, key, data); 2712 } else { 2713 data = undefined; 2714 } 2715 } 2716 return data; 2717 } 2718 jQuery2.extend({ 2719 hasData: function(elem) { 2720 return dataUser.hasData(elem) || dataPriv.hasData(elem); 2721 }, 2722 data: function(elem, name, data) { 2723 return dataUser.access(elem, name, data); 2724 }, 2725 removeData: function(elem, name) { 2726 dataUser.remove(elem, name); 2727 }, 2728 _data: function(elem, name, data) { 2729 return dataPriv.access(elem, name, data); 2730 }, 2731 _removeData: function(elem, name) { 2732 dataPriv.remove(elem, name); 2733 } 2734 }); 2735 jQuery2.fn.extend({ 2736 data: function(key, value) { 2737 var i, name, data, elem = this[0], attrs = elem && elem.attributes; 2738 if (key === undefined) { 2739 if (this.length) { 2740 data = dataUser.get(elem); 2741 if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { 2742 i = attrs.length; 2743 while (i--) { 2744 if (attrs[i]) { 2745 name = attrs[i].name; 2746 if (name.indexOf("data-") === 0) { 2747 name = camelCase(name.slice(5)); 2748 dataAttr(elem, name, data[name]); 2749 } 2750 } 2751 } 2752 dataPriv.set(elem, "hasDataAttrs", true); 2753 } 2754 } 2755 return data; 2756 } 2757 if (typeof key === "object") { 2758 return this.each(function() { 2759 dataUser.set(this, key); 2760 }); 2761 } 2762 return access(this, function(value2) { 2763 var data2; 2764 if (elem && value2 === undefined) { 2765 data2 = dataUser.get(elem, key); 2766 if (data2 !== undefined) { 2767 return data2; 2768 } 2769 data2 = dataAttr(elem, key); 2770 if (data2 !== undefined) { 2771 return data2; 2772 } 2773 return; 2774 } 2775 this.each(function() { 2776 dataUser.set(this, key, value2); 2777 }); 2778 }, null, value, arguments.length > 1, null, true); 2779 }, 2780 removeData: function(key) { 2781 return this.each(function() { 2782 dataUser.remove(this, key); 2783 }); 2784 } 2785 }); 2786 jQuery2.extend({ 2787 queue: function(elem, type, data) { 2788 var queue; 2789 if (elem) { 2790 type = (type || "fx") + "queue"; 2791 queue = dataPriv.get(elem, type); 2792 if (data) { 2793 if (!queue || Array.isArray(data)) { 2794 queue = dataPriv.access(elem, type, jQuery2.makeArray(data)); 2795 } else { 2796 queue.push(data); 2797 } 2798 } 2799 return queue || []; 2800 } 2801 }, 2802 dequeue: function(elem, type) { 2803 type = type || "fx"; 2804 var queue = jQuery2.queue(elem, type), startLength = queue.length, fn2 = queue.shift(), hooks = jQuery2._queueHooks(elem, type), next = function() { 2805 jQuery2.dequeue(elem, type); 2806 }; 2807 if (fn2 === "inprogress") { 2808 fn2 = queue.shift(); 2809 startLength--; 2810 } 2811 if (fn2) { 2812 if (type === "fx") { 2813 queue.unshift("inprogress"); 2814 } 2815 delete hooks.stop; 2816 fn2.call(elem, next, hooks); 2817 } 2818 if (!startLength && hooks) { 2819 hooks.empty.fire(); 2820 } 2821 }, 2822 _queueHooks: function(elem, type) { 2823 var key = type + "queueHooks"; 2824 return dataPriv.get(elem, key) || dataPriv.access(elem, key, { 2825 empty: jQuery2.Callbacks("once memory").add(function() { 2826 dataPriv.remove(elem, [type + "queue", key]); 2827 }) 2828 }); 2829 } 2830 }); 2831 jQuery2.fn.extend({ 2832 queue: function(type, data) { 2833 var setter = 2; 2834 if (typeof type !== "string") { 2835 data = type; 2836 type = "fx"; 2837 setter--; 2838 } 2839 if (arguments.length < setter) { 2840 return jQuery2.queue(this[0], type); 2841 } 2842 return data === undefined ? this : this.each(function() { 2843 var queue = jQuery2.queue(this, type, data); 2844 jQuery2._queueHooks(this, type); 2845 if (type === "fx" && queue[0] !== "inprogress") { 2846 jQuery2.dequeue(this, type); 2847 } 2848 }); 2849 }, 2850 dequeue: function(type) { 2851 return this.each(function() { 2852 jQuery2.dequeue(this, type); 2853 }); 2854 }, 2855 clearQueue: function(type) { 2856 return this.queue(type || "fx", []); 2857 }, 2858 promise: function(type, obj) { 2859 var tmp, count = 1, defer = jQuery2.Deferred(), elements = this, i = this.length, resolve = function() { 2860 if (!--count) { 2861 defer.resolveWith(elements, [elements]); 2862 } 2863 }; 2864 if (typeof type !== "string") { 2865 obj = type; 2866 type = undefined; 2867 } 2868 type = type || "fx"; 2869 while (i--) { 2870 tmp = dataPriv.get(elements[i], type + "queueHooks"); 2871 if (tmp && tmp.empty) { 2872 count++; 2873 tmp.empty.add(resolve); 2874 } 2875 } 2876 resolve(); 2877 return defer.promise(obj); 2878 } 2879 }); 2880 var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source; 2881 var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); 2882 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 2883 var documentElement = document2.documentElement; 2884 var isAttached = function(elem) { 2885 return jQuery2.contains(elem.ownerDocument, elem); 2886 }, composed = { composed: true }; 2887 if (documentElement.getRootNode) { 2888 isAttached = function(elem) { 2889 return jQuery2.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument; 2890 }; 2891 } 2892 var isHiddenWithinTree = function(elem, el) { 2893 elem = el || elem; 2894 return elem.style.display === "none" || elem.style.display === "" && isAttached(elem) && jQuery2.css(elem, "display") === "none"; 2895 }; 2896 function adjustCSS(elem, prop, valueParts, tween) { 2897 var adjusted, scale, maxIterations = 20, currentValue = tween ? function() { 2898 return tween.cur(); 2899 } : function() { 2900 return jQuery2.css(elem, prop, ""); 2901 }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery2.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery2.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery2.css(elem, prop)); 2902 if (initialInUnit && initialInUnit[3] !== unit) { 2903 initial = initial / 2; 2904 unit = unit || initialInUnit[3]; 2905 initialInUnit = +initial || 1; 2906 while (maxIterations--) { 2907 jQuery2.style(elem, prop, initialInUnit + unit); 2908 if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) { 2909 maxIterations = 0; 2910 } 2911 initialInUnit = initialInUnit / scale; 2912 } 2913 initialInUnit = initialInUnit * 2; 2914 jQuery2.style(elem, prop, initialInUnit + unit); 2915 valueParts = valueParts || []; 2916 } 2917 if (valueParts) { 2918 initialInUnit = +initialInUnit || +initial || 0; 2919 adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2]; 2920 if (tween) { 2921 tween.unit = unit; 2922 tween.start = initialInUnit; 2923 tween.end = adjusted; 2924 } 2925 } 2926 return adjusted; 2927 } 2928 var defaultDisplayMap = {}; 2929 function getDefaultDisplay(elem) { 2930 var temp, doc = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2]; 2931 if (display) { 2932 return display; 2933 } 2934 temp = doc.body.appendChild(doc.createElement(nodeName2)); 2935 display = jQuery2.css(temp, "display"); 2936 temp.parentNode.removeChild(temp); 2937 if (display === "none") { 2938 display = "block"; 2939 } 2940 defaultDisplayMap[nodeName2] = display; 2941 return display; 2942 } 2943 function showHide(elements, show) { 2944 var display, elem, values = [], index = 0, length = elements.length; 2945 for (;index < length; index++) { 2946 elem = elements[index]; 2947 if (!elem.style) { 2948 continue; 2949 } 2950 display = elem.style.display; 2951 if (show) { 2952 if (display === "none") { 2953 values[index] = dataPriv.get(elem, "display") || null; 2954 if (!values[index]) { 2955 elem.style.display = ""; 2956 } 2957 } 2958 if (elem.style.display === "" && isHiddenWithinTree(elem)) { 2959 values[index] = getDefaultDisplay(elem); 2960 } 2961 } else { 2962 if (display !== "none") { 2963 values[index] = "none"; 2964 dataPriv.set(elem, "display", display); 2965 } 2966 } 2967 } 2968 for (index = 0;index < length; index++) { 2969 if (values[index] != null) { 2970 elements[index].style.display = values[index]; 2971 } 2972 } 2973 return elements; 2974 } 2975 jQuery2.fn.extend({ 2976 show: function() { 2977 return showHide(this, true); 2978 }, 2979 hide: function() { 2980 return showHide(this); 2981 }, 2982 toggle: function(state) { 2983 if (typeof state === "boolean") { 2984 return state ? this.show() : this.hide(); 2985 } 2986 return this.each(function() { 2987 if (isHiddenWithinTree(this)) { 2988 jQuery2(this).show(); 2989 } else { 2990 jQuery2(this).hide(); 2991 } 2992 }); 2993 } 2994 }); 2995 var rcheckableType = /^(?:checkbox|radio)$/i; 2996 var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; 2997 var rscriptType = /^$|^module$|\/(?:java|ecma)script/i; 2998 (function() { 2999 var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input"); 3000 input.setAttribute("type", "radio"); 3001 input.setAttribute("checked", "checked"); 3002 input.setAttribute("name", "t"); 3003 div.appendChild(input); 3004 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 3005 div.innerHTML = "<textarea>x</textarea>"; 3006 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; 3007 div.innerHTML = "<option></option>"; 3008 support.option = !!div.lastChild; 3009 })(); 3010 var wrapMap = { 3011 thead: [1, "<table>", "</table>"], 3012 col: [2, "<table><colgroup>", "</colgroup></table>"], 3013 tr: [2, "<table><tbody>", "</tbody></table>"], 3014 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 3015 _default: [0, "", ""] 3016 }; 3017 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 3018 wrapMap.th = wrapMap.td; 3019 if (!support.option) { 3020 wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"]; 3021 } 3022 function getAll(context, tag) { 3023 var ret; 3024 if (typeof context.getElementsByTagName !== "undefined") { 3025 ret = context.getElementsByTagName(tag || "*"); 3026 } else if (typeof context.querySelectorAll !== "undefined") { 3027 ret = context.querySelectorAll(tag || "*"); 3028 } else { 3029 ret = []; 3030 } 3031 if (tag === undefined || tag && nodeName(context, tag)) { 3032 return jQuery2.merge([context], ret); 3033 } 3034 return ret; 3035 } 3036 function setGlobalEval(elems, refElements) { 3037 var i = 0, l2 = elems.length; 3038 for (;i < l2; i++) { 3039 dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval")); 3040 } 3041 } 3042 var rhtml = /<|&#?\w+;/; 3043 function buildFragment(elems, context, scripts, selection, ignored) { 3044 var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l2 = elems.length; 3045 for (;i < l2; i++) { 3046 elem = elems[i]; 3047 if (elem || elem === 0) { 3048 if (toType2(elem) === "object") { 3049 jQuery2.merge(nodes, elem.nodeType ? [elem] : elem); 3050 } else if (!rhtml.test(elem)) { 3051 nodes.push(context.createTextNode(elem)); 3052 } else { 3053 tmp = tmp || fragment.appendChild(context.createElement("div")); 3054 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 3055 wrap = wrapMap[tag] || wrapMap._default; 3056 tmp.innerHTML = wrap[1] + jQuery2.htmlPrefilter(elem) + wrap[2]; 3057 j = wrap[0]; 3058 while (j--) { 3059 tmp = tmp.lastChild; 3060 } 3061 jQuery2.merge(nodes, tmp.childNodes); 3062 tmp = fragment.firstChild; 3063 tmp.textContent = ""; 3064 } 3065 } 3066 } 3067 fragment.textContent = ""; 3068 i = 0; 3069 while (elem = nodes[i++]) { 3070 if (selection && jQuery2.inArray(elem, selection) > -1) { 3071 if (ignored) { 3072 ignored.push(elem); 3073 } 3074 continue; 3075 } 3076 attached = isAttached(elem); 3077 tmp = getAll(fragment.appendChild(elem), "script"); 3078 if (attached) { 3079 setGlobalEval(tmp); 3080 } 3081 if (scripts) { 3082 j = 0; 3083 while (elem = tmp[j++]) { 3084 if (rscriptType.test(elem.type || "")) { 3085 scripts.push(elem); 3086 } 3087 } 3088 } 3089 } 3090 return fragment; 3091 } 3092 var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 3093 function returnTrue() { 3094 return true; 3095 } 3096 function returnFalse() { 3097 return false; 3098 } 3099 function on(elem, types, selector, data, fn2, one) { 3100 var origFn, type; 3101 if (typeof types === "object") { 3102 if (typeof selector !== "string") { 3103 data = data || selector; 3104 selector = undefined; 3105 } 3106 for (type in types) { 3107 on(elem, type, selector, data, types[type], one); 3108 } 3109 return elem; 3110 } 3111 if (data == null && fn2 == null) { 3112 fn2 = selector; 3113 data = selector = undefined; 3114 } else if (fn2 == null) { 3115 if (typeof selector === "string") { 3116 fn2 = data; 3117 data = undefined; 3118 } else { 3119 fn2 = data; 3120 data = selector; 3121 selector = undefined; 3122 } 3123 } 3124 if (fn2 === false) { 3125 fn2 = returnFalse; 3126 } else if (!fn2) { 3127 return elem; 3128 } 3129 if (one === 1) { 3130 origFn = fn2; 3131 fn2 = function(event) { 3132 jQuery2().off(event); 3133 return origFn.apply(this, arguments); 3134 }; 3135 fn2.guid = origFn.guid || (origFn.guid = jQuery2.guid++); 3136 } 3137 return elem.each(function() { 3138 jQuery2.event.add(this, types, fn2, data, selector); 3139 }); 3140 } 3141 jQuery2.event = { 3142 global: {}, 3143 add: function(elem, types, handler, data, selector) { 3144 var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem); 3145 if (!acceptData(elem)) { 3146 return; 3147 } 3148 if (handler.handler) { 3149 handleObjIn = handler; 3150 handler = handleObjIn.handler; 3151 selector = handleObjIn.selector; 3152 } 3153 if (selector) { 3154 jQuery2.find.matchesSelector(documentElement, selector); 3155 } 3156 if (!handler.guid) { 3157 handler.guid = jQuery2.guid++; 3158 } 3159 if (!(events = elemData.events)) { 3160 events = elemData.events = Object.create(null); 3161 } 3162 if (!(eventHandle = elemData.handle)) { 3163 eventHandle = elemData.handle = function(e) { 3164 return typeof jQuery2 !== "undefined" && jQuery2.event.triggered !== e.type ? jQuery2.event.dispatch.apply(elem, arguments) : undefined; 3165 }; 3166 } 3167 types = (types || "").match(rnothtmlwhite) || [""]; 3168 t = types.length; 3169 while (t--) { 3170 tmp = rtypenamespace.exec(types[t]) || []; 3171 type = origType = tmp[1]; 3172 namespaces = (tmp[2] || "").split(".").sort(); 3173 if (!type) { 3174 continue; 3175 } 3176 special = jQuery2.event.special[type] || {}; 3177 type = (selector ? special.delegateType : special.bindType) || type; 3178 special = jQuery2.event.special[type] || {}; 3179 handleObj = jQuery2.extend({ 3180 type, 3181 origType, 3182 data, 3183 handler, 3184 guid: handler.guid, 3185 selector, 3186 needsContext: selector && jQuery2.expr.match.needsContext.test(selector), 3187 namespace: namespaces.join(".") 3188 }, handleObjIn); 3189 if (!(handlers = events[type])) { 3190 handlers = events[type] = []; 3191 handlers.delegateCount = 0; 3192 if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) { 3193 if (elem.addEventListener) { 3194 elem.addEventListener(type, eventHandle); 3195 } 3196 } 3197 } 3198 if (special.add) { 3199 special.add.call(elem, handleObj); 3200 if (!handleObj.handler.guid) { 3201 handleObj.handler.guid = handler.guid; 3202 } 3203 } 3204 if (selector) { 3205 handlers.splice(handlers.delegateCount++, 0, handleObj); 3206 } else { 3207 handlers.push(handleObj); 3208 } 3209 jQuery2.event.global[type] = true; 3210 } 3211 }, 3212 remove: function(elem, types, handler, selector, mappedTypes) { 3213 var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem); 3214 if (!elemData || !(events = elemData.events)) { 3215 return; 3216 } 3217 types = (types || "").match(rnothtmlwhite) || [""]; 3218 t = types.length; 3219 while (t--) { 3220 tmp = rtypenamespace.exec(types[t]) || []; 3221 type = origType = tmp[1]; 3222 namespaces = (tmp[2] || "").split(".").sort(); 3223 if (!type) { 3224 for (type in events) { 3225 jQuery2.event.remove(elem, type + types[t], handler, selector, true); 3226 } 3227 continue; 3228 } 3229 special = jQuery2.event.special[type] || {}; 3230 type = (selector ? special.delegateType : special.bindType) || type; 3231 handlers = events[type] || []; 3232 tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 3233 origCount = j = handlers.length; 3234 while (j--) { 3235 handleObj = handlers[j]; 3236 if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) { 3237 handlers.splice(j, 1); 3238 if (handleObj.selector) { 3239 handlers.delegateCount--; 3240 } 3241 if (special.remove) { 3242 special.remove.call(elem, handleObj); 3243 } 3244 } 3245 } 3246 if (origCount && !handlers.length) { 3247 if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) { 3248 jQuery2.removeEvent(elem, type, elemData.handle); 3249 } 3250 delete events[type]; 3251 } 3252 } 3253 if (jQuery2.isEmptyObject(events)) { 3254 dataPriv.remove(elem, "handle events"); 3255 } 3256 }, 3257 dispatch: function(nativeEvent) { 3258 var i, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event = jQuery2.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || Object.create(null))[event.type] || [], special = jQuery2.event.special[event.type] || {}; 3259 args[0] = event; 3260 for (i = 1;i < arguments.length; i++) { 3261 args[i] = arguments[i]; 3262 } 3263 event.delegateTarget = this; 3264 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 3265 return; 3266 } 3267 handlerQueue = jQuery2.event.handlers.call(this, event, handlers); 3268 i = 0; 3269 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { 3270 event.currentTarget = matched.elem; 3271 j = 0; 3272 while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) { 3273 if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) { 3274 event.handleObj = handleObj; 3275 event.data = handleObj.data; 3276 ret = ((jQuery2.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args); 3277 if (ret !== undefined) { 3278 if ((event.result = ret) === false) { 3279 event.preventDefault(); 3280 event.stopPropagation(); 3281 } 3282 } 3283 } 3284 } 3285 } 3286 if (special.postDispatch) { 3287 special.postDispatch.call(this, event); 3288 } 3289 return event.result; 3290 }, 3291 handlers: function(event, handlers) { 3292 var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; 3293 if (delegateCount && cur.nodeType && !(event.type === "click" && event.button >= 1)) { 3294 for (;cur !== this; cur = cur.parentNode || this) { 3295 if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { 3296 matchedHandlers = []; 3297 matchedSelectors = {}; 3298 for (i = 0;i < delegateCount; i++) { 3299 handleObj = handlers[i]; 3300 sel = handleObj.selector + " "; 3301 if (matchedSelectors[sel] === undefined) { 3302 matchedSelectors[sel] = handleObj.needsContext ? jQuery2(sel, this).index(cur) > -1 : jQuery2.find(sel, this, null, [cur]).length; 3303 } 3304 if (matchedSelectors[sel]) { 3305 matchedHandlers.push(handleObj); 3306 } 3307 } 3308 if (matchedHandlers.length) { 3309 handlerQueue.push({ elem: cur, handlers: matchedHandlers }); 3310 } 3311 } 3312 } 3313 } 3314 cur = this; 3315 if (delegateCount < handlers.length) { 3316 handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) }); 3317 } 3318 return handlerQueue; 3319 }, 3320 addProp: function(name, hook) { 3321 Object.defineProperty(jQuery2.Event.prototype, name, { 3322 enumerable: true, 3323 configurable: true, 3324 get: isFunction(hook) ? function() { 3325 if (this.originalEvent) { 3326 return hook(this.originalEvent); 3327 } 3328 } : function() { 3329 if (this.originalEvent) { 3330 return this.originalEvent[name]; 3331 } 3332 }, 3333 set: function(value) { 3334 Object.defineProperty(this, name, { 3335 enumerable: true, 3336 configurable: true, 3337 writable: true, 3338 value 3339 }); 3340 } 3341 }); 3342 }, 3343 fix: function(originalEvent) { 3344 return originalEvent[jQuery2.expando] ? originalEvent : new jQuery2.Event(originalEvent); 3345 }, 3346 special: { 3347 load: { 3348 noBubble: true 3349 }, 3350 click: { 3351 setup: function(data) { 3352 var el = this || data; 3353 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 3354 leverageNative(el, "click", true); 3355 } 3356 return false; 3357 }, 3358 trigger: function(data) { 3359 var el = this || data; 3360 if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) { 3361 leverageNative(el, "click"); 3362 } 3363 return true; 3364 }, 3365 _default: function(event) { 3366 var target = event.target; 3367 return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a"); 3368 } 3369 }, 3370 beforeunload: { 3371 postDispatch: function(event) { 3372 if (event.result !== undefined && event.originalEvent) { 3373 event.originalEvent.returnValue = event.result; 3374 } 3375 } 3376 } 3377 } 3378 }; 3379 function leverageNative(el, type, isSetup) { 3380 if (!isSetup) { 3381 if (dataPriv.get(el, type) === undefined) { 3382 jQuery2.event.add(el, type, returnTrue); 3383 } 3384 return; 3385 } 3386 dataPriv.set(el, type, false); 3387 jQuery2.event.add(el, type, { 3388 namespace: false, 3389 handler: function(event) { 3390 var result, saved = dataPriv.get(this, type); 3391 if (event.isTrigger & 1 && this[type]) { 3392 if (!saved) { 3393 saved = slice.call(arguments); 3394 dataPriv.set(this, type, saved); 3395 this[type](); 3396 result = dataPriv.get(this, type); 3397 dataPriv.set(this, type, false); 3398 if (saved !== result) { 3399 event.stopImmediatePropagation(); 3400 event.preventDefault(); 3401 return result; 3402 } 3403 } else if ((jQuery2.event.special[type] || {}).delegateType) { 3404 event.stopPropagation(); 3405 } 3406 } else if (saved) { 3407 dataPriv.set(this, type, jQuery2.event.trigger(saved[0], saved.slice(1), this)); 3408 event.stopPropagation(); 3409 event.isImmediatePropagationStopped = returnTrue; 3410 } 3411 } 3412 }); 3413 } 3414 jQuery2.removeEvent = function(elem, type, handle) { 3415 if (elem.removeEventListener) { 3416 elem.removeEventListener(type, handle); 3417 } 3418 }; 3419 jQuery2.Event = function(src, props) { 3420 if (!(this instanceof jQuery2.Event)) { 3421 return new jQuery2.Event(src, props); 3422 } 3423 if (src && src.type) { 3424 this.originalEvent = src; 3425 this.type = src.type; 3426 this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse; 3427 this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target; 3428 this.currentTarget = src.currentTarget; 3429 this.relatedTarget = src.relatedTarget; 3430 } else { 3431 this.type = src; 3432 } 3433 if (props) { 3434 jQuery2.extend(this, props); 3435 } 3436 this.timeStamp = src && src.timeStamp || Date.now(); 3437 this[jQuery2.expando] = true; 3438 }; 3439 jQuery2.Event.prototype = { 3440 constructor: jQuery2.Event, 3441 isDefaultPrevented: returnFalse, 3442 isPropagationStopped: returnFalse, 3443 isImmediatePropagationStopped: returnFalse, 3444 isSimulated: false, 3445 preventDefault: function() { 3446 var e = this.originalEvent; 3447 this.isDefaultPrevented = returnTrue; 3448 if (e && !this.isSimulated) { 3449 e.preventDefault(); 3450 } 3451 }, 3452 stopPropagation: function() { 3453 var e = this.originalEvent; 3454 this.isPropagationStopped = returnTrue; 3455 if (e && !this.isSimulated) { 3456 e.stopPropagation(); 3457 } 3458 }, 3459 stopImmediatePropagation: function() { 3460 var e = this.originalEvent; 3461 this.isImmediatePropagationStopped = returnTrue; 3462 if (e && !this.isSimulated) { 3463 e.stopImmediatePropagation(); 3464 } 3465 this.stopPropagation(); 3466 } 3467 }; 3468 jQuery2.each({ 3469 altKey: true, 3470 bubbles: true, 3471 cancelable: true, 3472 changedTouches: true, 3473 ctrlKey: true, 3474 detail: true, 3475 eventPhase: true, 3476 metaKey: true, 3477 pageX: true, 3478 pageY: true, 3479 shiftKey: true, 3480 view: true, 3481 char: true, 3482 code: true, 3483 charCode: true, 3484 key: true, 3485 keyCode: true, 3486 button: true, 3487 buttons: true, 3488 clientX: true, 3489 clientY: true, 3490 offsetX: true, 3491 offsetY: true, 3492 pointerId: true, 3493 pointerType: true, 3494 screenX: true, 3495 screenY: true, 3496 targetTouches: true, 3497 toElement: true, 3498 touches: true, 3499 which: true 3500 }, jQuery2.event.addProp); 3501 jQuery2.each({ focus: "focusin", blur: "focusout" }, function(type, delegateType) { 3502 function focusMappedHandler(nativeEvent) { 3503 if (document2.documentMode) { 3504 var handle = dataPriv.get(this, "handle"), event = jQuery2.event.fix(nativeEvent); 3505 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 3506 event.isSimulated = true; 3507 handle(nativeEvent); 3508 if (event.target === event.currentTarget) { 3509 handle(event); 3510 } 3511 } else { 3512 jQuery2.event.simulate(delegateType, nativeEvent.target, jQuery2.event.fix(nativeEvent)); 3513 } 3514 } 3515 jQuery2.event.special[type] = { 3516 setup: function() { 3517 var attaches; 3518 leverageNative(this, type, true); 3519 if (document2.documentMode) { 3520 attaches = dataPriv.get(this, delegateType); 3521 if (!attaches) { 3522 this.addEventListener(delegateType, focusMappedHandler); 3523 } 3524 dataPriv.set(this, delegateType, (attaches || 0) + 1); 3525 } else { 3526 return false; 3527 } 3528 }, 3529 trigger: function() { 3530 leverageNative(this, type); 3531 return true; 3532 }, 3533 teardown: function() { 3534 var attaches; 3535 if (document2.documentMode) { 3536 attaches = dataPriv.get(this, delegateType) - 1; 3537 if (!attaches) { 3538 this.removeEventListener(delegateType, focusMappedHandler); 3539 dataPriv.remove(this, delegateType); 3540 } else { 3541 dataPriv.set(this, delegateType, attaches); 3542 } 3543 } else { 3544 return false; 3545 } 3546 }, 3547 _default: function(event) { 3548 return dataPriv.get(event.target, type); 3549 }, 3550 delegateType 3551 }; 3552 jQuery2.event.special[delegateType] = { 3553 setup: function() { 3554 var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType); 3555 if (!attaches) { 3556 if (document2.documentMode) { 3557 this.addEventListener(delegateType, focusMappedHandler); 3558 } else { 3559 doc.addEventListener(type, focusMappedHandler, true); 3560 } 3561 } 3562 dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1); 3563 }, 3564 teardown: function() { 3565 var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType) - 1; 3566 if (!attaches) { 3567 if (document2.documentMode) { 3568 this.removeEventListener(delegateType, focusMappedHandler); 3569 } else { 3570 doc.removeEventListener(type, focusMappedHandler, true); 3571 } 3572 dataPriv.remove(dataHolder, delegateType); 3573 } else { 3574 dataPriv.set(dataHolder, delegateType, attaches); 3575 } 3576 } 3577 }; 3578 }); 3579 jQuery2.each({ 3580 mouseenter: "mouseover", 3581 mouseleave: "mouseout", 3582 pointerenter: "pointerover", 3583 pointerleave: "pointerout" 3584 }, function(orig, fix) { 3585 jQuery2.event.special[orig] = { 3586 delegateType: fix, 3587 bindType: fix, 3588 handle: function(event) { 3589 var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; 3590 if (!related || related !== target && !jQuery2.contains(target, related)) { 3591 event.type = handleObj.origType; 3592 ret = handleObj.handler.apply(this, arguments); 3593 event.type = fix; 3594 } 3595 return ret; 3596 } 3597 }; 3598 }); 3599 jQuery2.fn.extend({ 3600 on: function(types, selector, data, fn2) { 3601 return on(this, types, selector, data, fn2); 3602 }, 3603 one: function(types, selector, data, fn2) { 3604 return on(this, types, selector, data, fn2, 1); 3605 }, 3606 off: function(types, selector, fn2) { 3607 var handleObj, type; 3608 if (types && types.preventDefault && types.handleObj) { 3609 handleObj = types.handleObj; 3610 jQuery2(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler); 3611 return this; 3612 } 3613 if (typeof types === "object") { 3614 for (type in types) { 3615 this.off(type, selector, types[type]); 3616 } 3617 return this; 3618 } 3619 if (selector === false || typeof selector === "function") { 3620 fn2 = selector; 3621 selector = undefined; 3622 } 3623 if (fn2 === false) { 3624 fn2 = returnFalse; 3625 } 3626 return this.each(function() { 3627 jQuery2.event.remove(this, types, fn2, selector); 3628 }); 3629 } 3630 }); 3631 var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 3632 function manipulationTarget(elem, content) { 3633 if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { 3634 return jQuery2(elem).children("tbody")[0] || elem; 3635 } 3636 return elem; 3637 } 3638 function disableScript(elem) { 3639 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 3640 return elem; 3641 } 3642 function restoreScript(elem) { 3643 if ((elem.type || "").slice(0, 5) === "true/") { 3644 elem.type = elem.type.slice(5); 3645 } else { 3646 elem.removeAttribute("type"); 3647 } 3648 return elem; 3649 } 3650 function cloneCopyEvent(src, dest) { 3651 var i, l2, type, pdataOld, udataOld, udataCur, events; 3652 if (dest.nodeType !== 1) { 3653 return; 3654 } 3655 if (dataPriv.hasData(src)) { 3656 pdataOld = dataPriv.get(src); 3657 events = pdataOld.events; 3658 if (events) { 3659 dataPriv.remove(dest, "handle events"); 3660 for (type in events) { 3661 for (i = 0, l2 = events[type].length;i < l2; i++) { 3662 jQuery2.event.add(dest, type, events[type][i]); 3663 } 3664 } 3665 } 3666 } 3667 if (dataUser.hasData(src)) { 3668 udataOld = dataUser.access(src); 3669 udataCur = jQuery2.extend({}, udataOld); 3670 dataUser.set(dest, udataCur); 3671 } 3672 } 3673 function fixInput(src, dest) { 3674 var nodeName2 = dest.nodeName.toLowerCase(); 3675 if (nodeName2 === "input" && rcheckableType.test(src.type)) { 3676 dest.checked = src.checked; 3677 } else if (nodeName2 === "input" || nodeName2 === "textarea") { 3678 dest.defaultValue = src.defaultValue; 3679 } 3680 } 3681 function domManip(collection, args, callback, ignored) { 3682 args = flat(args); 3683 var fragment, first, scripts, hasScripts, node, doc, i = 0, l2 = collection.length, iNoClone = l2 - 1, value = args[0], valueIsFunction = isFunction(value); 3684 if (valueIsFunction || l2 > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) { 3685 return collection.each(function(index) { 3686 var self = collection.eq(index); 3687 if (valueIsFunction) { 3688 args[0] = value.call(this, index, self.html()); 3689 } 3690 domManip(self, args, callback, ignored); 3691 }); 3692 } 3693 if (l2) { 3694 fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored); 3695 first = fragment.firstChild; 3696 if (fragment.childNodes.length === 1) { 3697 fragment = first; 3698 } 3699 if (first || ignored) { 3700 scripts = jQuery2.map(getAll(fragment, "script"), disableScript); 3701 hasScripts = scripts.length; 3702 for (;i < l2; i++) { 3703 node = fragment; 3704 if (i !== iNoClone) { 3705 node = jQuery2.clone(node, true, true); 3706 if (hasScripts) { 3707 jQuery2.merge(scripts, getAll(node, "script")); 3708 } 3709 } 3710 callback.call(collection[i], node, i); 3711 } 3712 if (hasScripts) { 3713 doc = scripts[scripts.length - 1].ownerDocument; 3714 jQuery2.map(scripts, restoreScript); 3715 for (i = 0;i < hasScripts; i++) { 3716 node = scripts[i]; 3717 if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery2.contains(doc, node)) { 3718 if (node.src && (node.type || "").toLowerCase() !== "module") { 3719 if (jQuery2._evalUrl && !node.noModule) { 3720 jQuery2._evalUrl(node.src, { 3721 nonce: node.nonce || node.getAttribute("nonce") 3722 }, doc); 3723 } 3724 } else { 3725 DOMEval(node.textContent.replace(rcleanScript, ""), node, doc); 3726 } 3727 } 3728 } 3729 } 3730 } 3731 } 3732 return collection; 3733 } 3734 function remove(elem, selector, keepData) { 3735 var node, nodes = selector ? jQuery2.filter(selector, elem) : elem, i = 0; 3736 for (;(node = nodes[i]) != null; i++) { 3737 if (!keepData && node.nodeType === 1) { 3738 jQuery2.cleanData(getAll(node)); 3739 } 3740 if (node.parentNode) { 3741 if (keepData && isAttached(node)) { 3742 setGlobalEval(getAll(node, "script")); 3743 } 3744 node.parentNode.removeChild(node); 3745 } 3746 } 3747 return elem; 3748 } 3749 jQuery2.extend({ 3750 htmlPrefilter: function(html) { 3751 return html; 3752 }, 3753 clone: function(elem, dataAndEvents, deepDataAndEvents) { 3754 var i, l2, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem); 3755 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery2.isXMLDoc(elem)) { 3756 destElements = getAll(clone); 3757 srcElements = getAll(elem); 3758 for (i = 0, l2 = srcElements.length;i < l2; i++) { 3759 fixInput(srcElements[i], destElements[i]); 3760 } 3761 } 3762 if (dataAndEvents) { 3763 if (deepDataAndEvents) { 3764 srcElements = srcElements || getAll(elem); 3765 destElements = destElements || getAll(clone); 3766 for (i = 0, l2 = srcElements.length;i < l2; i++) { 3767 cloneCopyEvent(srcElements[i], destElements[i]); 3768 } 3769 } else { 3770 cloneCopyEvent(elem, clone); 3771 } 3772 } 3773 destElements = getAll(clone, "script"); 3774 if (destElements.length > 0) { 3775 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 3776 } 3777 return clone; 3778 }, 3779 cleanData: function(elems) { 3780 var data, elem, type, special = jQuery2.event.special, i = 0; 3781 for (;(elem = elems[i]) !== undefined; i++) { 3782 if (acceptData(elem)) { 3783 if (data = elem[dataPriv.expando]) { 3784 if (data.events) { 3785 for (type in data.events) { 3786 if (special[type]) { 3787 jQuery2.event.remove(elem, type); 3788 } else { 3789 jQuery2.removeEvent(elem, type, data.handle); 3790 } 3791 } 3792 } 3793 elem[dataPriv.expando] = undefined; 3794 } 3795 if (elem[dataUser.expando]) { 3796 elem[dataUser.expando] = undefined; 3797 } 3798 } 3799 } 3800 } 3801 }); 3802 jQuery2.fn.extend({ 3803 detach: function(selector) { 3804 return remove(this, selector, true); 3805 }, 3806 remove: function(selector) { 3807 return remove(this, selector); 3808 }, 3809 text: function(value) { 3810 return access(this, function(value2) { 3811 return value2 === undefined ? jQuery2.text(this) : this.empty().each(function() { 3812 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3813 this.textContent = value2; 3814 } 3815 }); 3816 }, null, value, arguments.length); 3817 }, 3818 append: function() { 3819 return domManip(this, arguments, function(elem) { 3820 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3821 var target = manipulationTarget(this, elem); 3822 target.appendChild(elem); 3823 } 3824 }); 3825 }, 3826 prepend: function() { 3827 return domManip(this, arguments, function(elem) { 3828 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 3829 var target = manipulationTarget(this, elem); 3830 target.insertBefore(elem, target.firstChild); 3831 } 3832 }); 3833 }, 3834 before: function() { 3835 return domManip(this, arguments, function(elem) { 3836 if (this.parentNode) { 3837 this.parentNode.insertBefore(elem, this); 3838 } 3839 }); 3840 }, 3841 after: function() { 3842 return domManip(this, arguments, function(elem) { 3843 if (this.parentNode) { 3844 this.parentNode.insertBefore(elem, this.nextSibling); 3845 } 3846 }); 3847 }, 3848 empty: function() { 3849 var elem, i = 0; 3850 for (;(elem = this[i]) != null; i++) { 3851 if (elem.nodeType === 1) { 3852 jQuery2.cleanData(getAll(elem, false)); 3853 elem.textContent = ""; 3854 } 3855 } 3856 return this; 3857 }, 3858 clone: function(dataAndEvents, deepDataAndEvents) { 3859 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 3860 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 3861 return this.map(function() { 3862 return jQuery2.clone(this, dataAndEvents, deepDataAndEvents); 3863 }); 3864 }, 3865 html: function(value) { 3866 return access(this, function(value2) { 3867 var elem = this[0] || {}, i = 0, l2 = this.length; 3868 if (value2 === undefined && elem.nodeType === 1) { 3869 return elem.innerHTML; 3870 } 3871 if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) { 3872 value2 = jQuery2.htmlPrefilter(value2); 3873 try { 3874 for (;i < l2; i++) { 3875 elem = this[i] || {}; 3876 if (elem.nodeType === 1) { 3877 jQuery2.cleanData(getAll(elem, false)); 3878 elem.innerHTML = value2; 3879 } 3880 } 3881 elem = 0; 3882 } catch (e) {} 3883 } 3884 if (elem) { 3885 this.empty().append(value2); 3886 } 3887 }, null, value, arguments.length); 3888 }, 3889 replaceWith: function() { 3890 var ignored = []; 3891 return domManip(this, arguments, function(elem) { 3892 var parent = this.parentNode; 3893 if (jQuery2.inArray(this, ignored) < 0) { 3894 jQuery2.cleanData(getAll(this)); 3895 if (parent) { 3896 parent.replaceChild(elem, this); 3897 } 3898 } 3899 }, ignored); 3900 } 3901 }); 3902 jQuery2.each({ 3903 appendTo: "append", 3904 prependTo: "prepend", 3905 insertBefore: "before", 3906 insertAfter: "after", 3907 replaceAll: "replaceWith" 3908 }, function(name, original) { 3909 jQuery2.fn[name] = function(selector) { 3910 var elems, ret = [], insert = jQuery2(selector), last = insert.length - 1, i = 0; 3911 for (;i <= last; i++) { 3912 elems = i === last ? this : this.clone(true); 3913 jQuery2(insert[i])[original](elems); 3914 push.apply(ret, elems.get()); 3915 } 3916 return this.pushStack(ret); 3917 }; 3918 }); 3919 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 3920 var rcustomProp = /^--/; 3921 var getStyles = function(elem) { 3922 var view = elem.ownerDocument.defaultView; 3923 if (!view || !view.opener) { 3924 view = window2; 3925 } 3926 return view.getComputedStyle(elem); 3927 }; 3928 var swap = function(elem, options, callback) { 3929 var ret, name, old = {}; 3930 for (name in options) { 3931 old[name] = elem.style[name]; 3932 elem.style[name] = options[name]; 3933 } 3934 ret = callback.call(elem); 3935 for (name in options) { 3936 elem.style[name] = old[name]; 3937 } 3938 return ret; 3939 }; 3940 var rboxStyle = new RegExp(cssExpand.join("|"), "i"); 3941 (function() { 3942 function computeStyleTests() { 3943 if (!div) { 3944 return; 3945 } 3946 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0"; 3947 div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%"; 3948 documentElement.appendChild(container).appendChild(div); 3949 var divStyle = window2.getComputedStyle(div); 3950 pixelPositionVal = divStyle.top !== "1%"; 3951 reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; 3952 div.style.right = "60%"; 3953 pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; 3954 boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; 3955 div.style.position = "absolute"; 3956 scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; 3957 documentElement.removeChild(container); 3958 div = null; 3959 } 3960 function roundPixelMeasures(measure) { 3961 return Math.round(parseFloat(measure)); 3962 } 3963 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div"); 3964 if (!div.style) { 3965 return; 3966 } 3967 div.style.backgroundClip = "content-box"; 3968 div.cloneNode(true).style.backgroundClip = ""; 3969 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 3970 jQuery2.extend(support, { 3971 boxSizingReliable: function() { 3972 computeStyleTests(); 3973 return boxSizingReliableVal; 3974 }, 3975 pixelBoxStyles: function() { 3976 computeStyleTests(); 3977 return pixelBoxStylesVal; 3978 }, 3979 pixelPosition: function() { 3980 computeStyleTests(); 3981 return pixelPositionVal; 3982 }, 3983 reliableMarginLeft: function() { 3984 computeStyleTests(); 3985 return reliableMarginLeftVal; 3986 }, 3987 scrollboxSize: function() { 3988 computeStyleTests(); 3989 return scrollboxSizeVal; 3990 }, 3991 reliableTrDimensions: function() { 3992 var table, tr, trChild, trStyle; 3993 if (reliableTrDimensionsVal == null) { 3994 table = document2.createElement("table"); 3995 tr = document2.createElement("tr"); 3996 trChild = document2.createElement("div"); 3997 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 3998 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 3999 tr.style.height = "1px"; 4000 trChild.style.height = "9px"; 4001 trChild.style.display = "block"; 4002 documentElement.appendChild(table).appendChild(tr).appendChild(trChild); 4003 trStyle = window2.getComputedStyle(tr); 4004 reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight; 4005 documentElement.removeChild(table); 4006 } 4007 return reliableTrDimensionsVal; 4008 } 4009 }); 4010 })(); 4011 function curCSS(elem, name, computed) { 4012 var width, minWidth, maxWidth, ret, isCustomProp = rcustomProp.test(name), style = elem.style; 4013 computed = computed || getStyles(elem); 4014 if (computed) { 4015 ret = computed.getPropertyValue(name) || computed[name]; 4016 if (isCustomProp && ret) { 4017 ret = ret.replace(rtrimCSS, "$1") || undefined; 4018 } 4019 if (ret === "" && !isAttached(elem)) { 4020 ret = jQuery2.style(elem, name); 4021 } 4022 if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) { 4023 width = style.width; 4024 minWidth = style.minWidth; 4025 maxWidth = style.maxWidth; 4026 style.minWidth = style.maxWidth = style.width = ret; 4027 ret = computed.width; 4028 style.width = width; 4029 style.minWidth = minWidth; 4030 style.maxWidth = maxWidth; 4031 } 4032 } 4033 return ret !== undefined ? ret + "" : ret; 4034 } 4035 function addGetHookIf(conditionFn, hookFn) { 4036 return { 4037 get: function() { 4038 if (conditionFn()) { 4039 delete this.get; 4040 return; 4041 } 4042 return (this.get = hookFn).apply(this, arguments); 4043 } 4044 }; 4045 } 4046 var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {}; 4047 function vendorPropName(name) { 4048 var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length; 4049 while (i--) { 4050 name = cssPrefixes[i] + capName; 4051 if (name in emptyStyle) { 4052 return name; 4053 } 4054 } 4055 } 4056 function finalPropName(name) { 4057 var final = jQuery2.cssProps[name] || vendorProps[name]; 4058 if (final) { 4059 return final; 4060 } 4061 if (name in emptyStyle) { 4062 return name; 4063 } 4064 return vendorProps[name] = vendorPropName(name) || name; 4065 } 4066 var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { 4067 letterSpacing: "0", 4068 fontWeight: "400" 4069 }; 4070 function setPositiveNumber(_elem, value, subtract) { 4071 var matches = rcssNum.exec(value); 4072 return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value; 4073 } 4074 function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) { 4075 var i = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0; 4076 if (box === (isBorderBox ? "border" : "content")) { 4077 return 0; 4078 } 4079 for (;i < 4; i += 2) { 4080 if (box === "margin") { 4081 marginDelta += jQuery2.css(elem, box + cssExpand[i], true, styles); 4082 } 4083 if (!isBorderBox) { 4084 delta += jQuery2.css(elem, "padding" + cssExpand[i], true, styles); 4085 if (box !== "padding") { 4086 delta += jQuery2.css(elem, "border" + cssExpand[i] + "Width", true, styles); 4087 } else { 4088 extra += jQuery2.css(elem, "border" + cssExpand[i] + "Width", true, styles); 4089 } 4090 } else { 4091 if (box === "content") { 4092 delta -= jQuery2.css(elem, "padding" + cssExpand[i], true, styles); 4093 } 4094 if (box !== "margin") { 4095 delta -= jQuery2.css(elem, "border" + cssExpand[i] + "Width", true, styles); 4096 } 4097 } 4098 } 4099 if (!isBorderBox && computedVal >= 0) { 4100 delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5)) || 0; 4101 } 4102 return delta + marginDelta; 4103 } 4104 function getWidthOrHeight(elem, dimension, extra) { 4105 var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery2.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); 4106 if (rnumnonpx.test(val)) { 4107 if (!extra) { 4108 return val; 4109 } 4110 val = "auto"; 4111 } 4112 if ((!support.boxSizingReliable() && isBorderBox || !support.reliableTrDimensions() && nodeName(elem, "tr") || val === "auto" || !parseFloat(val) && jQuery2.css(elem, "display", false, styles) === "inline") && elem.getClientRects().length) { 4113 isBorderBox = jQuery2.css(elem, "boxSizing", false, styles) === "border-box"; 4114 valueIsBorderBox = offsetProp in elem; 4115 if (valueIsBorderBox) { 4116 val = elem[offsetProp]; 4117 } 4118 } 4119 val = parseFloat(val) || 0; 4120 return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles, val) + "px"; 4121 } 4122 jQuery2.extend({ 4123 cssHooks: { 4124 opacity: { 4125 get: function(elem, computed) { 4126 if (computed) { 4127 var ret = curCSS(elem, "opacity"); 4128 return ret === "" ? "1" : ret; 4129 } 4130 } 4131 } 4132 }, 4133 cssNumber: { 4134 animationIterationCount: true, 4135 aspectRatio: true, 4136 borderImageSlice: true, 4137 columnCount: true, 4138 flexGrow: true, 4139 flexShrink: true, 4140 fontWeight: true, 4141 gridArea: true, 4142 gridColumn: true, 4143 gridColumnEnd: true, 4144 gridColumnStart: true, 4145 gridRow: true, 4146 gridRowEnd: true, 4147 gridRowStart: true, 4148 lineHeight: true, 4149 opacity: true, 4150 order: true, 4151 orphans: true, 4152 scale: true, 4153 widows: true, 4154 zIndex: true, 4155 zoom: true, 4156 fillOpacity: true, 4157 floodOpacity: true, 4158 stopOpacity: true, 4159 strokeMiterlimit: true, 4160 strokeOpacity: true 4161 }, 4162 cssProps: {}, 4163 style: function(elem, name, value, extra) { 4164 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 4165 return; 4166 } 4167 var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style; 4168 if (!isCustomProp) { 4169 name = finalPropName(origName); 4170 } 4171 hooks = jQuery2.cssHooks[name] || jQuery2.cssHooks[origName]; 4172 if (value !== undefined) { 4173 type = typeof value; 4174 if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { 4175 value = adjustCSS(elem, name, ret); 4176 type = "number"; 4177 } 4178 if (value == null || value !== value) { 4179 return; 4180 } 4181 if (type === "number" && !isCustomProp) { 4182 value += ret && ret[3] || (jQuery2.cssNumber[origName] ? "" : "px"); 4183 } 4184 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 4185 style[name] = "inherit"; 4186 } 4187 if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) { 4188 if (isCustomProp) { 4189 style.setProperty(name, value); 4190 } else { 4191 style[name] = value; 4192 } 4193 } 4194 } else { 4195 if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) { 4196 return ret; 4197 } 4198 return style[name]; 4199 } 4200 }, 4201 css: function(elem, name, extra, styles) { 4202 var val, num, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name); 4203 if (!isCustomProp) { 4204 name = finalPropName(origName); 4205 } 4206 hooks = jQuery2.cssHooks[name] || jQuery2.cssHooks[origName]; 4207 if (hooks && "get" in hooks) { 4208 val = hooks.get(elem, true, extra); 4209 } 4210 if (val === undefined) { 4211 val = curCSS(elem, name, styles); 4212 } 4213 if (val === "normal" && name in cssNormalTransform) { 4214 val = cssNormalTransform[name]; 4215 } 4216 if (extra === "" || extra) { 4217 num = parseFloat(val); 4218 return extra === true || isFinite(num) ? num || 0 : val; 4219 } 4220 return val; 4221 } 4222 }); 4223 jQuery2.each(["height", "width"], function(_i, dimension) { 4224 jQuery2.cssHooks[dimension] = { 4225 get: function(elem, computed, extra) { 4226 if (computed) { 4227 return rdisplayswap.test(jQuery2.css(elem, "display")) && (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() { 4228 return getWidthOrHeight(elem, dimension, extra); 4229 }) : getWidthOrHeight(elem, dimension, extra); 4230 } 4231 }, 4232 set: function(elem, value, extra) { 4233 var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery2.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) : 0; 4234 if (isBorderBox && scrollboxSizeBuggy) { 4235 subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5); 4236 } 4237 if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") { 4238 elem.style[dimension] = value; 4239 value = jQuery2.css(elem, dimension); 4240 } 4241 return setPositiveNumber(elem, value, subtract); 4242 } 4243 }; 4244 }); 4245 jQuery2.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function(elem, computed) { 4246 if (computed) { 4247 return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() { 4248 return elem.getBoundingClientRect().left; 4249 })) + "px"; 4250 } 4251 }); 4252 jQuery2.each({ 4253 margin: "", 4254 padding: "", 4255 border: "Width" 4256 }, function(prefix, suffix) { 4257 jQuery2.cssHooks[prefix + suffix] = { 4258 expand: function(value) { 4259 var i = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value]; 4260 for (;i < 4; i++) { 4261 expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0]; 4262 } 4263 return expanded; 4264 } 4265 }; 4266 if (prefix !== "margin") { 4267 jQuery2.cssHooks[prefix + suffix].set = setPositiveNumber; 4268 } 4269 }); 4270 jQuery2.fn.extend({ 4271 css: function(name, value) { 4272 return access(this, function(elem, name2, value2) { 4273 var styles, len, map = {}, i = 0; 4274 if (Array.isArray(name2)) { 4275 styles = getStyles(elem); 4276 len = name2.length; 4277 for (;i < len; i++) { 4278 map[name2[i]] = jQuery2.css(elem, name2[i], false, styles); 4279 } 4280 return map; 4281 } 4282 return value2 !== undefined ? jQuery2.style(elem, name2, value2) : jQuery2.css(elem, name2); 4283 }, name, value, arguments.length > 1); 4284 } 4285 }); 4286 function Tween(elem, options, prop, end2, easing) { 4287 return new Tween.prototype.init(elem, options, prop, end2, easing); 4288 } 4289 jQuery2.Tween = Tween; 4290 Tween.prototype = { 4291 constructor: Tween, 4292 init: function(elem, options, prop, end2, easing, unit) { 4293 this.elem = elem; 4294 this.prop = prop; 4295 this.easing = easing || jQuery2.easing._default; 4296 this.options = options; 4297 this.start = this.now = this.cur(); 4298 this.end = end2; 4299 this.unit = unit || (jQuery2.cssNumber[prop] ? "" : "px"); 4300 }, 4301 cur: function() { 4302 var hooks = Tween.propHooks[this.prop]; 4303 return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this); 4304 }, 4305 run: function(percent) { 4306 var eased, hooks = Tween.propHooks[this.prop]; 4307 if (this.options.duration) { 4308 this.pos = eased = jQuery2.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration); 4309 } else { 4310 this.pos = eased = percent; 4311 } 4312 this.now = (this.end - this.start) * eased + this.start; 4313 if (this.options.step) { 4314 this.options.step.call(this.elem, this.now, this); 4315 } 4316 if (hooks && hooks.set) { 4317 hooks.set(this); 4318 } else { 4319 Tween.propHooks._default.set(this); 4320 } 4321 return this; 4322 } 4323 }; 4324 Tween.prototype.init.prototype = Tween.prototype; 4325 Tween.propHooks = { 4326 _default: { 4327 get: function(tween) { 4328 var result; 4329 if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { 4330 return tween.elem[tween.prop]; 4331 } 4332 result = jQuery2.css(tween.elem, tween.prop, ""); 4333 return !result || result === "auto" ? 0 : result; 4334 }, 4335 set: function(tween) { 4336 if (jQuery2.fx.step[tween.prop]) { 4337 jQuery2.fx.step[tween.prop](tween); 4338 } else if (tween.elem.nodeType === 1 && (jQuery2.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) { 4339 jQuery2.style(tween.elem, tween.prop, tween.now + tween.unit); 4340 } else { 4341 tween.elem[tween.prop] = tween.now; 4342 } 4343 } 4344 } 4345 }; 4346 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 4347 set: function(tween) { 4348 if (tween.elem.nodeType && tween.elem.parentNode) { 4349 tween.elem[tween.prop] = tween.now; 4350 } 4351 } 4352 }; 4353 jQuery2.easing = { 4354 linear: function(p2) { 4355 return p2; 4356 }, 4357 swing: function(p2) { 4358 return 0.5 - Math.cos(p2 * Math.PI) / 2; 4359 }, 4360 _default: "swing" 4361 }; 4362 jQuery2.fx = Tween.prototype.init; 4363 jQuery2.fx.step = {}; 4364 var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/; 4365 function schedule() { 4366 if (inProgress) { 4367 if (document2.hidden === false && window2.requestAnimationFrame) { 4368 window2.requestAnimationFrame(schedule); 4369 } else { 4370 window2.setTimeout(schedule, jQuery2.fx.interval); 4371 } 4372 jQuery2.fx.tick(); 4373 } 4374 } 4375 function createFxNow() { 4376 window2.setTimeout(function() { 4377 fxNow = undefined; 4378 }); 4379 return fxNow = Date.now(); 4380 } 4381 function genFx(type, includeWidth) { 4382 var which, i = 0, attrs = { height: type }; 4383 includeWidth = includeWidth ? 1 : 0; 4384 for (;i < 4; i += 2 - includeWidth) { 4385 which = cssExpand[i]; 4386 attrs["margin" + which] = attrs["padding" + which] = type; 4387 } 4388 if (includeWidth) { 4389 attrs.opacity = attrs.width = type; 4390 } 4391 return attrs; 4392 } 4393 function createTween(value, prop, animation) { 4394 var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index = 0, length = collection.length; 4395 for (;index < length; index++) { 4396 if (tween = collection[index].call(animation, prop, value)) { 4397 return tween; 4398 } 4399 } 4400 } 4401 function defaultPrefilter(elem, props, opts) { 4402 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow"); 4403 if (!opts.queue) { 4404 hooks = jQuery2._queueHooks(elem, "fx"); 4405 if (hooks.unqueued == null) { 4406 hooks.unqueued = 0; 4407 oldfire = hooks.empty.fire; 4408 hooks.empty.fire = function() { 4409 if (!hooks.unqueued) { 4410 oldfire(); 4411 } 4412 }; 4413 } 4414 hooks.unqueued++; 4415 anim.always(function() { 4416 anim.always(function() { 4417 hooks.unqueued--; 4418 if (!jQuery2.queue(elem, "fx").length) { 4419 hooks.empty.fire(); 4420 } 4421 }); 4422 }); 4423 } 4424 for (prop in props) { 4425 value = props[prop]; 4426 if (rfxtypes.test(value)) { 4427 delete props[prop]; 4428 toggle = toggle || value === "toggle"; 4429 if (value === (hidden ? "hide" : "show")) { 4430 if (value === "show" && dataShow && dataShow[prop] !== undefined) { 4431 hidden = true; 4432 } else { 4433 continue; 4434 } 4435 } 4436 orig[prop] = dataShow && dataShow[prop] || jQuery2.style(elem, prop); 4437 } 4438 } 4439 propTween = !jQuery2.isEmptyObject(props); 4440 if (!propTween && jQuery2.isEmptyObject(orig)) { 4441 return; 4442 } 4443 if (isBox && elem.nodeType === 1) { 4444 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 4445 restoreDisplay = dataShow && dataShow.display; 4446 if (restoreDisplay == null) { 4447 restoreDisplay = dataPriv.get(elem, "display"); 4448 } 4449 display = jQuery2.css(elem, "display"); 4450 if (display === "none") { 4451 if (restoreDisplay) { 4452 display = restoreDisplay; 4453 } else { 4454 showHide([elem], true); 4455 restoreDisplay = elem.style.display || restoreDisplay; 4456 display = jQuery2.css(elem, "display"); 4457 showHide([elem]); 4458 } 4459 } 4460 if (display === "inline" || display === "inline-block" && restoreDisplay != null) { 4461 if (jQuery2.css(elem, "float") === "none") { 4462 if (!propTween) { 4463 anim.done(function() { 4464 style.display = restoreDisplay; 4465 }); 4466 if (restoreDisplay == null) { 4467 display = style.display; 4468 restoreDisplay = display === "none" ? "" : display; 4469 } 4470 } 4471 style.display = "inline-block"; 4472 } 4473 } 4474 } 4475 if (opts.overflow) { 4476 style.overflow = "hidden"; 4477 anim.always(function() { 4478 style.overflow = opts.overflow[0]; 4479 style.overflowX = opts.overflow[1]; 4480 style.overflowY = opts.overflow[2]; 4481 }); 4482 } 4483 propTween = false; 4484 for (prop in orig) { 4485 if (!propTween) { 4486 if (dataShow) { 4487 if ("hidden" in dataShow) { 4488 hidden = dataShow.hidden; 4489 } 4490 } else { 4491 dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); 4492 } 4493 if (toggle) { 4494 dataShow.hidden = !hidden; 4495 } 4496 if (hidden) { 4497 showHide([elem], true); 4498 } 4499 anim.done(function() { 4500 if (!hidden) { 4501 showHide([elem]); 4502 } 4503 dataPriv.remove(elem, "fxshow"); 4504 for (prop in orig) { 4505 jQuery2.style(elem, prop, orig[prop]); 4506 } 4507 }); 4508 } 4509 propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 4510 if (!(prop in dataShow)) { 4511 dataShow[prop] = propTween.start; 4512 if (hidden) { 4513 propTween.end = propTween.start; 4514 propTween.start = 0; 4515 } 4516 } 4517 } 4518 } 4519 function propFilter(props, specialEasing) { 4520 var index, name, easing, value, hooks; 4521 for (index in props) { 4522 name = camelCase(index); 4523 easing = specialEasing[name]; 4524 value = props[index]; 4525 if (Array.isArray(value)) { 4526 easing = value[1]; 4527 value = props[index] = value[0]; 4528 } 4529 if (index !== name) { 4530 props[name] = value; 4531 delete props[index]; 4532 } 4533 hooks = jQuery2.cssHooks[name]; 4534 if (hooks && "expand" in hooks) { 4535 value = hooks.expand(value); 4536 delete props[name]; 4537 for (index in value) { 4538 if (!(index in props)) { 4539 props[index] = value[index]; 4540 specialEasing[index] = easing; 4541 } 4542 } 4543 } else { 4544 specialEasing[name] = easing; 4545 } 4546 } 4547 } 4548 function Animation(elem, properties, options) { 4549 var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery2.Deferred().always(function() { 4550 delete tick.elem; 4551 }), tick = function() { 4552 if (stopped) { 4553 return false; 4554 } 4555 var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index2 = 0, length2 = animation.tweens.length; 4556 for (;index2 < length2; index2++) { 4557 animation.tweens[index2].run(percent); 4558 } 4559 deferred.notifyWith(elem, [animation, percent, remaining]); 4560 if (percent < 1 && length2) { 4561 return remaining; 4562 } 4563 if (!length2) { 4564 deferred.notifyWith(elem, [animation, 1, 0]); 4565 } 4566 deferred.resolveWith(elem, [animation]); 4567 return false; 4568 }, animation = deferred.promise({ 4569 elem, 4570 props: jQuery2.extend({}, properties), 4571 opts: jQuery2.extend(true, { 4572 specialEasing: {}, 4573 easing: jQuery2.easing._default 4574 }, options), 4575 originalProperties: properties, 4576 originalOptions: options, 4577 startTime: fxNow || createFxNow(), 4578 duration: options.duration, 4579 tweens: [], 4580 createTween: function(prop, end2) { 4581 var tween = jQuery2.Tween(elem, animation.opts, prop, end2, animation.opts.specialEasing[prop] || animation.opts.easing); 4582 animation.tweens.push(tween); 4583 return tween; 4584 }, 4585 stop: function(gotoEnd) { 4586 var index2 = 0, length2 = gotoEnd ? animation.tweens.length : 0; 4587 if (stopped) { 4588 return this; 4589 } 4590 stopped = true; 4591 for (;index2 < length2; index2++) { 4592 animation.tweens[index2].run(1); 4593 } 4594 if (gotoEnd) { 4595 deferred.notifyWith(elem, [animation, 1, 0]); 4596 deferred.resolveWith(elem, [animation, gotoEnd]); 4597 } else { 4598 deferred.rejectWith(elem, [animation, gotoEnd]); 4599 } 4600 return this; 4601 } 4602 }), props = animation.props; 4603 propFilter(props, animation.opts.specialEasing); 4604 for (;index < length; index++) { 4605 result = Animation.prefilters[index].call(animation, elem, props, animation.opts); 4606 if (result) { 4607 if (isFunction(result.stop)) { 4608 jQuery2._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result); 4609 } 4610 return result; 4611 } 4612 } 4613 jQuery2.map(props, createTween, animation); 4614 if (isFunction(animation.opts.start)) { 4615 animation.opts.start.call(elem, animation); 4616 } 4617 animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always); 4618 jQuery2.fx.timer(jQuery2.extend(tick, { 4619 elem, 4620 anim: animation, 4621 queue: animation.opts.queue 4622 })); 4623 return animation; 4624 } 4625 jQuery2.Animation = jQuery2.extend(Animation, { 4626 tweeners: { 4627 "*": [function(prop, value) { 4628 var tween = this.createTween(prop, value); 4629 adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); 4630 return tween; 4631 }] 4632 }, 4633 tweener: function(props, callback) { 4634 if (isFunction(props)) { 4635 callback = props; 4636 props = ["*"]; 4637 } else { 4638 props = props.match(rnothtmlwhite); 4639 } 4640 var prop, index = 0, length = props.length; 4641 for (;index < length; index++) { 4642 prop = props[index]; 4643 Animation.tweeners[prop] = Animation.tweeners[prop] || []; 4644 Animation.tweeners[prop].unshift(callback); 4645 } 4646 }, 4647 prefilters: [defaultPrefilter], 4648 prefilter: function(callback, prepend) { 4649 if (prepend) { 4650 Animation.prefilters.unshift(callback); 4651 } else { 4652 Animation.prefilters.push(callback); 4653 } 4654 } 4655 }); 4656 jQuery2.speed = function(speed, easing, fn2) { 4657 var opt = speed && typeof speed === "object" ? jQuery2.extend({}, speed) : { 4658 complete: fn2 || !fn2 && easing || isFunction(speed) && speed, 4659 duration: speed, 4660 easing: fn2 && easing || easing && !isFunction(easing) && easing 4661 }; 4662 if (jQuery2.fx.off) { 4663 opt.duration = 0; 4664 } else { 4665 if (typeof opt.duration !== "number") { 4666 if (opt.duration in jQuery2.fx.speeds) { 4667 opt.duration = jQuery2.fx.speeds[opt.duration]; 4668 } else { 4669 opt.duration = jQuery2.fx.speeds._default; 4670 } 4671 } 4672 } 4673 if (opt.queue == null || opt.queue === true) { 4674 opt.queue = "fx"; 4675 } 4676 opt.old = opt.complete; 4677 opt.complete = function() { 4678 if (isFunction(opt.old)) { 4679 opt.old.call(this); 4680 } 4681 if (opt.queue) { 4682 jQuery2.dequeue(this, opt.queue); 4683 } 4684 }; 4685 return opt; 4686 }; 4687 jQuery2.fn.extend({ 4688 fadeTo: function(speed, to, easing, callback) { 4689 return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback); 4690 }, 4691 animate: function(prop, speed, easing, callback) { 4692 var empty = jQuery2.isEmptyObject(prop), optall = jQuery2.speed(speed, easing, callback), doAnimation = function() { 4693 var anim = Animation(this, jQuery2.extend({}, prop), optall); 4694 if (empty || dataPriv.get(this, "finish")) { 4695 anim.stop(true); 4696 } 4697 }; 4698 doAnimation.finish = doAnimation; 4699 return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation); 4700 }, 4701 stop: function(type, clearQueue, gotoEnd) { 4702 var stopQueue = function(hooks) { 4703 var stop = hooks.stop; 4704 delete hooks.stop; 4705 stop(gotoEnd); 4706 }; 4707 if (typeof type !== "string") { 4708 gotoEnd = clearQueue; 4709 clearQueue = type; 4710 type = undefined; 4711 } 4712 if (clearQueue) { 4713 this.queue(type || "fx", []); 4714 } 4715 return this.each(function() { 4716 var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery2.timers, data = dataPriv.get(this); 4717 if (index) { 4718 if (data[index] && data[index].stop) { 4719 stopQueue(data[index]); 4720 } 4721 } else { 4722 for (index in data) { 4723 if (data[index] && data[index].stop && rrun.test(index)) { 4724 stopQueue(data[index]); 4725 } 4726 } 4727 } 4728 for (index = timers.length;index--; ) { 4729 if (timers[index].elem === this && (type == null || timers[index].queue === type)) { 4730 timers[index].anim.stop(gotoEnd); 4731 dequeue = false; 4732 timers.splice(index, 1); 4733 } 4734 } 4735 if (dequeue || !gotoEnd) { 4736 jQuery2.dequeue(this, type); 4737 } 4738 }); 4739 }, 4740 finish: function(type) { 4741 if (type !== false) { 4742 type = type || "fx"; 4743 } 4744 return this.each(function() { 4745 var index, data = dataPriv.get(this), queue = data[type + "queue"], hooks = data[type + "queueHooks"], timers = jQuery2.timers, length = queue ? queue.length : 0; 4746 data.finish = true; 4747 jQuery2.queue(this, type, []); 4748 if (hooks && hooks.stop) { 4749 hooks.stop.call(this, true); 4750 } 4751 for (index = timers.length;index--; ) { 4752 if (timers[index].elem === this && timers[index].queue === type) { 4753 timers[index].anim.stop(true); 4754 timers.splice(index, 1); 4755 } 4756 } 4757 for (index = 0;index < length; index++) { 4758 if (queue[index] && queue[index].finish) { 4759 queue[index].finish.call(this); 4760 } 4761 } 4762 delete data.finish; 4763 }); 4764 } 4765 }); 4766 jQuery2.each(["toggle", "show", "hide"], function(_i, name) { 4767 var cssFn = jQuery2.fn[name]; 4768 jQuery2.fn[name] = function(speed, easing, callback) { 4769 return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback); 4770 }; 4771 }); 4772 jQuery2.each({ 4773 slideDown: genFx("show"), 4774 slideUp: genFx("hide"), 4775 slideToggle: genFx("toggle"), 4776 fadeIn: { opacity: "show" }, 4777 fadeOut: { opacity: "hide" }, 4778 fadeToggle: { opacity: "toggle" } 4779 }, function(name, props) { 4780 jQuery2.fn[name] = function(speed, easing, callback) { 4781 return this.animate(props, speed, easing, callback); 4782 }; 4783 }); 4784 jQuery2.timers = []; 4785 jQuery2.fx.tick = function() { 4786 var timer, i = 0, timers = jQuery2.timers; 4787 fxNow = Date.now(); 4788 for (;i < timers.length; i++) { 4789 timer = timers[i]; 4790 if (!timer() && timers[i] === timer) { 4791 timers.splice(i--, 1); 4792 } 4793 } 4794 if (!timers.length) { 4795 jQuery2.fx.stop(); 4796 } 4797 fxNow = undefined; 4798 }; 4799 jQuery2.fx.timer = function(timer) { 4800 jQuery2.timers.push(timer); 4801 jQuery2.fx.start(); 4802 }; 4803 jQuery2.fx.interval = 13; 4804 jQuery2.fx.start = function() { 4805 if (inProgress) { 4806 return; 4807 } 4808 inProgress = true; 4809 schedule(); 4810 }; 4811 jQuery2.fx.stop = function() { 4812 inProgress = null; 4813 }; 4814 jQuery2.fx.speeds = { 4815 slow: 600, 4816 fast: 200, 4817 _default: 400 4818 }; 4819 jQuery2.fn.delay = function(time, type) { 4820 time = jQuery2.fx ? jQuery2.fx.speeds[time] || time : time; 4821 type = type || "fx"; 4822 return this.queue(type, function(next, hooks) { 4823 var timeout = window2.setTimeout(next, time); 4824 hooks.stop = function() { 4825 window2.clearTimeout(timeout); 4826 }; 4827 }); 4828 }; 4829 (function() { 4830 var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option")); 4831 input.type = "checkbox"; 4832 support.checkOn = input.value !== ""; 4833 support.optSelected = opt.selected; 4834 input = document2.createElement("input"); 4835 input.value = "t"; 4836 input.type = "radio"; 4837 support.radioValue = input.value === "t"; 4838 })(); 4839 var boolHook, attrHandle = jQuery2.expr.attrHandle; 4840 jQuery2.fn.extend({ 4841 attr: function(name, value) { 4842 return access(this, jQuery2.attr, name, value, arguments.length > 1); 4843 }, 4844 removeAttr: function(name) { 4845 return this.each(function() { 4846 jQuery2.removeAttr(this, name); 4847 }); 4848 } 4849 }); 4850 jQuery2.extend({ 4851 attr: function(elem, name, value) { 4852 var ret, hooks, nType = elem.nodeType; 4853 if (nType === 3 || nType === 8 || nType === 2) { 4854 return; 4855 } 4856 if (typeof elem.getAttribute === "undefined") { 4857 return jQuery2.prop(elem, name, value); 4858 } 4859 if (nType !== 1 || !jQuery2.isXMLDoc(elem)) { 4860 hooks = jQuery2.attrHooks[name.toLowerCase()] || (jQuery2.expr.match.bool.test(name) ? boolHook : undefined); 4861 } 4862 if (value !== undefined) { 4863 if (value === null) { 4864 jQuery2.removeAttr(elem, name); 4865 return; 4866 } 4867 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { 4868 return ret; 4869 } 4870 elem.setAttribute(name, value + ""); 4871 return value; 4872 } 4873 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 4874 return ret; 4875 } 4876 ret = jQuery2.find.attr(elem, name); 4877 return ret == null ? undefined : ret; 4878 }, 4879 attrHooks: { 4880 type: { 4881 set: function(elem, value) { 4882 if (!support.radioValue && value === "radio" && nodeName(elem, "input")) { 4883 var val = elem.value; 4884 elem.setAttribute("type", value); 4885 if (val) { 4886 elem.value = val; 4887 } 4888 return value; 4889 } 4890 } 4891 } 4892 }, 4893 removeAttr: function(elem, value) { 4894 var name, i = 0, attrNames = value && value.match(rnothtmlwhite); 4895 if (attrNames && elem.nodeType === 1) { 4896 while (name = attrNames[i++]) { 4897 elem.removeAttribute(name); 4898 } 4899 } 4900 } 4901 }); 4902 boolHook = { 4903 set: function(elem, value, name) { 4904 if (value === false) { 4905 jQuery2.removeAttr(elem, name); 4906 } else { 4907 elem.setAttribute(name, name); 4908 } 4909 return name; 4910 } 4911 }; 4912 jQuery2.each(jQuery2.expr.match.bool.source.match(/\w+/g), function(_i, name) { 4913 var getter = attrHandle[name] || jQuery2.find.attr; 4914 attrHandle[name] = function(elem, name2, isXML) { 4915 var ret, handle, lowercaseName = name2.toLowerCase(); 4916 if (!isXML) { 4917 handle = attrHandle[lowercaseName]; 4918 attrHandle[lowercaseName] = ret; 4919 ret = getter(elem, name2, isXML) != null ? lowercaseName : null; 4920 attrHandle[lowercaseName] = handle; 4921 } 4922 return ret; 4923 }; 4924 }); 4925 var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i; 4926 jQuery2.fn.extend({ 4927 prop: function(name, value) { 4928 return access(this, jQuery2.prop, name, value, arguments.length > 1); 4929 }, 4930 removeProp: function(name) { 4931 return this.each(function() { 4932 delete this[jQuery2.propFix[name] || name]; 4933 }); 4934 } 4935 }); 4936 jQuery2.extend({ 4937 prop: function(elem, name, value) { 4938 var ret, hooks, nType = elem.nodeType; 4939 if (nType === 3 || nType === 8 || nType === 2) { 4940 return; 4941 } 4942 if (nType !== 1 || !jQuery2.isXMLDoc(elem)) { 4943 name = jQuery2.propFix[name] || name; 4944 hooks = jQuery2.propHooks[name]; 4945 } 4946 if (value !== undefined) { 4947 if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) { 4948 return ret; 4949 } 4950 return elem[name] = value; 4951 } 4952 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 4953 return ret; 4954 } 4955 return elem[name]; 4956 }, 4957 propHooks: { 4958 tabIndex: { 4959 get: function(elem) { 4960 var tabindex = jQuery2.find.attr(elem, "tabindex"); 4961 if (tabindex) { 4962 return parseInt(tabindex, 10); 4963 } 4964 if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) { 4965 return 0; 4966 } 4967 return -1; 4968 } 4969 } 4970 }, 4971 propFix: { 4972 for: "htmlFor", 4973 class: "className" 4974 } 4975 }); 4976 if (!support.optSelected) { 4977 jQuery2.propHooks.selected = { 4978 get: function(elem) { 4979 var parent = elem.parentNode; 4980 if (parent && parent.parentNode) { 4981 parent.parentNode.selectedIndex; 4982 } 4983 return null; 4984 }, 4985 set: function(elem) { 4986 var parent = elem.parentNode; 4987 if (parent) { 4988 parent.selectedIndex; 4989 if (parent.parentNode) { 4990 parent.parentNode.selectedIndex; 4991 } 4992 } 4993 } 4994 }; 4995 } 4996 jQuery2.each([ 4997 "tabIndex", 4998 "readOnly", 4999 "maxLength", 5000 "cellSpacing", 5001 "cellPadding", 5002 "rowSpan", 5003 "colSpan", 5004 "useMap", 5005 "frameBorder", 5006 "contentEditable" 5007 ], function() { 5008 jQuery2.propFix[this.toLowerCase()] = this; 5009 }); 5010 function stripAndCollapse(value) { 5011 var tokens = value.match(rnothtmlwhite) || []; 5012 return tokens.join(" "); 5013 } 5014 function getClass(elem) { 5015 return elem.getAttribute && elem.getAttribute("class") || ""; 5016 } 5017 function classesToArray(value) { 5018 if (Array.isArray(value)) { 5019 return value; 5020 } 5021 if (typeof value === "string") { 5022 return value.match(rnothtmlwhite) || []; 5023 } 5024 return []; 5025 } 5026 jQuery2.fn.extend({ 5027 addClass: function(value) { 5028 var classNames, cur, curValue, className, i, finalValue; 5029 if (isFunction(value)) { 5030 return this.each(function(j) { 5031 jQuery2(this).addClass(value.call(this, j, getClass(this))); 5032 }); 5033 } 5034 classNames = classesToArray(value); 5035 if (classNames.length) { 5036 return this.each(function() { 5037 curValue = getClass(this); 5038 cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 5039 if (cur) { 5040 for (i = 0;i < classNames.length; i++) { 5041 className = classNames[i]; 5042 if (cur.indexOf(" " + className + " ") < 0) { 5043 cur += className + " "; 5044 } 5045 } 5046 finalValue = stripAndCollapse(cur); 5047 if (curValue !== finalValue) { 5048 this.setAttribute("class", finalValue); 5049 } 5050 } 5051 }); 5052 } 5053 return this; 5054 }, 5055 removeClass: function(value) { 5056 var classNames, cur, curValue, className, i, finalValue; 5057 if (isFunction(value)) { 5058 return this.each(function(j) { 5059 jQuery2(this).removeClass(value.call(this, j, getClass(this))); 5060 }); 5061 } 5062 if (!arguments.length) { 5063 return this.attr("class", ""); 5064 } 5065 classNames = classesToArray(value); 5066 if (classNames.length) { 5067 return this.each(function() { 5068 curValue = getClass(this); 5069 cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " "; 5070 if (cur) { 5071 for (i = 0;i < classNames.length; i++) { 5072 className = classNames[i]; 5073 while (cur.indexOf(" " + className + " ") > -1) { 5074 cur = cur.replace(" " + className + " ", " "); 5075 } 5076 } 5077 finalValue = stripAndCollapse(cur); 5078 if (curValue !== finalValue) { 5079 this.setAttribute("class", finalValue); 5080 } 5081 } 5082 }); 5083 } 5084 return this; 5085 }, 5086 toggleClass: function(value, stateVal) { 5087 var classNames, className, i, self, type = typeof value, isValidValue = type === "string" || Array.isArray(value); 5088 if (isFunction(value)) { 5089 return this.each(function(i2) { 5090 jQuery2(this).toggleClass(value.call(this, i2, getClass(this), stateVal), stateVal); 5091 }); 5092 } 5093 if (typeof stateVal === "boolean" && isValidValue) { 5094 return stateVal ? this.addClass(value) : this.removeClass(value); 5095 } 5096 classNames = classesToArray(value); 5097 return this.each(function() { 5098 if (isValidValue) { 5099 self = jQuery2(this); 5100 for (i = 0;i < classNames.length; i++) { 5101 className = classNames[i]; 5102 if (self.hasClass(className)) { 5103 self.removeClass(className); 5104 } else { 5105 self.addClass(className); 5106 } 5107 } 5108 } else if (value === undefined || type === "boolean") { 5109 className = getClass(this); 5110 if (className) { 5111 dataPriv.set(this, "__className__", className); 5112 } 5113 if (this.setAttribute) { 5114 this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || ""); 5115 } 5116 } 5117 }); 5118 }, 5119 hasClass: function(selector) { 5120 var className, elem, i = 0; 5121 className = " " + selector + " "; 5122 while (elem = this[i++]) { 5123 if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { 5124 return true; 5125 } 5126 } 5127 return false; 5128 } 5129 }); 5130 var rreturn = /\r/g; 5131 jQuery2.fn.extend({ 5132 val: function(value) { 5133 var hooks, ret, valueIsFunction, elem = this[0]; 5134 if (!arguments.length) { 5135 if (elem) { 5136 hooks = jQuery2.valHooks[elem.type] || jQuery2.valHooks[elem.nodeName.toLowerCase()]; 5137 if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) { 5138 return ret; 5139 } 5140 ret = elem.value; 5141 if (typeof ret === "string") { 5142 return ret.replace(rreturn, ""); 5143 } 5144 return ret == null ? "" : ret; 5145 } 5146 return; 5147 } 5148 valueIsFunction = isFunction(value); 5149 return this.each(function(i) { 5150 var val; 5151 if (this.nodeType !== 1) { 5152 return; 5153 } 5154 if (valueIsFunction) { 5155 val = value.call(this, i, jQuery2(this).val()); 5156 } else { 5157 val = value; 5158 } 5159 if (val == null) { 5160 val = ""; 5161 } else if (typeof val === "number") { 5162 val += ""; 5163 } else if (Array.isArray(val)) { 5164 val = jQuery2.map(val, function(value2) { 5165 return value2 == null ? "" : value2 + ""; 5166 }); 5167 } 5168 hooks = jQuery2.valHooks[this.type] || jQuery2.valHooks[this.nodeName.toLowerCase()]; 5169 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { 5170 this.value = val; 5171 } 5172 }); 5173 } 5174 }); 5175 jQuery2.extend({ 5176 valHooks: { 5177 option: { 5178 get: function(elem) { 5179 var val = jQuery2.find.attr(elem, "value"); 5180 return val != null ? val : stripAndCollapse(jQuery2.text(elem)); 5181 } 5182 }, 5183 select: { 5184 get: function(elem) { 5185 var value, option, i, options = elem.options, index = elem.selectedIndex, one = elem.type === "select-one", values = one ? null : [], max2 = one ? index + 1 : options.length; 5186 if (index < 0) { 5187 i = max2; 5188 } else { 5189 i = one ? index : 0; 5190 } 5191 for (;i < max2; i++) { 5192 option = options[i]; 5193 if ((option.selected || i === index) && !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) { 5194 value = jQuery2(option).val(); 5195 if (one) { 5196 return value; 5197 } 5198 values.push(value); 5199 } 5200 } 5201 return values; 5202 }, 5203 set: function(elem, value) { 5204 var optionSet, option, options = elem.options, values = jQuery2.makeArray(value), i = options.length; 5205 while (i--) { 5206 option = options[i]; 5207 if (option.selected = jQuery2.inArray(jQuery2.valHooks.option.get(option), values) > -1) { 5208 optionSet = true; 5209 } 5210 } 5211 if (!optionSet) { 5212 elem.selectedIndex = -1; 5213 } 5214 return values; 5215 } 5216 } 5217 } 5218 }); 5219 jQuery2.each(["radio", "checkbox"], function() { 5220 jQuery2.valHooks[this] = { 5221 set: function(elem, value) { 5222 if (Array.isArray(value)) { 5223 return elem.checked = jQuery2.inArray(jQuery2(elem).val(), value) > -1; 5224 } 5225 } 5226 }; 5227 if (!support.checkOn) { 5228 jQuery2.valHooks[this].get = function(elem) { 5229 return elem.getAttribute("value") === null ? "on" : elem.value; 5230 }; 5231 } 5232 }); 5233 var location2 = window2.location; 5234 var nonce = { guid: Date.now() }; 5235 var rquery = /\?/; 5236 jQuery2.parseXML = function(data) { 5237 var xml, parserErrorElem; 5238 if (!data || typeof data !== "string") { 5239 return null; 5240 } 5241 try { 5242 xml = new window2.DOMParser().parseFromString(data, "text/xml"); 5243 } catch (e) {} 5244 parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0]; 5245 if (!xml || parserErrorElem) { 5246 jQuery2.error("Invalid XML: " + (parserErrorElem ? jQuery2.map(parserErrorElem.childNodes, function(el) { 5247 return el.textContent; 5248 }).join(` 5249`) : data)); 5250 } 5251 return xml; 5252 }; 5253 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) { 5254 e.stopPropagation(); 5255 }; 5256 jQuery2.extend(jQuery2.event, { 5257 trigger: function(event, data, elem, onlyHandlers) { 5258 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document2], type = hasOwn.call(event, "type") ? event.type : event, namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; 5259 cur = lastElement = tmp = elem = elem || document2; 5260 if (elem.nodeType === 3 || elem.nodeType === 8) { 5261 return; 5262 } 5263 if (rfocusMorph.test(type + jQuery2.event.triggered)) { 5264 return; 5265 } 5266 if (type.indexOf(".") > -1) { 5267 namespaces = type.split("."); 5268 type = namespaces.shift(); 5269 namespaces.sort(); 5270 } 5271 ontype = type.indexOf(":") < 0 && "on" + type; 5272 event = event[jQuery2.expando] ? event : new jQuery2.Event(type, typeof event === "object" && event); 5273 event.isTrigger = onlyHandlers ? 2 : 3; 5274 event.namespace = namespaces.join("."); 5275 event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; 5276 event.result = undefined; 5277 if (!event.target) { 5278 event.target = elem; 5279 } 5280 data = data == null ? [event] : jQuery2.makeArray(data, [event]); 5281 special = jQuery2.event.special[type] || {}; 5282 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 5283 return; 5284 } 5285 if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { 5286 bubbleType = special.delegateType || type; 5287 if (!rfocusMorph.test(bubbleType + type)) { 5288 cur = cur.parentNode; 5289 } 5290 for (;cur; cur = cur.parentNode) { 5291 eventPath.push(cur); 5292 tmp = cur; 5293 } 5294 if (tmp === (elem.ownerDocument || document2)) { 5295 eventPath.push(tmp.defaultView || tmp.parentWindow || window2); 5296 } 5297 } 5298 i = 0; 5299 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { 5300 lastElement = cur; 5301 event.type = i > 1 ? bubbleType : special.bindType || type; 5302 handle = (dataPriv.get(cur, "events") || Object.create(null))[event.type] && dataPriv.get(cur, "handle"); 5303 if (handle) { 5304 handle.apply(cur, data); 5305 } 5306 handle = ontype && cur[ontype]; 5307 if (handle && handle.apply && acceptData(cur)) { 5308 event.result = handle.apply(cur, data); 5309 if (event.result === false) { 5310 event.preventDefault(); 5311 } 5312 } 5313 } 5314 event.type = type; 5315 if (!onlyHandlers && !event.isDefaultPrevented()) { 5316 if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) { 5317 if (ontype && isFunction(elem[type]) && !isWindow(elem)) { 5318 tmp = elem[ontype]; 5319 if (tmp) { 5320 elem[ontype] = null; 5321 } 5322 jQuery2.event.triggered = type; 5323 if (event.isPropagationStopped()) { 5324 lastElement.addEventListener(type, stopPropagationCallback); 5325 } 5326 elem[type](); 5327 if (event.isPropagationStopped()) { 5328 lastElement.removeEventListener(type, stopPropagationCallback); 5329 } 5330 jQuery2.event.triggered = undefined; 5331 if (tmp) { 5332 elem[ontype] = tmp; 5333 } 5334 } 5335 } 5336 } 5337 return event.result; 5338 }, 5339 simulate: function(type, elem, event) { 5340 var e = jQuery2.extend(new jQuery2.Event, event, { 5341 type, 5342 isSimulated: true 5343 }); 5344 jQuery2.event.trigger(e, null, elem); 5345 } 5346 }); 5347 jQuery2.fn.extend({ 5348 trigger: function(type, data) { 5349 return this.each(function() { 5350 jQuery2.event.trigger(type, data, this); 5351 }); 5352 }, 5353 triggerHandler: function(type, data) { 5354 var elem = this[0]; 5355 if (elem) { 5356 return jQuery2.event.trigger(type, data, elem, true); 5357 } 5358 } 5359 }); 5360 var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i; 5361 function buildParams(prefix, obj, traditional, add2) { 5362 var name; 5363 if (Array.isArray(obj)) { 5364 jQuery2.each(obj, function(i, v2) { 5365 if (traditional || rbracket.test(prefix)) { 5366 add2(prefix, v2); 5367 } else { 5368 buildParams(prefix + "[" + (typeof v2 === "object" && v2 != null ? i : "") + "]", v2, traditional, add2); 5369 } 5370 }); 5371 } else if (!traditional && toType2(obj) === "object") { 5372 for (name in obj) { 5373 buildParams(prefix + "[" + name + "]", obj[name], traditional, add2); 5374 } 5375 } else { 5376 add2(prefix, obj); 5377 } 5378 } 5379 jQuery2.param = function(a, traditional) { 5380 var prefix, s2 = [], add2 = function(key, valueOrFunction) { 5381 var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction; 5382 s2[s2.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value); 5383 }; 5384 if (a == null) { 5385 return ""; 5386 } 5387 if (Array.isArray(a) || a.jquery && !jQuery2.isPlainObject(a)) { 5388 jQuery2.each(a, function() { 5389 add2(this.name, this.value); 5390 }); 5391 } else { 5392 for (prefix in a) { 5393 buildParams(prefix, a[prefix], traditional, add2); 5394 } 5395 } 5396 return s2.join("&"); 5397 }; 5398 jQuery2.fn.extend({ 5399 serialize: function() { 5400 return jQuery2.param(this.serializeArray()); 5401 }, 5402 serializeArray: function() { 5403 return this.map(function() { 5404 var elements = jQuery2.prop(this, "elements"); 5405 return elements ? jQuery2.makeArray(elements) : this; 5406 }).filter(function() { 5407 var type = this.type; 5408 return this.name && !jQuery2(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type)); 5409 }).map(function(_i, elem) { 5410 var val = jQuery2(this).val(); 5411 if (val == null) { 5412 return null; 5413 } 5414 if (Array.isArray(val)) { 5415 return jQuery2.map(val, function(val2) { 5416 return { name: elem.name, value: val2.replace(rCRLF, `\r 5417`) }; 5418 }); 5419 } 5420 return { name: elem.name, value: val.replace(rCRLF, `\r 5421`) }; 5422 }).get(); 5423 } 5424 }); 5425 var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, prefilters = {}, transports = {}, allTypes = "*/".concat("*"), originAnchor = document2.createElement("a"); 5426 originAnchor.href = location2.href; 5427 function addToPrefiltersOrTransports(structure) { 5428 return function(dataTypeExpression, func) { 5429 if (typeof dataTypeExpression !== "string") { 5430 func = dataTypeExpression; 5431 dataTypeExpression = "*"; 5432 } 5433 var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; 5434 if (isFunction(func)) { 5435 while (dataType = dataTypes[i++]) { 5436 if (dataType[0] === "+") { 5437 dataType = dataType.slice(1) || "*"; 5438 (structure[dataType] = structure[dataType] || []).unshift(func); 5439 } else { 5440 (structure[dataType] = structure[dataType] || []).push(func); 5441 } 5442 } 5443 } 5444 }; 5445 } 5446 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { 5447 var inspected = {}, seekingTransport = structure === transports; 5448 function inspect(dataType) { 5449 var selected; 5450 inspected[dataType] = true; 5451 jQuery2.each(structure[dataType] || [], function(_, prefilterOrFactory) { 5452 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); 5453 if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) { 5454 options.dataTypes.unshift(dataTypeOrTransport); 5455 inspect(dataTypeOrTransport); 5456 return false; 5457 } else if (seekingTransport) { 5458 return !(selected = dataTypeOrTransport); 5459 } 5460 }); 5461 return selected; 5462 } 5463 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); 5464 } 5465 function ajaxExtend(target, src) { 5466 var key, deep, flatOptions = jQuery2.ajaxSettings.flatOptions || {}; 5467 for (key in src) { 5468 if (src[key] !== undefined) { 5469 (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]; 5470 } 5471 } 5472 if (deep) { 5473 jQuery2.extend(true, target, deep); 5474 } 5475 return target; 5476 } 5477 function ajaxHandleResponses(s2, jqXHR, responses) { 5478 var ct, type, finalDataType, firstDataType, contents = s2.contents, dataTypes = s2.dataTypes; 5479 while (dataTypes[0] === "*") { 5480 dataTypes.shift(); 5481 if (ct === undefined) { 5482 ct = s2.mimeType || jqXHR.getResponseHeader("Content-Type"); 5483 } 5484 } 5485 if (ct) { 5486 for (type in contents) { 5487 if (contents[type] && contents[type].test(ct)) { 5488 dataTypes.unshift(type); 5489 break; 5490 } 5491 } 5492 } 5493 if (dataTypes[0] in responses) { 5494 finalDataType = dataTypes[0]; 5495 } else { 5496 for (type in responses) { 5497 if (!dataTypes[0] || s2.converters[type + " " + dataTypes[0]]) { 5498 finalDataType = type; 5499 break; 5500 } 5501 if (!firstDataType) { 5502 firstDataType = type; 5503 } 5504 } 5505 finalDataType = finalDataType || firstDataType; 5506 } 5507 if (finalDataType) { 5508 if (finalDataType !== dataTypes[0]) { 5509 dataTypes.unshift(finalDataType); 5510 } 5511 return responses[finalDataType]; 5512 } 5513 } 5514 function ajaxConvert(s2, response, jqXHR, isSuccess) { 5515 var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s2.dataTypes.slice(); 5516 if (dataTypes[1]) { 5517 for (conv in s2.converters) { 5518 converters[conv.toLowerCase()] = s2.converters[conv]; 5519 } 5520 } 5521 current = dataTypes.shift(); 5522 while (current) { 5523 if (s2.responseFields[current]) { 5524 jqXHR[s2.responseFields[current]] = response; 5525 } 5526 if (!prev && isSuccess && s2.dataFilter) { 5527 response = s2.dataFilter(response, s2.dataType); 5528 } 5529 prev = current; 5530 current = dataTypes.shift(); 5531 if (current) { 5532 if (current === "*") { 5533 current = prev; 5534 } else if (prev !== "*" && prev !== current) { 5535 conv = converters[prev + " " + current] || converters["* " + current]; 5536 if (!conv) { 5537 for (conv2 in converters) { 5538 tmp = conv2.split(" "); 5539 if (tmp[1] === current) { 5540 conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]]; 5541 if (conv) { 5542 if (conv === true) { 5543 conv = converters[conv2]; 5544 } else if (converters[conv2] !== true) { 5545 current = tmp[0]; 5546 dataTypes.unshift(tmp[1]); 5547 } 5548 break; 5549 } 5550 } 5551 } 5552 } 5553 if (conv !== true) { 5554 if (conv && s2.throws) { 5555 response = conv(response); 5556 } else { 5557 try { 5558 response = conv(response); 5559 } catch (e) { 5560 return { 5561 state: "parsererror", 5562 error: conv ? e : "No conversion from " + prev + " to " + current 5563 }; 5564 } 5565 } 5566 } 5567 } 5568 } 5569 } 5570 return { state: "success", data: response }; 5571 } 5572 jQuery2.extend({ 5573 active: 0, 5574 lastModified: {}, 5575 etag: {}, 5576 ajaxSettings: { 5577 url: location2.href, 5578 type: "GET", 5579 isLocal: rlocalProtocol.test(location2.protocol), 5580 global: true, 5581 processData: true, 5582 async: true, 5583 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 5584 accepts: { 5585 "*": allTypes, 5586 text: "text/plain", 5587 html: "text/html", 5588 xml: "application/xml, text/xml", 5589 json: "application/json, text/javascript" 5590 }, 5591 contents: { 5592 xml: /\bxml\b/, 5593 html: /\bhtml/, 5594 json: /\bjson\b/ 5595 }, 5596 responseFields: { 5597 xml: "responseXML", 5598 text: "responseText", 5599 json: "responseJSON" 5600 }, 5601 converters: { 5602 "* text": String, 5603 "text html": true, 5604 "text json": JSON.parse, 5605 "text xml": jQuery2.parseXML 5606 }, 5607 flatOptions: { 5608 url: true, 5609 context: true 5610 } 5611 }, 5612 ajaxSetup: function(target, settings) { 5613 return settings ? ajaxExtend(ajaxExtend(target, jQuery2.ajaxSettings), settings) : ajaxExtend(jQuery2.ajaxSettings, target); 5614 }, 5615 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 5616 ajaxTransport: addToPrefiltersOrTransports(transports), 5617 ajax: function(url, options) { 5618 if (typeof url === "object") { 5619 options = url; 5620 url = undefined; 5621 } 5622 options = options || {}; 5623 var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed2, fireGlobals, i, uncached, s2 = jQuery2.ajaxSetup({}, options), callbackContext = s2.context || s2, globalEventContext = s2.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery2(callbackContext) : jQuery2.event, deferred = jQuery2.Deferred(), completeDeferred = jQuery2.Callbacks("once memory"), statusCode = s2.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = { 5624 readyState: 0, 5625 getResponseHeader: function(key) { 5626 var match; 5627 if (completed2) { 5628 if (!responseHeaders) { 5629 responseHeaders = {}; 5630 while (match = rheaders.exec(responseHeadersString)) { 5631 responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]); 5632 } 5633 } 5634 match = responseHeaders[key.toLowerCase() + " "]; 5635 } 5636 return match == null ? null : match.join(", "); 5637 }, 5638 getAllResponseHeaders: function() { 5639 return completed2 ? responseHeadersString : null; 5640 }, 5641 setRequestHeader: function(name, value) { 5642 if (completed2 == null) { 5643 name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name; 5644 requestHeaders[name] = value; 5645 } 5646 return this; 5647 }, 5648 overrideMimeType: function(type) { 5649 if (completed2 == null) { 5650 s2.mimeType = type; 5651 } 5652 return this; 5653 }, 5654 statusCode: function(map) { 5655 var code; 5656 if (map) { 5657 if (completed2) { 5658 jqXHR.always(map[jqXHR.status]); 5659 } else { 5660 for (code in map) { 5661 statusCode[code] = [statusCode[code], map[code]]; 5662 } 5663 } 5664 } 5665 return this; 5666 }, 5667 abort: function(statusText) { 5668 var finalText = statusText || strAbort; 5669 if (transport) { 5670 transport.abort(finalText); 5671 } 5672 done(0, finalText); 5673 return this; 5674 } 5675 }; 5676 deferred.promise(jqXHR); 5677 s2.url = ((url || s2.url || location2.href) + "").replace(rprotocol, location2.protocol + "//"); 5678 s2.type = options.method || options.type || s2.method || s2.type; 5679 s2.dataTypes = (s2.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; 5680 if (s2.crossDomain == null) { 5681 urlAnchor = document2.createElement("a"); 5682 try { 5683 urlAnchor.href = s2.url; 5684 urlAnchor.href = urlAnchor.href; 5685 s2.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host; 5686 } catch (e) { 5687 s2.crossDomain = true; 5688 } 5689 } 5690 if (s2.data && s2.processData && typeof s2.data !== "string") { 5691 s2.data = jQuery2.param(s2.data, s2.traditional); 5692 } 5693 inspectPrefiltersOrTransports(prefilters, s2, options, jqXHR); 5694 if (completed2) { 5695 return jqXHR; 5696 } 5697 fireGlobals = jQuery2.event && s2.global; 5698 if (fireGlobals && jQuery2.active++ === 0) { 5699 jQuery2.event.trigger("ajaxStart"); 5700 } 5701 s2.type = s2.type.toUpperCase(); 5702 s2.hasContent = !rnoContent.test(s2.type); 5703 cacheURL = s2.url.replace(rhash, ""); 5704 if (!s2.hasContent) { 5705 uncached = s2.url.slice(cacheURL.length); 5706 if (s2.data && (s2.processData || typeof s2.data === "string")) { 5707 cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s2.data; 5708 delete s2.data; 5709 } 5710 if (s2.cache === false) { 5711 cacheURL = cacheURL.replace(rantiCache, "$1"); 5712 uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached; 5713 } 5714 s2.url = cacheURL + uncached; 5715 } else if (s2.data && s2.processData && (s2.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { 5716 s2.data = s2.data.replace(r20, "+"); 5717 } 5718 if (s2.ifModified) { 5719 if (jQuery2.lastModified[cacheURL]) { 5720 jqXHR.setRequestHeader("If-Modified-Since", jQuery2.lastModified[cacheURL]); 5721 } 5722 if (jQuery2.etag[cacheURL]) { 5723 jqXHR.setRequestHeader("If-None-Match", jQuery2.etag[cacheURL]); 5724 } 5725 } 5726 if (s2.data && s2.hasContent && s2.contentType !== false || options.contentType) { 5727 jqXHR.setRequestHeader("Content-Type", s2.contentType); 5728 } 5729 jqXHR.setRequestHeader("Accept", s2.dataTypes[0] && s2.accepts[s2.dataTypes[0]] ? s2.accepts[s2.dataTypes[0]] + (s2.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s2.accepts["*"]); 5730 for (i in s2.headers) { 5731 jqXHR.setRequestHeader(i, s2.headers[i]); 5732 } 5733 if (s2.beforeSend && (s2.beforeSend.call(callbackContext, jqXHR, s2) === false || completed2)) { 5734 return jqXHR.abort(); 5735 } 5736 strAbort = "abort"; 5737 completeDeferred.add(s2.complete); 5738 jqXHR.done(s2.success); 5739 jqXHR.fail(s2.error); 5740 transport = inspectPrefiltersOrTransports(transports, s2, options, jqXHR); 5741 if (!transport) { 5742 done(-1, "No Transport"); 5743 } else { 5744 jqXHR.readyState = 1; 5745 if (fireGlobals) { 5746 globalEventContext.trigger("ajaxSend", [jqXHR, s2]); 5747 } 5748 if (completed2) { 5749 return jqXHR; 5750 } 5751 if (s2.async && s2.timeout > 0) { 5752 timeoutTimer = window2.setTimeout(function() { 5753 jqXHR.abort("timeout"); 5754 }, s2.timeout); 5755 } 5756 try { 5757 completed2 = false; 5758 transport.send(requestHeaders, done); 5759 } catch (e) { 5760 if (completed2) { 5761 throw e; 5762 } 5763 done(-1, e); 5764 } 5765 } 5766 function done(status, nativeStatusText, responses, headers) { 5767 var isSuccess, success, error2, response, modified, statusText = nativeStatusText; 5768 if (completed2) { 5769 return; 5770 } 5771 completed2 = true; 5772 if (timeoutTimer) { 5773 window2.clearTimeout(timeoutTimer); 5774 } 5775 transport = undefined; 5776 responseHeadersString = headers || ""; 5777 jqXHR.readyState = status > 0 ? 4 : 0; 5778 isSuccess = status >= 200 && status < 300 || status === 304; 5779 if (responses) { 5780 response = ajaxHandleResponses(s2, jqXHR, responses); 5781 } 5782 if (!isSuccess && jQuery2.inArray("script", s2.dataTypes) > -1 && jQuery2.inArray("json", s2.dataTypes) < 0) { 5783 s2.converters["text script"] = function() {}; 5784 } 5785 response = ajaxConvert(s2, response, jqXHR, isSuccess); 5786 if (isSuccess) { 5787 if (s2.ifModified) { 5788 modified = jqXHR.getResponseHeader("Last-Modified"); 5789 if (modified) { 5790 jQuery2.lastModified[cacheURL] = modified; 5791 } 5792 modified = jqXHR.getResponseHeader("etag"); 5793 if (modified) { 5794 jQuery2.etag[cacheURL] = modified; 5795 } 5796 } 5797 if (status === 204 || s2.type === "HEAD") { 5798 statusText = "nocontent"; 5799 } else if (status === 304) { 5800 statusText = "notmodified"; 5801 } else { 5802 statusText = response.state; 5803 success = response.data; 5804 error2 = response.error; 5805 isSuccess = !error2; 5806 } 5807 } else { 5808 error2 = statusText; 5809 if (status || !statusText) { 5810 statusText = "error"; 5811 if (status < 0) { 5812 status = 0; 5813 } 5814 } 5815 } 5816 jqXHR.status = status; 5817 jqXHR.statusText = (nativeStatusText || statusText) + ""; 5818 if (isSuccess) { 5819 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 5820 } else { 5821 deferred.rejectWith(callbackContext, [jqXHR, statusText, error2]); 5822 } 5823 jqXHR.statusCode(statusCode); 5824 statusCode = undefined; 5825 if (fireGlobals) { 5826 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s2, isSuccess ? success : error2]); 5827 } 5828 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 5829 if (fireGlobals) { 5830 globalEventContext.trigger("ajaxComplete", [jqXHR, s2]); 5831 if (!--jQuery2.active) { 5832 jQuery2.event.trigger("ajaxStop"); 5833 } 5834 } 5835 } 5836 return jqXHR; 5837 }, 5838 getJSON: function(url, data, callback) { 5839 return jQuery2.get(url, data, callback, "json"); 5840 }, 5841 getScript: function(url, callback) { 5842 return jQuery2.get(url, undefined, callback, "script"); 5843 } 5844 }); 5845 jQuery2.each(["get", "post"], function(_i, method) { 5846 jQuery2[method] = function(url, data, callback, type) { 5847 if (isFunction(data)) { 5848 type = type || callback; 5849 callback = data; 5850 data = undefined; 5851 } 5852 return jQuery2.ajax(jQuery2.extend({ 5853 url, 5854 type: method, 5855 dataType: type, 5856 data, 5857 success: callback 5858 }, jQuery2.isPlainObject(url) && url)); 5859 }; 5860 }); 5861 jQuery2.ajaxPrefilter(function(s2) { 5862 var i; 5863 for (i in s2.headers) { 5864 if (i.toLowerCase() === "content-type") { 5865 s2.contentType = s2.headers[i] || ""; 5866 } 5867 } 5868 }); 5869 jQuery2._evalUrl = function(url, options, doc) { 5870 return jQuery2.ajax({ 5871 url, 5872 type: "GET", 5873 dataType: "script", 5874 cache: true, 5875 async: false, 5876 global: false, 5877 converters: { 5878 "text script": function() {} 5879 }, 5880 dataFilter: function(response) { 5881 jQuery2.globalEval(response, options, doc); 5882 } 5883 }); 5884 }; 5885 jQuery2.fn.extend({ 5886 wrapAll: function(html) { 5887 var wrap; 5888 if (this[0]) { 5889 if (isFunction(html)) { 5890 html = html.call(this[0]); 5891 } 5892 wrap = jQuery2(html, this[0].ownerDocument).eq(0).clone(true); 5893 if (this[0].parentNode) { 5894 wrap.insertBefore(this[0]); 5895 } 5896 wrap.map(function() { 5897 var elem = this; 5898 while (elem.firstElementChild) { 5899 elem = elem.firstElementChild; 5900 } 5901 return elem; 5902 }).append(this); 5903 } 5904 return this; 5905 }, 5906 wrapInner: function(html) { 5907 if (isFunction(html)) { 5908 return this.each(function(i) { 5909 jQuery2(this).wrapInner(html.call(this, i)); 5910 }); 5911 } 5912 return this.each(function() { 5913 var self = jQuery2(this), contents = self.contents(); 5914 if (contents.length) { 5915 contents.wrapAll(html); 5916 } else { 5917 self.append(html); 5918 } 5919 }); 5920 }, 5921 wrap: function(html) { 5922 var htmlIsFunction = isFunction(html); 5923 return this.each(function(i) { 5924 jQuery2(this).wrapAll(htmlIsFunction ? html.call(this, i) : html); 5925 }); 5926 }, 5927 unwrap: function(selector) { 5928 this.parent(selector).not("body").each(function() { 5929 jQuery2(this).replaceWith(this.childNodes); 5930 }); 5931 return this; 5932 } 5933 }); 5934 jQuery2.expr.pseudos.hidden = function(elem) { 5935 return !jQuery2.expr.pseudos.visible(elem); 5936 }; 5937 jQuery2.expr.pseudos.visible = function(elem) { 5938 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 5939 }; 5940 jQuery2.ajaxSettings.xhr = function() { 5941 try { 5942 return new window2.XMLHttpRequest; 5943 } catch (e) {} 5944 }; 5945 var xhrSuccessStatus = { 5946 0: 200, 5947 1223: 204 5948 }, xhrSupported = jQuery2.ajaxSettings.xhr(); 5949 support.cors = !!xhrSupported && "withCredentials" in xhrSupported; 5950 support.ajax = xhrSupported = !!xhrSupported; 5951 jQuery2.ajaxTransport(function(options) { 5952 var callback, errorCallback; 5953 if (support.cors || xhrSupported && !options.crossDomain) { 5954 return { 5955 send: function(headers, complete) { 5956 var i, xhr = options.xhr(); 5957 xhr.open(options.type, options.url, options.async, options.username, options.password); 5958 if (options.xhrFields) { 5959 for (i in options.xhrFields) { 5960 xhr[i] = options.xhrFields[i]; 5961 } 5962 } 5963 if (options.mimeType && xhr.overrideMimeType) { 5964 xhr.overrideMimeType(options.mimeType); 5965 } 5966 if (!options.crossDomain && !headers["X-Requested-With"]) { 5967 headers["X-Requested-With"] = "XMLHttpRequest"; 5968 } 5969 for (i in headers) { 5970 xhr.setRequestHeader(i, headers[i]); 5971 } 5972 callback = function(type) { 5973 return function() { 5974 if (callback) { 5975 callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null; 5976 if (type === "abort") { 5977 xhr.abort(); 5978 } else if (type === "error") { 5979 if (typeof xhr.status !== "number") { 5980 complete(0, "error"); 5981 } else { 5982 complete(xhr.status, xhr.statusText); 5983 } 5984 } else { 5985 complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders()); 5986 } 5987 } 5988 }; 5989 }; 5990 xhr.onload = callback(); 5991 errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); 5992 if (xhr.onabort !== undefined) { 5993 xhr.onabort = errorCallback; 5994 } else { 5995 xhr.onreadystatechange = function() { 5996 if (xhr.readyState === 4) { 5997 window2.setTimeout(function() { 5998 if (callback) { 5999 errorCallback(); 6000 } 6001 }); 6002 } 6003 }; 6004 } 6005 callback = callback("abort"); 6006 try { 6007 xhr.send(options.hasContent && options.data || null); 6008 } catch (e) { 6009 if (callback) { 6010 throw e; 6011 } 6012 } 6013 }, 6014 abort: function() { 6015 if (callback) { 6016 callback(); 6017 } 6018 } 6019 }; 6020 } 6021 }); 6022 jQuery2.ajaxPrefilter(function(s2) { 6023 if (s2.crossDomain) { 6024 s2.contents.script = false; 6025 } 6026 }); 6027 jQuery2.ajaxSetup({ 6028 accepts: { 6029 script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript" 6030 }, 6031 contents: { 6032 script: /\b(?:java|ecma)script\b/ 6033 }, 6034 converters: { 6035 "text script": function(text) { 6036 jQuery2.globalEval(text); 6037 return text; 6038 } 6039 } 6040 }); 6041 jQuery2.ajaxPrefilter("script", function(s2) { 6042 if (s2.cache === undefined) { 6043 s2.cache = false; 6044 } 6045 if (s2.crossDomain) { 6046 s2.type = "GET"; 6047 } 6048 }); 6049 jQuery2.ajaxTransport("script", function(s2) { 6050 if (s2.crossDomain || s2.scriptAttrs) { 6051 var script, callback; 6052 return { 6053 send: function(_, complete) { 6054 script = jQuery2("<script>").attr(s2.scriptAttrs || {}).prop({ charset: s2.scriptCharset, src: s2.url }).on("load error", callback = function(evt) { 6055 script.remove(); 6056 callback = null; 6057 if (evt) { 6058 complete(evt.type === "error" ? 404 : 200, evt.type); 6059 } 6060 }); 6061 document2.head.appendChild(script[0]); 6062 }, 6063 abort: function() { 6064 if (callback) { 6065 callback(); 6066 } 6067 } 6068 }; 6069 } 6070 }); 6071 var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/; 6072 jQuery2.ajaxSetup({ 6073 jsonp: "callback", 6074 jsonpCallback: function() { 6075 var callback = oldCallbacks.pop() || jQuery2.expando + "_" + nonce.guid++; 6076 this[callback] = true; 6077 return callback; 6078 } 6079 }); 6080 jQuery2.ajaxPrefilter("json jsonp", function(s2, originalSettings, jqXHR) { 6081 var callbackName, overwritten, responseContainer, jsonProp = s2.jsonp !== false && (rjsonp.test(s2.url) ? "url" : typeof s2.data === "string" && (s2.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s2.data) && "data"); 6082 if (jsonProp || s2.dataTypes[0] === "jsonp") { 6083 callbackName = s2.jsonpCallback = isFunction(s2.jsonpCallback) ? s2.jsonpCallback() : s2.jsonpCallback; 6084 if (jsonProp) { 6085 s2[jsonProp] = s2[jsonProp].replace(rjsonp, "$1" + callbackName); 6086 } else if (s2.jsonp !== false) { 6087 s2.url += (rquery.test(s2.url) ? "&" : "?") + s2.jsonp + "=" + callbackName; 6088 } 6089 s2.converters["script json"] = function() { 6090 if (!responseContainer) { 6091 jQuery2.error(callbackName + " was not called"); 6092 } 6093 return responseContainer[0]; 6094 }; 6095 s2.dataTypes[0] = "json"; 6096 overwritten = window2[callbackName]; 6097 window2[callbackName] = function() { 6098 responseContainer = arguments; 6099 }; 6100 jqXHR.always(function() { 6101 if (overwritten === undefined) { 6102 jQuery2(window2).removeProp(callbackName); 6103 } else { 6104 window2[callbackName] = overwritten; 6105 } 6106 if (s2[callbackName]) { 6107 s2.jsonpCallback = originalSettings.jsonpCallback; 6108 oldCallbacks.push(callbackName); 6109 } 6110 if (responseContainer && isFunction(overwritten)) { 6111 overwritten(responseContainer[0]); 6112 } 6113 responseContainer = overwritten = undefined; 6114 }); 6115 return "script"; 6116 } 6117 }); 6118 support.createHTMLDocument = function() { 6119 var body = document2.implementation.createHTMLDocument("").body; 6120 body.innerHTML = "<form></form><form></form>"; 6121 return body.childNodes.length === 2; 6122 }(); 6123 jQuery2.parseHTML = function(data, context, keepScripts) { 6124 if (typeof data !== "string") { 6125 return []; 6126 } 6127 if (typeof context === "boolean") { 6128 keepScripts = context; 6129 context = false; 6130 } 6131 var base, parsed, scripts; 6132 if (!context) { 6133 if (support.createHTMLDocument) { 6134 context = document2.implementation.createHTMLDocument(""); 6135 base = context.createElement("base"); 6136 base.href = document2.location.href; 6137 context.head.appendChild(base); 6138 } else { 6139 context = document2; 6140 } 6141 } 6142 parsed = rsingleTag.exec(data); 6143 scripts = !keepScripts && []; 6144 if (parsed) { 6145 return [context.createElement(parsed[1])]; 6146 } 6147 parsed = buildFragment([data], context, scripts); 6148 if (scripts && scripts.length) { 6149 jQuery2(scripts).remove(); 6150 } 6151 return jQuery2.merge([], parsed.childNodes); 6152 }; 6153 jQuery2.fn.load = function(url, params, callback) { 6154 var selector, type, response, self = this, off = url.indexOf(" "); 6155 if (off > -1) { 6156 selector = stripAndCollapse(url.slice(off)); 6157 url = url.slice(0, off); 6158 } 6159 if (isFunction(params)) { 6160 callback = params; 6161 params = undefined; 6162 } else if (params && typeof params === "object") { 6163 type = "POST"; 6164 } 6165 if (self.length > 0) { 6166 jQuery2.ajax({ 6167 url, 6168 type: type || "GET", 6169 dataType: "html", 6170 data: params 6171 }).done(function(responseText) { 6172 response = arguments; 6173 self.html(selector ? jQuery2("<div>").append(jQuery2.parseHTML(responseText)).find(selector) : responseText); 6174 }).always(callback && function(jqXHR, status) { 6175 self.each(function() { 6176 callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); 6177 }); 6178 }); 6179 } 6180 return this; 6181 }; 6182 jQuery2.expr.pseudos.animated = function(elem) { 6183 return jQuery2.grep(jQuery2.timers, function(fn2) { 6184 return elem === fn2.elem; 6185 }).length; 6186 }; 6187 jQuery2.offset = { 6188 setOffset: function(elem, options, i) { 6189 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery2.css(elem, "position"), curElem = jQuery2(elem), props = {}; 6190 if (position === "static") { 6191 elem.style.position = "relative"; 6192 } 6193 curOffset = curElem.offset(); 6194 curCSSTop = jQuery2.css(elem, "top"); 6195 curCSSLeft = jQuery2.css(elem, "left"); 6196 calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1; 6197 if (calculatePosition) { 6198 curPosition = curElem.position(); 6199 curTop = curPosition.top; 6200 curLeft = curPosition.left; 6201 } else { 6202 curTop = parseFloat(curCSSTop) || 0; 6203 curLeft = parseFloat(curCSSLeft) || 0; 6204 } 6205 if (isFunction(options)) { 6206 options = options.call(elem, i, jQuery2.extend({}, curOffset)); 6207 } 6208 if (options.top != null) { 6209 props.top = options.top - curOffset.top + curTop; 6210 } 6211 if (options.left != null) { 6212 props.left = options.left - curOffset.left + curLeft; 6213 } 6214 if ("using" in options) { 6215 options.using.call(elem, props); 6216 } else { 6217 curElem.css(props); 6218 } 6219 } 6220 }; 6221 jQuery2.fn.extend({ 6222 offset: function(options) { 6223 if (arguments.length) { 6224 return options === undefined ? this : this.each(function(i) { 6225 jQuery2.offset.setOffset(this, options, i); 6226 }); 6227 } 6228 var rect, win, elem = this[0]; 6229 if (!elem) { 6230 return; 6231 } 6232 if (!elem.getClientRects().length) { 6233 return { top: 0, left: 0 }; 6234 } 6235 rect = elem.getBoundingClientRect(); 6236 win = elem.ownerDocument.defaultView; 6237 return { 6238 top: rect.top + win.pageYOffset, 6239 left: rect.left + win.pageXOffset 6240 }; 6241 }, 6242 position: function() { 6243 if (!this[0]) { 6244 return; 6245 } 6246 var offsetParent, offset2, doc, elem = this[0], parentOffset = { top: 0, left: 0 }; 6247 if (jQuery2.css(elem, "position") === "fixed") { 6248 offset2 = elem.getBoundingClientRect(); 6249 } else { 6250 offset2 = this.offset(); 6251 doc = elem.ownerDocument; 6252 offsetParent = elem.offsetParent || doc.documentElement; 6253 while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery2.css(offsetParent, "position") === "static") { 6254 offsetParent = offsetParent.parentNode; 6255 } 6256 if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) { 6257 parentOffset = jQuery2(offsetParent).offset(); 6258 parentOffset.top += jQuery2.css(offsetParent, "borderTopWidth", true); 6259 parentOffset.left += jQuery2.css(offsetParent, "borderLeftWidth", true); 6260 } 6261 } 6262 return { 6263 top: offset2.top - parentOffset.top - jQuery2.css(elem, "marginTop", true), 6264 left: offset2.left - parentOffset.left - jQuery2.css(elem, "marginLeft", true) 6265 }; 6266 }, 6267 offsetParent: function() { 6268 return this.map(function() { 6269 var offsetParent = this.offsetParent; 6270 while (offsetParent && jQuery2.css(offsetParent, "position") === "static") { 6271 offsetParent = offsetParent.offsetParent; 6272 } 6273 return offsetParent || documentElement; 6274 }); 6275 } 6276 }); 6277 jQuery2.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) { 6278 var top2 = prop === "pageYOffset"; 6279 jQuery2.fn[method] = function(val) { 6280 return access(this, function(elem, method2, val2) { 6281 var win; 6282 if (isWindow(elem)) { 6283 win = elem; 6284 } else if (elem.nodeType === 9) { 6285 win = elem.defaultView; 6286 } 6287 if (val2 === undefined) { 6288 return win ? win[prop] : elem[method2]; 6289 } 6290 if (win) { 6291 win.scrollTo(!top2 ? val2 : win.pageXOffset, top2 ? val2 : win.pageYOffset); 6292 } else { 6293 elem[method2] = val2; 6294 } 6295 }, method, val, arguments.length); 6296 }; 6297 }); 6298 jQuery2.each(["top", "left"], function(_i, prop) { 6299 jQuery2.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) { 6300 if (computed) { 6301 computed = curCSS(elem, prop); 6302 return rnumnonpx.test(computed) ? jQuery2(elem).position()[prop] + "px" : computed; 6303 } 6304 }); 6305 }); 6306 jQuery2.each({ Height: "height", Width: "width" }, function(name, type) { 6307 jQuery2.each({ 6308 padding: "inner" + name, 6309 content: type, 6310 "": "outer" + name 6311 }, function(defaultExtra, funcName) { 6312 jQuery2.fn[funcName] = function(margin, value) { 6313 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 6314 return access(this, function(elem, type2, value2) { 6315 var doc; 6316 if (isWindow(elem)) { 6317 return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name]; 6318 } 6319 if (elem.nodeType === 9) { 6320 doc = elem.documentElement; 6321 return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]); 6322 } 6323 return value2 === undefined ? jQuery2.css(elem, type2, extra) : jQuery2.style(elem, type2, value2, extra); 6324 }, type, chainable ? margin : undefined, chainable); 6325 }; 6326 }); 6327 }); 6328 jQuery2.each([ 6329 "ajaxStart", 6330 "ajaxStop", 6331 "ajaxComplete", 6332 "ajaxError", 6333 "ajaxSuccess", 6334 "ajaxSend" 6335 ], function(_i, type) { 6336 jQuery2.fn[type] = function(fn2) { 6337 return this.on(type, fn2); 6338 }; 6339 }); 6340 jQuery2.fn.extend({ 6341 bind: function(types, data, fn2) { 6342 return this.on(types, null, data, fn2); 6343 }, 6344 unbind: function(types, fn2) { 6345 return this.off(types, null, fn2); 6346 }, 6347 delegate: function(selector, types, data, fn2) { 6348 return this.on(types, selector, data, fn2); 6349 }, 6350 undelegate: function(selector, types, fn2) { 6351 return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn2); 6352 }, 6353 hover: function(fnOver, fnOut) { 6354 return this.on("mouseenter", fnOver).on("mouseleave", fnOut || fnOver); 6355 } 6356 }); 6357 jQuery2.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function(_i, name) { 6358 jQuery2.fn[name] = function(data, fn2) { 6359 return arguments.length > 0 ? this.on(name, null, data, fn2) : this.trigger(name); 6360 }; 6361 }); 6362 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 6363 jQuery2.proxy = function(fn2, context) { 6364 var tmp, args, proxy; 6365 if (typeof context === "string") { 6366 tmp = fn2[context]; 6367 context = fn2; 6368 fn2 = tmp; 6369 } 6370 if (!isFunction(fn2)) { 6371 return; 6372 } 6373 args = slice.call(arguments, 2); 6374 proxy = function() { 6375 return fn2.apply(context || this, args.concat(slice.call(arguments))); 6376 }; 6377 proxy.guid = fn2.guid = fn2.guid || jQuery2.guid++; 6378 return proxy; 6379 }; 6380 jQuery2.holdReady = function(hold) { 6381 if (hold) { 6382 jQuery2.readyWait++; 6383 } else { 6384 jQuery2.ready(true); 6385 } 6386 }; 6387 jQuery2.isArray = Array.isArray; 6388 jQuery2.parseJSON = JSON.parse; 6389 jQuery2.nodeName = nodeName; 6390 jQuery2.isFunction = isFunction; 6391 jQuery2.isWindow = isWindow; 6392 jQuery2.camelCase = camelCase; 6393 jQuery2.type = toType2; 6394 jQuery2.now = Date.now; 6395 jQuery2.isNumeric = function(obj) { 6396 var type = jQuery2.type(obj); 6397 return (type === "number" || type === "string") && !isNaN(obj - parseFloat(obj)); 6398 }; 6399 jQuery2.trim = function(text) { 6400 return text == null ? "" : (text + "").replace(rtrim, "$1"); 6401 }; 6402 if (typeof define === "function" && define.amd) { 6403 define("jquery", [], function() { 6404 return jQuery2; 6405 }); 6406 } 6407 var { jQuery: _jQuery, $: _$ } = window2; 6408 jQuery2.noConflict = function(deep) { 6409 if (window2.$ === jQuery2) { 6410 window2.$ = _$; 6411 } 6412 if (deep && window2.jQuery === jQuery2) { 6413 window2.jQuery = _jQuery; 6414 } 6415 return jQuery2; 6416 }; 6417 if (typeof noGlobal === "undefined") { 6418 window2.jQuery = window2.$ = jQuery2; 6419 } 6420 return jQuery2; 6421 }); 6422}); 6423
vendor: 124,112 bytes, lines 6424-10244
6424// node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js 6425(function() { 6426 if (window.Reflect === undefined || window.customElements === undefined || window.customElements.polyfillWrapFlushCallback) { 6427 return; 6428 } 6429 const BuiltInHTMLElement = HTMLElement; 6430 const wrapperForTheName = { 6431 HTMLElement: function HTMLElement2() { 6432 return Reflect.construct(BuiltInHTMLElement, [], this.constructor); 6433 } 6434 }; 6435 window.HTMLElement = wrapperForTheName["HTMLElement"]; 6436 HTMLElement.prototype = BuiltInHTMLElement.prototype; 6437 HTMLElement.prototype.constructor = HTMLElement; 6438 Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement); 6439})(); 6440(function(prototype) { 6441 if (typeof prototype.requestSubmit == "function") 6442 return; 6443 prototype.requestSubmit = function(submitter) { 6444 if (submitter) { 6445 validateSubmitter(submitter, this); 6446 submitter.click(); 6447 } else { 6448 submitter = document.createElement("input"); 6449 submitter.type = "submit"; 6450 submitter.hidden = true; 6451 this.appendChild(submitter); 6452 submitter.click(); 6453 this.removeChild(submitter); 6454 } 6455 }; 6456 function validateSubmitter(submitter, form) { 6457 submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'"); 6458 submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button"); 6459 submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError"); 6460 } 6461 function raise(errorConstructor, message, name) { 6462 throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".", name); 6463 } 6464})(HTMLFormElement.prototype); 6465var submittersByForm = new WeakMap; 6466function findSubmitterFromClickTarget(target) { 6467 const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null; 6468 const candidate = element ? element.closest("input, button") : null; 6469 return (candidate === null || candidate === undefined ? undefined : candidate.type) == "submit" ? candidate : null; 6470} 6471function clickCaptured(event) { 6472 const submitter = findSubmitterFromClickTarget(event.target); 6473 if (submitter && submitter.form) { 6474 submittersByForm.set(submitter.form, submitter); 6475 } 6476} 6477(function() { 6478 if ("submitter" in Event.prototype) 6479 return; 6480 let prototype = window.Event.prototype; 6481 if ("SubmitEvent" in window && /Apple Computer/.test(navigator.vendor)) { 6482 prototype = window.SubmitEvent.prototype; 6483 } else if ("SubmitEvent" in window) { 6484 return; 6485 } 6486 addEventListener("click", clickCaptured, true); 6487 Object.defineProperty(prototype, "submitter", { 6488 get() { 6489 if (this.type == "submit" && this.target instanceof HTMLFormElement) { 6490 return submittersByForm.get(this.target); 6491 } 6492 } 6493 }); 6494})(); 6495var FrameLoadingStyle; 6496(function(FrameLoadingStyle2) { 6497 FrameLoadingStyle2["eager"] = "eager"; 6498 FrameLoadingStyle2["lazy"] = "lazy"; 6499})(FrameLoadingStyle || (FrameLoadingStyle = {})); 6500 6501class FrameElement extends HTMLElement { 6502 static get observedAttributes() { 6503 return ["disabled", "complete", "loading", "src"]; 6504 } 6505 constructor() { 6506 super(); 6507 this.loaded = Promise.resolve(); 6508 this.delegate = new FrameElement.delegateConstructor(this); 6509 } 6510 connectedCallback() { 6511 this.delegate.connect(); 6512 } 6513 disconnectedCallback() { 6514 this.delegate.disconnect(); 6515 } 6516 reload() { 6517 return this.delegate.sourceURLReloaded(); 6518 } 6519 attributeChangedCallback(name) { 6520 if (name == "loading") { 6521 this.delegate.loadingStyleChanged(); 6522 } else if (name == "complete") { 6523 this.delegate.completeChanged(); 6524 } else if (name == "src") { 6525 this.delegate.sourceURLChanged(); 6526 } else { 6527 this.delegate.disabledChanged(); 6528 } 6529 } 6530 get src() { 6531 return this.getAttribute("src"); 6532 } 6533 set src(value) { 6534 if (value) { 6535 this.setAttribute("src", value); 6536 } else { 6537 this.removeAttribute("src"); 6538 } 6539 } 6540 get loading() { 6541 return frameLoadingStyleFromString(this.getAttribute("loading") || ""); 6542 } 6543 set loading(value) { 6544 if (value) { 6545 this.setAttribute("loading", value); 6546 } else { 6547 this.removeAttribute("loading"); 6548 } 6549 } 6550 get disabled() { 6551 return this.hasAttribute("disabled"); 6552 } 6553 set disabled(value) { 6554 if (value) { 6555 this.setAttribute("disabled", ""); 6556 } else { 6557 this.removeAttribute("disabled"); 6558 } 6559 } 6560 get autoscroll() { 6561 return this.hasAttribute("autoscroll"); 6562 } 6563 set autoscroll(value) { 6564 if (value) { 6565 this.setAttribute("autoscroll", ""); 6566 } else { 6567 this.removeAttribute("autoscroll"); 6568 } 6569 } 6570 get complete() { 6571 return !this.delegate.isLoading; 6572 } 6573 get isActive() { 6574 return this.ownerDocument === document && !this.isPreview; 6575 } 6576 get isPreview() { 6577 var _a, _b; 6578 return (_b = (_a = this.ownerDocument) === null || _a === undefined ? undefined : _a.documentElement) === null || _b === undefined ? undefined : _b.hasAttribute("data-turbo-preview"); 6579 } 6580} 6581function frameLoadingStyleFromString(style) { 6582 switch (style.toLowerCase()) { 6583 case "lazy": 6584 return FrameLoadingStyle.lazy; 6585 default: 6586 return FrameLoadingStyle.eager; 6587 } 6588} 6589function expandURL(locatable) { 6590 return new URL(locatable.toString(), document.baseURI); 6591} 6592function getAnchor(url) { 6593 let anchorMatch; 6594 if (url.hash) { 6595 return url.hash.slice(1); 6596 } else if (anchorMatch = url.href.match(/#(.*)$/)) { 6597 return anchorMatch[1]; 6598 } 6599} 6600function getAction(form, submitter) { 6601 const action = (submitter === null || submitter === undefined ? undefined : submitter.getAttribute("formaction")) || form.getAttribute("action") || form.action; 6602 return expandURL(action); 6603} 6604function getExtension(url) { 6605 return (getLastPathComponent(url).match(/\.[^.]*$/) || [])[0] || ""; 6606} 6607function isHTML(url) { 6608 return !!getExtension(url).match(/^(?:|\.(?:htm|html|xhtml|php))$/); 6609} 6610function isPrefixedBy(baseURL, url) { 6611 const prefix = getPrefix(url); 6612 return baseURL.href === expandURL(prefix).href || baseURL.href.startsWith(prefix); 6613} 6614function locationIsVisitable(location2, rootLocation) { 6615 return isPrefixedBy(location2, rootLocation) && isHTML(location2); 6616} 6617function getRequestURL(url) { 6618 const anchor = getAnchor(url); 6619 return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href; 6620} 6621function toCacheKey(url) { 6622 return getRequestURL(url); 6623} 6624function urlsAreEqual(left, right) { 6625 return expandURL(left).href == expandURL(right).href; 6626} 6627function getPathComponents(url) { 6628 return url.pathname.split("/").slice(1); 6629} 6630function getLastPathComponent(url) { 6631 return getPathComponents(url).slice(-1)[0]; 6632} 6633function getPrefix(url) { 6634 return addTrailingSlash(url.origin + url.pathname); 6635} 6636function addTrailingSlash(value) { 6637 return value.endsWith("/") ? value : value + "/"; 6638} 6639 6640class FetchResponse { 6641 constructor(response) { 6642 this.response = response; 6643 } 6644 get succeeded() { 6645 return this.response.ok; 6646 } 6647 get failed() { 6648 return !this.succeeded; 6649 } 6650 get clientError() { 6651 return this.statusCode >= 400 && this.statusCode <= 499; 6652 } 6653 get serverError() { 6654 return this.statusCode >= 500 && this.statusCode <= 599; 6655 } 6656 get redirected() { 6657 return this.response.redirected; 6658 } 6659 get location() { 6660 return expandURL(this.response.url); 6661 } 6662 get isHTML() { 6663 return this.contentType && this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/); 6664 } 6665 get statusCode() { 6666 return this.response.status; 6667 } 6668 get contentType() { 6669 return this.header("Content-Type"); 6670 } 6671 get responseText() { 6672 return this.response.clone().text(); 6673 } 6674 get responseHTML() { 6675 if (this.isHTML) { 6676 return this.response.clone().text(); 6677 } else { 6678 return Promise.resolve(undefined); 6679 } 6680 } 6681 header(name) { 6682 return this.response.headers.get(name); 6683 } 6684} 6685function activateScriptElement(element) { 6686 if (element.getAttribute("data-turbo-eval") == "false") { 6687 return element; 6688 } else { 6689 const createdScriptElement = document.createElement("script"); 6690 const cspNonce = getMetaContent("csp-nonce"); 6691 if (cspNonce) { 6692 createdScriptElement.nonce = cspNonce; 6693 } 6694 createdScriptElement.textContent = element.textContent; 6695 createdScriptElement.async = false; 6696 copyElementAttributes(createdScriptElement, element); 6697 return createdScriptElement; 6698 } 6699} 6700function copyElementAttributes(destinationElement, sourceElement) { 6701 for (const { name, value } of sourceElement.attributes) { 6702 destinationElement.setAttribute(name, value); 6703 } 6704} 6705function createDocumentFragment(html) { 6706 const template = document.createElement("template"); 6707 template.innerHTML = html; 6708 return template.content; 6709} 6710function dispatch(eventName, { target, cancelable, detail } = {}) { 6711 const event = new CustomEvent(eventName, { 6712 cancelable, 6713 bubbles: true, 6714 composed: true, 6715 detail 6716 }); 6717 if (target && target.isConnected) { 6718 target.dispatchEvent(event); 6719 } else { 6720 document.documentElement.dispatchEvent(event); 6721 } 6722 return event; 6723} 6724function nextAnimationFrame() { 6725 return new Promise((resolve) => requestAnimationFrame(() => resolve())); 6726} 6727function nextEventLoopTick() { 6728 return new Promise((resolve) => setTimeout(() => resolve(), 0)); 6729} 6730function nextMicrotask() { 6731 return Promise.resolve(); 6732} 6733function parseHTMLDocument(html = "") { 6734 return new DOMParser().parseFromString(html, "text/html"); 6735} 6736function unindent(strings, ...values) { 6737 const lines = interpolate(strings, values).replace(/^\n/, "").split(` 6738`); 6739 const match = lines[0].match(/^\s+/); 6740 const indent = match ? match[0].length : 0; 6741 return lines.map((line) => line.slice(indent)).join(` 6742`); 6743} 6744function interpolate(strings, values) { 6745 return strings.reduce((result, string, i) => { 6746 const value = values[i] == undefined ? "" : values[i]; 6747 return result + string + value; 6748 }, ""); 6749} 6750function uuid() { 6751 return Array.from({ length: 36 }).map((_, i) => { 6752 if (i == 8 || i == 13 || i == 18 || i == 23) { 6753 return "-"; 6754 } else if (i == 14) { 6755 return "4"; 6756 } else if (i == 19) { 6757 return (Math.floor(Math.random() * 4) + 8).toString(16); 6758 } else { 6759 return Math.floor(Math.random() * 15).toString(16); 6760 } 6761 }).join(""); 6762} 6763function getAttribute(attributeName, ...elements) { 6764 for (const value of elements.map((element) => element === null || element === undefined ? undefined : element.getAttribute(attributeName))) { 6765 if (typeof value == "string") 6766 return value; 6767 } 6768 return null; 6769} 6770function hasAttribute(attributeName, ...elements) { 6771 return elements.some((element) => element && element.hasAttribute(attributeName)); 6772} 6773function markAsBusy(...elements) { 6774 for (const element of elements) { 6775 if (element.localName == "turbo-frame") { 6776 element.setAttribute("busy", ""); 6777 } 6778 element.setAttribute("aria-busy", "true"); 6779 } 6780} 6781function clearBusyState(...elements) { 6782 for (const element of elements) { 6783 if (element.localName == "turbo-frame") { 6784 element.removeAttribute("busy"); 6785 } 6786 element.removeAttribute("aria-busy"); 6787 } 6788} 6789function waitForLoad(element, timeoutInMilliseconds = 2000) { 6790 return new Promise((resolve) => { 6791 const onComplete = () => { 6792 element.removeEventListener("error", onComplete); 6793 element.removeEventListener("load", onComplete); 6794 resolve(); 6795 }; 6796 element.addEventListener("load", onComplete, { once: true }); 6797 element.addEventListener("error", onComplete, { once: true }); 6798 setTimeout(resolve, timeoutInMilliseconds); 6799 }); 6800} 6801function getHistoryMethodForAction(action) { 6802 switch (action) { 6803 case "replace": 6804 return history.replaceState; 6805 case "advance": 6806 case "restore": 6807 return history.pushState; 6808 } 6809} 6810function isAction(action) { 6811 return action == "advance" || action == "replace" || action == "restore"; 6812} 6813function getVisitAction(...elements) { 6814 const action = getAttribute("data-turbo-action", ...elements); 6815 return isAction(action) ? action : null; 6816} 6817function getMetaElement(name) { 6818 return document.querySelector(`meta[name="${name}"]`); 6819} 6820function getMetaContent(name) { 6821 const element = getMetaElement(name); 6822 return element && element.content; 6823} 6824function setMetaContent(name, content) { 6825 let element = getMetaElement(name); 6826 if (!element) { 6827 element = document.createElement("meta"); 6828 element.setAttribute("name", name); 6829 document.head.appendChild(element); 6830 } 6831 element.setAttribute("content", content); 6832 return element; 6833} 6834function findClosestRecursively(element, selector) { 6835 var _a; 6836 if (element instanceof Element) { 6837 return element.closest(selector) || findClosestRecursively(element.assignedSlot || ((_a = element.getRootNode()) === null || _a === undefined ? undefined : _a.host), selector); 6838 } 6839} 6840var FetchMethod; 6841(function(FetchMethod2) { 6842 FetchMethod2[FetchMethod2["get"] = 0] = "get"; 6843 FetchMethod2[FetchMethod2["post"] = 1] = "post"; 6844 FetchMethod2[FetchMethod2["put"] = 2] = "put"; 6845 FetchMethod2[FetchMethod2["patch"] = 3] = "patch"; 6846 FetchMethod2[FetchMethod2["delete"] = 4] = "delete"; 6847})(FetchMethod || (FetchMethod = {})); 6848function fetchMethodFromString(method) { 6849 switch (method.toLowerCase()) { 6850 case "get": 6851 return FetchMethod.get; 6852 case "post": 6853 return FetchMethod.post; 6854 case "put": 6855 return FetchMethod.put; 6856 case "patch": 6857 return FetchMethod.patch; 6858 case "delete": 6859 return FetchMethod.delete; 6860 } 6861} 6862 6863class FetchRequest { 6864 constructor(delegate, method, location2, body = new URLSearchParams, target = null) { 6865 this.abortController = new AbortController; 6866 this.resolveRequestPromise = (_value) => {}; 6867 this.delegate = delegate; 6868 this.method = method; 6869 this.headers = this.defaultHeaders; 6870 this.body = body; 6871 this.url = location2; 6872 this.target = target; 6873 } 6874 get location() { 6875 return this.url; 6876 } 6877 get params() { 6878 return this.url.searchParams; 6879 } 6880 get entries() { 6881 return this.body ? Array.from(this.body.entries()) : []; 6882 } 6883 cancel() { 6884 this.abortController.abort(); 6885 } 6886 async perform() { 6887 const { fetchOptions } = this; 6888 this.delegate.prepareRequest(this); 6889 await this.allowRequestToBeIntercepted(fetchOptions); 6890 try { 6891 this.delegate.requestStarted(this); 6892 const response = await fetch(this.url.href, fetchOptions); 6893 return await this.receive(response); 6894 } catch (error) { 6895 if (error.name !== "AbortError") { 6896 if (this.willDelegateErrorHandling(error)) { 6897 this.delegate.requestErrored(this, error); 6898 } 6899 throw error; 6900 } 6901 } finally { 6902 this.delegate.requestFinished(this); 6903 } 6904 } 6905 async receive(response) { 6906 const fetchResponse = new FetchResponse(response); 6907 const event = dispatch("turbo:before-fetch-response", { 6908 cancelable: true, 6909 detail: { fetchResponse }, 6910 target: this.target 6911 }); 6912 if (event.defaultPrevented) { 6913 this.delegate.requestPreventedHandlingResponse(this, fetchResponse); 6914 } else if (fetchResponse.succeeded) { 6915 this.delegate.requestSucceededWithResponse(this, fetchResponse); 6916 } else { 6917 this.delegate.requestFailedWithResponse(this, fetchResponse); 6918 } 6919 return fetchResponse; 6920 } 6921 get fetchOptions() { 6922 var _a; 6923 return { 6924 method: FetchMethod[this.method].toUpperCase(), 6925 credentials: "same-origin", 6926 headers: this.headers, 6927 redirect: "follow", 6928 body: this.isSafe ? null : this.body, 6929 signal: this.abortSignal, 6930 referrer: (_a = this.delegate.referrer) === null || _a === undefined ? undefined : _a.href 6931 }; 6932 } 6933 get defaultHeaders() { 6934 return { 6935 Accept: "text/html, application/xhtml+xml" 6936 }; 6937 } 6938 get isSafe() { 6939 return this.method === FetchMethod.get; 6940 } 6941 get abortSignal() { 6942 return this.abortController.signal; 6943 } 6944 acceptResponseType(mimeType) { 6945 this.headers["Accept"] = [mimeType, this.headers["Accept"]].join(", "); 6946 } 6947 async allowRequestToBeIntercepted(fetchOptions) { 6948 const requestInterception = new Promise((resolve) => this.resolveRequestPromise = resolve); 6949 const event = dispatch("turbo:before-fetch-request", { 6950 cancelable: true, 6951 detail: { 6952 fetchOptions, 6953 url: this.url, 6954 resume: this.resolveRequestPromise 6955 }, 6956 target: this.target 6957 }); 6958 if (event.defaultPrevented) 6959 await requestInterception; 6960 } 6961 willDelegateErrorHandling(error) { 6962 const event = dispatch("turbo:fetch-request-error", { 6963 target: this.target, 6964 cancelable: true, 6965 detail: { request: this, error } 6966 }); 6967 return !event.defaultPrevented; 6968 } 6969} 6970 6971class AppearanceObserver { 6972 constructor(delegate, element) { 6973 this.started = false; 6974 this.intersect = (entries) => { 6975 const lastEntry = entries.slice(-1)[0]; 6976 if (lastEntry === null || lastEntry === undefined ? undefined : lastEntry.isIntersecting) { 6977 this.delegate.elementAppearedInViewport(this.element); 6978 } 6979 }; 6980 this.delegate = delegate; 6981 this.element = element; 6982 this.intersectionObserver = new IntersectionObserver(this.intersect); 6983 } 6984 start() { 6985 if (!this.started) { 6986 this.started = true; 6987 this.intersectionObserver.observe(this.element); 6988 } 6989 } 6990 stop() { 6991 if (this.started) { 6992 this.started = false; 6993 this.intersectionObserver.unobserve(this.element); 6994 } 6995 } 6996} 6997 6998class StreamMessage { 6999 static wrap(message) { 7000 if (typeof message == "string") { 7001 return new this(createDocumentFragment(message)); 7002 } else { 7003 return message; 7004 } 7005 } 7006 constructor(fragment) { 7007 this.fragment = importStreamElements(fragment); 7008 } 7009} 7010StreamMessage.contentType = "text/vnd.turbo-stream.html"; 7011function importStreamElements(fragment) { 7012 for (const element of fragment.querySelectorAll("turbo-stream")) { 7013 const streamElement = document.importNode(element, true); 7014 for (const inertScriptElement of streamElement.templateElement.content.querySelectorAll("script")) { 7015 inertScriptElement.replaceWith(activateScriptElement(inertScriptElement)); 7016 } 7017 element.replaceWith(streamElement); 7018 } 7019 return fragment; 7020} 7021var FormSubmissionState; 7022(function(FormSubmissionState2) { 7023 FormSubmissionState2[FormSubmissionState2["initialized"] = 0] = "initialized"; 7024 FormSubmissionState2[FormSubmissionState2["requesting"] = 1] = "requesting"; 7025 FormSubmissionState2[FormSubmissionState2["waiting"] = 2] = "waiting"; 7026 FormSubmissionState2[FormSubmissionState2["receiving"] = 3] = "receiving"; 7027 FormSubmissionState2[FormSubmissionState2["stopping"] = 4] = "stopping"; 7028 FormSubmissionState2[FormSubmissionState2["stopped"] = 5] = "stopped"; 7029})(FormSubmissionState || (FormSubmissionState = {})); 7030var FormEnctype; 7031(function(FormEnctype2) { 7032 FormEnctype2["urlEncoded"] = "application/x-www-form-urlencoded"; 7033 FormEnctype2["multipart"] = "multipart/form-data"; 7034 FormEnctype2["plain"] = "text/plain"; 7035})(FormEnctype || (FormEnctype = {})); 7036function formEnctypeFromString(encoding) { 7037 switch (encoding.toLowerCase()) { 7038 case FormEnctype.multipart: 7039 return FormEnctype.multipart; 7040 case FormEnctype.plain: 7041 return FormEnctype.plain; 7042 default: 7043 return FormEnctype.urlEncoded; 7044 } 7045} 7046 7047class FormSubmission { 7048 static confirmMethod(message, _element, _submitter) { 7049 return Promise.resolve(confirm(message)); 7050 } 7051 constructor(delegate, formElement, submitter, mustRedirect = false) { 7052 this.state = FormSubmissionState.initialized; 7053 this.delegate = delegate; 7054 this.formElement = formElement; 7055 this.submitter = submitter; 7056 this.formData = buildFormData(formElement, submitter); 7057 this.location = expandURL(this.action); 7058 if (this.method == FetchMethod.get) { 7059 mergeFormDataEntries(this.location, [...this.body.entries()]); 7060 } 7061 this.fetchRequest = new FetchRequest(this, this.method, this.location, this.body, this.formElement); 7062 this.mustRedirect = mustRedirect; 7063 } 7064 get method() { 7065 var _a; 7066 const method = ((_a = this.submitter) === null || _a === undefined ? undefined : _a.getAttribute("formmethod")) || this.formElement.getAttribute("method") || ""; 7067 return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get; 7068 } 7069 get action() { 7070 var _a; 7071 const formElementAction = typeof this.formElement.action === "string" ? this.formElement.action : null; 7072 if ((_a = this.submitter) === null || _a === undefined ? undefined : _a.hasAttribute("formaction")) { 7073 return this.submitter.getAttribute("formaction") || ""; 7074 } else { 7075 return this.formElement.getAttribute("action") || formElementAction || ""; 7076 } 7077 } 7078 get body() { 7079 if (this.enctype == FormEnctype.urlEncoded || this.method == FetchMethod.get) { 7080 return new URLSearchParams(this.stringFormData); 7081 } else { 7082 return this.formData; 7083 } 7084 } 7085 get enctype() { 7086 var _a; 7087 return formEnctypeFromString(((_a = this.submitter) === null || _a === undefined ? undefined : _a.getAttribute("formenctype")) || this.formElement.enctype); 7088 } 7089 get isSafe() { 7090 return this.fetchRequest.isSafe; 7091 } 7092 get stringFormData() { 7093 return [...this.formData].reduce((entries, [name, value]) => { 7094 return entries.concat(typeof value == "string" ? [[name, value]] : []); 7095 }, []); 7096 } 7097 async start() { 7098 const { initialized, requesting } = FormSubmissionState; 7099 const confirmationMessage = getAttribute("data-turbo-confirm", this.submitter, this.formElement); 7100 if (typeof confirmationMessage === "string") { 7101 const answer = await FormSubmission.confirmMethod(confirmationMessage, this.formElement, this.submitter); 7102 if (!answer) { 7103 return; 7104 } 7105 } 7106 if (this.state == initialized) { 7107 this.state = requesting; 7108 return this.fetchRequest.perform(); 7109 } 7110 } 7111 stop() { 7112 const { stopping, stopped } = FormSubmissionState; 7113 if (this.state != stopping && this.state != stopped) { 7114 this.state = stopping; 7115 this.fetchRequest.cancel(); 7116 return true; 7117 } 7118 } 7119 prepareRequest(request) { 7120 if (!request.isSafe) { 7121 const token = getCookieValue(getMetaContent("csrf-param")) || getMetaContent("csrf-token"); 7122 if (token) { 7123 request.headers["X-CSRF-Token"] = token; 7124 } 7125 } 7126 if (this.requestAcceptsTurboStreamResponse(request)) { 7127 request.acceptResponseType(StreamMessage.contentType); 7128 } 7129 } 7130 requestStarted(_request) { 7131 var _a; 7132 this.state = FormSubmissionState.waiting; 7133 (_a = this.submitter) === null || _a === undefined || _a.setAttribute("disabled", ""); 7134 this.setSubmitsWith(); 7135 dispatch("turbo:submit-start", { 7136 target: this.formElement, 7137 detail: { formSubmission: this } 7138 }); 7139 this.delegate.formSubmissionStarted(this); 7140 } 7141 requestPreventedHandlingResponse(request, response) { 7142 this.result = { success: response.succeeded, fetchResponse: response }; 7143 } 7144 requestSucceededWithResponse(request, response) { 7145 if (response.clientError || response.serverError) { 7146 this.delegate.formSubmissionFailedWithResponse(this, response); 7147 } else if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) { 7148 const error = new Error("Form responses must redirect to another location"); 7149 this.delegate.formSubmissionErrored(this, error); 7150 } else { 7151 this.state = FormSubmissionState.receiving; 7152 this.result = { success: true, fetchResponse: response }; 7153 this.delegate.formSubmissionSucceededWithResponse(this, response); 7154 } 7155 } 7156 requestFailedWithResponse(request, response) { 7157 this.result = { success: false, fetchResponse: response }; 7158 this.delegate.formSubmissionFailedWithResponse(this, response); 7159 } 7160 requestErrored(request, error) { 7161 this.result = { success: false, error }; 7162 this.delegate.formSubmissionErrored(this, error); 7163 } 7164 requestFinished(_request) { 7165 var _a; 7166 this.state = FormSubmissionState.stopped; 7167 (_a = this.submitter) === null || _a === undefined || _a.removeAttribute("disabled"); 7168 this.resetSubmitterText(); 7169 dispatch("turbo:submit-end", { 7170 target: this.formElement, 7171 detail: Object.assign({ formSubmission: this }, this.result) 7172 }); 7173 this.delegate.formSubmissionFinished(this); 7174 } 7175 setSubmitsWith() { 7176 if (!this.submitter || !this.submitsWith) 7177 return; 7178 if (this.submitter.matches("button")) { 7179 this.originalSubmitText = this.submitter.innerHTML; 7180 this.submitter.innerHTML = this.submitsWith; 7181 } else if (this.submitter.matches("input")) { 7182 const input = this.submitter; 7183 this.originalSubmitText = input.value; 7184 input.value = this.submitsWith; 7185 } 7186 } 7187 resetSubmitterText() { 7188 if (!this.submitter || !this.originalSubmitText) 7189 return; 7190 if (this.submitter.matches("button")) { 7191 this.submitter.innerHTML = this.originalSubmitText; 7192 } else if (this.submitter.matches("input")) { 7193 const input = this.submitter; 7194 input.value = this.originalSubmitText; 7195 } 7196 } 7197 requestMustRedirect(request) { 7198 return !request.isSafe && this.mustRedirect; 7199 } 7200 requestAcceptsTurboStreamResponse(request) { 7201 return !request.isSafe || hasAttribute("data-turbo-stream", this.submitter, this.formElement); 7202 } 7203 get submitsWith() { 7204 var _a; 7205 return (_a = this.submitter) === null || _a === undefined ? undefined : _a.getAttribute("data-turbo-submits-with"); 7206 } 7207} 7208function buildFormData(formElement, submitter) { 7209 const formData = new FormData(formElement); 7210 const name = submitter === null || submitter === undefined ? undefined : submitter.getAttribute("name"); 7211 const value = submitter === null || submitter === undefined ? undefined : submitter.getAttribute("value"); 7212 if (name) { 7213 formData.append(name, value || ""); 7214 } 7215 return formData; 7216} 7217function getCookieValue(cookieName) { 7218 if (cookieName != null) { 7219 const cookies = document.cookie ? document.cookie.split("; ") : []; 7220 const cookie = cookies.find((cookie2) => cookie2.startsWith(cookieName)); 7221 if (cookie) { 7222 const value = cookie.split("=").slice(1).join("="); 7223 return value ? decodeURIComponent(value) : undefined; 7224 } 7225 } 7226} 7227function responseSucceededWithoutRedirect(response) { 7228 return response.statusCode == 200 && !response.redirected; 7229} 7230function mergeFormDataEntries(url, entries) { 7231 const searchParams = new URLSearchParams; 7232 for (const [name, value] of entries) { 7233 if (value instanceof File) 7234 continue; 7235 searchParams.append(name, value); 7236 } 7237 url.search = searchParams.toString(); 7238 return url; 7239} 7240 7241class Snapshot { 7242 constructor(element) { 7243 this.element = element; 7244 } 7245 get activeElement() { 7246 return this.element.ownerDocument.activeElement; 7247 } 7248 get children() { 7249 return [...this.element.children]; 7250 } 7251 hasAnchor(anchor) { 7252 return this.getElementForAnchor(anchor) != null; 7253 } 7254 getElementForAnchor(anchor) { 7255 return anchor ? this.element.querySelector(`[id='${anchor}'], a[name='${anchor}']`) : null; 7256 } 7257 get isConnected() { 7258 return this.element.isConnected; 7259 } 7260 get firstAutofocusableElement() { 7261 const inertDisabledOrHidden = "[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"; 7262 for (const element of this.element.querySelectorAll("[autofocus]")) { 7263 if (element.closest(inertDisabledOrHidden) == null) 7264 return element; 7265 else 7266 continue; 7267 } 7268 return null; 7269 } 7270 get permanentElements() { 7271 return queryPermanentElementsAll(this.element); 7272 } 7273 getPermanentElementById(id) { 7274 return getPermanentElementById(this.element, id); 7275 } 7276 getPermanentElementMapForSnapshot(snapshot) { 7277 const permanentElementMap = {}; 7278 for (const currentPermanentElement of this.permanentElements) { 7279 const { id } = currentPermanentElement; 7280 const newPermanentElement = snapshot.getPermanentElementById(id); 7281 if (newPermanentElement) { 7282 permanentElementMap[id] = [currentPermanentElement, newPermanentElement]; 7283 } 7284 } 7285 return permanentElementMap; 7286 } 7287} 7288function getPermanentElementById(node, id) { 7289 return node.querySelector(`#${id}[data-turbo-permanent]`); 7290} 7291function queryPermanentElementsAll(node) { 7292 return node.querySelectorAll("[id][data-turbo-permanent]"); 7293} 7294 7295class FormSubmitObserver { 7296 constructor(delegate, eventTarget) { 7297 this.started = false; 7298 this.submitCaptured = () => { 7299 this.eventTarget.removeEventListener("submit", this.submitBubbled, false); 7300 this.eventTarget.addEventListener("submit", this.submitBubbled, false); 7301 }; 7302 this.submitBubbled = (event) => { 7303 if (!event.defaultPrevented) { 7304 const form = event.target instanceof HTMLFormElement ? event.target : undefined; 7305 const submitter = event.submitter || undefined; 7306 if (form && submissionDoesNotDismissDialog(form, submitter) && submissionDoesNotTargetIFrame(form, submitter) && this.delegate.willSubmitForm(form, submitter)) { 7307 event.preventDefault(); 7308 event.stopImmediatePropagation(); 7309 this.delegate.formSubmitted(form, submitter); 7310 } 7311 } 7312 }; 7313 this.delegate = delegate; 7314 this.eventTarget = eventTarget; 7315 } 7316 start() { 7317 if (!this.started) { 7318 this.eventTarget.addEventListener("submit", this.submitCaptured, true); 7319 this.started = true; 7320 } 7321 } 7322 stop() { 7323 if (this.started) { 7324 this.eventTarget.removeEventListener("submit", this.submitCaptured, true); 7325 this.started = false; 7326 } 7327 } 7328} 7329function submissionDoesNotDismissDialog(form, submitter) { 7330 const method = (submitter === null || submitter === undefined ? undefined : submitter.getAttribute("formmethod")) || form.getAttribute("method"); 7331 return method != "dialog"; 7332} 7333function submissionDoesNotTargetIFrame(form, submitter) { 7334 if ((submitter === null || submitter === undefined ? undefined : submitter.hasAttribute("formtarget")) || form.hasAttribute("target")) { 7335 const target = (submitter === null || submitter === undefined ? undefined : submitter.getAttribute("formtarget")) || form.target; 7336 for (const element of document.getElementsByName(target)) { 7337 if (element instanceof HTMLIFrameElement) 7338 return false; 7339 } 7340 return true; 7341 } else { 7342 return true; 7343 } 7344} 7345 7346class View { 7347 constructor(delegate, element) { 7348 this.resolveRenderPromise = (_value) => {}; 7349 this.resolveInterceptionPromise = (_value) => {}; 7350 this.delegate = delegate; 7351 this.element = element; 7352 } 7353 scrollToAnchor(anchor) { 7354 const element = this.snapshot.getElementForAnchor(anchor); 7355 if (element) { 7356 this.scrollToElement(element); 7357 this.focusElement(element); 7358 } else { 7359 this.scrollToPosition({ x: 0, y: 0 }); 7360 } 7361 } 7362 scrollToAnchorFromLocation(location2) { 7363 this.scrollToAnchor(getAnchor(location2)); 7364 } 7365 scrollToElement(element) { 7366 element.scrollIntoView(); 7367 } 7368 focusElement(element) { 7369 if (element instanceof HTMLElement) { 7370 if (element.hasAttribute("tabindex")) { 7371 element.focus(); 7372 } else { 7373 element.setAttribute("tabindex", "-1"); 7374 element.focus(); 7375 element.removeAttribute("tabindex"); 7376 } 7377 } 7378 } 7379 scrollToPosition({ x, y }) { 7380 this.scrollRoot.scrollTo(x, y); 7381 } 7382 scrollToTop() { 7383 this.scrollToPosition({ x: 0, y: 0 }); 7384 } 7385 get scrollRoot() { 7386 return window; 7387 } 7388 async render(renderer) { 7389 const { isPreview, shouldRender, newSnapshot: snapshot } = renderer; 7390 if (shouldRender) { 7391 try { 7392 this.renderPromise = new Promise((resolve) => this.resolveRenderPromise = resolve); 7393 this.renderer = renderer; 7394 await this.prepareToRenderSnapshot(renderer); 7395 const renderInterception = new Promise((resolve) => this.resolveInterceptionPromise = resolve); 7396 const options = { resume: this.resolveInterceptionPromise, render: this.renderer.renderElement }; 7397 const immediateRender = this.delegate.allowsImmediateRender(snapshot, options); 7398 if (!immediateRender) 7399 await renderInterception; 7400 await this.renderSnapshot(renderer); 7401 this.delegate.viewRenderedSnapshot(snapshot, isPreview); 7402 this.delegate.preloadOnLoadLinksForView(this.element); 7403 this.finishRenderingSnapshot(renderer); 7404 } finally { 7405 delete this.renderer; 7406 this.resolveRenderPromise(undefined); 7407 delete this.renderPromise; 7408 } 7409 } else { 7410 this.invalidate(renderer.reloadReason); 7411 } 7412 } 7413 invalidate(reason) { 7414 this.delegate.viewInvalidated(reason); 7415 } 7416 async prepareToRenderSnapshot(renderer) { 7417 this.markAsPreview(renderer.isPreview); 7418 await renderer.prepareToRender(); 7419 } 7420 markAsPreview(isPreview) { 7421 if (isPreview) { 7422 this.element.setAttribute("data-turbo-preview", ""); 7423 } else { 7424 this.element.removeAttribute("data-turbo-preview"); 7425 } 7426 } 7427 async renderSnapshot(renderer) { 7428 await renderer.render(); 7429 } 7430 finishRenderingSnapshot(renderer) { 7431 renderer.finishRendering(); 7432 } 7433} 7434 7435class FrameView extends View { 7436 missing() { 7437 this.element.innerHTML = `<strong class="turbo-frame-error">Content missing</strong>`; 7438 } 7439 get snapshot() { 7440 return new Snapshot(this.element); 7441 } 7442} 7443 7444class LinkInterceptor { 7445 constructor(delegate, element) { 7446 this.clickBubbled = (event) => { 7447 if (this.respondsToEventTarget(event.target)) { 7448 this.clickEvent = event; 7449 } else { 7450 delete this.clickEvent; 7451 } 7452 }; 7453 this.linkClicked = (event) => { 7454 if (this.clickEvent && this.respondsToEventTarget(event.target) && event.target instanceof Element) { 7455 if (this.delegate.shouldInterceptLinkClick(event.target, event.detail.url, event.detail.originalEvent)) { 7456 this.clickEvent.preventDefault(); 7457 event.preventDefault(); 7458 this.delegate.linkClickIntercepted(event.target, event.detail.url, event.detail.originalEvent); 7459 } 7460 } 7461 delete this.clickEvent; 7462 }; 7463 this.willVisit = (_event) => { 7464 delete this.clickEvent; 7465 }; 7466 this.delegate = delegate; 7467 this.element = element; 7468 } 7469 start() { 7470 this.element.addEventListener("click", this.clickBubbled); 7471 document.addEventListener("turbo:click", this.linkClicked); 7472 document.addEventListener("turbo:before-visit", this.willVisit); 7473 } 7474 stop() { 7475 this.element.removeEventListener("click", this.clickBubbled); 7476 document.removeEventListener("turbo:click", this.linkClicked); 7477 document.removeEventListener("turbo:before-visit", this.willVisit); 7478 } 7479 respondsToEventTarget(target) { 7480 const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null; 7481 return element && element.closest("turbo-frame, html") == this.element; 7482 } 7483} 7484 7485class LinkClickObserver { 7486 constructor(delegate, eventTarget) { 7487 this.started = false; 7488 this.clickCaptured = () => { 7489 this.eventTarget.removeEventListener("click", this.clickBubbled, false); 7490 this.eventTarget.addEventListener("click", this.clickBubbled, false); 7491 }; 7492 this.clickBubbled = (event) => { 7493 if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) { 7494 const target = event.composedPath && event.composedPath()[0] || event.target; 7495 const link = this.findLinkFromClickTarget(target); 7496 if (link && doesNotTargetIFrame(link)) { 7497 const location2 = this.getLocationForLink(link); 7498 if (this.delegate.willFollowLinkToLocation(link, location2, event)) { 7499 event.preventDefault(); 7500 this.delegate.followedLinkToLocation(link, location2); 7501 } 7502 } 7503 } 7504 }; 7505 this.delegate = delegate; 7506 this.eventTarget = eventTarget; 7507 } 7508 start() { 7509 if (!this.started) { 7510 this.eventTarget.addEventListener("click", this.clickCaptured, true); 7511 this.started = true; 7512 } 7513 } 7514 stop() { 7515 if (this.started) { 7516 this.eventTarget.removeEventListener("click", this.clickCaptured, true); 7517 this.started = false; 7518 } 7519 } 7520 clickEventIsSignificant(event) { 7521 return !(event.target && event.target.isContentEditable || event.defaultPrevented || event.which > 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey); 7522 } 7523 findLinkFromClickTarget(target) { 7524 return findClosestRecursively(target, "a[href]:not([target^=_]):not([download])"); 7525 } 7526 getLocationForLink(link) { 7527 return expandURL(link.getAttribute("href") || ""); 7528 } 7529} 7530function doesNotTargetIFrame(anchor) { 7531 if (anchor.hasAttribute("target")) { 7532 for (const element of document.getElementsByName(anchor.target)) { 7533 if (element instanceof HTMLIFrameElement) 7534 return false; 7535 } 7536 return true; 7537 } else { 7538 return true; 7539 } 7540} 7541 7542class FormLinkClickObserver { 7543 constructor(delegate, element) { 7544 this.delegate = delegate; 7545 this.linkInterceptor = new LinkClickObserver(this, element); 7546 } 7547 start() { 7548 this.linkInterceptor.start(); 7549 } 7550 stop() { 7551 this.linkInterceptor.stop(); 7552 } 7553 willFollowLinkToLocation(link, location2, originalEvent) { 7554 return this.delegate.willSubmitFormLinkToLocation(link, location2, originalEvent) && link.hasAttribute("data-turbo-method"); 7555 } 7556 followedLinkToLocation(link, location2) { 7557 const form = document.createElement("form"); 7558 const type = "hidden"; 7559 for (const [name, value] of location2.searchParams) { 7560 form.append(Object.assign(document.createElement("input"), { type, name, value })); 7561 } 7562 const action = Object.assign(location2, { search: "" }); 7563 form.setAttribute("data-turbo", "true"); 7564 form.setAttribute("action", action.href); 7565 form.setAttribute("hidden", ""); 7566 const method = link.getAttribute("data-turbo-method"); 7567 if (method) 7568 form.setAttribute("method", method); 7569 const turboFrame = link.getAttribute("data-turbo-frame"); 7570 if (turboFrame) 7571 form.setAttribute("data-turbo-frame", turboFrame); 7572 const turboAction = getVisitAction(link); 7573 if (turboAction) 7574 form.setAttribute("data-turbo-action", turboAction); 7575 const turboConfirm = link.getAttribute("data-turbo-confirm"); 7576 if (turboConfirm) 7577 form.setAttribute("data-turbo-confirm", turboConfirm); 7578 const turboStream = link.hasAttribute("data-turbo-stream"); 7579 if (turboStream) 7580 form.setAttribute("data-turbo-stream", ""); 7581 this.delegate.submittedFormLinkToLocation(link, location2, form); 7582 document.body.appendChild(form); 7583 form.addEventListener("turbo:submit-end", () => form.remove(), { once: true }); 7584 requestAnimationFrame(() => form.requestSubmit()); 7585 } 7586} 7587 7588class Bardo { 7589 static async preservingPermanentElements(delegate, permanentElementMap, callback) { 7590 const bardo = new this(delegate, permanentElementMap); 7591 bardo.enter(); 7592 await callback(); 7593 bardo.leave(); 7594 } 7595 constructor(delegate, permanentElementMap) { 7596 this.delegate = delegate; 7597 this.permanentElementMap = permanentElementMap; 7598 } 7599 enter() { 7600 for (const id in this.permanentElementMap) { 7601 const [currentPermanentElement, newPermanentElement] = this.permanentElementMap[id]; 7602 this.delegate.enteringBardo(currentPermanentElement, newPermanentElement); 7603 this.replaceNewPermanentElementWithPlaceholder(newPermanentElement); 7604 } 7605 } 7606 leave() { 7607 for (const id in this.permanentElementMap) { 7608 const [currentPermanentElement] = this.permanentElementMap[id]; 7609 this.replaceCurrentPermanentElementWithClone(currentPermanentElement); 7610 this.replacePlaceholderWithPermanentElement(currentPermanentElement); 7611 this.delegate.leavingBardo(currentPermanentElement); 7612 } 7613 } 7614 replaceNewPermanentElementWithPlaceholder(permanentElement) { 7615 const placeholder = createPlaceholderForPermanentElement(permanentElement); 7616 permanentElement.replaceWith(placeholder); 7617 } 7618 replaceCurrentPermanentElementWithClone(permanentElement) { 7619 const clone = permanentElement.cloneNode(true); 7620 permanentElement.replaceWith(clone); 7621 } 7622 replacePlaceholderWithPermanentElement(permanentElement) { 7623 const placeholder = this.getPlaceholderById(permanentElement.id); 7624 placeholder === null || placeholder === undefined || placeholder.replaceWith(permanentElement); 7625 } 7626 getPlaceholderById(id) { 7627 return this.placeholders.find((element) => element.content == id); 7628 } 7629 get placeholders() { 7630 return [...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]; 7631 } 7632} 7633function createPlaceholderForPermanentElement(permanentElement) { 7634 const element = document.createElement("meta"); 7635 element.setAttribute("name", "turbo-permanent-placeholder"); 7636 element.setAttribute("content", permanentElement.id); 7637 return element; 7638} 7639 7640class Renderer { 7641 constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { 7642 this.activeElement = null; 7643 this.currentSnapshot = currentSnapshot; 7644 this.newSnapshot = newSnapshot; 7645 this.isPreview = isPreview; 7646 this.willRender = willRender; 7647 this.renderElement = renderElement; 7648 this.promise = new Promise((resolve, reject) => this.resolvingFunctions = { resolve, reject }); 7649 } 7650 get shouldRender() { 7651 return true; 7652 } 7653 get reloadReason() { 7654 return; 7655 } 7656 prepareToRender() { 7657 return; 7658 } 7659 finishRendering() { 7660 if (this.resolvingFunctions) { 7661 this.resolvingFunctions.resolve(); 7662 delete this.resolvingFunctions; 7663 } 7664 } 7665 async preservingPermanentElements(callback) { 7666 await Bardo.preservingPermanentElements(this, this.permanentElementMap, callback); 7667 } 7668 focusFirstAutofocusableElement() { 7669 const element = this.connectedSnapshot.firstAutofocusableElement; 7670 if (elementIsFocusable(element)) { 7671 element.focus(); 7672 } 7673 } 7674 enteringBardo(currentPermanentElement) { 7675 if (this.activeElement) 7676 return; 7677 if (currentPermanentElement.contains(this.currentSnapshot.activeElement)) { 7678 this.activeElement = this.currentSnapshot.activeElement; 7679 } 7680 } 7681 leavingBardo(currentPermanentElement) { 7682 if (currentPermanentElement.contains(this.activeElement) && this.activeElement instanceof HTMLElement) { 7683 this.activeElement.focus(); 7684 this.activeElement = null; 7685 } 7686 } 7687 get connectedSnapshot() { 7688 return this.newSnapshot.isConnected ? this.newSnapshot : this.currentSnapshot; 7689 } 7690 get currentElement() { 7691 return this.currentSnapshot.element; 7692 } 7693 get newElement() { 7694 return this.newSnapshot.element; 7695 } 7696 get permanentElementMap() { 7697 return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot); 7698 } 7699} 7700function elementIsFocusable(element) { 7701 return element && typeof element.focus == "function"; 7702} 7703 7704class FrameRenderer extends Renderer { 7705 static renderElement(currentElement, newElement) { 7706 var _a; 7707 const destinationRange = document.createRange(); 7708 destinationRange.selectNodeContents(currentElement); 7709 destinationRange.deleteContents(); 7710 const frameElement = newElement; 7711 const sourceRange = (_a = frameElement.ownerDocument) === null || _a === undefined ? undefined : _a.createRange(); 7712 if (sourceRange) { 7713 sourceRange.selectNodeContents(frameElement); 7714 currentElement.appendChild(sourceRange.extractContents()); 7715 } 7716 } 7717 constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { 7718 super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender); 7719 this.delegate = delegate; 7720 } 7721 get shouldRender() { 7722 return true; 7723 } 7724 async render() { 7725 await nextAnimationFrame(); 7726 this.preservingPermanentElements(() => { 7727 this.loadFrameElement(); 7728 }); 7729 this.scrollFrameIntoView(); 7730 await nextAnimationFrame(); 7731 this.focusFirstAutofocusableElement(); 7732 await nextAnimationFrame(); 7733 this.activateScriptElements(); 7734 } 7735 loadFrameElement() { 7736 this.delegate.willRenderFrame(this.currentElement, this.newElement); 7737 this.renderElement(this.currentElement, this.newElement); 7738 } 7739 scrollFrameIntoView() { 7740 if (this.currentElement.autoscroll || this.newElement.autoscroll) { 7741 const element = this.currentElement.firstElementChild; 7742 const block = readScrollLogicalPosition(this.currentElement.getAttribute("data-autoscroll-block"), "end"); 7743 const behavior = readScrollBehavior(this.currentElement.getAttribute("data-autoscroll-behavior"), "auto"); 7744 if (element) { 7745 element.scrollIntoView({ block, behavior }); 7746 return true; 7747 } 7748 } 7749 return false; 7750 } 7751 activateScriptElements() { 7752 for (const inertScriptElement of this.newScriptElements) { 7753 const activatedScriptElement = activateScriptElement(inertScriptElement); 7754 inertScriptElement.replaceWith(activatedScriptElement); 7755 } 7756 } 7757 get newScriptElements() { 7758 return this.currentElement.querySelectorAll("script"); 7759 } 7760} 7761function readScrollLogicalPosition(value, defaultValue) { 7762 if (value == "end" || value == "start" || value == "center" || value == "nearest") { 7763 return value; 7764 } else { 7765 return defaultValue; 7766 } 7767} 7768function readScrollBehavior(value, defaultValue) { 7769 if (value == "auto" || value == "smooth") { 7770 return value; 7771 } else { 7772 return defaultValue; 7773 } 7774} 7775 7776class ProgressBar { 7777 static get defaultCSS() { 7778 return unindent` 7779 .turbo-progress-bar { 7780 position: fixed; 7781 display: block; 7782 top: 0; 7783 left: 0; 7784 height: 3px; 7785 background: #0076ff; 7786 z-index: 2147483647; 7787 transition: 7788 width ${ProgressBar.animationDuration}ms ease-out, 7789 opacity ${ProgressBar.animationDuration / 2}ms ${ProgressBar.animationDuration / 2}ms ease-in; 7790 transform: translate3d(0, 0, 0); 7791 } 7792 `; 7793 } 7794 constructor() { 7795 this.hiding = false; 7796 this.value = 0; 7797 this.visible = false; 7798 this.trickle = () => { 7799 this.setValue(this.value + Math.random() / 100); 7800 }; 7801 this.stylesheetElement = this.createStylesheetElement(); 7802 this.progressElement = this.createProgressElement(); 7803 this.installStylesheetElement(); 7804 this.setValue(0); 7805 } 7806 show() { 7807 if (!this.visible) { 7808 this.visible = true; 7809 this.installProgressElement(); 7810 this.startTrickling(); 7811 } 7812 } 7813 hide() { 7814 if (this.visible && !this.hiding) { 7815 this.hiding = true; 7816 this.fadeProgressElement(() => { 7817 this.uninstallProgressElement(); 7818 this.stopTrickling(); 7819 this.visible = false; 7820 this.hiding = false; 7821 }); 7822 } 7823 } 7824 setValue(value) { 7825 this.value = value; 7826 this.refresh(); 7827 } 7828 installStylesheetElement() { 7829 document.head.insertBefore(this.stylesheetElement, document.head.firstChild); 7830 } 7831 installProgressElement() { 7832 this.progressElement.style.width = "0"; 7833 this.progressElement.style.opacity = "1"; 7834 document.documentElement.insertBefore(this.progressElement, document.body); 7835 this.refresh(); 7836 } 7837 fadeProgressElement(callback) { 7838 this.progressElement.style.opacity = "0"; 7839 setTimeout(callback, ProgressBar.animationDuration * 1.5); 7840 } 7841 uninstallProgressElement() { 7842 if (this.progressElement.parentNode) { 7843 document.documentElement.removeChild(this.progressElement); 7844 } 7845 } 7846 startTrickling() { 7847 if (!this.trickleInterval) { 7848 this.trickleInterval = window.setInterval(this.trickle, ProgressBar.animationDuration); 7849 } 7850 } 7851 stopTrickling() { 7852 window.clearInterval(this.trickleInterval); 7853 delete this.trickleInterval; 7854 } 7855 refresh() { 7856 requestAnimationFrame(() => { 7857 this.progressElement.style.width = `${10 + this.value * 90}%`; 7858 }); 7859 } 7860 createStylesheetElement() { 7861 const element = document.createElement("style"); 7862 element.type = "text/css"; 7863 element.textContent = ProgressBar.defaultCSS; 7864 if (this.cspNonce) { 7865 element.nonce = this.cspNonce; 7866 } 7867 return element; 7868 } 7869 createProgressElement() { 7870 const element = document.createElement("div"); 7871 element.className = "turbo-progress-bar"; 7872 return element; 7873 } 7874 get cspNonce() { 7875 return getMetaContent("csp-nonce"); 7876 } 7877} 7878ProgressBar.animationDuration = 300; 7879 7880class HeadSnapshot extends Snapshot { 7881 constructor() { 7882 super(...arguments); 7883 this.detailsByOuterHTML = this.children.filter((element) => !elementIsNoscript(element)).map((element) => elementWithoutNonce(element)).reduce((result, element) => { 7884 const { outerHTML } = element; 7885 const details = outerHTML in result ? result[outerHTML] : { 7886 type: elementType(element), 7887 tracked: elementIsTracked(element), 7888 elements: [] 7889 }; 7890 return Object.assign(Object.assign({}, result), { [outerHTML]: Object.assign(Object.assign({}, details), { elements: [...details.elements, element] }) }); 7891 }, {}); 7892 } 7893 get trackedElementSignature() { 7894 return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked).join(""); 7895 } 7896 getScriptElementsNotInSnapshot(snapshot) { 7897 return this.getElementsMatchingTypeNotInSnapshot("script", snapshot); 7898 } 7899 getStylesheetElementsNotInSnapshot(snapshot) { 7900 return this.getElementsMatchingTypeNotInSnapshot("stylesheet", snapshot); 7901 } 7902 getElementsMatchingTypeNotInSnapshot(matchedType, snapshot) { 7903 return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => !(outerHTML in snapshot.detailsByOuterHTML)).map((outerHTML) => this.detailsByOuterHTML[outerHTML]).filter(({ type }) => type == matchedType).map(({ elements: [element] }) => element); 7904 } 7905 get provisionalElements() { 7906 return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { 7907 const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML]; 7908 if (type == null && !tracked) { 7909 return [...result, ...elements]; 7910 } else if (elements.length > 1) { 7911 return [...result, ...elements.slice(1)]; 7912 } else { 7913 return result; 7914 } 7915 }, []); 7916 } 7917 getMetaValue(name) { 7918 const element = this.findMetaElementByName(name); 7919 return element ? element.getAttribute("content") : null; 7920 } 7921 findMetaElementByName(name) { 7922 return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { 7923 const { elements: [element] } = this.detailsByOuterHTML[outerHTML]; 7924 return elementIsMetaElementWithName(element, name) ? element : result; 7925 }, undefined); 7926 } 7927} 7928function elementType(element) { 7929 if (elementIsScript(element)) { 7930 return "script"; 7931 } else if (elementIsStylesheet(element)) { 7932 return "stylesheet"; 7933 } 7934} 7935function elementIsTracked(element) { 7936 return element.getAttribute("data-turbo-track") == "reload"; 7937} 7938function elementIsScript(element) { 7939 const tagName = element.localName; 7940 return tagName == "script"; 7941} 7942function elementIsNoscript(element) { 7943 const tagName = element.localName; 7944 return tagName == "noscript"; 7945} 7946function elementIsStylesheet(element) { 7947 const tagName = element.localName; 7948 return tagName == "style" || tagName == "link" && element.getAttribute("rel") == "stylesheet"; 7949} 7950function elementIsMetaElementWithName(element, name) { 7951 const tagName = element.localName; 7952 return tagName == "meta" && element.getAttribute("name") == name; 7953} 7954function elementWithoutNonce(element) { 7955 if (element.hasAttribute("nonce")) { 7956 element.setAttribute("nonce", ""); 7957 } 7958 return element; 7959} 7960 7961class PageSnapshot extends Snapshot { 7962 static fromHTMLString(html = "") { 7963 return this.fromDocument(parseHTMLDocument(html)); 7964 } 7965 static fromElement(element) { 7966 return this.fromDocument(element.ownerDocument); 7967 } 7968 static fromDocument({ head, body }) { 7969 return new this(body, new HeadSnapshot(head)); 7970 } 7971 constructor(element, headSnapshot) { 7972 super(element); 7973 this.headSnapshot = headSnapshot; 7974 } 7975 clone() { 7976 const clonedElement = this.element.cloneNode(true); 7977 const selectElements = this.element.querySelectorAll("select"); 7978 const clonedSelectElements = clonedElement.querySelectorAll("select"); 7979 for (const [index, source] of selectElements.entries()) { 7980 const clone = clonedSelectElements[index]; 7981 for (const option of clone.selectedOptions) 7982 option.selected = false; 7983 for (const option of source.selectedOptions) 7984 clone.options[option.index].selected = true; 7985 } 7986 for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type="password"]')) { 7987 clonedPasswordInput.value = ""; 7988 } 7989 return new PageSnapshot(clonedElement, this.headSnapshot); 7990 } 7991 get headElement() { 7992 return this.headSnapshot.element; 7993 } 7994 get rootLocation() { 7995 var _a; 7996 const root = (_a = this.getSetting("root")) !== null && _a !== undefined ? _a : "/"; 7997 return expandURL(root); 7998 } 7999 get cacheControlValue() { 8000 return this.getSetting("cache-control"); 8001 } 8002 get isPreviewable() { 8003 return this.cacheControlValue != "no-preview"; 8004 } 8005 get isCacheable() { 8006 return this.cacheControlValue != "no-cache"; 8007 } 8008 get isVisitable() { 8009 return this.getSetting("visit-control") != "reload"; 8010 } 8011 getSetting(name) { 8012 return this.headSnapshot.getMetaValue(`turbo-${name}`); 8013 } 8014} 8015var TimingMetric; 8016(function(TimingMetric2) { 8017 TimingMetric2["visitStart"] = "visitStart"; 8018 TimingMetric2["requestStart"] = "requestStart"; 8019 TimingMetric2["requestEnd"] = "requestEnd"; 8020 TimingMetric2["visitEnd"] = "visitEnd"; 8021})(TimingMetric || (TimingMetric = {})); 8022var VisitState; 8023(function(VisitState2) { 8024 VisitState2["initialized"] = "initialized"; 8025 VisitState2["started"] = "started"; 8026 VisitState2["canceled"] = "canceled"; 8027 VisitState2["failed"] = "failed"; 8028 VisitState2["completed"] = "completed"; 8029})(VisitState || (VisitState = {})); 8030var defaultOptions = { 8031 action: "advance", 8032 historyChanged: false, 8033 visitCachedSnapshot: () => {}, 8034 willRender: true, 8035 updateHistory: true, 8036 shouldCacheSnapshot: true, 8037 acceptsStreamResponse: false 8038}; 8039var SystemStatusCode; 8040(function(SystemStatusCode2) { 8041 SystemStatusCode2[SystemStatusCode2["networkFailure"] = 0] = "networkFailure"; 8042 SystemStatusCode2[SystemStatusCode2["timeoutFailure"] = -1] = "timeoutFailure"; 8043 SystemStatusCode2[SystemStatusCode2["contentTypeMismatch"] = -2] = "contentTypeMismatch"; 8044})(SystemStatusCode || (SystemStatusCode = {})); 8045 8046class Visit { 8047 constructor(delegate, location2, restorationIdentifier, options = {}) { 8048 this.identifier = uuid(); 8049 this.timingMetrics = {}; 8050 this.followedRedirect = false; 8051 this.historyChanged = false; 8052 this.scrolled = false; 8053 this.shouldCacheSnapshot = true; 8054 this.acceptsStreamResponse = false; 8055 this.snapshotCached = false; 8056 this.state = VisitState.initialized; 8057 this.delegate = delegate; 8058 this.location = location2; 8059 this.restorationIdentifier = restorationIdentifier || uuid(); 8060 const { action, historyChanged, referrer, snapshot, snapshotHTML, response, visitCachedSnapshot, willRender, updateHistory, shouldCacheSnapshot, acceptsStreamResponse } = Object.assign(Object.assign({}, defaultOptions), options); 8061 this.action = action; 8062 this.historyChanged = historyChanged; 8063 this.referrer = referrer; 8064 this.snapshot = snapshot; 8065 this.snapshotHTML = snapshotHTML; 8066 this.response = response; 8067 this.isSamePage = this.delegate.locationWithActionIsSamePage(this.location, this.action); 8068 this.visitCachedSnapshot = visitCachedSnapshot; 8069 this.willRender = willRender; 8070 this.updateHistory = updateHistory; 8071 this.scrolled = !willRender; 8072 this.shouldCacheSnapshot = shouldCacheSnapshot; 8073 this.acceptsStreamResponse = acceptsStreamResponse; 8074 } 8075 get adapter() { 8076 return this.delegate.adapter; 8077 } 8078 get view() { 8079 return this.delegate.view; 8080 } 8081 get history() { 8082 return this.delegate.history; 8083 } 8084 get restorationData() { 8085 return this.history.getRestorationDataForIdentifier(this.restorationIdentifier); 8086 } 8087 get silent() { 8088 return this.isSamePage; 8089 } 8090 start() { 8091 if (this.state == VisitState.initialized) { 8092 this.recordTimingMetric(TimingMetric.visitStart); 8093 this.state = VisitState.started; 8094 this.adapter.visitStarted(this); 8095 this.delegate.visitStarted(this); 8096 } 8097 } 8098 cancel() { 8099 if (this.state == VisitState.started) { 8100 if (this.request) { 8101 this.request.cancel(); 8102 } 8103 this.cancelRender(); 8104 this.state = VisitState.canceled; 8105 } 8106 } 8107 complete() { 8108 if (this.state == VisitState.started) { 8109 this.recordTimingMetric(TimingMetric.visitEnd); 8110 this.state = VisitState.completed; 8111 this.followRedirect(); 8112 if (!this.followedRedirect) { 8113 this.adapter.visitCompleted(this); 8114 this.delegate.visitCompleted(this); 8115 } 8116 } 8117 } 8118 fail() { 8119 if (this.state == VisitState.started) { 8120 this.state = VisitState.failed; 8121 this.adapter.visitFailed(this); 8122 } 8123 } 8124 changeHistory() { 8125 var _a; 8126 if (!this.historyChanged && this.updateHistory) { 8127 const actionForHistory = this.location.href === ((_a = this.referrer) === null || _a === undefined ? undefined : _a.href) ? "replace" : this.action; 8128 const method = getHistoryMethodForAction(actionForHistory); 8129 this.history.update(method, this.location, this.restorationIdentifier); 8130 this.historyChanged = true; 8131 } 8132 } 8133 issueRequest() { 8134 if (this.hasPreloadedResponse()) { 8135 this.simulateRequest(); 8136 } else if (this.shouldIssueRequest() && !this.request) { 8137 this.request = new FetchRequest(this, FetchMethod.get, this.location); 8138 this.request.perform(); 8139 } 8140 } 8141 simulateRequest() { 8142 if (this.response) { 8143 this.startRequest(); 8144 this.recordResponse(); 8145 this.finishRequest(); 8146 } 8147 } 8148 startRequest() { 8149 this.recordTimingMetric(TimingMetric.requestStart); 8150 this.adapter.visitRequestStarted(this); 8151 } 8152 recordResponse(response = this.response) { 8153 this.response = response; 8154 if (response) { 8155 const { statusCode } = response; 8156 if (isSuccessful(statusCode)) { 8157 this.adapter.visitRequestCompleted(this); 8158 } else { 8159 this.adapter.visitRequestFailedWithStatusCode(this, statusCode); 8160 } 8161 } 8162 } 8163 finishRequest() { 8164 this.recordTimingMetric(TimingMetric.requestEnd); 8165 this.adapter.visitRequestFinished(this); 8166 } 8167 loadResponse() { 8168 if (this.response) { 8169 const { statusCode, responseHTML } = this.response; 8170 this.render(async () => { 8171 if (this.shouldCacheSnapshot) 8172 this.cacheSnapshot(); 8173 if (this.view.renderPromise) 8174 await this.view.renderPromise; 8175 if (isSuccessful(statusCode) && responseHTML != null) { 8176 await this.view.renderPage(PageSnapshot.fromHTMLString(responseHTML), false, this.willRender, this); 8177 this.performScroll(); 8178 this.adapter.visitRendered(this); 8179 this.complete(); 8180 } else { 8181 await this.view.renderError(PageSnapshot.fromHTMLString(responseHTML), this); 8182 this.adapter.visitRendered(this); 8183 this.fail(); 8184 } 8185 }); 8186 } 8187 } 8188 getCachedSnapshot() { 8189 const snapshot = this.view.getCachedSnapshotForLocation(this.location) || this.getPreloadedSnapshot(); 8190 if (snapshot && (!getAnchor(this.location) || snapshot.hasAnchor(getAnchor(this.location)))) { 8191 if (this.action == "restore" || snapshot.isPreviewable) { 8192 return snapshot; 8193 } 8194 } 8195 } 8196 getPreloadedSnapshot() { 8197 if (this.snapshotHTML) { 8198 return PageSnapshot.fromHTMLString(this.snapshotHTML); 8199 } 8200 } 8201 hasCachedSnapshot() { 8202 return this.getCachedSnapshot() != null; 8203 } 8204 loadCachedSnapshot() { 8205 const snapshot = this.getCachedSnapshot(); 8206 if (snapshot) { 8207 const isPreview = this.shouldIssueRequest(); 8208 this.render(async () => { 8209 this.cacheSnapshot(); 8210 if (this.isSamePage) { 8211 this.adapter.visitRendered(this); 8212 } else { 8213 if (this.view.renderPromise) 8214 await this.view.renderPromise; 8215 await this.view.renderPage(snapshot, isPreview, this.willRender, this); 8216 this.performScroll(); 8217 this.adapter.visitRendered(this); 8218 if (!isPreview) { 8219 this.complete(); 8220 } 8221 } 8222 }); 8223 } 8224 } 8225 followRedirect() { 8226 var _a; 8227 if (this.redirectedToLocation && !this.followedRedirect && ((_a = this.response) === null || _a === undefined ? undefined : _a.redirected)) { 8228 this.adapter.visitProposedToLocation(this.redirectedToLocation, { 8229 action: "replace", 8230 response: this.response, 8231 shouldCacheSnapshot: false, 8232 willRender: false 8233 }); 8234 this.followedRedirect = true; 8235 } 8236 } 8237 goToSamePageAnchor() { 8238 if (this.isSamePage) { 8239 this.render(async () => { 8240 this.cacheSnapshot(); 8241 this.performScroll(); 8242 this.changeHistory(); 8243 this.adapter.visitRendered(this); 8244 }); 8245 } 8246 } 8247 prepareRequest(request) { 8248 if (this.acceptsStreamResponse) { 8249 request.acceptResponseType(StreamMessage.contentType); 8250 } 8251 } 8252 requestStarted() { 8253 this.startRequest(); 8254 } 8255 requestPreventedHandlingResponse(_request, _response) {} 8256 async requestSucceededWithResponse(request, response) { 8257 const responseHTML = await response.responseHTML; 8258 const { redirected, statusCode } = response; 8259 if (responseHTML == undefined) { 8260 this.recordResponse({ 8261 statusCode: SystemStatusCode.contentTypeMismatch, 8262 redirected 8263 }); 8264 } else { 8265 this.redirectedToLocation = response.redirected ? response.location : undefined; 8266 this.recordResponse({ statusCode, responseHTML, redirected }); 8267 } 8268 } 8269 async requestFailedWithResponse(request, response) { 8270 const responseHTML = await response.responseHTML; 8271 const { redirected, statusCode } = response; 8272 if (responseHTML == undefined) { 8273 this.recordResponse({ 8274 statusCode: SystemStatusCode.contentTypeMismatch, 8275 redirected 8276 }); 8277 } else { 8278 this.recordResponse({ statusCode, responseHTML, redirected }); 8279 } 8280 } 8281 requestErrored(_request, _error) { 8282 this.recordResponse({ 8283 statusCode: SystemStatusCode.networkFailure, 8284 redirected: false 8285 }); 8286 } 8287 requestFinished() { 8288 this.finishRequest(); 8289 } 8290 performScroll() { 8291 if (!this.scrolled && !this.view.forceReloaded) { 8292 if (this.action == "restore") { 8293 this.scrollToRestoredPosition() || this.scrollToAnchor() || this.view.scrollToTop(); 8294 } else { 8295 this.scrollToAnchor() || this.view.scrollToTop(); 8296 } 8297 if (this.isSamePage) { 8298 this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation, this.location); 8299 } 8300 this.scrolled = true; 8301 } 8302 } 8303 scrollToRestoredPosition() { 8304 const { scrollPosition } = this.restorationData; 8305 if (scrollPosition) { 8306 this.view.scrollToPosition(scrollPosition); 8307 return true; 8308 } 8309 } 8310 scrollToAnchor() { 8311 const anchor = getAnchor(this.location); 8312 if (anchor != null) { 8313 this.view.scrollToAnchor(anchor); 8314 return true; 8315 } 8316 } 8317 recordTimingMetric(metric) { 8318 this.timingMetrics[metric] = new Date().getTime(); 8319 } 8320 getTimingMetrics() { 8321 return Object.assign({}, this.timingMetrics); 8322 } 8323 getHistoryMethodForAction(action) { 8324 switch (action) { 8325 case "replace": 8326 return history.replaceState; 8327 case "advance": 8328 case "restore": 8329 return history.pushState; 8330 } 8331 } 8332 hasPreloadedResponse() { 8333 return typeof this.response == "object"; 8334 } 8335 shouldIssueRequest() { 8336 if (this.isSamePage) { 8337 return false; 8338 } else if (this.action == "restore") { 8339 return !this.hasCachedSnapshot(); 8340 } else { 8341 return this.willRender; 8342 } 8343 } 8344 cacheSnapshot() { 8345 if (!this.snapshotCached) { 8346 this.view.cacheSnapshot(this.snapshot).then((snapshot) => snapshot && this.visitCachedSnapshot(snapshot)); 8347 this.snapshotCached = true; 8348 } 8349 } 8350 async render(callback) { 8351 this.cancelRender(); 8352 await new Promise((resolve) => { 8353 this.frame = requestAnimationFrame(() => resolve()); 8354 }); 8355 await callback(); 8356 delete this.frame; 8357 } 8358 cancelRender() { 8359 if (this.frame) { 8360 cancelAnimationFrame(this.frame); 8361 delete this.frame; 8362 } 8363 } 8364} 8365function isSuccessful(statusCode) { 8366 return statusCode >= 200 && statusCode < 300; 8367} 8368 8369class BrowserAdapter { 8370 constructor(session) { 8371 this.progressBar = new ProgressBar; 8372 this.showProgressBar = () => { 8373 this.progressBar.show(); 8374 }; 8375 this.session = session; 8376 } 8377 visitProposedToLocation(location2, options) { 8378 this.navigator.startVisit(location2, (options === null || options === undefined ? undefined : options.restorationIdentifier) || uuid(), options); 8379 } 8380 visitStarted(visit) { 8381 this.location = visit.location; 8382 visit.loadCachedSnapshot(); 8383 visit.issueRequest(); 8384 visit.goToSamePageAnchor(); 8385 } 8386 visitRequestStarted(visit) { 8387 this.progressBar.setValue(0); 8388 if (visit.hasCachedSnapshot() || visit.action != "restore") { 8389 this.showVisitProgressBarAfterDelay(); 8390 } else { 8391 this.showProgressBar(); 8392 } 8393 } 8394 visitRequestCompleted(visit) { 8395 visit.loadResponse(); 8396 } 8397 visitRequestFailedWithStatusCode(visit, statusCode) { 8398 switch (statusCode) { 8399 case SystemStatusCode.networkFailure: 8400 case SystemStatusCode.timeoutFailure: 8401 case SystemStatusCode.contentTypeMismatch: 8402 return this.reload({ 8403 reason: "request_failed", 8404 context: { 8405 statusCode 8406 } 8407 }); 8408 default: 8409 return visit.loadResponse(); 8410 } 8411 } 8412 visitRequestFinished(_visit) { 8413 this.progressBar.setValue(1); 8414 this.hideVisitProgressBar(); 8415 } 8416 visitCompleted(_visit) {} 8417 pageInvalidated(reason) { 8418 this.reload(reason); 8419 } 8420 visitFailed(_visit) {} 8421 visitRendered(_visit) {} 8422 formSubmissionStarted(_formSubmission) { 8423 this.progressBar.setValue(0); 8424 this.showFormProgressBarAfterDelay(); 8425 } 8426 formSubmissionFinished(_formSubmission) { 8427 this.progressBar.setValue(1); 8428 this.hideFormProgressBar(); 8429 } 8430 showVisitProgressBarAfterDelay() { 8431 this.visitProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); 8432 } 8433 hideVisitProgressBar() { 8434 this.progressBar.hide(); 8435 if (this.visitProgressBarTimeout != null) { 8436 window.clearTimeout(this.visitProgressBarTimeout); 8437 delete this.visitProgressBarTimeout; 8438 } 8439 } 8440 showFormProgressBarAfterDelay() { 8441 if (this.formProgressBarTimeout == null) { 8442 this.formProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); 8443 } 8444 } 8445 hideFormProgressBar() { 8446 this.progressBar.hide(); 8447 if (this.formProgressBarTimeout != null) { 8448 window.clearTimeout(this.formProgressBarTimeout); 8449 delete this.formProgressBarTimeout; 8450 } 8451 } 8452 reload(reason) { 8453 var _a; 8454 dispatch("turbo:reload", { detail: reason }); 8455 window.location.href = ((_a = this.location) === null || _a === undefined ? undefined : _a.toString()) || window.location.href; 8456 } 8457 get navigator() { 8458 return this.session.navigator; 8459 } 8460} 8461 8462class CacheObserver { 8463 constructor() { 8464 this.selector = "[data-turbo-temporary]"; 8465 this.deprecatedSelector = "[data-turbo-cache=false]"; 8466 this.started = false; 8467 this.removeTemporaryElements = (_event) => { 8468 for (const element of this.temporaryElements) { 8469 element.remove(); 8470 } 8471 }; 8472 } 8473 start() { 8474 if (!this.started) { 8475 this.started = true; 8476 addEventListener("turbo:before-cache", this.removeTemporaryElements, false); 8477 } 8478 } 8479 stop() { 8480 if (this.started) { 8481 this.started = false; 8482 removeEventListener("turbo:before-cache", this.removeTemporaryElements, false); 8483 } 8484 } 8485 get temporaryElements() { 8486 return [...document.querySelectorAll(this.selector), ...this.temporaryElementsWithDeprecation]; 8487 } 8488 get temporaryElementsWithDeprecation() { 8489 const elements = document.querySelectorAll(this.deprecatedSelector); 8490 if (elements.length) { 8491 console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`); 8492 } 8493 return [...elements]; 8494 } 8495} 8496 8497class FrameRedirector { 8498 constructor(session, element) { 8499 this.session = session; 8500 this.element = element; 8501 this.linkInterceptor = new LinkInterceptor(this, element); 8502 this.formSubmitObserver = new FormSubmitObserver(this, element); 8503 } 8504 start() { 8505 this.linkInterceptor.start(); 8506 this.formSubmitObserver.start(); 8507 } 8508 stop() { 8509 this.linkInterceptor.stop(); 8510 this.formSubmitObserver.stop(); 8511 } 8512 shouldInterceptLinkClick(element, _location, _event) { 8513 return this.shouldRedirect(element); 8514 } 8515 linkClickIntercepted(element, url, event) { 8516 const frame = this.findFrameElement(element); 8517 if (frame) { 8518 frame.delegate.linkClickIntercepted(element, url, event); 8519 } 8520 } 8521 willSubmitForm(element, submitter) { 8522 return element.closest("turbo-frame") == null && this.shouldSubmit(element, submitter) && this.shouldRedirect(element, submitter); 8523 } 8524 formSubmitted(element, submitter) { 8525 const frame = this.findFrameElement(element, submitter); 8526 if (frame) { 8527 frame.delegate.formSubmitted(element, submitter); 8528 } 8529 } 8530 shouldSubmit(form, submitter) { 8531 var _a; 8532 const action = getAction(form, submitter); 8533 const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); 8534 const rootLocation = expandURL((_a = meta === null || meta === undefined ? undefined : meta.content) !== null && _a !== undefined ? _a : "/"); 8535 return this.shouldRedirect(form, submitter) && locationIsVisitable(action, rootLocation); 8536 } 8537 shouldRedirect(element, submitter) { 8538 const isNavigatable = element instanceof HTMLFormElement ? this.session.submissionIsNavigatable(element, submitter) : this.session.elementIsNavigatable(element); 8539 if (isNavigatable) { 8540 const frame = this.findFrameElement(element, submitter); 8541 return frame ? frame != element.closest("turbo-frame") : false; 8542 } else { 8543 return false; 8544 } 8545 } 8546 findFrameElement(element, submitter) { 8547 const id = (submitter === null || submitter === undefined ? undefined : submitter.getAttribute("data-turbo-frame")) || element.getAttribute("data-turbo-frame"); 8548 if (id && id != "_top") { 8549 const frame = this.element.querySelector(`#${id}:not([disabled])`); 8550 if (frame instanceof FrameElement) { 8551 return frame; 8552 } 8553 } 8554 } 8555} 8556 8557class History { 8558 constructor(delegate) { 8559 this.restorationIdentifier = uuid(); 8560 this.restorationData = {}; 8561 this.started = false; 8562 this.pageLoaded = false; 8563 this.onPopState = (event) => { 8564 if (this.shouldHandlePopState()) { 8565 const { turbo } = event.state || {}; 8566 if (turbo) { 8567 this.location = new URL(window.location.href); 8568 const { restorationIdentifier } = turbo; 8569 this.restorationIdentifier = restorationIdentifier; 8570 this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location, restorationIdentifier); 8571 } 8572 } 8573 }; 8574 this.onPageLoad = async (_event) => { 8575 await nextMicrotask(); 8576 this.pageLoaded = true; 8577 }; 8578 this.delegate = delegate; 8579 } 8580 start() { 8581 if (!this.started) { 8582 addEventListener("popstate", this.onPopState, false); 8583 addEventListener("load", this.onPageLoad, false); 8584 this.started = true; 8585 this.replace(new URL(window.location.href)); 8586 } 8587 } 8588 stop() { 8589 if (this.started) { 8590 removeEventListener("popstate", this.onPopState, false); 8591 removeEventListener("load", this.onPageLoad, false); 8592 this.started = false; 8593 } 8594 } 8595 push(location2, restorationIdentifier) { 8596 this.update(history.pushState, location2, restorationIdentifier); 8597 } 8598 replace(location2, restorationIdentifier) { 8599 this.update(history.replaceState, location2, restorationIdentifier); 8600 } 8601 update(method, location2, restorationIdentifier = uuid()) { 8602 const state = { turbo: { restorationIdentifier } }; 8603 method.call(history, state, "", location2.href); 8604 this.location = location2; 8605 this.restorationIdentifier = restorationIdentifier; 8606 } 8607 getRestorationDataForIdentifier(restorationIdentifier) { 8608 return this.restorationData[restorationIdentifier] || {}; 8609 } 8610 updateRestorationData(additionalData) { 8611 const { restorationIdentifier } = this; 8612 const restorationData = this.restorationData[restorationIdentifier]; 8613 this.restorationData[restorationIdentifier] = Object.assign(Object.assign({}, restorationData), additionalData); 8614 } 8615 assumeControlOfScrollRestoration() { 8616 var _a; 8617 if (!this.previousScrollRestoration) { 8618 this.previousScrollRestoration = (_a = history.scrollRestoration) !== null && _a !== undefined ? _a : "auto"; 8619 history.scrollRestoration = "manual"; 8620 } 8621 } 8622 relinquishControlOfScrollRestoration() { 8623 if (this.previousScrollRestoration) { 8624 history.scrollRestoration = this.previousScrollRestoration; 8625 delete this.previousScrollRestoration; 8626 } 8627 } 8628 shouldHandlePopState() { 8629 return this.pageIsLoaded(); 8630 } 8631 pageIsLoaded() { 8632 return this.pageLoaded || document.readyState == "complete"; 8633 } 8634} 8635 8636class Navigator { 8637 constructor(delegate) { 8638 this.delegate = delegate; 8639 } 8640 proposeVisit(location2, options = {}) { 8641 if (this.delegate.allowsVisitingLocationWithAction(location2, options.action)) { 8642 if (locationIsVisitable(location2, this.view.snapshot.rootLocation)) { 8643 this.delegate.visitProposedToLocation(location2, options); 8644 } else { 8645 window.location.href = location2.toString(); 8646 } 8647 } 8648 } 8649 startVisit(locatable, restorationIdentifier, options = {}) { 8650 this.stop(); 8651 this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, Object.assign({ referrer: this.location }, options)); 8652 this.currentVisit.start(); 8653 } 8654 submitForm(form, submitter) { 8655 this.stop(); 8656 this.formSubmission = new FormSubmission(this, form, submitter, true); 8657 this.formSubmission.start(); 8658 } 8659 stop() { 8660 if (this.formSubmission) { 8661 this.formSubmission.stop(); 8662 delete this.formSubmission; 8663 } 8664 if (this.currentVisit) { 8665 this.currentVisit.cancel(); 8666 delete this.currentVisit; 8667 } 8668 } 8669 get adapter() { 8670 return this.delegate.adapter; 8671 } 8672 get view() { 8673 return this.delegate.view; 8674 } 8675 get history() { 8676 return this.delegate.history; 8677 } 8678 formSubmissionStarted(formSubmission) { 8679 if (typeof this.adapter.formSubmissionStarted === "function") { 8680 this.adapter.formSubmissionStarted(formSubmission); 8681 } 8682 } 8683 async formSubmissionSucceededWithResponse(formSubmission, fetchResponse) { 8684 if (formSubmission == this.formSubmission) { 8685 const responseHTML = await fetchResponse.responseHTML; 8686 if (responseHTML) { 8687 const shouldCacheSnapshot = formSubmission.isSafe; 8688 if (!shouldCacheSnapshot) { 8689 this.view.clearSnapshotCache(); 8690 } 8691 const { statusCode, redirected } = fetchResponse; 8692 const action = this.getActionForFormSubmission(formSubmission); 8693 const visitOptions = { 8694 action, 8695 shouldCacheSnapshot, 8696 response: { statusCode, responseHTML, redirected } 8697 }; 8698 this.proposeVisit(fetchResponse.location, visitOptions); 8699 } 8700 } 8701 } 8702 async formSubmissionFailedWithResponse(formSubmission, fetchResponse) { 8703 const responseHTML = await fetchResponse.responseHTML; 8704 if (responseHTML) { 8705 const snapshot = PageSnapshot.fromHTMLString(responseHTML); 8706 if (fetchResponse.serverError) { 8707 await this.view.renderError(snapshot, this.currentVisit); 8708 } else { 8709 await this.view.renderPage(snapshot, false, true, this.currentVisit); 8710 } 8711 this.view.scrollToTop(); 8712 this.view.clearSnapshotCache(); 8713 } 8714 } 8715 formSubmissionErrored(formSubmission, error) { 8716 console.error(error); 8717 } 8718 formSubmissionFinished(formSubmission) { 8719 if (typeof this.adapter.formSubmissionFinished === "function") { 8720 this.adapter.formSubmissionFinished(formSubmission); 8721 } 8722 } 8723 visitStarted(visit) { 8724 this.delegate.visitStarted(visit); 8725 } 8726 visitCompleted(visit) { 8727 this.delegate.visitCompleted(visit); 8728 } 8729 locationWithActionIsSamePage(location2, action) { 8730 const anchor = getAnchor(location2); 8731 const currentAnchor = getAnchor(this.view.lastRenderedLocation); 8732 const isRestorationToTop = action === "restore" && typeof anchor === "undefined"; 8733 return action !== "replace" && getRequestURL(location2) === getRequestURL(this.view.lastRenderedLocation) && (isRestorationToTop || anchor != null && anchor !== currentAnchor); 8734 } 8735 visitScrolledToSamePageLocation(oldURL, newURL) { 8736 this.delegate.visitScrolledToSamePageLocation(oldURL, newURL); 8737 } 8738 get location() { 8739 return this.history.location; 8740 } 8741 get restorationIdentifier() { 8742 return this.history.restorationIdentifier; 8743 } 8744 getActionForFormSubmission({ submitter, formElement }) { 8745 return getVisitAction(submitter, formElement) || "advance"; 8746 } 8747} 8748var PageStage; 8749(function(PageStage2) { 8750 PageStage2[PageStage2["initial"] = 0] = "initial"; 8751 PageStage2[PageStage2["loading"] = 1] = "loading"; 8752 PageStage2[PageStage2["interactive"] = 2] = "interactive"; 8753 PageStage2[PageStage2["complete"] = 3] = "complete"; 8754})(PageStage || (PageStage = {})); 8755 8756class PageObserver { 8757 constructor(delegate) { 8758 this.stage = PageStage.initial; 8759 this.started = false; 8760 this.interpretReadyState = () => { 8761 const { readyState } = this; 8762 if (readyState == "interactive") { 8763 this.pageIsInteractive(); 8764 } else if (readyState == "complete") { 8765 this.pageIsComplete(); 8766 } 8767 }; 8768 this.pageWillUnload = () => { 8769 this.delegate.pageWillUnload(); 8770 }; 8771 this.delegate = delegate; 8772 } 8773 start() { 8774 if (!this.started) { 8775 if (this.stage == PageStage.initial) { 8776 this.stage = PageStage.loading; 8777 } 8778 document.addEventListener("readystatechange", this.interpretReadyState, false); 8779 addEventListener("pagehide", this.pageWillUnload, false); 8780 this.started = true; 8781 } 8782 } 8783 stop() { 8784 if (this.started) { 8785 document.removeEventListener("readystatechange", this.interpretReadyState, false); 8786 removeEventListener("pagehide", this.pageWillUnload, false); 8787 this.started = false; 8788 } 8789 } 8790 pageIsInteractive() { 8791 if (this.stage == PageStage.loading) { 8792 this.stage = PageStage.interactive; 8793 this.delegate.pageBecameInteractive(); 8794 } 8795 } 8796 pageIsComplete() { 8797 this.pageIsInteractive(); 8798 if (this.stage == PageStage.interactive) { 8799 this.stage = PageStage.complete; 8800 this.delegate.pageLoaded(); 8801 } 8802 } 8803 get readyState() { 8804 return document.readyState; 8805 } 8806} 8807 8808class ScrollObserver { 8809 constructor(delegate) { 8810 this.started = false; 8811 this.onScroll = () => { 8812 this.updatePosition({ x: window.pageXOffset, y: window.pageYOffset }); 8813 }; 8814 this.delegate = delegate; 8815 } 8816 start() { 8817 if (!this.started) { 8818 addEventListener("scroll", this.onScroll, false); 8819 this.onScroll(); 8820 this.started = true; 8821 } 8822 } 8823 stop() { 8824 if (this.started) { 8825 removeEventListener("scroll", this.onScroll, false); 8826 this.started = false; 8827 } 8828 } 8829 updatePosition(position) { 8830 this.delegate.scrollPositionChanged(position); 8831 } 8832} 8833 8834class StreamMessageRenderer { 8835 render({ fragment }) { 8836 Bardo.preservingPermanentElements(this, getPermanentElementMapForFragment(fragment), () => document.documentElement.appendChild(fragment)); 8837 } 8838 enteringBardo(currentPermanentElement, newPermanentElement) { 8839 newPermanentElement.replaceWith(currentPermanentElement.cloneNode(true)); 8840 } 8841 leavingBardo() {} 8842} 8843function getPermanentElementMapForFragment(fragment) { 8844 const permanentElementsInDocument = queryPermanentElementsAll(document.documentElement); 8845 const permanentElementMap = {}; 8846 for (const permanentElementInDocument of permanentElementsInDocument) { 8847 const { id } = permanentElementInDocument; 8848 for (const streamElement of fragment.querySelectorAll("turbo-stream")) { 8849 const elementInStream = getPermanentElementById(streamElement.templateElement.content, id); 8850 if (elementInStream) { 8851 permanentElementMap[id] = [permanentElementInDocument, elementInStream]; 8852 } 8853 } 8854 } 8855 return permanentElementMap; 8856} 8857 8858class StreamObserver { 8859 constructor(delegate) { 8860 this.sources = new Set; 8861 this.started = false; 8862 this.inspectFetchResponse = (event) => { 8863 const response = fetchResponseFromEvent(event); 8864 if (response && fetchResponseIsStream(response)) { 8865 event.preventDefault(); 8866 this.receiveMessageResponse(response); 8867 } 8868 }; 8869 this.receiveMessageEvent = (event) => { 8870 if (this.started && typeof event.data == "string") { 8871 this.receiveMessageHTML(event.data); 8872 } 8873 }; 8874 this.delegate = delegate; 8875 } 8876 start() { 8877 if (!this.started) { 8878 this.started = true; 8879 addEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); 8880 } 8881 } 8882 stop() { 8883 if (this.started) { 8884 this.started = false; 8885 removeEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); 8886 } 8887 } 8888 connectStreamSource(source) { 8889 if (!this.streamSourceIsConnected(source)) { 8890 this.sources.add(source); 8891 source.addEventListener("message", this.receiveMessageEvent, false); 8892 } 8893 } 8894 disconnectStreamSource(source) { 8895 if (this.streamSourceIsConnected(source)) { 8896 this.sources.delete(source); 8897 source.removeEventListener("message", this.receiveMessageEvent, false); 8898 } 8899 } 8900 streamSourceIsConnected(source) { 8901 return this.sources.has(source); 8902 } 8903 async receiveMessageResponse(response) { 8904 const html = await response.responseHTML; 8905 if (html) { 8906 this.receiveMessageHTML(html); 8907 } 8908 } 8909 receiveMessageHTML(html) { 8910 this.delegate.receivedMessageFromStream(StreamMessage.wrap(html)); 8911 } 8912} 8913function fetchResponseFromEvent(event) { 8914 var _a; 8915 const fetchResponse = (_a = event.detail) === null || _a === undefined ? undefined : _a.fetchResponse; 8916 if (fetchResponse instanceof FetchResponse) { 8917 return fetchResponse; 8918 } 8919} 8920function fetchResponseIsStream(response) { 8921 var _a; 8922 const contentType = (_a = response.contentType) !== null && _a !== undefined ? _a : ""; 8923 return contentType.startsWith(StreamMessage.contentType); 8924} 8925 8926class ErrorRenderer extends Renderer { 8927 static renderElement(currentElement, newElement) { 8928 const { documentElement, body } = document; 8929 documentElement.replaceChild(newElement, body); 8930 } 8931 async render() { 8932 this.replaceHeadAndBody(); 8933 this.activateScriptElements(); 8934 } 8935 replaceHeadAndBody() { 8936 const { documentElement, head } = document; 8937 documentElement.replaceChild(this.newHead, head); 8938 this.renderElement(this.currentElement, this.newElement); 8939 } 8940 activateScriptElements() { 8941 for (const replaceableElement of this.scriptElements) { 8942 const parentNode = replaceableElement.parentNode; 8943 if (parentNode) { 8944 const element = activateScriptElement(replaceableElement); 8945 parentNode.replaceChild(element, replaceableElement); 8946 } 8947 } 8948 } 8949 get newHead() { 8950 return this.newSnapshot.headSnapshot.element; 8951 } 8952 get scriptElements() { 8953 return document.documentElement.querySelectorAll("script"); 8954 } 8955} 8956 8957class PageRenderer extends Renderer { 8958 static renderElement(currentElement, newElement) { 8959 if (document.body && newElement instanceof HTMLBodyElement) { 8960 document.body.replaceWith(newElement); 8961 } else { 8962 document.documentElement.appendChild(newElement); 8963 } 8964 } 8965 get shouldRender() { 8966 return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical; 8967 } 8968 get reloadReason() { 8969 if (!this.newSnapshot.isVisitable) { 8970 return { 8971 reason: "turbo_visit_control_is_reload" 8972 }; 8973 } 8974 if (!this.trackedElementsAreIdentical) { 8975 return { 8976 reason: "tracked_element_mismatch" 8977 }; 8978 } 8979 } 8980 async prepareToRender() { 8981 await this.mergeHead(); 8982 } 8983 async render() { 8984 if (this.willRender) { 8985 await this.replaceBody(); 8986 } 8987 } 8988 finishRendering() { 8989 super.finishRendering(); 8990 if (!this.isPreview) { 8991 this.focusFirstAutofocusableElement(); 8992 } 8993 } 8994 get currentHeadSnapshot() { 8995 return this.currentSnapshot.headSnapshot; 8996 } 8997 get newHeadSnapshot() { 8998 return this.newSnapshot.headSnapshot; 8999 } 9000 get newElement() { 9001 return this.newSnapshot.element; 9002 } 9003 async mergeHead() { 9004 const mergedHeadElements = this.mergeProvisionalElements(); 9005 const newStylesheetElements = this.copyNewHeadStylesheetElements(); 9006 this.copyNewHeadScriptElements(); 9007 await mergedHeadElements; 9008 await newStylesheetElements; 9009 } 9010 async replaceBody() { 9011 await this.preservingPermanentElements(async () => { 9012 this.activateNewBody(); 9013 await this.assignNewBody(); 9014 }); 9015 } 9016 get trackedElementsAreIdentical() { 9017 return this.currentHeadSnapshot.trackedElementSignature == this.newHeadSnapshot.trackedElementSignature; 9018 } 9019 async copyNewHeadStylesheetElements() { 9020 const loadingElements = []; 9021 for (const element of this.newHeadStylesheetElements) { 9022 loadingElements.push(waitForLoad(element)); 9023 document.head.appendChild(element); 9024 } 9025 await Promise.all(loadingElements); 9026 } 9027 copyNewHeadScriptElements() { 9028 for (const element of this.newHeadScriptElements) { 9029 document.head.appendChild(activateScriptElement(element)); 9030 } 9031 } 9032 async mergeProvisionalElements() { 9033 const newHeadElements = [...this.newHeadProvisionalElements]; 9034 for (const element of this.currentHeadProvisionalElements) { 9035 if (!this.isCurrentElementInElementList(element, newHeadElements)) { 9036 document.head.removeChild(element); 9037 } 9038 } 9039 for (const element of newHeadElements) { 9040 document.head.appendChild(element); 9041 } 9042 } 9043 isCurrentElementInElementList(element, elementList) { 9044 for (const [index, newElement] of elementList.entries()) { 9045 if (element.tagName == "TITLE") { 9046 if (newElement.tagName != "TITLE") { 9047 continue; 9048 } 9049 if (element.innerHTML == newElement.innerHTML) { 9050 elementList.splice(index, 1); 9051 return true; 9052 } 9053 } 9054 if (newElement.isEqualNode(element)) { 9055 elementList.splice(index, 1); 9056 return true; 9057 } 9058 } 9059 return false; 9060 } 9061 removeCurrentHeadProvisionalElements() { 9062 for (const element of this.currentHeadProvisionalElements) { 9063 document.head.removeChild(element); 9064 } 9065 } 9066 copyNewHeadProvisionalElements() { 9067 for (const element of this.newHeadProvisionalElements) { 9068 document.head.appendChild(element); 9069 } 9070 } 9071 activateNewBody() { 9072 document.adoptNode(this.newElement); 9073 this.activateNewBodyScriptElements(); 9074 } 9075 activateNewBodyScriptElements() { 9076 for (const inertScriptElement of this.newBodyScriptElements) { 9077 const activatedScriptElement = activateScriptElement(inertScriptElement); 9078 inertScriptElement.replaceWith(activatedScriptElement); 9079 } 9080 } 9081 async assignNewBody() { 9082 await this.renderElement(this.currentElement, this.newElement); 9083 } 9084 get newHeadStylesheetElements() { 9085 return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot); 9086 } 9087 get newHeadScriptElements() { 9088 return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot); 9089 } 9090 get currentHeadProvisionalElements() { 9091 return this.currentHeadSnapshot.provisionalElements; 9092 } 9093 get newHeadProvisionalElements() { 9094 return this.newHeadSnapshot.provisionalElements; 9095 } 9096 get newBodyScriptElements() { 9097 return this.newElement.querySelectorAll("script"); 9098 } 9099} 9100 9101class SnapshotCache { 9102 constructor(size) { 9103 this.keys = []; 9104 this.snapshots = {}; 9105 this.size = size; 9106 } 9107 has(location2) { 9108 return toCacheKey(location2) in this.snapshots; 9109 } 9110 get(location2) { 9111 if (this.has(location2)) { 9112 const snapshot = this.read(location2); 9113 this.touch(location2); 9114 return snapshot; 9115 } 9116 } 9117 put(location2, snapshot) { 9118 this.write(location2, snapshot); 9119 this.touch(location2); 9120 return snapshot; 9121 } 9122 clear() { 9123 this.snapshots = {}; 9124 } 9125 read(location2) { 9126 return this.snapshots[toCacheKey(location2)]; 9127 } 9128 write(location2, snapshot) { 9129 this.snapshots[toCacheKey(location2)] = snapshot; 9130 } 9131 touch(location2) { 9132 const key = toCacheKey(location2); 9133 const index = this.keys.indexOf(key); 9134 if (index > -1) 9135 this.keys.splice(index, 1); 9136 this.keys.unshift(key); 9137 this.trim(); 9138 } 9139 trim() { 9140 for (const key of this.keys.splice(this.size)) { 9141 delete this.snapshots[key]; 9142 } 9143 } 9144} 9145 9146class PageView extends View { 9147 constructor() { 9148 super(...arguments); 9149 this.snapshotCache = new SnapshotCache(10); 9150 this.lastRenderedLocation = new URL(location.href); 9151 this.forceReloaded = false; 9152 } 9153 renderPage(snapshot, isPreview = false, willRender = true, visit) { 9154 const renderer = new PageRenderer(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender); 9155 if (!renderer.shouldRender) { 9156 this.forceReloaded = true; 9157 } else { 9158 visit === null || visit === undefined || visit.changeHistory(); 9159 } 9160 return this.render(renderer); 9161 } 9162 renderError(snapshot, visit) { 9163 visit === null || visit === undefined || visit.changeHistory(); 9164 const renderer = new ErrorRenderer(this.snapshot, snapshot, ErrorRenderer.renderElement, false); 9165 return this.render(renderer); 9166 } 9167 clearSnapshotCache() { 9168 this.snapshotCache.clear(); 9169 } 9170 async cacheSnapshot(snapshot = this.snapshot) { 9171 if (snapshot.isCacheable) { 9172 this.delegate.viewWillCacheSnapshot(); 9173 const { lastRenderedLocation: location2 } = this; 9174 await nextEventLoopTick(); 9175 const cachedSnapshot = snapshot.clone(); 9176 this.snapshotCache.put(location2, cachedSnapshot); 9177 return cachedSnapshot; 9178 } 9179 } 9180 getCachedSnapshotForLocation(location2) { 9181 return this.snapshotCache.get(location2); 9182 } 9183 get snapshot() { 9184 return PageSnapshot.fromElement(this.element); 9185 } 9186} 9187 9188class Preloader { 9189 constructor(delegate) { 9190 this.selector = "a[data-turbo-preload]"; 9191 this.delegate = delegate; 9192 } 9193 get snapshotCache() { 9194 return this.delegate.navigator.view.snapshotCache; 9195 } 9196 start() { 9197 if (document.readyState === "loading") { 9198 return document.addEventListener("DOMContentLoaded", () => { 9199 this.preloadOnLoadLinksForView(document.body); 9200 }); 9201 } else { 9202 this.preloadOnLoadLinksForView(document.body); 9203 } 9204 } 9205 preloadOnLoadLinksForView(element) { 9206 for (const link of element.querySelectorAll(this.selector)) { 9207 this.preloadURL(link); 9208 } 9209 } 9210 async preloadURL(link) { 9211 const location2 = new URL(link.href); 9212 if (this.snapshotCache.has(location2)) { 9213 return; 9214 } 9215 try { 9216 const response = await fetch(location2.toString(), { headers: { "VND.PREFETCH": "true", Accept: "text/html" } }); 9217 const responseText = await response.text(); 9218 const snapshot = PageSnapshot.fromHTMLString(responseText); 9219 this.snapshotCache.put(location2, snapshot); 9220 } catch (_) {} 9221 } 9222} 9223 9224class Session { 9225 constructor() { 9226 this.navigator = new Navigator(this); 9227 this.history = new History(this); 9228 this.preloader = new Preloader(this); 9229 this.view = new PageView(this, document.documentElement); 9230 this.adapter = new BrowserAdapter(this); 9231 this.pageObserver = new PageObserver(this); 9232 this.cacheObserver = new CacheObserver; 9233 this.linkClickObserver = new LinkClickObserver(this, window); 9234 this.formSubmitObserver = new FormSubmitObserver(this, document); 9235 this.scrollObserver = new ScrollObserver(this); 9236 this.streamObserver = new StreamObserver(this); 9237 this.formLinkClickObserver = new FormLinkClickObserver(this, document.documentElement); 9238 this.frameRedirector = new FrameRedirector(this, document.documentElement); 9239 this.streamMessageRenderer = new StreamMessageRenderer; 9240 this.drive = true; 9241 this.enabled = true; 9242 this.progressBarDelay = 500; 9243 this.started = false; 9244 this.formMode = "on"; 9245 } 9246 start() { 9247 if (!this.started) { 9248 this.pageObserver.start(); 9249 this.cacheObserver.start(); 9250 this.formLinkClickObserver.start(); 9251 this.linkClickObserver.start(); 9252 this.formSubmitObserver.start(); 9253 this.scrollObserver.start(); 9254 this.streamObserver.start(); 9255 this.frameRedirector.start(); 9256 this.history.start(); 9257 this.preloader.start(); 9258 this.started = true; 9259 this.enabled = true; 9260 } 9261 } 9262 disable() { 9263 this.enabled = false; 9264 } 9265 stop() { 9266 if (this.started) { 9267 this.pageObserver.stop(); 9268 this.cacheObserver.stop(); 9269 this.formLinkClickObserver.stop(); 9270 this.linkClickObserver.stop(); 9271 this.formSubmitObserver.stop(); 9272 this.scrollObserver.stop(); 9273 this.streamObserver.stop(); 9274 this.frameRedirector.stop(); 9275 this.history.stop(); 9276 this.started = false; 9277 } 9278 } 9279 registerAdapter(adapter) { 9280 this.adapter = adapter; 9281 } 9282 visit(location2, options = {}) { 9283 const frameElement = options.frame ? document.getElementById(options.frame) : null; 9284 if (frameElement instanceof FrameElement) { 9285 frameElement.src = location2.toString(); 9286 frameElement.loaded; 9287 } else { 9288 this.navigator.proposeVisit(expandURL(location2), options); 9289 } 9290 } 9291 connectStreamSource(source) { 9292 this.streamObserver.connectStreamSource(source); 9293 } 9294 disconnectStreamSource(source) { 9295 this.streamObserver.disconnectStreamSource(source); 9296 } 9297 renderStreamMessage(message) { 9298 this.streamMessageRenderer.render(StreamMessage.wrap(message)); 9299 } 9300 clearCache() { 9301 this.view.clearSnapshotCache(); 9302 } 9303 setProgressBarDelay(delay) { 9304 this.progressBarDelay = delay; 9305 } 9306 setFormMode(mode) { 9307 this.formMode = mode; 9308 } 9309 get location() { 9310 return this.history.location; 9311 } 9312 get restorationIdentifier() { 9313 return this.history.restorationIdentifier; 9314 } 9315 historyPoppedToLocationWithRestorationIdentifier(location2, restorationIdentifier) { 9316 if (this.enabled) { 9317 this.navigator.startVisit(location2, restorationIdentifier, { 9318 action: "restore", 9319 historyChanged: true 9320 }); 9321 } else { 9322 this.adapter.pageInvalidated({ 9323 reason: "turbo_disabled" 9324 }); 9325 } 9326 } 9327 scrollPositionChanged(position) { 9328 this.history.updateRestorationData({ scrollPosition: position }); 9329 } 9330 willSubmitFormLinkToLocation(link, location2) { 9331 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation); 9332 } 9333 submittedFormLinkToLocation() {} 9334 willFollowLinkToLocation(link, location2, event) { 9335 return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation) && this.applicationAllowsFollowingLinkToLocation(link, location2, event); 9336 } 9337 followedLinkToLocation(link, location2) { 9338 const action = this.getActionForLink(link); 9339 const acceptsStreamResponse = link.hasAttribute("data-turbo-stream"); 9340 this.visit(location2.href, { action, acceptsStreamResponse }); 9341 } 9342 allowsVisitingLocationWithAction(location2, action) { 9343 return this.locationWithActionIsSamePage(location2, action) || this.applicationAllowsVisitingLocation(location2); 9344 } 9345 visitProposedToLocation(location2, options) { 9346 extendURLWithDeprecatedProperties(location2); 9347 this.adapter.visitProposedToLocation(location2, options); 9348 } 9349 visitStarted(visit) { 9350 if (!visit.acceptsStreamResponse) { 9351 markAsBusy(document.documentElement); 9352 } 9353 extendURLWithDeprecatedProperties(visit.location); 9354 if (!visit.silent) { 9355 this.notifyApplicationAfterVisitingLocation(visit.location, visit.action); 9356 } 9357 } 9358 visitCompleted(visit) { 9359 clearBusyState(document.documentElement); 9360 this.notifyApplicationAfterPageLoad(visit.getTimingMetrics()); 9361 } 9362 locationWithActionIsSamePage(location2, action) { 9363 return this.navigator.locationWithActionIsSamePage(location2, action); 9364 } 9365 visitScrolledToSamePageLocation(oldURL, newURL) { 9366 this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL); 9367 } 9368 willSubmitForm(form, submitter) { 9369 const action = getAction(form, submitter); 9370 return this.submissionIsNavigatable(form, submitter) && locationIsVisitable(expandURL(action), this.snapshot.rootLocation); 9371 } 9372 formSubmitted(form, submitter) { 9373 this.navigator.submitForm(form, submitter); 9374 } 9375 pageBecameInteractive() { 9376 this.view.lastRenderedLocation = this.location; 9377 this.notifyApplicationAfterPageLoad(); 9378 } 9379 pageLoaded() { 9380 this.history.assumeControlOfScrollRestoration(); 9381 } 9382 pageWillUnload() { 9383 this.history.relinquishControlOfScrollRestoration(); 9384 } 9385 receivedMessageFromStream(message) { 9386 this.renderStreamMessage(message); 9387 } 9388 viewWillCacheSnapshot() { 9389 var _a; 9390 if (!((_a = this.navigator.currentVisit) === null || _a === undefined ? undefined : _a.silent)) { 9391 this.notifyApplicationBeforeCachingSnapshot(); 9392 } 9393 } 9394 allowsImmediateRender({ element }, options) { 9395 const event = this.notifyApplicationBeforeRender(element, options); 9396 const { defaultPrevented, detail: { render } } = event; 9397 if (this.view.renderer && render) { 9398 this.view.renderer.renderElement = render; 9399 } 9400 return !defaultPrevented; 9401 } 9402 viewRenderedSnapshot(_snapshot, _isPreview) { 9403 this.view.lastRenderedLocation = this.history.location; 9404 this.notifyApplicationAfterRender(); 9405 } 9406 preloadOnLoadLinksForView(element) { 9407 this.preloader.preloadOnLoadLinksForView(element); 9408 } 9409 viewInvalidated(reason) { 9410 this.adapter.pageInvalidated(reason); 9411 } 9412 frameLoaded(frame) { 9413 this.notifyApplicationAfterFrameLoad(frame); 9414 } 9415 frameRendered(fetchResponse, frame) { 9416 this.notifyApplicationAfterFrameRender(fetchResponse, frame); 9417 } 9418 applicationAllowsFollowingLinkToLocation(link, location2, ev) { 9419 const event = this.notifyApplicationAfterClickingLinkToLocation(link, location2, ev); 9420 return !event.defaultPrevented; 9421 } 9422 applicationAllowsVisitingLocation(location2) { 9423 const event = this.notifyApplicationBeforeVisitingLocation(location2); 9424 return !event.defaultPrevented; 9425 } 9426 notifyApplicationAfterClickingLinkToLocation(link, location2, event) { 9427 return dispatch("turbo:click", { 9428 target: link, 9429 detail: { url: location2.href, originalEvent: event }, 9430 cancelable: true 9431 }); 9432 } 9433 notifyApplicationBeforeVisitingLocation(location2) { 9434 return dispatch("turbo:before-visit", { 9435 detail: { url: location2.href }, 9436 cancelable: true 9437 }); 9438 } 9439 notifyApplicationAfterVisitingLocation(location2, action) { 9440 return dispatch("turbo:visit", { detail: { url: location2.href, action } }); 9441 } 9442 notifyApplicationBeforeCachingSnapshot() { 9443 return dispatch("turbo:before-cache"); 9444 } 9445 notifyApplicationBeforeRender(newBody, options) { 9446 return dispatch("turbo:before-render", { 9447 detail: Object.assign({ newBody }, options), 9448 cancelable: true 9449 }); 9450 } 9451 notifyApplicationAfterRender() { 9452 return dispatch("turbo:render"); 9453 } 9454 notifyApplicationAfterPageLoad(timing = {}) { 9455 return dispatch("turbo:load", { 9456 detail: { url: this.location.href, timing } 9457 }); 9458 } 9459 notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL) { 9460 dispatchEvent(new HashChangeEvent("hashchange", { 9461 oldURL: oldURL.toString(), 9462 newURL: newURL.toString() 9463 })); 9464 } 9465 notifyApplicationAfterFrameLoad(frame) { 9466 return dispatch("turbo:frame-load", { target: frame }); 9467 } 9468 notifyApplicationAfterFrameRender(fetchResponse, frame) { 9469 return dispatch("turbo:frame-render", { 9470 detail: { fetchResponse }, 9471 target: frame, 9472 cancelable: true 9473 }); 9474 } 9475 submissionIsNavigatable(form, submitter) { 9476 if (this.formMode == "off") { 9477 return false; 9478 } else { 9479 const submitterIsNavigatable = submitter ? this.elementIsNavigatable(submitter) : true; 9480 if (this.formMode == "optin") { 9481 return submitterIsNavigatable && form.closest('[data-turbo="true"]') != null; 9482 } else { 9483 return submitterIsNavigatable && this.elementIsNavigatable(form); 9484 } 9485 } 9486 } 9487 elementIsNavigatable(element) { 9488 const container = findClosestRecursively(element, "[data-turbo]"); 9489 const withinFrame = findClosestRecursively(element, "turbo-frame"); 9490 if (this.drive || withinFrame) { 9491 if (container) { 9492 return container.getAttribute("data-turbo") != "false"; 9493 } else { 9494 return true; 9495 } 9496 } else { 9497 if (container) { 9498 return container.getAttribute("data-turbo") == "true"; 9499 } else { 9500 return false; 9501 } 9502 } 9503 } 9504 getActionForLink(link) { 9505 return getVisitAction(link) || "advance"; 9506 } 9507 get snapshot() { 9508 return this.view.snapshot; 9509 } 9510} 9511function extendURLWithDeprecatedProperties(url) { 9512 Object.defineProperties(url, deprecatedLocationPropertyDescriptors); 9513} 9514var deprecatedLocationPropertyDescriptors = { 9515 absoluteURL: { 9516 get() { 9517 return this.toString(); 9518 } 9519 } 9520}; 9521 9522class Cache { 9523 constructor(session) { 9524 this.session = session; 9525 } 9526 clear() { 9527 this.session.clearCache(); 9528 } 9529 resetCacheControl() { 9530 this.setCacheControl(""); 9531 } 9532 exemptPageFromCache() { 9533 this.setCacheControl("no-cache"); 9534 } 9535 exemptPageFromPreview() { 9536 this.setCacheControl("no-preview"); 9537 } 9538 setCacheControl(value) { 9539 setMetaContent("turbo-cache-control", value); 9540 } 9541} 9542var StreamActions = { 9543 after() { 9544 this.targetElements.forEach((e) => { 9545 var _a; 9546 return (_a = e.parentElement) === null || _a === undefined ? undefined : _a.insertBefore(this.templateContent, e.nextSibling); 9547 }); 9548 }, 9549 append() { 9550 this.removeDuplicateTargetChildren(); 9551 this.targetElements.forEach((e) => e.append(this.templateContent)); 9552 }, 9553 before() { 9554 this.targetElements.forEach((e) => { 9555 var _a; 9556 return (_a = e.parentElement) === null || _a === undefined ? undefined : _a.insertBefore(this.templateContent, e); 9557 }); 9558 }, 9559 prepend() { 9560 this.removeDuplicateTargetChildren(); 9561 this.targetElements.forEach((e) => e.prepend(this.templateContent)); 9562 }, 9563 remove() { 9564 this.targetElements.forEach((e) => e.remove()); 9565 }, 9566 replace() { 9567 this.targetElements.forEach((e) => e.replaceWith(this.templateContent)); 9568 }, 9569 update() { 9570 this.targetElements.forEach((targetElement) => { 9571 targetElement.innerHTML = ""; 9572 targetElement.append(this.templateContent); 9573 }); 9574 } 9575}; 9576var session = new Session; 9577var cache = new Cache(session); 9578var { navigator: navigator$1 } = session; 9579function start() { 9580 session.start(); 9581} 9582function registerAdapter(adapter) { 9583 session.registerAdapter(adapter); 9584} 9585function visit(location2, options) { 9586 session.visit(location2, options); 9587} 9588function connectStreamSource(source) { 9589 session.connectStreamSource(source); 9590} 9591function disconnectStreamSource(source) { 9592 session.disconnectStreamSource(source); 9593} 9594function renderStreamMessage(message) { 9595 session.renderStreamMessage(message); 9596} 9597function clearCache() { 9598 console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"); 9599 session.clearCache(); 9600} 9601function setProgressBarDelay(delay) { 9602 session.setProgressBarDelay(delay); 9603} 9604function setConfirmMethod(confirmMethod) { 9605 FormSubmission.confirmMethod = confirmMethod; 9606} 9607function setFormMode(mode) { 9608 session.setFormMode(mode); 9609} 9610var Turbo = /* @__PURE__ */ Object.freeze({ 9611 __proto__: null, 9612 navigator: navigator$1, 9613 session, 9614 cache, 9615 PageRenderer, 9616 PageSnapshot, 9617 FrameRenderer, 9618 start, 9619 registerAdapter, 9620 visit, 9621 connectStreamSource, 9622 disconnectStreamSource, 9623 renderStreamMessage, 9624 clearCache, 9625 setProgressBarDelay, 9626 setConfirmMethod, 9627 setFormMode, 9628 StreamActions 9629}); 9630 9631class TurboFrameMissingError extends Error { 9632} 9633 9634class FrameController { 9635 constructor(element) { 9636 this.fetchResponseLoaded = (_fetchResponse) => {}; 9637 this.currentFetchRequest = null; 9638 this.resolveVisitPromise = () => {}; 9639 this.connected = false; 9640 this.hasBeenLoaded = false; 9641 this.ignoredAttributes = new Set; 9642 this.action = null; 9643 this.visitCachedSnapshot = ({ element: element2 }) => { 9644 const frame = element2.querySelector("#" + this.element.id); 9645 if (frame && this.previousFrameElement) { 9646 frame.replaceChildren(...this.previousFrameElement.children); 9647 } 9648 delete this.previousFrameElement; 9649 }; 9650 this.element = element; 9651 this.view = new FrameView(this, this.element); 9652 this.appearanceObserver = new AppearanceObserver(this, this.element); 9653 this.formLinkClickObserver = new FormLinkClickObserver(this, this.element); 9654 this.linkInterceptor = new LinkInterceptor(this, this.element); 9655 this.restorationIdentifier = uuid(); 9656 this.formSubmitObserver = new FormSubmitObserver(this, this.element); 9657 } 9658 connect() { 9659 if (!this.connected) { 9660 this.connected = true; 9661 if (this.loadingStyle == FrameLoadingStyle.lazy) { 9662 this.appearanceObserver.start(); 9663 } else { 9664 this.loadSourceURL(); 9665 } 9666 this.formLinkClickObserver.start(); 9667 this.linkInterceptor.start(); 9668 this.formSubmitObserver.start(); 9669 } 9670 } 9671 disconnect() { 9672 if (this.connected) { 9673 this.connected = false; 9674 this.appearanceObserver.stop(); 9675 this.formLinkClickObserver.stop(); 9676 this.linkInterceptor.stop(); 9677 this.formSubmitObserver.stop(); 9678 } 9679 } 9680 disabledChanged() { 9681 if (this.loadingStyle == FrameLoadingStyle.eager) { 9682 this.loadSourceURL(); 9683 } 9684 } 9685 sourceURLChanged() { 9686 if (this.isIgnoringChangesTo("src")) 9687 return; 9688 if (this.element.isConnected) { 9689 this.complete = false; 9690 } 9691 if (this.loadingStyle == FrameLoadingStyle.eager || this.hasBeenLoaded) { 9692 this.loadSourceURL(); 9693 } 9694 } 9695 sourceURLReloaded() { 9696 const { src } = this.element; 9697 this.ignoringChangesToAttribute("complete", () => { 9698 this.element.removeAttribute("complete"); 9699 }); 9700 this.element.src = null; 9701 this.element.src = src; 9702 return this.element.loaded; 9703 } 9704 completeChanged() { 9705 if (this.isIgnoringChangesTo("complete")) 9706 return; 9707 this.loadSourceURL(); 9708 } 9709 loadingStyleChanged() { 9710 if (this.loadingStyle == FrameLoadingStyle.lazy) { 9711 this.appearanceObserver.start(); 9712 } else { 9713 this.appearanceObserver.stop(); 9714 this.loadSourceURL(); 9715 } 9716 } 9717 async loadSourceURL() { 9718 if (this.enabled && this.isActive && !this.complete && this.sourceURL) { 9719 this.element.loaded = this.visit(expandURL(this.sourceURL)); 9720 this.appearanceObserver.stop(); 9721 await this.element.loaded; 9722 this.hasBeenLoaded = true; 9723 } 9724 } 9725 async loadResponse(fetchResponse) { 9726 if (fetchResponse.redirected || fetchResponse.succeeded && fetchResponse.isHTML) { 9727 this.sourceURL = fetchResponse.response.url; 9728 } 9729 try { 9730 const html = await fetchResponse.responseHTML; 9731 if (html) { 9732 const document2 = parseHTMLDocument(html); 9733 const pageSnapshot = PageSnapshot.fromDocument(document2); 9734 if (pageSnapshot.isVisitable) { 9735 await this.loadFrameResponse(fetchResponse, document2); 9736 } else { 9737 await this.handleUnvisitableFrameResponse(fetchResponse); 9738 } 9739 } 9740 } finally { 9741 this.fetchResponseLoaded = () => {}; 9742 } 9743 } 9744 elementAppearedInViewport(element) { 9745 this.proposeVisitIfNavigatedWithAction(element, element); 9746 this.loadSourceURL(); 9747 } 9748 willSubmitFormLinkToLocation(link) { 9749 return this.shouldInterceptNavigation(link); 9750 } 9751 submittedFormLinkToLocation(link, _location, form) { 9752 const frame = this.findFrameElement(link); 9753 if (frame) 9754 form.setAttribute("data-turbo-frame", frame.id); 9755 } 9756 shouldInterceptLinkClick(element, _location, _event) { 9757 return this.shouldInterceptNavigation(element); 9758 } 9759 linkClickIntercepted(element, location2) { 9760 this.navigateFrame(element, location2); 9761 } 9762 willSubmitForm(element, submitter) { 9763 return element.closest("turbo-frame") == this.element && this.shouldInterceptNavigation(element, submitter); 9764 } 9765 formSubmitted(element, submitter) { 9766 if (this.formSubmission) { 9767 this.formSubmission.stop(); 9768 } 9769 this.formSubmission = new FormSubmission(this, element, submitter); 9770 const { fetchRequest } = this.formSubmission; 9771 this.prepareRequest(fetchRequest); 9772 this.formSubmission.start(); 9773 } 9774 prepareRequest(request) { 9775 var _a; 9776 request.headers["Turbo-Frame"] = this.id; 9777 if ((_a = this.currentNavigationElement) === null || _a === undefined ? undefined : _a.hasAttribute("data-turbo-stream")) { 9778 request.acceptResponseType(StreamMessage.contentType); 9779 } 9780 } 9781 requestStarted(_request) { 9782 markAsBusy(this.element); 9783 } 9784 requestPreventedHandlingResponse(_request, _response) { 9785 this.resolveVisitPromise(); 9786 } 9787 async requestSucceededWithResponse(request, response) { 9788 await this.loadResponse(response); 9789 this.resolveVisitPromise(); 9790 } 9791 async requestFailedWithResponse(request, response) { 9792 await this.loadResponse(response); 9793 this.resolveVisitPromise(); 9794 } 9795 requestErrored(request, error) { 9796 console.error(error); 9797 this.resolveVisitPromise(); 9798 } 9799 requestFinished(_request) { 9800 clearBusyState(this.element); 9801 } 9802 formSubmissionStarted({ formElement }) { 9803 markAsBusy(formElement, this.findFrameElement(formElement)); 9804 } 9805 formSubmissionSucceededWithResponse(formSubmission, response) { 9806 const frame = this.findFrameElement(formSubmission.formElement, formSubmission.submitter); 9807 frame.delegate.proposeVisitIfNavigatedWithAction(frame, formSubmission.formElement, formSubmission.submitter); 9808 frame.delegate.loadResponse(response); 9809 if (!formSubmission.isSafe) { 9810 session.clearCache(); 9811 } 9812 } 9813 formSubmissionFailedWithResponse(formSubmission, fetchResponse) { 9814 this.element.delegate.loadResponse(fetchResponse); 9815 session.clearCache(); 9816 } 9817 formSubmissionErrored(formSubmission, error) { 9818 console.error(error); 9819 } 9820 formSubmissionFinished({ formElement }) { 9821 clearBusyState(formElement, this.findFrameElement(formElement)); 9822 } 9823 allowsImmediateRender({ element: newFrame }, options) { 9824 const event = dispatch("turbo:before-frame-render", { 9825 target: this.element, 9826 detail: Object.assign({ newFrame }, options), 9827 cancelable: true 9828 }); 9829 const { defaultPrevented, detail: { render } } = event; 9830 if (this.view.renderer && render) { 9831 this.view.renderer.renderElement = render; 9832 } 9833 return !defaultPrevented; 9834 } 9835 viewRenderedSnapshot(_snapshot, _isPreview) {} 9836 preloadOnLoadLinksForView(element) { 9837 session.preloadOnLoadLinksForView(element); 9838 } 9839 viewInvalidated() {} 9840 willRenderFrame(currentElement, _newElement) { 9841 this.previousFrameElement = currentElement.cloneNode(true); 9842 } 9843 async loadFrameResponse(fetchResponse, document2) { 9844 const newFrameElement = await this.extractForeignFrameElement(document2.body); 9845 if (newFrameElement) { 9846 const snapshot = new Snapshot(newFrameElement); 9847 const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false, false); 9848 if (this.view.renderPromise) 9849 await this.view.renderPromise; 9850 this.changeHistory(); 9851 await this.view.render(renderer); 9852 this.complete = true; 9853 session.frameRendered(fetchResponse, this.element); 9854 session.frameLoaded(this.element); 9855 this.fetchResponseLoaded(fetchResponse); 9856 } else if (this.willHandleFrameMissingFromResponse(fetchResponse)) { 9857 this.handleFrameMissingFromResponse(fetchResponse); 9858 } 9859 } 9860 async visit(url) { 9861 var _a; 9862 const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams, this.element); 9863 (_a = this.currentFetchRequest) === null || _a === undefined || _a.cancel(); 9864 this.currentFetchRequest = request; 9865 return new Promise((resolve) => { 9866 this.resolveVisitPromise = () => { 9867 this.resolveVisitPromise = () => {}; 9868 this.currentFetchRequest = null; 9869 resolve(); 9870 }; 9871 request.perform(); 9872 }); 9873 } 9874 navigateFrame(element, url, submitter) { 9875 const frame = this.findFrameElement(element, submitter); 9876 frame.delegate.proposeVisitIfNavigatedWithAction(frame, element, submitter); 9877 this.withCurrentNavigationElement(element, () => { 9878 frame.src = url; 9879 }); 9880 } 9881 proposeVisitIfNavigatedWithAction(frame, element, submitter) { 9882 this.action = getVisitAction(submitter, element, frame); 9883 if (this.action) { 9884 const pageSnapshot = PageSnapshot.fromElement(frame).clone(); 9885 const { visitCachedSnapshot } = frame.delegate; 9886 frame.delegate.fetchResponseLoaded = (fetchResponse) => { 9887 if (frame.src) { 9888 const { statusCode, redirected } = fetchResponse; 9889 const responseHTML = frame.ownerDocument.documentElement.outerHTML; 9890 const response = { statusCode, redirected, responseHTML }; 9891 const options = { 9892 response, 9893 visitCachedSnapshot, 9894 willRender: false, 9895 updateHistory: false, 9896 restorationIdentifier: this.restorationIdentifier, 9897 snapshot: pageSnapshot 9898 }; 9899 if (this.action) 9900 options.action = this.action; 9901 session.visit(frame.src, options); 9902 } 9903 }; 9904 } 9905 } 9906 changeHistory() { 9907 if (this.action) { 9908 const method = getHistoryMethodForAction(this.action); 9909 session.history.update(method, expandURL(this.element.src || ""), this.restorationIdentifier); 9910 } 9911 } 9912 async handleUnvisitableFrameResponse(fetchResponse) { 9913 console.warn(`The response (${fetchResponse.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`); 9914 await this.visitResponse(fetchResponse.response); 9915 } 9916 willHandleFrameMissingFromResponse(fetchResponse) { 9917 this.element.setAttribute("complete", ""); 9918 const response = fetchResponse.response; 9919 const visit2 = async (url, options = {}) => { 9920 if (url instanceof Response) { 9921 this.visitResponse(url); 9922 } else { 9923 session.visit(url, options); 9924 } 9925 }; 9926 const event = dispatch("turbo:frame-missing", { 9927 target: this.element, 9928 detail: { response, visit: visit2 }, 9929 cancelable: true 9930 }); 9931 return !event.defaultPrevented; 9932 } 9933 handleFrameMissingFromResponse(fetchResponse) { 9934 this.view.missing(); 9935 this.throwFrameMissingError(fetchResponse); 9936 } 9937 throwFrameMissingError(fetchResponse) { 9938 const message = `The response (${fetchResponse.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`; 9939 throw new TurboFrameMissingError(message); 9940 } 9941 async visitResponse(response) { 9942 const wrapped = new FetchResponse(response); 9943 const responseHTML = await wrapped.responseHTML; 9944 const { location: location2, redirected, statusCode } = wrapped; 9945 return session.visit(location2, { response: { redirected, statusCode, responseHTML } }); 9946 } 9947 findFrameElement(element, submitter) { 9948 var _a; 9949 const id = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target"); 9950 return (_a = getFrameElementById(id)) !== null && _a !== undefined ? _a : this.element; 9951 } 9952 async extractForeignFrameElement(container) { 9953 let element; 9954 const id = CSS.escape(this.id); 9955 try { 9956 element = activateElement(container.querySelector(`turbo-frame#${id}`), this.sourceURL); 9957 if (element) { 9958 return element; 9959 } 9960 element = activateElement(container.querySelector(`turbo-frame[src][recurse~=${id}]`), this.sourceURL); 9961 if (element) { 9962 await element.loaded; 9963 return await this.extractForeignFrameElement(element); 9964 } 9965 } catch (error) { 9966 console.error(error); 9967 return new FrameElement; 9968 } 9969 return null; 9970 } 9971 formActionIsVisitable(form, submitter) { 9972 const action = getAction(form, submitter); 9973 return locationIsVisitable(expandURL(action), this.rootLocation); 9974 } 9975 shouldInterceptNavigation(element, submitter) { 9976 const id = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target"); 9977 if (element instanceof HTMLFormElement && !this.formActionIsVisitable(element, submitter)) { 9978 return false; 9979 } 9980 if (!this.enabled || id == "_top") { 9981 return false; 9982 } 9983 if (id) { 9984 const frameElement = getFrameElementById(id); 9985 if (frameElement) { 9986 return !frameElement.disabled; 9987 } 9988 } 9989 if (!session.elementIsNavigatable(element)) { 9990 return false; 9991 } 9992 if (submitter && !session.elementIsNavigatable(submitter)) { 9993 return false; 9994 } 9995 return true; 9996 } 9997 get id() { 9998 return this.element.id; 9999 } 10000 get enabled() { 10001 return !this.element.disabled; 10002 } 10003 get sourceURL() { 10004 if (this.element.src) { 10005 return this.element.src; 10006 } 10007 } 10008 set sourceURL(sourceURL) { 10009 this.ignoringChangesToAttribute("src", () => { 10010 this.element.src = sourceURL !== null && sourceURL !== undefined ? sourceURL : null; 10011 }); 10012 } 10013 get loadingStyle() { 10014 return this.element.loading; 10015 } 10016 get isLoading() { 10017 return this.formSubmission !== undefined || this.resolveVisitPromise() !== undefined; 10018 } 10019 get complete() { 10020 return this.element.hasAttribute("complete"); 10021 } 10022 set complete(value) { 10023 this.ignoringChangesToAttribute("complete", () => { 10024 if (value) { 10025 this.element.setAttribute("complete", ""); 10026 } else { 10027 this.element.removeAttribute("complete"); 10028 } 10029 }); 10030 } 10031 get isActive() { 10032 return this.element.isActive && this.connected; 10033 } 10034 get rootLocation() { 10035 var _a; 10036 const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); 10037 const root = (_a = meta === null || meta === undefined ? undefined : meta.content) !== null && _a !== undefined ? _a : "/"; 10038 return expandURL(root); 10039 } 10040 isIgnoringChangesTo(attributeName) { 10041 return this.ignoredAttributes.has(attributeName); 10042 } 10043 ignoringChangesToAttribute(attributeName, callback) { 10044 this.ignoredAttributes.add(attributeName); 10045 callback(); 10046 this.ignoredAttributes.delete(attributeName); 10047 } 10048 withCurrentNavigationElement(element, callback) { 10049 this.currentNavigationElement = element; 10050 callback(); 10051 delete this.currentNavigationElement; 10052 } 10053} 10054function getFrameElementById(id) { 10055 if (id != null) { 10056 const element = document.getElementById(id); 10057 if (element instanceof FrameElement) { 10058 return element; 10059 } 10060 } 10061} 10062function activateElement(element, currentURL) { 10063 if (element) { 10064 const src = element.getAttribute("src"); 10065 if (src != null && currentURL != null && urlsAreEqual(src, currentURL)) { 10066 throw new Error(`Matching <turbo-frame id="${element.id}"> element has a source URL which references itself`); 10067 } 10068 if (element.ownerDocument !== document) { 10069 element = document.importNode(element, true); 10070 } 10071 if (element instanceof FrameElement) { 10072 element.connectedCallback(); 10073 element.disconnectedCallback(); 10074 return element; 10075 } 10076 } 10077} 10078 10079class StreamElement extends HTMLElement { 10080 static async renderElement(newElement) { 10081 await newElement.performAction(); 10082 } 10083 async connectedCallback() { 10084 try { 10085 await this.render(); 10086 } catch (error) { 10087 console.error(error); 10088 } finally { 10089 this.disconnect(); 10090 } 10091 } 10092 async render() { 10093 var _a; 10094 return (_a = this.renderPromise) !== null && _a !== undefined ? _a : this.renderPromise = (async () => { 10095 const event = this.beforeRenderEvent; 10096 if (this.dispatchEvent(event)) { 10097 await nextAnimationFrame(); 10098 await event.detail.render(this); 10099 } 10100 })(); 10101 } 10102 disconnect() { 10103 try { 10104 this.remove(); 10105 } catch (_a) {} 10106 } 10107 removeDuplicateTargetChildren() { 10108 this.duplicateChildren.forEach((c) => c.remove()); 10109 } 10110 get duplicateChildren() { 10111 var _a; 10112 const existingChildren = this.targetElements.flatMap((e) => [...e.children]).filter((c) => !!c.id); 10113 const newChildrenIds = [...((_a = this.templateContent) === null || _a === undefined ? undefined : _a.children) || []].filter((c) => !!c.id).map((c) => c.id); 10114 return existingChildren.filter((c) => newChildrenIds.includes(c.id)); 10115 } 10116 get performAction() { 10117 if (this.action) { 10118 const actionFunction = StreamActions[this.action]; 10119 if (actionFunction) { 10120 return actionFunction; 10121 } 10122 this.raise("unknown action"); 10123 } 10124 this.raise("action attribute is missing"); 10125 } 10126 get targetElements() { 10127 if (this.target) { 10128 return this.targetElementsById; 10129 } else if (this.targets) { 10130 return this.targetElementsByQuery; 10131 } else { 10132 this.raise("target or targets attribute is missing"); 10133 } 10134 } 10135 get templateContent() { 10136 return this.templateElement.content.cloneNode(true); 10137 } 10138 get templateElement() { 10139 if (this.firstElementChild === null) { 10140 const template = this.ownerDocument.createElement("template"); 10141 this.appendChild(template); 10142 return template; 10143 } else if (this.firstElementChild instanceof HTMLTemplateElement) { 10144 return this.firstElementChild; 10145 } 10146 this.raise("first child element must be a <template> element"); 10147 } 10148 get action() { 10149 return this.getAttribute("action"); 10150 } 10151 get target() { 10152 return this.getAttribute("target"); 10153 } 10154 get targets() { 10155 return this.getAttribute("targets"); 10156 } 10157 raise(message) { 10158 throw new Error(`${this.description}: ${message}`); 10159 } 10160 get description() { 10161 var _a, _b; 10162 return (_b = ((_a = this.outerHTML.match(/<[^>]+>/)) !== null && _a !== undefined ? _a : [])[0]) !== null && _b !== undefined ? _b : "<turbo-stream>"; 10163 } 10164 get beforeRenderEvent() { 10165 return new CustomEvent("turbo:before-stream-render", { 10166 bubbles: true, 10167 cancelable: true, 10168 detail: { newStream: this, render: StreamElement.renderElement } 10169 }); 10170 } 10171 get targetElementsById() { 10172 var _a; 10173 const element = (_a = this.ownerDocument) === null || _a === undefined ? undefined : _a.getElementById(this.target); 10174 if (element !== null) { 10175 return [element]; 10176 } else { 10177 return []; 10178 } 10179 } 10180 get targetElementsByQuery() { 10181 var _a; 10182 const elements = (_a = this.ownerDocument) === null || _a === undefined ? undefined : _a.querySelectorAll(this.targets); 10183 if (elements.length !== 0) { 10184 return Array.prototype.slice.call(elements); 10185 } else { 10186 return []; 10187 } 10188 } 10189} 10190 10191class StreamSourceElement extends HTMLElement { 10192 constructor() { 10193 super(...arguments); 10194 this.streamSource = null; 10195 } 10196 connectedCallback() { 10197 this.streamSource = this.src.match(/^ws{1,2}:/) ? new WebSocket(this.src) : new EventSource(this.src); 10198 connectStreamSource(this.streamSource); 10199 } 10200 disconnectedCallback() { 10201 if (this.streamSource) { 10202 disconnectStreamSource(this.streamSource); 10203 } 10204 } 10205 get src() { 10206 return this.getAttribute("src") || ""; 10207 } 10208} 10209FrameElement.delegateConstructor = FrameController; 10210if (customElements.get("turbo-frame") === undefined) { 10211 customElements.define("turbo-frame", FrameElement); 10212} 10213if (customElements.get("turbo-stream") === undefined) { 10214 customElements.define("turbo-stream", StreamElement); 10215} 10216if (customElements.get("turbo-stream-source") === undefined) { 10217 customElements.define("turbo-stream-source", StreamSourceElement); 10218} 10219(() => { 10220 let element = document.currentScript; 10221 if (!element) 10222 return; 10223 if (element.hasAttribute("data-turbo-suppress-warning")) 10224 return; 10225 element = element.parentElement; 10226 while (element) { 10227 if (element == document.body) { 10228 return console.warn(unindent` 10229 You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! 10230 10231 Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. 10232 10233 For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements 10234 10235 —— 10236 Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s 10237 `, element.outerHTML); 10238 } 10239 element = element.parentElement; 10240 } 10241})(); 10242window.Turbo = Turbo; 10243start(); 10244
vendor: 575 bytes, lines 10245-10261
10245// node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js 10246var consumer; 10247async function getConsumer() { 10248 return consumer || setConsumer(createConsumer2().then(setConsumer)); 10249} 10250function setConsumer(newConsumer) { 10251 return consumer = newConsumer; 10252} 10253async function createConsumer2() { 10254 const { createConsumer: createConsumer3 } = await Promise.resolve().then(() => (init_src(), exports_src)); 10255 return createConsumer3(); 10256} 10257async function subscribeTo(channel, mixin) { 10258 const { subscriptions } = await getConsumer(); 10259 return subscriptions.create(channel, mixin); 10260} 10261
vendor: 517 bytes, lines 10262-10278
10262// node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js 10263function walk(obj) { 10264 if (!obj || typeof obj !== "object") 10265 return obj; 10266 if (obj instanceof Date || obj instanceof RegExp) 10267 return obj; 10268 if (Array.isArray(obj)) 10269 return obj.map(walk); 10270 return Object.keys(obj).reduce(function(acc, key) { 10271 var camel = key[0].toLowerCase() + key.slice(1).replace(/([A-Z]+)/g, function(m, x) { 10272 return "_" + x.toLowerCase(); 10273 }); 10274 acc[camel] = walk(obj[key]); 10275 return acc; 10276 }, {}); 10277} 10278
vendor: 1,234 bytes, lines 10279-10313
10279// node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js 10280class TurboCableStreamSourceElement extends HTMLElement { 10281 async connectedCallback() { 10282 connectStreamSource(this); 10283 this.subscription = await subscribeTo(this.channel, { 10284 received: this.dispatchMessageEvent.bind(this), 10285 connected: this.subscriptionConnected.bind(this), 10286 disconnected: this.subscriptionDisconnected.bind(this) 10287 }); 10288 } 10289 disconnectedCallback() { 10290 disconnectStreamSource(this); 10291 if (this.subscription) 10292 this.subscription.unsubscribe(); 10293 } 10294 dispatchMessageEvent(data) { 10295 const event = new MessageEvent("message", { data }); 10296 return this.dispatchEvent(event); 10297 } 10298 subscriptionConnected() { 10299 this.setAttribute("connected", ""); 10300 } 10301 subscriptionDisconnected() { 10302 this.removeAttribute("connected"); 10303 } 10304 get channel() { 10305 const channel = this.getAttribute("channel"); 10306 const signed_stream_name = this.getAttribute("signed-stream-name"); 10307 return { channel, signed_stream_name, ...walk({ ...this.dataset }) }; 10308 } 10309} 10310if (customElements.get("turbo-cable-stream-source") === undefined) { 10311 customElements.define("turbo-cable-stream-source", TurboCableStreamSourceElement); 10312} 10313
vendor: 1,510 bytes, lines 10314-10358
10314// node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js 10315function encodeMethodIntoRequestBody(event) { 10316 if (event.target instanceof HTMLFormElement) { 10317 const { target: form, detail: { fetchOptions } } = event; 10318 form.addEventListener("turbo:submit-start", ({ detail: { formSubmission: { submitter } } }) => { 10319 const body = isBodyInit(fetchOptions.body) ? fetchOptions.body : new URLSearchParams; 10320 const method = determineFetchMethod(submitter, body, form); 10321 if (!/get/i.test(method)) { 10322 if (/post/i.test(method)) { 10323 body.delete("_method"); 10324 } else { 10325 body.set("_method", method); 10326 } 10327 fetchOptions.method = "post"; 10328 } 10329 }, { once: true }); 10330 } 10331} 10332function determineFetchMethod(submitter, body, form) { 10333 const formMethod = determineFormMethod(submitter); 10334 const overrideMethod = body.get("_method"); 10335 const method = form.getAttribute("method") || "get"; 10336 if (typeof formMethod == "string") { 10337 return formMethod; 10338 } else if (typeof overrideMethod == "string") { 10339 return overrideMethod; 10340 } else { 10341 return method; 10342 } 10343} 10344function determineFormMethod(submitter) { 10345 if (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) { 10346 if (submitter.hasAttribute("formmethod")) { 10347 return submitter.formMethod; 10348 } else { 10349 return null; 10350 } 10351 } else { 10352 return null; 10353 } 10354} 10355function isBodyInit(body) { 10356 return body instanceof FormData || body instanceof URLSearchParams; 10357} 10358
vendor: 146 bytes, lines 10359-10361
10359// node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js 10360addEventListener("turbo:before-fetch-request", encodeMethodIntoRequestBody); 10361
vendor: 78,795 bytes, lines 10362-12830
10362// node_modules/@hotwired/stimulus/dist/stimulus.js 10363class EventListener { 10364 constructor(eventTarget, eventName, eventOptions) { 10365 this.eventTarget = eventTarget; 10366 this.eventName = eventName; 10367 this.eventOptions = eventOptions; 10368 this.unorderedBindings = new Set; 10369 } 10370 connect() { 10371 this.eventTarget.addEventListener(this.eventName, this, this.eventOptions); 10372 } 10373 disconnect() { 10374 this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions); 10375 } 10376 bindingConnected(binding) { 10377 this.unorderedBindings.add(binding); 10378 } 10379 bindingDisconnected(binding) { 10380 this.unorderedBindings.delete(binding); 10381 } 10382 handleEvent(event) { 10383 const extendedEvent = extendEvent(event); 10384 for (const binding of this.bindings) { 10385 if (extendedEvent.immediatePropagationStopped) { 10386 break; 10387 } else { 10388 binding.handleEvent(extendedEvent); 10389 } 10390 } 10391 } 10392 hasBindings() { 10393 return this.unorderedBindings.size > 0; 10394 } 10395 get bindings() { 10396 return Array.from(this.unorderedBindings).sort((left, right) => { 10397 const leftIndex = left.index, rightIndex = right.index; 10398 return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0; 10399 }); 10400 } 10401} 10402function extendEvent(event) { 10403 if ("immediatePropagationStopped" in event) { 10404 return event; 10405 } else { 10406 const { stopImmediatePropagation } = event; 10407 return Object.assign(event, { 10408 immediatePropagationStopped: false, 10409 stopImmediatePropagation() { 10410 this.immediatePropagationStopped = true; 10411 stopImmediatePropagation.call(this); 10412 } 10413 }); 10414 } 10415} 10416 10417class Dispatcher { 10418 constructor(application) { 10419 this.application = application; 10420 this.eventListenerMaps = new Map; 10421 this.started = false; 10422 } 10423 start() { 10424 if (!this.started) { 10425 this.started = true; 10426 this.eventListeners.forEach((eventListener) => eventListener.connect()); 10427 } 10428 } 10429 stop() { 10430 if (this.started) { 10431 this.started = false; 10432 this.eventListeners.forEach((eventListener) => eventListener.disconnect()); 10433 } 10434 } 10435 get eventListeners() { 10436 return Array.from(this.eventListenerMaps.values()).reduce((listeners, map) => listeners.concat(Array.from(map.values())), []); 10437 } 10438 bindingConnected(binding) { 10439 this.fetchEventListenerForBinding(binding).bindingConnected(binding); 10440 } 10441 bindingDisconnected(binding, clearEventListeners = false) { 10442 this.fetchEventListenerForBinding(binding).bindingDisconnected(binding); 10443 if (clearEventListeners) 10444 this.clearEventListenersForBinding(binding); 10445 } 10446 handleError(error, message, detail = {}) { 10447 this.application.handleError(error, `Error ${message}`, detail); 10448 } 10449 clearEventListenersForBinding(binding) { 10450 const eventListener = this.fetchEventListenerForBinding(binding); 10451 if (!eventListener.hasBindings()) { 10452 eventListener.disconnect(); 10453 this.removeMappedEventListenerFor(binding); 10454 } 10455 } 10456 removeMappedEventListenerFor(binding) { 10457 const { eventTarget, eventName, eventOptions } = binding; 10458 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 10459 const cacheKey = this.cacheKey(eventName, eventOptions); 10460 eventListenerMap.delete(cacheKey); 10461 if (eventListenerMap.size == 0) 10462 this.eventListenerMaps.delete(eventTarget); 10463 } 10464 fetchEventListenerForBinding(binding) { 10465 const { eventTarget, eventName, eventOptions } = binding; 10466 return this.fetchEventListener(eventTarget, eventName, eventOptions); 10467 } 10468 fetchEventListener(eventTarget, eventName, eventOptions) { 10469 const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget); 10470 const cacheKey = this.cacheKey(eventName, eventOptions); 10471 let eventListener = eventListenerMap.get(cacheKey); 10472 if (!eventListener) { 10473 eventListener = this.createEventListener(eventTarget, eventName, eventOptions); 10474 eventListenerMap.set(cacheKey, eventListener); 10475 } 10476 return eventListener; 10477 } 10478 createEventListener(eventTarget, eventName, eventOptions) { 10479 const eventListener = new EventListener(eventTarget, eventName, eventOptions); 10480 if (this.started) { 10481 eventListener.connect(); 10482 } 10483 return eventListener; 10484 } 10485 fetchEventListenerMapForEventTarget(eventTarget) { 10486 let eventListenerMap = this.eventListenerMaps.get(eventTarget); 10487 if (!eventListenerMap) { 10488 eventListenerMap = new Map; 10489 this.eventListenerMaps.set(eventTarget, eventListenerMap); 10490 } 10491 return eventListenerMap; 10492 } 10493 cacheKey(eventName, eventOptions) { 10494 const parts = [eventName]; 10495 Object.keys(eventOptions).sort().forEach((key) => { 10496 parts.push(`${eventOptions[key] ? "" : "!"}${key}`); 10497 }); 10498 return parts.join(":"); 10499 } 10500} 10501var defaultActionDescriptorFilters = { 10502 stop({ event, value }) { 10503 if (value) 10504 event.stopPropagation(); 10505 return true; 10506 }, 10507 prevent({ event, value }) { 10508 if (value) 10509 event.preventDefault(); 10510 return true; 10511 }, 10512 self({ event, value, element }) { 10513 if (value) { 10514 return element === event.target; 10515 } else { 10516 return true; 10517 } 10518 } 10519}; 10520var descriptorPattern = /^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/; 10521function parseActionDescriptorString(descriptorString) { 10522 const source = descriptorString.trim(); 10523 const matches = source.match(descriptorPattern) || []; 10524 let eventName = matches[2]; 10525 let keyFilter = matches[3]; 10526 if (keyFilter && !["keydown", "keyup", "keypress"].includes(eventName)) { 10527 eventName += `.${keyFilter}`; 10528 keyFilter = ""; 10529 } 10530 return { 10531 eventTarget: parseEventTarget(matches[4]), 10532 eventName, 10533 eventOptions: matches[7] ? parseEventOptions(matches[7]) : {}, 10534 identifier: matches[5], 10535 methodName: matches[6], 10536 keyFilter: matches[1] || keyFilter 10537 }; 10538} 10539function parseEventTarget(eventTargetName) { 10540 if (eventTargetName == "window") { 10541 return window; 10542 } else if (eventTargetName == "document") { 10543 return document; 10544 } 10545} 10546function parseEventOptions(eventOptions) { 10547 return eventOptions.split(":").reduce((options, token) => Object.assign(options, { [token.replace(/^!/, "")]: !/^!/.test(token) }), {}); 10548} 10549function stringifyEventTarget(eventTarget) { 10550 if (eventTarget == window) { 10551 return "window"; 10552 } else if (eventTarget == document) { 10553 return "document"; 10554 } 10555} 10556function camelize(value) { 10557 return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase()); 10558} 10559function namespaceCamelize(value) { 10560 return camelize(value.replace(/--/g, "-").replace(/__/g, "_")); 10561} 10562function capitalize(value) { 10563 return value.charAt(0).toUpperCase() + value.slice(1); 10564} 10565function dasherize(value) { 10566 return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`); 10567} 10568function tokenize(value) { 10569 return value.match(/[^\s]+/g) || []; 10570} 10571function isSomething(object) { 10572 return object !== null && object !== undefined; 10573} 10574function hasProperty(object, property) { 10575 return Object.prototype.hasOwnProperty.call(object, property); 10576} 10577var allModifiers = ["meta", "ctrl", "alt", "shift"]; 10578 10579class Action { 10580 constructor(element, index, descriptor, schema) { 10581 this.element = element; 10582 this.index = index; 10583 this.eventTarget = descriptor.eventTarget || element; 10584 this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error("missing event name"); 10585 this.eventOptions = descriptor.eventOptions || {}; 10586 this.identifier = descriptor.identifier || error("missing identifier"); 10587 this.methodName = descriptor.methodName || error("missing method name"); 10588 this.keyFilter = descriptor.keyFilter || ""; 10589 this.schema = schema; 10590 } 10591 static forToken(token, schema) { 10592 return new this(token.element, token.index, parseActionDescriptorString(token.content), schema); 10593 } 10594 toString() { 10595 const eventFilter = this.keyFilter ? `.${this.keyFilter}` : ""; 10596 const eventTarget = this.eventTargetName ? `@${this.eventTargetName}` : ""; 10597 return `${this.eventName}${eventFilter}${eventTarget}->${this.identifier}#${this.methodName}`; 10598 } 10599 shouldIgnoreKeyboardEvent(event) { 10600 if (!this.keyFilter) { 10601 return false; 10602 } 10603 const filters = this.keyFilter.split("+"); 10604 if (this.keyFilterDissatisfied(event, filters)) { 10605 return true; 10606 } 10607 const standardFilter = filters.filter((key) => !allModifiers.includes(key))[0]; 10608 if (!standardFilter) { 10609 return false; 10610 } 10611 if (!hasProperty(this.keyMappings, standardFilter)) { 10612 error(`contains unknown key filter: ${this.keyFilter}`); 10613 } 10614 return this.keyMappings[standardFilter].toLowerCase() !== event.key.toLowerCase(); 10615 } 10616 shouldIgnoreMouseEvent(event) { 10617 if (!this.keyFilter) { 10618 return false; 10619 } 10620 const filters = [this.keyFilter]; 10621 if (this.keyFilterDissatisfied(event, filters)) { 10622 return true; 10623 } 10624 return false; 10625 } 10626 get params() { 10627 const params = {}; 10628 const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`, "i"); 10629 for (const { name, value } of Array.from(this.element.attributes)) { 10630 const match = name.match(pattern); 10631 const key = match && match[1]; 10632 if (key) { 10633 params[camelize(key)] = typecast(value); 10634 } 10635 } 10636 return params; 10637 } 10638 get eventTargetName() { 10639 return stringifyEventTarget(this.eventTarget); 10640 } 10641 get keyMappings() { 10642 return this.schema.keyMappings; 10643 } 10644 keyFilterDissatisfied(event, filters) { 10645 const [meta, ctrl, alt, shift] = allModifiers.map((modifier) => filters.includes(modifier)); 10646 return event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== alt || event.shiftKey !== shift; 10647 } 10648} 10649var defaultEventNames = { 10650 a: () => "click", 10651 button: () => "click", 10652 form: () => "submit", 10653 details: () => "toggle", 10654 input: (e) => e.getAttribute("type") == "submit" ? "click" : "input", 10655 select: () => "change", 10656 textarea: () => "input" 10657}; 10658function getDefaultEventNameForElement(element) { 10659 const tagName = element.tagName.toLowerCase(); 10660 if (tagName in defaultEventNames) { 10661 return defaultEventNames[tagName](element); 10662 } 10663} 10664function error(message) { 10665 throw new Error(message); 10666} 10667function typecast(value) { 10668 try { 10669 return JSON.parse(value); 10670 } catch (o_O) { 10671 return value; 10672 } 10673} 10674 10675class Binding { 10676 constructor(context, action) { 10677 this.context = context; 10678 this.action = action; 10679 } 10680 get index() { 10681 return this.action.index; 10682 } 10683 get eventTarget() { 10684 return this.action.eventTarget; 10685 } 10686 get eventOptions() { 10687 return this.action.eventOptions; 10688 } 10689 get identifier() { 10690 return this.context.identifier; 10691 } 10692 handleEvent(event) { 10693 const actionEvent = this.prepareActionEvent(event); 10694 if (this.willBeInvokedByEvent(event) && this.applyEventModifiers(actionEvent)) { 10695 this.invokeWithEvent(actionEvent); 10696 } 10697 } 10698 get eventName() { 10699 return this.action.eventName; 10700 } 10701 get method() { 10702 const method = this.controller[this.methodName]; 10703 if (typeof method == "function") { 10704 return method; 10705 } 10706 throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`); 10707 } 10708 applyEventModifiers(event) { 10709 const { element } = this.action; 10710 const { actionDescriptorFilters } = this.context.application; 10711 const { controller } = this.context; 10712 let passes = true; 10713 for (const [name, value] of Object.entries(this.eventOptions)) { 10714 if (name in actionDescriptorFilters) { 10715 const filter = actionDescriptorFilters[name]; 10716 passes = passes && filter({ name, value, event, element, controller }); 10717 } else { 10718 continue; 10719 } 10720 } 10721 return passes; 10722 } 10723 prepareActionEvent(event) { 10724 return Object.assign(event, { params: this.action.params }); 10725 } 10726 invokeWithEvent(event) { 10727 const { target, currentTarget } = event; 10728 try { 10729 this.method.call(this.controller, event); 10730 this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName }); 10731 } catch (error2) { 10732 const { identifier, controller, element, index } = this; 10733 const detail = { identifier, controller, element, index, event }; 10734 this.context.handleError(error2, `invoking action "${this.action}"`, detail); 10735 } 10736 } 10737 willBeInvokedByEvent(event) { 10738 const eventTarget = event.target; 10739 if (event instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(event)) { 10740 return false; 10741 } 10742 if (event instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(event)) { 10743 return false; 10744 } 10745 if (this.element === eventTarget) { 10746 return true; 10747 } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) { 10748 return this.scope.containsElement(eventTarget); 10749 } else { 10750 return this.scope.containsElement(this.action.element); 10751 } 10752 } 10753 get controller() { 10754 return this.context.controller; 10755 } 10756 get methodName() { 10757 return this.action.methodName; 10758 } 10759 get element() { 10760 return this.scope.element; 10761 } 10762 get scope() { 10763 return this.context.scope; 10764 } 10765} 10766 10767class ElementObserver { 10768 constructor(element, delegate) { 10769 this.mutationObserverInit = { attributes: true, childList: true, subtree: true }; 10770 this.element = element; 10771 this.started = false; 10772 this.delegate = delegate; 10773 this.elements = new Set; 10774 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 10775 } 10776 start() { 10777 if (!this.started) { 10778 this.started = true; 10779 this.mutationObserver.observe(this.element, this.mutationObserverInit); 10780 this.refresh(); 10781 } 10782 } 10783 pause(callback) { 10784 if (this.started) { 10785 this.mutationObserver.disconnect(); 10786 this.started = false; 10787 } 10788 callback(); 10789 if (!this.started) { 10790 this.mutationObserver.observe(this.element, this.mutationObserverInit); 10791 this.started = true; 10792 } 10793 } 10794 stop() { 10795 if (this.started) { 10796 this.mutationObserver.takeRecords(); 10797 this.mutationObserver.disconnect(); 10798 this.started = false; 10799 } 10800 } 10801 refresh() { 10802 if (this.started) { 10803 const matches = new Set(this.matchElementsInTree()); 10804 for (const element of Array.from(this.elements)) { 10805 if (!matches.has(element)) { 10806 this.removeElement(element); 10807 } 10808 } 10809 for (const element of Array.from(matches)) { 10810 this.addElement(element); 10811 } 10812 } 10813 } 10814 processMutations(mutations) { 10815 if (this.started) { 10816 for (const mutation of mutations) { 10817 this.processMutation(mutation); 10818 } 10819 } 10820 } 10821 processMutation(mutation) { 10822 if (mutation.type == "attributes") { 10823 this.processAttributeChange(mutation.target, mutation.attributeName); 10824 } else if (mutation.type == "childList") { 10825 this.processRemovedNodes(mutation.removedNodes); 10826 this.processAddedNodes(mutation.addedNodes); 10827 } 10828 } 10829 processAttributeChange(element, attributeName) { 10830 if (this.elements.has(element)) { 10831 if (this.delegate.elementAttributeChanged && this.matchElement(element)) { 10832 this.delegate.elementAttributeChanged(element, attributeName); 10833 } else { 10834 this.removeElement(element); 10835 } 10836 } else if (this.matchElement(element)) { 10837 this.addElement(element); 10838 } 10839 } 10840 processRemovedNodes(nodes) { 10841 for (const node of Array.from(nodes)) { 10842 const element = this.elementFromNode(node); 10843 if (element) { 10844 this.processTree(element, this.removeElement); 10845 } 10846 } 10847 } 10848 processAddedNodes(nodes) { 10849 for (const node of Array.from(nodes)) { 10850 const element = this.elementFromNode(node); 10851 if (element && this.elementIsActive(element)) { 10852 this.processTree(element, this.addElement); 10853 } 10854 } 10855 } 10856 matchElement(element) { 10857 return this.delegate.matchElement(element); 10858 } 10859 matchElementsInTree(tree = this.element) { 10860 return this.delegate.matchElementsInTree(tree); 10861 } 10862 processTree(tree, processor) { 10863 for (const element of this.matchElementsInTree(tree)) { 10864 processor.call(this, element); 10865 } 10866 } 10867 elementFromNode(node) { 10868 if (node.nodeType == Node.ELEMENT_NODE) { 10869 return node; 10870 } 10871 } 10872 elementIsActive(element) { 10873 if (element.isConnected != this.element.isConnected) { 10874 return false; 10875 } else { 10876 return this.element.contains(element); 10877 } 10878 } 10879 addElement(element) { 10880 if (!this.elements.has(element)) { 10881 if (this.elementIsActive(element)) { 10882 this.elements.add(element); 10883 if (this.delegate.elementMatched) { 10884 this.delegate.elementMatched(element); 10885 } 10886 } 10887 } 10888 } 10889 removeElement(element) { 10890 if (this.elements.has(element)) { 10891 this.elements.delete(element); 10892 if (this.delegate.elementUnmatched) { 10893 this.delegate.elementUnmatched(element); 10894 } 10895 } 10896 } 10897} 10898 10899class AttributeObserver { 10900 constructor(element, attributeName, delegate) { 10901 this.attributeName = attributeName; 10902 this.delegate = delegate; 10903 this.elementObserver = new ElementObserver(element, this); 10904 } 10905 get element() { 10906 return this.elementObserver.element; 10907 } 10908 get selector() { 10909 return `[${this.attributeName}]`; 10910 } 10911 start() { 10912 this.elementObserver.start(); 10913 } 10914 pause(callback) { 10915 this.elementObserver.pause(callback); 10916 } 10917 stop() { 10918 this.elementObserver.stop(); 10919 } 10920 refresh() { 10921 this.elementObserver.refresh(); 10922 } 10923 get started() { 10924 return this.elementObserver.started; 10925 } 10926 matchElement(element) { 10927 return element.hasAttribute(this.attributeName); 10928 } 10929 matchElementsInTree(tree) { 10930 const match = this.matchElement(tree) ? [tree] : []; 10931 const matches = Array.from(tree.querySelectorAll(this.selector)); 10932 return match.concat(matches); 10933 } 10934 elementMatched(element) { 10935 if (this.delegate.elementMatchedAttribute) { 10936 this.delegate.elementMatchedAttribute(element, this.attributeName); 10937 } 10938 } 10939 elementUnmatched(element) { 10940 if (this.delegate.elementUnmatchedAttribute) { 10941 this.delegate.elementUnmatchedAttribute(element, this.attributeName); 10942 } 10943 } 10944 elementAttributeChanged(element, attributeName) { 10945 if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) { 10946 this.delegate.elementAttributeValueChanged(element, attributeName); 10947 } 10948 } 10949} 10950function add(map, key, value) { 10951 fetch2(map, key).add(value); 10952} 10953function del(map, key, value) { 10954 fetch2(map, key).delete(value); 10955 prune(map, key); 10956} 10957function fetch2(map, key) { 10958 let values = map.get(key); 10959 if (!values) { 10960 values = new Set; 10961 map.set(key, values); 10962 } 10963 return values; 10964} 10965function prune(map, key) { 10966 const values = map.get(key); 10967 if (values != null && values.size == 0) { 10968 map.delete(key); 10969 } 10970} 10971 10972class Multimap { 10973 constructor() { 10974 this.valuesByKey = new Map; 10975 } 10976 get keys() { 10977 return Array.from(this.valuesByKey.keys()); 10978 } 10979 get values() { 10980 const sets = Array.from(this.valuesByKey.values()); 10981 return sets.reduce((values, set) => values.concat(Array.from(set)), []); 10982 } 10983 get size() { 10984 const sets = Array.from(this.valuesByKey.values()); 10985 return sets.reduce((size, set) => size + set.size, 0); 10986 } 10987 add(key, value) { 10988 add(this.valuesByKey, key, value); 10989 } 10990 delete(key, value) { 10991 del(this.valuesByKey, key, value); 10992 } 10993 has(key, value) { 10994 const values = this.valuesByKey.get(key); 10995 return values != null && values.has(value); 10996 } 10997 hasKey(key) { 10998 return this.valuesByKey.has(key); 10999 } 11000 hasValue(value) { 11001 const sets = Array.from(this.valuesByKey.values()); 11002 return sets.some((set) => set.has(value)); 11003 } 11004 getValuesForKey(key) { 11005 const values = this.valuesByKey.get(key); 11006 return values ? Array.from(values) : []; 11007 } 11008 getKeysForValue(value) { 11009 return Array.from(this.valuesByKey).filter(([_key, values]) => values.has(value)).map(([key, _values]) => key); 11010 } 11011} 11012class SelectorObserver { 11013 constructor(element, selector, delegate, details) { 11014 this._selector = selector; 11015 this.details = details; 11016 this.elementObserver = new ElementObserver(element, this); 11017 this.delegate = delegate; 11018 this.matchesByElement = new Multimap; 11019 } 11020 get started() { 11021 return this.elementObserver.started; 11022 } 11023 get selector() { 11024 return this._selector; 11025 } 11026 set selector(selector) { 11027 this._selector = selector; 11028 this.refresh(); 11029 } 11030 start() { 11031 this.elementObserver.start(); 11032 } 11033 pause(callback) { 11034 this.elementObserver.pause(callback); 11035 } 11036 stop() { 11037 this.elementObserver.stop(); 11038 } 11039 refresh() { 11040 this.elementObserver.refresh(); 11041 } 11042 get element() { 11043 return this.elementObserver.element; 11044 } 11045 matchElement(element) { 11046 const { selector } = this; 11047 if (selector) { 11048 const matches = element.matches(selector); 11049 if (this.delegate.selectorMatchElement) { 11050 return matches && this.delegate.selectorMatchElement(element, this.details); 11051 } 11052 return matches; 11053 } else { 11054 return false; 11055 } 11056 } 11057 matchElementsInTree(tree) { 11058 const { selector } = this; 11059 if (selector) { 11060 const match = this.matchElement(tree) ? [tree] : []; 11061 const matches = Array.from(tree.querySelectorAll(selector)).filter((match2) => this.matchElement(match2)); 11062 return match.concat(matches); 11063 } else { 11064 return []; 11065 } 11066 } 11067 elementMatched(element) { 11068 const { selector } = this; 11069 if (selector) { 11070 this.selectorMatched(element, selector); 11071 } 11072 } 11073 elementUnmatched(element) { 11074 const selectors = this.matchesByElement.getKeysForValue(element); 11075 for (const selector of selectors) { 11076 this.selectorUnmatched(element, selector); 11077 } 11078 } 11079 elementAttributeChanged(element, _attributeName) { 11080 const { selector } = this; 11081 if (selector) { 11082 const matches = this.matchElement(element); 11083 const matchedBefore = this.matchesByElement.has(selector, element); 11084 if (matches && !matchedBefore) { 11085 this.selectorMatched(element, selector); 11086 } else if (!matches && matchedBefore) { 11087 this.selectorUnmatched(element, selector); 11088 } 11089 } 11090 } 11091 selectorMatched(element, selector) { 11092 this.delegate.selectorMatched(element, selector, this.details); 11093 this.matchesByElement.add(selector, element); 11094 } 11095 selectorUnmatched(element, selector) { 11096 this.delegate.selectorUnmatched(element, selector, this.details); 11097 this.matchesByElement.delete(selector, element); 11098 } 11099} 11100 11101class StringMapObserver { 11102 constructor(element, delegate) { 11103 this.element = element; 11104 this.delegate = delegate; 11105 this.started = false; 11106 this.stringMap = new Map; 11107 this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations)); 11108 } 11109 start() { 11110 if (!this.started) { 11111 this.started = true; 11112 this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true }); 11113 this.refresh(); 11114 } 11115 } 11116 stop() { 11117 if (this.started) { 11118 this.mutationObserver.takeRecords(); 11119 this.mutationObserver.disconnect(); 11120 this.started = false; 11121 } 11122 } 11123 refresh() { 11124 if (this.started) { 11125 for (const attributeName of this.knownAttributeNames) { 11126 this.refreshAttribute(attributeName, null); 11127 } 11128 } 11129 } 11130 processMutations(mutations) { 11131 if (this.started) { 11132 for (const mutation of mutations) { 11133 this.processMutation(mutation); 11134 } 11135 } 11136 } 11137 processMutation(mutation) { 11138 const attributeName = mutation.attributeName; 11139 if (attributeName) { 11140 this.refreshAttribute(attributeName, mutation.oldValue); 11141 } 11142 } 11143 refreshAttribute(attributeName, oldValue) { 11144 const key = this.delegate.getStringMapKeyForAttribute(attributeName); 11145 if (key != null) { 11146 if (!this.stringMap.has(attributeName)) { 11147 this.stringMapKeyAdded(key, attributeName); 11148 } 11149 const value = this.element.getAttribute(attributeName); 11150 if (this.stringMap.get(attributeName) != value) { 11151 this.stringMapValueChanged(value, key, oldValue); 11152 } 11153 if (value == null) { 11154 const oldValue2 = this.stringMap.get(attributeName); 11155 this.stringMap.delete(attributeName); 11156 if (oldValue2) 11157 this.stringMapKeyRemoved(key, attributeName, oldValue2); 11158 } else { 11159 this.stringMap.set(attributeName, value); 11160 } 11161 } 11162 } 11163 stringMapKeyAdded(key, attributeName) { 11164 if (this.delegate.stringMapKeyAdded) { 11165 this.delegate.stringMapKeyAdded(key, attributeName); 11166 } 11167 } 11168 stringMapValueChanged(value, key, oldValue) { 11169 if (this.delegate.stringMapValueChanged) { 11170 this.delegate.stringMapValueChanged(value, key, oldValue); 11171 } 11172 } 11173 stringMapKeyRemoved(key, attributeName, oldValue) { 11174 if (this.delegate.stringMapKeyRemoved) { 11175 this.delegate.stringMapKeyRemoved(key, attributeName, oldValue); 11176 } 11177 } 11178 get knownAttributeNames() { 11179 return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames))); 11180 } 11181 get currentAttributeNames() { 11182 return Array.from(this.element.attributes).map((attribute) => attribute.name); 11183 } 11184 get recordedAttributeNames() { 11185 return Array.from(this.stringMap.keys()); 11186 } 11187} 11188 11189class TokenListObserver { 11190 constructor(element, attributeName, delegate) { 11191 this.attributeObserver = new AttributeObserver(element, attributeName, this); 11192 this.delegate = delegate; 11193 this.tokensByElement = new Multimap; 11194 } 11195 get started() { 11196 return this.attributeObserver.started; 11197 } 11198 start() { 11199 this.attributeObserver.start(); 11200 } 11201 pause(callback) { 11202 this.attributeObserver.pause(callback); 11203 } 11204 stop() { 11205 this.attributeObserver.stop(); 11206 } 11207 refresh() { 11208 this.attributeObserver.refresh(); 11209 } 11210 get element() { 11211 return this.attributeObserver.element; 11212 } 11213 get attributeName() { 11214 return this.attributeObserver.attributeName; 11215 } 11216 elementMatchedAttribute(element) { 11217 this.tokensMatched(this.readTokensForElement(element)); 11218 } 11219 elementAttributeValueChanged(element) { 11220 const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element); 11221 this.tokensUnmatched(unmatchedTokens); 11222 this.tokensMatched(matchedTokens); 11223 } 11224 elementUnmatchedAttribute(element) { 11225 this.tokensUnmatched(this.tokensByElement.getValuesForKey(element)); 11226 } 11227 tokensMatched(tokens) { 11228 tokens.forEach((token) => this.tokenMatched(token)); 11229 } 11230 tokensUnmatched(tokens) { 11231 tokens.forEach((token) => this.tokenUnmatched(token)); 11232 } 11233 tokenMatched(token) { 11234 this.delegate.tokenMatched(token); 11235 this.tokensByElement.add(token.element, token); 11236 } 11237 tokenUnmatched(token) { 11238 this.delegate.tokenUnmatched(token); 11239 this.tokensByElement.delete(token.element, token); 11240 } 11241 refreshTokensForElement(element) { 11242 const previousTokens = this.tokensByElement.getValuesForKey(element); 11243 const currentTokens = this.readTokensForElement(element); 11244 const firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken)); 11245 if (firstDifferingIndex == -1) { 11246 return [[], []]; 11247 } else { 11248 return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)]; 11249 } 11250 } 11251 readTokensForElement(element) { 11252 const attributeName = this.attributeName; 11253 const tokenString = element.getAttribute(attributeName) || ""; 11254 return parseTokenString(tokenString, element, attributeName); 11255 } 11256} 11257function parseTokenString(tokenString, element, attributeName) { 11258 return tokenString.trim().split(/\s+/).filter((content) => content.length).map((content, index) => ({ element, attributeName, content, index })); 11259} 11260function zip(left, right) { 11261 const length = Math.max(left.length, right.length); 11262 return Array.from({ length }, (_, index) => [left[index], right[index]]); 11263} 11264function tokensAreEqual(left, right) { 11265 return left && right && left.index == right.index && left.content == right.content; 11266} 11267 11268class ValueListObserver { 11269 constructor(element, attributeName, delegate) { 11270 this.tokenListObserver = new TokenListObserver(element, attributeName, this); 11271 this.delegate = delegate; 11272 this.parseResultsByToken = new WeakMap; 11273 this.valuesByTokenByElement = new WeakMap; 11274 } 11275 get started() { 11276 return this.tokenListObserver.started; 11277 } 11278 start() { 11279 this.tokenListObserver.start(); 11280 } 11281 stop() { 11282 this.tokenListObserver.stop(); 11283 } 11284 refresh() { 11285 this.tokenListObserver.refresh(); 11286 } 11287 get element() { 11288 return this.tokenListObserver.element; 11289 } 11290 get attributeName() { 11291 return this.tokenListObserver.attributeName; 11292 } 11293 tokenMatched(token) { 11294 const { element } = token; 11295 const { value } = this.fetchParseResultForToken(token); 11296 if (value) { 11297 this.fetchValuesByTokenForElement(element).set(token, value); 11298 this.delegate.elementMatchedValue(element, value); 11299 } 11300 } 11301 tokenUnmatched(token) { 11302 const { element } = token; 11303 const { value } = this.fetchParseResultForToken(token); 11304 if (value) { 11305 this.fetchValuesByTokenForElement(element).delete(token); 11306 this.delegate.elementUnmatchedValue(element, value); 11307 } 11308 } 11309 fetchParseResultForToken(token) { 11310 let parseResult = this.parseResultsByToken.get(token); 11311 if (!parseResult) { 11312 parseResult = this.parseToken(token); 11313 this.parseResultsByToken.set(token, parseResult); 11314 } 11315 return parseResult; 11316 } 11317 fetchValuesByTokenForElement(element) { 11318 let valuesByToken = this.valuesByTokenByElement.get(element); 11319 if (!valuesByToken) { 11320 valuesByToken = new Map; 11321 this.valuesByTokenByElement.set(element, valuesByToken); 11322 } 11323 return valuesByToken; 11324 } 11325 parseToken(token) { 11326 try { 11327 const value = this.delegate.parseValueForToken(token); 11328 return { value }; 11329 } catch (error2) { 11330 return { error: error2 }; 11331 } 11332 } 11333} 11334 11335class BindingObserver { 11336 constructor(context, delegate) { 11337 this.context = context; 11338 this.delegate = delegate; 11339 this.bindingsByAction = new Map; 11340 } 11341 start() { 11342 if (!this.valueListObserver) { 11343 this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this); 11344 this.valueListObserver.start(); 11345 } 11346 } 11347 stop() { 11348 if (this.valueListObserver) { 11349 this.valueListObserver.stop(); 11350 delete this.valueListObserver; 11351 this.disconnectAllActions(); 11352 } 11353 } 11354 get element() { 11355 return this.context.element; 11356 } 11357 get identifier() { 11358 return this.context.identifier; 11359 } 11360 get actionAttribute() { 11361 return this.schema.actionAttribute; 11362 } 11363 get schema() { 11364 return this.context.schema; 11365 } 11366 get bindings() { 11367 return Array.from(this.bindingsByAction.values()); 11368 } 11369 connectAction(action) { 11370 const binding = new Binding(this.context, action); 11371 this.bindingsByAction.set(action, binding); 11372 this.delegate.bindingConnected(binding); 11373 } 11374 disconnectAction(action) { 11375 const binding = this.bindingsByAction.get(action); 11376 if (binding) { 11377 this.bindingsByAction.delete(action); 11378 this.delegate.bindingDisconnected(binding); 11379 } 11380 } 11381 disconnectAllActions() { 11382 this.bindings.forEach((binding) => this.delegate.bindingDisconnected(binding, true)); 11383 this.bindingsByAction.clear(); 11384 } 11385 parseValueForToken(token) { 11386 const action = Action.forToken(token, this.schema); 11387 if (action.identifier == this.identifier) { 11388 return action; 11389 } 11390 } 11391 elementMatchedValue(element, action) { 11392 this.connectAction(action); 11393 } 11394 elementUnmatchedValue(element, action) { 11395 this.disconnectAction(action); 11396 } 11397} 11398 11399class ValueObserver { 11400 constructor(context, receiver) { 11401 this.context = context; 11402 this.receiver = receiver; 11403 this.stringMapObserver = new StringMapObserver(this.element, this); 11404 this.valueDescriptorMap = this.controller.valueDescriptorMap; 11405 } 11406 start() { 11407 this.stringMapObserver.start(); 11408 this.invokeChangedCallbacksForDefaultValues(); 11409 } 11410 stop() { 11411 this.stringMapObserver.stop(); 11412 } 11413 get element() { 11414 return this.context.element; 11415 } 11416 get controller() { 11417 return this.context.controller; 11418 } 11419 getStringMapKeyForAttribute(attributeName) { 11420 if (attributeName in this.valueDescriptorMap) { 11421 return this.valueDescriptorMap[attributeName].name; 11422 } 11423 } 11424 stringMapKeyAdded(key, attributeName) { 11425 const descriptor = this.valueDescriptorMap[attributeName]; 11426 if (!this.hasValue(key)) { 11427 this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue)); 11428 } 11429 } 11430 stringMapValueChanged(value, name, oldValue) { 11431 const descriptor = this.valueDescriptorNameMap[name]; 11432 if (value === null) 11433 return; 11434 if (oldValue === null) { 11435 oldValue = descriptor.writer(descriptor.defaultValue); 11436 } 11437 this.invokeChangedCallback(name, value, oldValue); 11438 } 11439 stringMapKeyRemoved(key, attributeName, oldValue) { 11440 const descriptor = this.valueDescriptorNameMap[key]; 11441 if (this.hasValue(key)) { 11442 this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue); 11443 } else { 11444 this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue); 11445 } 11446 } 11447 invokeChangedCallbacksForDefaultValues() { 11448 for (const { key, name, defaultValue, writer } of this.valueDescriptors) { 11449 if (defaultValue != null && !this.controller.data.has(key)) { 11450 this.invokeChangedCallback(name, writer(defaultValue), undefined); 11451 } 11452 } 11453 } 11454 invokeChangedCallback(name, rawValue, rawOldValue) { 11455 const changedMethodName = `${name}Changed`; 11456 const changedMethod = this.receiver[changedMethodName]; 11457 if (typeof changedMethod == "function") { 11458 const descriptor = this.valueDescriptorNameMap[name]; 11459 try { 11460 const value = descriptor.reader(rawValue); 11461 let oldValue = rawOldValue; 11462 if (rawOldValue) { 11463 oldValue = descriptor.reader(rawOldValue); 11464 } 11465 changedMethod.call(this.receiver, value, oldValue); 11466 } catch (error2) { 11467 if (error2 instanceof TypeError) { 11468 error2.message = `Stimulus Value "${this.context.identifier}.${descriptor.name}" - ${error2.message}`; 11469 } 11470 throw error2; 11471 } 11472 } 11473 } 11474 get valueDescriptors() { 11475 const { valueDescriptorMap } = this; 11476 return Object.keys(valueDescriptorMap).map((key) => valueDescriptorMap[key]); 11477 } 11478 get valueDescriptorNameMap() { 11479 const descriptors = {}; 11480 Object.keys(this.valueDescriptorMap).forEach((key) => { 11481 const descriptor = this.valueDescriptorMap[key]; 11482 descriptors[descriptor.name] = descriptor; 11483 }); 11484 return descriptors; 11485 } 11486 hasValue(attributeName) { 11487 const descriptor = this.valueDescriptorNameMap[attributeName]; 11488 const hasMethodName = `has${capitalize(descriptor.name)}`; 11489 return this.receiver[hasMethodName]; 11490 } 11491} 11492 11493class TargetObserver { 11494 constructor(context, delegate) { 11495 this.context = context; 11496 this.delegate = delegate; 11497 this.targetsByName = new Multimap; 11498 } 11499 start() { 11500 if (!this.tokenListObserver) { 11501 this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this); 11502 this.tokenListObserver.start(); 11503 } 11504 } 11505 stop() { 11506 if (this.tokenListObserver) { 11507 this.disconnectAllTargets(); 11508 this.tokenListObserver.stop(); 11509 delete this.tokenListObserver; 11510 } 11511 } 11512 tokenMatched({ element, content: name }) { 11513 if (this.scope.containsElement(element)) { 11514 this.connectTarget(element, name); 11515 } 11516 } 11517 tokenUnmatched({ element, content: name }) { 11518 this.disconnectTarget(element, name); 11519 } 11520 connectTarget(element, name) { 11521 var _a; 11522 if (!this.targetsByName.has(name, element)) { 11523 this.targetsByName.add(name, element); 11524 (_a = this.tokenListObserver) === null || _a === undefined || _a.pause(() => this.delegate.targetConnected(element, name)); 11525 } 11526 } 11527 disconnectTarget(element, name) { 11528 var _a; 11529 if (this.targetsByName.has(name, element)) { 11530 this.targetsByName.delete(name, element); 11531 (_a = this.tokenListObserver) === null || _a === undefined || _a.pause(() => this.delegate.targetDisconnected(element, name)); 11532 } 11533 } 11534 disconnectAllTargets() { 11535 for (const name of this.targetsByName.keys) { 11536 for (const element of this.targetsByName.getValuesForKey(name)) { 11537 this.disconnectTarget(element, name); 11538 } 11539 } 11540 } 11541 get attributeName() { 11542 return `data-${this.context.identifier}-target`; 11543 } 11544 get element() { 11545 return this.context.element; 11546 } 11547 get scope() { 11548 return this.context.scope; 11549 } 11550} 11551function readInheritableStaticArrayValues(constructor, propertyName) { 11552 const ancestors = getAncestorsForConstructor(constructor); 11553 return Array.from(ancestors.reduce((values, constructor2) => { 11554 getOwnStaticArrayValues(constructor2, propertyName).forEach((name) => values.add(name)); 11555 return values; 11556 }, new Set)); 11557} 11558function readInheritableStaticObjectPairs(constructor, propertyName) { 11559 const ancestors = getAncestorsForConstructor(constructor); 11560 return ancestors.reduce((pairs, constructor2) => { 11561 pairs.push(...getOwnStaticObjectPairs(constructor2, propertyName)); 11562 return pairs; 11563 }, []); 11564} 11565function getAncestorsForConstructor(constructor) { 11566 const ancestors = []; 11567 while (constructor) { 11568 ancestors.push(constructor); 11569 constructor = Object.getPrototypeOf(constructor); 11570 } 11571 return ancestors.reverse(); 11572} 11573function getOwnStaticArrayValues(constructor, propertyName) { 11574 const definition = constructor[propertyName]; 11575 return Array.isArray(definition) ? definition : []; 11576} 11577function getOwnStaticObjectPairs(constructor, propertyName) { 11578 const definition = constructor[propertyName]; 11579 return definition ? Object.keys(definition).map((key) => [key, definition[key]]) : []; 11580} 11581 11582class OutletObserver { 11583 constructor(context, delegate) { 11584 this.started = false; 11585 this.context = context; 11586 this.delegate = delegate; 11587 this.outletsByName = new Multimap; 11588 this.outletElementsByName = new Multimap; 11589 this.selectorObserverMap = new Map; 11590 this.attributeObserverMap = new Map; 11591 } 11592 start() { 11593 if (!this.started) { 11594 this.outletDefinitions.forEach((outletName) => { 11595 this.setupSelectorObserverForOutlet(outletName); 11596 this.setupAttributeObserverForOutlet(outletName); 11597 }); 11598 this.started = true; 11599 this.dependentContexts.forEach((context) => context.refresh()); 11600 } 11601 } 11602 refresh() { 11603 this.selectorObserverMap.forEach((observer) => observer.refresh()); 11604 this.attributeObserverMap.forEach((observer) => observer.refresh()); 11605 } 11606 stop() { 11607 if (this.started) { 11608 this.started = false; 11609 this.disconnectAllOutlets(); 11610 this.stopSelectorObservers(); 11611 this.stopAttributeObservers(); 11612 } 11613 } 11614 stopSelectorObservers() { 11615 if (this.selectorObserverMap.size > 0) { 11616 this.selectorObserverMap.forEach((observer) => observer.stop()); 11617 this.selectorObserverMap.clear(); 11618 } 11619 } 11620 stopAttributeObservers() { 11621 if (this.attributeObserverMap.size > 0) { 11622 this.attributeObserverMap.forEach((observer) => observer.stop()); 11623 this.attributeObserverMap.clear(); 11624 } 11625 } 11626 selectorMatched(element, _selector, { outletName }) { 11627 const outlet = this.getOutlet(element, outletName); 11628 if (outlet) { 11629 this.connectOutlet(outlet, element, outletName); 11630 } 11631 } 11632 selectorUnmatched(element, _selector, { outletName }) { 11633 const outlet = this.getOutletFromMap(element, outletName); 11634 if (outlet) { 11635 this.disconnectOutlet(outlet, element, outletName); 11636 } 11637 } 11638 selectorMatchElement(element, { outletName }) { 11639 const selector = this.selector(outletName); 11640 const hasOutlet = this.hasOutlet(element, outletName); 11641 const hasOutletController = element.matches(`[${this.schema.controllerAttribute}~=${outletName}]`); 11642 if (selector) { 11643 return hasOutlet && hasOutletController && element.matches(selector); 11644 } else { 11645 return false; 11646 } 11647 } 11648 elementMatchedAttribute(_element, attributeName) { 11649 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 11650 if (outletName) { 11651 this.updateSelectorObserverForOutlet(outletName); 11652 } 11653 } 11654 elementAttributeValueChanged(_element, attributeName) { 11655 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 11656 if (outletName) { 11657 this.updateSelectorObserverForOutlet(outletName); 11658 } 11659 } 11660 elementUnmatchedAttribute(_element, attributeName) { 11661 const outletName = this.getOutletNameFromOutletAttributeName(attributeName); 11662 if (outletName) { 11663 this.updateSelectorObserverForOutlet(outletName); 11664 } 11665 } 11666 connectOutlet(outlet, element, outletName) { 11667 var _a; 11668 if (!this.outletElementsByName.has(outletName, element)) { 11669 this.outletsByName.add(outletName, outlet); 11670 this.outletElementsByName.add(outletName, element); 11671 (_a = this.selectorObserverMap.get(outletName)) === null || _a === undefined || _a.pause(() => this.delegate.outletConnected(outlet, element, outletName)); 11672 } 11673 } 11674 disconnectOutlet(outlet, element, outletName) { 11675 var _a; 11676 if (this.outletElementsByName.has(outletName, element)) { 11677 this.outletsByName.delete(outletName, outlet); 11678 this.outletElementsByName.delete(outletName, element); 11679 (_a = this.selectorObserverMap.get(outletName)) === null || _a === undefined || _a.pause(() => this.delegate.outletDisconnected(outlet, element, outletName)); 11680 } 11681 } 11682 disconnectAllOutlets() { 11683 for (const outletName of this.outletElementsByName.keys) { 11684 for (const element of this.outletElementsByName.getValuesForKey(outletName)) { 11685 for (const outlet of this.outletsByName.getValuesForKey(outletName)) { 11686 this.disconnectOutlet(outlet, element, outletName); 11687 } 11688 } 11689 } 11690 } 11691 updateSelectorObserverForOutlet(outletName) { 11692 const observer = this.selectorObserverMap.get(outletName); 11693 if (observer) { 11694 observer.selector = this.selector(outletName); 11695 } 11696 } 11697 setupSelectorObserverForOutlet(outletName) { 11698 const selector = this.selector(outletName); 11699 const selectorObserver = new SelectorObserver(document.body, selector, this, { outletName }); 11700 this.selectorObserverMap.set(outletName, selectorObserver); 11701 selectorObserver.start(); 11702 } 11703 setupAttributeObserverForOutlet(outletName) { 11704 const attributeName = this.attributeNameForOutletName(outletName); 11705 const attributeObserver = new AttributeObserver(this.scope.element, attributeName, this); 11706 this.attributeObserverMap.set(outletName, attributeObserver); 11707 attributeObserver.start(); 11708 } 11709 selector(outletName) { 11710 return this.scope.outlets.getSelectorForOutletName(outletName); 11711 } 11712 attributeNameForOutletName(outletName) { 11713 return this.scope.schema.outletAttributeForScope(this.identifier, outletName); 11714 } 11715 getOutletNameFromOutletAttributeName(attributeName) { 11716 return this.outletDefinitions.find((outletName) => this.attributeNameForOutletName(outletName) === attributeName); 11717 } 11718 get outletDependencies() { 11719 const dependencies = new Multimap; 11720 this.router.modules.forEach((module) => { 11721 const constructor = module.definition.controllerConstructor; 11722 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 11723 outlets.forEach((outlet) => dependencies.add(outlet, module.identifier)); 11724 }); 11725 return dependencies; 11726 } 11727 get outletDefinitions() { 11728 return this.outletDependencies.getKeysForValue(this.identifier); 11729 } 11730 get dependentControllerIdentifiers() { 11731 return this.outletDependencies.getValuesForKey(this.identifier); 11732 } 11733 get dependentContexts() { 11734 const identifiers = this.dependentControllerIdentifiers; 11735 return this.router.contexts.filter((context) => identifiers.includes(context.identifier)); 11736 } 11737 hasOutlet(element, outletName) { 11738 return !!this.getOutlet(element, outletName) || !!this.getOutletFromMap(element, outletName); 11739 } 11740 getOutlet(element, outletName) { 11741 return this.application.getControllerForElementAndIdentifier(element, outletName); 11742 } 11743 getOutletFromMap(element, outletName) { 11744 return this.outletsByName.getValuesForKey(outletName).find((outlet) => outlet.element === element); 11745 } 11746 get scope() { 11747 return this.context.scope; 11748 } 11749 get schema() { 11750 return this.context.schema; 11751 } 11752 get identifier() { 11753 return this.context.identifier; 11754 } 11755 get application() { 11756 return this.context.application; 11757 } 11758 get router() { 11759 return this.application.router; 11760 } 11761} 11762 11763class Context { 11764 constructor(module, scope) { 11765 this.logDebugActivity = (functionName, detail = {}) => { 11766 const { identifier, controller, element } = this; 11767 detail = Object.assign({ identifier, controller, element }, detail); 11768 this.application.logDebugActivity(this.identifier, functionName, detail); 11769 }; 11770 this.module = module; 11771 this.scope = scope; 11772 this.controller = new module.controllerConstructor(this); 11773 this.bindingObserver = new BindingObserver(this, this.dispatcher); 11774 this.valueObserver = new ValueObserver(this, this.controller); 11775 this.targetObserver = new TargetObserver(this, this); 11776 this.outletObserver = new OutletObserver(this, this); 11777 try { 11778 this.controller.initialize(); 11779 this.logDebugActivity("initialize"); 11780 } catch (error2) { 11781 this.handleError(error2, "initializing controller"); 11782 } 11783 } 11784 connect() { 11785 this.bindingObserver.start(); 11786 this.valueObserver.start(); 11787 this.targetObserver.start(); 11788 this.outletObserver.start(); 11789 try { 11790 this.controller.connect(); 11791 this.logDebugActivity("connect"); 11792 } catch (error2) { 11793 this.handleError(error2, "connecting controller"); 11794 } 11795 } 11796 refresh() { 11797 this.outletObserver.refresh(); 11798 } 11799 disconnect() { 11800 try { 11801 this.controller.disconnect(); 11802 this.logDebugActivity("disconnect"); 11803 } catch (error2) { 11804 this.handleError(error2, "disconnecting controller"); 11805 } 11806 this.outletObserver.stop(); 11807 this.targetObserver.stop(); 11808 this.valueObserver.stop(); 11809 this.bindingObserver.stop(); 11810 } 11811 get application() { 11812 return this.module.application; 11813 } 11814 get identifier() { 11815 return this.module.identifier; 11816 } 11817 get schema() { 11818 return this.application.schema; 11819 } 11820 get dispatcher() { 11821 return this.application.dispatcher; 11822 } 11823 get element() { 11824 return this.scope.element; 11825 } 11826 get parentElement() { 11827 return this.element.parentElement; 11828 } 11829 handleError(error2, message, detail = {}) { 11830 const { identifier, controller, element } = this; 11831 detail = Object.assign({ identifier, controller, element }, detail); 11832 this.application.handleError(error2, `Error ${message}`, detail); 11833 } 11834 targetConnected(element, name) { 11835 this.invokeControllerMethod(`${name}TargetConnected`, element); 11836 } 11837 targetDisconnected(element, name) { 11838 this.invokeControllerMethod(`${name}TargetDisconnected`, element); 11839 } 11840 outletConnected(outlet, element, name) { 11841 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletConnected`, outlet, element); 11842 } 11843 outletDisconnected(outlet, element, name) { 11844 this.invokeControllerMethod(`${namespaceCamelize(name)}OutletDisconnected`, outlet, element); 11845 } 11846 invokeControllerMethod(methodName, ...args) { 11847 const controller = this.controller; 11848 if (typeof controller[methodName] == "function") { 11849 controller[methodName](...args); 11850 } 11851 } 11852} 11853function bless(constructor) { 11854 return shadow(constructor, getBlessedProperties(constructor)); 11855} 11856function shadow(constructor, properties) { 11857 const shadowConstructor = extend2(constructor); 11858 const shadowProperties = getShadowProperties(constructor.prototype, properties); 11859 Object.defineProperties(shadowConstructor.prototype, shadowProperties); 11860 return shadowConstructor; 11861} 11862function getBlessedProperties(constructor) { 11863 const blessings = readInheritableStaticArrayValues(constructor, "blessings"); 11864 return blessings.reduce((blessedProperties, blessing) => { 11865 const properties = blessing(constructor); 11866 for (const key in properties) { 11867 const descriptor = blessedProperties[key] || {}; 11868 blessedProperties[key] = Object.assign(descriptor, properties[key]); 11869 } 11870 return blessedProperties; 11871 }, {}); 11872} 11873function getShadowProperties(prototype, properties) { 11874 return getOwnKeys(properties).reduce((shadowProperties, key) => { 11875 const descriptor = getShadowedDescriptor(prototype, properties, key); 11876 if (descriptor) { 11877 Object.assign(shadowProperties, { [key]: descriptor }); 11878 } 11879 return shadowProperties; 11880 }, {}); 11881} 11882function getShadowedDescriptor(prototype, properties, key) { 11883 const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key); 11884 const shadowedByValue = shadowingDescriptor && "value" in shadowingDescriptor; 11885 if (!shadowedByValue) { 11886 const descriptor = Object.getOwnPropertyDescriptor(properties, key).value; 11887 if (shadowingDescriptor) { 11888 descriptor.get = shadowingDescriptor.get || descriptor.get; 11889 descriptor.set = shadowingDescriptor.set || descriptor.set; 11890 } 11891 return descriptor; 11892 } 11893} 11894var getOwnKeys = (() => { 11895 if (typeof Object.getOwnPropertySymbols == "function") { 11896 return (object) => [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)]; 11897 } else { 11898 return Object.getOwnPropertyNames; 11899 } 11900})(); 11901var extend2 = (() => { 11902 function extendWithReflect(constructor) { 11903 function extended() { 11904 return Reflect.construct(constructor, arguments, new.target); 11905 } 11906 extended.prototype = Object.create(constructor.prototype, { 11907 constructor: { value: extended } 11908 }); 11909 Reflect.setPrototypeOf(extended, constructor); 11910 return extended; 11911 } 11912 function testReflectExtension() { 11913 const a = function() { 11914 this.a.call(this); 11915 }; 11916 const b = extendWithReflect(a); 11917 b.prototype.a = function() {}; 11918 return new b; 11919 } 11920 try { 11921 testReflectExtension(); 11922 return extendWithReflect; 11923 } catch (error2) { 11924 return (constructor) => class extended extends constructor { 11925 }; 11926 } 11927})(); 11928function blessDefinition(definition) { 11929 return { 11930 identifier: definition.identifier, 11931 controllerConstructor: bless(definition.controllerConstructor) 11932 }; 11933} 11934 11935class Module { 11936 constructor(application, definition) { 11937 this.application = application; 11938 this.definition = blessDefinition(definition); 11939 this.contextsByScope = new WeakMap; 11940 this.connectedContexts = new Set; 11941 } 11942 get identifier() { 11943 return this.definition.identifier; 11944 } 11945 get controllerConstructor() { 11946 return this.definition.controllerConstructor; 11947 } 11948 get contexts() { 11949 return Array.from(this.connectedContexts); 11950 } 11951 connectContextForScope(scope) { 11952 const context = this.fetchContextForScope(scope); 11953 this.connectedContexts.add(context); 11954 context.connect(); 11955 } 11956 disconnectContextForScope(scope) { 11957 const context = this.contextsByScope.get(scope); 11958 if (context) { 11959 this.connectedContexts.delete(context); 11960 context.disconnect(); 11961 } 11962 } 11963 fetchContextForScope(scope) { 11964 let context = this.contextsByScope.get(scope); 11965 if (!context) { 11966 context = new Context(this, scope); 11967 this.contextsByScope.set(scope, context); 11968 } 11969 return context; 11970 } 11971} 11972 11973class ClassMap { 11974 constructor(scope) { 11975 this.scope = scope; 11976 } 11977 has(name) { 11978 return this.data.has(this.getDataKey(name)); 11979 } 11980 get(name) { 11981 return this.getAll(name)[0]; 11982 } 11983 getAll(name) { 11984 const tokenString = this.data.get(this.getDataKey(name)) || ""; 11985 return tokenize(tokenString); 11986 } 11987 getAttributeName(name) { 11988 return this.data.getAttributeNameForKey(this.getDataKey(name)); 11989 } 11990 getDataKey(name) { 11991 return `${name}-class`; 11992 } 11993 get data() { 11994 return this.scope.data; 11995 } 11996} 11997 11998class DataMap { 11999 constructor(scope) { 12000 this.scope = scope; 12001 } 12002 get element() { 12003 return this.scope.element; 12004 } 12005 get identifier() { 12006 return this.scope.identifier; 12007 } 12008 get(key) { 12009 const name = this.getAttributeNameForKey(key); 12010 return this.element.getAttribute(name); 12011 } 12012 set(key, value) { 12013 const name = this.getAttributeNameForKey(key); 12014 this.element.setAttribute(name, value); 12015 return this.get(key); 12016 } 12017 has(key) { 12018 const name = this.getAttributeNameForKey(key); 12019 return this.element.hasAttribute(name); 12020 } 12021 delete(key) { 12022 if (this.has(key)) { 12023 const name = this.getAttributeNameForKey(key); 12024 this.element.removeAttribute(name); 12025 return true; 12026 } else { 12027 return false; 12028 } 12029 } 12030 getAttributeNameForKey(key) { 12031 return `data-${this.identifier}-${dasherize(key)}`; 12032 } 12033} 12034 12035class Guide { 12036 constructor(logger) { 12037 this.warnedKeysByObject = new WeakMap; 12038 this.logger = logger; 12039 } 12040 warn(object, key, message) { 12041 let warnedKeys = this.warnedKeysByObject.get(object); 12042 if (!warnedKeys) { 12043 warnedKeys = new Set; 12044 this.warnedKeysByObject.set(object, warnedKeys); 12045 } 12046 if (!warnedKeys.has(key)) { 12047 warnedKeys.add(key); 12048 this.logger.warn(message, object); 12049 } 12050 } 12051} 12052function attributeValueContainsToken(attributeName, token) { 12053 return `[${attributeName}~="${token}"]`; 12054} 12055 12056class TargetSet { 12057 constructor(scope) { 12058 this.scope = scope; 12059 } 12060 get element() { 12061 return this.scope.element; 12062 } 12063 get identifier() { 12064 return this.scope.identifier; 12065 } 12066 get schema() { 12067 return this.scope.schema; 12068 } 12069 has(targetName) { 12070 return this.find(targetName) != null; 12071 } 12072 find(...targetNames) { 12073 return targetNames.reduce((target, targetName) => target || this.findTarget(targetName) || this.findLegacyTarget(targetName), undefined); 12074 } 12075 findAll(...targetNames) { 12076 return targetNames.reduce((targets, targetName) => [ 12077 ...targets, 12078 ...this.findAllTargets(targetName), 12079 ...this.findAllLegacyTargets(targetName) 12080 ], []); 12081 } 12082 findTarget(targetName) { 12083 const selector = this.getSelectorForTargetName(targetName); 12084 return this.scope.findElement(selector); 12085 } 12086 findAllTargets(targetName) { 12087 const selector = this.getSelectorForTargetName(targetName); 12088 return this.scope.findAllElements(selector); 12089 } 12090 getSelectorForTargetName(targetName) { 12091 const attributeName = this.schema.targetAttributeForScope(this.identifier); 12092 return attributeValueContainsToken(attributeName, targetName); 12093 } 12094 findLegacyTarget(targetName) { 12095 const selector = this.getLegacySelectorForTargetName(targetName); 12096 return this.deprecate(this.scope.findElement(selector), targetName); 12097 } 12098 findAllLegacyTargets(targetName) { 12099 const selector = this.getLegacySelectorForTargetName(targetName); 12100 return this.scope.findAllElements(selector).map((element) => this.deprecate(element, targetName)); 12101 } 12102 getLegacySelectorForTargetName(targetName) { 12103 const targetDescriptor = `${this.identifier}.${targetName}`; 12104 return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor); 12105 } 12106 deprecate(element, targetName) { 12107 if (element) { 12108 const { identifier } = this; 12109 const attributeName = this.schema.targetAttribute; 12110 const revisedAttributeName = this.schema.targetAttributeForScope(identifier); 12111 this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}="${identifier}.${targetName}" with ${revisedAttributeName}="${targetName}". ` + `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`); 12112 } 12113 return element; 12114 } 12115 get guide() { 12116 return this.scope.guide; 12117 } 12118} 12119 12120class OutletSet { 12121 constructor(scope, controllerElement) { 12122 this.scope = scope; 12123 this.controllerElement = controllerElement; 12124 } 12125 get element() { 12126 return this.scope.element; 12127 } 12128 get identifier() { 12129 return this.scope.identifier; 12130 } 12131 get schema() { 12132 return this.scope.schema; 12133 } 12134 has(outletName) { 12135 return this.find(outletName) != null; 12136 } 12137 find(...outletNames) { 12138 return outletNames.reduce((outlet, outletName) => outlet || this.findOutlet(outletName), undefined); 12139 } 12140 findAll(...outletNames) { 12141 return outletNames.reduce((outlets, outletName) => [...outlets, ...this.findAllOutlets(outletName)], []); 12142 } 12143 getSelectorForOutletName(outletName) { 12144 const attributeName = this.schema.outletAttributeForScope(this.identifier, outletName); 12145 return this.controllerElement.getAttribute(attributeName); 12146 } 12147 findOutlet(outletName) { 12148 const selector = this.getSelectorForOutletName(outletName); 12149 if (selector) 12150 return this.findElement(selector, outletName); 12151 } 12152 findAllOutlets(outletName) { 12153 const selector = this.getSelectorForOutletName(outletName); 12154 return selector ? this.findAllElements(selector, outletName) : []; 12155 } 12156 findElement(selector, outletName) { 12157 const elements = this.scope.queryElements(selector); 12158 return elements.filter((element) => this.matchesElement(element, selector, outletName))[0]; 12159 } 12160 findAllElements(selector, outletName) { 12161 const elements = this.scope.queryElements(selector); 12162 return elements.filter((element) => this.matchesElement(element, selector, outletName)); 12163 } 12164 matchesElement(element, selector, outletName) { 12165 const controllerAttribute = element.getAttribute(this.scope.schema.controllerAttribute) || ""; 12166 return element.matches(selector) && controllerAttribute.split(" ").includes(outletName); 12167 } 12168} 12169 12170class Scope { 12171 constructor(schema, element, identifier, logger) { 12172 this.targets = new TargetSet(this); 12173 this.classes = new ClassMap(this); 12174 this.data = new DataMap(this); 12175 this.containsElement = (element2) => { 12176 return element2.closest(this.controllerSelector) === this.element; 12177 }; 12178 this.schema = schema; 12179 this.element = element; 12180 this.identifier = identifier; 12181 this.guide = new Guide(logger); 12182 this.outlets = new OutletSet(this.documentScope, element); 12183 } 12184 findElement(selector) { 12185 return this.element.matches(selector) ? this.element : this.queryElements(selector).find(this.containsElement); 12186 } 12187 findAllElements(selector) { 12188 return [ 12189 ...this.element.matches(selector) ? [this.element] : [], 12190 ...this.queryElements(selector).filter(this.containsElement) 12191 ]; 12192 } 12193 queryElements(selector) { 12194 return Array.from(this.element.querySelectorAll(selector)); 12195 } 12196 get controllerSelector() { 12197 return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier); 12198 } 12199 get isDocumentScope() { 12200 return this.element === document.documentElement; 12201 } 12202 get documentScope() { 12203 return this.isDocumentScope ? this : new Scope(this.schema, document.documentElement, this.identifier, this.guide.logger); 12204 } 12205} 12206 12207class ScopeObserver { 12208 constructor(element, schema, delegate) { 12209 this.element = element; 12210 this.schema = schema; 12211 this.delegate = delegate; 12212 this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this); 12213 this.scopesByIdentifierByElement = new WeakMap; 12214 this.scopeReferenceCounts = new WeakMap; 12215 } 12216 start() { 12217 this.valueListObserver.start(); 12218 } 12219 stop() { 12220 this.valueListObserver.stop(); 12221 } 12222 get controllerAttribute() { 12223 return this.schema.controllerAttribute; 12224 } 12225 parseValueForToken(token) { 12226 const { element, content: identifier } = token; 12227 return this.parseValueForElementAndIdentifier(element, identifier); 12228 } 12229 parseValueForElementAndIdentifier(element, identifier) { 12230 const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element); 12231 let scope = scopesByIdentifier.get(identifier); 12232 if (!scope) { 12233 scope = this.delegate.createScopeForElementAndIdentifier(element, identifier); 12234 scopesByIdentifier.set(identifier, scope); 12235 } 12236 return scope; 12237 } 12238 elementMatchedValue(element, value) { 12239 const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1; 12240 this.scopeReferenceCounts.set(value, referenceCount); 12241 if (referenceCount == 1) { 12242 this.delegate.scopeConnected(value); 12243 } 12244 } 12245 elementUnmatchedValue(element, value) { 12246 const referenceCount = this.scopeReferenceCounts.get(value); 12247 if (referenceCount) { 12248 this.scopeReferenceCounts.set(value, referenceCount - 1); 12249 if (referenceCount == 1) { 12250 this.delegate.scopeDisconnected(value); 12251 } 12252 } 12253 } 12254 fetchScopesByIdentifierForElement(element) { 12255 let scopesByIdentifier = this.scopesByIdentifierByElement.get(element); 12256 if (!scopesByIdentifier) { 12257 scopesByIdentifier = new Map; 12258 this.scopesByIdentifierByElement.set(element, scopesByIdentifier); 12259 } 12260 return scopesByIdentifier; 12261 } 12262} 12263 12264class Router { 12265 constructor(application) { 12266 this.application = application; 12267 this.scopeObserver = new ScopeObserver(this.element, this.schema, this); 12268 this.scopesByIdentifier = new Multimap; 12269 this.modulesByIdentifier = new Map; 12270 } 12271 get element() { 12272 return this.application.element; 12273 } 12274 get schema() { 12275 return this.application.schema; 12276 } 12277 get logger() { 12278 return this.application.logger; 12279 } 12280 get controllerAttribute() { 12281 return this.schema.controllerAttribute; 12282 } 12283 get modules() { 12284 return Array.from(this.modulesByIdentifier.values()); 12285 } 12286 get contexts() { 12287 return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []); 12288 } 12289 start() { 12290 this.scopeObserver.start(); 12291 } 12292 stop() { 12293 this.scopeObserver.stop(); 12294 } 12295 loadDefinition(definition) { 12296 this.unloadIdentifier(definition.identifier); 12297 const module = new Module(this.application, definition); 12298 this.connectModule(module); 12299 const afterLoad = definition.controllerConstructor.afterLoad; 12300 if (afterLoad) { 12301 afterLoad.call(definition.controllerConstructor, definition.identifier, this.application); 12302 } 12303 } 12304 unloadIdentifier(identifier) { 12305 const module = this.modulesByIdentifier.get(identifier); 12306 if (module) { 12307 this.disconnectModule(module); 12308 } 12309 } 12310 getContextForElementAndIdentifier(element, identifier) { 12311 const module = this.modulesByIdentifier.get(identifier); 12312 if (module) { 12313 return module.contexts.find((context) => context.element == element); 12314 } 12315 } 12316 proposeToConnectScopeForElementAndIdentifier(element, identifier) { 12317 const scope = this.scopeObserver.parseValueForElementAndIdentifier(element, identifier); 12318 if (scope) { 12319 this.scopeObserver.elementMatchedValue(scope.element, scope); 12320 } else { 12321 console.error(`Couldn't find or create scope for identifier: "${identifier}" and element:`, element); 12322 } 12323 } 12324 handleError(error2, message, detail) { 12325 this.application.handleError(error2, message, detail); 12326 } 12327 createScopeForElementAndIdentifier(element, identifier) { 12328 return new Scope(this.schema, element, identifier, this.logger); 12329 } 12330 scopeConnected(scope) { 12331 this.scopesByIdentifier.add(scope.identifier, scope); 12332 const module = this.modulesByIdentifier.get(scope.identifier); 12333 if (module) { 12334 module.connectContextForScope(scope); 12335 } 12336 } 12337 scopeDisconnected(scope) { 12338 this.scopesByIdentifier.delete(scope.identifier, scope); 12339 const module = this.modulesByIdentifier.get(scope.identifier); 12340 if (module) { 12341 module.disconnectContextForScope(scope); 12342 } 12343 } 12344 connectModule(module) { 12345 this.modulesByIdentifier.set(module.identifier, module); 12346 const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier); 12347 scopes.forEach((scope) => module.connectContextForScope(scope)); 12348 } 12349 disconnectModule(module) { 12350 this.modulesByIdentifier.delete(module.identifier); 12351 const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier); 12352 scopes.forEach((scope) => module.disconnectContextForScope(scope)); 12353 } 12354} 12355var defaultSchema = { 12356 controllerAttribute: "data-controller", 12357 actionAttribute: "data-action", 12358 targetAttribute: "data-target", 12359 targetAttributeForScope: (identifier) => `data-${identifier}-target`, 12360 outletAttributeForScope: (identifier, outlet) => `data-${identifier}-${outlet}-outlet`, 12361 keyMappings: Object.assign(Object.assign({ enter: "Enter", tab: "Tab", esc: "Escape", space: " ", up: "ArrowUp", down: "ArrowDown", left: "ArrowLeft", right: "ArrowRight", home: "Home", end: "End", page_up: "PageUp", page_down: "PageDown" }, objectFromEntries("abcdefghijklmnopqrstuvwxyz".split("").map((c) => [c, c]))), objectFromEntries("0123456789".split("").map((n) => [n, n]))) 12362}; 12363function objectFromEntries(array) { 12364 return array.reduce((memo, [k, v]) => Object.assign(Object.assign({}, memo), { [k]: v }), {}); 12365} 12366 12367class Application { 12368 constructor(element = document.documentElement, schema = defaultSchema) { 12369 this.logger = console; 12370 this.debug = false; 12371 this.logDebugActivity = (identifier, functionName, detail = {}) => { 12372 if (this.debug) { 12373 this.logFormattedMessage(identifier, functionName, detail); 12374 } 12375 }; 12376 this.element = element; 12377 this.schema = schema; 12378 this.dispatcher = new Dispatcher(this); 12379 this.router = new Router(this); 12380 this.actionDescriptorFilters = Object.assign({}, defaultActionDescriptorFilters); 12381 } 12382 static start(element, schema) { 12383 const application = new this(element, schema); 12384 application.start(); 12385 return application; 12386 } 12387 async start() { 12388 await domReady(); 12389 this.logDebugActivity("application", "starting"); 12390 this.dispatcher.start(); 12391 this.router.start(); 12392 this.logDebugActivity("application", "start"); 12393 } 12394 stop() { 12395 this.logDebugActivity("application", "stopping"); 12396 this.dispatcher.stop(); 12397 this.router.stop(); 12398 this.logDebugActivity("application", "stop"); 12399 } 12400 register(identifier, controllerConstructor) { 12401 this.load({ identifier, controllerConstructor }); 12402 } 12403 registerActionOption(name, filter) { 12404 this.actionDescriptorFilters[name] = filter; 12405 } 12406 load(head, ...rest) { 12407 const definitions = Array.isArray(head) ? head : [head, ...rest]; 12408 definitions.forEach((definition) => { 12409 if (definition.controllerConstructor.shouldLoad) { 12410 this.router.loadDefinition(definition); 12411 } 12412 }); 12413 } 12414 unload(head, ...rest) { 12415 const identifiers = Array.isArray(head) ? head : [head, ...rest]; 12416 identifiers.forEach((identifier) => this.router.unloadIdentifier(identifier)); 12417 } 12418 get controllers() { 12419 return this.router.contexts.map((context) => context.controller); 12420 } 12421 getControllerForElementAndIdentifier(element, identifier) { 12422 const context = this.router.getContextForElementAndIdentifier(element, identifier); 12423 return context ? context.controller : null; 12424 } 12425 handleError(error2, message, detail) { 12426 var _a; 12427 this.logger.error(`%s 12428 12429%o 12430 12431%o`, message, error2, detail); 12432 (_a = window.onerror) === null || _a === undefined || _a.call(window, message, "", 0, 0, error2); 12433 } 12434 logFormattedMessage(identifier, functionName, detail = {}) { 12435 detail = Object.assign({ application: this }, detail); 12436 this.logger.groupCollapsed(`${identifier} #${functionName}`); 12437 this.logger.log("details:", Object.assign({}, detail)); 12438 this.logger.groupEnd(); 12439 } 12440} 12441function domReady() { 12442 return new Promise((resolve) => { 12443 if (document.readyState == "loading") { 12444 document.addEventListener("DOMContentLoaded", () => resolve()); 12445 } else { 12446 resolve(); 12447 } 12448 }); 12449} 12450function ClassPropertiesBlessing(constructor) { 12451 const classes = readInheritableStaticArrayValues(constructor, "classes"); 12452 return classes.reduce((properties, classDefinition) => { 12453 return Object.assign(properties, propertiesForClassDefinition(classDefinition)); 12454 }, {}); 12455} 12456function propertiesForClassDefinition(key) { 12457 return { 12458 [`${key}Class`]: { 12459 get() { 12460 const { classes } = this; 12461 if (classes.has(key)) { 12462 return classes.get(key); 12463 } else { 12464 const attribute = classes.getAttributeName(key); 12465 throw new Error(`Missing attribute "${attribute}"`); 12466 } 12467 } 12468 }, 12469 [`${key}Classes`]: { 12470 get() { 12471 return this.classes.getAll(key); 12472 } 12473 }, 12474 [`has${capitalize(key)}Class`]: { 12475 get() { 12476 return this.classes.has(key); 12477 } 12478 } 12479 }; 12480} 12481function OutletPropertiesBlessing(constructor) { 12482 const outlets = readInheritableStaticArrayValues(constructor, "outlets"); 12483 return outlets.reduce((properties, outletDefinition) => { 12484 return Object.assign(properties, propertiesForOutletDefinition(outletDefinition)); 12485 }, {}); 12486} 12487function getOutletController(controller, element, identifier) { 12488 return controller.application.getControllerForElementAndIdentifier(element, identifier); 12489} 12490function getControllerAndEnsureConnectedScope(controller, element, outletName) { 12491 let outletController = getOutletController(controller, element, outletName); 12492 if (outletController) 12493 return outletController; 12494 controller.application.router.proposeToConnectScopeForElementAndIdentifier(element, outletName); 12495 outletController = getOutletController(controller, element, outletName); 12496 if (outletController) 12497 return outletController; 12498} 12499function propertiesForOutletDefinition(name) { 12500 const camelizedName = namespaceCamelize(name); 12501 return { 12502 [`${camelizedName}Outlet`]: { 12503 get() { 12504 const outletElement = this.outlets.find(name); 12505 const selector = this.outlets.getSelectorForOutletName(name); 12506 if (outletElement) { 12507 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 12508 if (outletController) 12509 return outletController; 12510 throw new Error(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`); 12511 } 12512 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); 12513 } 12514 }, 12515 [`${camelizedName}Outlets`]: { 12516 get() { 12517 const outlets = this.outlets.findAll(name); 12518 if (outlets.length > 0) { 12519 return outlets.map((outletElement) => { 12520 const outletController = getControllerAndEnsureConnectedScope(this, outletElement, name); 12521 if (outletController) 12522 return outletController; 12523 console.warn(`The provided outlet element is missing an outlet controller "${name}" instance for host controller "${this.identifier}"`, outletElement); 12524 }).filter((controller) => controller); 12525 } 12526 return []; 12527 } 12528 }, 12529 [`${camelizedName}OutletElement`]: { 12530 get() { 12531 const outletElement = this.outlets.find(name); 12532 const selector = this.outlets.getSelectorForOutletName(name); 12533 if (outletElement) { 12534 return outletElement; 12535 } else { 12536 throw new Error(`Missing outlet element "${name}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${selector}".`); 12537 } 12538 } 12539 }, 12540 [`${camelizedName}OutletElements`]: { 12541 get() { 12542 return this.outlets.findAll(name); 12543 } 12544 }, 12545 [`has${capitalize(camelizedName)}Outlet`]: { 12546 get() { 12547 return this.outlets.has(name); 12548 } 12549 } 12550 }; 12551} 12552function TargetPropertiesBlessing(constructor) { 12553 const targets = readInheritableStaticArrayValues(constructor, "targets"); 12554 return targets.reduce((properties, targetDefinition) => { 12555 return Object.assign(properties, propertiesForTargetDefinition(targetDefinition)); 12556 }, {}); 12557} 12558function propertiesForTargetDefinition(name) { 12559 return { 12560 [`${name}Target`]: { 12561 get() { 12562 const target = this.targets.find(name); 12563 if (target) { 12564 return target; 12565 } else { 12566 throw new Error(`Missing target element "${name}" for "${this.identifier}" controller`); 12567 } 12568 } 12569 }, 12570 [`${name}Targets`]: { 12571 get() { 12572 return this.targets.findAll(name); 12573 } 12574 }, 12575 [`has${capitalize(name)}Target`]: { 12576 get() { 12577 return this.targets.has(name); 12578 } 12579 } 12580 }; 12581} 12582function ValuePropertiesBlessing(constructor) { 12583 const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, "values"); 12584 const propertyDescriptorMap = { 12585 valueDescriptorMap: { 12586 get() { 12587 return valueDefinitionPairs.reduce((result, valueDefinitionPair) => { 12588 const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier); 12589 const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key); 12590 return Object.assign(result, { [attributeName]: valueDescriptor }); 12591 }, {}); 12592 } 12593 } 12594 }; 12595 return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => { 12596 return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair)); 12597 }, propertyDescriptorMap); 12598} 12599function propertiesForValueDefinitionPair(valueDefinitionPair, controller) { 12600 const definition = parseValueDefinitionPair(valueDefinitionPair, controller); 12601 const { key, name, reader: read, writer: write } = definition; 12602 return { 12603 [name]: { 12604 get() { 12605 const value = this.data.get(key); 12606 if (value !== null) { 12607 return read(value); 12608 } else { 12609 return definition.defaultValue; 12610 } 12611 }, 12612 set(value) { 12613 if (value === undefined) { 12614 this.data.delete(key); 12615 } else { 12616 this.data.set(key, write(value)); 12617 } 12618 } 12619 }, 12620 [`has${capitalize(name)}`]: { 12621 get() { 12622 return this.data.has(key) || definition.hasCustomDefaultValue; 12623 } 12624 } 12625 }; 12626} 12627function parseValueDefinitionPair([token, typeDefinition], controller) { 12628 return valueDescriptorForTokenAndTypeDefinition({ 12629 controller, 12630 token, 12631 typeDefinition 12632 }); 12633} 12634function parseValueTypeConstant(constant) { 12635 switch (constant) { 12636 case Array: 12637 return "array"; 12638 case Boolean: 12639 return "boolean"; 12640 case Number: 12641 return "number"; 12642 case Object: 12643 return "object"; 12644 case String: 12645 return "string"; 12646 } 12647} 12648function parseValueTypeDefault(defaultValue) { 12649 switch (typeof defaultValue) { 12650 case "boolean": 12651 return "boolean"; 12652 case "number": 12653 return "number"; 12654 case "string": 12655 return "string"; 12656 } 12657 if (Array.isArray(defaultValue)) 12658 return "array"; 12659 if (Object.prototype.toString.call(defaultValue) === "[object Object]") 12660 return "object"; 12661} 12662function parseValueTypeObject(payload) { 12663 const { controller, token, typeObject } = payload; 12664 const hasType = isSomething(typeObject.type); 12665 const hasDefault = isSomething(typeObject.default); 12666 const fullObject = hasType && hasDefault; 12667 const onlyType = hasType && !hasDefault; 12668 const onlyDefault = !hasType && hasDefault; 12669 const typeFromObject = parseValueTypeConstant(typeObject.type); 12670 const typeFromDefaultValue = parseValueTypeDefault(payload.typeObject.default); 12671 if (onlyType) 12672 return typeFromObject; 12673 if (onlyDefault) 12674 return typeFromDefaultValue; 12675 if (typeFromObject !== typeFromDefaultValue) { 12676 const propertyPath = controller ? `${controller}.${token}` : token; 12677 throw new Error(`The specified default value for the Stimulus Value "${propertyPath}" must match the defined type "${typeFromObject}". The provided default value of "${typeObject.default}" is of type "${typeFromDefaultValue}".`); 12678 } 12679 if (fullObject) 12680 return typeFromObject; 12681} 12682function parseValueTypeDefinition(payload) { 12683 const { controller, token, typeDefinition } = payload; 12684 const typeObject = { controller, token, typeObject: typeDefinition }; 12685 const typeFromObject = parseValueTypeObject(typeObject); 12686 const typeFromDefaultValue = parseValueTypeDefault(typeDefinition); 12687 const typeFromConstant = parseValueTypeConstant(typeDefinition); 12688 const type = typeFromObject || typeFromDefaultValue || typeFromConstant; 12689 if (type) 12690 return type; 12691 const propertyPath = controller ? `${controller}.${typeDefinition}` : token; 12692 throw new Error(`Unknown value type "${propertyPath}" for "${token}" value`); 12693} 12694function defaultValueForDefinition(typeDefinition) { 12695 const constant = parseValueTypeConstant(typeDefinition); 12696 if (constant) 12697 return defaultValuesByType[constant]; 12698 const hasDefault = hasProperty(typeDefinition, "default"); 12699 const hasType = hasProperty(typeDefinition, "type"); 12700 const typeObject = typeDefinition; 12701 if (hasDefault) 12702 return typeObject.default; 12703 if (hasType) { 12704 const { type } = typeObject; 12705 const constantFromType = parseValueTypeConstant(type); 12706 if (constantFromType) 12707 return defaultValuesByType[constantFromType]; 12708 } 12709 return typeDefinition; 12710} 12711function valueDescriptorForTokenAndTypeDefinition(payload) { 12712 const { token, typeDefinition } = payload; 12713 const key = `${dasherize(token)}-value`; 12714 const type = parseValueTypeDefinition(payload); 12715 return { 12716 type, 12717 key, 12718 name: camelize(key), 12719 get defaultValue() { 12720 return defaultValueForDefinition(typeDefinition); 12721 }, 12722 get hasCustomDefaultValue() { 12723 return parseValueTypeDefault(typeDefinition) !== undefined; 12724 }, 12725 reader: readers[type], 12726 writer: writers[type] || writers.default 12727 }; 12728} 12729var defaultValuesByType = { 12730 get array() { 12731 return []; 12732 }, 12733 boolean: false, 12734 number: 0, 12735 get object() { 12736 return {}; 12737 }, 12738 string: "" 12739}; 12740var readers = { 12741 array(value) { 12742 const array = JSON.parse(value); 12743 if (!Array.isArray(array)) { 12744 throw new TypeError(`expected value of type "array" but instead got value "${value}" of type "${parseValueTypeDefault(array)}"`); 12745 } 12746 return array; 12747 }, 12748 boolean(value) { 12749 return !(value == "0" || String(value).toLowerCase() == "false"); 12750 }, 12751 number(value) { 12752 return Number(value.replace(/_/g, "")); 12753 }, 12754 object(value) { 12755 const object = JSON.parse(value); 12756 if (object === null || typeof object != "object" || Array.isArray(object)) { 12757 throw new TypeError(`expected value of type "object" but instead got value "${value}" of type "${parseValueTypeDefault(object)}"`); 12758 } 12759 return object; 12760 }, 12761 string(value) { 12762 return value; 12763 } 12764}; 12765var writers = { 12766 default: writeString, 12767 array: writeJSON, 12768 object: writeJSON 12769}; 12770function writeJSON(value) { 12771 return JSON.stringify(value); 12772} 12773function writeString(value) { 12774 return `${value}`; 12775} 12776 12777class Controller { 12778 constructor(context) { 12779 this.context = context; 12780 } 12781 static get shouldLoad() { 12782 return true; 12783 } 12784 static afterLoad(_identifier, _application) { 12785 return; 12786 } 12787 get application() { 12788 return this.context.application; 12789 } 12790 get scope() { 12791 return this.context.scope; 12792 } 12793 get element() { 12794 return this.scope.element; 12795 } 12796 get identifier() { 12797 return this.scope.identifier; 12798 } 12799 get targets() { 12800 return this.scope.targets; 12801 } 12802 get outlets() { 12803 return this.scope.outlets; 12804 } 12805 get classes() { 12806 return this.scope.classes; 12807 } 12808 get data() { 12809 return this.scope.data; 12810 } 12811 initialize() {} 12812 connect() {} 12813 disconnect() {} 12814 dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) { 12815 const type = prefix ? `${prefix}:${eventName}` : eventName; 12816 const event = new CustomEvent(type, { detail, bubbles, cancelable }); 12817 target.dispatchEvent(event); 12818 return event; 12819 } 12820} 12821Controller.blessings = [ 12822 ClassPropertiesBlessing, 12823 TargetPropertiesBlessing, 12824 ValuePropertiesBlessing, 12825 OutletPropertiesBlessing 12826]; 12827Controller.targets = []; 12828Controller.outlets = []; 12829Controller.values = {}; 12830
vendor: 10,084 bytes, lines 12831-13086
12831// node_modules/tailwindcss-stimulus-components/dist/tailwindcss-stimulus-components.module.js 12832var I = Object.defineProperty; 12833var S = (t, e, a) => (e in t) ? I(t, e, { enumerable: true, configurable: true, writable: true, value: a }) : t[e] = a; 12834var s = (t, e, a) => (S(t, typeof e != "symbol" ? e + "" : e, a), a); 12835var p = new Map; 12836async function o(t, e, a = null) { 12837 e ? await l(t, a) : await u(t, a); 12838} 12839async function l(t, e = null) { 12840 try { 12841 t.classList.remove("hidden"), await C("enter", t, e); 12842 } finally { 12843 y(t, e); 12844 } 12845} 12846async function u(t, e = null) { 12847 try { 12848 await C("leave", t, e); 12849 } finally { 12850 t.classList.add("hidden"), y(t, e); 12851 } 12852} 12853async function C(t, e, a) { 12854 y(e, a); 12855 let i = w(t, e, a); 12856 p.set(e, t), c(e, i.transition), c(e, i.start), f(e, i.end), await A(), f(e, i.start), c(e, i.end), await D(e), f(e, i.end), f(e, i.transition), "originalClass" in e.dataset && e.dataset.originalClass !== "" && c(e, e.dataset.originalClass.split(" ")), p.delete(e); 12857} 12858function w(t, e, a) { 12859 let i = e.dataset, d = a ? `${a}-${t}` : t, r = `transition${t.charAt(0).toUpperCase() + t.slice(1)}`; 12860 return { transition: i[r] ? i[r].split(" ") : [d], start: i[`${r}From`] ? i[`${r}From`].split(" ") : [`${d}-from`], end: i[`${r}To`] ? i[`${r}To`].split(" ") : [`${d}-to`] }; 12861} 12862function c(t, e) { 12863 t.classList.add(...e); 12864} 12865function f(t, e) { 12866 t.classList.remove(...e); 12867} 12868function A() { 12869 return new Promise((t) => { 12870 requestAnimationFrame(() => { 12871 requestAnimationFrame(t); 12872 }); 12873 }); 12874} 12875function D(t) { 12876 return Promise.all(t.getAnimations().map((e) => e.finished)); 12877} 12878async function y(t, e = null) { 12879 if ("originalClass" in t.dataset || (t.dataset.originalClass = [...t.classList].filter((a) => a !== "hidden").join(" ")), p.has(t)) { 12880 let a = p.get(t), i = w(a, t, e); 12881 f(t, i.transition + i.start + i.end), "originalClass" in t.dataset && t.dataset.originalClass !== "" && c(t, t.dataset.originalClass.split(" ")), p.delete(t); 12882 } 12883} 12884var v = class extends Controller { 12885 connect() { 12886 setTimeout(() => { 12887 l(this.element); 12888 }, this.showDelayValue), this.hasDismissAfterValue && setTimeout(() => { 12889 this.close(); 12890 }, this.dismissAfterValue); 12891 } 12892 close() { 12893 u(this.element).then(() => { 12894 this.element.remove(); 12895 }); 12896 } 12897}; 12898s(v, "values", { dismissAfter: Number, showDelay: { type: Number, default: 0 }, removeDelay: { type: Number, default: 1100 } }); 12899var g = class extends Controller { 12900 connect() { 12901 this.timeout = null; 12902 } 12903 save() { 12904 clearTimeout(this.timeout), this.timeout = setTimeout(() => { 12905 this.statusTarget.textContent = this.submittingTextValue, this.formTarget.requestSubmit(); 12906 }, this.submitDurationValue); 12907 } 12908 success() { 12909 this.setStatus(this.successTextValue); 12910 } 12911 error() { 12912 this.setStatus(this.errorTextValue); 12913 } 12914 setStatus(t) { 12915 this.statusTarget.textContent = t, this.timeout = setTimeout(() => { 12916 this.statusTarget.textContent = ""; 12917 }, this.statusDurationValue); 12918 } 12919}; 12920s(g, "targets", ["form", "status"]), s(g, "values", { submitDuration: { type: Number, default: 1000 }, statusDuration: { type: Number, default: 2000 }, submittingText: { type: String, default: "Saving..." }, successText: { type: String, default: "Saved!" }, errorText: { type: String, default: "Unable to save." } }); 12921var m = class extends Controller { 12922 update() { 12923 this.preview = this.colorTarget.value; 12924 } 12925 set preview(t) { 12926 this.previewTarget.style[this.styleValue] = t; 12927 let e = this._getContrastYIQ(t); 12928 this.styleValue === "color" ? this.previewTarget.style.backgroundColor = e : this.previewTarget.style.color = e; 12929 } 12930 _getContrastYIQ(t) { 12931 t = t.replace("#", ""); 12932 let e = 128, a = parseInt(t.substr(0, 2), 16), i = parseInt(t.substr(2, 2), 16), d = parseInt(t.substr(4, 2), 16); 12933 return (a * 299 + i * 587 + d * 114) / 1000 >= e ? "#000" : "#fff"; 12934 } 12935}; 12936s(m, "targets", ["preview", "color"]), s(m, "values", { style: { type: String, default: "backgroundColor" } }); 12937var n = class extends Controller { 12938 connect() { 12939 this.hasButtonTarget && (this.buttonTarget.addEventListener("keydown", this._onMenuButtonKeydown), this.buttonTarget.setAttribute("aria-haspopup", "true")); 12940 } 12941 disconnect() { 12942 this.hasButtonTarget && (this.buttonTarget.removeEventListener("keydown", this._onMenuButtonKeydown), this.buttonTarget.removeAttribute("aria-haspopup")); 12943 } 12944 openValueChanged() { 12945 o(this.menuTarget, this.openValue), this.openValue === true && this.hasMenuItemTarget && this.menuItemTargets[0].focus(); 12946 } 12947 show() { 12948 this.openValue = true; 12949 } 12950 hide(t) { 12951 t.target.nodeType && this.element.contains(t.target) === false && this.openValue && (this.openValue = false); 12952 } 12953 toggle() { 12954 this.openValue = !this.openValue; 12955 } 12956 nextItem() { 12957 let t = Math.min(this.currentItemIndex + 1, this.menuItemTargets.length - 1); 12958 this.menuItemTargets[t].focus(); 12959 } 12960 previousItem() { 12961 let t = Math.max(this.currentItemIndex - 1, 0); 12962 this.menuItemTargets[t].focus(); 12963 } 12964 get currentItemIndex() { 12965 return this.menuItemTargets.indexOf(document.activeElement); 12966 } 12967}; 12968s(n, "targets", ["menu", "button", "menuItem"]), s(n, "values", { open: Boolean, default: false }); 12969var T = class extends Controller { 12970 disconnect() { 12971 this.close(); 12972 } 12973 open() { 12974 this.openValue = true; 12975 } 12976 close() { 12977 this.openValue = false; 12978 } 12979 closeBackground(t) { 12980 t.target === this.backgroundTarget && this.close(); 12981 } 12982 async openValueChanged() { 12983 this.openValue ? (this.containerTarget.focus(), this.lockScroll(), l(this.backgroundTarget), l(this.containerTarget)) : (u(this.containerTarget), await u(this.backgroundTarget), this.unlockScroll()); 12984 } 12985 lockScroll() { 12986 this.restoreScrollValue && (this.saveScrollPosition(), document.body.style.top = `-${this.scrollPosition}px`); 12987 let t = window.innerWidth - document.documentElement.clientWidth; 12988 document.body.style.paddingRight = `${t}px`, document.body.classList.add("fixed", "inset-x-0", "overflow-hidden"); 12989 } 12990 unlockScroll() { 12991 document.body.style.paddingRight = null, document.body.classList.remove("fixed", "inset-x-0", "overflow-hidden"), this.restoreScrollValue && (this.restoreScrollPosition(), document.body.style.top = null); 12992 } 12993 saveScrollPosition() { 12994 this.scrollPosition = window.pageYOffset || document.body.scrollTop; 12995 } 12996 restoreScrollPosition() { 12997 this.scrollPosition !== undefined && (document.documentElement.scrollTop = this.scrollPosition); 12998 } 12999}; 13000s(T, "targets", ["container", "background"]), s(T, "values", { open: { type: Boolean, default: false }, restoreScroll: { type: Boolean, default: true } }); 13001var x = class extends Controller { 13002 openValueChanged() { 13003 o(this.contentTarget, this.openValue), this.shouldAutoDismiss && this.scheduleDismissal(); 13004 } 13005 show(t) { 13006 this.shouldAutoDismiss && this.scheduleDismissal(), this.openValue = true; 13007 } 13008 hide() { 13009 this.openValue = false; 13010 } 13011 toggle() { 13012 this.openValue = !this.openValue; 13013 } 13014 get shouldAutoDismiss() { 13015 return this.openValue && this.hasDismissAfterValue; 13016 } 13017 scheduleDismissal() { 13018 this.hasDismissAfterValue && (this.cancelDismissal(), this.timeoutId = setTimeout(() => { 13019 this.hide(), this.timeoutId = undefined; 13020 }, this.dismissAfterValue)); 13021 } 13022 cancelDismissal() { 13023 typeof this.timeoutId == "number" && (clearTimeout(this.timeoutId), this.timeoutId = undefined); 13024 } 13025}; 13026s(x, "targets", ["content"]), s(x, "values", { dismissAfter: Number, open: { type: Boolean, default: false } }); 13027var V = class extends n { 13028 openValueChanged() { 13029 o(this.overlayTarget, this.openValue), o(this.menuTarget, this.openValue), this.hasCloseTarget && o(this.closeTarget, this.openValue); 13030 } 13031}; 13032s(V, "targets", ["menu", "overlay", "close"]); 13033var h = class extends Controller { 13034 connect() { 13035 this.anchor && (this.indexValue = this.tabTargets.findIndex((t) => t.id === this.anchor)), this.showTab(); 13036 } 13037 change(t) { 13038 t.currentTarget.tagName === "SELECT" ? this.indexValue = t.currentTarget.selectedIndex : t.currentTarget.dataset.index ? this.indexValue = t.currentTarget.dataset.index : t.currentTarget.dataset.id ? this.indexValue = this.tabTargets.findIndex((e) => e.id == t.currentTarget.dataset.id) : this.indexValue = this.tabTargets.indexOf(t.currentTarget), window.dispatchEvent(new CustomEvent("tsc:tab-change")); 13039 } 13040 nextTab() { 13041 this.indexValue = Math.min(this.indexValue + 1, this.tabsCount - 1); 13042 } 13043 previousTab() { 13044 this.indexValue = Math.max(this.indexValue - 1, 0); 13045 } 13046 firstTab() { 13047 this.indexValue = 0; 13048 } 13049 lastTab() { 13050 this.indexValue = this.tabsCount - 1; 13051 } 13052 indexValueChanged() { 13053 this.showTab(), this.updateAnchorValue && (location.hash = this.tabTargets[this.indexValue].id); 13054 } 13055 showTab() { 13056 this.panelTargets.forEach((t, e) => { 13057 let a = this.tabTargets[e]; 13058 e === this.indexValue ? (t.classList.remove("hidden"), this.hasInactiveTabClass && a?.classList?.remove(...this.inactiveTabClasses), this.hasActiveTabClass && a?.classList?.add(...this.activeTabClasses)) : (t.classList.add("hidden"), this.hasActiveTabClass && a?.classList?.remove(...this.activeTabClasses), this.hasInactiveTabClass && a?.classList?.add(...this.inactiveTabClasses)); 13059 }), this.hasSelectTarget && (this.selectTarget.selectedIndex = this.indexValue); 13060 } 13061 get tabsCount() { 13062 return this.tabTargets.length; 13063 } 13064 get anchor() { 13065 return document.URL.split("#").length > 1 ? document.URL.split("#")[1] : null; 13066 } 13067}; 13068s(h, "classes", ["activeTab", "inactiveTab"]), s(h, "targets", ["tab", "panel", "select"]), s(h, "values", { index: 0, updateAnchor: Boolean }); 13069var b = class extends Controller { 13070 toggle(t) { 13071 this.openValue = !this.openValue, this.animate(); 13072 } 13073 hide() { 13074 this.openValue = false, this.animate(); 13075 } 13076 show() { 13077 this.openValue = true, this.animate(); 13078 } 13079 animate() { 13080 this.toggleableTargets.forEach((t) => { 13081 o(t, this.openValue); 13082 }); 13083 } 13084}; 13085s(b, "targets", ["toggleable"]), s(b, "values", { open: { type: Boolean, default: false } }); 13086
13087// app/javascript/controllers/application.js 13088var application = Application.start(); 13089application.debug = false; 13090window.Stimulus = application; 13091application.register("modal", T); 13092
13093// app/javascript/controllers/hello_controller.js 13094class hello_controller_default extends Controller { 13095 connect() { 13096 this.element.textContent = "Hello World!"; 13097 } 13098} 13099
13100// app/javascript/controllers/index.js 13101application.register("hello", hello_controller_default); 13102
vendor: 1,327 bytes, lines 13103-13145
13103// node_modules/@popperjs/core/lib/index.js 13104var exports_lib = {}; 13105__export(exports_lib, { 13106 write: () => write, 13107 viewport: () => viewport, 13108 variationPlacements: () => variationPlacements, 13109 top: () => top, 13110 start: () => start2, 13111 right: () => right, 13112 reference: () => reference, 13113 read: () => read, 13114 preventOverflow: () => preventOverflow_default, 13115 popperOffsets: () => popperOffsets_default, 13116 popperGenerator: () => popperGenerator, 13117 popper: () => popper, 13118 placements: () => placements, 13119 offset: () => offset_default, 13120 modifierPhases: () => modifierPhases, 13121 main: () => main, 13122 left: () => left, 13123 hide: () => hide_default, 13124 flip: () => flip_default, 13125 eventListeners: () => eventListeners_default, 13126 end: () => end, 13127 detectOverflow: () => detectOverflow, 13128 createPopperLite: () => createPopper2, 13129 createPopperBase: () => createPopper, 13130 createPopper: () => createPopper3, 13131 computeStyles: () => computeStyles_default, 13132 clippingParents: () => clippingParents, 13133 bottom: () => bottom, 13134 beforeWrite: () => beforeWrite, 13135 beforeRead: () => beforeRead, 13136 beforeMain: () => beforeMain, 13137 basePlacements: () => basePlacements, 13138 auto: () => auto, 13139 arrow: () => arrow_default, 13140 applyStyles: () => applyStyles_default, 13141 afterWrite: () => afterWrite, 13142 afterRead: () => afterRead, 13143 afterMain: () => afterMain 13144}); 13145
vendor: 1,070 bytes, lines 13146-13174
13146// node_modules/@popperjs/core/lib/enums.js 13147var top = "top"; 13148var bottom = "bottom"; 13149var right = "right"; 13150var left = "left"; 13151var auto = "auto"; 13152var basePlacements = [top, bottom, right, left]; 13153var start2 = "start"; 13154var end = "end"; 13155var clippingParents = "clippingParents"; 13156var viewport = "viewport"; 13157var popper = "popper"; 13158var reference = "reference"; 13159var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) { 13160 return acc.concat([placement + "-" + start2, placement + "-" + end]); 13161}, []); 13162var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) { 13163 return acc.concat([placement, placement + "-" + start2, placement + "-" + end]); 13164}, []); 13165var beforeRead = "beforeRead"; 13166var read = "read"; 13167var afterRead = "afterRead"; 13168var beforeMain = "beforeMain"; 13169var main = "main"; 13170var afterMain = "afterMain"; 13171var beforeWrite = "beforeWrite"; 13172var write = "write"; 13173var afterWrite = "afterWrite"; 13174var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
vendor: 161 bytes, lines 13175-13179
13175// node_modules/@popperjs/core/lib/dom-utils/getNodeName.js 13176function getNodeName(element) { 13177 return element ? (element.nodeName || "").toLowerCase() : null; 13178} 13179
vendor: 316 bytes, lines 13180-13191
13180// node_modules/@popperjs/core/lib/dom-utils/getWindow.js 13181function getWindow(node) { 13182 if (node == null) { 13183 return window; 13184 } 13185 if (node.toString() !== "[object Window]") { 13186 var ownerDocument = node.ownerDocument; 13187 return ownerDocument ? ownerDocument.defaultView || window : window; 13188 } 13189 return node; 13190} 13191
vendor: 557 bytes, lines 13192-13208
13192// node_modules/@popperjs/core/lib/dom-utils/instanceOf.js 13193function isElement(node) { 13194 var OwnElement = getWindow(node).Element; 13195 return node instanceof OwnElement || node instanceof Element; 13196} 13197function isHTMLElement(node) { 13198 var OwnElement = getWindow(node).HTMLElement; 13199 return node instanceof OwnElement || node instanceof HTMLElement; 13200} 13201function isShadowRoot(node) { 13202 if (typeof ShadowRoot === "undefined") { 13203 return false; 13204 } 13205 var OwnElement = getWindow(node).ShadowRoot; 13206 return node instanceof OwnElement || node instanceof ShadowRoot; 13207} 13208
vendor: 1,986 bytes, lines 13209-13275
13209// node_modules/@popperjs/core/lib/modifiers/applyStyles.js 13210function applyStyles(_ref) { 13211 var state = _ref.state; 13212 Object.keys(state.elements).forEach(function(name) { 13213 var style = state.styles[name] || {}; 13214 var attributes = state.attributes[name] || {}; 13215 var element = state.elements[name]; 13216 if (!isHTMLElement(element) || !getNodeName(element)) { 13217 return; 13218 } 13219 Object.assign(element.style, style); 13220 Object.keys(attributes).forEach(function(name2) { 13221 var value = attributes[name2]; 13222 if (value === false) { 13223 element.removeAttribute(name2); 13224 } else { 13225 element.setAttribute(name2, value === true ? "" : value); 13226 } 13227 }); 13228 }); 13229} 13230function effect(_ref2) { 13231 var state = _ref2.state; 13232 var initialStyles = { 13233 popper: { 13234 position: state.options.strategy, 13235 left: "0", 13236 top: "0", 13237 margin: "0" 13238 }, 13239 arrow: { 13240 position: "absolute" 13241 }, 13242 reference: {} 13243 }; 13244 Object.assign(state.elements.popper.style, initialStyles.popper); 13245 state.styles = initialStyles; 13246 if (state.elements.arrow) { 13247 Object.assign(state.elements.arrow.style, initialStyles.arrow); 13248 } 13249 return function() { 13250 Object.keys(state.elements).forEach(function(name) { 13251 var element = state.elements[name]; 13252 var attributes = state.attributes[name] || {}; 13253 var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); 13254 var style = styleProperties.reduce(function(style2, property) { 13255 style2[property] = ""; 13256 return style2; 13257 }, {}); 13258 if (!isHTMLElement(element) || !getNodeName(element)) { 13259 return; 13260 } 13261 Object.assign(element.style, style); 13262 Object.keys(attributes).forEach(function(attribute) { 13263 element.removeAttribute(attribute); 13264 }); 13265 }); 13266 }; 13267} 13268var applyStyles_default = { 13269 name: "applyStyles", 13270 enabled: true, 13271 phase: "write", 13272 fn: applyStyles, 13273 effect, 13274 requires: ["computeStyles"] 13275};
vendor: 137 bytes, lines 13276-13280
13276// node_modules/@popperjs/core/lib/utils/getBasePlacement.js 13277function getBasePlacement(placement) { 13278 return placement.split("-")[0]; 13279} 13280
vendor: 114 bytes, lines 13281-13285
13281// node_modules/@popperjs/core/lib/utils/math.js 13282var max = Math.max; 13283var min = Math.min; 13284var round = Math.round; 13285
vendor: 339 bytes, lines 13286-13296
13286// node_modules/@popperjs/core/lib/utils/userAgent.js 13287function getUAString() { 13288 var uaData = navigator.userAgentData; 13289 if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) { 13290 return uaData.brands.map(function(item) { 13291 return item.brand + "/" + item.version; 13292 }).join(" "); 13293 } 13294 return navigator.userAgent; 13295} 13296
vendor: 162 bytes, lines 13297-13301
13297// node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js 13298function isLayoutViewport() { 13299 return !/^((?!chrome|android).)*safari/i.test(getUAString()); 13300} 13301
vendor: 1,220 bytes, lines 13302-13334
13302// node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js 13303function getBoundingClientRect(element, includeScale, isFixedStrategy) { 13304 if (includeScale === undefined) { 13305 includeScale = false; 13306 } 13307 if (isFixedStrategy === undefined) { 13308 isFixedStrategy = false; 13309 } 13310 var clientRect = element.getBoundingClientRect(); 13311 var scaleX = 1; 13312 var scaleY = 1; 13313 if (includeScale && isHTMLElement(element)) { 13314 scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; 13315 scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; 13316 } 13317 var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport; 13318 var addVisualOffsets = !isLayoutViewport() && isFixedStrategy; 13319 var x2 = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX; 13320 var y2 = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY; 13321 var width = clientRect.width / scaleX; 13322 var height = clientRect.height / scaleY; 13323 return { 13324 width, 13325 height, 13326 top: y2, 13327 right: x2 + width, 13328 bottom: y2 + height, 13329 left: x2, 13330 x: x2, 13331 y: y2 13332 }; 13333} 13334
vendor: 483 bytes, lines 13335-13353
13335// node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js 13336function getLayoutRect(element) { 13337 var clientRect = getBoundingClientRect(element); 13338 var width = element.offsetWidth; 13339 var height = element.offsetHeight; 13340 if (Math.abs(clientRect.width - width) <= 1) { 13341 width = clientRect.width; 13342 } 13343 if (Math.abs(clientRect.height - height) <= 1) { 13344 height = clientRect.height; 13345 } 13346 return { 13347 x: element.offsetLeft, 13348 y: element.offsetTop, 13349 width, 13350 height 13351 }; 13352} 13353
vendor: 442 bytes, lines 13354-13370
13354// node_modules/@popperjs/core/lib/dom-utils/contains.js 13355function contains(parent, child) { 13356 var rootNode = child.getRootNode && child.getRootNode(); 13357 if (parent.contains(child)) { 13358 return true; 13359 } else if (rootNode && isShadowRoot(rootNode)) { 13360 var next = child; 13361 do { 13362 if (next && parent.isSameNode(next)) { 13363 return true; 13364 } 13365 next = next.parentNode || next.host; 13366 } while (next); 13367 } 13368 return false; 13369} 13370
vendor: 161 bytes, lines 13371-13375
13371// node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js 13372function getComputedStyle2(element) { 13373 return getWindow(element).getComputedStyle(element); 13374} 13375
vendor: 168 bytes, lines 13376-13380
13376// node_modules/@popperjs/core/lib/dom-utils/isTableElement.js 13377function isTableElement(element) { 13378 return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0; 13379} 13380
vendor: 220 bytes, lines 13381-13385
13381// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js 13382function getDocumentElement(element) { 13383 return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement; 13384} 13385
vendor: 297 bytes, lines 13386-13393
13386// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js 13387function getParentNode(element) { 13388 if (getNodeName(element) === "html") { 13389 return element; 13390 } 13391 return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element); 13392} 13393
vendor: 1,709 bytes, lines 13394-13435
13394// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js 13395function getTrueOffsetParent(element) { 13396 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 13397 return null; 13398 } 13399 return element.offsetParent; 13400} 13401function getContainingBlock(element) { 13402 var isFirefox = /firefox/i.test(getUAString()); 13403 var isIE = /Trident/i.test(getUAString()); 13404 if (isIE && isHTMLElement(element)) { 13405 var elementCss = getComputedStyle2(element); 13406 if (elementCss.position === "fixed") { 13407 return null; 13408 } 13409 } 13410 var currentNode = getParentNode(element); 13411 if (isShadowRoot(currentNode)) { 13412 currentNode = currentNode.host; 13413 } 13414 while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) { 13415 var css = getComputedStyle2(currentNode); 13416 if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") { 13417 return currentNode; 13418 } else { 13419 currentNode = currentNode.parentNode; 13420 } 13421 } 13422 return null; 13423} 13424function getOffsetParent(element) { 13425 var window2 = getWindow(element); 13426 var offsetParent = getTrueOffsetParent(element); 13427 while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") { 13428 offsetParent = getTrueOffsetParent(offsetParent); 13429 } 13430 if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static")) { 13431 return window2; 13432 } 13433 return offsetParent || getContainingBlock(element) || window2; 13434} 13435
vendor: 183 bytes, lines 13436-13440
13436// node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js 13437function getMainAxisFromPlacement(placement) { 13438 return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y"; 13439} 13440
vendor: 246 bytes, lines 13441-13449
13441// node_modules/@popperjs/core/lib/utils/within.js 13442function within(min2, value, max2) { 13443 return max(min2, min(value, max2)); 13444} 13445function withinMaxClamp(min2, value, max2) { 13446 var v2 = within(min2, value, max2); 13447 return v2 > max2 ? max2 : v2; 13448} 13449
vendor: 167 bytes, lines 13450-13459
13450// node_modules/@popperjs/core/lib/utils/getFreshSideObject.js 13451function getFreshSideObject() { 13452 return { 13453 top: 0, 13454 right: 0, 13455 bottom: 0, 13456 left: 0 13457 }; 13458} 13459
vendor: 176 bytes, lines 13460-13464
13460// node_modules/@popperjs/core/lib/utils/mergePaddingObject.js 13461function mergePaddingObject(paddingObject) { 13462 return Object.assign({}, getFreshSideObject(), paddingObject); 13463} 13464
vendor: 205 bytes, lines 13465-13472
13465// node_modules/@popperjs/core/lib/utils/expandToHashMap.js 13466function expandToHashMap(value, keys) { 13467 return keys.reduce(function(hashMap, key) { 13468 hashMap[key] = value; 13469 return hashMap; 13470 }, {}); 13471} 13472
vendor: 2,582 bytes, lines 13473-13533
13473// node_modules/@popperjs/core/lib/modifiers/arrow.js 13474var toPaddingObject = function toPaddingObject2(padding, state) { 13475 padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, { 13476 placement: state.placement 13477 })) : padding; 13478 return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements)); 13479}; 13480function arrow(_ref) { 13481 var _state$modifiersData$; 13482 var { state, name, options } = _ref; 13483 var arrowElement = state.elements.arrow; 13484 var popperOffsets = state.modifiersData.popperOffsets; 13485 var basePlacement = getBasePlacement(state.placement); 13486 var axis = getMainAxisFromPlacement(basePlacement); 13487 var isVertical = [left, right].indexOf(basePlacement) >= 0; 13488 var len = isVertical ? "height" : "width"; 13489 if (!arrowElement || !popperOffsets) { 13490 return; 13491 } 13492 var paddingObject = toPaddingObject(options.padding, state); 13493 var arrowRect = getLayoutRect(arrowElement); 13494 var minProp = axis === "y" ? top : left; 13495 var maxProp = axis === "y" ? bottom : right; 13496 var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; 13497 var startDiff = popperOffsets[axis] - state.rects.reference[axis]; 13498 var arrowOffsetParent = getOffsetParent(arrowElement); 13499 var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; 13500 var centerToReference = endDiff / 2 - startDiff / 2; 13501 var min2 = paddingObject[minProp]; 13502 var max2 = clientSize - arrowRect[len] - paddingObject[maxProp]; 13503 var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; 13504 var offset = within(min2, center, max2); 13505 var axisProp = axis; 13506 state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); 13507} 13508function effect2(_ref2) { 13509 var { state, options } = _ref2; 13510 var _options$element = options.element, arrowElement = _options$element === undefined ? "[data-popper-arrow]" : _options$element; 13511 if (arrowElement == null) { 13512 return; 13513 } 13514 if (typeof arrowElement === "string") { 13515 arrowElement = state.elements.popper.querySelector(arrowElement); 13516 if (!arrowElement) { 13517 return; 13518 } 13519 } 13520 if (!contains(state.elements.popper, arrowElement)) { 13521 return; 13522 } 13523 state.elements.arrow = arrowElement; 13524} 13525var arrow_default = { 13526 name: "arrow", 13527 enabled: true, 13528 phase: "main", 13529 fn: arrow, 13530 effect: effect2, 13531 requires: ["popperOffsets"], 13532 requiresIfExists: ["preventOverflow"] 13533};
vendor: 129 bytes, lines 13534-13538
13534// node_modules/@popperjs/core/lib/utils/getVariation.js 13535function getVariation(placement) { 13536 return placement.split("-")[1]; 13537} 13538
vendor: 4,474 bytes, lines 13539-13652
13539// node_modules/@popperjs/core/lib/modifiers/computeStyles.js 13540var unsetSides = { 13541 top: "auto", 13542 right: "auto", 13543 bottom: "auto", 13544 left: "auto" 13545}; 13546function roundOffsetsByDPR(_ref, win) { 13547 var { x: x2, y: y2 } = _ref; 13548 var dpr = win.devicePixelRatio || 1; 13549 return { 13550 x: round(x2 * dpr) / dpr || 0, 13551 y: round(y2 * dpr) / dpr || 0 13552 }; 13553} 13554function mapToStyles(_ref2) { 13555 var _Object$assign2; 13556 var { popper: popper2, popperRect, placement, variation, offsets, position, gpuAcceleration, adaptive, roundOffsets, isFixed } = _ref2; 13557 var _offsets$x = offsets.x, x2 = _offsets$x === undefined ? 0 : _offsets$x, _offsets$y = offsets.y, y2 = _offsets$y === undefined ? 0 : _offsets$y; 13558 var _ref3 = typeof roundOffsets === "function" ? roundOffsets({ 13559 x: x2, 13560 y: y2 13561 }) : { 13562 x: x2, 13563 y: y2 13564 }; 13565 x2 = _ref3.x; 13566 y2 = _ref3.y; 13567 var hasX = offsets.hasOwnProperty("x"); 13568 var hasY = offsets.hasOwnProperty("y"); 13569 var sideX = left; 13570 var sideY = top; 13571 var win = window; 13572 if (adaptive) { 13573 var offsetParent = getOffsetParent(popper2); 13574 var heightProp = "clientHeight"; 13575 var widthProp = "clientWidth"; 13576 if (offsetParent === getWindow(popper2)) { 13577 offsetParent = getDocumentElement(popper2); 13578 if (getComputedStyle2(offsetParent).position !== "static" && position === "absolute") { 13579 heightProp = "scrollHeight"; 13580 widthProp = "scrollWidth"; 13581 } 13582 } 13583 offsetParent = offsetParent; 13584 if (placement === top || (placement === left || placement === right) && variation === end) { 13585 sideY = bottom; 13586 var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp]; 13587 y2 -= offsetY - popperRect.height; 13588 y2 *= gpuAcceleration ? 1 : -1; 13589 } 13590 if (placement === left || (placement === top || placement === bottom) && variation === end) { 13591 sideX = right; 13592 var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp]; 13593 x2 -= offsetX - popperRect.width; 13594 x2 *= gpuAcceleration ? 1 : -1; 13595 } 13596 } 13597 var commonStyles = Object.assign({ 13598 position 13599 }, adaptive && unsetSides); 13600 var _ref4 = roundOffsets === true ? roundOffsetsByDPR({ 13601 x: x2, 13602 y: y2 13603 }, getWindow(popper2)) : { 13604 x: x2, 13605 y: y2 13606 }; 13607 x2 = _ref4.x; 13608 y2 = _ref4.y; 13609 if (gpuAcceleration) { 13610 var _Object$assign; 13611 return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x2 + "px, " + y2 + "px)" : "translate3d(" + x2 + "px, " + y2 + "px, 0)", _Object$assign)); 13612 } 13613 return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y2 + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2)); 13614} 13615function computeStyles(_ref5) { 13616 var { state, options } = _ref5; 13617 var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === undefined ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === undefined ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === undefined ? true : _options$roundOffsets; 13618 var commonStyles = { 13619 placement: getBasePlacement(state.placement), 13620 variation: getVariation(state.placement), 13621 popper: state.elements.popper, 13622 popperRect: state.rects.popper, 13623 gpuAcceleration, 13624 isFixed: state.options.strategy === "fixed" 13625 }; 13626 if (state.modifiersData.popperOffsets != null) { 13627 state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { 13628 offsets: state.modifiersData.popperOffsets, 13629 position: state.options.strategy, 13630 adaptive, 13631 roundOffsets 13632 }))); 13633 } 13634 if (state.modifiersData.arrow != null) { 13635 state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { 13636 offsets: state.modifiersData.arrow, 13637 position: "absolute", 13638 adaptive: false, 13639 roundOffsets 13640 }))); 13641 } 13642 state.attributes.popper = Object.assign({}, state.attributes.popper, { 13643 "data-popper-placement": state.placement 13644 }); 13645} 13646var computeStyles_default = { 13647 name: "computeStyles", 13648 enabled: true, 13649 phase: "beforeWrite", 13650 fn: computeStyles, 13651 data: {} 13652};
vendor: 1,188 bytes, lines 13653-13688
13653// node_modules/@popperjs/core/lib/modifiers/eventListeners.js 13654var passive = { 13655 passive: true 13656}; 13657function effect3(_ref) { 13658 var { state, instance, options } = _ref; 13659 var _options$scroll = options.scroll, scroll = _options$scroll === undefined ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === undefined ? true : _options$resize; 13660 var window2 = getWindow(state.elements.popper); 13661 var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); 13662 if (scroll) { 13663 scrollParents.forEach(function(scrollParent) { 13664 scrollParent.addEventListener("scroll", instance.update, passive); 13665 }); 13666 } 13667 if (resize) { 13668 window2.addEventListener("resize", instance.update, passive); 13669 } 13670 return function() { 13671 if (scroll) { 13672 scrollParents.forEach(function(scrollParent) { 13673 scrollParent.removeEventListener("scroll", instance.update, passive); 13674 }); 13675 } 13676 if (resize) { 13677 window2.removeEventListener("resize", instance.update, passive); 13678 } 13679 }; 13680} 13681var eventListeners_default = { 13682 name: "eventListeners", 13683 enabled: true, 13684 phase: "write", 13685 fn: function fn() {}, 13686 effect: effect3, 13687 data: {} 13688};
vendor: 299 bytes, lines 13689-13701
13689// node_modules/@popperjs/core/lib/utils/getOppositePlacement.js 13690var hash = { 13691 left: "right", 13692 right: "left", 13693 bottom: "top", 13694 top: "bottom" 13695}; 13696function getOppositePlacement(placement) { 13697 return placement.replace(/left|right|bottom|top/g, function(matched) { 13698 return hash[matched]; 13699 }); 13700} 13701
vendor: 271 bytes, lines 13702-13712
13702// node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js 13703var hash2 = { 13704 start: "end", 13705 end: "start" 13706}; 13707function getOppositeVariationPlacement(placement) { 13708 return placement.replace(/start|end/g, function(matched) { 13709 return hash2[matched]; 13710 }); 13711} 13712
vendor: 246 bytes, lines 13713-13723
13713// node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js 13714function getWindowScroll(node) { 13715 var win = getWindow(node); 13716 var scrollLeft = win.pageXOffset; 13717 var scrollTop = win.pageYOffset; 13718 return { 13719 scrollLeft, 13720 scrollTop 13721 }; 13722} 13723
vendor: 215 bytes, lines 13724-13728
13724// node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js 13725function getWindowScrollBarX(element) { 13726 return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; 13727} 13728
vendor: 708 bytes, lines 13729-13754
13729// node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js 13730function getViewportRect(element, strategy) { 13731 var win = getWindow(element); 13732 var html = getDocumentElement(element); 13733 var visualViewport = win.visualViewport; 13734 var width = html.clientWidth; 13735 var height = html.clientHeight; 13736 var x2 = 0; 13737 var y2 = 0; 13738 if (visualViewport) { 13739 width = visualViewport.width; 13740 height = visualViewport.height; 13741 var layoutViewport = isLayoutViewport(); 13742 if (layoutViewport || !layoutViewport && strategy === "fixed") { 13743 x2 = visualViewport.offsetLeft; 13744 y2 = visualViewport.offsetTop; 13745 } 13746 } 13747 return { 13748 width, 13749 height, 13750 x: x2 + getWindowScrollBarX(element), 13751 y: y2 13752 }; 13753} 13754
vendor: 853 bytes, lines 13755-13775
13755// node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js 13756function getDocumentRect(element) { 13757 var _element$ownerDocumen; 13758 var html = getDocumentElement(element); 13759 var winScroll = getWindowScroll(element); 13760 var body = (_element$ownerDocumen = element.ownerDocument) == null ? undefined : _element$ownerDocumen.body; 13761 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); 13762 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); 13763 var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element); 13764 var y2 = -winScroll.scrollTop; 13765 if (getComputedStyle2(body || html).direction === "rtl") { 13766 x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width; 13767 } 13768 return { 13769 width, 13770 height, 13771 x: x2, 13772 y: y2 13773 }; 13774} 13775
vendor: 354 bytes, lines 13776-13781
13776// node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js 13777function isScrollParent(element) { 13778 var _getComputedStyle = getComputedStyle2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY; 13779 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); 13780} 13781
vendor: 332 bytes, lines 13782-13792
13782// node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js 13783function getScrollParent(node) { 13784 if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) { 13785 return node.ownerDocument.body; 13786 } 13787 if (isHTMLElement(node) && isScrollParent(node)) { 13788 return node; 13789 } 13790 return getScrollParent(getParentNode(node)); 13791} 13792
vendor: 669 bytes, lines 13793-13806
13793// node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js 13794function listScrollParents(element, list) { 13795 var _element$ownerDocumen; 13796 if (list === undefined) { 13797 list = []; 13798 } 13799 var scrollParent = getScrollParent(element); 13800 var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? undefined : _element$ownerDocumen.body); 13801 var win = getWindow(scrollParent); 13802 var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; 13803 var updatedList = list.concat(target); 13804 return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target))); 13805} 13806
vendor: 239 bytes, lines 13807-13816
13807// node_modules/@popperjs/core/lib/utils/rectToClientRect.js 13808function rectToClientRect(rect) { 13809 return Object.assign({}, rect, { 13810 left: rect.x, 13811 top: rect.y, 13812 right: rect.x + rect.width, 13813 bottom: rect.y + rect.height 13814 }); 13815} 13816
vendor: 2,376 bytes, lines 13817-13862
13817// node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js 13818function getInnerBoundingClientRect(element, strategy) { 13819 var rect = getBoundingClientRect(element, false, strategy === "fixed"); 13820 rect.top = rect.top + element.clientTop; 13821 rect.left = rect.left + element.clientLeft; 13822 rect.bottom = rect.top + element.clientHeight; 13823 rect.right = rect.left + element.clientWidth; 13824 rect.width = element.clientWidth; 13825 rect.height = element.clientHeight; 13826 rect.x = rect.left; 13827 rect.y = rect.top; 13828 return rect; 13829} 13830function getClientRectFromMixedType(element, clippingParent, strategy) { 13831 return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element))); 13832} 13833function getClippingParents(element) { 13834 var clippingParents2 = listScrollParents(getParentNode(element)); 13835 var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle2(element).position) >= 0; 13836 var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; 13837 if (!isElement(clipperElement)) { 13838 return []; 13839 } 13840 return clippingParents2.filter(function(clippingParent) { 13841 return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body"; 13842 }); 13843} 13844function getClippingRect(element, boundary, rootBoundary, strategy) { 13845 var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary); 13846 var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]); 13847 var firstClippingParent = clippingParents2[0]; 13848 var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) { 13849 var rect = getClientRectFromMixedType(element, clippingParent, strategy); 13850 accRect.top = max(rect.top, accRect.top); 13851 accRect.right = min(rect.right, accRect.right); 13852 accRect.bottom = min(rect.bottom, accRect.bottom); 13853 accRect.left = max(rect.left, accRect.left); 13854 return accRect; 13855 }, getClientRectFromMixedType(element, firstClippingParent, strategy)); 13856 clippingRect.width = clippingRect.right - clippingRect.left; 13857 clippingRect.height = clippingRect.bottom - clippingRect.top; 13858 clippingRect.x = clippingRect.left; 13859 clippingRect.y = clippingRect.top; 13860 return clippingRect; 13861} 13862
vendor: 1,512 bytes, lines 13863-13917
13863// node_modules/@popperjs/core/lib/utils/computeOffsets.js 13864function computeOffsets(_ref) { 13865 var { reference: reference2, element, placement } = _ref; 13866 var basePlacement = placement ? getBasePlacement(placement) : null; 13867 var variation = placement ? getVariation(placement) : null; 13868 var commonX = reference2.x + reference2.width / 2 - element.width / 2; 13869 var commonY = reference2.y + reference2.height / 2 - element.height / 2; 13870 var offsets; 13871 switch (basePlacement) { 13872 case top: 13873 offsets = { 13874 x: commonX, 13875 y: reference2.y - element.height 13876 }; 13877 break; 13878 case bottom: 13879 offsets = { 13880 x: commonX, 13881 y: reference2.y + reference2.height 13882 }; 13883 break; 13884 case right: 13885 offsets = { 13886 x: reference2.x + reference2.width, 13887 y: commonY 13888 }; 13889 break; 13890 case left: 13891 offsets = { 13892 x: reference2.x - element.width, 13893 y: commonY 13894 }; 13895 break; 13896 default: 13897 offsets = { 13898 x: reference2.x, 13899 y: reference2.y 13900 }; 13901 } 13902 var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; 13903 if (mainAxis != null) { 13904 var len = mainAxis === "y" ? "height" : "width"; 13905 switch (variation) { 13906 case start2: 13907 offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2); 13908 break; 13909 case end: 13910 offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2); 13911 break; 13912 default: 13913 } 13914 } 13915 return offsets; 13916} 13917
vendor: 2,712 bytes, lines 13918-13955
13918// node_modules/@popperjs/core/lib/utils/detectOverflow.js 13919function detectOverflow(state, options) { 13920 if (options === undefined) { 13921 options = {}; 13922 } 13923 var _options = options, _options$placement = _options.placement, placement = _options$placement === undefined ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === undefined ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === undefined ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === undefined ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === undefined ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === undefined ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === undefined ? 0 : _options$padding; 13924 var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements)); 13925 var altContext = elementContext === popper ? reference : popper; 13926 var popperRect = state.rects.popper; 13927 var element = state.elements[altBoundary ? altContext : elementContext]; 13928 var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy); 13929 var referenceClientRect = getBoundingClientRect(state.elements.reference); 13930 var popperOffsets = computeOffsets({ 13931 reference: referenceClientRect, 13932 element: popperRect, 13933 strategy: "absolute", 13934 placement 13935 }); 13936 var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); 13937 var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; 13938 var overflowOffsets = { 13939 top: clippingClientRect.top - elementClientRect.top + paddingObject.top, 13940 bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, 13941 left: clippingClientRect.left - elementClientRect.left + paddingObject.left, 13942 right: elementClientRect.right - clippingClientRect.right + paddingObject.right 13943 }; 13944 var offsetData = state.modifiersData.offset; 13945 if (elementContext === popper && offsetData) { 13946 var offset = offsetData[placement]; 13947 Object.keys(overflowOffsets).forEach(function(key) { 13948 var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; 13949 var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x"; 13950 overflowOffsets[key] += offset[axis] * multiply; 13951 }); 13952 } 13953 return overflowOffsets; 13954} 13955
vendor: 1,333 bytes, lines 13956-13985
13956// node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js 13957function computeAutoPlacement(state, options) { 13958 if (options === undefined) { 13959 options = {}; 13960 } 13961 var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === undefined ? placements : _options$allowedAutoP; 13962 var variation = getVariation(placement); 13963 var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) { 13964 return getVariation(placement2) === variation; 13965 }) : basePlacements; 13966 var allowedPlacements = placements2.filter(function(placement2) { 13967 return allowedAutoPlacements.indexOf(placement2) >= 0; 13968 }); 13969 if (allowedPlacements.length === 0) { 13970 allowedPlacements = placements2; 13971 } 13972 var overflows = allowedPlacements.reduce(function(acc, placement2) { 13973 acc[placement2] = detectOverflow(state, { 13974 placement: placement2, 13975 boundary, 13976 rootBoundary, 13977 padding 13978 })[getBasePlacement(placement2)]; 13979 return acc; 13980 }, {}); 13981 return Object.keys(overflows).sort(function(a, b2) { 13982 return overflows[a] - overflows[b2]; 13983 }); 13984} 13985
vendor: 4,106 bytes, lines 13986-14090
13986// node_modules/@popperjs/core/lib/modifiers/flip.js 13987function getExpandedFallbackPlacements(placement) { 13988 if (getBasePlacement(placement) === auto) { 13989 return []; 13990 } 13991 var oppositePlacement = getOppositePlacement(placement); 13992 return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; 13993} 13994function flip(_ref) { 13995 var { state, options, name } = _ref; 13996 if (state.modifiersData[name]._skip) { 13997 return; 13998 } 13999 var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === undefined ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === undefined ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === undefined ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements; 14000 var preferredPlacement = state.options.placement; 14001 var basePlacement = getBasePlacement(preferredPlacement); 14002 var isBasePlacement = basePlacement === preferredPlacement; 14003 var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); 14004 var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) { 14005 return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, { 14006 placement: placement2, 14007 boundary, 14008 rootBoundary, 14009 padding, 14010 flipVariations, 14011 allowedAutoPlacements 14012 }) : placement2); 14013 }, []); 14014 var referenceRect = state.rects.reference; 14015 var popperRect = state.rects.popper; 14016 var checksMap = new Map; 14017 var makeFallbackChecks = true; 14018 var firstFittingPlacement = placements2[0]; 14019 for (var i = 0;i < placements2.length; i++) { 14020 var placement = placements2[i]; 14021 var _basePlacement = getBasePlacement(placement); 14022 var isStartVariation = getVariation(placement) === start2; 14023 var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; 14024 var len = isVertical ? "width" : "height"; 14025 var overflow = detectOverflow(state, { 14026 placement, 14027 boundary, 14028 rootBoundary, 14029 altBoundary, 14030 padding 14031 }); 14032 var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; 14033 if (referenceRect[len] > popperRect[len]) { 14034 mainVariationSide = getOppositePlacement(mainVariationSide); 14035 } 14036 var altVariationSide = getOppositePlacement(mainVariationSide); 14037 var checks = []; 14038 if (checkMainAxis) { 14039 checks.push(overflow[_basePlacement] <= 0); 14040 } 14041 if (checkAltAxis) { 14042 checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); 14043 } 14044 if (checks.every(function(check) { 14045 return check; 14046 })) { 14047 firstFittingPlacement = placement; 14048 makeFallbackChecks = false; 14049 break; 14050 } 14051 checksMap.set(placement, checks); 14052 } 14053 if (makeFallbackChecks) { 14054 var numberOfChecks = flipVariations ? 3 : 1; 14055 var _loop = function _loop2(_i2) { 14056 var fittingPlacement = placements2.find(function(placement2) { 14057 var checks2 = checksMap.get(placement2); 14058 if (checks2) { 14059 return checks2.slice(0, _i2).every(function(check) { 14060 return check; 14061 }); 14062 } 14063 }); 14064 if (fittingPlacement) { 14065 firstFittingPlacement = fittingPlacement; 14066 return "break"; 14067 } 14068 }; 14069 for (var _i = numberOfChecks;_i > 0; _i--) { 14070 var _ret = _loop(_i); 14071 if (_ret === "break") 14072 break; 14073 } 14074 } 14075 if (state.placement !== firstFittingPlacement) { 14076 state.modifiersData[name]._skip = true; 14077 state.placement = firstFittingPlacement; 14078 state.reset = true; 14079 } 14080} 14081var flip_default = { 14082 name: "flip", 14083 enabled: true, 14084 phase: "main", 14085 fn: flip, 14086 requiresIfExists: ["offset"], 14087 data: { 14088 _skip: false 14089 } 14090};
vendor: 1,738 bytes, lines 14091-14143
14091// node_modules/@popperjs/core/lib/modifiers/hide.js 14092function getSideOffsets(overflow, rect, preventedOffsets) { 14093 if (preventedOffsets === undefined) { 14094 preventedOffsets = { 14095 x: 0, 14096 y: 0 14097 }; 14098 } 14099 return { 14100 top: overflow.top - rect.height - preventedOffsets.y, 14101 right: overflow.right - rect.width + preventedOffsets.x, 14102 bottom: overflow.bottom - rect.height + preventedOffsets.y, 14103 left: overflow.left - rect.width - preventedOffsets.x 14104 }; 14105} 14106function isAnySideFullyClipped(overflow) { 14107 return [top, right, bottom, left].some(function(side) { 14108 return overflow[side] >= 0; 14109 }); 14110} 14111function hide(_ref) { 14112 var { state, name } = _ref; 14113 var referenceRect = state.rects.reference; 14114 var popperRect = state.rects.popper; 14115 var preventedOffsets = state.modifiersData.preventOverflow; 14116 var referenceOverflow = detectOverflow(state, { 14117 elementContext: "reference" 14118 }); 14119 var popperAltOverflow = detectOverflow(state, { 14120 altBoundary: true 14121 }); 14122 var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); 14123 var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); 14124 var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); 14125 var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); 14126 state.modifiersData[name] = { 14127 referenceClippingOffsets, 14128 popperEscapeOffsets, 14129 isReferenceHidden, 14130 hasPopperEscaped 14131 }; 14132 state.attributes.popper = Object.assign({}, state.attributes.popper, { 14133 "data-popper-reference-hidden": isReferenceHidden, 14134 "data-popper-escaped": hasPopperEscaped 14135 }); 14136} 14137var hide_default = { 14138 name: "hide", 14139 enabled: true, 14140 phase: "main", 14141 requiresIfExists: ["preventOverflow"], 14142 fn: hide 14143};
vendor: 1,357 bytes, lines 14144-14181
14144// node_modules/@popperjs/core/lib/modifiers/offset.js 14145function distanceAndSkiddingToXY(placement, rects, offset) { 14146 var basePlacement = getBasePlacement(placement); 14147 var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; 14148 var _ref = typeof offset === "function" ? offset(Object.assign({}, rects, { 14149 placement 14150 })) : offset, skidding = _ref[0], distance = _ref[1]; 14151 skidding = skidding || 0; 14152 distance = (distance || 0) * invertDistance; 14153 return [left, right].indexOf(basePlacement) >= 0 ? { 14154 x: distance, 14155 y: skidding 14156 } : { 14157 x: skidding, 14158 y: distance 14159 }; 14160} 14161function offset(_ref2) { 14162 var { state, options, name } = _ref2; 14163 var _options$offset = options.offset, offset2 = _options$offset === undefined ? [0, 0] : _options$offset; 14164 var data = placements.reduce(function(acc, placement) { 14165 acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2); 14166 return acc; 14167 }, {}); 14168 var _data$state$placement = data[state.placement], x2 = _data$state$placement.x, y2 = _data$state$placement.y; 14169 if (state.modifiersData.popperOffsets != null) { 14170 state.modifiersData.popperOffsets.x += x2; 14171 state.modifiersData.popperOffsets.y += y2; 14172 } 14173 state.modifiersData[name] = data; 14174} 14175var offset_default = { 14176 name: "offset", 14177 enabled: true, 14178 phase: "main", 14179 requires: ["popperOffsets"], 14180 fn: offset 14181};
vendor: 430 bytes, lines 14182-14198
14182// node_modules/@popperjs/core/lib/modifiers/popperOffsets.js 14183function popperOffsets(_ref) { 14184 var { state, name } = _ref; 14185 state.modifiersData[name] = computeOffsets({ 14186 reference: state.rects.reference, 14187 element: state.rects.popper, 14188 strategy: "absolute", 14189 placement: state.placement 14190 }); 14191} 14192var popperOffsets_default = { 14193 name: "popperOffsets", 14194 enabled: true, 14195 phase: "read", 14196 fn: popperOffsets, 14197 data: {} 14198};
vendor: 121 bytes, lines 14199-14203
14199// node_modules/@popperjs/core/lib/utils/getAltAxis.js 14200function getAltAxis(axis) { 14201 return axis === "x" ? "y" : "x"; 14202} 14203
vendor: 5,354 bytes, lines 14204-14295
14204// node_modules/@popperjs/core/lib/modifiers/preventOverflow.js 14205function preventOverflow(_ref) { 14206 var { state, options, name } = _ref; 14207 var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === undefined ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === undefined ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === undefined ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === undefined ? 0 : _options$tetherOffset; 14208 var overflow = detectOverflow(state, { 14209 boundary, 14210 rootBoundary, 14211 padding, 14212 altBoundary 14213 }); 14214 var basePlacement = getBasePlacement(state.placement); 14215 var variation = getVariation(state.placement); 14216 var isBasePlacement = !variation; 14217 var mainAxis = getMainAxisFromPlacement(basePlacement); 14218 var altAxis = getAltAxis(mainAxis); 14219 var popperOffsets2 = state.modifiersData.popperOffsets; 14220 var referenceRect = state.rects.reference; 14221 var popperRect = state.rects.popper; 14222 var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, { 14223 placement: state.placement 14224 })) : tetherOffset; 14225 var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? { 14226 mainAxis: tetherOffsetValue, 14227 altAxis: tetherOffsetValue 14228 } : Object.assign({ 14229 mainAxis: 0, 14230 altAxis: 0 14231 }, tetherOffsetValue); 14232 var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null; 14233 var data = { 14234 x: 0, 14235 y: 0 14236 }; 14237 if (!popperOffsets2) { 14238 return; 14239 } 14240 if (checkMainAxis) { 14241 var _offsetModifierState$; 14242 var mainSide = mainAxis === "y" ? top : left; 14243 var altSide = mainAxis === "y" ? bottom : right; 14244 var len = mainAxis === "y" ? "height" : "width"; 14245 var offset2 = popperOffsets2[mainAxis]; 14246 var min2 = offset2 + overflow[mainSide]; 14247 var max2 = offset2 - overflow[altSide]; 14248 var additive = tether ? -popperRect[len] / 2 : 0; 14249 var minLen = variation === start2 ? referenceRect[len] : popperRect[len]; 14250 var maxLen = variation === start2 ? -popperRect[len] : -referenceRect[len]; 14251 var arrowElement = state.elements.arrow; 14252 var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { 14253 width: 0, 14254 height: 0 14255 }; 14256 var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject(); 14257 var arrowPaddingMin = arrowPaddingObject[mainSide]; 14258 var arrowPaddingMax = arrowPaddingObject[altSide]; 14259 var arrowLen = within(0, referenceRect[len], arrowRect[len]); 14260 var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis; 14261 var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis; 14262 var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); 14263 var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; 14264 var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? undefined : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0; 14265 var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset; 14266 var tetherMax = offset2 + maxOffset - offsetModifierValue; 14267 var preventedOffset = within(tether ? min(min2, tetherMin) : min2, offset2, tether ? max(max2, tetherMax) : max2); 14268 popperOffsets2[mainAxis] = preventedOffset; 14269 data[mainAxis] = preventedOffset - offset2; 14270 } 14271 if (checkAltAxis) { 14272 var _offsetModifierState$2; 14273 var _mainSide = mainAxis === "x" ? top : left; 14274 var _altSide = mainAxis === "x" ? bottom : right; 14275 var _offset = popperOffsets2[altAxis]; 14276 var _len = altAxis === "y" ? "height" : "width"; 14277 var _min = _offset + overflow[_mainSide]; 14278 var _max = _offset - overflow[_altSide]; 14279 var isOriginSide = [top, left].indexOf(basePlacement) !== -1; 14280 var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? undefined : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0; 14281 var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis; 14282 var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max; 14283 var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max); 14284 popperOffsets2[altAxis] = _preventedOffset; 14285 data[altAxis] = _preventedOffset - _offset; 14286 } 14287 state.modifiersData[name] = data; 14288} 14289var preventOverflow_default = { 14290 name: "preventOverflow", 14291 enabled: true, 14292 phase: "main", 14293 fn: preventOverflow, 14294 requiresIfExists: ["offset"] 14295};
vendor: 198 bytes, lines 14296-14303
14296// node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js 14297function getHTMLElementScroll(element) { 14298 return { 14299 scrollLeft: element.scrollLeft, 14300 scrollTop: element.scrollTop 14301 }; 14302} 14303
vendor: 242 bytes, lines 14304-14312
14304// node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js 14305function getNodeScroll(node) { 14306 if (node === getWindow(node) || !isHTMLElement(node)) { 14307 return getWindowScroll(node); 14308 } else { 14309 return getHTMLElementScroll(node); 14310 } 14311} 14312
vendor: 1,501 bytes, lines 14313-14355
14313// node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js 14314function isElementScaled(element) { 14315 var rect = element.getBoundingClientRect(); 14316 var scaleX = round(rect.width) / element.offsetWidth || 1; 14317 var scaleY = round(rect.height) / element.offsetHeight || 1; 14318 return scaleX !== 1 || scaleY !== 1; 14319} 14320function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { 14321 if (isFixed === undefined) { 14322 isFixed = false; 14323 } 14324 var isOffsetParentAnElement = isHTMLElement(offsetParent); 14325 var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent); 14326 var documentElement = getDocumentElement(offsetParent); 14327 var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed); 14328 var scroll = { 14329 scrollLeft: 0, 14330 scrollTop: 0 14331 }; 14332 var offsets = { 14333 x: 0, 14334 y: 0 14335 }; 14336 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 14337 if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) { 14338 scroll = getNodeScroll(offsetParent); 14339 } 14340 if (isHTMLElement(offsetParent)) { 14341 offsets = getBoundingClientRect(offsetParent, true); 14342 offsets.x += offsetParent.clientLeft; 14343 offsets.y += offsetParent.clientTop; 14344 } else if (documentElement) { 14345 offsets.x = getWindowScrollBarX(documentElement); 14346 } 14347 } 14348 return { 14349 x: rect.left + scroll.scrollLeft - offsets.x, 14350 y: rect.top + scroll.scrollTop - offsets.y, 14351 width: rect.width, 14352 height: rect.height 14353 }; 14354} 14355
vendor: 1,001 bytes, lines 14356-14392
14356// node_modules/@popperjs/core/lib/utils/orderModifiers.js 14357function order(modifiers) { 14358 var map = new Map; 14359 var visited = new Set; 14360 var result = []; 14361 modifiers.forEach(function(modifier) { 14362 map.set(modifier.name, modifier); 14363 }); 14364 function sort(modifier) { 14365 visited.add(modifier.name); 14366 var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); 14367 requires.forEach(function(dep) { 14368 if (!visited.has(dep)) { 14369 var depModifier = map.get(dep); 14370 if (depModifier) { 14371 sort(depModifier); 14372 } 14373 } 14374 }); 14375 result.push(modifier); 14376 } 14377 modifiers.forEach(function(modifier) { 14378 if (!visited.has(modifier.name)) { 14379 sort(modifier); 14380 } 14381 }); 14382 return result; 14383} 14384function orderModifiers(modifiers) { 14385 var orderedModifiers = order(modifiers); 14386 return modifierPhases.reduce(function(acc, phase) { 14387 return acc.concat(orderedModifiers.filter(function(modifier) { 14388 return modifier.phase === phase; 14389 })); 14390 }, []); 14391} 14392
vendor: 340 bytes, lines 14393-14408
14393// node_modules/@popperjs/core/lib/utils/debounce.js 14394function debounce(fn2) { 14395 var pending; 14396 return function() { 14397 if (!pending) { 14398 pending = new Promise(function(resolve) { 14399 Promise.resolve().then(function() { 14400 pending = undefined; 14401 resolve(fn2()); 14402 }); 14403 }); 14404 } 14405 return pending; 14406 }; 14407} 14408
vendor: 529 bytes, lines 14409-14423
14409// node_modules/@popperjs/core/lib/utils/mergeByName.js 14410function mergeByName(modifiers) { 14411 var merged = modifiers.reduce(function(merged2, current) { 14412 var existing = merged2[current.name]; 14413 merged2[current.name] = existing ? Object.assign({}, existing, current, { 14414 options: Object.assign({}, existing.options, current.options), 14415 data: Object.assign({}, existing.data, current.data) 14416 }) : current; 14417 return merged2; 14418 }, {}); 14419 return Object.keys(merged).map(function(key) { 14420 return merged[key]; 14421 }); 14422} 14423
vendor: 4,969 bytes, lines 14424-14555
14424// node_modules/@popperjs/core/lib/createPopper.js 14425var DEFAULT_OPTIONS = { 14426 placement: "bottom", 14427 modifiers: [], 14428 strategy: "absolute" 14429}; 14430function areValidElements() { 14431 for (var _len = arguments.length, args = new Array(_len), _key = 0;_key < _len; _key++) { 14432 args[_key] = arguments[_key]; 14433 } 14434 return !args.some(function(element) { 14435 return !(element && typeof element.getBoundingClientRect === "function"); 14436 }); 14437} 14438function popperGenerator(generatorOptions) { 14439 if (generatorOptions === undefined) { 14440 generatorOptions = {}; 14441 } 14442 var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === undefined ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === undefined ? DEFAULT_OPTIONS : _generatorOptions$def2; 14443 return function createPopper(reference2, popper2, options) { 14444 if (options === undefined) { 14445 options = defaultOptions2; 14446 } 14447 var state = { 14448 placement: "bottom", 14449 orderedModifiers: [], 14450 options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2), 14451 modifiersData: {}, 14452 elements: { 14453 reference: reference2, 14454 popper: popper2 14455 }, 14456 attributes: {}, 14457 styles: {} 14458 }; 14459 var effectCleanupFns = []; 14460 var isDestroyed = false; 14461 var instance = { 14462 state, 14463 setOptions: function setOptions(setOptionsAction) { 14464 var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction; 14465 cleanupModifierEffects(); 14466 state.options = Object.assign({}, defaultOptions2, state.options, options2); 14467 state.scrollParents = { 14468 reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [], 14469 popper: listScrollParents(popper2) 14470 }; 14471 var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); 14472 state.orderedModifiers = orderedModifiers.filter(function(m2) { 14473 return m2.enabled; 14474 }); 14475 runModifierEffects(); 14476 return instance.update(); 14477 }, 14478 forceUpdate: function forceUpdate() { 14479 if (isDestroyed) { 14480 return; 14481 } 14482 var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper; 14483 if (!areValidElements(reference3, popper3)) { 14484 return; 14485 } 14486 state.rects = { 14487 reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"), 14488 popper: getLayoutRect(popper3) 14489 }; 14490 state.reset = false; 14491 state.placement = state.options.placement; 14492 state.orderedModifiers.forEach(function(modifier) { 14493 return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); 14494 }); 14495 for (var index = 0;index < state.orderedModifiers.length; index++) { 14496 if (state.reset === true) { 14497 state.reset = false; 14498 index = -1; 14499 continue; 14500 } 14501 var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === undefined ? {} : _state$orderedModifie2, name = _state$orderedModifie.name; 14502 if (typeof fn2 === "function") { 14503 state = fn2({ 14504 state, 14505 options: _options, 14506 name, 14507 instance 14508 }) || state; 14509 } 14510 } 14511 }, 14512 update: debounce(function() { 14513 return new Promise(function(resolve) { 14514 instance.forceUpdate(); 14515 resolve(state); 14516 }); 14517 }), 14518 destroy: function destroy() { 14519 cleanupModifierEffects(); 14520 isDestroyed = true; 14521 } 14522 }; 14523 if (!areValidElements(reference2, popper2)) { 14524 return instance; 14525 } 14526 instance.setOptions(options).then(function(state2) { 14527 if (!isDestroyed && options.onFirstUpdate) { 14528 options.onFirstUpdate(state2); 14529 } 14530 }); 14531 function runModifierEffects() { 14532 state.orderedModifiers.forEach(function(_ref) { 14533 var { name, options: _ref$options } = _ref, options2 = _ref$options === undefined ? {} : _ref$options, effect4 = _ref.effect; 14534 if (typeof effect4 === "function") { 14535 var cleanupFn = effect4({ 14536 state, 14537 name, 14538 instance, 14539 options: options2 14540 }); 14541 var noopFn = function noopFn2() {}; 14542 effectCleanupFns.push(cleanupFn || noopFn); 14543 } 14544 }); 14545 } 14546 function cleanupModifierEffects() { 14547 effectCleanupFns.forEach(function(fn2) { 14548 return fn2(); 14549 }); 14550 effectCleanupFns = []; 14551 } 14552 return instance; 14553 }; 14554} 14555var createPopper = /* @__PURE__ */ popperGenerator();
vendor: 244 bytes, lines 14556-14561
14556// node_modules/@popperjs/core/lib/popper-lite.js 14557var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default]; 14558var createPopper2 = /* @__PURE__ */ popperGenerator({ 14559 defaultModifiers 14560}); 14561
vendor: 342 bytes, lines 14562-14566
14562// node_modules/@popperjs/core/lib/popper.js 14563var defaultModifiers2 = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default, offset_default, flip_default, preventOverflow_default, arrow_default, hide_default]; 14564var createPopper3 = /* @__PURE__ */ popperGenerator({ 14565 defaultModifiers: defaultModifiers2 14566});
vendor: 115,156 bytes, lines 14567-18153
14567// node_modules/bootstrap/dist/js/bootstrap.esm.js 14568/*! 14569 * Bootstrap v5.3.2 (https://getbootstrap.com/) 14570 * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 14571 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 14572 */ 14573var elementMap = new Map; 14574var Data = { 14575 set(element, key, instance) { 14576 if (!elementMap.has(element)) { 14577 elementMap.set(element, new Map); 14578 } 14579 const instanceMap = elementMap.get(element); 14580 if (!instanceMap.has(key) && instanceMap.size !== 0) { 14581 console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`); 14582 return; 14583 } 14584 instanceMap.set(key, instance); 14585 }, 14586 get(element, key) { 14587 if (elementMap.has(element)) { 14588 return elementMap.get(element).get(key) || null; 14589 } 14590 return null; 14591 }, 14592 remove(element, key) { 14593 if (!elementMap.has(element)) { 14594 return; 14595 } 14596 const instanceMap = elementMap.get(element); 14597 instanceMap.delete(key); 14598 if (instanceMap.size === 0) { 14599 elementMap.delete(element); 14600 } 14601 } 14602}; 14603var MAX_UID = 1e6; 14604var MILLISECONDS_MULTIPLIER = 1000; 14605var TRANSITION_END = "transitionend"; 14606var parseSelector = (selector) => { 14607 if (selector && window.CSS && window.CSS.escape) { 14608 selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`); 14609 } 14610 return selector; 14611}; 14612var toType = (object) => { 14613 if (object === null || object === undefined) { 14614 return `${object}`; 14615 } 14616 return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase(); 14617}; 14618var getUID = (prefix) => { 14619 do { 14620 prefix += Math.floor(Math.random() * MAX_UID); 14621 } while (document.getElementById(prefix)); 14622 return prefix; 14623}; 14624var getTransitionDurationFromElement = (element) => { 14625 if (!element) { 14626 return 0; 14627 } 14628 let { 14629 transitionDuration, 14630 transitionDelay 14631 } = window.getComputedStyle(element); 14632 const floatTransitionDuration = Number.parseFloat(transitionDuration); 14633 const floatTransitionDelay = Number.parseFloat(transitionDelay); 14634 if (!floatTransitionDuration && !floatTransitionDelay) { 14635 return 0; 14636 } 14637 transitionDuration = transitionDuration.split(",")[0]; 14638 transitionDelay = transitionDelay.split(",")[0]; 14639 return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 14640}; 14641var triggerTransitionEnd = (element) => { 14642 element.dispatchEvent(new Event(TRANSITION_END)); 14643}; 14644var isElement2 = (object) => { 14645 if (!object || typeof object !== "object") { 14646 return false; 14647 } 14648 if (typeof object.jquery !== "undefined") { 14649 object = object[0]; 14650 } 14651 return typeof object.nodeType !== "undefined"; 14652}; 14653var getElement = (object) => { 14654 if (isElement2(object)) { 14655 return object.jquery ? object[0] : object; 14656 } 14657 if (typeof object === "string" && object.length > 0) { 14658 return document.querySelector(parseSelector(object)); 14659 } 14660 return null; 14661}; 14662var isVisible = (element) => { 14663 if (!isElement2(element) || element.getClientRects().length === 0) { 14664 return false; 14665 } 14666 const elementIsVisible = getComputedStyle(element).getPropertyValue("visibility") === "visible"; 14667 const closedDetails = element.closest("details:not([open])"); 14668 if (!closedDetails) { 14669 return elementIsVisible; 14670 } 14671 if (closedDetails !== element) { 14672 const summary = element.closest("summary"); 14673 if (summary && summary.parentNode !== closedDetails) { 14674 return false; 14675 } 14676 if (summary === null) { 14677 return false; 14678 } 14679 } 14680 return elementIsVisible; 14681}; 14682var isDisabled = (element) => { 14683 if (!element || element.nodeType !== Node.ELEMENT_NODE) { 14684 return true; 14685 } 14686 if (element.classList.contains("disabled")) { 14687 return true; 14688 } 14689 if (typeof element.disabled !== "undefined") { 14690 return element.disabled; 14691 } 14692 return element.hasAttribute("disabled") && element.getAttribute("disabled") !== "false"; 14693}; 14694var findShadowRoot = (element) => { 14695 if (!document.documentElement.attachShadow) { 14696 return null; 14697 } 14698 if (typeof element.getRootNode === "function") { 14699 const root = element.getRootNode(); 14700 return root instanceof ShadowRoot ? root : null; 14701 } 14702 if (element instanceof ShadowRoot) { 14703 return element; 14704 } 14705 if (!element.parentNode) { 14706 return null; 14707 } 14708 return findShadowRoot(element.parentNode); 14709}; 14710var noop = () => {}; 14711var reflow = (element) => { 14712 element.offsetHeight; 14713}; 14714var getjQuery = () => { 14715 if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) { 14716 return window.jQuery; 14717 } 14718 return null; 14719}; 14720var DOMContentLoadedCallbacks = []; 14721var onDOMContentLoaded = (callback) => { 14722 if (document.readyState === "loading") { 14723 if (!DOMContentLoadedCallbacks.length) { 14724 document.addEventListener("DOMContentLoaded", () => { 14725 for (const callback2 of DOMContentLoadedCallbacks) { 14726 callback2(); 14727 } 14728 }); 14729 } 14730 DOMContentLoadedCallbacks.push(callback); 14731 } else { 14732 callback(); 14733 } 14734}; 14735var isRTL = () => document.documentElement.dir === "rtl"; 14736var defineJQueryPlugin = (plugin) => { 14737 onDOMContentLoaded(() => { 14738 const $ = getjQuery(); 14739 if ($) { 14740 const name = plugin.NAME; 14741 const JQUERY_NO_CONFLICT = $.fn[name]; 14742 $.fn[name] = plugin.jQueryInterface; 14743 $.fn[name].Constructor = plugin; 14744 $.fn[name].noConflict = () => { 14745 $.fn[name] = JQUERY_NO_CONFLICT; 14746 return plugin.jQueryInterface; 14747 }; 14748 } 14749 }); 14750}; 14751var execute = (possibleCallback, args = [], defaultValue = possibleCallback) => { 14752 return typeof possibleCallback === "function" ? possibleCallback(...args) : defaultValue; 14753}; 14754var executeAfterTransition = (callback, transitionElement, waitForTransition = true) => { 14755 if (!waitForTransition) { 14756 execute(callback); 14757 return; 14758 } 14759 const durationPadding = 5; 14760 const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding; 14761 let called = false; 14762 const handler = ({ 14763 target 14764 }) => { 14765 if (target !== transitionElement) { 14766 return; 14767 } 14768 called = true; 14769 transitionElement.removeEventListener(TRANSITION_END, handler); 14770 execute(callback); 14771 }; 14772 transitionElement.addEventListener(TRANSITION_END, handler); 14773 setTimeout(() => { 14774 if (!called) { 14775 triggerTransitionEnd(transitionElement); 14776 } 14777 }, emulatedDuration); 14778}; 14779var getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => { 14780 const listLength = list.length; 14781 let index = list.indexOf(activeElement); 14782 if (index === -1) { 14783 return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]; 14784 } 14785 index += shouldGetNext ? 1 : -1; 14786 if (isCycleAllowed) { 14787 index = (index + listLength) % listLength; 14788 } 14789 return list[Math.max(0, Math.min(index, listLength - 1))]; 14790}; 14791var namespaceRegex = /[^.]*(?=\..*)\.|.*/; 14792var stripNameRegex = /\..*/; 14793var stripUidRegex = /::\d+$/; 14794var eventRegistry = {}; 14795var uidEvent = 1; 14796var customEvents = { 14797 mouseenter: "mouseover", 14798 mouseleave: "mouseout" 14799}; 14800var nativeEvents = new Set(["click", "dblclick", "mouseup", "mousedown", "contextmenu", "mousewheel", "DOMMouseScroll", "mouseover", "mouseout", "mousemove", "selectstart", "selectend", "keydown", "keypress", "keyup", "orientationchange", "touchstart", "touchmove", "touchend", "touchcancel", "pointerdown", "pointermove", "pointerup", "pointerleave", "pointercancel", "gesturestart", "gesturechange", "gestureend", "focus", "blur", "change", "reset", "select", "submit", "focusin", "focusout", "load", "unload", "beforeunload", "resize", "move", "DOMContentLoaded", "readystatechange", "error", "abort", "scroll"]); 14801function makeEventUid(element, uid) { 14802 return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; 14803} 14804function getElementEvents(element) { 14805 const uid = makeEventUid(element); 14806 element.uidEvent = uid; 14807 eventRegistry[uid] = eventRegistry[uid] || {}; 14808 return eventRegistry[uid]; 14809} 14810function bootstrapHandler(element, fn2) { 14811 return function handler(event) { 14812 hydrateObj(event, { 14813 delegateTarget: element 14814 }); 14815 if (handler.oneOff) { 14816 EventHandler.off(element, event.type, fn2); 14817 } 14818 return fn2.apply(element, [event]); 14819 }; 14820} 14821function bootstrapDelegationHandler(element, selector, fn2) { 14822 return function handler(event) { 14823 const domElements = element.querySelectorAll(selector); 14824 for (let { 14825 target 14826 } = event;target && target !== this; target = target.parentNode) { 14827 for (const domElement of domElements) { 14828 if (domElement !== target) { 14829 continue; 14830 } 14831 hydrateObj(event, { 14832 delegateTarget: target 14833 }); 14834 if (handler.oneOff) { 14835 EventHandler.off(element, event.type, selector, fn2); 14836 } 14837 return fn2.apply(target, [event]); 14838 } 14839 } 14840 }; 14841} 14842function findHandler(events, callable, delegationSelector = null) { 14843 return Object.values(events).find((event) => event.callable === callable && event.delegationSelector === delegationSelector); 14844} 14845function normalizeParameters(originalTypeEvent, handler, delegationFunction) { 14846 const isDelegated = typeof handler === "string"; 14847 const callable = isDelegated ? delegationFunction : handler || delegationFunction; 14848 let typeEvent = getTypeEvent(originalTypeEvent); 14849 if (!nativeEvents.has(typeEvent)) { 14850 typeEvent = originalTypeEvent; 14851 } 14852 return [isDelegated, callable, typeEvent]; 14853} 14854function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { 14855 if (typeof originalTypeEvent !== "string" || !element) { 14856 return; 14857 } 14858 let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 14859 if (originalTypeEvent in customEvents) { 14860 const wrapFunction = (fn3) => { 14861 return function(event) { 14862 if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) { 14863 return fn3.call(this, event); 14864 } 14865 }; 14866 }; 14867 callable = wrapFunction(callable); 14868 } 14869 const events = getElementEvents(element); 14870 const handlers = events[typeEvent] || (events[typeEvent] = {}); 14871 const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null); 14872 if (previousFunction) { 14873 previousFunction.oneOff = previousFunction.oneOff && oneOff; 14874 return; 14875 } 14876 const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, "")); 14877 const fn2 = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable); 14878 fn2.delegationSelector = isDelegated ? handler : null; 14879 fn2.callable = callable; 14880 fn2.oneOff = oneOff; 14881 fn2.uidEvent = uid; 14882 handlers[uid] = fn2; 14883 element.addEventListener(typeEvent, fn2, isDelegated); 14884} 14885function removeHandler(element, events, typeEvent, handler, delegationSelector) { 14886 const fn2 = findHandler(events[typeEvent], handler, delegationSelector); 14887 if (!fn2) { 14888 return; 14889 } 14890 element.removeEventListener(typeEvent, fn2, Boolean(delegationSelector)); 14891 delete events[typeEvent][fn2.uidEvent]; 14892} 14893function removeNamespacedHandlers(element, events, typeEvent, namespace) { 14894 const storeElementEvent = events[typeEvent] || {}; 14895 for (const [handlerKey, event] of Object.entries(storeElementEvent)) { 14896 if (handlerKey.includes(namespace)) { 14897 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 14898 } 14899 } 14900} 14901function getTypeEvent(event) { 14902 event = event.replace(stripNameRegex, ""); 14903 return customEvents[event] || event; 14904} 14905var EventHandler = { 14906 on(element, event, handler, delegationFunction) { 14907 addHandler(element, event, handler, delegationFunction, false); 14908 }, 14909 one(element, event, handler, delegationFunction) { 14910 addHandler(element, event, handler, delegationFunction, true); 14911 }, 14912 off(element, originalTypeEvent, handler, delegationFunction) { 14913 if (typeof originalTypeEvent !== "string" || !element) { 14914 return; 14915 } 14916 const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); 14917 const inNamespace = typeEvent !== originalTypeEvent; 14918 const events = getElementEvents(element); 14919 const storeElementEvent = events[typeEvent] || {}; 14920 const isNamespace = originalTypeEvent.startsWith("."); 14921 if (typeof callable !== "undefined") { 14922 if (!Object.keys(storeElementEvent).length) { 14923 return; 14924 } 14925 removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null); 14926 return; 14927 } 14928 if (isNamespace) { 14929 for (const elementEvent of Object.keys(events)) { 14930 removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); 14931 } 14932 } 14933 for (const [keyHandlers, event] of Object.entries(storeElementEvent)) { 14934 const handlerKey = keyHandlers.replace(stripUidRegex, ""); 14935 if (!inNamespace || originalTypeEvent.includes(handlerKey)) { 14936 removeHandler(element, events, typeEvent, event.callable, event.delegationSelector); 14937 } 14938 } 14939 }, 14940 trigger(element, event, args) { 14941 if (typeof event !== "string" || !element) { 14942 return null; 14943 } 14944 const $ = getjQuery(); 14945 const typeEvent = getTypeEvent(event); 14946 const inNamespace = event !== typeEvent; 14947 let jQueryEvent = null; 14948 let bubbles = true; 14949 let nativeDispatch = true; 14950 let defaultPrevented = false; 14951 if (inNamespace && $) { 14952 jQueryEvent = $.Event(event, args); 14953 $(element).trigger(jQueryEvent); 14954 bubbles = !jQueryEvent.isPropagationStopped(); 14955 nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); 14956 defaultPrevented = jQueryEvent.isDefaultPrevented(); 14957 } 14958 const evt = hydrateObj(new Event(event, { 14959 bubbles, 14960 cancelable: true 14961 }), args); 14962 if (defaultPrevented) { 14963 evt.preventDefault(); 14964 } 14965 if (nativeDispatch) { 14966 element.dispatchEvent(evt); 14967 } 14968 if (evt.defaultPrevented && jQueryEvent) { 14969 jQueryEvent.preventDefault(); 14970 } 14971 return evt; 14972 } 14973}; 14974function hydrateObj(obj, meta = {}) { 14975 for (const [key, value] of Object.entries(meta)) { 14976 try { 14977 obj[key] = value; 14978 } catch (_unused) { 14979 Object.defineProperty(obj, key, { 14980 configurable: true, 14981 get() { 14982 return value; 14983 } 14984 }); 14985 } 14986 } 14987 return obj; 14988} 14989function normalizeData(value) { 14990 if (value === "true") { 14991 return true; 14992 } 14993 if (value === "false") { 14994 return false; 14995 } 14996 if (value === Number(value).toString()) { 14997 return Number(value); 14998 } 14999 if (value === "" || value === "null") { 15000 return null; 15001 } 15002 if (typeof value !== "string") { 15003 return value; 15004 } 15005 try { 15006 return JSON.parse(decodeURIComponent(value)); 15007 } catch (_unused) { 15008 return value; 15009 } 15010} 15011function normalizeDataKey(key) { 15012 return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`); 15013} 15014var Manipulator = { 15015 setDataAttribute(element, key, value) { 15016 element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value); 15017 }, 15018 removeDataAttribute(element, key) { 15019 element.removeAttribute(`data-bs-${normalizeDataKey(key)}`); 15020 }, 15021 getDataAttributes(element) { 15022 if (!element) { 15023 return {}; 15024 } 15025 const attributes = {}; 15026 const bsKeys = Object.keys(element.dataset).filter((key) => key.startsWith("bs") && !key.startsWith("bsConfig")); 15027 for (const key of bsKeys) { 15028 let pureKey = key.replace(/^bs/, ""); 15029 pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); 15030 attributes[pureKey] = normalizeData(element.dataset[key]); 15031 } 15032 return attributes; 15033 }, 15034 getDataAttribute(element, key) { 15035 return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`)); 15036 } 15037}; 15038 15039class Config { 15040 static get Default() { 15041 return {}; 15042 } 15043 static get DefaultType() { 15044 return {}; 15045 } 15046 static get NAME() { 15047 throw new Error('You have to implement the static method "NAME", for each component!'); 15048 } 15049 _getConfig(config) { 15050 config = this._mergeConfigObj(config); 15051 config = this._configAfterMerge(config); 15052 this._typeCheckConfig(config); 15053 return config; 15054 } 15055 _configAfterMerge(config) { 15056 return config; 15057 } 15058 _mergeConfigObj(config, element) { 15059 const jsonConfig = isElement2(element) ? Manipulator.getDataAttribute(element, "config") : {}; 15060 return { 15061 ...this.constructor.Default, 15062 ...typeof jsonConfig === "object" ? jsonConfig : {}, 15063 ...isElement2(element) ? Manipulator.getDataAttributes(element) : {}, 15064 ...typeof config === "object" ? config : {} 15065 }; 15066 } 15067 _typeCheckConfig(config, configTypes = this.constructor.DefaultType) { 15068 for (const [property, expectedTypes] of Object.entries(configTypes)) { 15069 const value = config[property]; 15070 const valueType = isElement2(value) ? "element" : toType(value); 15071 if (!new RegExp(expectedTypes).test(valueType)) { 15072 throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`); 15073 } 15074 } 15075 } 15076} 15077var VERSION = "5.3.2"; 15078 15079class BaseComponent extends Config { 15080 constructor(element, config) { 15081 super(); 15082 element = getElement(element); 15083 if (!element) { 15084 return; 15085 } 15086 this._element = element; 15087 this._config = this._getConfig(config); 15088 Data.set(this._element, this.constructor.DATA_KEY, this); 15089 } 15090 dispose() { 15091 Data.remove(this._element, this.constructor.DATA_KEY); 15092 EventHandler.off(this._element, this.constructor.EVENT_KEY); 15093 for (const propertyName of Object.getOwnPropertyNames(this)) { 15094 this[propertyName] = null; 15095 } 15096 } 15097 _queueCallback(callback, element, isAnimated = true) { 15098 executeAfterTransition(callback, element, isAnimated); 15099 } 15100 _getConfig(config) { 15101 config = this._mergeConfigObj(config, this._element); 15102 config = this._configAfterMerge(config); 15103 this._typeCheckConfig(config); 15104 return config; 15105 } 15106 static getInstance(element) { 15107 return Data.get(getElement(element), this.DATA_KEY); 15108 } 15109 static getOrCreateInstance(element, config = {}) { 15110 return this.getInstance(element) || new this(element, typeof config === "object" ? config : null); 15111 } 15112 static get VERSION() { 15113 return VERSION; 15114 } 15115 static get DATA_KEY() { 15116 return `bs.${this.NAME}`; 15117 } 15118 static get EVENT_KEY() { 15119 return `.${this.DATA_KEY}`; 15120 } 15121 static eventName(name) { 15122 return `${name}${this.EVENT_KEY}`; 15123 } 15124} 15125var getSelector = (element) => { 15126 let selector = element.getAttribute("data-bs-target"); 15127 if (!selector || selector === "#") { 15128 let hrefAttribute = element.getAttribute("href"); 15129 if (!hrefAttribute || !hrefAttribute.includes("#") && !hrefAttribute.startsWith(".")) { 15130 return null; 15131 } 15132 if (hrefAttribute.includes("#") && !hrefAttribute.startsWith("#")) { 15133 hrefAttribute = `#${hrefAttribute.split("#")[1]}`; 15134 } 15135 selector = hrefAttribute && hrefAttribute !== "#" ? parseSelector(hrefAttribute.trim()) : null; 15136 } 15137 return selector; 15138}; 15139var SelectorEngine = { 15140 find(selector, element = document.documentElement) { 15141 return [].concat(...Element.prototype.querySelectorAll.call(element, selector)); 15142 }, 15143 findOne(selector, element = document.documentElement) { 15144 return Element.prototype.querySelector.call(element, selector); 15145 }, 15146 children(element, selector) { 15147 return [].concat(...element.children).filter((child) => child.matches(selector)); 15148 }, 15149 parents(element, selector) { 15150 const parents = []; 15151 let ancestor = element.parentNode.closest(selector); 15152 while (ancestor) { 15153 parents.push(ancestor); 15154 ancestor = ancestor.parentNode.closest(selector); 15155 } 15156 return parents; 15157 }, 15158 prev(element, selector) { 15159 let previous = element.previousElementSibling; 15160 while (previous) { 15161 if (previous.matches(selector)) { 15162 return [previous]; 15163 } 15164 previous = previous.previousElementSibling; 15165 } 15166 return []; 15167 }, 15168 next(element, selector) { 15169 let next = element.nextElementSibling; 15170 while (next) { 15171 if (next.matches(selector)) { 15172 return [next]; 15173 } 15174 next = next.nextElementSibling; 15175 } 15176 return []; 15177 }, 15178 focusableChildren(element) { 15179 const focusables = ["a", "button", "input", "textarea", "select", "details", "[tabindex]", '[contenteditable="true"]'].map((selector) => `${selector}:not([tabindex^="-"])`).join(","); 15180 return this.find(focusables, element).filter((el) => !isDisabled(el) && isVisible(el)); 15181 }, 15182 getSelectorFromElement(element) { 15183 const selector = getSelector(element); 15184 if (selector) { 15185 return SelectorEngine.findOne(selector) ? selector : null; 15186 } 15187 return null; 15188 }, 15189 getElementFromSelector(element) { 15190 const selector = getSelector(element); 15191 return selector ? SelectorEngine.findOne(selector) : null; 15192 }, 15193 getMultipleElementsFromSelector(element) { 15194 const selector = getSelector(element); 15195 return selector ? SelectorEngine.find(selector) : []; 15196 } 15197}; 15198var enableDismissTrigger = (component, method = "hide") => { 15199 const clickEvent = `click.dismiss${component.EVENT_KEY}`; 15200 const name = component.NAME; 15201 EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function(event) { 15202 if (["A", "AREA"].includes(this.tagName)) { 15203 event.preventDefault(); 15204 } 15205 if (isDisabled(this)) { 15206 return; 15207 } 15208 const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`); 15209 const instance = component.getOrCreateInstance(target); 15210 instance[method](); 15211 }); 15212}; 15213var NAME$f = "alert"; 15214var DATA_KEY$a = "bs.alert"; 15215var EVENT_KEY$b = `.${DATA_KEY$a}`; 15216var EVENT_CLOSE = `close${EVENT_KEY$b}`; 15217var EVENT_CLOSED = `closed${EVENT_KEY$b}`; 15218var CLASS_NAME_FADE$5 = "fade"; 15219var CLASS_NAME_SHOW$8 = "show"; 15220 15221class Alert extends BaseComponent { 15222 static get NAME() { 15223 return NAME$f; 15224 } 15225 close() { 15226 const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE); 15227 if (closeEvent.defaultPrevented) { 15228 return; 15229 } 15230 this._element.classList.remove(CLASS_NAME_SHOW$8); 15231 const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5); 15232 this._queueCallback(() => this._destroyElement(), this._element, isAnimated); 15233 } 15234 _destroyElement() { 15235 this._element.remove(); 15236 EventHandler.trigger(this._element, EVENT_CLOSED); 15237 this.dispose(); 15238 } 15239 static jQueryInterface(config) { 15240 return this.each(function() { 15241 const data = Alert.getOrCreateInstance(this); 15242 if (typeof config !== "string") { 15243 return; 15244 } 15245 if (data[config] === undefined || config.startsWith("_") || config === "constructor") { 15246 throw new TypeError(`No method named "${config}"`); 15247 } 15248 data[config](this); 15249 }); 15250 } 15251} 15252enableDismissTrigger(Alert, "close"); 15253defineJQueryPlugin(Alert); 15254var NAME$e = "button"; 15255var DATA_KEY$9 = "bs.button"; 15256var EVENT_KEY$a = `.${DATA_KEY$9}`; 15257var DATA_API_KEY$6 = ".data-api"; 15258var CLASS_NAME_ACTIVE$3 = "active"; 15259var SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; 15260var EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`; 15261 15262class Button extends BaseComponent { 15263 static get NAME() { 15264 return NAME$e; 15265 } 15266 toggle() { 15267 this._element.setAttribute("aria-pressed", this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); 15268 } 15269 static jQueryInterface(config) { 15270 return this.each(function() { 15271 const data = Button.getOrCreateInstance(this); 15272 if (config === "toggle") { 15273 data[config](); 15274 } 15275 }); 15276 } 15277} 15278EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, (event) => { 15279 event.preventDefault(); 15280 const button = event.target.closest(SELECTOR_DATA_TOGGLE$5); 15281 const data = Button.getOrCreateInstance(button); 15282 data.toggle(); 15283}); 15284defineJQueryPlugin(Button); 15285var NAME$d = "swipe"; 15286var EVENT_KEY$9 = ".bs.swipe"; 15287var EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`; 15288var EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`; 15289var EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`; 15290var EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`; 15291var EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`; 15292var POINTER_TYPE_TOUCH = "touch"; 15293var POINTER_TYPE_PEN = "pen"; 15294var CLASS_NAME_POINTER_EVENT = "pointer-event"; 15295var SWIPE_THRESHOLD = 40; 15296var Default$c = { 15297 endCallback: null, 15298 leftCallback: null, 15299 rightCallback: null 15300}; 15301var DefaultType$c = { 15302 endCallback: "(function|null)", 15303 leftCallback: "(function|null)", 15304 rightCallback: "(function|null)" 15305}; 15306 15307class Swipe extends Config { 15308 constructor(element, config) { 15309 super(); 15310 this._element = element; 15311 if (!element || !Swipe.isSupported()) { 15312 return; 15313 } 15314 this._config = this._getConfig(config); 15315 this._deltaX = 0; 15316 this._supportPointerEvents = Boolean(window.PointerEvent); 15317 this._initEvents(); 15318 } 15319 static get Default() { 15320 return Default$c; 15321 } 15322 static get DefaultType() { 15323 return DefaultType$c; 15324 } 15325 static get NAME() { 15326 return NAME$d; 15327 } 15328 dispose() { 15329 EventHandler.off(this._element, EVENT_KEY$9); 15330 } 15331 _start(event) { 15332 if (!this._supportPointerEvents) { 15333 this._deltaX = event.touches[0].clientX; 15334 return; 15335 } 15336 if (this._eventIsPointerPenTouch(event)) { 15337 this._deltaX = event.clientX; 15338 } 15339 } 15340 _end(event) { 15341 if (this._eventIsPointerPenTouch(event)) { 15342 this._deltaX = event.clientX - this._deltaX; 15343 } 15344 this._handleSwipe(); 15345 execute(this._config.endCallback); 15346 } 15347 _move(event) { 15348 this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX; 15349 } 15350 _handleSwipe() { 15351 const absDeltaX = Math.abs(this._deltaX); 15352 if (absDeltaX <= SWIPE_THRESHOLD) { 15353 return; 15354 } 15355 const direction = absDeltaX / this._deltaX; 15356 this._deltaX = 0; 15357 if (!direction) { 15358 return; 15359 } 15360 execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback); 15361 } 15362 _initEvents() { 15363 if (this._supportPointerEvents) { 15364 EventHandler.on(this._element, EVENT_POINTERDOWN, (event) => this._start(event)); 15365 EventHandler.on(this._element, EVENT_POINTERUP, (event) => this._end(event)); 15366 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 15367 } else { 15368 EventHandler.on(this._element, EVENT_TOUCHSTART, (event) => this._start(event)); 15369 EventHandler.on(this._element, EVENT_TOUCHMOVE, (event) => this._move(event)); 15370 EventHandler.on(this._element, EVENT_TOUCHEND, (event) => this._end(event)); 15371 } 15372 } 15373 _eventIsPointerPenTouch(event) { 15374 return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); 15375 } 15376 static isSupported() { 15377 return "ontouchstart" in document.documentElement || navigator.maxTouchPoints > 0; 15378 } 15379} 15380var NAME$c = "carousel"; 15381var DATA_KEY$8 = "bs.carousel"; 15382var EVENT_KEY$8 = `.${DATA_KEY$8}`; 15383var DATA_API_KEY$5 = ".data-api"; 15384var ARROW_LEFT_KEY$1 = "ArrowLeft"; 15385var ARROW_RIGHT_KEY$1 = "ArrowRight"; 15386var TOUCHEVENT_COMPAT_WAIT = 500; 15387var ORDER_NEXT = "next"; 15388var ORDER_PREV = "prev"; 15389var DIRECTION_LEFT = "left"; 15390var DIRECTION_RIGHT = "right"; 15391var EVENT_SLIDE = `slide${EVENT_KEY$8}`; 15392var EVENT_SLID = `slid${EVENT_KEY$8}`; 15393var EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`; 15394var EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`; 15395var EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`; 15396var EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`; 15397var EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`; 15398var EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`; 15399var CLASS_NAME_CAROUSEL = "carousel"; 15400var CLASS_NAME_ACTIVE$2 = "active"; 15401var CLASS_NAME_SLIDE = "slide"; 15402var CLASS_NAME_END = "carousel-item-end"; 15403var CLASS_NAME_START = "carousel-item-start"; 15404var CLASS_NAME_NEXT = "carousel-item-next"; 15405var CLASS_NAME_PREV = "carousel-item-prev"; 15406var SELECTOR_ACTIVE = ".active"; 15407var SELECTOR_ITEM = ".carousel-item"; 15408var SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM; 15409var SELECTOR_ITEM_IMG = ".carousel-item img"; 15410var SELECTOR_INDICATORS = ".carousel-indicators"; 15411var SELECTOR_DATA_SLIDE = "[data-bs-slide], [data-bs-slide-to]"; 15412var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; 15413var KEY_TO_DIRECTION = { 15414 [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT, 15415 [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT 15416}; 15417var Default$b = { 15418 interval: 5000, 15419 keyboard: true, 15420 pause: "hover", 15421 ride: false, 15422 touch: true, 15423 wrap: true 15424}; 15425var DefaultType$b = { 15426 interval: "(number|boolean)", 15427 keyboard: "boolean", 15428 pause: "(string|boolean)", 15429 ride: "(boolean|string)", 15430 touch: "boolean", 15431 wrap: "boolean" 15432}; 15433 15434class Carousel extends BaseComponent { 15435 constructor(element, config) { 15436 super(element, config); 15437 this._interval = null; 15438 this._activeElement = null; 15439 this._isSliding = false; 15440 this.touchTimeout = null; 15441 this._swipeHelper = null; 15442 this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); 15443 this._addEventListeners(); 15444 if (this._config.ride === CLASS_NAME_CAROUSEL) { 15445 this.cycle(); 15446 } 15447 } 15448 static get Default() { 15449 return Default$b; 15450 } 15451 static get DefaultType() { 15452 return DefaultType$b; 15453 } 15454 static get NAME() { 15455 return NAME$c; 15456 } 15457 next() { 15458 this._slide(ORDER_NEXT); 15459 } 15460 nextWhenVisible() { 15461 if (!document.hidden && isVisible(this._element)) { 15462 this.next(); 15463 } 15464 } 15465 prev() { 15466 this._slide(ORDER_PREV); 15467 } 15468 pause() { 15469 if (this._isSliding) { 15470 triggerTransitionEnd(this._element); 15471 } 15472 this._clearInterval(); 15473 } 15474 cycle() { 15475 this._clearInterval(); 15476 this._updateInterval(); 15477 this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval); 15478 } 15479 _maybeEnableCycle() { 15480 if (!this._config.ride) { 15481 return; 15482 } 15483 if (this._isSliding) { 15484 EventHandler.one(this._element, EVENT_SLID, () => this.cycle()); 15485 return; 15486 } 15487 this.cycle(); 15488 } 15489 to(index) { 15490 const items = this._getItems(); 15491 if (index > items.length - 1 || index < 0) { 15492 return; 15493 } 15494 if (this._isSliding) { 15495 EventHandler.one(this._element, EVENT_SLID, () => this.to(index)); 15496 return; 15497 } 15498 const activeIndex = this._getItemIndex(this._getActive()); 15499 if (activeIndex === index) { 15500 return; 15501 } 15502 const order2 = index > activeIndex ? ORDER_NEXT : ORDER_PREV; 15503 this._slide(order2, items[index]); 15504 } 15505 dispose() { 15506 if (this._swipeHelper) { 15507 this._swipeHelper.dispose(); 15508 } 15509 super.dispose(); 15510 } 15511 _configAfterMerge(config) { 15512 config.defaultInterval = config.interval; 15513 return config; 15514 } 15515 _addEventListeners() { 15516 if (this._config.keyboard) { 15517 EventHandler.on(this._element, EVENT_KEYDOWN$1, (event) => this._keydown(event)); 15518 } 15519 if (this._config.pause === "hover") { 15520 EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause()); 15521 EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle()); 15522 } 15523 if (this._config.touch && Swipe.isSupported()) { 15524 this._addTouchEventListeners(); 15525 } 15526 } 15527 _addTouchEventListeners() { 15528 for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) { 15529 EventHandler.on(img, EVENT_DRAG_START, (event) => event.preventDefault()); 15530 } 15531 const endCallBack = () => { 15532 if (this._config.pause !== "hover") { 15533 return; 15534 } 15535 this.pause(); 15536 if (this.touchTimeout) { 15537 clearTimeout(this.touchTimeout); 15538 } 15539 this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval); 15540 }; 15541 const swipeConfig = { 15542 leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)), 15543 rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)), 15544 endCallback: endCallBack 15545 }; 15546 this._swipeHelper = new Swipe(this._element, swipeConfig); 15547 } 15548 _keydown(event) { 15549 if (/input|textarea/i.test(event.target.tagName)) { 15550 return; 15551 } 15552 const direction = KEY_TO_DIRECTION[event.key]; 15553 if (direction) { 15554 event.preventDefault(); 15555 this._slide(this._directionToOrder(direction)); 15556 } 15557 } 15558 _getItemIndex(element) { 15559 return this._getItems().indexOf(element); 15560 } 15561 _setActiveIndicatorElement(index) { 15562 if (!this._indicatorsElement) { 15563 return; 15564 } 15565 const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement); 15566 activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); 15567 activeIndicator.removeAttribute("aria-current"); 15568 const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement); 15569 if (newActiveIndicator) { 15570 newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2); 15571 newActiveIndicator.setAttribute("aria-current", "true"); 15572 } 15573 } 15574 _updateInterval() { 15575 const element = this._activeElement || this._getActive(); 15576 if (!element) { 15577 return; 15578 } 15579 const elementInterval = Number.parseInt(element.getAttribute("data-bs-interval"), 10); 15580 this._config.interval = elementInterval || this._config.defaultInterval; 15581 } 15582 _slide(order2, element = null) { 15583 if (this._isSliding) { 15584 return; 15585 } 15586 const activeElement = this._getActive(); 15587 const isNext = order2 === ORDER_NEXT; 15588 const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap); 15589 if (nextElement === activeElement) { 15590 return; 15591 } 15592 const nextElementIndex = this._getItemIndex(nextElement); 15593 const triggerEvent = (eventName) => { 15594 return EventHandler.trigger(this._element, eventName, { 15595 relatedTarget: nextElement, 15596 direction: this._orderToDirection(order2), 15597 from: this._getItemIndex(activeElement), 15598 to: nextElementIndex 15599 }); 15600 }; 15601 const slideEvent = triggerEvent(EVENT_SLIDE); 15602 if (slideEvent.defaultPrevented) { 15603 return; 15604 } 15605 if (!activeElement || !nextElement) { 15606 return; 15607 } 15608 const isCycling = Boolean(this._interval); 15609 this.pause(); 15610 this._isSliding = true; 15611 this._setActiveIndicatorElement(nextElementIndex); 15612 this._activeElement = nextElement; 15613 const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END; 15614 const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV; 15615 nextElement.classList.add(orderClassName); 15616 reflow(nextElement); 15617 activeElement.classList.add(directionalClassName); 15618 nextElement.classList.add(directionalClassName); 15619 const completeCallBack = () => { 15620 nextElement.classList.remove(directionalClassName, orderClassName); 15621 nextElement.classList.add(CLASS_NAME_ACTIVE$2); 15622 activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); 15623 this._isSliding = false; 15624 triggerEvent(EVENT_SLID); 15625 }; 15626 this._queueCallback(completeCallBack, activeElement, this._isAnimated()); 15627 if (isCycling) { 15628 this.cycle(); 15629 } 15630 } 15631 _isAnimated() { 15632 return this._element.classList.contains(CLASS_NAME_SLIDE); 15633 } 15634 _getActive() { 15635 return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); 15636 } 15637 _getItems() { 15638 return SelectorEngine.find(SELECTOR_ITEM, this._element); 15639 } 15640 _clearInterval() { 15641 if (this._interval) { 15642 clearInterval(this._interval); 15643 this._interval = null; 15644 } 15645 } 15646 _directionToOrder(direction) { 15647 if (isRTL()) { 15648 return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT; 15649 } 15650 return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV; 15651 } 15652 _orderToDirection(order2) { 15653 if (isRTL()) { 15654 return order2 === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT; 15655 } 15656 return order2 === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT; 15657 } 15658 static jQueryInterface(config) { 15659 return this.each(function() { 15660 const data = Carousel.getOrCreateInstance(this, config); 15661 if (typeof config === "number") { 15662 data.to(config); 15663 return; 15664 } 15665 if (typeof config === "string") { 15666 if (data[config] === undefined || config.startsWith("_") || config === "constructor") { 15667 throw new TypeError(`No method named "${config}"`); 15668 } 15669 data[config](); 15670 } 15671 }); 15672 } 15673} 15674EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function(event) { 15675 const target = SelectorEngine.getElementFromSelector(this); 15676 if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { 15677 return; 15678 } 15679 event.preventDefault(); 15680 const carousel = Carousel.getOrCreateInstance(target); 15681 const slideIndex = this.getAttribute("data-bs-slide-to"); 15682 if (slideIndex) { 15683 carousel.to(slideIndex); 15684 carousel._maybeEnableCycle(); 15685 return; 15686 } 15687 if (Manipulator.getDataAttribute(this, "slide") === "next") { 15688 carousel.next(); 15689 carousel._maybeEnableCycle(); 15690 return; 15691 } 15692 carousel.prev(); 15693 carousel._maybeEnableCycle(); 15694}); 15695EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => { 15696 const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); 15697 for (const carousel of carousels) { 15698 Carousel.getOrCreateInstance(carousel); 15699 } 15700}); 15701defineJQueryPlugin(Carousel); 15702var NAME$b = "collapse"; 15703var DATA_KEY$7 = "bs.collapse"; 15704var EVENT_KEY$7 = `.${DATA_KEY$7}`; 15705var DATA_API_KEY$4 = ".data-api"; 15706var EVENT_SHOW$6 = `show${EVENT_KEY$7}`; 15707var EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`; 15708var EVENT_HIDE$6 = `hide${EVENT_KEY$7}`; 15709var EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`; 15710var EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`; 15711var CLASS_NAME_SHOW$7 = "show"; 15712var CLASS_NAME_COLLAPSE = "collapse"; 15713var CLASS_NAME_COLLAPSING = "collapsing"; 15714var CLASS_NAME_COLLAPSED = "collapsed"; 15715var CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`; 15716var CLASS_NAME_HORIZONTAL = "collapse-horizontal"; 15717var WIDTH = "width"; 15718var HEIGHT = "height"; 15719var SELECTOR_ACTIVES = ".collapse.show, .collapse.collapsing"; 15720var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; 15721var Default$a = { 15722 parent: null, 15723 toggle: true 15724}; 15725var DefaultType$a = { 15726 parent: "(null|element)", 15727 toggle: "boolean" 15728}; 15729 15730class Collapse extends BaseComponent { 15731 constructor(element, config) { 15732 super(element, config); 15733 this._isTransitioning = false; 15734 this._triggerArray = []; 15735 const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); 15736 for (const elem of toggleList) { 15737 const selector = SelectorEngine.getSelectorFromElement(elem); 15738 const filterElement = SelectorEngine.find(selector).filter((foundElement) => foundElement === this._element); 15739 if (selector !== null && filterElement.length) { 15740 this._triggerArray.push(elem); 15741 } 15742 } 15743 this._initializeChildren(); 15744 if (!this._config.parent) { 15745 this._addAriaAndCollapsedClass(this._triggerArray, this._isShown()); 15746 } 15747 if (this._config.toggle) { 15748 this.toggle(); 15749 } 15750 } 15751 static get Default() { 15752 return Default$a; 15753 } 15754 static get DefaultType() { 15755 return DefaultType$a; 15756 } 15757 static get NAME() { 15758 return NAME$b; 15759 } 15760 toggle() { 15761 if (this._isShown()) { 15762 this.hide(); 15763 } else { 15764 this.show(); 15765 } 15766 } 15767 show() { 15768 if (this._isTransitioning || this._isShown()) { 15769 return; 15770 } 15771 let activeChildren = []; 15772 if (this._config.parent) { 15773 activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element).map((element) => Collapse.getOrCreateInstance(element, { 15774 toggle: false 15775 })); 15776 } 15777 if (activeChildren.length && activeChildren[0]._isTransitioning) { 15778 return; 15779 } 15780 const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6); 15781 if (startEvent.defaultPrevented) { 15782 return; 15783 } 15784 for (const activeInstance of activeChildren) { 15785 activeInstance.hide(); 15786 } 15787 const dimension = this._getDimension(); 15788 this._element.classList.remove(CLASS_NAME_COLLAPSE); 15789 this._element.classList.add(CLASS_NAME_COLLAPSING); 15790 this._element.style[dimension] = 0; 15791 this._addAriaAndCollapsedClass(this._triggerArray, true); 15792 this._isTransitioning = true; 15793 const complete = () => { 15794 this._isTransitioning = false; 15795 this._element.classList.remove(CLASS_NAME_COLLAPSING); 15796 this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 15797 this._element.style[dimension] = ""; 15798 EventHandler.trigger(this._element, EVENT_SHOWN$6); 15799 }; 15800 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 15801 const scrollSize = `scroll${capitalizedDimension}`; 15802 this._queueCallback(complete, this._element, true); 15803 this._element.style[dimension] = `${this._element[scrollSize]}px`; 15804 } 15805 hide() { 15806 if (this._isTransitioning || !this._isShown()) { 15807 return; 15808 } 15809 const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6); 15810 if (startEvent.defaultPrevented) { 15811 return; 15812 } 15813 const dimension = this._getDimension(); 15814 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`; 15815 reflow(this._element); 15816 this._element.classList.add(CLASS_NAME_COLLAPSING); 15817 this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); 15818 for (const trigger of this._triggerArray) { 15819 const element = SelectorEngine.getElementFromSelector(trigger); 15820 if (element && !this._isShown(element)) { 15821 this._addAriaAndCollapsedClass([trigger], false); 15822 } 15823 } 15824 this._isTransitioning = true; 15825 const complete = () => { 15826 this._isTransitioning = false; 15827 this._element.classList.remove(CLASS_NAME_COLLAPSING); 15828 this._element.classList.add(CLASS_NAME_COLLAPSE); 15829 EventHandler.trigger(this._element, EVENT_HIDDEN$6); 15830 }; 15831 this._element.style[dimension] = ""; 15832 this._queueCallback(complete, this._element, true); 15833 } 15834 _isShown(element = this._element) { 15835 return element.classList.contains(CLASS_NAME_SHOW$7); 15836 } 15837 _configAfterMerge(config) { 15838 config.toggle = Boolean(config.toggle); 15839 config.parent = getElement(config.parent); 15840 return config; 15841 } 15842 _getDimension() { 15843 return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT; 15844 } 15845 _initializeChildren() { 15846 if (!this._config.parent) { 15847 return; 15848 } 15849 const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4); 15850 for (const element of children) { 15851 const selected = SelectorEngine.getElementFromSelector(element); 15852 if (selected) { 15853 this._addAriaAndCollapsedClass([element], this._isShown(selected)); 15854 } 15855 } 15856 } 15857 _getFirstLevelChildren(selector) { 15858 const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent); 15859 return SelectorEngine.find(selector, this._config.parent).filter((element) => !children.includes(element)); 15860 } 15861 _addAriaAndCollapsedClass(triggerArray, isOpen) { 15862 if (!triggerArray.length) { 15863 return; 15864 } 15865 for (const element of triggerArray) { 15866 element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen); 15867 element.setAttribute("aria-expanded", isOpen); 15868 } 15869 } 15870 static jQueryInterface(config) { 15871 const _config = {}; 15872 if (typeof config === "string" && /show|hide/.test(config)) { 15873 _config.toggle = false; 15874 } 15875 return this.each(function() { 15876 const data = Collapse.getOrCreateInstance(this, _config); 15877 if (typeof config === "string") { 15878 if (typeof data[config] === "undefined") { 15879 throw new TypeError(`No method named "${config}"`); 15880 } 15881 data[config](); 15882 } 15883 }); 15884 } 15885} 15886EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function(event) { 15887 if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") { 15888 event.preventDefault(); 15889 } 15890 for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) { 15891 Collapse.getOrCreateInstance(element, { 15892 toggle: false 15893 }).toggle(); 15894 } 15895}); 15896defineJQueryPlugin(Collapse); 15897var NAME$a = "dropdown"; 15898var DATA_KEY$6 = "bs.dropdown"; 15899var EVENT_KEY$6 = `.${DATA_KEY$6}`; 15900var DATA_API_KEY$3 = ".data-api"; 15901var ESCAPE_KEY$2 = "Escape"; 15902var TAB_KEY$1 = "Tab"; 15903var ARROW_UP_KEY$1 = "ArrowUp"; 15904var ARROW_DOWN_KEY$1 = "ArrowDown"; 15905var RIGHT_MOUSE_BUTTON = 2; 15906var EVENT_HIDE$5 = `hide${EVENT_KEY$6}`; 15907var EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`; 15908var EVENT_SHOW$5 = `show${EVENT_KEY$6}`; 15909var EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`; 15910var EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`; 15911var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`; 15912var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`; 15913var CLASS_NAME_SHOW$6 = "show"; 15914var CLASS_NAME_DROPUP = "dropup"; 15915var CLASS_NAME_DROPEND = "dropend"; 15916var CLASS_NAME_DROPSTART = "dropstart"; 15917var CLASS_NAME_DROPUP_CENTER = "dropup-center"; 15918var CLASS_NAME_DROPDOWN_CENTER = "dropdown-center"; 15919var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)'; 15920var SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`; 15921var SELECTOR_MENU = ".dropdown-menu"; 15922var SELECTOR_NAVBAR = ".navbar"; 15923var SELECTOR_NAVBAR_NAV = ".navbar-nav"; 15924var SELECTOR_VISIBLE_ITEMS = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)"; 15925var PLACEMENT_TOP = isRTL() ? "top-end" : "top-start"; 15926var PLACEMENT_TOPEND = isRTL() ? "top-start" : "top-end"; 15927var PLACEMENT_BOTTOM = isRTL() ? "bottom-end" : "bottom-start"; 15928var PLACEMENT_BOTTOMEND = isRTL() ? "bottom-start" : "bottom-end"; 15929var PLACEMENT_RIGHT = isRTL() ? "left-start" : "right-start"; 15930var PLACEMENT_LEFT = isRTL() ? "right-start" : "left-start"; 15931var PLACEMENT_TOPCENTER = "top"; 15932var PLACEMENT_BOTTOMCENTER = "bottom"; 15933var Default$9 = { 15934 autoClose: true, 15935 boundary: "clippingParents", 15936 display: "dynamic", 15937 offset: [0, 2], 15938 popperConfig: null, 15939 reference: "toggle" 15940}; 15941var DefaultType$9 = { 15942 autoClose: "(boolean|string)", 15943 boundary: "(string|element)", 15944 display: "string", 15945 offset: "(array|string|function)", 15946 popperConfig: "(null|object|function)", 15947 reference: "(string|element|object)" 15948}; 15949 15950class Dropdown extends BaseComponent { 15951 constructor(element, config) { 15952 super(element, config); 15953 this._popper = null; 15954 this._parent = this._element.parentNode; 15955 this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent); 15956 this._inNavbar = this._detectNavbar(); 15957 } 15958 static get Default() { 15959 return Default$9; 15960 } 15961 static get DefaultType() { 15962 return DefaultType$9; 15963 } 15964 static get NAME() { 15965 return NAME$a; 15966 } 15967 toggle() { 15968 return this._isShown() ? this.hide() : this.show(); 15969 } 15970 show() { 15971 if (isDisabled(this._element) || this._isShown()) { 15972 return; 15973 } 15974 const relatedTarget = { 15975 relatedTarget: this._element 15976 }; 15977 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget); 15978 if (showEvent.defaultPrevented) { 15979 return; 15980 } 15981 this._createPopper(); 15982 if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) { 15983 for (const element of [].concat(...document.body.children)) { 15984 EventHandler.on(element, "mouseover", noop); 15985 } 15986 } 15987 this._element.focus(); 15988 this._element.setAttribute("aria-expanded", true); 15989 this._menu.classList.add(CLASS_NAME_SHOW$6); 15990 this._element.classList.add(CLASS_NAME_SHOW$6); 15991 EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget); 15992 } 15993 hide() { 15994 if (isDisabled(this._element) || !this._isShown()) { 15995 return; 15996 } 15997 const relatedTarget = { 15998 relatedTarget: this._element 15999 }; 16000 this._completeHide(relatedTarget); 16001 } 16002 dispose() { 16003 if (this._popper) { 16004 this._popper.destroy(); 16005 } 16006 super.dispose(); 16007 } 16008 update() { 16009 this._inNavbar = this._detectNavbar(); 16010 if (this._popper) { 16011 this._popper.update(); 16012 } 16013 } 16014 _completeHide(relatedTarget) { 16015 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget); 16016 if (hideEvent.defaultPrevented) { 16017 return; 16018 } 16019 if ("ontouchstart" in document.documentElement) { 16020 for (const element of [].concat(...document.body.children)) { 16021 EventHandler.off(element, "mouseover", noop); 16022 } 16023 } 16024 if (this._popper) { 16025 this._popper.destroy(); 16026 } 16027 this._menu.classList.remove(CLASS_NAME_SHOW$6); 16028 this._element.classList.remove(CLASS_NAME_SHOW$6); 16029 this._element.setAttribute("aria-expanded", "false"); 16030 Manipulator.removeDataAttribute(this._menu, "popper"); 16031 EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget); 16032 } 16033 _getConfig(config) { 16034 config = super._getConfig(config); 16035 if (typeof config.reference === "object" && !isElement2(config.reference) && typeof config.reference.getBoundingClientRect !== "function") { 16036 throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`); 16037 } 16038 return config; 16039 } 16040 _createPopper() { 16041 if (typeof exports_lib === "undefined") { 16042 throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)"); 16043 } 16044 let referenceElement = this._element; 16045 if (this._config.reference === "parent") { 16046 referenceElement = this._parent; 16047 } else if (isElement2(this._config.reference)) { 16048 referenceElement = getElement(this._config.reference); 16049 } else if (typeof this._config.reference === "object") { 16050 referenceElement = this._config.reference; 16051 } 16052 const popperConfig = this._getPopperConfig(); 16053 this._popper = createPopper3(referenceElement, this._menu, popperConfig); 16054 } 16055 _isShown() { 16056 return this._menu.classList.contains(CLASS_NAME_SHOW$6); 16057 } 16058 _getPlacement() { 16059 const parentDropdown = this._parent; 16060 if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { 16061 return PLACEMENT_RIGHT; 16062 } 16063 if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { 16064 return PLACEMENT_LEFT; 16065 } 16066 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) { 16067 return PLACEMENT_TOPCENTER; 16068 } 16069 if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) { 16070 return PLACEMENT_BOTTOMCENTER; 16071 } 16072 const isEnd = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end"; 16073 if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { 16074 return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; 16075 } 16076 return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; 16077 } 16078 _detectNavbar() { 16079 return this._element.closest(SELECTOR_NAVBAR) !== null; 16080 } 16081 _getOffset() { 16082 const { 16083 offset: offset2 16084 } = this._config; 16085 if (typeof offset2 === "string") { 16086 return offset2.split(",").map((value) => Number.parseInt(value, 10)); 16087 } 16088 if (typeof offset2 === "function") { 16089 return (popperData) => offset2(popperData, this._element); 16090 } 16091 return offset2; 16092 } 16093 _getPopperConfig() { 16094 const defaultBsPopperConfig = { 16095 placement: this._getPlacement(), 16096 modifiers: [{ 16097 name: "preventOverflow", 16098 options: { 16099 boundary: this._config.boundary 16100 } 16101 }, { 16102 name: "offset", 16103 options: { 16104 offset: this._getOffset() 16105 } 16106 }] 16107 }; 16108 if (this._inNavbar || this._config.display === "static") { 16109 Manipulator.setDataAttribute(this._menu, "popper", "static"); 16110 defaultBsPopperConfig.modifiers = [{ 16111 name: "applyStyles", 16112 enabled: false 16113 }]; 16114 } 16115 return { 16116 ...defaultBsPopperConfig, 16117 ...execute(this._config.popperConfig, [defaultBsPopperConfig]) 16118 }; 16119 } 16120 _selectMenuItem({ 16121 key, 16122 target 16123 }) { 16124 const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element)); 16125 if (!items.length) { 16126 return; 16127 } 16128 getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus(); 16129 } 16130 static jQueryInterface(config) { 16131 return this.each(function() { 16132 const data = Dropdown.getOrCreateInstance(this, config); 16133 if (typeof config !== "string") { 16134 return; 16135 } 16136 if (typeof data[config] === "undefined") { 16137 throw new TypeError(`No method named "${config}"`); 16138 } 16139 data[config](); 16140 }); 16141 } 16142 static clearMenus(event) { 16143 if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY$1) { 16144 return; 16145 } 16146 const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN); 16147 for (const toggle of openToggles) { 16148 const context = Dropdown.getInstance(toggle); 16149 if (!context || context._config.autoClose === false) { 16150 continue; 16151 } 16152 const composedPath = event.composedPath(); 16153 const isMenuTarget = composedPath.includes(context._menu); 16154 if (composedPath.includes(context._element) || context._config.autoClose === "inside" && !isMenuTarget || context._config.autoClose === "outside" && isMenuTarget) { 16155 continue; 16156 } 16157 if (context._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) { 16158 continue; 16159 } 16160 const relatedTarget = { 16161 relatedTarget: context._element 16162 }; 16163 if (event.type === "click") { 16164 relatedTarget.clickEvent = event; 16165 } 16166 context._completeHide(relatedTarget); 16167 } 16168 } 16169 static dataApiKeydownHandler(event) { 16170 const isInput = /input|textarea/i.test(event.target.tagName); 16171 const isEscapeEvent = event.key === ESCAPE_KEY$2; 16172 const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key); 16173 if (!isUpOrDownEvent && !isEscapeEvent) { 16174 return; 16175 } 16176 if (isInput && !isEscapeEvent) { 16177 return; 16178 } 16179 event.preventDefault(); 16180 const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode); 16181 const instance = Dropdown.getOrCreateInstance(getToggleButton); 16182 if (isUpOrDownEvent) { 16183 event.stopPropagation(); 16184 instance.show(); 16185 instance._selectMenuItem(event); 16186 return; 16187 } 16188 if (instance._isShown()) { 16189 event.stopPropagation(); 16190 instance.hide(); 16191 getToggleButton.focus(); 16192 } 16193 } 16194} 16195EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); 16196EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); 16197EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); 16198EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); 16199EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function(event) { 16200 event.preventDefault(); 16201 Dropdown.getOrCreateInstance(this).toggle(); 16202}); 16203defineJQueryPlugin(Dropdown); 16204var NAME$9 = "backdrop"; 16205var CLASS_NAME_FADE$4 = "fade"; 16206var CLASS_NAME_SHOW$5 = "show"; 16207var EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; 16208var Default$8 = { 16209 className: "modal-backdrop", 16210 clickCallback: null, 16211 isAnimated: false, 16212 isVisible: true, 16213 rootElement: "body" 16214}; 16215var DefaultType$8 = { 16216 className: "string", 16217 clickCallback: "(function|null)", 16218 isAnimated: "boolean", 16219 isVisible: "boolean", 16220 rootElement: "(element|string)" 16221}; 16222 16223class Backdrop extends Config { 16224 constructor(config) { 16225 super(); 16226 this._config = this._getConfig(config); 16227 this._isAppended = false; 16228 this._element = null; 16229 } 16230 static get Default() { 16231 return Default$8; 16232 } 16233 static get DefaultType() { 16234 return DefaultType$8; 16235 } 16236 static get NAME() { 16237 return NAME$9; 16238 } 16239 show(callback) { 16240 if (!this._config.isVisible) { 16241 execute(callback); 16242 return; 16243 } 16244 this._append(); 16245 const element = this._getElement(); 16246 if (this._config.isAnimated) { 16247 reflow(element); 16248 } 16249 element.classList.add(CLASS_NAME_SHOW$5); 16250 this._emulateAnimation(() => { 16251 execute(callback); 16252 }); 16253 } 16254 hide(callback) { 16255 if (!this._config.isVisible) { 16256 execute(callback); 16257 return; 16258 } 16259 this._getElement().classList.remove(CLASS_NAME_SHOW$5); 16260 this._emulateAnimation(() => { 16261 this.dispose(); 16262 execute(callback); 16263 }); 16264 } 16265 dispose() { 16266 if (!this._isAppended) { 16267 return; 16268 } 16269 EventHandler.off(this._element, EVENT_MOUSEDOWN); 16270 this._element.remove(); 16271 this._isAppended = false; 16272 } 16273 _getElement() { 16274 if (!this._element) { 16275 const backdrop = document.createElement("div"); 16276 backdrop.className = this._config.className; 16277 if (this._config.isAnimated) { 16278 backdrop.classList.add(CLASS_NAME_FADE$4); 16279 } 16280 this._element = backdrop; 16281 } 16282 return this._element; 16283 } 16284 _configAfterMerge(config) { 16285 config.rootElement = getElement(config.rootElement); 16286 return config; 16287 } 16288 _append() { 16289 if (this._isAppended) { 16290 return; 16291 } 16292 const element = this._getElement(); 16293 this._config.rootElement.append(element); 16294 EventHandler.on(element, EVENT_MOUSEDOWN, () => { 16295 execute(this._config.clickCallback); 16296 }); 16297 this._isAppended = true; 16298 } 16299 _emulateAnimation(callback) { 16300 executeAfterTransition(callback, this._getElement(), this._config.isAnimated); 16301 } 16302} 16303var NAME$8 = "focustrap"; 16304var DATA_KEY$5 = "bs.focustrap"; 16305var EVENT_KEY$5 = `.${DATA_KEY$5}`; 16306var EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`; 16307var EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`; 16308var TAB_KEY = "Tab"; 16309var TAB_NAV_FORWARD = "forward"; 16310var TAB_NAV_BACKWARD = "backward"; 16311var Default$7 = { 16312 autofocus: true, 16313 trapElement: null 16314}; 16315var DefaultType$7 = { 16316 autofocus: "boolean", 16317 trapElement: "element" 16318}; 16319 16320class FocusTrap extends Config { 16321 constructor(config) { 16322 super(); 16323 this._config = this._getConfig(config); 16324 this._isActive = false; 16325 this._lastTabNavDirection = null; 16326 } 16327 static get Default() { 16328 return Default$7; 16329 } 16330 static get DefaultType() { 16331 return DefaultType$7; 16332 } 16333 static get NAME() { 16334 return NAME$8; 16335 } 16336 activate() { 16337 if (this._isActive) { 16338 return; 16339 } 16340 if (this._config.autofocus) { 16341 this._config.trapElement.focus(); 16342 } 16343 EventHandler.off(document, EVENT_KEY$5); 16344 EventHandler.on(document, EVENT_FOCUSIN$2, (event) => this._handleFocusin(event)); 16345 EventHandler.on(document, EVENT_KEYDOWN_TAB, (event) => this._handleKeydown(event)); 16346 this._isActive = true; 16347 } 16348 deactivate() { 16349 if (!this._isActive) { 16350 return; 16351 } 16352 this._isActive = false; 16353 EventHandler.off(document, EVENT_KEY$5); 16354 } 16355 _handleFocusin(event) { 16356 const { 16357 trapElement 16358 } = this._config; 16359 if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) { 16360 return; 16361 } 16362 const elements = SelectorEngine.focusableChildren(trapElement); 16363 if (elements.length === 0) { 16364 trapElement.focus(); 16365 } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) { 16366 elements[elements.length - 1].focus(); 16367 } else { 16368 elements[0].focus(); 16369 } 16370 } 16371 _handleKeydown(event) { 16372 if (event.key !== TAB_KEY) { 16373 return; 16374 } 16375 this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD; 16376 } 16377} 16378var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top"; 16379var SELECTOR_STICKY_CONTENT = ".sticky-top"; 16380var PROPERTY_PADDING = "padding-right"; 16381var PROPERTY_MARGIN = "margin-right"; 16382 16383class ScrollBarHelper { 16384 constructor() { 16385 this._element = document.body; 16386 } 16387 getWidth() { 16388 const documentWidth = document.documentElement.clientWidth; 16389 return Math.abs(window.innerWidth - documentWidth); 16390 } 16391 hide() { 16392 const width = this.getWidth(); 16393 this._disableOverFlow(); 16394 this._setElementAttributes(this._element, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width); 16395 this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width); 16396 this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, (calculatedValue) => calculatedValue - width); 16397 } 16398 reset() { 16399 this._resetElementAttributes(this._element, "overflow"); 16400 this._resetElementAttributes(this._element, PROPERTY_PADDING); 16401 this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING); 16402 this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN); 16403 } 16404 isOverflowing() { 16405 return this.getWidth() > 0; 16406 } 16407 _disableOverFlow() { 16408 this._saveInitialAttribute(this._element, "overflow"); 16409 this._element.style.overflow = "hidden"; 16410 } 16411 _setElementAttributes(selector, styleProperty, callback) { 16412 const scrollbarWidth = this.getWidth(); 16413 const manipulationCallBack = (element) => { 16414 if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) { 16415 return; 16416 } 16417 this._saveInitialAttribute(element, styleProperty); 16418 const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty); 16419 element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`); 16420 }; 16421 this._applyManipulationCallback(selector, manipulationCallBack); 16422 } 16423 _saveInitialAttribute(element, styleProperty) { 16424 const actualValue = element.style.getPropertyValue(styleProperty); 16425 if (actualValue) { 16426 Manipulator.setDataAttribute(element, styleProperty, actualValue); 16427 } 16428 } 16429 _resetElementAttributes(selector, styleProperty) { 16430 const manipulationCallBack = (element) => { 16431 const value = Manipulator.getDataAttribute(element, styleProperty); 16432 if (value === null) { 16433 element.style.removeProperty(styleProperty); 16434 return; 16435 } 16436 Manipulator.removeDataAttribute(element, styleProperty); 16437 element.style.setProperty(styleProperty, value); 16438 }; 16439 this._applyManipulationCallback(selector, manipulationCallBack); 16440 } 16441 _applyManipulationCallback(selector, callBack) { 16442 if (isElement2(selector)) { 16443 callBack(selector); 16444 return; 16445 } 16446 for (const sel of SelectorEngine.find(selector, this._element)) { 16447 callBack(sel); 16448 } 16449 } 16450} 16451var NAME$7 = "modal"; 16452var DATA_KEY$4 = "bs.modal"; 16453var EVENT_KEY$4 = `.${DATA_KEY$4}`; 16454var DATA_API_KEY$2 = ".data-api"; 16455var ESCAPE_KEY$1 = "Escape"; 16456var EVENT_HIDE$4 = `hide${EVENT_KEY$4}`; 16457var EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`; 16458var EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`; 16459var EVENT_SHOW$4 = `show${EVENT_KEY$4}`; 16460var EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; 16461var EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`; 16462var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`; 16463var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`; 16464var EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`; 16465var EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; 16466var CLASS_NAME_OPEN = "modal-open"; 16467var CLASS_NAME_FADE$3 = "fade"; 16468var CLASS_NAME_SHOW$4 = "show"; 16469var CLASS_NAME_STATIC = "modal-static"; 16470var OPEN_SELECTOR$1 = ".modal.show"; 16471var SELECTOR_DIALOG = ".modal-dialog"; 16472var SELECTOR_MODAL_BODY = ".modal-body"; 16473var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; 16474var Default$6 = { 16475 backdrop: true, 16476 focus: true, 16477 keyboard: true 16478}; 16479var DefaultType$6 = { 16480 backdrop: "(boolean|string)", 16481 focus: "boolean", 16482 keyboard: "boolean" 16483}; 16484 16485class Modal extends BaseComponent { 16486 constructor(element, config) { 16487 super(element, config); 16488 this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element); 16489 this._backdrop = this._initializeBackDrop(); 16490 this._focustrap = this._initializeFocusTrap(); 16491 this._isShown = false; 16492 this._isTransitioning = false; 16493 this._scrollBar = new ScrollBarHelper; 16494 this._addEventListeners(); 16495 } 16496 static get Default() { 16497 return Default$6; 16498 } 16499 static get DefaultType() { 16500 return DefaultType$6; 16501 } 16502 static get NAME() { 16503 return NAME$7; 16504 } 16505 toggle(relatedTarget) { 16506 return this._isShown ? this.hide() : this.show(relatedTarget); 16507 } 16508 show(relatedTarget) { 16509 if (this._isShown || this._isTransitioning) { 16510 return; 16511 } 16512 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, { 16513 relatedTarget 16514 }); 16515 if (showEvent.defaultPrevented) { 16516 return; 16517 } 16518 this._isShown = true; 16519 this._isTransitioning = true; 16520 this._scrollBar.hide(); 16521 document.body.classList.add(CLASS_NAME_OPEN); 16522 this._adjustDialog(); 16523 this._backdrop.show(() => this._showElement(relatedTarget)); 16524 } 16525 hide() { 16526 if (!this._isShown || this._isTransitioning) { 16527 return; 16528 } 16529 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4); 16530 if (hideEvent.defaultPrevented) { 16531 return; 16532 } 16533 this._isShown = false; 16534 this._isTransitioning = true; 16535 this._focustrap.deactivate(); 16536 this._element.classList.remove(CLASS_NAME_SHOW$4); 16537 this._queueCallback(() => this._hideModal(), this._element, this._isAnimated()); 16538 } 16539 dispose() { 16540 EventHandler.off(window, EVENT_KEY$4); 16541 EventHandler.off(this._dialog, EVENT_KEY$4); 16542 this._backdrop.dispose(); 16543 this._focustrap.deactivate(); 16544 super.dispose(); 16545 } 16546 handleUpdate() { 16547 this._adjustDialog(); 16548 } 16549 _initializeBackDrop() { 16550 return new Backdrop({ 16551 isVisible: Boolean(this._config.backdrop), 16552 isAnimated: this._isAnimated() 16553 }); 16554 } 16555 _initializeFocusTrap() { 16556 return new FocusTrap({ 16557 trapElement: this._element 16558 }); 16559 } 16560 _showElement(relatedTarget) { 16561 if (!document.body.contains(this._element)) { 16562 document.body.append(this._element); 16563 } 16564 this._element.style.display = "block"; 16565 this._element.removeAttribute("aria-hidden"); 16566 this._element.setAttribute("aria-modal", true); 16567 this._element.setAttribute("role", "dialog"); 16568 this._element.scrollTop = 0; 16569 const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); 16570 if (modalBody) { 16571 modalBody.scrollTop = 0; 16572 } 16573 reflow(this._element); 16574 this._element.classList.add(CLASS_NAME_SHOW$4); 16575 const transitionComplete = () => { 16576 if (this._config.focus) { 16577 this._focustrap.activate(); 16578 } 16579 this._isTransitioning = false; 16580 EventHandler.trigger(this._element, EVENT_SHOWN$4, { 16581 relatedTarget 16582 }); 16583 }; 16584 this._queueCallback(transitionComplete, this._dialog, this._isAnimated()); 16585 } 16586 _addEventListeners() { 16587 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, (event) => { 16588 if (event.key !== ESCAPE_KEY$1) { 16589 return; 16590 } 16591 if (this._config.keyboard) { 16592 this.hide(); 16593 return; 16594 } 16595 this._triggerBackdropTransition(); 16596 }); 16597 EventHandler.on(window, EVENT_RESIZE$1, () => { 16598 if (this._isShown && !this._isTransitioning) { 16599 this._adjustDialog(); 16600 } 16601 }); 16602 EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, (event) => { 16603 EventHandler.one(this._element, EVENT_CLICK_DISMISS, (event2) => { 16604 if (this._element !== event.target || this._element !== event2.target) { 16605 return; 16606 } 16607 if (this._config.backdrop === "static") { 16608 this._triggerBackdropTransition(); 16609 return; 16610 } 16611 if (this._config.backdrop) { 16612 this.hide(); 16613 } 16614 }); 16615 }); 16616 } 16617 _hideModal() { 16618 this._element.style.display = "none"; 16619 this._element.setAttribute("aria-hidden", true); 16620 this._element.removeAttribute("aria-modal"); 16621 this._element.removeAttribute("role"); 16622 this._isTransitioning = false; 16623 this._backdrop.hide(() => { 16624 document.body.classList.remove(CLASS_NAME_OPEN); 16625 this._resetAdjustments(); 16626 this._scrollBar.reset(); 16627 EventHandler.trigger(this._element, EVENT_HIDDEN$4); 16628 }); 16629 } 16630 _isAnimated() { 16631 return this._element.classList.contains(CLASS_NAME_FADE$3); 16632 } 16633 _triggerBackdropTransition() { 16634 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1); 16635 if (hideEvent.defaultPrevented) { 16636 return; 16637 } 16638 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 16639 const initialOverflowY = this._element.style.overflowY; 16640 if (initialOverflowY === "hidden" || this._element.classList.contains(CLASS_NAME_STATIC)) { 16641 return; 16642 } 16643 if (!isModalOverflowing) { 16644 this._element.style.overflowY = "hidden"; 16645 } 16646 this._element.classList.add(CLASS_NAME_STATIC); 16647 this._queueCallback(() => { 16648 this._element.classList.remove(CLASS_NAME_STATIC); 16649 this._queueCallback(() => { 16650 this._element.style.overflowY = initialOverflowY; 16651 }, this._dialog); 16652 }, this._dialog); 16653 this._element.focus(); 16654 } 16655 _adjustDialog() { 16656 const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 16657 const scrollbarWidth = this._scrollBar.getWidth(); 16658 const isBodyOverflowing = scrollbarWidth > 0; 16659 if (isBodyOverflowing && !isModalOverflowing) { 16660 const property = isRTL() ? "paddingLeft" : "paddingRight"; 16661 this._element.style[property] = `${scrollbarWidth}px`; 16662 } 16663 if (!isBodyOverflowing && isModalOverflowing) { 16664 const property = isRTL() ? "paddingRight" : "paddingLeft"; 16665 this._element.style[property] = `${scrollbarWidth}px`; 16666 } 16667 } 16668 _resetAdjustments() { 16669 this._element.style.paddingLeft = ""; 16670 this._element.style.paddingRight = ""; 16671 } 16672 static jQueryInterface(config, relatedTarget) { 16673 return this.each(function() { 16674 const data = Modal.getOrCreateInstance(this, config); 16675 if (typeof config !== "string") { 16676 return; 16677 } 16678 if (typeof data[config] === "undefined") { 16679 throw new TypeError(`No method named "${config}"`); 16680 } 16681 data[config](relatedTarget); 16682 }); 16683 } 16684} 16685EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function(event) { 16686 const target = SelectorEngine.getElementFromSelector(this); 16687 if (["A", "AREA"].includes(this.tagName)) { 16688 event.preventDefault(); 16689 } 16690 EventHandler.one(target, EVENT_SHOW$4, (showEvent) => { 16691 if (showEvent.defaultPrevented) { 16692 return; 16693 } 16694 EventHandler.one(target, EVENT_HIDDEN$4, () => { 16695 if (isVisible(this)) { 16696 this.focus(); 16697 } 16698 }); 16699 }); 16700 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); 16701 if (alreadyOpen) { 16702 Modal.getInstance(alreadyOpen).hide(); 16703 } 16704 const data = Modal.getOrCreateInstance(target); 16705 data.toggle(this); 16706}); 16707enableDismissTrigger(Modal); 16708defineJQueryPlugin(Modal); 16709var NAME$6 = "offcanvas"; 16710var DATA_KEY$3 = "bs.offcanvas"; 16711var EVENT_KEY$3 = `.${DATA_KEY$3}`; 16712var DATA_API_KEY$1 = ".data-api"; 16713var EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`; 16714var ESCAPE_KEY = "Escape"; 16715var CLASS_NAME_SHOW$3 = "show"; 16716var CLASS_NAME_SHOWING$1 = "showing"; 16717var CLASS_NAME_HIDING = "hiding"; 16718var CLASS_NAME_BACKDROP = "offcanvas-backdrop"; 16719var OPEN_SELECTOR = ".offcanvas.show"; 16720var EVENT_SHOW$3 = `show${EVENT_KEY$3}`; 16721var EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`; 16722var EVENT_HIDE$3 = `hide${EVENT_KEY$3}`; 16723var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`; 16724var EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`; 16725var EVENT_RESIZE = `resize${EVENT_KEY$3}`; 16726var EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`; 16727var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`; 16728var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; 16729var Default$5 = { 16730 backdrop: true, 16731 keyboard: true, 16732 scroll: false 16733}; 16734var DefaultType$5 = { 16735 backdrop: "(boolean|string)", 16736 keyboard: "boolean", 16737 scroll: "boolean" 16738}; 16739 16740class Offcanvas extends BaseComponent { 16741 constructor(element, config) { 16742 super(element, config); 16743 this._isShown = false; 16744 this._backdrop = this._initializeBackDrop(); 16745 this._focustrap = this._initializeFocusTrap(); 16746 this._addEventListeners(); 16747 } 16748 static get Default() { 16749 return Default$5; 16750 } 16751 static get DefaultType() { 16752 return DefaultType$5; 16753 } 16754 static get NAME() { 16755 return NAME$6; 16756 } 16757 toggle(relatedTarget) { 16758 return this._isShown ? this.hide() : this.show(relatedTarget); 16759 } 16760 show(relatedTarget) { 16761 if (this._isShown) { 16762 return; 16763 } 16764 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { 16765 relatedTarget 16766 }); 16767 if (showEvent.defaultPrevented) { 16768 return; 16769 } 16770 this._isShown = true; 16771 this._backdrop.show(); 16772 if (!this._config.scroll) { 16773 new ScrollBarHelper().hide(); 16774 } 16775 this._element.setAttribute("aria-modal", true); 16776 this._element.setAttribute("role", "dialog"); 16777 this._element.classList.add(CLASS_NAME_SHOWING$1); 16778 const completeCallBack = () => { 16779 if (!this._config.scroll || this._config.backdrop) { 16780 this._focustrap.activate(); 16781 } 16782 this._element.classList.add(CLASS_NAME_SHOW$3); 16783 this._element.classList.remove(CLASS_NAME_SHOWING$1); 16784 EventHandler.trigger(this._element, EVENT_SHOWN$3, { 16785 relatedTarget 16786 }); 16787 }; 16788 this._queueCallback(completeCallBack, this._element, true); 16789 } 16790 hide() { 16791 if (!this._isShown) { 16792 return; 16793 } 16794 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); 16795 if (hideEvent.defaultPrevented) { 16796 return; 16797 } 16798 this._focustrap.deactivate(); 16799 this._element.blur(); 16800 this._isShown = false; 16801 this._element.classList.add(CLASS_NAME_HIDING); 16802 this._backdrop.hide(); 16803 const completeCallback = () => { 16804 this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING); 16805 this._element.removeAttribute("aria-modal"); 16806 this._element.removeAttribute("role"); 16807 if (!this._config.scroll) { 16808 new ScrollBarHelper().reset(); 16809 } 16810 EventHandler.trigger(this._element, EVENT_HIDDEN$3); 16811 }; 16812 this._queueCallback(completeCallback, this._element, true); 16813 } 16814 dispose() { 16815 this._backdrop.dispose(); 16816 this._focustrap.deactivate(); 16817 super.dispose(); 16818 } 16819 _initializeBackDrop() { 16820 const clickCallback = () => { 16821 if (this._config.backdrop === "static") { 16822 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 16823 return; 16824 } 16825 this.hide(); 16826 }; 16827 const isVisible2 = Boolean(this._config.backdrop); 16828 return new Backdrop({ 16829 className: CLASS_NAME_BACKDROP, 16830 isVisible: isVisible2, 16831 isAnimated: true, 16832 rootElement: this._element.parentNode, 16833 clickCallback: isVisible2 ? clickCallback : null 16834 }); 16835 } 16836 _initializeFocusTrap() { 16837 return new FocusTrap({ 16838 trapElement: this._element 16839 }); 16840 } 16841 _addEventListeners() { 16842 EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => { 16843 if (event.key !== ESCAPE_KEY) { 16844 return; 16845 } 16846 if (this._config.keyboard) { 16847 this.hide(); 16848 return; 16849 } 16850 EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); 16851 }); 16852 } 16853 static jQueryInterface(config) { 16854 return this.each(function() { 16855 const data = Offcanvas.getOrCreateInstance(this, config); 16856 if (typeof config !== "string") { 16857 return; 16858 } 16859 if (data[config] === undefined || config.startsWith("_") || config === "constructor") { 16860 throw new TypeError(`No method named "${config}"`); 16861 } 16862 data[config](this); 16863 }); 16864 } 16865} 16866EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function(event) { 16867 const target = SelectorEngine.getElementFromSelector(this); 16868 if (["A", "AREA"].includes(this.tagName)) { 16869 event.preventDefault(); 16870 } 16871 if (isDisabled(this)) { 16872 return; 16873 } 16874 EventHandler.one(target, EVENT_HIDDEN$3, () => { 16875 if (isVisible(this)) { 16876 this.focus(); 16877 } 16878 }); 16879 const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR); 16880 if (alreadyOpen && alreadyOpen !== target) { 16881 Offcanvas.getInstance(alreadyOpen).hide(); 16882 } 16883 const data = Offcanvas.getOrCreateInstance(target); 16884 data.toggle(this); 16885}); 16886EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => { 16887 for (const selector of SelectorEngine.find(OPEN_SELECTOR)) { 16888 Offcanvas.getOrCreateInstance(selector).show(); 16889 } 16890}); 16891EventHandler.on(window, EVENT_RESIZE, () => { 16892 for (const element of SelectorEngine.find("[aria-modal][class*=show][class*=offcanvas-]")) { 16893 if (getComputedStyle(element).position !== "fixed") { 16894 Offcanvas.getOrCreateInstance(element).hide(); 16895 } 16896 } 16897}); 16898enableDismissTrigger(Offcanvas); 16899defineJQueryPlugin(Offcanvas); 16900var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 16901var DefaultAllowlist = { 16902 "*": ["class", "dir", "id", "lang", "role", ARIA_ATTRIBUTE_PATTERN], 16903 a: ["target", "href", "title", "rel"], 16904 area: [], 16905 b: [], 16906 br: [], 16907 col: [], 16908 code: [], 16909 div: [], 16910 em: [], 16911 hr: [], 16912 h1: [], 16913 h2: [], 16914 h3: [], 16915 h4: [], 16916 h5: [], 16917 h6: [], 16918 i: [], 16919 img: ["src", "srcset", "alt", "title", "width", "height"], 16920 li: [], 16921 ol: [], 16922 p: [], 16923 pre: [], 16924 s: [], 16925 small: [], 16926 span: [], 16927 sub: [], 16928 sup: [], 16929 strong: [], 16930 u: [], 16931 ul: [] 16932}; 16933var uriAttributes = new Set(["background", "cite", "href", "itemtype", "longdesc", "poster", "src", "xlink:href"]); 16934var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i; 16935var allowedAttribute = (attribute, allowedAttributeList) => { 16936 const attributeName = attribute.nodeName.toLowerCase(); 16937 if (allowedAttributeList.includes(attributeName)) { 16938 if (uriAttributes.has(attributeName)) { 16939 return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue)); 16940 } 16941 return true; 16942 } 16943 return allowedAttributeList.filter((attributeRegex) => attributeRegex instanceof RegExp).some((regex) => regex.test(attributeName)); 16944}; 16945function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) { 16946 if (!unsafeHtml.length) { 16947 return unsafeHtml; 16948 } 16949 if (sanitizeFunction && typeof sanitizeFunction === "function") { 16950 return sanitizeFunction(unsafeHtml); 16951 } 16952 const domParser = new window.DOMParser; 16953 const createdDocument = domParser.parseFromString(unsafeHtml, "text/html"); 16954 const elements = [].concat(...createdDocument.body.querySelectorAll("*")); 16955 for (const element of elements) { 16956 const elementName = element.nodeName.toLowerCase(); 16957 if (!Object.keys(allowList).includes(elementName)) { 16958 element.remove(); 16959 continue; 16960 } 16961 const attributeList = [].concat(...element.attributes); 16962 const allowedAttributes = [].concat(allowList["*"] || [], allowList[elementName] || []); 16963 for (const attribute of attributeList) { 16964 if (!allowedAttribute(attribute, allowedAttributes)) { 16965 element.removeAttribute(attribute.nodeName); 16966 } 16967 } 16968 } 16969 return createdDocument.body.innerHTML; 16970} 16971var NAME$5 = "TemplateFactory"; 16972var Default$4 = { 16973 allowList: DefaultAllowlist, 16974 content: {}, 16975 extraClass: "", 16976 html: false, 16977 sanitize: true, 16978 sanitizeFn: null, 16979 template: "<div></div>" 16980}; 16981var DefaultType$4 = { 16982 allowList: "object", 16983 content: "object", 16984 extraClass: "(string|function)", 16985 html: "boolean", 16986 sanitize: "boolean", 16987 sanitizeFn: "(null|function)", 16988 template: "string" 16989}; 16990var DefaultContentType = { 16991 entry: "(string|element|function|null)", 16992 selector: "(string|element)" 16993}; 16994 16995class TemplateFactory extends Config { 16996 constructor(config) { 16997 super(); 16998 this._config = this._getConfig(config); 16999 } 17000 static get Default() { 17001 return Default$4; 17002 } 17003 static get DefaultType() { 17004 return DefaultType$4; 17005 } 17006 static get NAME() { 17007 return NAME$5; 17008 } 17009 getContent() { 17010 return Object.values(this._config.content).map((config) => this._resolvePossibleFunction(config)).filter(Boolean); 17011 } 17012 hasContent() { 17013 return this.getContent().length > 0; 17014 } 17015 changeContent(content) { 17016 this._checkContent(content); 17017 this._config.content = { 17018 ...this._config.content, 17019 ...content 17020 }; 17021 return this; 17022 } 17023 toHtml() { 17024 const templateWrapper = document.createElement("div"); 17025 templateWrapper.innerHTML = this._maybeSanitize(this._config.template); 17026 for (const [selector, text] of Object.entries(this._config.content)) { 17027 this._setContent(templateWrapper, text, selector); 17028 } 17029 const template = templateWrapper.children[0]; 17030 const extraClass = this._resolvePossibleFunction(this._config.extraClass); 17031 if (extraClass) { 17032 template.classList.add(...extraClass.split(" ")); 17033 } 17034 return template; 17035 } 17036 _typeCheckConfig(config) { 17037 super._typeCheckConfig(config); 17038 this._checkContent(config.content); 17039 } 17040 _checkContent(arg) { 17041 for (const [selector, content] of Object.entries(arg)) { 17042 super._typeCheckConfig({ 17043 selector, 17044 entry: content 17045 }, DefaultContentType); 17046 } 17047 } 17048 _setContent(template, content, selector) { 17049 const templateElement = SelectorEngine.findOne(selector, template); 17050 if (!templateElement) { 17051 return; 17052 } 17053 content = this._resolvePossibleFunction(content); 17054 if (!content) { 17055 templateElement.remove(); 17056 return; 17057 } 17058 if (isElement2(content)) { 17059 this._putElementInTemplate(getElement(content), templateElement); 17060 return; 17061 } 17062 if (this._config.html) { 17063 templateElement.innerHTML = this._maybeSanitize(content); 17064 return; 17065 } 17066 templateElement.textContent = content; 17067 } 17068 _maybeSanitize(arg) { 17069 return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg; 17070 } 17071 _resolvePossibleFunction(arg) { 17072 return execute(arg, [this]); 17073 } 17074 _putElementInTemplate(element, templateElement) { 17075 if (this._config.html) { 17076 templateElement.innerHTML = ""; 17077 templateElement.append(element); 17078 return; 17079 } 17080 templateElement.textContent = element.textContent; 17081 } 17082} 17083var NAME$4 = "tooltip"; 17084var DISALLOWED_ATTRIBUTES = new Set(["sanitize", "allowList", "sanitizeFn"]); 17085var CLASS_NAME_FADE$2 = "fade"; 17086var CLASS_NAME_MODAL = "modal"; 17087var CLASS_NAME_SHOW$2 = "show"; 17088var SELECTOR_TOOLTIP_INNER = ".tooltip-inner"; 17089var SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`; 17090var EVENT_MODAL_HIDE = "hide.bs.modal"; 17091var TRIGGER_HOVER = "hover"; 17092var TRIGGER_FOCUS = "focus"; 17093var TRIGGER_CLICK = "click"; 17094var TRIGGER_MANUAL = "manual"; 17095var EVENT_HIDE$2 = "hide"; 17096var EVENT_HIDDEN$2 = "hidden"; 17097var EVENT_SHOW$2 = "show"; 17098var EVENT_SHOWN$2 = "shown"; 17099var EVENT_INSERTED = "inserted"; 17100var EVENT_CLICK$1 = "click"; 17101var EVENT_FOCUSIN$1 = "focusin"; 17102var EVENT_FOCUSOUT$1 = "focusout"; 17103var EVENT_MOUSEENTER = "mouseenter"; 17104var EVENT_MOUSELEAVE = "mouseleave"; 17105var AttachmentMap = { 17106 AUTO: "auto", 17107 TOP: "top", 17108 RIGHT: isRTL() ? "left" : "right", 17109 BOTTOM: "bottom", 17110 LEFT: isRTL() ? "right" : "left" 17111}; 17112var Default$3 = { 17113 allowList: DefaultAllowlist, 17114 animation: true, 17115 boundary: "clippingParents", 17116 container: false, 17117 customClass: "", 17118 delay: 0, 17119 fallbackPlacements: ["top", "right", "bottom", "left"], 17120 html: false, 17121 offset: [0, 6], 17122 placement: "top", 17123 popperConfig: null, 17124 sanitize: true, 17125 sanitizeFn: null, 17126 selector: false, 17127 template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + "</div>", 17128 title: "", 17129 trigger: "hover focus" 17130}; 17131var DefaultType$3 = { 17132 allowList: "object", 17133 animation: "boolean", 17134 boundary: "(string|element)", 17135 container: "(string|element|boolean)", 17136 customClass: "(string|function)", 17137 delay: "(number|object)", 17138 fallbackPlacements: "array", 17139 html: "boolean", 17140 offset: "(array|string|function)", 17141 placement: "(string|function)", 17142 popperConfig: "(null|object|function)", 17143 sanitize: "boolean", 17144 sanitizeFn: "(null|function)", 17145 selector: "(string|boolean)", 17146 template: "string", 17147 title: "(string|element|function)", 17148 trigger: "string" 17149}; 17150 17151class Tooltip extends BaseComponent { 17152 constructor(element, config) { 17153 if (typeof exports_lib === "undefined") { 17154 throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)"); 17155 } 17156 super(element, config); 17157 this._isEnabled = true; 17158 this._timeout = 0; 17159 this._isHovered = null; 17160 this._activeTrigger = {}; 17161 this._popper = null; 17162 this._templateFactory = null; 17163 this._newContent = null; 17164 this.tip = null; 17165 this._setListeners(); 17166 if (!this._config.selector) { 17167 this._fixTitle(); 17168 } 17169 } 17170 static get Default() { 17171 return Default$3; 17172 } 17173 static get DefaultType() { 17174 return DefaultType$3; 17175 } 17176 static get NAME() { 17177 return NAME$4; 17178 } 17179 enable() { 17180 this._isEnabled = true; 17181 } 17182 disable() { 17183 this._isEnabled = false; 17184 } 17185 toggleEnabled() { 17186 this._isEnabled = !this._isEnabled; 17187 } 17188 toggle() { 17189 if (!this._isEnabled) { 17190 return; 17191 } 17192 this._activeTrigger.click = !this._activeTrigger.click; 17193 if (this._isShown()) { 17194 this._leave(); 17195 return; 17196 } 17197 this._enter(); 17198 } 17199 dispose() { 17200 clearTimeout(this._timeout); 17201 EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 17202 if (this._element.getAttribute("data-bs-original-title")) { 17203 this._element.setAttribute("title", this._element.getAttribute("data-bs-original-title")); 17204 } 17205 this._disposePopper(); 17206 super.dispose(); 17207 } 17208 show() { 17209 if (this._element.style.display === "none") { 17210 throw new Error("Please use show on visible elements"); 17211 } 17212 if (!(this._isWithContent() && this._isEnabled)) { 17213 return; 17214 } 17215 const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2)); 17216 const shadowRoot = findShadowRoot(this._element); 17217 const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element); 17218 if (showEvent.defaultPrevented || !isInTheDom) { 17219 return; 17220 } 17221 this._disposePopper(); 17222 const tip = this._getTipElement(); 17223 this._element.setAttribute("aria-describedby", tip.getAttribute("id")); 17224 const { 17225 container 17226 } = this._config; 17227 if (!this._element.ownerDocument.documentElement.contains(this.tip)) { 17228 container.append(tip); 17229 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED)); 17230 } 17231 this._popper = this._createPopper(tip); 17232 tip.classList.add(CLASS_NAME_SHOW$2); 17233 if ("ontouchstart" in document.documentElement) { 17234 for (const element of [].concat(...document.body.children)) { 17235 EventHandler.on(element, "mouseover", noop); 17236 } 17237 } 17238 const complete = () => { 17239 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2)); 17240 if (this._isHovered === false) { 17241 this._leave(); 17242 } 17243 this._isHovered = false; 17244 }; 17245 this._queueCallback(complete, this.tip, this._isAnimated()); 17246 } 17247 hide() { 17248 if (!this._isShown()) { 17249 return; 17250 } 17251 const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2)); 17252 if (hideEvent.defaultPrevented) { 17253 return; 17254 } 17255 const tip = this._getTipElement(); 17256 tip.classList.remove(CLASS_NAME_SHOW$2); 17257 if ("ontouchstart" in document.documentElement) { 17258 for (const element of [].concat(...document.body.children)) { 17259 EventHandler.off(element, "mouseover", noop); 17260 } 17261 } 17262 this._activeTrigger[TRIGGER_CLICK] = false; 17263 this._activeTrigger[TRIGGER_FOCUS] = false; 17264 this._activeTrigger[TRIGGER_HOVER] = false; 17265 this._isHovered = null; 17266 const complete = () => { 17267 if (this._isWithActiveTrigger()) { 17268 return; 17269 } 17270 if (!this._isHovered) { 17271 this._disposePopper(); 17272 } 17273 this._element.removeAttribute("aria-describedby"); 17274 EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2)); 17275 }; 17276 this._queueCallback(complete, this.tip, this._isAnimated()); 17277 } 17278 update() { 17279 if (this._popper) { 17280 this._popper.update(); 17281 } 17282 } 17283 _isWithContent() { 17284 return Boolean(this._getTitle()); 17285 } 17286 _getTipElement() { 17287 if (!this.tip) { 17288 this.tip = this._createTipElement(this._newContent || this._getContentForTemplate()); 17289 } 17290 return this.tip; 17291 } 17292 _createTipElement(content) { 17293 const tip = this._getTemplateFactory(content).toHtml(); 17294 if (!tip) { 17295 return null; 17296 } 17297 tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); 17298 tip.classList.add(`bs-${this.constructor.NAME}-auto`); 17299 const tipId = getUID(this.constructor.NAME).toString(); 17300 tip.setAttribute("id", tipId); 17301 if (this._isAnimated()) { 17302 tip.classList.add(CLASS_NAME_FADE$2); 17303 } 17304 return tip; 17305 } 17306 setContent(content) { 17307 this._newContent = content; 17308 if (this._isShown()) { 17309 this._disposePopper(); 17310 this.show(); 17311 } 17312 } 17313 _getTemplateFactory(content) { 17314 if (this._templateFactory) { 17315 this._templateFactory.changeContent(content); 17316 } else { 17317 this._templateFactory = new TemplateFactory({ 17318 ...this._config, 17319 content, 17320 extraClass: this._resolvePossibleFunction(this._config.customClass) 17321 }); 17322 } 17323 return this._templateFactory; 17324 } 17325 _getContentForTemplate() { 17326 return { 17327 [SELECTOR_TOOLTIP_INNER]: this._getTitle() 17328 }; 17329 } 17330 _getTitle() { 17331 return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute("data-bs-original-title"); 17332 } 17333 _initializeOnDelegatedTarget(event) { 17334 return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig()); 17335 } 17336 _isAnimated() { 17337 return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2); 17338 } 17339 _isShown() { 17340 return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2); 17341 } 17342 _createPopper(tip) { 17343 const placement = execute(this._config.placement, [this, tip, this._element]); 17344 const attachment = AttachmentMap[placement.toUpperCase()]; 17345 return createPopper3(this._element, tip, this._getPopperConfig(attachment)); 17346 } 17347 _getOffset() { 17348 const { 17349 offset: offset2 17350 } = this._config; 17351 if (typeof offset2 === "string") { 17352 return offset2.split(",").map((value) => Number.parseInt(value, 10)); 17353 } 17354 if (typeof offset2 === "function") { 17355 return (popperData) => offset2(popperData, this._element); 17356 } 17357 return offset2; 17358 } 17359 _resolvePossibleFunction(arg) { 17360 return execute(arg, [this._element]); 17361 } 17362 _getPopperConfig(attachment) { 17363 const defaultBsPopperConfig = { 17364 placement: attachment, 17365 modifiers: [{ 17366 name: "flip", 17367 options: { 17368 fallbackPlacements: this._config.fallbackPlacements 17369 } 17370 }, { 17371 name: "offset", 17372 options: { 17373 offset: this._getOffset() 17374 } 17375 }, { 17376 name: "preventOverflow", 17377 options: { 17378 boundary: this._config.boundary 17379 } 17380 }, { 17381 name: "arrow", 17382 options: { 17383 element: `.${this.constructor.NAME}-arrow` 17384 } 17385 }, { 17386 name: "preSetPlacement", 17387 enabled: true, 17388 phase: "beforeMain", 17389 fn: (data) => { 17390 this._getTipElement().setAttribute("data-popper-placement", data.state.placement); 17391 } 17392 }] 17393 }; 17394 return { 17395 ...defaultBsPopperConfig, 17396 ...execute(this._config.popperConfig, [defaultBsPopperConfig]) 17397 }; 17398 } 17399 _setListeners() { 17400 const triggers = this._config.trigger.split(" "); 17401 for (const trigger of triggers) { 17402 if (trigger === "click") { 17403 EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, (event) => { 17404 const context = this._initializeOnDelegatedTarget(event); 17405 context.toggle(); 17406 }); 17407 } else if (trigger !== TRIGGER_MANUAL) { 17408 const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1); 17409 const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1); 17410 EventHandler.on(this._element, eventIn, this._config.selector, (event) => { 17411 const context = this._initializeOnDelegatedTarget(event); 17412 context._activeTrigger[event.type === "focusin" ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 17413 context._enter(); 17414 }); 17415 EventHandler.on(this._element, eventOut, this._config.selector, (event) => { 17416 const context = this._initializeOnDelegatedTarget(event); 17417 context._activeTrigger[event.type === "focusout" ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget); 17418 context._leave(); 17419 }); 17420 } 17421 } 17422 this._hideModalHandler = () => { 17423 if (this._element) { 17424 this.hide(); 17425 } 17426 }; 17427 EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler); 17428 } 17429 _fixTitle() { 17430 const title = this._element.getAttribute("title"); 17431 if (!title) { 17432 return; 17433 } 17434 if (!this._element.getAttribute("aria-label") && !this._element.textContent.trim()) { 17435 this._element.setAttribute("aria-label", title); 17436 } 17437 this._element.setAttribute("data-bs-original-title", title); 17438 this._element.removeAttribute("title"); 17439 } 17440 _enter() { 17441 if (this._isShown() || this._isHovered) { 17442 this._isHovered = true; 17443 return; 17444 } 17445 this._isHovered = true; 17446 this._setTimeout(() => { 17447 if (this._isHovered) { 17448 this.show(); 17449 } 17450 }, this._config.delay.show); 17451 } 17452 _leave() { 17453 if (this._isWithActiveTrigger()) { 17454 return; 17455 } 17456 this._isHovered = false; 17457 this._setTimeout(() => { 17458 if (!this._isHovered) { 17459 this.hide(); 17460 } 17461 }, this._config.delay.hide); 17462 } 17463 _setTimeout(handler, timeout) { 17464 clearTimeout(this._timeout); 17465 this._timeout = setTimeout(handler, timeout); 17466 } 17467 _isWithActiveTrigger() { 17468 return Object.values(this._activeTrigger).includes(true); 17469 } 17470 _getConfig(config) { 17471 const dataAttributes = Manipulator.getDataAttributes(this._element); 17472 for (const dataAttribute of Object.keys(dataAttributes)) { 17473 if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) { 17474 delete dataAttributes[dataAttribute]; 17475 } 17476 } 17477 config = { 17478 ...dataAttributes, 17479 ...typeof config === "object" && config ? config : {} 17480 }; 17481 config = this._mergeConfigObj(config); 17482 config = this._configAfterMerge(config); 17483 this._typeCheckConfig(config); 17484 return config; 17485 } 17486 _configAfterMerge(config) { 17487 config.container = config.container === false ? document.body : getElement(config.container); 17488 if (typeof config.delay === "number") { 17489 config.delay = { 17490 show: config.delay, 17491 hide: config.delay 17492 }; 17493 } 17494 if (typeof config.title === "number") { 17495 config.title = config.title.toString(); 17496 } 17497 if (typeof config.content === "number") { 17498 config.content = config.content.toString(); 17499 } 17500 return config; 17501 } 17502 _getDelegateConfig() { 17503 const config = {}; 17504 for (const [key, value] of Object.entries(this._config)) { 17505 if (this.constructor.Default[key] !== value) { 17506 config[key] = value; 17507 } 17508 } 17509 config.selector = false; 17510 config.trigger = "manual"; 17511 return config; 17512 } 17513 _disposePopper() { 17514 if (this._popper) { 17515 this._popper.destroy(); 17516 this._popper = null; 17517 } 17518 if (this.tip) { 17519 this.tip.remove(); 17520 this.tip = null; 17521 } 17522 } 17523 static jQueryInterface(config) { 17524 return this.each(function() { 17525 const data = Tooltip.getOrCreateInstance(this, config); 17526 if (typeof config !== "string") { 17527 return; 17528 } 17529 if (typeof data[config] === "undefined") { 17530 throw new TypeError(`No method named "${config}"`); 17531 } 17532 data[config](); 17533 }); 17534 } 17535} 17536defineJQueryPlugin(Tooltip); 17537var NAME$3 = "popover"; 17538var SELECTOR_TITLE = ".popover-header"; 17539var SELECTOR_CONTENT = ".popover-body"; 17540var Default$2 = { 17541 ...Tooltip.Default, 17542 content: "", 17543 offset: [0, 8], 17544 placement: "right", 17545 template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + "</div>", 17546 trigger: "click" 17547}; 17548var DefaultType$2 = { 17549 ...Tooltip.DefaultType, 17550 content: "(null|string|element|function)" 17551}; 17552 17553class Popover extends Tooltip { 17554 static get Default() { 17555 return Default$2; 17556 } 17557 static get DefaultType() { 17558 return DefaultType$2; 17559 } 17560 static get NAME() { 17561 return NAME$3; 17562 } 17563 _isWithContent() { 17564 return this._getTitle() || this._getContent(); 17565 } 17566 _getContentForTemplate() { 17567 return { 17568 [SELECTOR_TITLE]: this._getTitle(), 17569 [SELECTOR_CONTENT]: this._getContent() 17570 }; 17571 } 17572 _getContent() { 17573 return this._resolvePossibleFunction(this._config.content); 17574 } 17575 static jQueryInterface(config) { 17576 return this.each(function() { 17577 const data = Popover.getOrCreateInstance(this, config); 17578 if (typeof config !== "string") { 17579 return; 17580 } 17581 if (typeof data[config] === "undefined") { 17582 throw new TypeError(`No method named "${config}"`); 17583 } 17584 data[config](); 17585 }); 17586 } 17587} 17588defineJQueryPlugin(Popover); 17589var NAME$2 = "scrollspy"; 17590var DATA_KEY$2 = "bs.scrollspy"; 17591var EVENT_KEY$2 = `.${DATA_KEY$2}`; 17592var DATA_API_KEY = ".data-api"; 17593var EVENT_ACTIVATE = `activate${EVENT_KEY$2}`; 17594var EVENT_CLICK = `click${EVENT_KEY$2}`; 17595var EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`; 17596var CLASS_NAME_DROPDOWN_ITEM = "dropdown-item"; 17597var CLASS_NAME_ACTIVE$1 = "active"; 17598var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; 17599var SELECTOR_TARGET_LINKS = "[href]"; 17600var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group"; 17601var SELECTOR_NAV_LINKS = ".nav-link"; 17602var SELECTOR_NAV_ITEMS = ".nav-item"; 17603var SELECTOR_LIST_ITEMS = ".list-group-item"; 17604var SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`; 17605var SELECTOR_DROPDOWN = ".dropdown"; 17606var SELECTOR_DROPDOWN_TOGGLE$1 = ".dropdown-toggle"; 17607var Default$1 = { 17608 offset: null, 17609 rootMargin: "0px 0px -25%", 17610 smoothScroll: false, 17611 target: null, 17612 threshold: [0.1, 0.5, 1] 17613}; 17614var DefaultType$1 = { 17615 offset: "(number|null)", 17616 rootMargin: "string", 17617 smoothScroll: "boolean", 17618 target: "element", 17619 threshold: "array" 17620}; 17621 17622class ScrollSpy extends BaseComponent { 17623 constructor(element, config) { 17624 super(element, config); 17625 this._targetLinks = new Map; 17626 this._observableSections = new Map; 17627 this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element; 17628 this._activeTarget = null; 17629 this._observer = null; 17630 this._previousScrollData = { 17631 visibleEntryTop: 0, 17632 parentScrollTop: 0 17633 }; 17634 this.refresh(); 17635 } 17636 static get Default() { 17637 return Default$1; 17638 } 17639 static get DefaultType() { 17640 return DefaultType$1; 17641 } 17642 static get NAME() { 17643 return NAME$2; 17644 } 17645 refresh() { 17646 this._initializeTargetsAndObservables(); 17647 this._maybeEnableSmoothScroll(); 17648 if (this._observer) { 17649 this._observer.disconnect(); 17650 } else { 17651 this._observer = this._getNewObserver(); 17652 } 17653 for (const section of this._observableSections.values()) { 17654 this._observer.observe(section); 17655 } 17656 } 17657 dispose() { 17658 this._observer.disconnect(); 17659 super.dispose(); 17660 } 17661 _configAfterMerge(config) { 17662 config.target = getElement(config.target) || document.body; 17663 config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin; 17664 if (typeof config.threshold === "string") { 17665 config.threshold = config.threshold.split(",").map((value) => Number.parseFloat(value)); 17666 } 17667 return config; 17668 } 17669 _maybeEnableSmoothScroll() { 17670 if (!this._config.smoothScroll) { 17671 return; 17672 } 17673 EventHandler.off(this._config.target, EVENT_CLICK); 17674 EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, (event) => { 17675 const observableSection = this._observableSections.get(event.target.hash); 17676 if (observableSection) { 17677 event.preventDefault(); 17678 const root = this._rootElement || window; 17679 const height = observableSection.offsetTop - this._element.offsetTop; 17680 if (root.scrollTo) { 17681 root.scrollTo({ 17682 top: height, 17683 behavior: "smooth" 17684 }); 17685 return; 17686 } 17687 root.scrollTop = height; 17688 } 17689 }); 17690 } 17691 _getNewObserver() { 17692 const options = { 17693 root: this._rootElement, 17694 threshold: this._config.threshold, 17695 rootMargin: this._config.rootMargin 17696 }; 17697 return new IntersectionObserver((entries) => this._observerCallback(entries), options); 17698 } 17699 _observerCallback(entries) { 17700 const targetElement = (entry) => this._targetLinks.get(`#${entry.target.id}`); 17701 const activate = (entry) => { 17702 this._previousScrollData.visibleEntryTop = entry.target.offsetTop; 17703 this._process(targetElement(entry)); 17704 }; 17705 const parentScrollTop = (this._rootElement || document.documentElement).scrollTop; 17706 const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop; 17707 this._previousScrollData.parentScrollTop = parentScrollTop; 17708 for (const entry of entries) { 17709 if (!entry.isIntersecting) { 17710 this._activeTarget = null; 17711 this._clearActiveClass(targetElement(entry)); 17712 continue; 17713 } 17714 const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; 17715 if (userScrollsDown && entryIsLowerThanPrevious) { 17716 activate(entry); 17717 if (!parentScrollTop) { 17718 return; 17719 } 17720 continue; 17721 } 17722 if (!userScrollsDown && !entryIsLowerThanPrevious) { 17723 activate(entry); 17724 } 17725 } 17726 } 17727 _initializeTargetsAndObservables() { 17728 this._targetLinks = new Map; 17729 this._observableSections = new Map; 17730 const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target); 17731 for (const anchor of targetLinks) { 17732 if (!anchor.hash || isDisabled(anchor)) { 17733 continue; 17734 } 17735 const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element); 17736 if (isVisible(observableSection)) { 17737 this._targetLinks.set(decodeURI(anchor.hash), anchor); 17738 this._observableSections.set(anchor.hash, observableSection); 17739 } 17740 } 17741 } 17742 _process(target) { 17743 if (this._activeTarget === target) { 17744 return; 17745 } 17746 this._clearActiveClass(this._config.target); 17747 this._activeTarget = target; 17748 target.classList.add(CLASS_NAME_ACTIVE$1); 17749 this._activateParents(target); 17750 EventHandler.trigger(this._element, EVENT_ACTIVATE, { 17751 relatedTarget: target 17752 }); 17753 } 17754 _activateParents(target) { 17755 if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { 17756 SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1); 17757 return; 17758 } 17759 for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) { 17760 for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) { 17761 item.classList.add(CLASS_NAME_ACTIVE$1); 17762 } 17763 } 17764 } 17765 _clearActiveClass(parent) { 17766 parent.classList.remove(CLASS_NAME_ACTIVE$1); 17767 const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent); 17768 for (const node of activeNodes) { 17769 node.classList.remove(CLASS_NAME_ACTIVE$1); 17770 } 17771 } 17772 static jQueryInterface(config) { 17773 return this.each(function() { 17774 const data = ScrollSpy.getOrCreateInstance(this, config); 17775 if (typeof config !== "string") { 17776 return; 17777 } 17778 if (data[config] === undefined || config.startsWith("_") || config === "constructor") { 17779 throw new TypeError(`No method named "${config}"`); 17780 } 17781 data[config](); 17782 }); 17783 } 17784} 17785EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => { 17786 for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) { 17787 ScrollSpy.getOrCreateInstance(spy); 17788 } 17789}); 17790defineJQueryPlugin(ScrollSpy); 17791var NAME$1 = "tab"; 17792var DATA_KEY$1 = "bs.tab"; 17793var EVENT_KEY$1 = `.${DATA_KEY$1}`; 17794var EVENT_HIDE$1 = `hide${EVENT_KEY$1}`; 17795var EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`; 17796var EVENT_SHOW$1 = `show${EVENT_KEY$1}`; 17797var EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`; 17798var EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`; 17799var EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`; 17800var EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`; 17801var ARROW_LEFT_KEY = "ArrowLeft"; 17802var ARROW_RIGHT_KEY = "ArrowRight"; 17803var ARROW_UP_KEY = "ArrowUp"; 17804var ARROW_DOWN_KEY = "ArrowDown"; 17805var HOME_KEY = "Home"; 17806var END_KEY = "End"; 17807var CLASS_NAME_ACTIVE = "active"; 17808var CLASS_NAME_FADE$1 = "fade"; 17809var CLASS_NAME_SHOW$1 = "show"; 17810var CLASS_DROPDOWN = "dropdown"; 17811var SELECTOR_DROPDOWN_TOGGLE = ".dropdown-toggle"; 17812var SELECTOR_DROPDOWN_MENU = ".dropdown-menu"; 17813var NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`; 17814var SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'; 17815var SELECTOR_OUTER = ".nav-item, .list-group-item"; 17816var SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`; 17817var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; 17818var SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`; 17819var SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`; 17820 17821class Tab extends BaseComponent { 17822 constructor(element) { 17823 super(element); 17824 this._parent = this._element.closest(SELECTOR_TAB_PANEL); 17825 if (!this._parent) { 17826 return; 17827 } 17828 this._setInitialAttributes(this._parent, this._getChildren()); 17829 EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event)); 17830 } 17831 static get NAME() { 17832 return NAME$1; 17833 } 17834 show() { 17835 const innerElem = this._element; 17836 if (this._elemIsActive(innerElem)) { 17837 return; 17838 } 17839 const active = this._getActiveElem(); 17840 const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, { 17841 relatedTarget: innerElem 17842 }) : null; 17843 const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, { 17844 relatedTarget: active 17845 }); 17846 if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) { 17847 return; 17848 } 17849 this._deactivate(active, innerElem); 17850 this._activate(innerElem, active); 17851 } 17852 _activate(element, relatedElem) { 17853 if (!element) { 17854 return; 17855 } 17856 element.classList.add(CLASS_NAME_ACTIVE); 17857 this._activate(SelectorEngine.getElementFromSelector(element)); 17858 const complete = () => { 17859 if (element.getAttribute("role") !== "tab") { 17860 element.classList.add(CLASS_NAME_SHOW$1); 17861 return; 17862 } 17863 element.removeAttribute("tabindex"); 17864 element.setAttribute("aria-selected", true); 17865 this._toggleDropDown(element, true); 17866 EventHandler.trigger(element, EVENT_SHOWN$1, { 17867 relatedTarget: relatedElem 17868 }); 17869 }; 17870 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 17871 } 17872 _deactivate(element, relatedElem) { 17873 if (!element) { 17874 return; 17875 } 17876 element.classList.remove(CLASS_NAME_ACTIVE); 17877 element.blur(); 17878 this._deactivate(SelectorEngine.getElementFromSelector(element)); 17879 const complete = () => { 17880 if (element.getAttribute("role") !== "tab") { 17881 element.classList.remove(CLASS_NAME_SHOW$1); 17882 return; 17883 } 17884 element.setAttribute("aria-selected", false); 17885 element.setAttribute("tabindex", "-1"); 17886 this._toggleDropDown(element, false); 17887 EventHandler.trigger(element, EVENT_HIDDEN$1, { 17888 relatedTarget: relatedElem 17889 }); 17890 }; 17891 this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1)); 17892 } 17893 _keydown(event) { 17894 if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) { 17895 return; 17896 } 17897 event.stopPropagation(); 17898 event.preventDefault(); 17899 const children = this._getChildren().filter((element) => !isDisabled(element)); 17900 let nextActiveElement; 17901 if ([HOME_KEY, END_KEY].includes(event.key)) { 17902 nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1]; 17903 } else { 17904 const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key); 17905 nextActiveElement = getNextActiveElement(children, event.target, isNext, true); 17906 } 17907 if (nextActiveElement) { 17908 nextActiveElement.focus({ 17909 preventScroll: true 17910 }); 17911 Tab.getOrCreateInstance(nextActiveElement).show(); 17912 } 17913 } 17914 _getChildren() { 17915 return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent); 17916 } 17917 _getActiveElem() { 17918 return this._getChildren().find((child) => this._elemIsActive(child)) || null; 17919 } 17920 _setInitialAttributes(parent, children) { 17921 this._setAttributeIfNotExists(parent, "role", "tablist"); 17922 for (const child of children) { 17923 this._setInitialAttributesOnChild(child); 17924 } 17925 } 17926 _setInitialAttributesOnChild(child) { 17927 child = this._getInnerElement(child); 17928 const isActive = this._elemIsActive(child); 17929 const outerElem = this._getOuterElement(child); 17930 child.setAttribute("aria-selected", isActive); 17931 if (outerElem !== child) { 17932 this._setAttributeIfNotExists(outerElem, "role", "presentation"); 17933 } 17934 if (!isActive) { 17935 child.setAttribute("tabindex", "-1"); 17936 } 17937 this._setAttributeIfNotExists(child, "role", "tab"); 17938 this._setInitialAttributesOnTargetPanel(child); 17939 } 17940 _setInitialAttributesOnTargetPanel(child) { 17941 const target = SelectorEngine.getElementFromSelector(child); 17942 if (!target) { 17943 return; 17944 } 17945 this._setAttributeIfNotExists(target, "role", "tabpanel"); 17946 if (child.id) { 17947 this._setAttributeIfNotExists(target, "aria-labelledby", `${child.id}`); 17948 } 17949 } 17950 _toggleDropDown(element, open) { 17951 const outerElem = this._getOuterElement(element); 17952 if (!outerElem.classList.contains(CLASS_DROPDOWN)) { 17953 return; 17954 } 17955 const toggle = (selector, className) => { 17956 const element2 = SelectorEngine.findOne(selector, outerElem); 17957 if (element2) { 17958 element2.classList.toggle(className, open); 17959 } 17960 }; 17961 toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE); 17962 toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1); 17963 outerElem.setAttribute("aria-expanded", open); 17964 } 17965 _setAttributeIfNotExists(element, attribute, value) { 17966 if (!element.hasAttribute(attribute)) { 17967 element.setAttribute(attribute, value); 17968 } 17969 } 17970 _elemIsActive(elem) { 17971 return elem.classList.contains(CLASS_NAME_ACTIVE); 17972 } 17973 _getInnerElement(elem) { 17974 return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem); 17975 } 17976 _getOuterElement(elem) { 17977 return elem.closest(SELECTOR_OUTER) || elem; 17978 } 17979 static jQueryInterface(config) { 17980 return this.each(function() { 17981 const data = Tab.getOrCreateInstance(this); 17982 if (typeof config !== "string") { 17983 return; 17984 } 17985 if (data[config] === undefined || config.startsWith("_") || config === "constructor") { 17986 throw new TypeError(`No method named "${config}"`); 17987 } 17988 data[config](); 17989 }); 17990 } 17991} 17992EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function(event) { 17993 if (["A", "AREA"].includes(this.tagName)) { 17994 event.preventDefault(); 17995 } 17996 if (isDisabled(this)) { 17997 return; 17998 } 17999 Tab.getOrCreateInstance(this).show(); 18000}); 18001EventHandler.on(window, EVENT_LOAD_DATA_API, () => { 18002 for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) { 18003 Tab.getOrCreateInstance(element); 18004 } 18005}); 18006defineJQueryPlugin(Tab); 18007var NAME = "toast"; 18008var DATA_KEY = "bs.toast"; 18009var EVENT_KEY = `.${DATA_KEY}`; 18010var EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`; 18011var EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`; 18012var EVENT_FOCUSIN = `focusin${EVENT_KEY}`; 18013var EVENT_FOCUSOUT = `focusout${EVENT_KEY}`; 18014var EVENT_HIDE = `hide${EVENT_KEY}`; 18015var EVENT_HIDDEN = `hidden${EVENT_KEY}`; 18016var EVENT_SHOW = `show${EVENT_KEY}`; 18017var EVENT_SHOWN = `shown${EVENT_KEY}`; 18018var CLASS_NAME_FADE = "fade"; 18019var CLASS_NAME_HIDE = "hide"; 18020var CLASS_NAME_SHOW = "show"; 18021var CLASS_NAME_SHOWING = "showing"; 18022var DefaultType = { 18023 animation: "boolean", 18024 autohide: "boolean", 18025 delay: "number" 18026}; 18027var Default = { 18028 animation: true, 18029 autohide: true, 18030 delay: 5000 18031}; 18032 18033class Toast extends BaseComponent { 18034 constructor(element, config) { 18035 super(element, config); 18036 this._timeout = null; 18037 this._hasMouseInteraction = false; 18038 this._hasKeyboardInteraction = false; 18039 this._setListeners(); 18040 } 18041 static get Default() { 18042 return Default; 18043 } 18044 static get DefaultType() { 18045 return DefaultType; 18046 } 18047 static get NAME() { 18048 return NAME; 18049 } 18050 show() { 18051 const showEvent = EventHandler.trigger(this._element, EVENT_SHOW); 18052 if (showEvent.defaultPrevented) { 18053 return; 18054 } 18055 this._clearTimeout(); 18056 if (this._config.animation) { 18057 this._element.classList.add(CLASS_NAME_FADE); 18058 } 18059 const complete = () => { 18060 this._element.classList.remove(CLASS_NAME_SHOWING); 18061 EventHandler.trigger(this._element, EVENT_SHOWN); 18062 this._maybeScheduleHide(); 18063 }; 18064 this._element.classList.remove(CLASS_NAME_HIDE); 18065 reflow(this._element); 18066 this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING); 18067 this._queueCallback(complete, this._element, this._config.animation); 18068 } 18069 hide() { 18070 if (!this.isShown()) { 18071 return; 18072 } 18073 const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); 18074 if (hideEvent.defaultPrevented) { 18075 return; 18076 } 18077 const complete = () => { 18078 this._element.classList.add(CLASS_NAME_HIDE); 18079 this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW); 18080 EventHandler.trigger(this._element, EVENT_HIDDEN); 18081 }; 18082 this._element.classList.add(CLASS_NAME_SHOWING); 18083 this._queueCallback(complete, this._element, this._config.animation); 18084 } 18085 dispose() { 18086 this._clearTimeout(); 18087 if (this.isShown()) { 18088 this._element.classList.remove(CLASS_NAME_SHOW); 18089 } 18090 super.dispose(); 18091 } 18092 isShown() { 18093 return this._element.classList.contains(CLASS_NAME_SHOW); 18094 } 18095 _maybeScheduleHide() { 18096 if (!this._config.autohide) { 18097 return; 18098 } 18099 if (this._hasMouseInteraction || this._hasKeyboardInteraction) { 18100 return; 18101 } 18102 this._timeout = setTimeout(() => { 18103 this.hide(); 18104 }, this._config.delay); 18105 } 18106 _onInteraction(event, isInteracting) { 18107 switch (event.type) { 18108 case "mouseover": 18109 case "mouseout": { 18110 this._hasMouseInteraction = isInteracting; 18111 break; 18112 } 18113 case "focusin": 18114 case "focusout": { 18115 this._hasKeyboardInteraction = isInteracting; 18116 break; 18117 } 18118 } 18119 if (isInteracting) { 18120 this._clearTimeout(); 18121 return; 18122 } 18123 const nextElement = event.relatedTarget; 18124 if (this._element === nextElement || this._element.contains(nextElement)) { 18125 return; 18126 } 18127 this._maybeScheduleHide(); 18128 } 18129 _setListeners() { 18130 EventHandler.on(this._element, EVENT_MOUSEOVER, (event) => this._onInteraction(event, true)); 18131 EventHandler.on(this._element, EVENT_MOUSEOUT, (event) => this._onInteraction(event, false)); 18132 EventHandler.on(this._element, EVENT_FOCUSIN, (event) => this._onInteraction(event, true)); 18133 EventHandler.on(this._element, EVENT_FOCUSOUT, (event) => this._onInteraction(event, false)); 18134 } 18135 _clearTimeout() { 18136 clearTimeout(this._timeout); 18137 this._timeout = null; 18138 } 18139 static jQueryInterface(config) { 18140 return this.each(function() { 18141 const data = Toast.getOrCreateInstance(this, config); 18142 if (typeof config === "string") { 18143 if (typeof data[config] === "undefined") { 18144 throw new TypeError(`No method named "${config}"`); 18145 } 18146 data[config](this); 18147 } 18148 }); 18149 } 18150} 18151enableDismissTrigger(Toast); 18152defineJQueryPlugin(Toast); 18153
18154// app/javascript/add_jquery.js 18155var import_jquery = __toESM(require_jquery(), 1); 18156window.jQuery = window.$ = import_jquery.default; 18157window.$ = import_jquery.default; 18158
vendor: 69,592 bytes, lines 18159-20012
18159// node_modules/owl.carousel/dist/owl.carousel.js 18160(function($, window2, document2, undefined2) { 18161 function Owl(element, options) { 18162 this.settings = null; 18163 this.options = $.extend({}, Owl.Defaults, options); 18164 this.$element = $(element); 18165 this._handlers = {}; 18166 this._plugins = {}; 18167 this._supress = {}; 18168 this._current = null; 18169 this._speed = null; 18170 this._coordinates = []; 18171 this._breakpoint = null; 18172 this._width = null; 18173 this._items = []; 18174 this._clones = []; 18175 this._mergers = []; 18176 this._widths = []; 18177 this._invalidated = {}; 18178 this._pipe = []; 18179 this._drag = { 18180 time: null, 18181 target: null, 18182 pointer: null, 18183 stage: { 18184 start: null, 18185 current: null 18186 }, 18187 direction: null 18188 }; 18189 this._states = { 18190 current: {}, 18191 tags: { 18192 initializing: ["busy"], 18193 animating: ["busy"], 18194 dragging: ["interacting"] 18195 } 18196 }; 18197 $.each(["onResize", "onThrottledResize"], $.proxy(function(i, handler) { 18198 this._handlers[handler] = $.proxy(this[handler], this); 18199 }, this)); 18200 $.each(Owl.Plugins, $.proxy(function(key, plugin) { 18201 this._plugins[key.charAt(0).toLowerCase() + key.slice(1)] = new plugin(this); 18202 }, this)); 18203 $.each(Owl.Workers, $.proxy(function(priority, worker) { 18204 this._pipe.push({ 18205 filter: worker.filter, 18206 run: $.proxy(worker.run, this) 18207 }); 18208 }, this)); 18209 this.setup(); 18210 this.initialize(); 18211 } 18212 Owl.Defaults = { 18213 items: 3, 18214 loop: false, 18215 center: false, 18216 rewind: false, 18217 checkVisibility: true, 18218 mouseDrag: true, 18219 touchDrag: true, 18220 pullDrag: true, 18221 freeDrag: false, 18222 margin: 0, 18223 stagePadding: 0, 18224 merge: false, 18225 mergeFit: true, 18226 autoWidth: false, 18227 startPosition: 0, 18228 rtl: false, 18229 smartSpeed: 250, 18230 fluidSpeed: false, 18231 dragEndSpeed: false, 18232 responsive: {}, 18233 responsiveRefreshRate: 200, 18234 responsiveBaseElement: window2, 18235 fallbackEasing: "swing", 18236 slideTransition: "", 18237 info: false, 18238 nestedItemSelector: false, 18239 itemElement: "div", 18240 stageElement: "div", 18241 refreshClass: "owl-refresh", 18242 loadedClass: "owl-loaded", 18243 loadingClass: "owl-loading", 18244 rtlClass: "owl-rtl", 18245 responsiveClass: "owl-responsive", 18246 dragClass: "owl-drag", 18247 itemClass: "owl-item", 18248 stageClass: "owl-stage", 18249 stageOuterClass: "owl-stage-outer", 18250 grabClass: "owl-grab" 18251 }; 18252 Owl.Width = { 18253 Default: "default", 18254 Inner: "inner", 18255 Outer: "outer" 18256 }; 18257 Owl.Type = { 18258 Event: "event", 18259 State: "state" 18260 }; 18261 Owl.Plugins = {}; 18262 Owl.Workers = [{ 18263 filter: ["width", "settings"], 18264 run: function() { 18265 this._width = this.$element.width(); 18266 } 18267 }, { 18268 filter: ["width", "items", "settings"], 18269 run: function(cache2) { 18270 cache2.current = this._items && this._items[this.relative(this._current)]; 18271 } 18272 }, { 18273 filter: ["items", "settings"], 18274 run: function() { 18275 this.$stage.children(".cloned").remove(); 18276 } 18277 }, { 18278 filter: ["width", "items", "settings"], 18279 run: function(cache2) { 18280 var margin = this.settings.margin || "", grid = !this.settings.autoWidth, rtl = this.settings.rtl, css = { 18281 width: "auto", 18282 "margin-left": rtl ? margin : "", 18283 "margin-right": rtl ? "" : margin 18284 }; 18285 !grid && this.$stage.children().css(css); 18286 cache2.css = css; 18287 } 18288 }, { 18289 filter: ["width", "items", "settings"], 18290 run: function(cache2) { 18291 var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, merge = null, iterator = this._items.length, grid = !this.settings.autoWidth, widths = []; 18292 cache2.items = { 18293 merge: false, 18294 width 18295 }; 18296 while (iterator--) { 18297 merge = this._mergers[iterator]; 18298 merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge; 18299 cache2.items.merge = merge > 1 || cache2.items.merge; 18300 widths[iterator] = !grid ? this._items[iterator].width() : width * merge; 18301 } 18302 this._widths = widths; 18303 } 18304 }, { 18305 filter: ["items", "settings"], 18306 run: function() { 18307 var clones = [], items = this._items, settings = this.settings, view = Math.max(settings.items * 2, 4), size = Math.ceil(items.length / 2) * 2, repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0, append = "", prepend = ""; 18308 repeat /= 2; 18309 while (repeat > 0) { 18310 clones.push(this.normalize(clones.length / 2, true)); 18311 append = append + items[clones[clones.length - 1]][0].outerHTML; 18312 clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true)); 18313 prepend = items[clones[clones.length - 1]][0].outerHTML + prepend; 18314 repeat -= 1; 18315 } 18316 this._clones = clones; 18317 $(append).addClass("cloned").appendTo(this.$stage); 18318 $(prepend).addClass("cloned").prependTo(this.$stage); 18319 } 18320 }, { 18321 filter: ["width", "items", "settings"], 18322 run: function() { 18323 var rtl = this.settings.rtl ? 1 : -1, size = this._clones.length + this._items.length, iterator = -1, previous = 0, current = 0, coordinates = []; 18324 while (++iterator < size) { 18325 previous = coordinates[iterator - 1] || 0; 18326 current = this._widths[this.relative(iterator)] + this.settings.margin; 18327 coordinates.push(previous + current * rtl); 18328 } 18329 this._coordinates = coordinates; 18330 } 18331 }, { 18332 filter: ["width", "items", "settings"], 18333 run: function() { 18334 var padding = this.settings.stagePadding, coordinates = this._coordinates, css = { 18335 width: Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2, 18336 "padding-left": padding || "", 18337 "padding-right": padding || "" 18338 }; 18339 this.$stage.css(css); 18340 } 18341 }, { 18342 filter: ["width", "items", "settings"], 18343 run: function(cache2) { 18344 var iterator = this._coordinates.length, grid = !this.settings.autoWidth, items = this.$stage.children(); 18345 if (grid && cache2.items.merge) { 18346 while (iterator--) { 18347 cache2.css.width = this._widths[this.relative(iterator)]; 18348 items.eq(iterator).css(cache2.css); 18349 } 18350 } else if (grid) { 18351 cache2.css.width = cache2.items.width; 18352 items.css(cache2.css); 18353 } 18354 } 18355 }, { 18356 filter: ["items"], 18357 run: function() { 18358 this._coordinates.length < 1 && this.$stage.removeAttr("style"); 18359 } 18360 }, { 18361 filter: ["width", "items", "settings"], 18362 run: function(cache2) { 18363 cache2.current = cache2.current ? this.$stage.children().index(cache2.current) : 0; 18364 cache2.current = Math.max(this.minimum(), Math.min(this.maximum(), cache2.current)); 18365 this.reset(cache2.current); 18366 } 18367 }, { 18368 filter: ["position"], 18369 run: function() { 18370 this.animate(this.coordinates(this._current)); 18371 } 18372 }, { 18373 filter: ["width", "position", "items", "settings"], 18374 run: function() { 18375 var rtl = this.settings.rtl ? 1 : -1, padding = this.settings.stagePadding * 2, begin = this.coordinates(this.current()) + padding, end2 = begin + this.width() * rtl, inner, outer, matches = [], i, n2; 18376 for (i = 0, n2 = this._coordinates.length;i < n2; i++) { 18377 inner = this._coordinates[i - 1] || 0; 18378 outer = Math.abs(this._coordinates[i]) + padding * rtl; 18379 if (this.op(inner, "<=", begin) && this.op(inner, ">", end2) || this.op(outer, "<", begin) && this.op(outer, ">", end2)) { 18380 matches.push(i); 18381 } 18382 } 18383 this.$stage.children(".active").removeClass("active"); 18384 this.$stage.children(":eq(" + matches.join("), :eq(") + ")").addClass("active"); 18385 this.$stage.children(".center").removeClass("center"); 18386 if (this.settings.center) { 18387 this.$stage.children().eq(this.current()).addClass("center"); 18388 } 18389 } 18390 }]; 18391 Owl.prototype.initializeStage = function() { 18392 this.$stage = this.$element.find("." + this.settings.stageClass); 18393 if (this.$stage.length) { 18394 return; 18395 } 18396 this.$element.addClass(this.options.loadingClass); 18397 this.$stage = $("<" + this.settings.stageElement + ">", { 18398 class: this.settings.stageClass 18399 }).wrap($("<div/>", { 18400 class: this.settings.stageOuterClass 18401 })); 18402 this.$element.append(this.$stage.parent()); 18403 }; 18404 Owl.prototype.initializeItems = function() { 18405 var $items = this.$element.find(".owl-item"); 18406 if ($items.length) { 18407 this._items = $items.get().map(function(item) { 18408 return $(item); 18409 }); 18410 this._mergers = this._items.map(function() { 18411 return 1; 18412 }); 18413 this.refresh(); 18414 return; 18415 } 18416 this.replace(this.$element.children().not(this.$stage.parent())); 18417 if (this.isVisible()) { 18418 this.refresh(); 18419 } else { 18420 this.invalidate("width"); 18421 } 18422 this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass); 18423 }; 18424 Owl.prototype.initialize = function() { 18425 this.enter("initializing"); 18426 this.trigger("initialize"); 18427 this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl); 18428 if (this.settings.autoWidth && !this.is("pre-loading")) { 18429 var imgs, nestedSelector, width; 18430 imgs = this.$element.find("img"); 18431 nestedSelector = this.settings.nestedItemSelector ? "." + this.settings.nestedItemSelector : undefined2; 18432 width = this.$element.children(nestedSelector).width(); 18433 if (imgs.length && width <= 0) { 18434 this.preloadAutoWidthImages(imgs); 18435 } 18436 } 18437 this.initializeStage(); 18438 this.initializeItems(); 18439 this.registerEventHandlers(); 18440 this.leave("initializing"); 18441 this.trigger("initialized"); 18442 }; 18443 Owl.prototype.isVisible = function() { 18444 return this.settings.checkVisibility ? this.$element.is(":visible") : true; 18445 }; 18446 Owl.prototype.setup = function() { 18447 var viewport2 = this.viewport(), overwrites = this.options.responsive, match = -1, settings = null; 18448 if (!overwrites) { 18449 settings = $.extend({}, this.options); 18450 } else { 18451 $.each(overwrites, function(breakpoint) { 18452 if (breakpoint <= viewport2 && breakpoint > match) { 18453 match = Number(breakpoint); 18454 } 18455 }); 18456 settings = $.extend({}, this.options, overwrites[match]); 18457 if (typeof settings.stagePadding === "function") { 18458 settings.stagePadding = settings.stagePadding(); 18459 } 18460 delete settings.responsive; 18461 if (settings.responsiveClass) { 18462 this.$element.attr("class", this.$element.attr("class").replace(new RegExp("(" + this.options.responsiveClass + "-)\\S+\\s", "g"), "$1" + match)); 18463 } 18464 } 18465 this.trigger("change", { property: { name: "settings", value: settings } }); 18466 this._breakpoint = match; 18467 this.settings = settings; 18468 this.invalidate("settings"); 18469 this.trigger("changed", { property: { name: "settings", value: this.settings } }); 18470 }; 18471 Owl.prototype.optionsLogic = function() { 18472 if (this.settings.autoWidth) { 18473 this.settings.stagePadding = false; 18474 this.settings.merge = false; 18475 } 18476 }; 18477 Owl.prototype.prepare = function(item) { 18478 var event = this.trigger("prepare", { content: item }); 18479 if (!event.data) { 18480 event.data = $("<" + this.settings.itemElement + "/>").addClass(this.options.itemClass).append(item); 18481 } 18482 this.trigger("prepared", { content: event.data }); 18483 return event.data; 18484 }; 18485 Owl.prototype.update = function() { 18486 var i = 0, n2 = this._pipe.length, filter = $.proxy(function(p2) { 18487 return this[p2]; 18488 }, this._invalidated), cache2 = {}; 18489 while (i < n2) { 18490 if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) { 18491 this._pipe[i].run(cache2); 18492 } 18493 i++; 18494 } 18495 this._invalidated = {}; 18496 !this.is("valid") && this.enter("valid"); 18497 }; 18498 Owl.prototype.width = function(dimension) { 18499 dimension = dimension || Owl.Width.Default; 18500 switch (dimension) { 18501 case Owl.Width.Inner: 18502 case Owl.Width.Outer: 18503 return this._width; 18504 default: 18505 return this._width - this.settings.stagePadding * 2 + this.settings.margin; 18506 } 18507 }; 18508 Owl.prototype.refresh = function() { 18509 this.enter("refreshing"); 18510 this.trigger("refresh"); 18511 this.setup(); 18512 this.optionsLogic(); 18513 this.$element.addClass(this.options.refreshClass); 18514 this.update(); 18515 this.$element.removeClass(this.options.refreshClass); 18516 this.leave("refreshing"); 18517 this.trigger("refreshed"); 18518 }; 18519 Owl.prototype.onThrottledResize = function() { 18520 window2.clearTimeout(this.resizeTimer); 18521 this.resizeTimer = window2.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate); 18522 }; 18523 Owl.prototype.onResize = function() { 18524 if (!this._items.length) { 18525 return false; 18526 } 18527 if (this._width === this.$element.width()) { 18528 return false; 18529 } 18530 if (!this.isVisible()) { 18531 return false; 18532 } 18533 this.enter("resizing"); 18534 if (this.trigger("resize").isDefaultPrevented()) { 18535 this.leave("resizing"); 18536 return false; 18537 } 18538 this.invalidate("width"); 18539 this.refresh(); 18540 this.leave("resizing"); 18541 this.trigger("resized"); 18542 }; 18543 Owl.prototype.registerEventHandlers = function() { 18544 if ($.support.transition) { 18545 this.$stage.on($.support.transition.end + ".owl.core", $.proxy(this.onTransitionEnd, this)); 18546 } 18547 if (this.settings.responsive !== false) { 18548 this.on(window2, "resize", this._handlers.onThrottledResize); 18549 } 18550 if (this.settings.mouseDrag) { 18551 this.$element.addClass(this.options.dragClass); 18552 this.$stage.on("mousedown.owl.core", $.proxy(this.onDragStart, this)); 18553 this.$stage.on("dragstart.owl.core selectstart.owl.core", function() { 18554 return false; 18555 }); 18556 } 18557 if (this.settings.touchDrag) { 18558 this.$stage.on("touchstart.owl.core", $.proxy(this.onDragStart, this)); 18559 this.$stage.on("touchcancel.owl.core", $.proxy(this.onDragEnd, this)); 18560 } 18561 }; 18562 Owl.prototype.onDragStart = function(event) { 18563 var stage = null; 18564 if (event.which === 3) { 18565 return; 18566 } 18567 if ($.support.transform) { 18568 stage = this.$stage.css("transform").replace(/.*\(|\)| /g, "").split(","); 18569 stage = { 18570 x: stage[stage.length === 16 ? 12 : 4], 18571 y: stage[stage.length === 16 ? 13 : 5] 18572 }; 18573 } else { 18574 stage = this.$stage.position(); 18575 stage = { 18576 x: this.settings.rtl ? stage.left + this.$stage.width() - this.width() + this.settings.margin : stage.left, 18577 y: stage.top 18578 }; 18579 } 18580 if (this.is("animating")) { 18581 $.support.transform ? this.animate(stage.x) : this.$stage.stop(); 18582 this.invalidate("position"); 18583 } 18584 this.$element.toggleClass(this.options.grabClass, event.type === "mousedown"); 18585 this.speed(0); 18586 this._drag.time = new Date().getTime(); 18587 this._drag.target = $(event.target); 18588 this._drag.stage.start = stage; 18589 this._drag.stage.current = stage; 18590 this._drag.pointer = this.pointer(event); 18591 $(document2).on("mouseup.owl.core touchend.owl.core", $.proxy(this.onDragEnd, this)); 18592 $(document2).one("mousemove.owl.core touchmove.owl.core", $.proxy(function(event2) { 18593 var delta = this.difference(this._drag.pointer, this.pointer(event2)); 18594 $(document2).on("mousemove.owl.core touchmove.owl.core", $.proxy(this.onDragMove, this)); 18595 if (Math.abs(delta.x) < Math.abs(delta.y) && this.is("valid")) { 18596 return; 18597 } 18598 event2.preventDefault(); 18599 this.enter("dragging"); 18600 this.trigger("drag"); 18601 }, this)); 18602 }; 18603 Owl.prototype.onDragMove = function(event) { 18604 var minimum = null, maximum = null, pull = null, delta = this.difference(this._drag.pointer, this.pointer(event)), stage = this.difference(this._drag.stage.start, delta); 18605 if (!this.is("dragging")) { 18606 return; 18607 } 18608 event.preventDefault(); 18609 if (this.settings.loop) { 18610 minimum = this.coordinates(this.minimum()); 18611 maximum = this.coordinates(this.maximum() + 1) - minimum; 18612 stage.x = ((stage.x - minimum) % maximum + maximum) % maximum + minimum; 18613 } else { 18614 minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()); 18615 maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()); 18616 pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0; 18617 stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull); 18618 } 18619 this._drag.stage.current = stage; 18620 this.animate(stage.x); 18621 }; 18622 Owl.prototype.onDragEnd = function(event) { 18623 var delta = this.difference(this._drag.pointer, this.pointer(event)), stage = this._drag.stage.current, direction = delta.x > 0 ^ this.settings.rtl ? "left" : "right"; 18624 $(document2).off(".owl.core"); 18625 this.$element.removeClass(this.options.grabClass); 18626 if (delta.x !== 0 && this.is("dragging") || !this.is("valid")) { 18627 this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); 18628 this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction)); 18629 this.invalidate("position"); 18630 this.update(); 18631 this._drag.direction = direction; 18632 if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) { 18633 this._drag.target.one("click.owl.core", function() { 18634 return false; 18635 }); 18636 } 18637 } 18638 if (!this.is("dragging")) { 18639 return; 18640 } 18641 this.leave("dragging"); 18642 this.trigger("dragged"); 18643 }; 18644 Owl.prototype.closest = function(coordinate, direction) { 18645 var position = -1, pull = 30, width = this.width(), coordinates = this.coordinates(); 18646 if (!this.settings.freeDrag) { 18647 $.each(coordinates, $.proxy(function(index, value) { 18648 if (direction === "left" && coordinate > value - pull && coordinate < value + pull) { 18649 position = index; 18650 } else if (direction === "right" && coordinate > value - width - pull && coordinate < value - width + pull) { 18651 position = index + 1; 18652 } else if (this.op(coordinate, "<", value) && this.op(coordinate, ">", coordinates[index + 1] !== undefined2 ? coordinates[index + 1] : value - width)) { 18653 position = direction === "left" ? index + 1 : index; 18654 } 18655 return position === -1; 18656 }, this)); 18657 } 18658 if (!this.settings.loop) { 18659 if (this.op(coordinate, ">", coordinates[this.minimum()])) { 18660 position = coordinate = this.minimum(); 18661 } else if (this.op(coordinate, "<", coordinates[this.maximum()])) { 18662 position = coordinate = this.maximum(); 18663 } 18664 } 18665 return position; 18666 }; 18667 Owl.prototype.animate = function(coordinate) { 18668 var animate = this.speed() > 0; 18669 this.is("animating") && this.onTransitionEnd(); 18670 if (animate) { 18671 this.enter("animating"); 18672 this.trigger("translate"); 18673 } 18674 if ($.support.transform3d && $.support.transition) { 18675 this.$stage.css({ 18676 transform: "translate3d(" + coordinate + "px,0px,0px)", 18677 transition: this.speed() / 1000 + "s" + (this.settings.slideTransition ? " " + this.settings.slideTransition : "") 18678 }); 18679 } else if (animate) { 18680 this.$stage.animate({ 18681 left: coordinate + "px" 18682 }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this)); 18683 } else { 18684 this.$stage.css({ 18685 left: coordinate + "px" 18686 }); 18687 } 18688 }; 18689 Owl.prototype.is = function(state) { 18690 return this._states.current[state] && this._states.current[state] > 0; 18691 }; 18692 Owl.prototype.current = function(position) { 18693 if (position === undefined2) { 18694 return this._current; 18695 } 18696 if (this._items.length === 0) { 18697 return undefined2; 18698 } 18699 position = this.normalize(position); 18700 if (this._current !== position) { 18701 var event = this.trigger("change", { property: { name: "position", value: position } }); 18702 if (event.data !== undefined2) { 18703 position = this.normalize(event.data); 18704 } 18705 this._current = position; 18706 this.invalidate("position"); 18707 this.trigger("changed", { property: { name: "position", value: this._current } }); 18708 } 18709 return this._current; 18710 }; 18711 Owl.prototype.invalidate = function(part) { 18712 if ($.type(part) === "string") { 18713 this._invalidated[part] = true; 18714 this.is("valid") && this.leave("valid"); 18715 } 18716 return $.map(this._invalidated, function(v2, i) { 18717 return i; 18718 }); 18719 }; 18720 Owl.prototype.reset = function(position) { 18721 position = this.normalize(position); 18722 if (position === undefined2) { 18723 return; 18724 } 18725 this._speed = 0; 18726 this._current = position; 18727 this.suppress(["translate", "translated"]); 18728 this.animate(this.coordinates(position)); 18729 this.release(["translate", "translated"]); 18730 }; 18731 Owl.prototype.normalize = function(position, relative) { 18732 var n2 = this._items.length, m2 = relative ? 0 : this._clones.length; 18733 if (!this.isNumeric(position) || n2 < 1) { 18734 position = undefined2; 18735 } else if (position < 0 || position >= n2 + m2) { 18736 position = ((position - m2 / 2) % n2 + n2) % n2 + m2 / 2; 18737 } 18738 return position; 18739 }; 18740 Owl.prototype.relative = function(position) { 18741 position -= this._clones.length / 2; 18742 return this.normalize(position, true); 18743 }; 18744 Owl.prototype.maximum = function(relative) { 18745 var settings = this.settings, maximum = this._coordinates.length, iterator, reciprocalItemsWidth, elementWidth; 18746 if (settings.loop) { 18747 maximum = this._clones.length / 2 + this._items.length - 1; 18748 } else if (settings.autoWidth || settings.merge) { 18749 iterator = this._items.length; 18750 if (iterator) { 18751 reciprocalItemsWidth = this._items[--iterator].width(); 18752 elementWidth = this.$element.width(); 18753 while (iterator--) { 18754 reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin; 18755 if (reciprocalItemsWidth > elementWidth) { 18756 break; 18757 } 18758 } 18759 } 18760 maximum = iterator + 1; 18761 } else if (settings.center) { 18762 maximum = this._items.length - 1; 18763 } else { 18764 maximum = this._items.length - settings.items; 18765 } 18766 if (relative) { 18767 maximum -= this._clones.length / 2; 18768 } 18769 return Math.max(maximum, 0); 18770 }; 18771 Owl.prototype.minimum = function(relative) { 18772 return relative ? 0 : this._clones.length / 2; 18773 }; 18774 Owl.prototype.items = function(position) { 18775 if (position === undefined2) { 18776 return this._items.slice(); 18777 } 18778 position = this.normalize(position, true); 18779 return this._items[position]; 18780 }; 18781 Owl.prototype.mergers = function(position) { 18782 if (position === undefined2) { 18783 return this._mergers.slice(); 18784 } 18785 position = this.normalize(position, true); 18786 return this._mergers[position]; 18787 }; 18788 Owl.prototype.clones = function(position) { 18789 var odd = this._clones.length / 2, even = odd + this._items.length, map = function(index) { 18790 return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2; 18791 }; 18792 if (position === undefined2) { 18793 return $.map(this._clones, function(v2, i) { 18794 return map(i); 18795 }); 18796 } 18797 return $.map(this._clones, function(v2, i) { 18798 return v2 === position ? map(i) : null; 18799 }); 18800 }; 18801 Owl.prototype.speed = function(speed) { 18802 if (speed !== undefined2) { 18803 this._speed = speed; 18804 } 18805 return this._speed; 18806 }; 18807 Owl.prototype.coordinates = function(position) { 18808 var multiplier = 1, newPosition = position - 1, coordinate; 18809 if (position === undefined2) { 18810 return $.map(this._coordinates, $.proxy(function(coordinate2, index) { 18811 return this.coordinates(index); 18812 }, this)); 18813 } 18814 if (this.settings.center) { 18815 if (this.settings.rtl) { 18816 multiplier = -1; 18817 newPosition = position + 1; 18818 } 18819 coordinate = this._coordinates[position]; 18820 coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier; 18821 } else { 18822 coordinate = this._coordinates[newPosition] || 0; 18823 } 18824 coordinate = Math.ceil(coordinate); 18825 return coordinate; 18826 }; 18827 Owl.prototype.duration = function(from, to, factor) { 18828 if (factor === 0) { 18829 return 0; 18830 } 18831 return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs(factor || this.settings.smartSpeed); 18832 }; 18833 Owl.prototype.to = function(position, speed) { 18834 var current = this.current(), revert = null, distance = position - this.relative(current), direction = (distance > 0) - (distance < 0), items = this._items.length, minimum = this.minimum(), maximum = this.maximum(); 18835 if (this.settings.loop) { 18836 if (!this.settings.rewind && Math.abs(distance) > items / 2) { 18837 distance += direction * -1 * items; 18838 } 18839 position = current + distance; 18840 revert = ((position - minimum) % items + items) % items + minimum; 18841 if (revert !== position && revert - distance <= maximum && revert - distance > 0) { 18842 current = revert - distance; 18843 position = revert; 18844 this.reset(current); 18845 } 18846 } else if (this.settings.rewind) { 18847 maximum += 1; 18848 position = (position % maximum + maximum) % maximum; 18849 } else { 18850 position = Math.max(minimum, Math.min(maximum, position)); 18851 } 18852 this.speed(this.duration(current, position, speed)); 18853 this.current(position); 18854 if (this.isVisible()) { 18855 this.update(); 18856 } 18857 }; 18858 Owl.prototype.next = function(speed) { 18859 speed = speed || false; 18860 this.to(this.relative(this.current()) + 1, speed); 18861 }; 18862 Owl.prototype.prev = function(speed) { 18863 speed = speed || false; 18864 this.to(this.relative(this.current()) - 1, speed); 18865 }; 18866 Owl.prototype.onTransitionEnd = function(event) { 18867 if (event !== undefined2) { 18868 event.stopPropagation(); 18869 if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) { 18870 return false; 18871 } 18872 } 18873 this.leave("animating"); 18874 this.trigger("translated"); 18875 }; 18876 Owl.prototype.viewport = function() { 18877 var width; 18878 if (this.options.responsiveBaseElement !== window2) { 18879 width = $(this.options.responsiveBaseElement).width(); 18880 } else if (window2.innerWidth) { 18881 width = window2.innerWidth; 18882 } else if (document2.documentElement && document2.documentElement.clientWidth) { 18883 width = document2.documentElement.clientWidth; 18884 } else { 18885 console.warn("Can not detect viewport width."); 18886 } 18887 return width; 18888 }; 18889 Owl.prototype.replace = function(content) { 18890 this.$stage.empty(); 18891 this._items = []; 18892 if (content) { 18893 content = content instanceof jQuery ? content : $(content); 18894 } 18895 if (this.settings.nestedItemSelector) { 18896 content = content.find("." + this.settings.nestedItemSelector); 18897 } 18898 content.filter(function() { 18899 return this.nodeType === 1; 18900 }).each($.proxy(function(index, item) { 18901 item = this.prepare(item); 18902 this.$stage.append(item); 18903 this._items.push(item); 18904 this._mergers.push(item.find("[data-merge]").addBack("[data-merge]").attr("data-merge") * 1 || 1); 18905 }, this)); 18906 this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0); 18907 this.invalidate("items"); 18908 }; 18909 Owl.prototype.add = function(content, position) { 18910 var current = this.relative(this._current); 18911 position = position === undefined2 ? this._items.length : this.normalize(position, true); 18912 content = content instanceof jQuery ? content : $(content); 18913 this.trigger("add", { content, position }); 18914 content = this.prepare(content); 18915 if (this._items.length === 0 || position === this._items.length) { 18916 this._items.length === 0 && this.$stage.append(content); 18917 this._items.length !== 0 && this._items[position - 1].after(content); 18918 this._items.push(content); 18919 this._mergers.push(content.find("[data-merge]").addBack("[data-merge]").attr("data-merge") * 1 || 1); 18920 } else { 18921 this._items[position].before(content); 18922 this._items.splice(position, 0, content); 18923 this._mergers.splice(position, 0, content.find("[data-merge]").addBack("[data-merge]").attr("data-merge") * 1 || 1); 18924 } 18925 this._items[current] && this.reset(this._items[current].index()); 18926 this.invalidate("items"); 18927 this.trigger("added", { content, position }); 18928 }; 18929 Owl.prototype.remove = function(position) { 18930 position = this.normalize(position, true); 18931 if (position === undefined2) { 18932 return; 18933 } 18934 this.trigger("remove", { content: this._items[position], position }); 18935 this._items[position].remove(); 18936 this._items.splice(position, 1); 18937 this._mergers.splice(position, 1); 18938 this.invalidate("items"); 18939 this.trigger("removed", { content: null, position }); 18940 }; 18941 Owl.prototype.preloadAutoWidthImages = function(images) { 18942 images.each($.proxy(function(i, element) { 18943 this.enter("pre-loading"); 18944 element = $(element); 18945 $(new Image).one("load", $.proxy(function(e) { 18946 element.attr("src", e.target.src); 18947 element.css("opacity", 1); 18948 this.leave("pre-loading"); 18949 !this.is("pre-loading") && !this.is("initializing") && this.refresh(); 18950 }, this)).attr("src", element.attr("src") || element.attr("data-src") || element.attr("data-src-retina")); 18951 }, this)); 18952 }; 18953 Owl.prototype.destroy = function() { 18954 this.$element.off(".owl.core"); 18955 this.$stage.off(".owl.core"); 18956 $(document2).off(".owl.core"); 18957 if (this.settings.responsive !== false) { 18958 window2.clearTimeout(this.resizeTimer); 18959 this.off(window2, "resize", this._handlers.onThrottledResize); 18960 } 18961 for (var i in this._plugins) { 18962 this._plugins[i].destroy(); 18963 } 18964 this.$stage.children(".cloned").remove(); 18965 this.$stage.unwrap(); 18966 this.$stage.children().contents().unwrap(); 18967 this.$stage.children().unwrap(); 18968 this.$stage.remove(); 18969 this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class", this.$element.attr("class").replace(new RegExp(this.options.responsiveClass + "-\\S+\\s", "g"), "")).removeData("owl.carousel"); 18970 }; 18971 Owl.prototype.op = function(a, o2, b2) { 18972 var rtl = this.settings.rtl; 18973 switch (o2) { 18974 case "<": 18975 return rtl ? a > b2 : a < b2; 18976 case ">": 18977 return rtl ? a < b2 : a > b2; 18978 case ">=": 18979 return rtl ? a <= b2 : a >= b2; 18980 case "<=": 18981 return rtl ? a >= b2 : a <= b2; 18982 default: 18983 break; 18984 } 18985 }; 18986 Owl.prototype.on = function(element, event, listener, capture) { 18987 if (element.addEventListener) { 18988 element.addEventListener(event, listener, capture); 18989 } else if (element.attachEvent) { 18990 element.attachEvent("on" + event, listener); 18991 } 18992 }; 18993 Owl.prototype.off = function(element, event, listener, capture) { 18994 if (element.removeEventListener) { 18995 element.removeEventListener(event, listener, capture); 18996 } else if (element.detachEvent) { 18997 element.detachEvent("on" + event, listener); 18998 } 18999 }; 19000 Owl.prototype.trigger = function(name, data, namespace, state, enter) { 19001 var status = { 19002 item: { count: this._items.length, index: this.current() } 19003 }, handler = $.camelCase($.grep(["on", name, namespace], function(v2) { 19004 return v2; 19005 }).join("-").toLowerCase()), event = $.Event([name, "owl", namespace || "carousel"].join(".").toLowerCase(), $.extend({ relatedTarget: this }, status, data)); 19006 if (!this._supress[name]) { 19007 $.each(this._plugins, function(name2, plugin) { 19008 if (plugin.onTrigger) { 19009 plugin.onTrigger(event); 19010 } 19011 }); 19012 this.register({ type: Owl.Type.Event, name }); 19013 this.$element.trigger(event); 19014 if (this.settings && typeof this.settings[handler] === "function") { 19015 this.settings[handler].call(this, event); 19016 } 19017 } 19018 return event; 19019 }; 19020 Owl.prototype.enter = function(name) { 19021 $.each([name].concat(this._states.tags[name] || []), $.proxy(function(i, name2) { 19022 if (this._states.current[name2] === undefined2) { 19023 this._states.current[name2] = 0; 19024 } 19025 this._states.current[name2]++; 19026 }, this)); 19027 }; 19028 Owl.prototype.leave = function(name) { 19029 $.each([name].concat(this._states.tags[name] || []), $.proxy(function(i, name2) { 19030 this._states.current[name2]--; 19031 }, this)); 19032 }; 19033 Owl.prototype.register = function(object) { 19034 if (object.type === Owl.Type.Event) { 19035 if (!$.event.special[object.name]) { 19036 $.event.special[object.name] = {}; 19037 } 19038 if (!$.event.special[object.name].owl) { 19039 var _default = $.event.special[object.name]._default; 19040 $.event.special[object.name]._default = function(e) { 19041 if (_default && _default.apply && (!e.namespace || e.namespace.indexOf("owl") === -1)) { 19042 return _default.apply(this, arguments); 19043 } 19044 return e.namespace && e.namespace.indexOf("owl") > -1; 19045 }; 19046 $.event.special[object.name].owl = true; 19047 } 19048 } else if (object.type === Owl.Type.State) { 19049 if (!this._states.tags[object.name]) { 19050 this._states.tags[object.name] = object.tags; 19051 } else { 19052 this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags); 19053 } 19054 this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) { 19055 return $.inArray(tag, this._states.tags[object.name]) === i; 19056 }, this)); 19057 } 19058 }; 19059 Owl.prototype.suppress = function(events) { 19060 $.each(events, $.proxy(function(index, event) { 19061 this._supress[event] = true; 19062 }, this)); 19063 }; 19064 Owl.prototype.release = function(events) { 19065 $.each(events, $.proxy(function(index, event) { 19066 delete this._supress[event]; 19067 }, this)); 19068 }; 19069 Owl.prototype.pointer = function(event) { 19070 var result = { x: null, y: null }; 19071 event = event.originalEvent || event || window2.event; 19072 event = event.touches && event.touches.length ? event.touches[0] : event.changedTouches && event.changedTouches.length ? event.changedTouches[0] : event; 19073 if (event.pageX) { 19074 result.x = event.pageX; 19075 result.y = event.pageY; 19076 } else { 19077 result.x = event.clientX; 19078 result.y = event.clientY; 19079 } 19080 return result; 19081 }; 19082 Owl.prototype.isNumeric = function(number) { 19083 return !isNaN(parseFloat(number)); 19084 }; 19085 Owl.prototype.difference = function(first, second) { 19086 return { 19087 x: first.x - second.x, 19088 y: first.y - second.y 19089 }; 19090 }; 19091 $.fn.owlCarousel = function(option) { 19092 var args = Array.prototype.slice.call(arguments, 1); 19093 return this.each(function() { 19094 var $this = $(this), data = $this.data("owl.carousel"); 19095 if (!data) { 19096 data = new Owl(this, typeof option == "object" && option); 19097 $this.data("owl.carousel", data); 19098 $.each([ 19099 "next", 19100 "prev", 19101 "to", 19102 "destroy", 19103 "refresh", 19104 "replace", 19105 "add", 19106 "remove" 19107 ], function(i, event) { 19108 data.register({ type: Owl.Type.Event, name: event }); 19109 data.$element.on(event + ".owl.carousel.core", $.proxy(function(e) { 19110 if (e.namespace && e.relatedTarget !== this) { 19111 this.suppress([event]); 19112 data[event].apply(this, [].slice.call(arguments, 1)); 19113 this.release([event]); 19114 } 19115 }, data)); 19116 }); 19117 } 19118 if (typeof option == "string" && option.charAt(0) !== "_") { 19119 data[option].apply(data, args); 19120 } 19121 }); 19122 }; 19123 $.fn.owlCarousel.Constructor = Owl; 19124})(window.Zepto || window.jQuery, window, document); 19125(function($, window2, document2, undefined2) { 19126 var AutoRefresh = function(carousel) { 19127 this._core = carousel; 19128 this._interval = null; 19129 this._visible = null; 19130 this._handlers = { 19131 "initialized.owl.carousel": $.proxy(function(e) { 19132 if (e.namespace && this._core.settings.autoRefresh) { 19133 this.watch(); 19134 } 19135 }, this) 19136 }; 19137 this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options); 19138 this._core.$element.on(this._handlers); 19139 }; 19140 AutoRefresh.Defaults = { 19141 autoRefresh: true, 19142 autoRefreshInterval: 500 19143 }; 19144 AutoRefresh.prototype.watch = function() { 19145 if (this._interval) { 19146 return; 19147 } 19148 this._visible = this._core.isVisible(); 19149 this._interval = window2.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval); 19150 }; 19151 AutoRefresh.prototype.refresh = function() { 19152 if (this._core.isVisible() === this._visible) { 19153 return; 19154 } 19155 this._visible = !this._visible; 19156 this._core.$element.toggleClass("owl-hidden", !this._visible); 19157 this._visible && (this._core.invalidate("width") && this._core.refresh()); 19158 }; 19159 AutoRefresh.prototype.destroy = function() { 19160 var handler, property; 19161 window2.clearInterval(this._interval); 19162 for (handler in this._handlers) { 19163 this._core.$element.off(handler, this._handlers[handler]); 19164 } 19165 for (property in Object.getOwnPropertyNames(this)) { 19166 typeof this[property] != "function" && (this[property] = null); 19167 } 19168 }; 19169 $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh; 19170})(window.Zepto || window.jQuery, window, document); 19171(function($, window2, document2, undefined2) { 19172 var Lazy = function(carousel) { 19173 this._core = carousel; 19174 this._loaded = []; 19175 this._handlers = { 19176 "initialized.owl.carousel change.owl.carousel resized.owl.carousel": $.proxy(function(e) { 19177 if (!e.namespace) { 19178 return; 19179 } 19180 if (!this._core.settings || !this._core.settings.lazyLoad) { 19181 return; 19182 } 19183 if (e.property && e.property.name == "position" || e.type == "initialized") { 19184 var settings = this._core.settings, n2 = settings.center && Math.ceil(settings.items / 2) || settings.items, i = settings.center && n2 * -1 || 0, position = (e.property && e.property.value !== undefined2 ? e.property.value : this._core.current()) + i, clones = this._core.clones().length, load = $.proxy(function(i2, v2) { 19185 this.load(v2); 19186 }, this); 19187 if (settings.lazyLoadEager > 0) { 19188 n2 += settings.lazyLoadEager; 19189 if (settings.loop) { 19190 position -= settings.lazyLoadEager; 19191 n2++; 19192 } 19193 } 19194 while (i++ < n2) { 19195 this.load(clones / 2 + this._core.relative(position)); 19196 clones && $.each(this._core.clones(this._core.relative(position)), load); 19197 position++; 19198 } 19199 } 19200 }, this) 19201 }; 19202 this._core.options = $.extend({}, Lazy.Defaults, this._core.options); 19203 this._core.$element.on(this._handlers); 19204 }; 19205 Lazy.Defaults = { 19206 lazyLoad: false, 19207 lazyLoadEager: 0 19208 }; 19209 Lazy.prototype.load = function(position) { 19210 var $item = this._core.$stage.children().eq(position), $elements = $item && $item.find(".owl-lazy"); 19211 if (!$elements || $.inArray($item.get(0), this._loaded) > -1) { 19212 return; 19213 } 19214 $elements.each($.proxy(function(index, element) { 19215 var $element = $(element), image, url = window2.devicePixelRatio > 1 && $element.attr("data-src-retina") || $element.attr("data-src") || $element.attr("data-srcset"); 19216 this._core.trigger("load", { element: $element, url }, "lazy"); 19217 if ($element.is("img")) { 19218 $element.one("load.owl.lazy", $.proxy(function() { 19219 $element.css("opacity", 1); 19220 this._core.trigger("loaded", { element: $element, url }, "lazy"); 19221 }, this)).attr("src", url); 19222 } else if ($element.is("source")) { 19223 $element.one("load.owl.lazy", $.proxy(function() { 19224 this._core.trigger("loaded", { element: $element, url }, "lazy"); 19225 }, this)).attr("srcset", url); 19226 } else { 19227 image = new Image; 19228 image.onload = $.proxy(function() { 19229 $element.css({ 19230 "background-image": 'url("' + url + '")', 19231 opacity: "1" 19232 }); 19233 this._core.trigger("loaded", { element: $element, url }, "lazy"); 19234 }, this); 19235 image.src = url; 19236 } 19237 }, this)); 19238 this._loaded.push($item.get(0)); 19239 }; 19240 Lazy.prototype.destroy = function() { 19241 var handler, property; 19242 for (handler in this.handlers) { 19243 this._core.$element.off(handler, this.handlers[handler]); 19244 } 19245 for (property in Object.getOwnPropertyNames(this)) { 19246 typeof this[property] != "function" && (this[property] = null); 19247 } 19248 }; 19249 $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy; 19250})(window.Zepto || window.jQuery, window, document); 19251(function($, window2, document2, undefined2) { 19252 var AutoHeight = function(carousel) { 19253 this._core = carousel; 19254 this._previousHeight = null; 19255 this._handlers = { 19256 "initialized.owl.carousel refreshed.owl.carousel": $.proxy(function(e) { 19257 if (e.namespace && this._core.settings.autoHeight) { 19258 this.update(); 19259 } 19260 }, this), 19261 "changed.owl.carousel": $.proxy(function(e) { 19262 if (e.namespace && this._core.settings.autoHeight && e.property.name === "position") { 19263 this.update(); 19264 } 19265 }, this), 19266 "loaded.owl.lazy": $.proxy(function(e) { 19267 if (e.namespace && this._core.settings.autoHeight && e.element.closest("." + this._core.settings.itemClass).index() === this._core.current()) { 19268 this.update(); 19269 } 19270 }, this) 19271 }; 19272 this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); 19273 this._core.$element.on(this._handlers); 19274 this._intervalId = null; 19275 var refThis = this; 19276 $(window2).on("load", function() { 19277 if (refThis._core.settings.autoHeight) { 19278 refThis.update(); 19279 } 19280 }); 19281 $(window2).resize(function() { 19282 if (refThis._core.settings.autoHeight) { 19283 if (refThis._intervalId != null) { 19284 clearTimeout(refThis._intervalId); 19285 } 19286 refThis._intervalId = setTimeout(function() { 19287 refThis.update(); 19288 }, 250); 19289 } 19290 }); 19291 }; 19292 AutoHeight.Defaults = { 19293 autoHeight: false, 19294 autoHeightClass: "owl-height" 19295 }; 19296 AutoHeight.prototype.update = function() { 19297 var start3 = this._core._current, end2 = start3 + this._core.settings.items, lazyLoadEnabled = this._core.settings.lazyLoad, visible = this._core.$stage.children().toArray().slice(start3, end2), heights = [], maxheight = 0; 19298 $.each(visible, function(index, item) { 19299 heights.push($(item).height()); 19300 }); 19301 maxheight = Math.max.apply(null, heights); 19302 if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) { 19303 maxheight = this._previousHeight; 19304 } 19305 this._previousHeight = maxheight; 19306 this._core.$stage.parent().height(maxheight).addClass(this._core.settings.autoHeightClass); 19307 }; 19308 AutoHeight.prototype.destroy = function() { 19309 var handler, property; 19310 for (handler in this._handlers) { 19311 this._core.$element.off(handler, this._handlers[handler]); 19312 } 19313 for (property in Object.getOwnPropertyNames(this)) { 19314 typeof this[property] !== "function" && (this[property] = null); 19315 } 19316 }; 19317 $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight; 19318})(window.Zepto || window.jQuery, window, document); 19319(function($, window2, document2, undefined2) { 19320 var Video = function(carousel) { 19321 this._core = carousel; 19322 this._videos = {}; 19323 this._playing = null; 19324 this._handlers = { 19325 "initialized.owl.carousel": $.proxy(function(e) { 19326 if (e.namespace) { 19327 this._core.register({ type: "state", name: "playing", tags: ["interacting"] }); 19328 } 19329 }, this), 19330 "resize.owl.carousel": $.proxy(function(e) { 19331 if (e.namespace && this._core.settings.video && this.isInFullScreen()) { 19332 e.preventDefault(); 19333 } 19334 }, this), 19335 "refreshed.owl.carousel": $.proxy(function(e) { 19336 if (e.namespace && this._core.is("resizing")) { 19337 this._core.$stage.find(".cloned .owl-video-frame").remove(); 19338 } 19339 }, this), 19340 "changed.owl.carousel": $.proxy(function(e) { 19341 if (e.namespace && e.property.name === "position" && this._playing) { 19342 this.stop(); 19343 } 19344 }, this), 19345 "prepared.owl.carousel": $.proxy(function(e) { 19346 if (!e.namespace) { 19347 return; 19348 } 19349 var $element = $(e.content).find(".owl-video"); 19350 if ($element.length) { 19351 $element.css("display", "none"); 19352 this.fetch($element, $(e.content)); 19353 } 19354 }, this) 19355 }; 19356 this._core.options = $.extend({}, Video.Defaults, this._core.options); 19357 this._core.$element.on(this._handlers); 19358 this._core.$element.on("click.owl.video", ".owl-video-play-icon", $.proxy(function(e) { 19359 this.play(e); 19360 }, this)); 19361 }; 19362 Video.Defaults = { 19363 video: false, 19364 videoHeight: false, 19365 videoWidth: false 19366 }; 19367 Video.prototype.fetch = function(target, item) { 19368 var type = function() { 19369 if (target.attr("data-vimeo-id")) { 19370 return "vimeo"; 19371 } else if (target.attr("data-vzaar-id")) { 19372 return "vzaar"; 19373 } else { 19374 return "youtube"; 19375 } 19376 }(), id = target.attr("data-vimeo-id") || target.attr("data-youtube-id") || target.attr("data-vzaar-id"), width = target.attr("data-width") || this._core.settings.videoWidth, height = target.attr("data-height") || this._core.settings.videoHeight, url = target.attr("href"); 19377 if (url) { 19378 id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); 19379 if (id[3].indexOf("youtu") > -1) { 19380 type = "youtube"; 19381 } else if (id[3].indexOf("vimeo") > -1) { 19382 type = "vimeo"; 19383 } else if (id[3].indexOf("vzaar") > -1) { 19384 type = "vzaar"; 19385 } else { 19386 throw new Error("Video URL not supported."); 19387 } 19388 id = id[6]; 19389 } else { 19390 throw new Error("Missing video URL."); 19391 } 19392 this._videos[url] = { 19393 type, 19394 id, 19395 width, 19396 height 19397 }; 19398 item.attr("data-video", url); 19399 this.thumbnail(target, this._videos[url]); 19400 }; 19401 Video.prototype.thumbnail = function(target, video) { 19402 var tnLink, icon, path, dimensions = video.width && video.height ? "width:" + video.width + "px;height:" + video.height + "px;" : "", customTn = target.find("img"), srcType = "src", lazyClass = "", settings = this._core.settings, create = function(path2) { 19403 icon = '<div class="owl-video-play-icon"></div>'; 19404 if (settings.lazyLoad) { 19405 tnLink = $("<div/>", { 19406 class: "owl-video-tn " + lazyClass, 19407 srcType: path2 19408 }); 19409 } else { 19410 tnLink = $("<div/>", { 19411 class: "owl-video-tn", 19412 style: "opacity:1;background-image:url(" + path2 + ")" 19413 }); 19414 } 19415 target.after(tnLink); 19416 target.after(icon); 19417 }; 19418 target.wrap($("<div/>", { 19419 class: "owl-video-wrapper", 19420 style: dimensions 19421 })); 19422 if (this._core.settings.lazyLoad) { 19423 srcType = "data-src"; 19424 lazyClass = "owl-lazy"; 19425 } 19426 if (customTn.length) { 19427 create(customTn.attr(srcType)); 19428 customTn.remove(); 19429 return false; 19430 } 19431 if (video.type === "youtube") { 19432 path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; 19433 create(path); 19434 } else if (video.type === "vimeo") { 19435 $.ajax({ 19436 type: "GET", 19437 url: "//vimeo.com/api/v2/video/" + video.id + ".json", 19438 jsonp: "callback", 19439 dataType: "jsonp", 19440 success: function(data) { 19441 path = data[0].thumbnail_large; 19442 create(path); 19443 } 19444 }); 19445 } else if (video.type === "vzaar") { 19446 $.ajax({ 19447 type: "GET", 19448 url: "//vzaar.com/api/videos/" + video.id + ".json", 19449 jsonp: "callback", 19450 dataType: "jsonp", 19451 success: function(data) { 19452 path = data.framegrab_url; 19453 create(path); 19454 } 19455 }); 19456 } 19457 }; 19458 Video.prototype.stop = function() { 19459 this._core.trigger("stop", null, "video"); 19460 this._playing.find(".owl-video-frame").remove(); 19461 this._playing.removeClass("owl-video-playing"); 19462 this._playing = null; 19463 this._core.leave("playing"); 19464 this._core.trigger("stopped", null, "video"); 19465 }; 19466 Video.prototype.play = function(event) { 19467 var target = $(event.target), item = target.closest("." + this._core.settings.itemClass), video = this._videos[item.attr("data-video")], width = video.width || "100%", height = video.height || this._core.$stage.height(), html, iframe; 19468 if (this._playing) { 19469 return; 19470 } 19471 this._core.enter("playing"); 19472 this._core.trigger("play", null, "video"); 19473 item = this._core.items(this._core.relative(item.index())); 19474 this._core.reset(item.index()); 19475 html = $('<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>'); 19476 html.attr("height", height); 19477 html.attr("width", width); 19478 if (video.type === "youtube") { 19479 html.attr("src", "//www.youtube.com/embed/" + video.id + "?autoplay=1&rel=0&v=" + video.id); 19480 } else if (video.type === "vimeo") { 19481 html.attr("src", "//player.vimeo.com/video/" + video.id + "?autoplay=1"); 19482 } else if (video.type === "vzaar") { 19483 html.attr("src", "//view.vzaar.com/" + video.id + "/player?autoplay=true"); 19484 } 19485 iframe = $(html).wrap('<div class="owl-video-frame" />').insertAfter(item.find(".owl-video")); 19486 this._playing = item.addClass("owl-video-playing"); 19487 }; 19488 Video.prototype.isInFullScreen = function() { 19489 var element = document2.fullscreenElement || document2.mozFullScreenElement || document2.webkitFullscreenElement; 19490 return element && $(element).parent().hasClass("owl-video-frame"); 19491 }; 19492 Video.prototype.destroy = function() { 19493 var handler, property; 19494 this._core.$element.off("click.owl.video"); 19495 for (handler in this._handlers) { 19496 this._core.$element.off(handler, this._handlers[handler]); 19497 } 19498 for (property in Object.getOwnPropertyNames(this)) { 19499 typeof this[property] != "function" && (this[property] = null); 19500 } 19501 }; 19502 $.fn.owlCarousel.Constructor.Plugins.Video = Video; 19503})(window.Zepto || window.jQuery, window, document); 19504(function($, window2, document2, undefined2) { 19505 var Animate = function(scope) { 19506 this.core = scope; 19507 this.core.options = $.extend({}, Animate.Defaults, this.core.options); 19508 this.swapping = true; 19509 this.previous = undefined2; 19510 this.next = undefined2; 19511 this.handlers = { 19512 "change.owl.carousel": $.proxy(function(e) { 19513 if (e.namespace && e.property.name == "position") { 19514 this.previous = this.core.current(); 19515 this.next = e.property.value; 19516 } 19517 }, this), 19518 "drag.owl.carousel dragged.owl.carousel translated.owl.carousel": $.proxy(function(e) { 19519 if (e.namespace) { 19520 this.swapping = e.type == "translated"; 19521 } 19522 }, this), 19523 "translate.owl.carousel": $.proxy(function(e) { 19524 if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) { 19525 this.swap(); 19526 } 19527 }, this) 19528 }; 19529 this.core.$element.on(this.handlers); 19530 }; 19531 Animate.Defaults = { 19532 animateOut: false, 19533 animateIn: false 19534 }; 19535 Animate.prototype.swap = function() { 19536 if (this.core.settings.items !== 1) { 19537 return; 19538 } 19539 if (!$.support.animation || !$.support.transition) { 19540 return; 19541 } 19542 this.core.speed(0); 19543 var left2, clear = $.proxy(this.clear, this), previous = this.core.$stage.children().eq(this.previous), next = this.core.$stage.children().eq(this.next), incoming = this.core.settings.animateIn, outgoing = this.core.settings.animateOut; 19544 if (this.core.current() === this.previous) { 19545 return; 19546 } 19547 if (outgoing) { 19548 left2 = this.core.coordinates(this.previous) - this.core.coordinates(this.next); 19549 previous.one($.support.animation.end, clear).css({ left: left2 + "px" }).addClass("animated owl-animated-out").addClass(outgoing); 19550 } 19551 if (incoming) { 19552 next.one($.support.animation.end, clear).addClass("animated owl-animated-in").addClass(incoming); 19553 } 19554 }; 19555 Animate.prototype.clear = function(e) { 19556 $(e.target).css({ left: "" }).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut); 19557 this.core.onTransitionEnd(); 19558 }; 19559 Animate.prototype.destroy = function() { 19560 var handler, property; 19561 for (handler in this.handlers) { 19562 this.core.$element.off(handler, this.handlers[handler]); 19563 } 19564 for (property in Object.getOwnPropertyNames(this)) { 19565 typeof this[property] != "function" && (this[property] = null); 19566 } 19567 }; 19568 $.fn.owlCarousel.Constructor.Plugins.Animate = Animate; 19569})(window.Zepto || window.jQuery, window, document); 19570(function($, window2, document2, undefined2) { 19571 var Autoplay = function(carousel) { 19572 this._core = carousel; 19573 this._call = null; 19574 this._time = 0; 19575 this._timeout = 0; 19576 this._paused = true; 19577 this._handlers = { 19578 "changed.owl.carousel": $.proxy(function(e) { 19579 if (e.namespace && e.property.name === "settings") { 19580 if (this._core.settings.autoplay) { 19581 this.play(); 19582 } else { 19583 this.stop(); 19584 } 19585 } else if (e.namespace && e.property.name === "position" && this._paused) { 19586 this._time = 0; 19587 } 19588 }, this), 19589 "initialized.owl.carousel": $.proxy(function(e) { 19590 if (e.namespace && this._core.settings.autoplay) { 19591 this.play(); 19592 } 19593 }, this), 19594 "play.owl.autoplay": $.proxy(function(e, t, s2) { 19595 if (e.namespace) { 19596 this.play(t, s2); 19597 } 19598 }, this), 19599 "stop.owl.autoplay": $.proxy(function(e) { 19600 if (e.namespace) { 19601 this.stop(); 19602 } 19603 }, this), 19604 "mouseover.owl.autoplay": $.proxy(function() { 19605 if (this._core.settings.autoplayHoverPause && this._core.is("rotating")) { 19606 this.pause(); 19607 } 19608 }, this), 19609 "mouseleave.owl.autoplay": $.proxy(function() { 19610 if (this._core.settings.autoplayHoverPause && this._core.is("rotating")) { 19611 this.play(); 19612 } 19613 }, this), 19614 "touchstart.owl.core": $.proxy(function() { 19615 if (this._core.settings.autoplayHoverPause && this._core.is("rotating")) { 19616 this.pause(); 19617 } 19618 }, this), 19619 "touchend.owl.core": $.proxy(function() { 19620 if (this._core.settings.autoplayHoverPause) { 19621 this.play(); 19622 } 19623 }, this) 19624 }; 19625 this._core.$element.on(this._handlers); 19626 this._core.options = $.extend({}, Autoplay.Defaults, this._core.options); 19627 }; 19628 Autoplay.Defaults = { 19629 autoplay: false, 19630 autoplayTimeout: 5000, 19631 autoplayHoverPause: false, 19632 autoplaySpeed: false 19633 }; 19634 Autoplay.prototype._next = function(speed) { 19635 this._call = window2.setTimeout($.proxy(this._next, this, speed), this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()); 19636 if (this._core.is("interacting") || document2.hidden) { 19637 return; 19638 } 19639 this._core.next(speed || this._core.settings.autoplaySpeed); 19640 }; 19641 Autoplay.prototype.read = function() { 19642 return new Date().getTime() - this._time; 19643 }; 19644 Autoplay.prototype.play = function(timeout, speed) { 19645 var elapsed; 19646 if (!this._core.is("rotating")) { 19647 this._core.enter("rotating"); 19648 } 19649 timeout = timeout || this._core.settings.autoplayTimeout; 19650 elapsed = Math.min(this._time % (this._timeout || timeout), timeout); 19651 if (this._paused) { 19652 this._time = this.read(); 19653 this._paused = false; 19654 } else { 19655 window2.clearTimeout(this._call); 19656 } 19657 this._time += this.read() % timeout - elapsed; 19658 this._timeout = timeout; 19659 this._call = window2.setTimeout($.proxy(this._next, this, speed), timeout - elapsed); 19660 }; 19661 Autoplay.prototype.stop = function() { 19662 if (this._core.is("rotating")) { 19663 this._time = 0; 19664 this._paused = true; 19665 window2.clearTimeout(this._call); 19666 this._core.leave("rotating"); 19667 } 19668 }; 19669 Autoplay.prototype.pause = function() { 19670 if (this._core.is("rotating") && !this._paused) { 19671 this._time = this.read(); 19672 this._paused = true; 19673 window2.clearTimeout(this._call); 19674 } 19675 }; 19676 Autoplay.prototype.destroy = function() { 19677 var handler, property; 19678 this.stop(); 19679 for (handler in this._handlers) { 19680 this._core.$element.off(handler, this._handlers[handler]); 19681 } 19682 for (property in Object.getOwnPropertyNames(this)) { 19683 typeof this[property] != "function" && (this[property] = null); 19684 } 19685 }; 19686 $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay; 19687})(window.Zepto || window.jQuery, window, document); 19688(function($, window2, document2, undefined2) { 19689 var Navigation = function(carousel) { 19690 this._core = carousel; 19691 this._initialized = false; 19692 this._pages = []; 19693 this._controls = {}; 19694 this._templates = []; 19695 this.$element = this._core.$element; 19696 this._overrides = { 19697 next: this._core.next, 19698 prev: this._core.prev, 19699 to: this._core.to 19700 }; 19701 this._handlers = { 19702 "prepared.owl.carousel": $.proxy(function(e) { 19703 if (e.namespace && this._core.settings.dotsData) { 19704 this._templates.push('<div class="' + this._core.settings.dotClass + '">' + $(e.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot") + "</div>"); 19705 } 19706 }, this), 19707 "added.owl.carousel": $.proxy(function(e) { 19708 if (e.namespace && this._core.settings.dotsData) { 19709 this._templates.splice(e.position, 0, this._templates.pop()); 19710 } 19711 }, this), 19712 "remove.owl.carousel": $.proxy(function(e) { 19713 if (e.namespace && this._core.settings.dotsData) { 19714 this._templates.splice(e.position, 1); 19715 } 19716 }, this), 19717 "changed.owl.carousel": $.proxy(function(e) { 19718 if (e.namespace && e.property.name == "position") { 19719 this.draw(); 19720 } 19721 }, this), 19722 "initialized.owl.carousel": $.proxy(function(e) { 19723 if (e.namespace && !this._initialized) { 19724 this._core.trigger("initialize", null, "navigation"); 19725 this.initialize(); 19726 this.update(); 19727 this.draw(); 19728 this._initialized = true; 19729 this._core.trigger("initialized", null, "navigation"); 19730 } 19731 }, this), 19732 "refreshed.owl.carousel": $.proxy(function(e) { 19733 if (e.namespace && this._initialized) { 19734 this._core.trigger("refresh", null, "navigation"); 19735 this.update(); 19736 this.draw(); 19737 this._core.trigger("refreshed", null, "navigation"); 19738 } 19739 }, this) 19740 }; 19741 this._core.options = $.extend({}, Navigation.Defaults, this._core.options); 19742 this.$element.on(this._handlers); 19743 }; 19744 Navigation.Defaults = { 19745 nav: false, 19746 navText: [ 19747 '<span aria-label="' + "Previous" + '">‹</span>', 19748 '<span aria-label="' + "Next" + '">›</span>' 19749 ], 19750 navSpeed: false, 19751 navElement: 'button type="button" role="presentation"', 19752 navContainer: false, 19753 navContainerClass: "owl-nav", 19754 navClass: [ 19755 "owl-prev", 19756 "owl-next" 19757 ], 19758 slideBy: 1, 19759 dotClass: "owl-dot", 19760 dotsClass: "owl-dots", 19761 dots: true, 19762 dotsEach: false, 19763 dotsData: false, 19764 dotsSpeed: false, 19765 dotsContainer: false 19766 }; 19767 Navigation.prototype.initialize = function() { 19768 var override, settings = this._core.settings; 19769 this._controls.$relative = (settings.navContainer ? $(settings.navContainer) : $("<div>").addClass(settings.navContainerClass).appendTo(this.$element)).addClass("disabled"); 19770 this._controls.$previous = $("<" + settings.navElement + ">").addClass(settings.navClass[0]).html(settings.navText[0]).prependTo(this._controls.$relative).on("click", $.proxy(function(e) { 19771 this.prev(settings.navSpeed); 19772 }, this)); 19773 this._controls.$next = $("<" + settings.navElement + ">").addClass(settings.navClass[1]).html(settings.navText[1]).appendTo(this._controls.$relative).on("click", $.proxy(function(e) { 19774 this.next(settings.navSpeed); 19775 }, this)); 19776 if (!settings.dotsData) { 19777 this._templates = [$('<button role="button">').addClass(settings.dotClass).append($("<span>")).prop("outerHTML")]; 19778 } 19779 this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer) : $("<div>").addClass(settings.dotsClass).appendTo(this.$element)).addClass("disabled"); 19780 this._controls.$absolute.on("click", "button", $.proxy(function(e) { 19781 var index = $(e.target).parent().is(this._controls.$absolute) ? $(e.target).index() : $(e.target).parent().index(); 19782 e.preventDefault(); 19783 this.to(index, settings.dotsSpeed); 19784 }, this)); 19785 for (override in this._overrides) { 19786 this._core[override] = $.proxy(this[override], this); 19787 } 19788 }; 19789 Navigation.prototype.destroy = function() { 19790 var handler, control, property, override, settings; 19791 settings = this._core.settings; 19792 for (handler in this._handlers) { 19793 this.$element.off(handler, this._handlers[handler]); 19794 } 19795 for (control in this._controls) { 19796 if (control === "$relative" && settings.navContainer) { 19797 this._controls[control].html(""); 19798 } else { 19799 this._controls[control].remove(); 19800 } 19801 } 19802 for (override in this.overides) { 19803 this._core[override] = this._overrides[override]; 19804 } 19805 for (property in Object.getOwnPropertyNames(this)) { 19806 typeof this[property] != "function" && (this[property] = null); 19807 } 19808 }; 19809 Navigation.prototype.update = function() { 19810 var i, j, k, lower = this._core.clones().length / 2, upper = lower + this._core.items().length, maximum = this._core.maximum(true), settings = this._core.settings, size = settings.center || settings.autoWidth || settings.dotsData ? 1 : settings.dotsEach || settings.items; 19811 if (settings.slideBy !== "page") { 19812 settings.slideBy = Math.min(settings.slideBy, settings.items); 19813 } 19814 if (settings.dots || settings.slideBy == "page") { 19815 this._pages = []; 19816 for (i = lower, j = 0, k = 0;i < upper; i++) { 19817 if (j >= size || j === 0) { 19818 this._pages.push({ 19819 start: Math.min(maximum, i - lower), 19820 end: i - lower + size - 1 19821 }); 19822 if (Math.min(maximum, i - lower) === maximum) { 19823 break; 19824 } 19825 j = 0, ++k; 19826 } 19827 j += this._core.mergers(this._core.relative(i)); 19828 } 19829 } 19830 }; 19831 Navigation.prototype.draw = function() { 19832 var difference, settings = this._core.settings, disabled = this._core.items().length <= settings.items, index = this._core.relative(this._core.current()), loop = settings.loop || settings.rewind; 19833 this._controls.$relative.toggleClass("disabled", !settings.nav || disabled); 19834 if (settings.nav) { 19835 this._controls.$previous.toggleClass("disabled", !loop && index <= this._core.minimum(true)); 19836 this._controls.$next.toggleClass("disabled", !loop && index >= this._core.maximum(true)); 19837 } 19838 this._controls.$absolute.toggleClass("disabled", !settings.dots || disabled); 19839 if (settings.dots) { 19840 difference = this._pages.length - this._controls.$absolute.children().length; 19841 if (settings.dotsData && difference !== 0) { 19842 this._controls.$absolute.html(this._templates.join("")); 19843 } else if (difference > 0) { 19844 this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0])); 19845 } else if (difference < 0) { 19846 this._controls.$absolute.children().slice(difference).remove(); 19847 } 19848 this._controls.$absolute.find(".active").removeClass("active"); 19849 this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass("active"); 19850 } 19851 }; 19852 Navigation.prototype.onTrigger = function(event) { 19853 var settings = this._core.settings; 19854 event.page = { 19855 index: $.inArray(this.current(), this._pages), 19856 count: this._pages.length, 19857 size: settings && (settings.center || settings.autoWidth || settings.dotsData ? 1 : settings.dotsEach || settings.items) 19858 }; 19859 }; 19860 Navigation.prototype.current = function() { 19861 var current = this._core.relative(this._core.current()); 19862 return $.grep(this._pages, $.proxy(function(page, index) { 19863 return page.start <= current && page.end >= current; 19864 }, this)).pop(); 19865 }; 19866 Navigation.prototype.getPosition = function(successor) { 19867 var position, length, settings = this._core.settings; 19868 if (settings.slideBy == "page") { 19869 position = $.inArray(this.current(), this._pages); 19870 length = this._pages.length; 19871 successor ? ++position : --position; 19872 position = this._pages[(position % length + length) % length].start; 19873 } else { 19874 position = this._core.relative(this._core.current()); 19875 length = this._core.items().length; 19876 successor ? position += settings.slideBy : position -= settings.slideBy; 19877 } 19878 return position; 19879 }; 19880 Navigation.prototype.next = function(speed) { 19881 $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed); 19882 }; 19883 Navigation.prototype.prev = function(speed) { 19884 $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed); 19885 }; 19886 Navigation.prototype.to = function(position, speed, standard) { 19887 var length; 19888 if (!standard && this._pages.length) { 19889 length = this._pages.length; 19890 $.proxy(this._overrides.to, this._core)(this._pages[(position % length + length) % length].start, speed); 19891 } else { 19892 $.proxy(this._overrides.to, this._core)(position, speed); 19893 } 19894 }; 19895 $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation; 19896})(window.Zepto || window.jQuery, window, document); 19897(function($, window2, document2, undefined2) { 19898 var Hash = function(carousel) { 19899 this._core = carousel; 19900 this._hashes = {}; 19901 this.$element = this._core.$element; 19902 this._handlers = { 19903 "initialized.owl.carousel": $.proxy(function(e) { 19904 if (e.namespace && this._core.settings.startPosition === "URLHash") { 19905 $(window2).trigger("hashchange.owl.navigation"); 19906 } 19907 }, this), 19908 "prepared.owl.carousel": $.proxy(function(e) { 19909 if (e.namespace) { 19910 var hash3 = $(e.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash"); 19911 if (!hash3) { 19912 return; 19913 } 19914 this._hashes[hash3] = e.content; 19915 } 19916 }, this), 19917 "changed.owl.carousel": $.proxy(function(e) { 19918 if (e.namespace && e.property.name === "position") { 19919 var current = this._core.items(this._core.relative(this._core.current())), hash3 = $.map(this._hashes, function(item, hash4) { 19920 return item === current ? hash4 : null; 19921 }).join(); 19922 if (!hash3 || window2.location.hash.slice(1) === hash3) { 19923 return; 19924 } 19925 window2.location.hash = hash3; 19926 } 19927 }, this) 19928 }; 19929 this._core.options = $.extend({}, Hash.Defaults, this._core.options); 19930 this.$element.on(this._handlers); 19931 $(window2).on("hashchange.owl.navigation", $.proxy(function(e) { 19932 var hash3 = window2.location.hash.substring(1), items = this._core.$stage.children(), position = this._hashes[hash3] && items.index(this._hashes[hash3]); 19933 if (position === undefined2 || position === this._core.current()) { 19934 return; 19935 } 19936 this._core.to(this._core.relative(position), false, true); 19937 }, this)); 19938 }; 19939 Hash.Defaults = { 19940 URLhashListener: false 19941 }; 19942 Hash.prototype.destroy = function() { 19943 var handler, property; 19944 $(window2).off("hashchange.owl.navigation"); 19945 for (handler in this._handlers) { 19946 this._core.$element.off(handler, this._handlers[handler]); 19947 } 19948 for (property in Object.getOwnPropertyNames(this)) { 19949 typeof this[property] != "function" && (this[property] = null); 19950 } 19951 }; 19952 $.fn.owlCarousel.Constructor.Plugins.Hash = Hash; 19953})(window.Zepto || window.jQuery, window, document); 19954(function($, window2, document2, undefined2) { 19955 var style = $("<support>").get(0).style, prefixes = "Webkit Moz O ms".split(" "), events = { 19956 transition: { 19957 end: { 19958 WebkitTransition: "webkitTransitionEnd", 19959 MozTransition: "transitionend", 19960 OTransition: "oTransitionEnd", 19961 transition: "transitionend" 19962 } 19963 }, 19964 animation: { 19965 end: { 19966 WebkitAnimation: "webkitAnimationEnd", 19967 MozAnimation: "animationend", 19968 OAnimation: "oAnimationEnd", 19969 animation: "animationend" 19970 } 19971 } 19972 }, tests = { 19973 csstransforms: function() { 19974 return !!test("transform"); 19975 }, 19976 csstransforms3d: function() { 19977 return !!test("perspective"); 19978 }, 19979 csstransitions: function() { 19980 return !!test("transition"); 19981 }, 19982 cssanimations: function() { 19983 return !!test("animation"); 19984 } 19985 }; 19986 function test(property, prefixed2) { 19987 var result = false, upper = property.charAt(0).toUpperCase() + property.slice(1); 19988 $.each((property + " " + prefixes.join(upper + " ") + upper).split(" "), function(i, property2) { 19989 if (style[property2] !== undefined2) { 19990 result = prefixed2 ? property2 : true; 19991 return false; 19992 } 19993 }); 19994 return result; 19995 } 19996 function prefixed(property) { 19997 return test(property, true); 19998 } 19999 if (tests.csstransitions()) { 20000 $.support.transition = new String(prefixed("transition")); 20001 $.support.transition.end = events.transition.end[$.support.transition]; 20002 } 20003 if (tests.cssanimations()) { 20004 $.support.animation = new String(prefixed("animation")); 20005 $.support.animation.end = events.animation.end[$.support.animation]; 20006 } 20007 if (tests.csstransforms()) { 20008 $.support.transform = new String(prefixed("transform")); 20009 $.support.transform3d = tests.csstransforms3d(); 20010 } 20011})(window.Zepto || window.jQuery, window, document); 20012
20013// app/javascript/application.js 20014document.addEventListener("turbo:load", () => { 20015 if (typeof window.hcaptcha === "undefined") 20016 return; 20017 document.querySelectorAll(".h-captcha").forEach((el) => { 20018 if (el.children.length > 0) 20019 return; 20020 window.hcaptcha.render(el); 20021 }); 20022}); 20023 20024//# debugId=20314F7BBE521B0964756E2164756E21;
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.