vendor: 1,088 bytes, lines 1-24
1(() => { 2 var __create = Object.create; 3 var __defProp = Object.defineProperty; 4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 5 var __getOwnPropNames = Object.getOwnPropertyNames; 6 var __getProtoOf = Object.getPrototypeOf; 7 var __hasOwnProp = Object.prototype.hasOwnProperty; 8 var __commonJS = (cb, mod) => function __require() { 9 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 10 }; 11 var __copyProps = (to, from, except, desc) => { 12 if (from && typeof from === "object" || typeof from === "function") { 13 for (let key of __getOwnPropNames(from)) 14 if (!__hasOwnProp.call(to, key) && key !== except) 15 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 16 } 17 return to; 18 }; 19 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 20 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 21 mod 22 )); 23 24
vendor: 10,242 bytes, lines 24-301
24// node_modules/nprogress/nprogress.js 25 var require_nprogress = __commonJS({ 26 "node_modules/nprogress/nprogress.js"(exports, module) { 27 (function(root, factory) { 28 if (typeof define === "function" && define.amd) { 29 define(factory); 30 } else if (typeof exports === "object") { 31 module.exports = factory(); 32 } else { 33 root.NProgress = factory(); 34 } 35 })(exports, function() { 36 var NProgress2 = {}; 37 NProgress2.version = "0.2.0"; 38 var Settings = NProgress2.settings = { 39 minimum: 0.08, 40 easing: "ease", 41 positionUsing: "", 42 speed: 200, 43 trickle: true, 44 trickleRate: 0.02, 45 trickleSpeed: 800, 46 showSpinner: true, 47 barSelector: '[role="bar"]', 48 spinnerSelector: '[role="spinner"]', 49 parent: "body", 50 template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>' 51 }; 52 NProgress2.configure = function(options) { 53 var key, value; 54 for (key in options) { 55 value = options[key]; 56 if (value !== void 0 && options.hasOwnProperty(key)) 57 Settings[key] = value; 58 } 59 return this; 60 }; 61 NProgress2.status = null; 62 NProgress2.set = function(n) { 63 var started2 = NProgress2.isStarted(); 64 n = clamp2(n, Settings.minimum, 1); 65 NProgress2.status = n === 1 ? null : n; 66 var progress = NProgress2.render(!started2), bar = progress.querySelector(Settings.barSelector), speed = Settings.speed, ease = Settings.easing; 67 progress.offsetWidth; 68 queue2(function(next) { 69 if (Settings.positionUsing === "") 70 Settings.positionUsing = NProgress2.getPositioningCSS(); 71 css2(bar, barPositionCSS(n, speed, ease)); 72 if (n === 1) { 73 css2(progress, { 74 transition: "none", 75 opacity: 1 76 }); 77 progress.offsetWidth; 78 setTimeout(function() { 79 css2(progress, { 80 transition: "all " + speed + "ms linear", 81 opacity: 0 82 }); 83 setTimeout(function() { 84 NProgress2.remove(); 85 next(); 86 }, speed); 87 }, speed); 88 } else { 89 setTimeout(next, speed); 90 } 91 }); 92 return this; 93 }; 94 NProgress2.isStarted = function() { 95 return typeof NProgress2.status === "number"; 96 }; 97 NProgress2.start = function() { 98 if (!NProgress2.status) 99 NProgress2.set(0); 100 var work = function() { 101 setTimeout(function() { 102 if (!NProgress2.status) 103 return; 104 NProgress2.trickle(); 105 work(); 106 }, Settings.trickleSpeed); 107 }; 108 if (Settings.trickle) 109 work(); 110 return this; 111 }; 112 NProgress2.done = function(force) { 113 if (!force && !NProgress2.status) 114 return this; 115 return NProgress2.inc(0.3 + 0.5 * Math.random()).set(1); 116 }; 117 NProgress2.inc = function(amount) { 118 var n = NProgress2.status; 119 if (!n) { 120 return NProgress2.start(); 121 } else { 122 if (typeof amount !== "number") { 123 amount = (1 - n) * clamp2(Math.random() * n, 0.1, 0.95); 124 } 125 n = clamp2(n + amount, 0, 0.994); 126 return NProgress2.set(n); 127 } 128 }; 129 NProgress2.trickle = function() { 130 return NProgress2.inc(Math.random() * Settings.trickleRate); 131 }; 132 (function() { 133 var initial = 0, current = 0; 134 NProgress2.promise = function($promise) { 135 if (!$promise || $promise.state() === "resolved") { 136 return this; 137 } 138 if (current === 0) { 139 NProgress2.start(); 140 } 141 initial++; 142 current++; 143 $promise.always(function() { 144 current--; 145 if (current === 0) { 146 initial = 0; 147 NProgress2.done(); 148 } else { 149 NProgress2.set((initial - current) / initial); 150 } 151 }); 152 return this; 153 }; 154 })(); 155 NProgress2.render = function(fromStart) { 156 if (NProgress2.isRendered()) 157 return document.getElementById("nprogress"); 158 addClass(document.documentElement, "nprogress-busy"); 159 var progress = document.createElement("div"); 160 progress.id = "nprogress"; 161 progress.innerHTML = Settings.template; 162 var bar = progress.querySelector(Settings.barSelector), perc = fromStart ? "-100" : toBarPerc(NProgress2.status || 0), parent = document.querySelector(Settings.parent), spinner; 163 css2(bar, { 164 transition: "all 0 linear", 165 transform: "translate3d(" + perc + "%,0,0)" 166 }); 167 if (!Settings.showSpinner) { 168 spinner = progress.querySelector(Settings.spinnerSelector); 169 spinner && removeElement(spinner); 170 } 171 if (parent != document.body) { 172 addClass(parent, "nprogress-custom-parent"); 173 } 174 parent.appendChild(progress); 175 return progress; 176 }; 177 NProgress2.remove = function() { 178 removeClass(document.documentElement, "nprogress-busy"); 179 removeClass(document.querySelector(Settings.parent), "nprogress-custom-parent"); 180 var progress = document.getElementById("nprogress"); 181 progress && removeElement(progress); 182 }; 183 NProgress2.isRendered = function() { 184 return !!document.getElementById("nprogress"); 185 }; 186 NProgress2.getPositioningCSS = function() { 187 var bodyStyle = document.body.style; 188 var vendorPrefix = "WebkitTransform" in bodyStyle ? "Webkit" : "MozTransform" in bodyStyle ? "Moz" : "msTransform" in bodyStyle ? "ms" : "OTransform" in bodyStyle ? "O" : ""; 189 if (vendorPrefix + "Perspective" in bodyStyle) { 190 return "translate3d"; 191 } else if (vendorPrefix + "Transform" in bodyStyle) { 192 return "translate"; 193 } else { 194 return "margin"; 195 } 196 }; 197 function clamp2(n, min2, max2) { 198 if (n < min2) 199 return min2; 200 if (n > max2) 201 return max2; 202 return n; 203 } 204 function toBarPerc(n) { 205 return (-1 + n) * 100; 206 } 207 function barPositionCSS(n, speed, ease) { 208 var barCSS; 209 if (Settings.positionUsing === "translate3d") { 210 barCSS = { transform: "translate3d(" + toBarPerc(n) + "%,0,0)" }; 211 } else if (Settings.positionUsing === "translate") { 212 barCSS = { transform: "translate(" + toBarPerc(n) + "%,0)" }; 213 } else { 214 barCSS = { "margin-left": toBarPerc(n) + "%" }; 215 } 216 barCSS.transition = "all " + speed + "ms " + ease; 217 return barCSS; 218 } 219 var queue2 = function() { 220 var pending = []; 221 function next() { 222 var fn = pending.shift(); 223 if (fn) { 224 fn(next); 225 } 226 } 227 return function(fn) { 228 pending.push(fn); 229 if (pending.length == 1) 230 next(); 231 }; 232 }(); 233 var css2 = function() { 234 var cssPrefixes = ["Webkit", "O", "Moz", "ms"], cssProps = {}; 235 function camelCase3(string) { 236 return string.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function(match, letter) { 237 return letter.toUpperCase(); 238 }); 239 } 240 function getVendorProp(name) { 241 var style = document.body.style; 242 if (name in style) 243 return name; 244 var i = cssPrefixes.length, capName = name.charAt(0).toUpperCase() + name.slice(1), vendorName; 245 while (i--) { 246 vendorName = cssPrefixes[i] + capName; 247 if (vendorName in style) 248 return vendorName; 249 } 250 return name; 251 } 252 function getStyleProp(name) { 253 name = camelCase3(name); 254 return cssProps[name] || (cssProps[name] = getVendorProp(name)); 255 } 256 function applyCss(element, prop, value) { 257 prop = getStyleProp(prop); 258 element.style[prop] = value; 259 } 260 return function(element, properties2) { 261 var args = arguments, prop, value; 262 if (args.length == 2) { 263 for (prop in properties2) { 264 value = properties2[prop]; 265 if (value !== void 0 && properties2.hasOwnProperty(prop)) 266 applyCss(element, prop, value); 267 } 268 } else { 269 applyCss(element, args[1], args[2]); 270 } 271 }; 272 }(); 273 function hasClass(element, name) { 274 var list = typeof element == "string" ? element : classList(element); 275 return list.indexOf(" " + name + " ") >= 0; 276 } 277 function addClass(element, name) { 278 var oldList = classList(element), newList = oldList + name; 279 if (hasClass(oldList, name)) 280 return; 281 element.className = newList.substring(1); 282 } 283 function removeClass(element, name) { 284 var oldList = classList(element), newList; 285 if (!hasClass(element, name)) 286 return; 287 newList = oldList.replace(" " + name + " ", " "); 288 element.className = newList.substring(1, newList.length - 1); 289 } 290 function classList(element) { 291 return (" " + (element.className || "") + " ").replace(/\s+/gi, " "); 292 } 293 function removeElement(element) { 294 element && element.parentNode && element.parentNode.removeChild(element); 295 } 296 return NProgress2; 297 }); 298 } 299 }); 300 301
301// js/utils.js 302 var Bag = class { 303 constructor() { 304 this.arrays = {}; 305 } 306 add(key, value) { 307 if (!this.arrays[key]) 308 this.arrays[key] = []; 309 this.arrays[key].push(value); 310 } 311 remove(key) { 312 if (this.arrays[key]) 313 delete this.arrays[key]; 314 } 315 get(key) { 316 return this.arrays[key] || []; 317 } 318 each(key, callback) { 319 return this.get(key).forEach(callback); 320 } 321 }; 322 var WeakBag = class { 323 constructor() { 324 this.arrays = /* @__PURE__ */ new WeakMap(); 325 } 326 add(key, value) { 327 if (!this.arrays.has(key)) 328 this.arrays.set(key, []); 329 this.arrays.get(key).push(value); 330 } 331 remove(key) { 332 if (this.arrays.has(key)) 333 this.arrays.delete(key, []); 334 } 335 get(key) { 336 return this.arrays.has(key) ? this.arrays.get(key) : []; 337 } 338 each(key, callback) { 339 return this.get(key).forEach(callback); 340 } 341 }; 342 function dispatch(target, name, detail = {}, bubbles = true) { 343 target.dispatchEvent( 344 new CustomEvent(name, { 345 detail, 346 bubbles, 347 composed: true, 348 cancelable: true 349 }) 350 ); 351 } 352 function listen(target, name, handler4) { 353 target.addEventListener(name, handler4); 354 return () => target.removeEventListener(name, handler4); 355 } 356 function isObjecty(subject) { 357 return typeof subject === "object" && subject !== null; 358 } 359 function isObject(subject) { 360 return isObjecty(subject) && !isArray(subject); 361 } 362 function isArray(subject) { 363 return Array.isArray(subject); 364 } 365 function isFunction(subject) { 366 return typeof subject === "function"; 367 } 368 function isPrimitive(subject) { 369 return typeof subject !== "object" || subject === null; 370 } 371 function deepClone(obj) { 372 return JSON.parse(JSON.stringify(obj)); 373 } 374 function deeplyEqual(a, b) { 375 return JSON.stringify(a) === JSON.stringify(b); 376 } 377 function parsePathSegments(path) { 378 if (path === "") 379 return []; 380 return path.replace(/\[(['"]?)(.+?)\1\]/g, ".$2").replace(/^\./, "").split("."); 381 } 382 function dataGet(object, key) { 383 if (key === "") 384 return object; 385 return parsePathSegments(key).reduce((carry, i) => { 386 return carry?.[i]; 387 }, object); 388 } 389 function dataSet(object, key, value) { 390 let segments = parsePathSegments(key); 391 if (segments.length === 1) { 392 return object[segments[0]] = value; 393 } 394 let firstSegment = segments.shift(); 395 let restOfSegments = segments.join("."); 396 let nextSegment = segments[0]; 397 if (object[firstSegment] === void 0) { 398 object[firstSegment] = {}; 399 } 400 if (isArray(object[firstSegment]) && isNumeric(nextSegment) && parseInt(nextSegment) > object[firstSegment].length) { 401 object[firstSegment] = { ...object[firstSegment] }; 402 } 403 dataSet(object[firstSegment], restOfSegments, value); 404 } 405 function isNumeric(subject) { 406 return !isNaN(parseInt(subject)); 407 } 408 function dataDelete(object, key) { 409 let segments = parsePathSegments(key); 410 if (segments.length === 1) { 411 if (Array.isArray(object)) { 412 object.splice(segments[0], 1); 413 } else { 414 delete object[segments[0]]; 415 } 416 return; 417 } 418 let firstSegment = segments.shift(); 419 let restOfSegments = segments.join("."); 420 if (object[firstSegment] !== void 0) { 421 dataDelete(object[firstSegment], restOfSegments); 422 } 423 } 424 function diff(left, right, diffs = {}, path = "") { 425 if (left === right) 426 return diffs; 427 if (typeof left !== typeof right || isObject(left) && isArray(right) || isArray(left) && isObject(right)) { 428 diffs[path] = right; 429 return diffs; 430 } 431 if (isPrimitive(left) || isPrimitive(right)) { 432 diffs[path] = right; 433 return diffs; 434 } 435 let leftKeys = Object.keys(left); 436 let rightKeys = Object.keys(right); 437 if (isObject(left) && leftKeys.some((key, i) => key !== rightKeys[i])) { 438 diffs[path] = right; 439 return diffs; 440 } 441 Object.entries(right).forEach(([key, value]) => { 442 diffs = { ...diffs, ...diff(left[key], right[key], diffs, path === "" ? key : `${path}.${key}`) }; 443 leftKeys = leftKeys.filter((i) => i !== key); 444 }); 445 leftKeys.forEach((key) => { 446 diffs[`${path}.${key}`] = "__rm__"; 447 }); 448 return diffs; 449 } 450 function diffAndConsolidate(left, right) { 451 let diffs = {}; 452 diffRecursive(left, right, "", diffs, left, right); 453 return diffs; 454 } 455 function diffRecursive(left, right, path, diffs, rootLeft, rootRight) { 456 if (left === right) 457 return { changed: false, consolidated: false };
458 let convertedToObject = false; 459 let hasNonNumericKeys = (arr) => { 460 return isArray(arr) && Object.keys(arr).some((k) => isNaN(parseInt(k))); 461 }; 462 if (typeof left !== typeof right || isObject(left) && isArray(right) || isArray(left) && isObject(right)) { 463 if (isArray(left) && left.length === 0 && isObject(right)) { 464 left = {}; 465 convertedToObject = true; 466 } else if ((left === void 0 || left === null) && isObject(right)) { 467 left = {}; 468 convertedToObject = true; 469 } else { 470 diffs[path] = right; 471 return { changed: true, consolidated: false }; 472 } 473 } 474 if (isArray(left) && isArray(right) && hasNonNumericKeys(right)) { 475 if (Object.keys(left).length === 0) { 476 convertedToObject = true; 477 } 478 } 479 if (isPrimitive(left) || isPrimitive(right)) { 480 diffs[path] = right; 481 return { changed: true, consolidated: false }; 482 } 483 let leftKeys = Object.keys(left); 484 let rightKeys = Object.keys(right); 485 if (leftKeys.length !== rightKeys.length && !convertedToObject) { 486 if (path === "") { 487 Object.keys(right).forEach((key) => { 488 if (!deeplyEqual(left[key], right[key])) { 489 diffs[key] = right[key]; 490 } 491 }); 492 return { changed: true, consolidated: true }; 493 } 494 diffs[path] = dataGet(rootRight, path); 495 return { changed: true, consolidated: true }; 496 } 497 if (isObject(left) && leftKeys.length === rightKeys.length && leftKeys.some((key, i) => key !== rightKeys[i])) { 498 if (path !== "") { 499 diffs[path] = dataGet(rootRight, path); 500 return { changed: true, consolidated: true }; 501 } 502 } 503 let keysMatch = leftKeys.every((k) => rightKeys.includes(k)); 504 if (!keysMatch && !convertedToObject) { 505 if (path !== "") { 506 diffs[path] = dataGet(rootRight, path); 507 return { changed: true, consolidated: true }; 508 } 509 } 510 let childDiffs = {}; 511 let changedCount = 0; 512 let consolidatedCount = 0; 513 let totalChildren = rightKeys.length; 514 rightKeys.forEach((key) => { 515 let childPath = path === "" ? key : `${path}.${key}`; 516 let result = diffRecursive(left[key], right[key], childPath, childDiffs, rootLeft, rootRight); 517 if (result.changed) 518 changedCount++; 519 if (result.consolidated) 520 consolidatedCount++; 521 }); 522 if (path !== "" && totalChildren > 1 && changedCount === totalChildren && consolidatedCount === 0 && !convertedToObject) { 523 diffs[path] = dataGet(rootRight, path); 524 return { changed: true, consolidated: true }; 525 } 526 Object.assign(diffs, childDiffs); 527 return { changed: changedCount > 0, consolidated: consolidatedCount > 0 || convertedToObject }; 528 } 529 function diffAndPatchRecursive(left, right, target) { 530 let leftKeys = new Set(Object.keys(left || {})); 531 let rightKeys = Object.keys(right); 532 if (!isArray(target) && [...leftKeys].some((key, i) => key !== rightKeys[i])) { 533 for (let key of Object.keys(target)) 534 delete target[key]; 535 for (let key of rightKeys) 536 target[key] = right[key]; 537 return; 538 } 539 rightKeys.forEach((key) => { 540 leftKeys.delete(key); 541 if (deeplyEqual(left?.[key], right[key])) 542 return; 543 if (isObjecty(left?.[key]) && isObjecty(right[key]) && isObjecty(target[key]) && isArray(right[key]) === isArray(target[key])) { 544 diffAndPatchRecursive(left[key], right[key], target[key]); 545 } else { 546 target[key] = right[key]; 547 } 548 }); 549 let removedKeys = [...leftKeys]; 550 removedKeys.sort((a, b) => { 551 let aNum = parseInt(a) || 0; 552 let bNum = parseInt(b) || 0; 553 return bNum - aNum; 554 }
554).forEach((key) => { 555 if (isArray(target)) { 556 target.splice(parseInt(key), 1); 557 } else { 558 delete target[key]; 559 } 560 }); 561 } 562 function extractData(payload) { 563 let value = isSynthetic(payload) ? payload[0] : payload; 564 let meta = isSynthetic(payload) ? payload[1] : void 0; 565 if (isObjecty(value)) { 566 Object.entries(value).forEach(([key, iValue]) => { 567 value[key] = extractData(iValue); 568 }); 569 } 570 return value; 571 } 572 function isSynthetic(subject) { 573 return Array.isArray(subject) && subject.length === 2 && typeof subject[1] === "object" && Object.keys(subject[1]).includes("s"); 574 } 575 function getCsrfToken() { 576 if (document.querySelector('meta[name="csrf-token"]')) { 577 return document.querySelector('meta[name="csrf-token"]').getAttribute("content"); 578 } 579 if (document.querySelector("[data-csrf]")) { 580 return document.querySelector("[data-csrf]").getAttribute("data-csrf"); 581 } 582 if (window.livewireScriptConfig["csrf"] ?? false) { 583 return window.livewireScriptConfig["csrf"]; 584 } 585 throw "Livewire: No CSRF token detected"; 586 } 587 var nonce; 588 function getNonce() { 589 if (nonce) 590 return nonce; 591 if (window.livewireScriptConfig && (window.livewireScriptConfig["nonce"] ?? false)) { 592 nonce = window.livewireScriptConfig["nonce"]; 593 return nonce; 594 } 595 let elWithNonce = document.querySelector("style[data-livewire-style][nonce]"); 596 if (elWithNonce) { 597 nonce = elWithNonce.nonce; 598 return nonce; 599 } 600 return null; 601 } 602 function replaceNoncesInHtml(html) { 603 let nonce2 = getNonce(); 604 if (!nonce2) 605 return html; 606 let nonceMatch = html.match(/nonce="([^"]+)"/); 607 if (!nonceMatch) 608 return html; 609 let newNonce = nonceMatch[1]; 610 if (newNonce === nonce2) 611 return html; 612 return html.replaceAll(`nonce="${newNonce}"`, `nonce="${nonce2}"`); 613 } 614 function cloneScriptTag(el) { 615 let script = document.createElement("script"); 616 script.textContent = el.textContent; 617 script.async = el.async; 618 for (let attr of el.attributes) { 619 if (attr.name === "nonce") { 620 script.nonce = getNonce() || el.nonce; 621 } else { 622 script.setAttribute(attr.name, attr.value); 623 } 624 } 625 return script; 626 } 627 function getModuleUrl() { 628 return document.querySelector("[data-module-url]")?.getAttribute("data-module-url") ?? window.livewireScriptConfig["moduleUrl"] ?? null; 629 } 630 function getUpdateUri() { 631 return document.querySelector("[data-update-uri]")?.getAttribute("data-update-uri") ?? window.livewireScriptConfig["uri"] ?? null; 632 } 633 function contentIsFromDump(content) { 634 return !!content.match(/<script>Sfdump\(".+"\)<\/script>/); 635 } 636 function splitDumpFromContent(content) { 637 let dump = content.match(/.*<script>Sfdump\(".+"\)<\/script>/s); 638 return [dump, content.replace(dump, "")]; 639 } 640 function walkUpwards(el, callback) {
641 let current = el; 642 while (current) { 643 let stop2 = void 0; 644 callback(current, { stop: (value) => value === void 0 ? stop2 = current : stop2 = value }); 645 if (stop2 !== void 0) 646 return stop2; 647 if (current._x_teleportBack) 648 current = current._x_teleportBack; 649 current = current.parentElement; 650 } 651 } 652 function walkBackwards(el, callback) { 653 let current = el; 654 while (current) { 655 let stop2 = void 0; 656 callback(current, { stop: (value) => value === void 0 ? stop2 = current : stop2 = value }); 657 if (stop2 !== void 0) 658 return stop2; 659 current = current.previousSibling; 660 } 661 } 662 663
663// js/features/supportFileUploads.js 664 var uploadManagers = /* @__PURE__ */ new WeakMap(); 665 function getUploadManager(component) { 666 if (!uploadManagers.has(component)) { 667 let manager = new UploadManager(component); 668 uploadManagers.set(component, manager); 669 manager.registerListeners(); 670 } 671 return uploadManagers.get(component); 672 } 673 function handleFileUpload(el, property, component, cleanup2) { 674 let manager = getUploadManager(component); 675 let start3 = () => el.dispatchEvent(new CustomEvent("livewire-upload-start", { bubbles: true, detail: { id: component.id, property } })); 676 let finish = () => el.dispatchEvent(new CustomEvent("livewire-upload-finish", { bubbles: true, detail: { id: component.id, property } })); 677 let error2 = () => el.dispatchEvent(new CustomEvent("livewire-upload-error", { bubbles: true, detail: { id: component.id, property } })); 678 let cancel = () => el.dispatchEvent(new CustomEvent("livewire-upload-cancel", { bubbles: true, detail: { id: component.id, property } })); 679 let progress = (progressEvent) => { 680 var percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total); 681 el.dispatchEvent( 682 new CustomEvent("livewire-upload-progress", { 683 bubbles: true, 684 detail: { progress: percentCompleted } 685 }) 686 ); 687 }; 688 let eventHandler = (e) => { 689 if (e.target.files.length === 0) 690 return; 691 start3(); 692 if (e.target.multiple) { 693 manager.uploadMultiple(property, e.target.files, finish, error2, progress, cancel); 694 } else { 695 manager.upload(property, e.target.files[0], finish, error2, progress, cancel); 696 } 697 }; 698 el.addEventListener("change", eventHandler); 699 let unwatch = component.$wire.$watch(property, (value) => { 700 if (!el.isConnected) 701 return; 702 if (value === null || value === "") { 703 el.value = ""; 704 } 705 if (el.multiple && Array.isArray(value) && value.length === 0) { 706 el.value = ""; 707 } 708 }); 709 let clearFileInputValue = () => { 710 el.value = null; 711 }; 712 el.addEventListener("click", clearFileInputValue); 713 el.addEventListener("livewire-upload-cancel", clearFileInputValue); 714 cleanup2(() => { 715 el.removeEventListener("change", eventHandler); 716 el.removeEventListener("click", clearFileInputValue); 717 el.removeEventListener("livewire-upload-cancel", clearFileInputValue); 718 unwatch(); 719 }); 720 } 721 var UploadManager = class { 722 constructor(component) { 723 this.component = component; 724 this.uploadBag = new MessageBag(); 725 this.removeBag = new MessageBag(); 726 } 727 registerListeners() { 728 this.component.$wire.$on("upload:generatedSignedUrl", ({ name, url }) => { 729 setUploadLoading(this.component, name); 730 this.handleSignedUrl(name, url); 731 }); 732 this.component.$wire.$on("upload:generatedSignedUrlForS3", ({ name, payload }) => { 733 setUploadLoading(this.component, name); 734 this.handleS3PreSignedUrl(name, payload); 735 }); 736 this.component.$wire.$on("upload:finished", ({ name, tmpFilenames }) => this.markUploadFinished(name, tmpFilenames)); 737 this.component.$wire.$on("upload:errored", ({ name }) => this.markUploadErrored(name)); 738 this.component.$wire.$on("upload:removed", ({ name, tmpFilename }) => this.removeBag.shift(name).finishCallback(tmpFilename)); 739 } 740 upload(name, file, finishCallback, errorCallback, progressCallback, cancelledCallback) { 741 this.setUpload(name, { 742 files: [file], 743 multiple: false, 744 finishCallback, 745 errorCallback, 746 progressCallback, 747 cancelledCallback, 748 append: false 749 }); 750 } 751 uploadMultiple(name, files, finishCallback, errorCallback, progressCallback, cancelledCallback, append = true) { 752 this.setUpload(name, { 753 files: Array.from(files), 754 multiple: true, 755 finishCallback, 756 errorCallback, 757 progressCallback, 758 cancelledCallback, 759 append 760 }); 761 } 762 removeUpload(name, tmpFilename, finishCallback) { 763 this.removeBag.push(name, { 764 tmpFilename, 765 finishCallback 766 }); 767 this.component.$wire.call("_removeUpload", name, tmpFilename); 768 } 769 setUpload(name, uploadObject) { 770 this.uploadBag.add(name, uploadObject); 771 if (this.uploadBag.get(name).length === 1) { 772 this.startUpload(name, uploadObject); 773 } 774 } 775 handleSignedUrl(name, url) { 776 let formData = new FormData();
777 Array.from(this.uploadBag.first(name).files).forEach((file) => formData.append("files[]", file, file.name)); 778 let headers = { 779 "Accept": "application/json" 780 }; 781 let csrfToken = getCsrfToken(); 782 if (csrfToken) 783 headers["X-CSRF-TOKEN"] = csrfToken; 784 this.makeRequest(name, formData, "post", url, headers, (response) => { 785 return response.paths; 786 }); 787 } 788 handleS3PreSignedUrl(name, payload) { 789 let formData = this.uploadBag.first(name).files[0]; 790 let headers = payload.headers; 791 if ("Host" in headers) 792 delete headers.Host; 793 let url = payload.url; 794 this.makeRequest(name, formData, "put", url, headers, (response) => { 795 return [payload.path]; 796 }); 797 } 798 makeRequest(name, formData, method, url, headers, retrievePaths) { 799 let request = new XMLHttpRequest(); 800 request.open(method, url); 801 Object.entries(headers).forEach(([key, value]) => { 802 request.setRequestHeader(key, value); 803 }); 804 request.upload.addEventListener("progress", (e) => { 805 e.detail = {}; 806 e.detail.progress = Math.floor(e.loaded * 100 / e.total); 807 this.uploadBag.first(name).progressCallback(e); 808 }); 809 request.addEventListener("load", () => { 810 if ((request.status + "")[0] === "2") { 811 let paths = retrievePaths(request.response && JSON.parse(request.response)); 812 this.component.$wire.call("_finishUpload", name, paths, this.uploadBag.first(name).multiple, this.uploadBag.first(name).append); 813 return; 814 } 815 let errors = null; 816 if (request.status === 422) { 817 errors = request.response; 818 } 819 this.component.$wire.call("_uploadErrored", name, errors, this.uploadBag.first(name).multiple); 820 }); 821 request.addEventListener("error", () => { 822 this.component.$wire.call("_uploadErrored", name, null, this.uploadBag.first(name).multiple); 823 }); 824 this.uploadBag.first(name).request = request; 825 request.send(formData); 826 } 827 startUpload(name, uploadObject) { 828 let fileInfos = uploadObject.files.map((file) => { 829 return { name: file.name, size: file.size, type: file.type }; 830 }); 831 this.component.$wire.call("_startUpload", name, fileInfos, uploadObject.multiple); 832 setUploadLoading(this.component, name); 833 } 834 markUploadFinished(name, tmpFilenames) { 835 unsetUploadLoading(this.component); 836 let uploadObject = this.uploadBag.shift(name); 837 uploadObject.finishCallback(uploadObject.multiple ? tmpFilenames : tmpFilenames[0]); 838 if (this.uploadBag.get(name).length > 0) 839 this.startUpload(name, this.uploadBag.last(name)); 840 } 841 markUploadErrored(name) { 842 unsetUploadLoading(this.component); 843 this.uploadBag.shift(name).errorCallback(); 844 if (this.uploadBag.get(name).length > 0) 845 this.startUpload(name, this.uploadBag.last(name)); 846 } 847 cancelUpload(name, cancelledCallback = null) { 848 unsetUploadLoading(this.component); 849 let uploadItem = this.uploadBag.first(name); 850 if (uploadItem) { 851 if (uploadItem.request) { 852 uploadItem.request.abort(); 853 } 854 this.uploadBag.shift(name).cancelledCallback(); 855 if (cancelledCallback) 856 cancelledCallback(); 857 } 858 } 859 }; 860 var MessageBag = class { 861 constructor() { 862 this.bag = {}; 863 } 864 add(name, thing) { 865 if (!this.bag[name]) { 866 this.bag[name] = []; 867 } 868 this.bag[name].push(thing); 869 } 870 push(name, thing) { 871 this.add(name, thing); 872 } 873 first(name) { 874 if (!this.bag[name]) 875 return null; 876 return this.bag[name][0]; 877 } 878 last(name) { 879 return this.bag[name].slice(-1)[0]; 880 } 881 get(name) { 882 return this.bag[name]; 883 } 884 shift(name) { 885 return this.bag[name].shift(); 886 } 887 call(name, ...params) { 888 (this.listeners[name] || []).forEach((callback) => { 889 callback(...params); 890 }); 891 } 892 has(name) { 893 return Object.keys(this.listeners).includes(name); 894 } 895 }; 896 function setUploadLoading() { 897 } 898 function unsetUploadLoading() { 899 } 900 function upload(component, name, file, finishCallback = () => { 901 }, errorCallback = () => { 902 }, progressCallback = () => { 903 }, cancelledCallback = () => { 904 }) { 905 let uploadManager = getUploadManager(component); 906 uploadManager.upload( 907 name, 908 file, 909 finishCallback, 910 errorCallback, 911 progressCallback, 912 cancelledCallback 913 ); 914 } 915 function uploadMultiple(component, name, files, finishCallback = () => { 916 }, errorCallback = () => { 917 }, progressCallback = () => { 918 }, cancelledCallback = () => { 919 }, append = true) { 920 let uploadManager = getUploadManager(component); 921 uploadManager.uploadMultiple( 922 name, 923 files, 924 finishCallback, 925 errorCallback, 926 progressCallback, 927 cancelledCallback, 928 append 929 ); 930 } 931 function removeUpload(component, name, tmpFilename, finishCallback = () => { 932 }, errorCallback = () => { 933 }) { 934 let uploadManager = getUploadManager(component); 935 uploadManager.removeUpload( 936 name, 937 tmpFilename, 938 finishCallback, 939 errorCallback 940 ); 941 } 942 function cancelUpload(component, name, cancelledCallback = () => { 943 }) { 944 let uploadManager = getUploadManager(component); 945 uploadManager.cancelUpload( 946 name, 947 cancelledCallback 948 ); 949 } 950 951
vendor: 109,781 bytes, lines 951-4302
951// node_modules/alpinejs/dist/module.esm.js 952 var flushPending = false; 953 var flushing = false; 954 var queue = []; 955 var lastFlushedIndex = -1; 956 var transactionActive = false; 957 function scheduler(callback) { 958 queueJob(callback); 959 } 960 function startTransaction() { 961 transactionActive = true; 962 } 963 function commitTransaction() { 964 transactionActive = false; 965 queueFlush(); 966 } 967 function queueJob(job) { 968 if (!queue.includes(job)) 969 queue.push(job); 970 queueFlush(); 971 } 972 function dequeueJob(job) { 973 let index2 = queue.indexOf(job); 974 if (index2 !== -1 && index2 > lastFlushedIndex) 975 queue.splice(index2, 1); 976 } 977 function queueFlush() { 978 if (!flushing && !flushPending) { 979 if (transactionActive) 980 return; 981 flushPending = true; 982 queueMicrotask(flushJobs); 983 } 984 } 985 function flushJobs() { 986 flushPending = false; 987 flushing = true; 988 for (let i = 0; i < queue.length; i++) { 989 queue[i](); 990 lastFlushedIndex = i; 991 } 992 queue.length = 0; 993 lastFlushedIndex = -1; 994 flushing = false; 995 } 996 var reactive; 997 var effect; 998 var release; 999 var raw; 1000 var shouldSchedule = true; 1001 function disableEffectScheduling(callback) { 1002 shouldSchedule = false; 1003 callback(); 1004 shouldSchedule = true; 1005 } 1006 function setReactivityEngine(engine) { 1007 reactive = engine.reactive; 1008 release = engine.release; 1009 effect = (callback) => engine.effect(callback, { scheduler: (task) => { 1010 if (shouldSchedule) { 1011 scheduler(task); 1012 } else { 1013 task(); 1014 } 1015 } }); 1016 raw = engine.raw; 1017 } 1018 function overrideEffect(override) { 1019 effect = override; 1020 } 1021 function elementBoundEffect(el) { 1022 let cleanup2 = () => { 1023 }; 1024 let wrappedEffect = (callback) => { 1025 let effectReference = effect(callback); 1026 if (!el._x_effects) { 1027 el._x_effects = /* @__PURE__ */ new Set(); 1028 el._x_runEffects = () => { 1029 el._x_effects.forEach((i) => i()); 1030 }; 1031 } 1032 el._x_effects.add(effectReference); 1033 cleanup2 = () => { 1034 if (effectReference === void 0) 1035 return; 1036 el._x_effects.delete(effectReference); 1037 release(effectReference); 1038 }; 1039 return effectReference; 1040 }; 1041 return [wrappedEffect, () => { 1042 cleanup2(); 1043 }]; 1044 } 1045 function watch(getter, callback) { 1046 let firstTime = true; 1047 let oldValue; 1048 let oldValueJSON; 1049 let effectReference = effect(() => { 1050 let value = getter(); 1051 let newJSON = JSON.stringify(value); 1052 if (!firstTime) { 1053 if (typeof value === "object" || value !== oldValue) { 1054 let previousValue = typeof oldValue === "object" ? JSON.parse(oldValueJSON) : oldValue; 1055 queueMicrotask(() => { 1056 callback(value, previousValue); 1057 }); 1058 } 1059 } 1060 oldValue = value; 1061 oldValueJSON = newJSON; 1062 firstTime = false; 1063 }); 1064 return () => release(effectReference); 1065 } 1066 async function transaction(callback) { 1067 startTransaction(); 1068 try { 1069 await callback(); 1070 await Promise.resolve(); 1071 } finally { 1072 commitTransaction(); 1073 } 1074 } 1075 var onAttributeAddeds = []; 1076 var onElRemoveds = []; 1077 var onElAddeds = []; 1078 function onElAdded(callback) { 1079 onElAddeds.push(callback); 1080 } 1081 function onElRemoved(el, callback) { 1082 if (typeof callback === "function") { 1083 if (!el._x_cleanups) 1084 el._x_cleanups = []; 1085 el._x_cleanups.push(callback); 1086 } else { 1087 callback = el; 1088 onElRemoveds.push(callback); 1089 } 1090 } 1091 function onAttributesAdded(callback) { 1092 onAttributeAddeds.push(callback); 1093 } 1094 function onAttributeRemoved(el, name, callback) { 1095 if (!el._x_attributeCleanups) 1096 el._x_attributeCleanups = {}; 1097 if (!el._x_attributeCleanups[name]) 1098 el._x_attributeCleanups[name] = []; 1099 el._x_attributeCleanups[name].push(callback); 1100 } 1101 function cleanupAttributes(el, names) { 1102 if (!el._x_attributeCleanups) 1103 return; 1104 Object.entries(el._x_attributeCleanups).forEach(([name, value]) => { 1105 if (names === void 0 || names.includes(name)) { 1106 value.forEach((i) => i()); 1107 delete el._x_attributeCleanups[name]; 1108 } 1109 }); 1110 } 1111 function cleanupElement(el) { 1112 el._x_effects?.forEach(dequeueJob); 1113 while (el._x_cleanups?.length) 1114 el._x_cleanups.pop()(); 1115 } 1116 var observer = new MutationObserver(onMutate); 1117 var currentlyObserving = false; 1118 function startObservingMutations() { 1119 observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true }); 1120 currentlyObserving = true; 1121 } 1122 function stopObservingMutations() { 1123 flushObserver(); 1124 observer.disconnect(); 1125 currentlyObserving = false; 1126 } 1127 var queuedMutations = []; 1128 function flushObserver() { 1129 let records = observer.takeRecords(); 1130 queuedMutations.push(() => records.length > 0 && onMutate(records)); 1131 let queueLengthWhenTriggered = queuedMutations.length; 1132 queueMicrotask(() => { 1133 if (queuedMutations.length === queueLengthWhenTriggered) { 1134 while (queuedMutations.length > 0) 1135 queuedMutations.shift()(); 1136 } 1137 }); 1138 } 1139 function mutateDom(callback) { 1140 if (!currentlyObserving) 1141 return callback(); 1142 stopObservingMutations(); 1143 let result = callback(); 1144 startObservingMutations(); 1145 return result; 1146 } 1147 var isCollecting = false; 1148 var deferredMutations = []; 1149 function deferMutations() { 1150 isCollecting = true; 1151 } 1152 function flushAndStopDeferringMutations() { 1153 isCollecting = false; 1154 onMutate(deferredMutations); 1155 deferredMutations = []; 1156 } 1157 function onMutate(mutations) { 1158 if (isCollecting) { 1159 deferredMutations = deferredMutations.concat(mutations); 1160 return; 1161 } 1162 let addedNodes = []; 1163 let removedNodes = /* @__PURE__ */ new Set(); 1164 let addedAttributes = /* @__PURE__ */ new Map(); 1165 let removedAttributes = /* @__PURE__ */ new Map(); 1166 for (let i = 0; i < mutations.length; i++) { 1167 if (mutations[i].target._x_ignoreMutationObserver) 1168 continue; 1169 if (mutations[i].type === "childList") { 1170 mutations[i].removedNodes.forEach((node) => { 1171 if (node.nodeType !== 1) 1172 return; 1173 if (!node._x_marker) 1174 return; 1175 removedNodes.add(node); 1176 }); 1177 mutations[i].addedNodes.forEach((node) => { 1178 if (node.nodeType !== 1) 1179 return; 1180 if (removedNodes.has(node)) { 1181 removedNodes.delete(node); 1182 return; 1183 } 1184 if (node._x_marker) 1185 return; 1186 addedNodes.push(node); 1187 }); 1188 } 1189 if (mutations[i].type === "attributes") { 1190 let el = mutations[i].target; 1191 let name = mutations[i].attributeName; 1192 let oldValue = mutations[i].oldValue; 1193 let add2 = () => { 1194 if (!addedAttributes.has(el)) 1195 addedAttributes.set(el, []); 1196 addedAttributes.get(el).push({ name, value: el.getAttribute(name) }); 1197 }; 1198 let remove = () => { 1199 if (!removedAttributes.has(el)) 1200 removedAttributes.set(el, []); 1201 removedAttributes.get(el).push(name); 1202 }; 1203 if (el.hasAttribute(name) && oldValue === null) { 1204 add2(); 1205 } else if (el.hasAttribute(name)) { 1206 remove(); 1207 add2(); 1208 } else { 1209 remove(); 1210 } 1211 } 1212 } 1213 removedAttributes.forEach((attrs, el) => { 1214 cleanupAttributes(el, attrs); 1215 }); 1216 addedAttributes.forEach((attrs, el) => { 1217 onAttributeAddeds.forEach((i) => i(el, attrs)); 1218 }); 1219 for (let node of removedNodes) { 1220 if (addedNodes.some((i) => i.contains(node))) 1221 continue; 1222 onElRemoveds.forEach((i) => i(node)); 1223 } 1224 for (let node of addedNodes) { 1225 if (!node.isConnected) 1226 continue; 1227 onElAddeds.forEach((i) => i(node)); 1228 } 1229 addedNodes = null; 1230 removedNodes = null; 1231 addedAttributes = null; 1232 removedAttributes = null; 1233 } 1234 function scope(node) { 1235 return mergeProxies(closestDataStack(node)); 1236 } 1237 function addScopeToNode(node, data2, referenceNode) { 1238 node._x_dataStack = [data2, ...closestDataStack(referenceNode || node)]; 1239 return () => { 1240 node._x_dataStack = node._x_dataStack.filter((i) => i !== data2); 1241 }; 1242 } 1243 function closestDataStack(node) { 1244 if (node._x_dataStack) 1245 return node._x_dataStack; 1246 if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) { 1247 return closestDataStack(node.host); 1248 } 1249 if (!node.parentNode) { 1250 return []; 1251 } 1252 return closestDataStack(node.parentNode); 1253 } 1254 function mergeProxies(objects) { 1255 return new Proxy({ objects }, mergeProxyTrap); 1256 } 1257 function keyInPrototypeChain(obj, key) { 1258 if (obj === null || obj === Object.prototype) 1259 return null; 1260 if (Object.prototype.hasOwnProperty.call(obj, key)) 1261 return obj; 1262 return keyInPrototypeChain(Object.getPrototypeOf(obj), key); 1263 } 1264 var mergeProxyTrap = { 1265 ownKeys({ objects }) { 1266 return Array.from( 1267 new Set(objects.flatMap((i) => Object.keys(i))) 1268 ); 1269 }, 1270 has({ objects }, name) { 1271 if (name == Symbol.unscopables) 1272 return false; 1273 return objects.some( 1274 (obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name) 1275 ); 1276 }, 1277 get({ objects }, name, thisProxy) { 1278 if (name == "toJSON") 1279 return collapseProxies; 1280 return Reflect.get( 1281 objects.find( 1282 (obj) => Reflect.has(obj, name) 1283 ) || {}, 1284 name, 1285 thisProxy 1286 ); 1287 }, 1288 set({ objects }, name, value, thisProxy) { 1289 let target; 1290 for (const obj of objects) { 1291 target = keyInPrototypeChain(obj, name); 1292 if (target) 1293 break; 1294 } 1295 if (!target) 1296 target = objects[objects.length - 1]; 1297 const descriptor = Object.getOwnPropertyDescriptor(target, name); 1298 if (descriptor?.set && descriptor?.get) 1299 return descriptor.set.call(thisProxy, value) || true; 1300 return Reflect.set(target, name, value); 1301 } 1302 }; 1303 function collapseProxies() { 1304 let keys = Reflect.ownKeys(this); 1305 return keys.reduce((acc, key) => { 1306 acc[key] = Reflect.get(this, key); 1307 return acc; 1308 }, {}); 1309 } 1310 function initInterceptors(data2) { 1311 let isObject3 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null; 1312 let recurse = (obj, basePath = "") => { 1313 Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => { 1314 if (enumerable === false || value === void 0) 1315 return; 1316 if (typeof value === "object" && value !== null && value.__v_skip) 1317 return; 1318 let path = basePath === "" ? key : `${basePath}.${key}`; 1319 if (typeof value === "object" && value !== null && value._x_interceptor) { 1320 obj[key] = value.initialize(data2, path, key); 1321 } else { 1322 if (isObject3(value) && value !== obj && !(value instanceof Element)) { 1323 recurse(value, path); 1324 } 1325 } 1326 }); 1327 }; 1328 return recurse(data2); 1329 } 1330 function interceptor(callback, mutateObj = () => { 1331 }) { 1332 let obj = { 1333 initialValue: void 0, 1334 _x_interceptor: true, 1335 initialize(data2, path, key) { 1336 return callback(this.initialValue, () => get(data2, path), (value) => set(data2, path, value), path, key); 1337 } 1338 }; 1339 mutateObj(obj); 1340 return (initialValue) => { 1341 if (typeof initialValue === "object" && initialValue !== null && initialValue._x_interceptor) { 1342 let initialize = obj.initialize.bind(obj); 1343 obj.initialize = (data2, path, key) => { 1344 let innerValue = initialValue.initialize(data2, path, key); 1345 obj.initialValue = innerValue; 1346 return initialize(data2, path, key); 1347 }; 1348 } else { 1349 obj.initialValue = initialValue; 1350 } 1351 return obj; 1352 }; 1353 } 1354 function get(obj, path) { 1355 return path.split(".").reduce((carry, segment) => carry[segment], obj); 1356 } 1357 function set(obj, path, value) { 1358 if (typeof path === "string") 1359 path = path.split("."); 1360 if (path.length === 1) 1361 obj[path[0]] = value; 1362 else if (path.length === 0) 1363 throw error; 1364 else { 1365 if (obj[path[0]]) 1366 return set(obj[path[0]], path.slice(1), value); 1367 else { 1368 obj[path[0]] = {}; 1369 return set(obj[path[0]], path.slice(1), value); 1370 } 1371 } 1372 } 1373 var magics = {}; 1374 function magic(name, callback) { 1375 magics[name] = callback; 1376 } 1377 function injectMagics(obj, el) { 1378 let memoizedUtilities = getUtilities(el); 1379 Object.entries(magics).forEach(([name, callback]) => { 1380 Object.defineProperty(obj, `$${name}`, { 1381 get() { 1382 return callback(el, memoizedUtilities); 1383 }, 1384 enumerable: false 1385 }); 1386 }); 1387 return obj; 1388 } 1389 function getUtilities(el) { 1390 let [utilities, cleanup2] = getElementBoundUtilities(el); 1391 let utils = { interceptor, ...utilities }; 1392 onElRemoved(el, cleanup2); 1393 return utils; 1394 } 1395 function tryCatch(el, expression, callback, ...args) { 1396 try { 1397 return callback(...args); 1398 } catch (e) { 1399 handleError(e, el, expression); 1400 } 1401 } 1402 function handleError(...args) { 1403 return errorHandler(...args); 1404 } 1405 var errorHandler = normalErrorHandler; 1406 function setErrorHandler(handler4) { 1407 errorHandler = handler4; 1408 } 1409 function normalErrorHandler(error2, el, expression = void 0) { 1410 error2 = Object.assign( 1411 error2 ?? { message: "No error message given." }, 1412 { el, expression } 1413 ); 1414 console.warn(`Alpine Expression Error: ${error2.message} 1415 1416${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); 1417 setTimeout(() => { 1418 throw error2; 1419 }, 0); 1420 } 1421 var shouldAutoEvaluateFunctions = true; 1422 function dontAutoEvaluateFunctions(callback) { 1423 let cache = shouldAutoEvaluateFunctions; 1424 shouldAutoEvaluateFunctions = false; 1425 let result = callback(); 1426 shouldAutoEvaluateFunctions = cache; 1427 return result; 1428 } 1429 function evaluate(el, expression, extras = {}) { 1430 let result; 1431 evaluateLater(el, expression)((value) => result = value, extras); 1432 return result; 1433 } 1434 function evaluateLater(...args) { 1435 return theEvaluatorFunction(...args); 1436 } 1437 var theEvaluatorFunction = () => { 1438 }; 1439 function setEvaluator(newEvaluator) { 1440 theEvaluatorFunction = newEvaluator; 1441 } 1442 var theRawEvaluatorFunction; 1443 function setRawEvaluator(newEvaluator) { 1444 theRawEvaluatorFunction = newEvaluator; 1445 } 1446 function normalEvaluator(el, expression) { 1447 let overriddenMagics = {}; 1448 injectMagics(overriddenMagics, el); 1449 let dataStack = [overriddenMagics, ...closestDataStack(el)]; 1450 let evaluator = typeof expression === "function" ? generateEvaluatorFromFunction(dataStack, expression) : generateEvaluatorFromString(dataStack, expression, el); 1451 return tryCatch.bind(null, el, expression, evaluator); 1452 } 1453 function generateEvaluatorFromFunction(dataStack, func) { 1454 return (receiver = () => { 1455 }, { scope: scope2 = {}, params = [], context } = {}) => { 1456 if (!shouldAutoEvaluateFunctions) { 1457 runIfTypeOfFunction(receiver, func, mergeProxies([scope2, ...dataStack]), params); 1458 return; 1459 } 1460 let result = func.apply(mergeProxies([scope2, ...dataStack]), params); 1461 runIfTypeOfFunction(receiver, result); 1462 }; 1463 } 1464 var evaluatorMemo = {}; 1465 function generateFunctionFromString(expression, el) { 1466 if (evaluatorMemo[expression]) { 1467 return evaluatorMemo[expression]; 1468 } 1469 let AsyncFunction = Object.getPrototypeOf(async function() { 1470 }).constructor; 1471 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; 1472 const safeAsyncFunction = () => { 1473 try { 1474 let func2 = new AsyncFunction( 1475 ["__self", "scope"], 1476 `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;` 1477 ); 1478 Object.defineProperty(func2, "name", { 1479 value: `[Alpine] ${expression}` 1480 }); 1481 return func2; 1482 } catch (error2) { 1483 handleError(error2, el, expression); 1484 return Promise.resolve(); 1485 } 1486 }; 1487 let func = safeAsyncFunction(); 1488 evaluatorMemo[expression] = func; 1489 return func; 1490 } 1491 function generateEvaluatorFromString(dataStack, expression, el) { 1492 let func = generateFunctionFromString(expression, el); 1493 return (receiver = () => { 1494 }, { scope: scope2 = {}, params = [], context } = {}) => { 1495 func.result = void 0; 1496 func.finished = false; 1497 let completeScope = mergeProxies([scope2, ...dataStack]); 1498 if (typeof func === "function") { 1499 let promise = func.call(context, func, completeScope).catch((error2) => handleError(error2, el, expression)); 1500 if (func.finished) { 1501 runIfTypeOfFunction(receiver, func.result, completeScope, params, el); 1502 func.result = void 0; 1503 } else { 1504 promise.then((result) => { 1505 runIfTypeOfFunction(receiver, result, completeScope, params, el); 1506 }).catch((error2) => handleError(error2, el, expression)).finally(() => func.result = void 0); 1507 } 1508 } 1509 }; 1510 } 1511 function runIfTypeOfFunction(receiver, value, scope2, params, el) { 1512 if (shouldAutoEvaluateFunctions && typeof value === "function") { 1513 let result = value.apply(scope2, params); 1514 if (result instanceof Promise) { 1515 result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value)); 1516 } else { 1517 receiver(result); 1518 } 1519 } else if (typeof value === "object" && value instanceof Promise) { 1520 value.then((i) => receiver(i)); 1521 } else { 1522 receiver(value); 1523 } 1524 } 1525 function evaluateRaw(...args) { 1526 return theRawEvaluatorFunction(...args); 1527 } 1528 function normalRawEvaluator(el, expression, extras = {}) { 1529 let overriddenMagics = {}; 1530 injectMagics(overriddenMagics, el); 1531 let dataStack = [overriddenMagics, ...closestDataStack(el)]; 1532 let scope2 = mergeProxies([extras.scope ?? {}, ...dataStack]); 1533 let params = extras.params ?? []; 1534 if (expression.includes("await")) { 1535 let AsyncFunction = Object.getPrototypeOf(async function() { 1536 }).constructor; 1537 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; 1538 let func = new AsyncFunction( 1539 ["scope"], 1540 `with (scope) { let __result = ${rightSideSafeExpression}; return __result }` 1541 ); 1542 let result = func.call(extras.context, scope2); 1543 return result; 1544 } else { 1545 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(()=>{ ${expression} })()` : expression; 1546 let func = new Function( 1547 ["scope"], 1548 `with (scope) { let __result = ${rightSideSafeExpression}; return __result }` 1549 ); 1550 let result = func.call(extras.context, scope2); 1551 if (typeof result === "function" && shouldAutoEvaluateFunctions) { 1552 return result.apply(scope2, params); 1553 } 1554 return result; 1555 } 1556 } 1557 var prefixAsString = "x-"; 1558 function prefix(subject = "") { 1559 return prefixAsString + subject; 1560 } 1561 function setPrefix(newPrefix) { 1562 prefixAsString = newPrefix; 1563 } 1564 var directiveHandlers = {}; 1565 function directive(name, callback) { 1566 directiveHandlers[name] = callback; 1567 return { 1568 before(directive22) { 1569 if (!directiveHandlers[directive22]) { 1570 console.warn(String.raw`Cannot find directive \`${directive22}\`. \`${name}\` will use the default order of execution`); 1571 return; 1572 } 1573 const pos = directiveOrder.indexOf(directive22); 1574 directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name); 1575 } 1576 }; 1577 } 1578 function directiveExists(name) { 1579 return Object.keys(directiveHandlers).includes(name); 1580 } 1581 function directives(el, attributes, originalAttributeOverride) { 1582 attributes = Array.from(attributes); 1583 if (el._x_virtualDirectives) { 1584 let vAttributes = Object.entries(el._x_virtualDirectives).map(([name, value]) => ({ name, value })); 1585 let staticAttributes = attributesOnly(vAttributes); 1586 vAttributes = vAttributes.map((attribute) => { 1587 if (staticAttributes.find((attr) => attr.name === attribute.name)) { 1588 return { 1589 name: `x-bind:${attribute.name}`, 1590 value: `"${attribute.value}"` 1591 }; 1592 } 1593 return attribute; 1594 }); 1595 attributes = attributes.concat(vAttributes); 1596 } 1597 let transformedAttributeMap = {}; 1598 let directives2 = attributes.map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority); 1599 return directives2.map((directive22) => { 1600 return getDirectiveHandler(el, directive22); 1601 }); 1602 } 1603 function attributesOnly(attributes) { 1604 return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr)); 1605 } 1606 var isDeferringHandlers = false; 1607 var directiveHandlerStacks = /* @__PURE__ */ new Map(); 1608 var currentHandlerStackKey = Symbol(); 1609 function deferHandlingDirectives(callback) { 1610 isDeferringHandlers = true; 1611 let key = Symbol(); 1612 currentHandlerStackKey = key; 1613 directiveHandlerStacks.set(key, []); 1614 let flushHandlers = () => { 1615 while (directiveHandlerStacks.get(key).length) 1616 directiveHandlerStacks.get(key).shift()(); 1617 directiveHandlerStacks.delete(key); 1618 }; 1619 let stopDeferring = () => { 1620 isDeferringHandlers = false; 1621 flushHandlers(); 1622 }; 1623 callback(flushHandlers); 1624 stopDeferring(); 1625 } 1626 function getElementBoundUtilities(el) { 1627 let cleanups2 = []; 1628 let cleanup2 = (callback) => cleanups2.push(callback); 1629 let [effect3, cleanupEffect] = elementBoundEffect(el); 1630 cleanups2.push(cleanupEffect); 1631 let utilities = { 1632 Alpine: alpine_default, 1633 effect: effect3, 1634 cleanup: cleanup2, 1635 evaluateLater: evaluateLater.bind(evaluateLater, el), 1636 evaluate: evaluate.bind(evaluate, el) 1637 }; 1638 let doCleanup = () => cleanups2.forEach((i) => i()); 1639 return [utilities, doCleanup]; 1640 } 1641 function getDirectiveHandler(el, directive22) { 1642 let noop = () => { 1643 }; 1644 let handler4 = directiveHandlers[directive22.type] || noop; 1645 let [utilities, cleanup2] = getElementBoundUtilities(el); 1646 onAttributeRemoved(el, directive22.original, cleanup2); 1647 let fullHandler = () => { 1648 if (el._x_ignore || el._x_ignoreSelf) 1649 return; 1650 handler4.inline && handler4.inline(el, directive22, utilities); 1651 handler4 = handler4.bind(handler4, el, directive22, utilities); 1652 isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4(); 1653 }; 1654 fullHandler.runCleanups = cleanup2; 1655 return fullHandler; 1656 } 1657 var startingWith = (subject, replacement) => ({ name, value }) => { 1658 if (name.startsWith(subject)) 1659 name = name.replace(subject, replacement); 1660 return { name, value }; 1661 }; 1662 var into = (i) => i; 1663 function toTransformedAttributes(callback = () => { 1664 }) { 1665 return ({ name, value }) => { 1666 let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => { 1667 return transform(carry); 1668 }, { name, value }); 1669 if (newName !== name) 1670 callback(newName, name); 1671 return { name: newName, value: newValue }; 1672 }; 1673 } 1674 var attributeTransformers = []; 1675 function mapAttributes(callback) { 1676 attributeTransformers.push(callback); 1677 } 1678 function outNonAlpineAttributes({ name }) { 1679 return alpineAttributeRegex().test(name); 1680 } 1681 var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`); 1682 function toParsedDirectives(transformedAttributeMap, originalAttributeOverride) { 1683 return ({ name, value }) => { 1684 if (name === value) 1685 value = ""; 1686 let typeMatch = name.match(alpineAttributeRegex()); 1687 let valueMatch = name.match(/:([a-zA-Z0-9\-_:]+)/); 1688 let modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || []; 1689 let original = originalAttributeOverride || transformedAttributeMap[name] || name; 1690 return { 1691 type: typeMatch ? typeMatch[1] : null, 1692 value: valueMatch ? valueMatch[1] : null, 1693 modifiers: modifiers.map((i) => i.replace(".", "")), 1694 expression: value, 1695 original 1696 }; 1697 }; 1698 } 1699 var DEFAULT = "DEFAULT"; 1700 var directiveOrder = [ 1701 "ignore", 1702 "ref", 1703 "id", 1704 "data", 1705 "anchor", 1706 "bind", 1707 "init", 1708 "for", 1709 "model", 1710 "modelable", 1711 "transition", 1712 "show", 1713 "if", 1714 DEFAULT, 1715 "teleport" 1716 ]; 1717 function byPriority(a, b) { 1718 let typeA = directiveOrder.indexOf(a.type) === -1 ? DEFAULT : a.type; 1719 let typeB = directiveOrder.indexOf(b.type) === -1 ? DEFAULT : b.type; 1720 return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB); 1721 } 1722 function dispatch2(el, name, detail = {}, options = {}) { 1723 return el.dispatchEvent( 1724 new CustomEvent(name, { 1725 detail, 1726 bubbles: true, 1727 composed: true, 1728 cancelable: true, 1729 ...options 1730 }) 1731 ); 1732 } 1733 function walk(el, callback) { 1734 if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) { 1735 Array.from(el.children).forEach((el2) => walk(el2, callback)); 1736 return; 1737 } 1738 let skip = false; 1739 callback(el, () => skip = true); 1740 if (skip) 1741 return; 1742 let node = el.firstElementChild; 1743 while (node) { 1744 walk(node, callback, false); 1745 node = node.nextElementSibling; 1746 } 1747 } 1748 function warn(message, ...args) { 1749 console.warn(`Alpine Warning: ${message}`, ...args); 1750 } 1751 var started = false; 1752 function start() { 1753 if (started) 1754 warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."); 1755 started = true; 1756 if (!document.body) 1757 warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"); 1758 dispatch2(document, "alpine:init"); 1759 dispatch2(document, "alpine:initializing"); 1760 startObservingMutations(); 1761 onElAdded((el) => initTree(el, walk)); 1762 onElRemoved((el) => destroyTree(el)); 1763 onAttributesAdded((el, attrs) => { 1764 directives(el, attrs).forEach((handle) => handle()); 1765 }); 1766 let outNestedComponents = (el) => !closestRoot(el.parentElement, true); 1767 Array.from(document.querySelectorAll(allSelectors().join(","))).filter(outNestedComponents).forEach((el) => { 1768 initTree(el); 1769 }); 1770 dispatch2(document, "alpine:initialized"); 1771 setTimeout(() => { 1772 warnAboutMissingPlugins(); 1773 }); 1774 } 1775 var rootSelectorCallbacks = []; 1776 var initSelectorCallbacks = []; 1777 function rootSelectors() { 1778 return rootSelectorCallbacks.map((fn) => fn()); 1779 } 1780 function allSelectors() { 1781 return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn()); 1782 } 1783 function addRootSelector(selectorCallback) { 1784 rootSelectorCallbacks.push(selectorCallback); 1785 } 1786 function addInitSelector(selectorCallback) { 1787 initSelectorCallbacks.push(selectorCallback); 1788 } 1789 function closestRoot(el, includeInitSelectors = false) { 1790 return findClosest(el, (element) => { 1791 const selectors = includeInitSelectors ? allSelectors() : rootSelectors(); 1792 if (selectors.some((selector) => element.matches(selector))) 1793 return true; 1794 }); 1795 } 1796 function findClosest(el, callback) { 1797 if (!el) 1798 return; 1799 if (callback(el)) 1800 return el; 1801 if (el._x_teleportBack) 1802 return findClosest(el._x_teleportBack, callback); 1803 if (el.parentNode instanceof ShadowRoot) { 1804 return findClosest(el.parentNode.host, callback); 1805 } 1806 if (!el.parentElement) 1807 return; 1808 return findClosest(el.parentElement, callback); 1809 } 1810 function isRoot(el) { 1811 return rootSelectors().some((selector) => el.matches(selector)); 1812 } 1813 var initInterceptors2 = []; 1814 function interceptInit(callback) { 1815 initInterceptors2.push(callback); 1816 } 1817 var markerDispenser = 1; 1818 function initTree(el, walker = walk, intercept = () => { 1819 }) { 1820 if (findClosest(el, (i) => i._x_ignore)) 1821 return; 1822 deferHandlingDirectives(() => { 1823 walker(el, (el2, skip) => { 1824 if (el2._x_marker) 1825 return; 1826 intercept(el2, skip); 1827 initInterceptors2.forEach((i) => i(el2, skip)); 1828 directives(el2, el2.attributes).forEach((handle) => handle()); 1829 if (!el2._x_ignore) 1830 el2._x_marker = markerDispenser++; 1831 el2._x_ignore && skip(); 1832 }); 1833 }); 1834 } 1835 function destroyTree(root, walker = walk) { 1836 walker(root, (el) => { 1837 cleanupElement(el); 1838 cleanupAttributes(el); 1839 delete el._x_marker; 1840 }); 1841 } 1842 function warnAboutMissingPlugins() { 1843 let pluginDirectives = [ 1844 ["ui", "dialog", ["[x-dialog], [x-popover]"]], 1845 ["anchor", "anchor", ["[x-anchor]"]], 1846 ["sort", "sort", ["[x-sort]"]] 1847 ]; 1848 pluginDirectives.forEach(([plugin2, directive22, selectors]) => { 1849 if (directiveExists(directive22)) 1850 return; 1851 selectors.some((selector) => { 1852 if (document.querySelector(selector)) { 1853 warn(`found "${selector}", but missing ${plugin2} plugin`); 1854 return true; 1855 } 1856 }); 1857 }); 1858 } 1859 var tickStack = []; 1860 var isHolding = false; 1861 function nextTick(callback = () => { 1862 }) { 1863 queueMicrotask(() => { 1864 isHolding || setTimeout(() => { 1865 releaseNextTicks(); 1866 }); 1867 }); 1868 return new Promise((res) => { 1869 tickStack.push(() => { 1870 callback(); 1871 res(); 1872 }); 1873 }); 1874 } 1875 function releaseNextTicks() { 1876 isHolding = false; 1877 while (tickStack.length) 1878 tickStack.shift()(); 1879 } 1880 function holdNextTicks() { 1881 isHolding = true; 1882 } 1883 function setClasses(el, value) { 1884 if (Array.isArray(value)) { 1885 return setClassesFromString(el, value.join(" ")); 1886 } else if (typeof value === "object" && value !== null) { 1887 return setClassesFromObject(el, value); 1888 } else if (typeof value === "function") { 1889 return setClasses(el, value()); 1890 } 1891 return setClassesFromString(el, value); 1892 } 1893 function splitClasses(classString) { 1894 return classString.split(/\s/).filter(Boolean); 1895 } 1896 function setClassesFromString(el, classString) { 1897 let missingClasses = (classString2) => splitClasses(classString2).filter((i) => !el.classList.contains(i)).filter(Boolean); 1898 let addClassesAndReturnUndo = (classes) => { 1899 el.classList.add(...classes); 1900 return () => { 1901 el.classList.remove(...classes); 1902 }; 1903 }; 1904 classString = classString === true ? classString = "" : classString || ""; 1905 return addClassesAndReturnUndo(missingClasses(classString)); 1906 } 1907 function setClassesFromObject(el, classObject) { 1908 let forAdd = Object.entries(classObject).flatMap(([classString, bool]) => bool ? splitClasses(classString) : false).filter(Boolean); 1909 let forRemove = Object.entries(classObject).flatMap(([classString, bool]) => !bool ? splitClasses(classString) : false).filter(Boolean); 1910 let added = []; 1911 let removed = []; 1912 forRemove.forEach((i) => { 1913 if (el.classList.contains(i)) { 1914 el.classList.remove(i); 1915 removed.push(i); 1916 } 1917 }); 1918 forAdd.forEach((i) => { 1919 if (!el.classList.contains(i)) { 1920 el.classList.add(i); 1921 added.push(i); 1922 } 1923 }); 1924 return () => { 1925 removed.forEach((i) => el.classList.add(i)); 1926 added.forEach((i) => el.classList.remove(i)); 1927 }; 1928 } 1929 function setStyles(el, value) { 1930 if (typeof value === "object" && value !== null) { 1931 return setStylesFromObject(el, value); 1932 } 1933 return setStylesFromString(el, value); 1934 } 1935 function setStylesFromObject(el, value) { 1936 let previousStyles = {}; 1937 Object.entries(value).forEach(([key, value2]) => { 1938 previousStyles[key] = el.style[key]; 1939 if (!key.startsWith("--")) { 1940 key = kebabCase(key); 1941 } 1942 el.style.setProperty(key, value2); 1943 }); 1944 setTimeout(() => { 1945 if (el.style.length === 0) { 1946 el.removeAttribute("style"); 1947 } 1948 }); 1949 return () => { 1950 setStyles(el, previousStyles); 1951 }; 1952 } 1953 function setStylesFromString(el, value) { 1954 let cache = el.getAttribute("style", value); 1955 el.setAttribute("style", value); 1956 return () => { 1957 el.setAttribute("style", cache || ""); 1958 }; 1959 } 1960 function kebabCase(subject) { 1961 return subject.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 1962 } 1963 function once(callback, fallback2 = () => { 1964 }) { 1965 let called = false; 1966 return function() { 1967 if (!called) { 1968 called = true; 1969 callback.apply(this, arguments); 1970 } else { 1971 fallback2.apply(this, arguments); 1972 } 1973 }; 1974 } 1975 directive("transition", (el, { value, modifiers, expression }, { evaluate: evaluate22 }) => { 1976 if (typeof expression === "function") 1977 expression = evaluate22(expression); 1978 if (expression === false) 1979 return; 1980 if (!expression || typeof expression === "boolean") { 1981 registerTransitionsFromHelper(el, modifiers, value); 1982 } else { 1983 registerTransitionsFromClassString(el, expression, value); 1984 } 1985 }); 1986 function registerTransitionsFromClassString(el, classString, stage) { 1987 registerTransitionObject(el, setClasses, ""); 1988 let directiveStorageMap = { 1989 "enter": (classes) => { 1990 el._x_transition.enter.during = classes; 1991 }, 1992 "enter-start": (classes) => { 1993 el._x_transition.enter.start = classes; 1994 }, 1995 "enter-end": (classes) => { 1996 el._x_transition.enter.end = classes; 1997 }, 1998 "leave": (classes) => { 1999 el._x_transition.leave.during = classes; 2000 }, 2001 "leave-start": (classes) => { 2002 el._x_transition.leave.start = classes; 2003 }, 2004 "leave-end": (classes) => { 2005 el._x_transition.leave.end = classes; 2006 } 2007 }; 2008 directiveStorageMap[stage](classString); 2009 } 2010 function registerTransitionsFromHelper(el, modifiers, stage) { 2011 registerTransitionObject(el, setStyles); 2012 let doesntSpecify = !modifiers.includes("in") && !modifiers.includes("out") && !stage; 2013 let transitioningIn = doesntSpecify || modifiers.includes("in") || ["enter"].includes(stage); 2014 let transitioningOut = doesntSpecify || modifiers.includes("out") || ["leave"].includes(stage); 2015 if (modifiers.includes("in") && !doesntSpecify) { 2016 modifiers = modifiers.filter((i, index2) => index2 < modifiers.indexOf("out")); 2017 } 2018 if (modifiers.includes("out") && !doesntSpecify) { 2019 modifiers = modifiers.filter((i, index2) => index2 > modifiers.indexOf("out")); 2020 } 2021 let wantsAll = !modifiers.includes("opacity") && !modifiers.includes("scale"); 2022 let wantsOpacity = wantsAll || modifiers.includes("opacity"); 2023 let wantsScale = wantsAll || modifiers.includes("scale"); 2024 let opacityValue = wantsOpacity ? 0 : 1; 2025 let scaleValue = wantsScale ? modifierValue(modifiers, "scale", 95) / 100 : 1; 2026 let delay3 = modifierValue(modifiers, "delay", 0) / 1e3; 2027 let origin = modifierValue(modifiers, "origin", "center"); 2028 let property = "opacity, transform"; 2029 let durationIn = modifierValue(modifiers, "duration", 150) / 1e3; 2030 let durationOut = modifierValue(modifiers, "duration", 75) / 1e3; 2031 let easing = `cubic-bezier(0.4, 0.0, 0.2, 1)`; 2032 if (transitioningIn) { 2033 el._x_transition.enter.during = { 2034 transformOrigin: origin, 2035 transitionDelay: `${delay3}s`, 2036 transitionProperty: property, 2037 transitionDuration: `${durationIn}s`, 2038 transitionTimingFunction: easing 2039 }; 2040 el._x_transition.enter.start = { 2041 opacity: opacityValue, 2042 transform: `scale(${scaleValue})` 2043 }; 2044 el._x_transition.enter.end = { 2045 opacity: 1, 2046 transform: `scale(1)` 2047 }; 2048 } 2049 if (transitioningOut) { 2050 el._x_transition.leave.during = { 2051 transformOrigin: origin, 2052 transitionDelay: `${delay3}s`, 2053 transitionProperty: property, 2054 transitionDuration: `${durationOut}s`, 2055 transitionTimingFunction: easing 2056 }; 2057 el._x_transition.leave.start = { 2058 opacity: 1, 2059 transform: `scale(1)` 2060 }; 2061 el._x_transition.leave.end = { 2062 opacity: opacityValue, 2063 transform: `scale(${scaleValue})` 2064 }; 2065 } 2066 } 2067 function registerTransitionObject(el, setFunction, defaultValue = {}) { 2068 if (!el._x_transition) 2069 el._x_transition = { 2070 enter: { during: defaultValue, start: defaultValue, end: defaultValue }, 2071 leave: { during: defaultValue, start: defaultValue, end: defaultValue }, 2072 in(before = () => { 2073 }, after = () => { 2074 }) { 2075 transition(el, setFunction, { 2076 during: this.enter.during, 2077 start: this.enter.start, 2078 end: this.enter.end 2079 }, before, after); 2080 }, 2081 out(before = () => { 2082 }, after = () => { 2083 }) { 2084 transition(el, setFunction, { 2085 during: this.leave.during, 2086 start: this.leave.start, 2087 end: this.leave.end 2088 }, before, after); 2089 } 2090 }; 2091 } 2092 window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) { 2093 const nextTick2 = document.visibilityState === "visible" ? requestAnimationFrame : setTimeout; 2094 let clickAwayCompatibleShow = () => nextTick2(show); 2095 if (value) { 2096 if (el._x_transition && (el._x_transition.enter || el._x_transition.leave)) { 2097 el._x_transition.enter && (Object.entries(el._x_transition.enter.during).length || Object.entries(el._x_transition.enter.start).length || Object.entries(el._x_transition.enter.end).length) ? el._x_transition.in(show) : clickAwayCompatibleShow(); 2098 } else { 2099 el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow(); 2100 } 2101 return; 2102 } 2103 el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => { 2104 el._x_transition.out(() => { 2105 }, () => resolve(hide)); 2106 el._x_transitioning && el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true })); 2107 }) : Promise.resolve(hide); 2108 queueMicrotask(() => { 2109 let closest2 = closestHide(el); 2110 if (closest2) { 2111 if (!closest2._x_hideChildren) 2112 closest2._x_hideChildren = []; 2113 closest2._x_hideChildren.push(el); 2114 } else { 2115 nextTick2(() => { 2116 let hideAfterChildren = (el2) => { 2117 let carry = Promise.all([ 2118 el2._x_hidePromise, 2119 ...(el2._x_hideChildren || []).map(hideAfterChildren) 2120 ]).then(([i]) => i?.()); 2121 delete el2._x_hidePromise; 2122 delete el2._x_hideChildren; 2123 return carry; 2124 }; 2125 hideAfterChildren(el).catch((e) => { 2126 if (!e.isFromCancelledTransition) 2127 throw e; 2128 }); 2129 }); 2130 } 2131 }); 2132 }; 2133 function closestHide(el) { 2134 let parent = el.parentNode; 2135 if (!parent) 2136 return; 2137 return parent._x_hidePromise ? parent : closestHide(parent); 2138 } 2139 function transition(el, setFunction, { during, start: start22, end } = {}, before = () => { 2140 }, after = () => { 2141 }) { 2142 if (el._x_transitioning) 2143 el._x_transitioning.cancel(); 2144 if (Object.keys(during).length === 0 && Object.keys(start22).length === 0 && Object.keys(end).length === 0) { 2145 before(); 2146 after(); 2147 return; 2148 } 2149 let undoStart, undoDuring, undoEnd; 2150 performTransition(el, { 2151 start() { 2152 undoStart = setFunction(el, start22); 2153 }, 2154 during() { 2155 undoDuring = setFunction(el, during); 2156 }, 2157 before, 2158 end() { 2159 undoStart(); 2160 undoEnd = setFunction(el, end); 2161 }, 2162 after, 2163 cleanup() { 2164 undoDuring(); 2165 undoEnd(); 2166 } 2167 }); 2168 } 2169 function performTransition(el, stages) { 2170 let interrupted, reachedBefore, reachedEnd; 2171 let finish = once(() => { 2172 mutateDom(() => { 2173 interrupted = true; 2174 if (!reachedBefore) 2175 stages.before(); 2176 if (!reachedEnd) { 2177 stages.end(); 2178 releaseNextTicks(); 2179 } 2180 stages.after(); 2181 if (el.isConnected) 2182 stages.cleanup(); 2183 delete el._x_transitioning; 2184 }); 2185 }); 2186 el._x_transitioning = { 2187 beforeCancels: [], 2188 beforeCancel(callback) { 2189 this.beforeCancels.push(callback); 2190 }, 2191 cancel: once(function() { 2192 while (this.beforeCancels.length) { 2193 this.beforeCancels.shift()(); 2194 } 2195 ; 2196 finish(); 2197 }), 2198 finish 2199 }; 2200 mutateDom(() => { 2201 stages.start(); 2202 stages.during(); 2203 }); 2204 holdNextTicks(); 2205 requestAnimationFrame(() => { 2206 if (interrupted) 2207 return; 2208 let duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, "").replace("s", "")) * 1e3; 2209 let delay3 = Number(getComputedStyle(el).transitionDelay.replace(/,.*/, "").replace("s", "")) * 1e3; 2210 if (duration === 0) 2211 duration = Number(getComputedStyle(el).animationDuration.replace("s", "")) * 1e3; 2212 mutateDom(() => { 2213 stages.before(); 2214 }); 2215 reachedBefore = true; 2216 requestAnimationFrame(() => { 2217 if (interrupted) 2218 return; 2219 mutateDom(() => { 2220 stages.end(); 2221 }); 2222 releaseNextTicks(); 2223 setTimeout(el._x_transitioning.finish, duration + delay3); 2224 reachedEnd = true; 2225 }); 2226 }); 2227 } 2228 function modifierValue(modifiers, key, fallback2) { 2229 if (modifiers.indexOf(key) === -1) 2230 return fallback2; 2231 const rawValue = modifiers[modifiers.indexOf(key) + 1]; 2232 if (!rawValue) 2233 return fallback2; 2234 if (key === "scale") { 2235 if (isNaN(rawValue)) 2236 return fallback2; 2237 } 2238 if (key === "duration" || key === "delay") { 2239 let match = rawValue.match(/([0-9]+)ms/); 2240 if (match) 2241 return match[1]; 2242 } 2243 if (key === "origin") { 2244 if (["top", "right", "left", "center", "bottom"].includes(modifiers[modifiers.indexOf(key) + 2])) { 2245 return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(" "); 2246 } 2247 } 2248 return rawValue; 2249 } 2250 var isCloning = false; 2251 function skipDuringClone(callback, fallback2 = () => { 2252 }) { 2253 return (...args) => isCloning ? fallback2(...args) : callback(...args); 2254 } 2255 function onlyDuringClone(callback) { 2256 return (...args) => isCloning && callback(...args); 2257 } 2258 var interceptors = []; 2259 function interceptClone(callback) { 2260 interceptors.push(callback); 2261 } 2262 function cloneNode(from, to) { 2263 interceptors.forEach((i) => i(from, to)); 2264 isCloning = true; 2265 dontRegisterReactiveSideEffects(() => { 2266 initTree(to, (el, callback) => { 2267 callback(el, () => { 2268 }); 2269 }); 2270 }); 2271 isCloning = false; 2272 } 2273 var isCloningLegacy = false; 2274 function clone(oldEl, newEl) { 2275 if (!newEl._x_dataStack) 2276 newEl._x_dataStack = oldEl._x_dataStack; 2277 isCloning = true; 2278 isCloningLegacy = true; 2279 dontRegisterReactiveSideEffects(() => { 2280 cloneTree(newEl); 2281 }); 2282 isCloning = false; 2283 isCloningLegacy = false; 2284 } 2285 function cloneTree(el) { 2286 let hasRunThroughFirstEl = false; 2287 let shallowWalker = (el2, callback) => { 2288 walk(el2, (el3, skip) => { 2289 if (hasRunThroughFirstEl && isRoot(el3)) 2290 return skip(); 2291 hasRunThroughFirstEl = true; 2292 callback(el3, skip); 2293 }); 2294 }; 2295 initTree(el, shallowWalker); 2296 } 2297 function dontRegisterReactiveSideEffects(callback) { 2298 let cache = effect; 2299 overrideEffect((callback2, el) => { 2300 let storedEffect = cache(callback2); 2301 release(storedEffect); 2302 return () => { 2303 }; 2304 }); 2305 callback(); 2306 overrideEffect(cache); 2307 } 2308 function bind(el, name, value, modifiers = []) { 2309 if (!el._x_bindings) 2310 el._x_bindings = reactive({}); 2311 el._x_bindings[name] = value; 2312 name = modifiers.includes("camel") ? camelCase(name) : name; 2313 switch (name) { 2314 case "value": 2315 bindInputValue(el, value); 2316 break; 2317 case "style": 2318 bindStyles(el, value); 2319 break; 2320 case "class": 2321 bindClasses(el, value); 2322 break; 2323 case "selected": 2324 case "checked": 2325 bindAttributeAndProperty(el, name, value); 2326 break; 2327 default: 2328 bindAttribute(el, name, value); 2329 break; 2330 } 2331 } 2332 function bindInputValue(el, value) { 2333 if (isRadio(el)) { 2334 if (el.attributes.value === void 0) { 2335 el.value = value; 2336 } 2337 } else if (isCheckbox(el)) { 2338 if (Number.isInteger(value)) { 2339 el.value = value; 2340 } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { 2341 el.value = String(value); 2342 } else { 2343 if (Array.isArray(value)) { 2344 el.checked = value.some((val) => checkedAttrLooseCompare(val, el.value)); 2345 } else { 2346 el.checked = !!value; 2347 } 2348 } 2349 } else if (el.tagName === "SELECT") { 2350 updateSelect(el, value); 2351 } else { 2352 if (el.value === value) 2353 return; 2354 el.value = value === void 0 ? "" : value; 2355 } 2356 } 2357 function bindClasses(el, value) { 2358 if (el._x_undoAddedClasses) 2359 el._x_undoAddedClasses(); 2360 el._x_undoAddedClasses = setClasses(el, value); 2361 } 2362 function bindStyles(el, value) { 2363 if (el._x_undoAddedStyles) 2364 el._x_undoAddedStyles(); 2365 el._x_undoAddedStyles = setStyles(el, value); 2366 } 2367 function bindAttributeAndProperty(el, name, value) { 2368 bindAttribute(el, name, value); 2369 setPropertyIfChanged(el, name, value); 2370 } 2371 function bindAttribute(el, name, value) { 2372 if ([null, void 0, false].includes(value) && attributeShouldntBePreservedIfFalsy(name)) { 2373 el.removeAttribute(name); 2374 } else { 2375 if (isBooleanAttr(name)) 2376 value = name; 2377 setIfChanged(el, name, value); 2378 } 2379 } 2380 function setIfChanged(el, attrName, value) { 2381 if (el.getAttribute(attrName) != value) { 2382 el.setAttribute(attrName, value); 2383 } 2384 } 2385 function setPropertyIfChanged(el, propName, value) { 2386 if (el[propName] !== value) { 2387 el[propName] = value; 2388 } 2389 } 2390 function updateSelect(el, value) { 2391 const arrayWrappedValue = [].concat(value).map((value2) => { 2392 return value2 + ""; 2393 }); 2394 Array.from(el.options).forEach((option2) => { 2395 option2.selected = arrayWrappedValue.includes(option2.value); 2396 }); 2397 } 2398 function camelCase(subject) { 2399 return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase()); 2400 } 2401 function checkedAttrLooseCompare(valueA, valueB) { 2402 return valueA == valueB; 2403 } 2404 function safeParseBoolean(rawValue) { 2405 if ([1, "1", "true", "on", "yes", true].includes(rawValue)) { 2406 return true; 2407 } 2408 if ([0, "0", "false", "off", "no", false].includes(rawValue)) { 2409 return false; 2410 } 2411 return rawValue ? Boolean(rawValue) : null; 2412 } 2413 var booleanAttributes = /* @__PURE__ */ new Set([ 2414 "allowfullscreen", 2415 "async", 2416 "autofocus", 2417 "autoplay", 2418 "checked", 2419 "controls", 2420 "default", 2421 "defer", 2422 "disabled", 2423 "formnovalidate", 2424 "inert", 2425 "ismap", 2426 "itemscope", 2427 "loop", 2428 "multiple", 2429 "muted", 2430 "nomodule", 2431 "novalidate", 2432 "open", 2433 "playsinline", 2434 "readonly", 2435 "required", 2436 "reversed", 2437 "selected", 2438 "shadowrootclonable", 2439 "shadowrootdelegatesfocus", 2440 "shadowrootserializable" 2441 ]); 2442 function isBooleanAttr(attrName) { 2443 return booleanAttributes.has(attrName); 2444 } 2445 function attributeShouldntBePreservedIfFalsy(name) { 2446 return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(name); 2447 } 2448 function getBinding(el, name, fallback2) { 2449 if (el._x_bindings && el._x_bindings[name] !== void 0) 2450 return el._x_bindings[name]; 2451 return getAttributeBinding(el, name, fallback2); 2452 } 2453 function extractProp(el, name, fallback2, extract = true) { 2454 if (el._x_bindings && el._x_bindings[name] !== void 0) 2455 return el._x_bindings[name]; 2456 if (el._x_inlineBindings && el._x_inlineBindings[name] !== void 0) { 2457 let binding = el._x_inlineBindings[name]; 2458 binding.extract = extract; 2459 return dontAutoEvaluateFunctions(() => { 2460 return evaluate(el, binding.expression); 2461 }); 2462 } 2463 return getAttributeBinding(el, name, fallback2); 2464 } 2465 function getAttributeBinding(el, name, fallback2) { 2466 let attr = el.getAttribute(name); 2467 if (attr === null) 2468 return typeof fallback2 === "function" ? fallback2() : fallback2; 2469 if (attr === "") 2470 return true; 2471 if (isBooleanAttr(name)) { 2472 return !![name, "true"].includes(attr); 2473 } 2474 return attr; 2475 } 2476 function isCheckbox(el) { 2477 return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; 2478 } 2479 function isRadio(el) { 2480 return el.type === "radio" || el.localName === "ui-radio"; 2481 } 2482 function debounce(func, wait) { 2483 let timeout; 2484 return function() { 2485 const context = this, args = arguments; 2486 const later = function() { 2487 timeout = null; 2488 func.apply(context, args); 2489 }; 2490 clearTimeout(timeout); 2491 timeout = setTimeout(later, wait); 2492 }; 2493 } 2494 function throttle(func, limit) { 2495 let inThrottle; 2496 return function() { 2497 let context = this, args = arguments; 2498 if (!inThrottle) { 2499 func.apply(context, args); 2500 inThrottle = true; 2501 setTimeout(() => inThrottle = false, limit); 2502 } 2503 }; 2504 } 2505 function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) { 2506 let firstRun = true; 2507 let outerHash; 2508 let innerHash; 2509 let reference = effect(() => { 2510 let outer = outerGet(); 2511 let inner = innerGet(); 2512 if (firstRun) { 2513 innerSet(cloneIfObject(outer)); 2514 firstRun = false; 2515 } else { 2516 let outerHashLatest = JSON.stringify(outer); 2517 let innerHashLatest = JSON.stringify(inner); 2518 if (outerHashLatest !== outerHash) { 2519 innerSet(cloneIfObject(outer)); 2520 } else if (outerHashLatest !== innerHashLatest) { 2521 outerSet(cloneIfObject(inner)); 2522 } else { 2523 } 2524 } 2525 outerHash = JSON.stringify(outerGet()); 2526 innerHash = JSON.stringify(innerGet()); 2527 }); 2528 return () => { 2529 release(reference); 2530 }; 2531 } 2532 function cloneIfObject(value) { 2533 return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; 2534 } 2535 function plugin(callback) { 2536 let callbacks = Array.isArray(callback) ? callback : [callback]; 2537 callbacks.forEach((i) => i(alpine_default)); 2538 } 2539 var stores = {}; 2540 var isReactive = false; 2541 function store(name, value) { 2542 if (!isReactive) { 2543 stores = reactive(stores); 2544 isReactive = true; 2545 } 2546 if (value === void 0) { 2547 return stores[name]; 2548 } 2549 stores[name] = value; 2550 initInterceptors(stores[name]); 2551 if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") { 2552 stores[name].init(); 2553 } 2554 } 2555 function getStores() { 2556 return stores; 2557 } 2558 var binds = {}; 2559 function bind2(name, bindings) { 2560 let getBindings = typeof bindings !== "function" ? () => bindings : bindings; 2561 if (name instanceof Element) { 2562 return applyBindingsObject(name, getBindings()); 2563 } else { 2564 binds[name] = getBindings; 2565 } 2566 return () => { 2567 }; 2568 } 2569 function injectBindingProviders(obj) { 2570 Object.entries(binds).forEach(([name, callback]) => { 2571 Object.defineProperty(obj, name, { 2572 get() { 2573 return (...args) => { 2574 return callback(...args); 2575 }; 2576 } 2577 }); 2578 }); 2579 return obj; 2580 } 2581 function applyBindingsObject(el, obj, original) { 2582 let cleanupRunners = []; 2583 while (cleanupRunners.length) 2584 cleanupRunners.pop()(); 2585 let attributes = Object.entries(obj).map(([name, value]) => ({ name, value })); 2586 let staticAttributes = attributesOnly(attributes); 2587 attributes = attributes.map((attribute) => { 2588 if (staticAttributes.find((attr) => attr.name === attribute.name)) { 2589 return { 2590 name: `x-bind:${attribute.name}`, 2591 value: `"${attribute.value}"` 2592 }; 2593 } 2594 return attribute; 2595 }); 2596 directives(el, attributes, original).map((handle) => { 2597 cleanupRunners.push(handle.runCleanups); 2598 handle(); 2599 }); 2600 return () => { 2601 while (cleanupRunners.length) 2602 cleanupRunners.pop()(); 2603 }; 2604 } 2605 var datas = {}; 2606 function data(name, callback) { 2607 datas[name] = callback; 2608 } 2609 function injectDataProviders(obj, context) { 2610 Object.entries(datas).forEach(([name, callback]) => { 2611 Object.defineProperty(obj, name, { 2612 get() { 2613 return (...args) => { 2614 return callback.bind(context)(...args); 2615 }; 2616 }, 2617 enumerable: false 2618 }); 2619 }); 2620 return obj; 2621 } 2622 var Alpine2 = { 2623 get reactive() { 2624 return reactive; 2625 }, 2626 get release() { 2627 return release; 2628 }, 2629 get effect() { 2630 return effect; 2631 }, 2632 get raw() { 2633 return raw; 2634 }, 2635 get transaction() { 2636 return transaction; 2637 }, 2638 version: "3.15.12", 2639 flushAndStopDeferringMutations, 2640 dontAutoEvaluateFunctions, 2641 disableEffectScheduling, 2642 startObservingMutations, 2643 stopObservingMutations, 2644 setReactivityEngine, 2645 onAttributeRemoved, 2646 onAttributesAdded, 2647 closestDataStack, 2648 skipDuringClone, 2649 onlyDuringClone, 2650 addRootSelector, 2651 addInitSelector, 2652 setErrorHandler, 2653 interceptClone, 2654 addScopeToNode, 2655 deferMutations, 2656 mapAttributes, 2657 evaluateLater, 2658 interceptInit, 2659 initInterceptors, 2660 injectMagics, 2661 setEvaluator, 2662 setRawEvaluator, 2663 mergeProxies, 2664 extractProp, 2665 findClosest, 2666 onElRemoved, 2667 closestRoot, 2668 destroyTree, 2669 interceptor, 2670 transition, 2671 setStyles, 2672 mutateDom, 2673 directive, 2674 entangle, 2675 throttle, 2676 debounce, 2677 evaluate, 2678 evaluateRaw, 2679 initTree, 2680 nextTick, 2681 prefixed: prefix, 2682 prefix: setPrefix, 2683 plugin, 2684 magic, 2685 store, 2686 start, 2687 clone, 2688 cloneNode, 2689 bound: getBinding, 2690 $data: scope, 2691 watch, 2692 walk, 2693 data, 2694 bind: bind2 2695 }; 2696 var alpine_default = Alpine2; 2697 function makeMap(str, expectsLowerCase) { 2698 const map = /* @__PURE__ */ Object.create(null); 2699 const list = str.split(","); 2700 for (let i = 0; i < list.length; i++) { 2701 map[list[i]] = true; 2702 } 2703 return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; 2704 } 2705 var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 2706 var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`); 2707 var EMPTY_OBJ = true ? Object.freeze({}) : {}; 2708 var EMPTY_ARR = true ? Object.freeze([]) : []; 2709 var hasOwnProperty = Object.prototype.hasOwnProperty; 2710 var hasOwn = (val, key) => hasOwnProperty.call(val, key); 2711 var isArray2 = Array.isArray; 2712 var isMap = (val) => toTypeString(val) === "[object Map]"; 2713 var isString = (val) => typeof val === "string"; 2714 var isSymbol = (val) => typeof val === "symbol"; 2715 var isObject2 = (val) => val !== null && typeof val === "object"; 2716 var objectToString = Object.prototype.toString; 2717 var toTypeString = (value) => objectToString.call(value); 2718 var toRawType = (value) => { 2719 return toTypeString(value).slice(8, -1); 2720 }; 2721 var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 2722 var cacheStringFunction = (fn) => { 2723 const cache = /* @__PURE__ */ Object.create(null); 2724 return (str) => { 2725 const hit = cache[str]; 2726 return hit || (cache[str] = fn(str)); 2727 }; 2728 }; 2729 var camelizeRE = /-(\w)/g; 2730 var camelize = cacheStringFunction((str) => { 2731 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); 2732 }); 2733 var hyphenateRE = /\B([A-Z])/g; 2734 var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); 2735 var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1)); 2736 var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``); 2737 var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue); 2738 var targetMap = /* @__PURE__ */ new WeakMap(); 2739 var effectStack = []; 2740 var activeEffect; 2741 var ITERATE_KEY = Symbol(true ? "iterate" : ""); 2742 var MAP_KEY_ITERATE_KEY = Symbol(true ? "Map key iterate" : ""); 2743 function isEffect(fn) { 2744 return fn && fn._isEffect === true; 2745 } 2746 function effect2(fn, options = EMPTY_OBJ) { 2747 if (isEffect(fn)) { 2748 fn = fn.raw; 2749 } 2750 const effect3 = createReactiveEffect(fn, options); 2751 if (!options.lazy) { 2752 effect3(); 2753 } 2754 return effect3; 2755 } 2756 function stop(effect3) { 2757 if (effect3.active) { 2758 cleanup(effect3); 2759 if (effect3.options.onStop) { 2760 effect3.options.onStop(); 2761 } 2762 effect3.active = false; 2763 } 2764 } 2765 var uid = 0; 2766 function createReactiveEffect(fn, options) { 2767 const effect3 = function reactiveEffect() { 2768 if (!effect3.active) { 2769 return fn(); 2770 } 2771 if (!effectStack.includes(effect3)) { 2772 cleanup(effect3); 2773 try { 2774 enableTracking(); 2775 effectStack.push(effect3); 2776 activeEffect = effect3; 2777 return fn(); 2778 } finally { 2779 effectStack.pop(); 2780 resetTracking(); 2781 activeEffect = effectStack[effectStack.length - 1]; 2782 } 2783 } 2784 }; 2785 effect3.id = uid++; 2786 effect3.allowRecurse = !!options.allowRecurse; 2787 effect3._isEffect = true; 2788 effect3.active = true; 2789 effect3.raw = fn; 2790 effect3.deps = []; 2791 effect3.options = options; 2792 return effect3; 2793 } 2794 function cleanup(effect3) { 2795 const { deps } = effect3; 2796 if (deps.length) { 2797 for (let i = 0; i < deps.length; i++) { 2798 deps[i].delete(effect3); 2799 } 2800 deps.length = 0; 2801 } 2802 } 2803 var shouldTrack = true; 2804 var trackStack = []; 2805 function pauseTracking() { 2806 trackStack.push(shouldTrack); 2807 shouldTrack = false; 2808 } 2809 function enableTracking() { 2810 trackStack.push(shouldTrack); 2811 shouldTrack = true; 2812 } 2813 function resetTracking() { 2814 const last = trackStack.pop(); 2815 shouldTrack = last === void 0 ? true : last; 2816 } 2817 function track(target, type, key) { 2818 if (!shouldTrack || activeEffect === void 0) { 2819 return; 2820 } 2821 let depsMap = targetMap.get(target); 2822 if (!depsMap) { 2823 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 2824 } 2825 let dep = depsMap.get(key); 2826 if (!dep) { 2827 depsMap.set(key, dep = /* @__PURE__ */ new Set()); 2828 } 2829 if (!dep.has(activeEffect)) { 2830 dep.add(activeEffect); 2831 activeEffect.deps.push(dep); 2832 if (activeEffect.options.onTrack) { 2833 activeEffect.options.onTrack({ 2834 effect: activeEffect, 2835 target, 2836 type, 2837 key 2838 }); 2839 } 2840 } 2841 } 2842 function trigger(target, type, key, newValue, oldValue, oldTarget) { 2843 const depsMap = targetMap.get(target); 2844 if (!depsMap) { 2845 return; 2846 } 2847 const effects = /* @__PURE__ */ new Set(); 2848 const add2 = (effectsToAdd) => { 2849 if (effectsToAdd) { 2850 effectsToAdd.forEach((effect3) => { 2851 if (effect3 !== activeEffect || effect3.allowRecurse) { 2852 effects.add(effect3); 2853 } 2854 }); 2855 } 2856 }; 2857 if (type === "clear") { 2858 depsMap.forEach(add2); 2859 } else if (key === "length" && isArray2(target)) { 2860 depsMap.forEach((dep, key2) => { 2861 if (key2 === "length" || key2 >= newValue) { 2862 add2(dep); 2863 } 2864 }); 2865 } else { 2866 if (key !== void 0) { 2867 add2(depsMap.get(key)); 2868 } 2869 switch (type) { 2870 case "add": 2871 if (!isArray2(target)) { 2872 add2(depsMap.get(ITERATE_KEY)); 2873 if (isMap(target)) { 2874 add2(depsMap.get(MAP_KEY_ITERATE_KEY)); 2875 } 2876 } else if (isIntegerKey(key)) { 2877 add2(depsMap.get("length")); 2878 } 2879 break; 2880 case "delete": 2881 if (!isArray2(target)) { 2882 add2(depsMap.get(ITERATE_KEY)); 2883 if (isMap(target)) { 2884 add2(depsMap.get(MAP_KEY_ITERATE_KEY)); 2885 } 2886 } 2887 break; 2888 case "set": 2889 if (isMap(target)) { 2890 add2(depsMap.get(ITERATE_KEY)); 2891 } 2892 break; 2893 } 2894 } 2895 const run = (effect3) => { 2896 if (effect3.options.onTrigger) { 2897 effect3.options.onTrigger({ 2898 effect: effect3, 2899 target, 2900 key, 2901 type, 2902 newValue, 2903 oldValue, 2904 oldTarget 2905 }); 2906 } 2907 if (effect3.options.scheduler) { 2908 effect3.options.scheduler(effect3); 2909 } else { 2910 effect3(); 2911 } 2912 }; 2913 effects.forEach(run); 2914 } 2915 var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 2916 var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol)); 2917 var get2 = /* @__PURE__ */ createGetter(); 2918 var readonlyGet = /* @__PURE__ */ createGetter(true); 2919 var arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); 2920 function createArrayInstrumentations() { 2921 const instrumentations = {}; 2922 ["includes", "indexOf", "lastIndexOf"].forEach((key) => { 2923 instrumentations[key] = function(...args) { 2924 const arr = toRaw(this); 2925 for (let i = 0, l = this.length; i < l; i++) { 2926 track(arr, "get", i + ""); 2927 } 2928 const res = arr[key](...args); 2929 if (res === -1 || res === false) { 2930 return arr[key](...args.map(toRaw)); 2931 } else { 2932 return res; 2933 } 2934 }; 2935 }); 2936 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => { 2937 instrumentations[key] = function(...args) { 2938 pauseTracking(); 2939 const res = toRaw(this)[key].apply(this, args); 2940 resetTracking(); 2941 return res; 2942 }; 2943 }); 2944 return instrumentations; 2945 } 2946 function createGetter(isReadonly = false, shallow = false) { 2947 return function get3(target, key, receiver) { 2948 if (key === "__v_isReactive") { 2949 return !isReadonly; 2950 } else if (key === "__v_isReadonly") { 2951 return isReadonly; 2952 } else if (key === "__v_raw" && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { 2953 return target; 2954 } 2955 const targetIsArray = isArray2(target); 2956 if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) { 2957 return Reflect.get(arrayInstrumentations, key, receiver); 2958 } 2959 const res = Reflect.get(target, key, receiver); 2960 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 2961 return res; 2962 } 2963 if (!isReadonly) { 2964 track(target, "get", key); 2965 } 2966 if (shallow) { 2967 return res; 2968 } 2969 if (isRef(res)) { 2970 const shouldUnwrap = !targetIsArray || !isIntegerKey(key); 2971 return shouldUnwrap ? res.value : res; 2972 } 2973 if (isObject2(res)) { 2974 return isReadonly ? readonly(res) : reactive2(res); 2975 } 2976 return res; 2977 }; 2978 } 2979 var set2 = /* @__PURE__ */ createSetter(); 2980 function createSetter(shallow = false) { 2981 return function set3(target, key, value, receiver) { 2982 let oldValue = target[key]; 2983 if (!shallow) { 2984 value = toRaw(value); 2985 oldValue = toRaw(oldValue); 2986 if (!isArray2(target) && isRef(oldValue) && !isRef(value)) { 2987 oldValue.value = value; 2988 return true; 2989 } 2990 } 2991 const hadKey = isArray2(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 2992 const result = Reflect.set(target, key, value, receiver); 2993 if (target === toRaw(receiver)) { 2994 if (!hadKey) { 2995 trigger(target, "add", key, value); 2996 } else if (hasChanged(value, oldValue)) { 2997 trigger(target, "set", key, value, oldValue); 2998 } 2999 } 3000 return result; 3001 }; 3002 } 3003 function deleteProperty(target, key) { 3004 const hadKey = hasOwn(target, key); 3005 const oldValue = target[key]; 3006 const result = Reflect.deleteProperty(target, key); 3007 if (result && hadKey) { 3008 trigger(target, "delete", key, void 0, oldValue); 3009 } 3010 return result; 3011 } 3012 function has(target, key) { 3013 const result = Reflect.has(target, key); 3014 if (!isSymbol(key) || !builtInSymbols.has(key)) { 3015 track(target, "has", key); 3016 } 3017 return result; 3018 } 3019 function ownKeys(target) { 3020 track(target, "iterate", isArray2(target) ? "length" : ITERATE_KEY); 3021 return Reflect.ownKeys(target); 3022 } 3023 var mutableHandlers = { 3024 get: get2, 3025 set: set2, 3026 deleteProperty, 3027 has, 3028 ownKeys 3029 }; 3030 var readonlyHandlers = { 3031 get: readonlyGet, 3032 set(target, key) { 3033 if (true) { 3034 console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target); 3035 } 3036 return true; 3037 }, 3038 deleteProperty(target, key) { 3039 if (true) { 3040 console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target); 3041 } 3042 return true; 3043 } 3044 }; 3045 var toReactive = (value) => isObject2(value) ? reactive2(value) : value; 3046 var toReadonly = (value) => isObject2(value) ? readonly(value) : value; 3047 var toShallow = (value) => value; 3048 var getProto = (v) => Reflect.getPrototypeOf(v); 3049 function get$1(target, key, isReadonly = false, isShallow = false) { 3050 target = target["__v_raw"]; 3051 const rawTarget = toRaw(target); 3052 const rawKey = toRaw(key); 3053 if (key !== rawKey) { 3054 !isReadonly && track(rawTarget, "get", key); 3055 } 3056 !isReadonly && track(rawTarget, "get", rawKey); 3057 const { has: has2 } = getProto(rawTarget); 3058 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 3059 if (has2.call(rawTarget, key)) { 3060 return wrap(target.get(key)); 3061 } else if (has2.call(rawTarget, rawKey)) { 3062 return wrap(target.get(rawKey)); 3063 } else if (target !== rawTarget) { 3064 target.get(key); 3065 } 3066 } 3067 function has$1(key, isReadonly = false) { 3068 const target = this["__v_raw"]; 3069 const rawTarget = toRaw(target); 3070 const rawKey = toRaw(key); 3071 if (key !== rawKey) { 3072 !isReadonly && track(rawTarget, "has", key); 3073 } 3074 !isReadonly && track(rawTarget, "has", rawKey); 3075 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 3076 } 3077 function size(target, isReadonly = false) { 3078 target = target["__v_raw"]; 3079 !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY); 3080 return Reflect.get(target, "size", target); 3081 } 3082 function add(value) { 3083 value = toRaw(value); 3084 const target = toRaw(this); 3085 const proto = getProto(target); 3086 const hadKey = proto.has.call(target, value); 3087 if (!hadKey) { 3088 target.add(value); 3089 trigger(target, "add", value, value); 3090 } 3091 return this; 3092 } 3093 function set$1(key, value) { 3094 value = toRaw(value); 3095 const target = toRaw(this); 3096 const { has: has2, get: get3 } = getProto(target); 3097 let hadKey = has2.call(target, key); 3098 if (!hadKey) { 3099 key = toRaw(key); 3100 hadKey = has2.call(target, key); 3101 } else if (true) { 3102 checkIdentityKeys(target, has2, key); 3103 } 3104 const oldValue = get3.call(target, key); 3105 target.set(key, value); 3106 if (!hadKey) { 3107 trigger(target, "add", key, value); 3108 } else if (hasChanged(value, oldValue)) { 3109 trigger(target, "set", key, value, oldValue); 3110 } 3111 return this; 3112 } 3113 function deleteEntry(key) { 3114 const target = toRaw(this); 3115 const { has: has2, get: get3 } = getProto(target); 3116 let hadKey = has2.call(target, key); 3117 if (!hadKey) { 3118 key = toRaw(key); 3119 hadKey = has2.call(target, key); 3120 } else if (true) { 3121 checkIdentityKeys(target, has2, key); 3122 } 3123 const oldValue = get3 ? get3.call(target, key) : void 0; 3124 const result = target.delete(key); 3125 if (hadKey) { 3126 trigger(target, "delete", key, void 0, oldValue); 3127 } 3128 return result; 3129 } 3130 function clear() { 3131 const target = toRaw(this); 3132 const hadItems = target.size !== 0; 3133 const oldTarget = true ? isMap(target) ? new Map(target) : new Set(target) : void 0; 3134 const result = target.clear(); 3135 if (hadItems) { 3136 trigger(target, "clear", void 0, void 0, oldTarget); 3137 } 3138 return result; 3139 } 3140 function createForEach(isReadonly, isShallow) { 3141 return function forEach(callback, thisArg) { 3142 const observed = this; 3143 const target = observed["__v_raw"]; 3144 const rawTarget = toRaw(target); 3145 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 3146 !isReadonly && track(rawTarget, "iterate", ITERATE_KEY); 3147 return target.forEach((value, key) => { 3148 return callback.call(thisArg, wrap(value), wrap(key), observed); 3149 }); 3150 }; 3151 } 3152 function createIterableMethod(method, isReadonly, isShallow) { 3153 return function(...args) { 3154 const target = this["__v_raw"]; 3155 const rawTarget = toRaw(target); 3156 const targetIsMap = isMap(rawTarget); 3157 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 3158 const isKeyOnly = method === "keys" && targetIsMap; 3159 const innerIterator = target[method](...args); 3160 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 3161 !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); 3162 return { 3163 next() { 3164 const { value, done } = innerIterator.next(); 3165 return done ? { value, done } : { 3166 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 3167 done 3168 }; 3169 }, 3170 [Symbol.iterator]() { 3171 return this; 3172 } 3173 }; 3174 }; 3175 } 3176 function createReadonlyMethod(type) { 3177 return function(...args) { 3178 if (true) { 3179 const key = args[0] ? `on key "${args[0]}" ` : ``; 3180 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this)); 3181 } 3182 return type === "delete" ? false : this; 3183 }; 3184 } 3185 function createInstrumentations() { 3186 const mutableInstrumentations2 = { 3187 get(key) { 3188 return get$1(this, key); 3189 }, 3190 get size() { 3191 return size(this); 3192 }, 3193 has: has$1, 3194 add, 3195 set: set$1, 3196 delete: deleteEntry, 3197 clear, 3198 forEach: createForEach(false, false) 3199 }; 3200 const shallowInstrumentations2 = { 3201 get(key) { 3202 return get$1(this, key, false, true); 3203 }, 3204 get size() { 3205 return size(this); 3206 }, 3207 has: has$1, 3208 add, 3209 set: set$1, 3210 delete: deleteEntry, 3211 clear, 3212 forEach: createForEach(false, true) 3213 }; 3214 const readonlyInstrumentations2 = { 3215 get(key) { 3216 return get$1(this, key, true); 3217 }, 3218 get size() { 3219 return size(this, true); 3220 }, 3221 has(key) { 3222 return has$1.call(this, key, true); 3223 }, 3224 add: createReadonlyMethod( 3225 "add" 3226 ), 3227 set: createReadonlyMethod( 3228 "set" 3229 ), 3230 delete: createReadonlyMethod( 3231 "delete" 3232 ), 3233 clear: createReadonlyMethod( 3234 "clear" 3235 ), 3236 forEach: createForEach(true, false) 3237 }; 3238 const shallowReadonlyInstrumentations2 = { 3239 get(key) { 3240 return get$1(this, key, true, true); 3241 }, 3242 get size() { 3243 return size(this, true); 3244 }, 3245 has(key) { 3246 return has$1.call(this, key, true); 3247 }, 3248 add: createReadonlyMethod( 3249 "add" 3250 ), 3251 set: createReadonlyMethod( 3252 "set" 3253 ), 3254 delete: createReadonlyMethod( 3255 "delete" 3256 ), 3257 clear: createReadonlyMethod( 3258 "clear" 3259 ), 3260 forEach: createForEach(true, true) 3261 }; 3262 const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; 3263 iteratorMethods.forEach((method) => { 3264 mutableInstrumentations2[method] = createIterableMethod(method, false, false); 3265 readonlyInstrumentations2[method] = createIterableMethod(method, true, false); 3266 shallowInstrumentations2[method] = createIterableMethod(method, false, true); 3267 shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true); 3268 }); 3269 return [ 3270 mutableInstrumentations2, 3271 readonlyInstrumentations2, 3272 shallowInstrumentations2, 3273 shallowReadonlyInstrumentations2 3274 ]; 3275 } 3276 var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations(); 3277 function createInstrumentationGetter(isReadonly, shallow) { 3278 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; 3279 return (target, key, receiver) => { 3280 if (key === "__v_isReactive") { 3281 return !isReadonly; 3282 } else if (key === "__v_isReadonly") { 3283 return isReadonly; 3284 } else if (key === "__v_raw") { 3285 return target; 3286 } 3287 return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver); 3288 }; 3289 } 3290 var mutableCollectionHandlers = { 3291 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 3292 }; 3293 var readonlyCollectionHandlers = { 3294 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 3295 }; 3296 function checkIdentityKeys(target, has2, key) { 3297 const rawKey = toRaw(key); 3298 if (rawKey !== key && has2.call(target, rawKey)) { 3299 const type = toRawType(target); 3300 console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`); 3301 } 3302 } 3303 var reactiveMap = /* @__PURE__ */ new WeakMap(); 3304 var shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 3305 var readonlyMap = /* @__PURE__ */ new WeakMap(); 3306 var shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 3307 function targetTypeMap(rawType) { 3308 switch (rawType) { 3309 case "Object": 3310 case "Array": 3311 return 1; 3312 case "Map": 3313 case "Set": 3314 case "WeakMap": 3315 case "WeakSet": 3316 return 2; 3317 default: 3318 return 0; 3319 } 3320 } 3321 function getTargetType(value) { 3322 return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); 3323 } 3324 function reactive2(target) { 3325 if (target && target["__v_isReadonly"]) { 3326 return target; 3327 } 3328 return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap); 3329 } 3330 function readonly(target) { 3331 return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap); 3332 } 3333 function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) { 3334 if (!isObject2(target)) { 3335 if (true) { 3336 console.warn(`value cannot be made reactive: ${String(target)}`); 3337 } 3338 return target; 3339 } 3340 if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) { 3341 return target; 3342 } 3343 const existingProxy = proxyMap.get(target); 3344 if (existingProxy) { 3345 return existingProxy; 3346 } 3347 const targetType = getTargetType(target); 3348 if (targetType === 0) { 3349 return target; 3350 } 3351 const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers); 3352 proxyMap.set(target, proxy); 3353 return proxy; 3354 } 3355 function toRaw(observed) { 3356 return observed && toRaw(observed["__v_raw"]) || observed; 3357 } 3358 function isRef(r) { 3359 return Boolean(r && r.__v_isRef === true); 3360 } 3361 magic("nextTick", () => nextTick); 3362 magic("dispatch", (el) => dispatch2.bind(dispatch2, el)); 3363 magic("watch", (el, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => (key, callback) => { 3364 let evaluate22 = evaluateLater2(key); 3365 let getter = () => { 3366 let value; 3367 evaluate22((i) => value = i); 3368 return value; 3369 }; 3370 let unwatch = watch(getter, callback); 3371 cleanup2(unwatch); 3372 }); 3373 magic("store", getStores); 3374 magic("data", (el) => scope(el)); 3375 magic("root", (el) => closestRoot(el)); 3376 magic("refs", (el) => { 3377 if (el._x_refs_proxy) 3378 return el._x_refs_proxy; 3379 el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el)); 3380 return el._x_refs_proxy; 3381 }); 3382 function getArrayOfRefObject(el) { 3383 let refObjects = []; 3384 findClosest(el, (i) => { 3385 if (i._x_refs) 3386 refObjects.push(i._x_refs); 3387 }); 3388 return refObjects; 3389 } 3390 var globalIdMemo = {}; 3391 function findAndIncrementId(name) { 3392 if (!globalIdMemo[name]) 3393 globalIdMemo[name] = 0; 3394 return ++globalIdMemo[name]; 3395 } 3396 function closestIdRoot(el, name) { 3397 return findClosest(el, (element) => { 3398 if (element._x_ids && element._x_ids[name]) 3399 return true; 3400 }); 3401 } 3402 function setIdRoot(el, name) { 3403 if (!el._x_ids) 3404 el._x_ids = {}; 3405 if (!el._x_ids[name]) 3406 el._x_ids[name] = findAndIncrementId(name); 3407 } 3408 magic("id", (el, { cleanup: cleanup2 }) => (name, key = null) => { 3409 let cacheKey = `${name}${key ? `-${key}` : ""}`; 3410 return cacheIdByNameOnElement(el, cacheKey, cleanup2, () => { 3411 let root = closestIdRoot(el, name); 3412 let id = root ? root._x_ids[name] : findAndIncrementId(name); 3413 return key ? `${name}-${id}-${key}` : `${name}-${id}`; 3414 }); 3415 }); 3416 interceptClone((from, to) => { 3417 if (from._x_id) { 3418 to._x_id = from._x_id; 3419 } 3420 }); 3421 function cacheIdByNameOnElement(el, cacheKey, cleanup2, callback) { 3422 if (!el._x_id) 3423 el._x_id = {}; 3424 if (el._x_id[cacheKey]) 3425 return el._x_id[cacheKey]; 3426 let output = callback(); 3427 el._x_id[cacheKey] = output; 3428 cleanup2(() => { 3429 delete el._x_id[cacheKey]; 3430 }); 3431 return output; 3432 } 3433 magic("el", (el) => el); 3434 warnMissingPluginMagic("Focus", "focus", "focus"); 3435 warnMissingPluginMagic("Persist", "persist", "persist"); 3436 function warnMissingPluginMagic(name, magicName, slug) { 3437 magic(magicName, (el) => warn(`You can't use [$${magicName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); 3438 } 3439 directive("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 3440 let func = evaluateLater2(expression); 3441 let innerGet = () => { 3442 let result; 3443 func((i) => result = i); 3444 return result; 3445 }; 3446 let evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`); 3447 let innerSet = (val) => evaluateInnerSet(() => { 3448 }, { scope: { "__placeholder": val } }); 3449 let initialValue = innerGet(); 3450 innerSet(initialValue); 3451 queueMicrotask(() => { 3452 if (!el._x_model) 3453 return; 3454 el._x_removeModelListeners["default"](); 3455 let outerGet = el._x_model.get; 3456 let outerSet = el._x_model.setWithModifiers; 3457 let releaseEntanglement = entangle( 3458 { 3459 get() { 3460 return outerGet(); 3461 }, 3462 set(value) { 3463 outerSet(value); 3464 } 3465 }, 3466 { 3467 get() { 3468 return innerGet(); 3469 }, 3470 set(value) { 3471 innerSet(value); 3472 } 3473 } 3474 ); 3475 cleanup2(releaseEntanglement); 3476 }); 3477 }); 3478 directive("teleport", (el, { modifiers, expression }, { cleanup: cleanup2 }) => { 3479 if (el.tagName.toLowerCase() !== "template") 3480 warn("x-teleport can only be used on a <template> tag", el); 3481 let target = getTarget(expression); 3482 let clone22 = el.content.cloneNode(true).firstElementChild; 3483 el._x_teleport = clone22; 3484 clone22._x_teleportBack = el; 3485 el.setAttribute("data-teleport-template", true); 3486 clone22.setAttribute("data-teleport-target", true); 3487 if (el._x_forwardEvents) { 3488 el._x_forwardEvents.forEach((eventName) => { 3489 clone22.addEventListener(eventName, (e) => { 3490 e.stopPropagation(); 3491 el.dispatchEvent(new e.constructor(e.type, e)); 3492 }); 3493 }); 3494 } 3495 addScopeToNode(clone22, {}, el); 3496 let placeInDom = (clone3, target2, modifiers2) => { 3497 if (modifiers2.includes("prepend")) { 3498 target2.parentNode.insertBefore(clone3, target2); 3499 } else if (modifiers2.includes("append")) { 3500 target2.parentNode.insertBefore(clone3, target2.nextSibling); 3501 } else { 3502 target2.appendChild(clone3); 3503 } 3504 }; 3505 mutateDom(() => { 3506 skipDuringClone(() => { 3507 placeInDom(clone22, target, modifiers); 3508 initTree(clone22); 3509 })(); 3510 }); 3511 el._x_teleportPutBack = () => { 3512 let target2 = getTarget(expression); 3513 mutateDom(() => { 3514 placeInDom(el._x_teleport, target2, modifiers); 3515 }); 3516 }; 3517 cleanup2( 3518 () => mutateDom(() => { 3519 clone22.remove(); 3520 destroyTree(clone22); 3521 }) 3522 ); 3523 }); 3524 var teleportContainerDuringClone = document.createElement("div"); 3525 function getTarget(expression) { 3526 let target = skipDuringClone(() => { 3527 return document.querySelector(expression); 3528 }, () => { 3529 return teleportContainerDuringClone; 3530 })(); 3531 if (!target) 3532 warn(`Cannot find x-teleport element for selector: "${expression}"`); 3533 return target; 3534 } 3535 var handler = () => { 3536 }; 3537 handler.inline = (el, { modifiers }, { cleanup: cleanup2 }) => { 3538 modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true; 3539 cleanup2(() => { 3540 modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore; 3541 }); 3542 }; 3543 directive("ignore", handler); 3544 directive("effect", skipDuringClone((el, { expression }, { effect: effect3 }) => { 3545 effect3(evaluateLater(el, expression)); 3546 })); 3547 function on(el, event, modifiers, callback) { 3548 let listenerTarget = el; 3549 let handler4 = (e) => callback(e); 3550 let options = {}; 3551 let wrapHandler = (callback2, wrapper) => (e) => wrapper(callback2, e); 3552 if (modifiers.includes("dot")) 3553 event = dotSyntax(event); 3554 if (modifiers.includes("camel")) 3555 event = camelCase2(event); 3556 if (modifiers.includes("capture")) 3557 options.capture = true; 3558 if (modifiers.includes("window")) 3559 listenerTarget = window; 3560 if (modifiers.includes("document")) 3561 listenerTarget = document; 3562 if (modifiers.includes("passive")) { 3563 options.passive = modifiers[modifiers.indexOf("passive") + 1] !== "false"; 3564 } 3565 handler4 = addDebounceOrThrottle(modifiers, handler4); 3566 if (modifiers.includes("prevent")) 3567 handler4 = wrapHandler(handler4, (next, e) => { 3568 e.preventDefault(); 3569 next(e); 3570 }); 3571 if (modifiers.includes("stop")) 3572 handler4 = wrapHandler(handler4, (next, e) => { 3573 e.stopPropagation(); 3574 next(e); 3575 }); 3576 if (modifiers.includes("once")) { 3577 handler4 = wrapHandler(handler4, (next, e) => { 3578 next(e); 3579 listenerTarget.removeEventListener(event, handler4, options); 3580 }); 3581 } 3582 if (modifiers.includes("away") || modifiers.includes("outside")) { 3583 listenerTarget = document; 3584 handler4 = wrapHandler(handler4, (next, e) => { 3585 if (el.contains(e.target)) 3586 return; 3587 if (e.target.isConnected === false) 3588 return; 3589 if (el.offsetWidth < 1 && el.offsetHeight < 1) 3590 return; 3591 if (el._x_isShown === false) 3592 return; 3593 next(e); 3594 }); 3595 } 3596 if (modifiers.includes("self")) 3597 handler4 = wrapHandler(handler4, (next, e) => { 3598 e.target === el && next(e); 3599 }); 3600 if (event === "submit") { 3601 handler4 = wrapHandler(handler4, (next, e) => { 3602 if (e.target._x_pendingModelUpdates) { 3603 e.target._x_pendingModelUpdates.forEach((fn) => fn()); 3604 } 3605 next(e); 3606 }); 3607 } 3608 if (isKeyEvent(event) || isClickEvent(event)) { 3609 handler4 = wrapHandler(handler4, (next, e) => { 3610 if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) { 3611 return; 3612 } 3613 next(e); 3614 }); 3615 } 3616 listenerTarget.addEventListener(event, handler4, options); 3617 return () => { 3618 listenerTarget.removeEventListener(event, handler4, options); 3619 }; 3620 } 3621 function addDebounceOrThrottle(modifiers, handler4) { 3622 if (modifiers.includes("debounce")) { 3623 let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait"; 3624 let wait = isNumeric2(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250; 3625 handler4 = debounce(handler4, wait); 3626 } 3627 if (modifiers.includes("throttle")) { 3628 let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait"; 3629 let wait = isNumeric2(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250; 3630 handler4 = throttle(handler4, wait); 3631 } 3632 return handler4; 3633 } 3634 function dotSyntax(subject) { 3635 return subject.replace(/-/g, "."); 3636 } 3637 function camelCase2(subject) { 3638 return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase()); 3639 } 3640 function isNumeric2(subject) { 3641 return !Array.isArray(subject) && !isNaN(subject); 3642 } 3643 function kebabCase2(subject) { 3644 if ([" ", "_"].includes( 3645 subject 3646 )) 3647 return subject; 3648 return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase(); 3649 } 3650 function isKeyEvent(event) { 3651 return ["keydown", "keyup"].includes(event); 3652 } 3653 function isClickEvent(event) { 3654 return ["contextmenu", "click", "mouse"].some((i) => event.includes(i)); 3655 } 3656 function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) { 3657 let keyModifiers = modifiers.filter((i) => { 3658 return !["window", "document", "prevent", "stop", "once", "capture", "self", "away", "outside", "passive", "preserve-scroll", "blur", "change", "lazy"].includes(i); 3659 }); 3660 if (keyModifiers.includes("debounce")) { 3661 let debounceIndex = keyModifiers.indexOf("debounce"); 3662 keyModifiers.splice(debounceIndex, isNumeric2((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1); 3663 } 3664 if (keyModifiers.includes("throttle")) { 3665 let debounceIndex = keyModifiers.indexOf("throttle"); 3666 keyModifiers.splice(debounceIndex, isNumeric2((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1); 3667 } 3668 if (keyModifiers.length === 0) 3669 return false; 3670 if (keyModifiers.length === 1 && keyToModifiers(e.key).includes(keyModifiers[0])) 3671 return false; 3672 const systemKeyModifiers = ["ctrl", "shift", "alt", "meta", "cmd", "super"]; 3673 const selectedSystemKeyModifiers = systemKeyModifiers.filter((modifier) => keyModifiers.includes(modifier)); 3674 keyModifiers = keyModifiers.filter((i) => !selectedSystemKeyModifiers.includes(i)); 3675 if (selectedSystemKeyModifiers.length > 0) { 3676 const activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter((modifier) => { 3677 if (modifier === "cmd" || modifier === "super") 3678 modifier = "meta"; 3679 return e[`${modifier}Key`]; 3680 }); 3681 if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) { 3682 if (isClickEvent(e.type)) 3683 return false; 3684 if (keyToModifiers(e.key).includes(keyModifiers[0])) 3685 return false; 3686 } 3687 } 3688 return true; 3689 } 3690 function keyToModifiers(key) { 3691 if (!key) 3692 return []; 3693 key = kebabCase2(key); 3694 let modifierToKeyMap = { 3695 "ctrl": "control", 3696 "slash": "/", 3697 "space": " ", 3698 "spacebar": " ", 3699 "cmd": "meta", 3700 "esc": "escape", 3701 "up": "arrow-up", 3702 "down": "arrow-down", 3703 "left": "arrow-left", 3704 "right": "arrow-right", 3705 "period": ".", 3706 "comma": ",", 3707 "equal": "=", 3708 "minus": "-", 3709 "underscore": "_" 3710 }; 3711 modifierToKeyMap[key] = key; 3712 return Object.keys(modifierToKeyMap).map((modifier) => { 3713 if (modifierToKeyMap[modifier] === key) 3714 return modifier; 3715 }).filter((modifier) => modifier); 3716 } 3717 directive("model", (el, { modifiers, expression }, { effect: effect3, cleanup: cleanup2 }) => { 3718 let scopeTarget = el; 3719 if (modifiers.includes("parent")) { 3720 scopeTarget = findClosest(el, (element) => element !== el); 3721 } 3722 let evaluateGet = evaluateLater(scopeTarget, expression); 3723 let evaluateSet; 3724 if (typeof expression === "string") { 3725 evaluateSet = evaluateLater(scopeTarget, `${expression} = __placeholder`); 3726 } else if (typeof expression === "function" && typeof expression() === "string") { 3727 evaluateSet = evaluateLater(scopeTarget, `${expression()} = __placeholder`); 3728 } else { 3729 evaluateSet = () => { 3730 }; 3731 } 3732 let getValue = () => { 3733 let result; 3734 evaluateGet((value) => result = value); 3735 return isGetterSetter(result) ? result.get() : result; 3736 }; 3737 let setValue = (value) => { 3738 let result; 3739 evaluateGet((value2) => result = value2); 3740 if (isGetterSetter(result)) { 3741 result.set(value); 3742 } else { 3743 evaluateSet(() => { 3744 }, { 3745 scope: { "__placeholder": value } 3746 }); 3747 } 3748 }; 3749 if (typeof expression === "string" && el.type === "radio") { 3750 mutateDom(() => { 3751 if (!el.hasAttribute("name")) 3752 el.setAttribute("name", expression); 3753 }); 3754 } 3755 let hasChangeModifier = modifiers.includes("change") || modifiers.includes("lazy"); 3756 let hasBlurModifier = modifiers.includes("blur"); 3757 let hasEnterModifier = modifiers.includes("enter"); 3758 let hasExplicitEventModifiers = hasChangeModifier || hasBlurModifier || hasEnterModifier; 3759 let removeListener; 3760 if (isCloning) { 3761 removeListener = () => { 3762 }; 3763 } else if (hasExplicitEventModifiers) { 3764 let listeners2 = []; 3765 let syncValue = (e) => setValue(getInputValue(el, modifiers, e, getValue())); 3766 if (hasChangeModifier) { 3767 listeners2.push(on(el, "change", modifiers, syncValue)); 3768 } 3769 if (hasBlurModifier) { 3770 listeners2.push(on(el, "blur", modifiers, syncValue)); 3771 if (el.form) { 3772 let form = el.form; 3773 let syncCallback = () => syncValue({ target: el }); 3774 if (!form._x_pendingModelUpdates) 3775 form._x_pendingModelUpdates = []; 3776 form._x_pendingModelUpdates.push(syncCallback); 3777 cleanup2(() => { 3778 if (form._x_pendingModelUpdates) { 3779 form._x_pendingModelUpdates.splice(form._x_pendingModelUpdates.indexOf(syncCallback), 1); 3780 } 3781 }); 3782 } 3783 } 3784 if (hasEnterModifier) { 3785 listeners2.push(on(el, "keydown", modifiers, (e) => { 3786 if (e.key === "Enter") 3787 syncValue(e); 3788 })); 3789 } 3790 removeListener = () => listeners2.forEach((remove) => remove()); 3791 } else { 3792 let event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) ? "change" : "input"; 3793 removeListener = on(el, event, modifiers, (e) => { 3794 setValue(getInputValue(el, modifiers, e, getValue())); 3795 }); 3796 } 3797 if (modifiers.includes("fill")) { 3798 if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { 3799 setValue( 3800 getInputValue(el, modifiers, { target: el }, getValue()) 3801 ); 3802 } 3803 } 3804 if (!el._x_removeModelListeners) 3805 el._x_removeModelListeners = {}; 3806 el._x_removeModelListeners["default"] = removeListener; 3807 cleanup2(() => el._x_removeModelListeners["default"]()); 3808 if (el.form) { 3809 let removeResetListener = on(el.form, "reset", [], (e) => { 3810 nextTick(() => el._x_model && el._x_model.set(getInputValue(el, modifiers, { target: el }, getValue()))); 3811 }); 3812 cleanup2(() => removeResetListener()); 3813 } 3814 el._x_model = { 3815 get() { 3816 return getValue(); 3817 }, 3818 set(value) { 3819 setValue(value); 3820 }, 3821 setWithModifiers: addDebounceOrThrottle(modifiers, setValue) 3822 }; 3823 el._x_forceModelUpdate = (value) => { 3824 if (value === void 0 && typeof expression === "string" && expression.match(/\./)) 3825 value = ""; 3826 mutateDom(() => { 3827 if (isCheckbox(el)) { 3828 if (Array.isArray(value)) { 3829 el.checked = value.some((val) => val == el.value); 3830 } else { 3831 el.checked = !!value; 3832 } 3833 } else if (isRadio(el)) { 3834 if (typeof value === "boolean") { 3835 el.checked = safeParseBoolean(el.value) === value; 3836 } else { 3837 el.checked = el.value == value; 3838 } 3839 } else { 3840 bind(el, "value", value); 3841 } 3842 }); 3843 }; 3844 effect3(() => { 3845 let value = getValue(); 3846 if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el)) 3847 return; 3848 el._x_forceModelUpdate(value); 3849 }); 3850 }); 3851 function getInputValue(el, modifiers, event, currentValue) { 3852 return mutateDom(() => { 3853 if (event instanceof CustomEvent && event.detail !== void 0) 3854 return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; 3855 else if (isCheckbox(el)) { 3856 if (Array.isArray(currentValue)) { 3857 let newValue = null; 3858 if (modifiers.includes("number")) { 3859 newValue = safeParseNumber(event.target.value); 3860 } else if (modifiers.includes("boolean")) { 3861 newValue = safeParseBoolean(event.target.value); 3862 } else { 3863 newValue = event.target.value; 3864 } 3865 return event.target.checked ? currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue)); 3866 } else { 3867 return event.target.checked; 3868 } 3869 } else if (el.tagName.toLowerCase() === "select" && el.multiple) { 3870 if (modifiers.includes("number")) { 3871 return Array.from(event.target.selectedOptions).map((option2) => { 3872 let rawValue = option2.value || option2.text; 3873 return safeParseNumber(rawValue); 3874 }); 3875 } else if (modifiers.includes("boolean")) { 3876 return Array.from(event.target.selectedOptions).map((option2) => { 3877 let rawValue = option2.value || option2.text; 3878 return safeParseBoolean(rawValue); 3879 }); 3880 } 3881 return Array.from(event.target.selectedOptions).map((option2) => { 3882 return option2.value || option2.text; 3883 }); 3884 } else { 3885 let newValue; 3886 if (isRadio(el)) { 3887 if (event.target.checked) { 3888 newValue = event.target.value; 3889 } else { 3890 newValue = currentValue; 3891 } 3892 } else { 3893 newValue = event.target.value; 3894 } 3895 if (modifiers.includes("number")) { 3896 return safeParseNumber(newValue); 3897 } else if (modifiers.includes("boolean")) { 3898 return safeParseBoolean(newValue); 3899 } else if (modifiers.includes("trim")) { 3900 return newValue.trim(); 3901 } else { 3902 return newValue; 3903 } 3904 } 3905 }); 3906 } 3907 function safeParseNumber(rawValue) { 3908 let number = rawValue ? parseFloat(rawValue) : null; 3909 return isNumeric22(number) ? number : rawValue; 3910 } 3911 function checkedAttrLooseCompare2(valueA, valueB) { 3912 return valueA == valueB; 3913 } 3914 function isNumeric22(subject) { 3915 return !Array.isArray(subject) && !isNaN(subject); 3916 } 3917 function isGetterSetter(value) { 3918 return value !== null && typeof value === "object" && typeof value.get === "function" && typeof value.set === "function"; 3919 } 3920 directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak"))))); 3921 addInitSelector(() => `[${prefix("init")}]`); 3922 directive("init", skipDuringClone((el, { expression }, { evaluate: evaluate22 }) => { 3923 if (typeof expression === "string") { 3924 return !!expression.trim() && evaluate22(expression, {}, false); 3925 } 3926 return evaluate22(expression, {}, false); 3927 })); 3928 directive("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => { 3929 let evaluate22 = evaluateLater2(expression); 3930 effect3(() => { 3931 evaluate22((value) => { 3932 mutateDom(() => { 3933 el.textContent = value; 3934 }); 3935 }); 3936 }); 3937 }); 3938 directive("html", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => { 3939 let evaluate22 = evaluateLater2(expression); 3940 effect3(() => { 3941 evaluate22((value) => { 3942 mutateDom(() => { 3943 el.innerHTML = value ?? ""; 3944 el._x_ignoreSelf = true; 3945 initTree(el); 3946 delete el._x_ignoreSelf; 3947 }); 3948 }); 3949 }); 3950 }); 3951 mapAttributes(startingWith(":", into(prefix("bind:")))); 3952 var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3, cleanup: cleanup2 }) => { 3953 if (!value) { 3954 let bindingProviders = {}; 3955 injectBindingProviders(bindingProviders); 3956 let getBindings = evaluateLater(el, expression); 3957 getBindings((bindings) => { 3958 applyBindingsObject(el, bindings, original); 3959 }, { scope: bindingProviders }); 3960 return; 3961 } 3962 if (value === "key") 3963 return storeKeyForXFor(el, expression); 3964 if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) { 3965 return; 3966 } 3967 let evaluate22 = evaluateLater(el, expression); 3968 effect3(() => evaluate22((result) => { 3969 if (result === void 0 && typeof expression === "string" && expression.match(/\./)) { 3970 result = ""; 3971 } 3972 mutateDom(() => bind(el, value, result, modifiers)); 3973 })); 3974 cleanup2(() => { 3975 el._x_undoAddedClasses && el._x_undoAddedClasses(); 3976 el._x_undoAddedStyles && el._x_undoAddedStyles(); 3977 }); 3978 }; 3979 handler2.inline = (el, { value, modifiers, expression }) => { 3980 if (!value) 3981 return; 3982 if (!el._x_inlineBindings) 3983 el._x_inlineBindings = {}; 3984 el._x_inlineBindings[value] = { expression, extract: false }; 3985 }; 3986 directive("bind", handler2); 3987 function storeKeyForXFor(el, expression) { 3988 el._x_keyExpression = expression; 3989 } 3990 addRootSelector(() => `[${prefix("data")}]`); 3991 directive("data", (el, { expression }, { cleanup: cleanup2 }) => { 3992 if (shouldSkipRegisteringDataDuringClone(el)) 3993 return; 3994 expression = expression === "" ? "{}" : expression; 3995 let magicContext = {}; 3996 injectMagics(magicContext, el); 3997 let dataProviderContext = {}; 3998 injectDataProviders(dataProviderContext, magicContext); 3999 let data2 = evaluate(el, expression, { scope: dataProviderContext }); 4000 if (data2 === void 0 || data2 === true) 4001 data2 = {}; 4002 injectMagics(data2, el); 4003 let reactiveData = reactive(data2); 4004 initInterceptors(reactiveData); 4005 let undo = addScopeToNode(el, reactiveData); 4006 reactiveData["init"] && evaluate(el, reactiveData["init"]); 4007 cleanup2(() => { 4008 reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]); 4009 undo(); 4010 }); 4011 }); 4012 interceptClone((from, to) => { 4013 if (from._x_dataStack) { 4014 to._x_dataStack = from._x_dataStack; 4015 to.setAttribute("data-has-alpine-state", true); 4016 } 4017 }); 4018 function shouldSkipRegisteringDataDuringClone(el) { 4019 if (!isCloning) 4020 return false; 4021 if (isCloningLegacy) 4022 return true; 4023 return el.hasAttribute("data-has-alpine-state"); 4024 } 4025 directive("show", (el, { modifiers, expression }, { effect: effect3 }) => { 4026 let evaluate22 = evaluateLater(el, expression); 4027 if (!el._x_doHide) 4028 el._x_doHide = () => { 4029 mutateDom(() => { 4030 el.style.setProperty("display", "none", modifiers.includes("important") ? "important" : void 0); 4031 }); 4032 }; 4033 if (!el._x_doShow) 4034 el._x_doShow = () => { 4035 mutateDom(() => { 4036 if (el.style.length === 1 && el.style.display === "none") { 4037 el.removeAttribute("style"); 4038 } else { 4039 el.style.removeProperty("display"); 4040 } 4041 }); 4042 }; 4043 let hide = () => { 4044 el._x_doHide(); 4045 el._x_isShown = false; 4046 }; 4047 let show = () => { 4048 el._x_doShow(); 4049 el._x_isShown = true; 4050 }; 4051 let clickAwayCompatibleShow = () => setTimeout(show); 4052 let toggle = once( 4053 (value) => value ? show() : hide(), 4054 (value) => { 4055 if (typeof el._x_toggleAndCascadeWithTransitions === "function") { 4056 el._x_toggleAndCascadeWithTransitions(el, value, show, hide); 4057 } else { 4058 value ? clickAwayCompatibleShow() : hide(); 4059 } 4060 } 4061 ); 4062 let oldValue; 4063 let firstTime = true; 4064 effect3(() => evaluate22((value) => { 4065 if (!firstTime && value === oldValue) 4066 return; 4067 if (modifiers.includes("immediate")) 4068 value ? clickAwayCompatibleShow() : hide(); 4069 toggle(value); 4070 oldValue = value; 4071 firstTime = false; 4072 })); 4073 }); 4074 directive("for", (el, { expression }, { effect: effect3, cleanup: cleanup2 }) => { 4075 let iteratorNames = parseForExpression(expression); 4076 let evaluateItems = evaluateLater(el, iteratorNames.items); 4077 let evaluateKey = evaluateLater( 4078 el, 4079 el._x_keyExpression || "index" 4080 ); 4081 el._x_lookup = /* @__PURE__ */ new Map(); 4082 effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey)); 4083 cleanup2(() => { 4084 el._x_lookup.forEach( 4085 (el2) => mutateDom(() => { 4086 destroyTree(el2); 4087 el2.remove(); 4088 }) 4089 ); 4090 delete el._x_lookup; 4091 }); 4092 }); 4093 function refreshScope(scope2) { 4094 return (newScope) => { 4095 Object.entries(newScope).forEach(([key, value]) => { 4096 scope2[key] = value; 4097 }); 4098 }; 4099 } 4100 function loop(templateEl, iteratorNames, evaluateItems, evaluateKey) { 4101 evaluateItems((items) => { 4102 if (isNumeric3(items)) 4103 items = Array.from({ length: items }, (_, i) => i + 1); 4104 if (items === void 0 || items === null) 4105 items = []; 4106 if (items instanceof Set) 4107 items = Array.from(items); 4108 if (items instanceof Map) 4109 items = Array.from(items); 4110 let oldLookup = templateEl._x_lookup; 4111 let lookup = /* @__PURE__ */ new Map(); 4112 templateEl._x_lookup = lookup; 4113 let hasStringKeys = isObject22(items); 4114 let scopeEntries = Object.entries(items).map(([index2, item]) => { 4115 if (!hasStringKeys) 4116 index2 = parseInt(index2); 4117 let scope2 = getIterationScopeVariables(iteratorNames, item, index2, items); 4118 let key; 4119 evaluateKey((innerKey) => { 4120 if (typeof innerKey === "object") 4121 warn("x-for key cannot be an object, it must be a string or an integer", templateEl); 4122 if (oldLookup.has(innerKey)) { 4123 lookup.set(innerKey, oldLookup.get(innerKey)); 4124 oldLookup.delete(innerKey); 4125 } 4126 key = innerKey; 4127 }, { scope: { index: index2, ...scope2 } }); 4128 return [key, scope2]; 4129 }); 4130 mutateDom(() => { 4131 oldLookup.forEach((el) => { 4132 destroyTree(el); 4133 el.remove(); 4134 }); 4135 let added = /* @__PURE__ */ new Set(); 4136 let prev = templateEl; 4137 scopeEntries.forEach(([key, scope2]) => { 4138 if (lookup.has(key)) { 4139 let el = lookup.get(key); 4140 el._x_refreshXForScope(scope2); 4141 if (prev.nextElementSibling !== el) { 4142 if (prev.nextElementSibling) 4143 el.replaceWith(prev.nextElementSibling); 4144 prev.after(el); 4145 } 4146 prev = el; 4147 if (el._x_currentIfEl) { 4148 if (el.nextElementSibling !== el._x_currentIfEl) 4149 prev.after(el._x_currentIfEl); 4150 prev = el._x_currentIfEl; 4151 } 4152 return; 4153 } 4154 if (templateEl.content.children.length > 1) 4155 warn("x-for templates require a single root element, additional elements will be ignored.", templateEl); 4156 let clone22 = document.importNode(templateEl.content, true).firstElementChild; 4157 let reactiveScope = reactive(scope2); 4158 addScopeToNode(clone22, reactiveScope, templateEl); 4159 clone22._x_refreshXForScope = refreshScope(reactiveScope); 4160 lookup.set(key, clone22); 4161 added.add(clone22); 4162 prev.after(clone22); 4163 prev = clone22; 4164 }); 4165 skipDuringClone(() => added.forEach((clone22) => initTree(clone22)))(); 4166 }); 4167 }); 4168 } 4169 function parseForExpression(expression) { 4170 let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 4171 let stripParensRE = /^\s*\(|\)\s*$/g; 4172 let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; 4173 let inMatch = expression.match(forAliasRE); 4174 if (!inMatch) 4175 return; 4176 let res = {}; 4177 res.items = inMatch[2].trim(); 4178 let item = inMatch[1].replace(stripParensRE, "").trim(); 4179 let iteratorMatch = item.match(forIteratorRE); 4180 if (iteratorMatch) { 4181 res.item = item.replace(forIteratorRE, "").trim(); 4182 res.index = iteratorMatch[1].trim(); 4183 if (iteratorMatch[2]) { 4184 res.collection = iteratorMatch[2].trim(); 4185 } 4186 } else { 4187 res.item = item; 4188 } 4189 return res; 4190 } 4191 function getIterationScopeVariables(iteratorNames, item, index2, items) { 4192 let scopeVariables = {}; 4193 if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) { 4194 let names = iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i) => i.trim()); 4195 names.forEach((name, i) => { 4196 scopeVariables[name] = item[i]; 4197 }); 4198 } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") { 4199 let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim()); 4200 names.forEach((name) => { 4201 scopeVariables[name] = item[name]; 4202 }); 4203 } else { 4204 scopeVariables[iteratorNames.item] = item; 4205 } 4206 if (iteratorNames.index) 4207 scopeVariables[iteratorNames.index] = index2; 4208 if (iteratorNames.collection) 4209 scopeVariables[iteratorNames.collection] = items; 4210 return scopeVariables; 4211 } 4212 function isNumeric3(subject) { 4213 return typeof subject !== "object" && !isNaN(subject); 4214 } 4215 function isObject22(subject) { 4216 return typeof subject === "object" && !Array.isArray(subject); 4217 } 4218 function handler3() { 4219 } 4220 handler3.inline = (el, { expression }, { cleanup: cleanup2 }) => { 4221 let root = closestRoot(el); 4222 if (!root) 4223 return; 4224 if (!root._x_refs) 4225 root._x_refs = {}; 4226 root._x_refs[expression] = el; 4227 cleanup2(() => delete root._x_refs[expression]); 4228 }; 4229 directive("ref", handler3); 4230 directive("if", (el, { expression }, { effect: effect3, cleanup: cleanup2 }) => { 4231 if (el.tagName.toLowerCase() !== "template") 4232 warn("x-if can only be used on a <template> tag", el); 4233 let evaluate22 = evaluateLater(el, expression); 4234 let show = () => { 4235 if (el._x_currentIfEl) 4236 return el._x_currentIfEl; 4237 let clone22 = el.content.cloneNode(true).firstElementChild; 4238 addScopeToNode(clone22, {}, el); 4239 mutateDom(() => { 4240 el.after(clone22); 4241 skipDuringClone(() => initTree(clone22))(); 4242 }); 4243 el._x_currentIfEl = clone22; 4244 el._x_undoIf = () => { 4245 mutateDom(() => { 4246 destroyTree(clone22); 4247 clone22.remove(); 4248 }); 4249 delete el._x_currentIfEl; 4250 }; 4251 return clone22; 4252 }; 4253 let hide = () => { 4254 if (!el._x_undoIf) 4255 return; 4256 el._x_undoIf(); 4257 delete el._x_undoIf; 4258 }; 4259 effect3(() => evaluate22((value) => { 4260 value ? show() : hide(); 4261 })); 4262 cleanup2(() => el._x_undoIf && el._x_undoIf()); 4263 }); 4264 directive("id", (el, { expression }, { evaluate: evaluate22 }) => { 4265 let names = evaluate22(expression); 4266 names.forEach((name) => setIdRoot(el, name)); 4267 }); 4268 interceptClone((from, to) => { 4269 if (from._x_ids) { 4270 to._x_ids = from._x_ids; 4271 } 4272 }); 4273 mapAttributes(startingWith("@", into(prefix("on:")))); 4274 directive("on", skipDuringClone((el, { value, modifiers, expression }, { cleanup: cleanup2 }) => { 4275 let evaluate22 = expression ? evaluateLater(el, expression) : () => { 4276 }; 4277 if (el.tagName.toLowerCase() === "template") { 4278 if (!el._x_forwardEvents) 4279 el._x_forwardEvents = []; 4280 if (!el._x_forwardEvents.includes(value)) 4281 el._x_forwardEvents.push(value); 4282 } 4283 let removeListener = on(el, value, modifiers, (e) => { 4284 evaluate22(() => { 4285 }, { scope: { "$event": e }, params: [e] }); 4286 }); 4287 cleanup2(() => removeListener()); 4288 })); 4289 warnMissingPluginDirective("Collapse", "collapse", "collapse"); 4290 warnMissingPluginDirective("Intersect", "intersect", "intersect"); 4291 warnMissingPluginDirective("Focus", "trap", "focus"); 4292 warnMissingPluginDirective("Mask", "mask", "mask"); 4293 function warnMissingPluginDirective(name, directiveName, slug) { 4294 directive(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); 4295 } 4296 alpine_default.setEvaluator(normalEvaluator); 4297 alpine_default.setRawEvaluator(normalRawEvaluator); 4298 alpine_default.setReactivityEngine({ reactive: reactive2, effect: effect2, release: stop, raw: toRaw }); 4299 var src_default = alpine_default; 4300 var module_default = src_default; 4301 4302
4302// js/features/supportEntangle.js 4303 function generateEntangleFunction(component, cleanup2) { 4304 if (!cleanup2) 4305 cleanup2 = () => { 4306 }; 4307 return (name, live = false) => { 4308 let isLive = live; 4309 let livewireProperty = name; 4310 let livewireComponent = component.$wire; 4311 let livewirePropertyValue = livewireComponent.get(livewireProperty); 4312 let interceptor2 = module_default.interceptor((initialValue, getter, setter, path, key) => { 4313 if (typeof livewirePropertyValue === "undefined") { 4314 console.error(`Livewire Entangle Error: Livewire property ['${livewireProperty}'] cannot be found on component: ['${component.name}']`); 4315 return; 4316 } 4317 let release2 = module_default.entangle({ 4318 get() { 4319 return livewireComponent.get(name); 4320 }, 4321 set(value) { 4322 livewireComponent.set(name, value, isLive); 4323 } 4324 }, { 4325 get() { 4326 return getter(); 4327 }, 4328 set(value) { 4329 setter(value); 4330 } 4331 }); 4332 cleanup2(() => release2()); 4333 return cloneIfObject2(livewireComponent.get(name)); 4334 }, (obj) => { 4335 Object.defineProperty(obj, "live", { 4336 get() { 4337 isLive = true; 4338 return obj; 4339 } 4340 }); 4341 }); 4342 return interceptor2(livewirePropertyValue); 4343 }; 4344 } 4345 function cloneIfObject2(value) { 4346 return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; 4347 } 4348 4349
4349// js/hooks.js 4350 var listeners = []; 4351 function on2(name, callback) { 4352 if (!listeners[name]) 4353 listeners[name] = []; 4354 listeners[name].push(callback); 4355 return () => { 4356 listeners[name] = listeners[name].filter((i) => i !== callback); 4357 }; 4358 } 4359 function trigger2(name, ...params) { 4360 let callbacks = listeners[name] || []; 4361 let finishers = []; 4362 for (let i = 0; i < callbacks.length; i++) { 4363 let finisher = callbacks[i](...params); 4364 if (isFunction(finisher)) 4365 finishers.push(finisher); 4366 } 4367 return (result) => { 4368 return runFinishers(finishers, result); 4369 }; 4370 } 4371 async function triggerAsync(name, ...params) { 4372 let callbacks = listeners[name] || []; 4373 let finishers = []; 4374 for (let i = 0; i < callbacks.length; i++) { 4375 let finisher = await callbacks[i](...params); 4376 if (isFunction(finisher)) 4377 finishers.push(finisher); 4378 } 4379 return (result) => { 4380 return runFinishers(finishers, result); 4381 }; 4382 } 4383 function runFinishers(finishers, result) { 4384 let latest = result; 4385 for (let i = 0; i < finishers.length; i++) { 4386 let iResult = finishers[i](latest); 4387 if (iResult !== void 0) { 4388 latest = iResult; 4389 } 4390 } 4391 return latest; 4392 } 4393 4394
4394// js/request/interactions.js 4395 function coordinateNetworkInteractions(messageBus2) { 4396 interceptPartition(({ message, compileRequest }) => { 4397 if (!message.component.isIsolated) 4398 return; 4399 compileRequest([message]); 4400 }); 4401 interceptPartition(({ message, compileRequest }) => { 4402 if (message.component.isLazy && !message.component.hasBeenLazyLoaded && message.component.isLazyIsolated) { 4403 compileRequest([message]); 4404 } 4405 }); 4406 interceptPartition(({ message, compileRequest }) => { 4407 let component = message.component; 4408 let bundledMessages = []; 4409 component.getDeepChildrenWithBindings((child) => { 4410 let action = constructAction(child, "$commit"); 4411 let message2 = createOrAddToOutstandingMessage(action); 4412 bundledMessages.push(message2); 4413 }); 4414 if (bundledMessages.length > 0) { 4415 compileRequest([message, ...bundledMessages]); 4416 } 4417 }); 4418 interceptAction(({ action }) => { 4419 let isRenderless = action?.origin?.directive?.modifiers.includes("renderless"); 4420 if (isRenderless) { 4421 action.metadata.renderless = true; 4422 } 4423 let message = messageBus2.activeMessageMatchingScope(action); 4424 if (message) { 4425 if (message.isAsync() || action.isAsync()) 4426 return; 4427 if (action.metadata.type === "poll") { 4428 return action.cancel(); 4429 } 4430 if (Array.from(message.actions).every((action2) => action2.metadata.type === "poll")) { 4431 return message.cancel(); 4432 } 4433 let bothAreModelLive = action.metadata.type === "model.live" && Array.from(message.actions).every((action2) => action2.metadata.type === "model.live"); 4434 if (bothAreModelLive) { 4435 let incomingHasBoundChildren = componentHasBoundChildren(action.component); 4436 let outgoingHasBoundChildren = Array.from(message.actions).some((activeAction) => componentHasBoundChildren(activeAction.component)); 4437 if (!incomingHasBoundChildren && !outgoingHasBoundChildren) 4438 return; 4439 } 4440 action.defer(); 4441 message.addInterceptor(({ onFinish }) => { 4442 onFinish(() => action.fire()); 4443 }); 4444 } 4445 }); 4446 } 4447 function componentHasBoundChildren(component) { 4448 let hasBoundChildren = false; 4449 component.getDeepChildrenWithBindings(() => { 4450 hasBoundChildren = true; 4451 }); 4452 return hasBoundChildren; 4453 } 4454 4455
4455// js/request/request.js 4456 var MessageRequest = class { 4457 messages = /* @__PURE__ */ new Set(); 4458 controller = new AbortController(); 4459 interceptors = []; 4460 cancelled = false; 4461 uri = null; 4462 payload = null; 4463 options = null; 4464 addMessage(message) { 4465 message.setRequest(this); 4466 this.messages.add(message); 4467 } 4468 getActiveMessages() { 4469 return new Set([...this.messages].filter((message) => !message.isCancelled())); 4470 } 4471 initInterceptors(interceptorRegistry) { 4472 this.interceptors = interceptorRegistry.getRequestInterceptors(this); 4473 this.messages.forEach((message) => { 4474 let messageInterceptors = interceptorRegistry.getMessageInterceptors(message); 4475 message.setInterceptors(messageInterceptors); 4476 }); 4477 this.interceptors.forEach((interceptor2) => interceptor2.init()); 4478 this.messages.forEach((message) => { 4479 message.getInterceptors().forEach((interceptor2) => interceptor2.init()); 4480 }); 4481 } 4482 cancel() { 4483 if (this.cancelled) 4484 return; 4485 this.cancelled = true; 4486 this.controller.abort(); 4487 this.messages.forEach((message) => { 4488 if (message.isCancelled()) 4489 return; 4490 message.cancel(); 4491 }); 4492 } 4493 hasAllCancelledMessages() { 4494 return this.getActiveMessages().size === 0; 4495 } 4496 isCancelled() { 4497 return this.cancelled; 4498 } 4499 invokeOnSend({ responsePromise }) { 4500 this.interceptors.forEach((interceptor2) => interceptor2.onSend({ responsePromise })); 4501 this.messages.forEach((message) => message.invokeOnSend()); 4502 } 4503 invokeOnCancel() { 4504 this.interceptors.forEach((interceptor2) => interceptor2.onCancel()); 4505 } 4506 invokeOnFailure({ error: error2 }) { 4507 this.interceptors.forEach((interceptor2) => interceptor2.onFailure({ error: error2 })); 4508 this.messages.forEach((message) => message.invokeOnFailure(error2)); 4509 } 4510 invokeOnResponse({ response }) { 4511 this.interceptors.forEach((interceptor2) => interceptor2.onResponse({ response })); 4512 } 4513 invokeOnStream({ response }) { 4514 this.interceptors.forEach((interceptor2) => interceptor2.onStream({ response })); 4515 } 4516 invokeOnParsed({ response, body }) { 4517 this.interceptors.forEach((interceptor2) => interceptor2.onParsed({ response, body })); 4518 } 4519 invokeOnRedirect({ url, preventDefault }) { 4520 this.interceptors.forEach((interceptor2) => interceptor2.onRedirect({ url, preventDefault })); 4521 } 4522 invokeOnDump({ html, preventDefault }) { 4523 this.interceptors.forEach((interceptor2) => interceptor2.onDump({ html, preventDefault })); 4524 } 4525 invokeOnError({ response, body, preventDefault }) { 4526 this.interceptors.forEach((interceptor2) => interceptor2.onError({ response, body, preventDefault })); 4527 this.messages.forEach((message) => message.invokeOnError({ response, body, preventDefault })); 4528 } 4529 invokeOnSuccess({ response, body, json }) { 4530 this.interceptors.forEach((interceptor2) => interceptor2.onSuccess({ response, body, json })); 4531 } 4532 invokeOnFinish() { 4533 this.interceptors.forEach((interceptor2) => interceptor2.onFinish()); 4534 } 4535 }; 4536 var PageRequest = class { 4537 controller = new AbortController(); 4538 constructor(uri) { 4539 this.uri = uri; 4540 } 4541 cancel() { 4542 this.controller.abort(); 4543 } 4544 isCancelled() { 4545 return this.controller.signal.aborted; 4546 } 4547 }; 4548 4549
4549// js/request/interceptor.js 4550 var MessageInterceptor = class { 4551 onSend = () => { 4552 }; 4553 onCancel = () => { 4554 }; 4555 onFailure = () => { 4556 }; 4557 onError = () => { 4558 }; 4559 onStream = () => { 4560 }; 4561 onSuccess = () => { 4562 }; 4563 onSkipped = () => { 4564 }; 4565 onFinish = () => { 4566 }; 4567 onSync = () => { 4568 }; 4569 onEffect = () => { 4570 }; 4571 onMorph = async () => { 4572 }; 4573 onRender = () => { 4574 }; 4575 constructor(message, callback) { 4576 this.message = message; 4577 this.callback = callback; 4578 this.callback({ 4579 message: this.message, 4580 cancel: () => { 4581 let attachedToMessage = this.message.getInterceptors().includes(this); 4582 if (!attachedToMessage) { 4583 this.onCancel(); 4584 } 4585 this.message.cancel(); 4586 }, 4587 onSend: (callback2) => this.onSend = callback2, 4588 onCancel: (callback2) => this.onCancel = callback2, 4589 onFailure: (callback2) => this.onFailure = callback2, 4590 onError: (callback2) => this.onError = callback2, 4591 onStream: (callback2) => this.onStream = callback2, 4592 onSuccess: (callback2) => this.onSuccess = callback2, 4593 onSkipped: (callback2) => this.onSkipped = callback2, 4594 onFinish: (callback2) => this.onFinish = callback2 4595 }); 4596 } 4597 init() { 4598 } 4599 }; 4600 var RequestInterceptor = class { 4601 onSend = () => { 4602 }; 4603 onCancel = () => { 4604 }; 4605 onFailure = () => { 4606 }; 4607 onResponse = () => { 4608 }; 4609 onParsed = () => { 4610 }; 4611 onError = () => { 4612 }; 4613 onStream = () => { 4614 }; 4615 onRedirect = () => { 4616 }; 4617 onDump = () => { 4618 }; 4619 onSuccess = () => { 4620 }; 4621 onFinish = () => { 4622 }; 4623 constructor(request, callback) { 4624 this.request = request; 4625 this.callback = callback; 4626 this.callback({ 4627 request: this.request, 4628 onSend: (callback2) => this.onSend = callback2, 4629 onCancel: (callback2) => this.onCancel = callback2, 4630 onFailure: (callback2) => this.onFailure = callback2, 4631 onResponse: (callback2) => this.onResponse = callback2, 4632 onParsed: (callback2) => this.onParsed = callback2, 4633 onError: (callback2) => this.onError = callback2, 4634 onStream: (callback2) => this.onStream = callback2, 4635 onRedirect: (callback2) => this.onRedirect = callback2, 4636 onDump: (callback2) => this.onDump = callback2, 4637 onSuccess: (callback2) => this.onSuccess = callback2, 4638 onFinish: (callback2) => this.onFinish = callback2 4639 }); 4640 } 4641 init() { 4642 } 4643 }; 4644 var InterceptorRegistry = class { 4645 messageInterceptorCallbacks = []; 4646 messageInterceptorCallbacksByComponent = new WeakBag(); 4647 requestInterceptorCallbacks = []; 4648 addInterceptor(component, callback) { 4649 this.messageInterceptorCallbacksByComponent.add(component, callback); 4650 return () => { 4651 this.messageInterceptorCallbacksByComponent.delete(component, callback); 4652 }; 4653 } 4654 addMessageInterceptor(callback) { 4655 this.messageInterceptorCallbacks.push(callback); 4656 return () => { 4657 this.messageInterceptorCallbacks.splice(this.messageInterceptorCallbacks.indexOf(callback), 1); 4658 }; 4659 } 4660 addRequestInterceptor(callback) { 4661 this.requestInterceptorCallbacks.push(callback); 4662 return () => { 4663 this.requestInterceptorCallbacks.splice(this.requestInterceptorCallbacks.indexOf(callback), 1); 4664 }; 4665 } 4666 getMessageInterceptors(message) { 4667 let callbacks = [ 4668 ...this.messageInterceptorCallbacksByComponent.get(message.component), 4669 ...this.messageInterceptorCallbacks 4670 ]; 4671 return callbacks.map((callback) => { 4672 return new MessageInterceptor(message, callback); 4673 }); 4674 } 4675 getRequestInterceptors(request) { 4676 return this.requestInterceptorCallbacks.map((callback) => { 4677 return new RequestInterceptor(request, callback); 4678 }); 4679 } 4680 }; 4681 4682
4682// js/utils/modal.js 4683 function showHtmlModal(html) { 4684 let page = document.createElement("html"); 4685 page.innerHTML = html; 4686 page.querySelectorAll("a").forEach( 4687 (a) => a.setAttribute("target", "_top") 4688 ); 4689 let modal = document.getElementById("livewire-error"); 4690 if (typeof modal != "undefined" && modal != null) { 4691 modal.innerHTML = ""; 4692 } else { 4693 modal = document.createElement("dialog"); 4694 modal.id = "livewire-error"; 4695 modal.style.margin = "50px"; 4696 modal.style.width = "calc(100% - 100px)"; 4697 modal.style.height = "calc(100% - 100px)"; 4698 modal.style.borderRadius = "5px"; 4699 modal.style.padding = "0px"; 4700 } 4701 let iframe = document.createElement("iframe"); 4702 iframe.style.backgroundColor = "#17161A"; 4703 iframe.style.borderRadius = "5px"; 4704 iframe.style.width = "100%"; 4705 iframe.style.height = "100%"; 4706 modal.appendChild(iframe); 4707 document.body.prepend(modal); 4708 document.body.style.overflow = "hidden"; 4709 iframe.contentWindow.document.open(); 4710 iframe.contentWindow.document.write(page.outerHTML); 4711 iframe.contentWindow.document.close(); 4712 modal.addEventListener("click", () => hideHtmlModal(modal)); 4713 modal.addEventListener("close", () => cleanupModal(modal)); 4714 modal.showModal(); 4715 modal.focus(); 4716 modal.blur(); 4717 } 4718 function hideHtmlModal(modal) { 4719 modal.close(); 4720 } 4721 function cleanupModal(modal) { 4722 modal.outerHTML = ""; 4723 document.body.style.overflow = "visible"; 4724 } 4725 4726
4726// js/request/messageBus.js 4727 var componentSymbols = /* @__PURE__ */ new WeakMap(); 4728 var componentIslandSymbols = /* @__PURE__ */ new WeakMap(); 4729 function scopeSymbolFromMessage(message) { 4730 let component = message.component; 4731 let hasAllIslands = Array.from(message.actions).every((action) => action.metadata.island); 4732 if (hasAllIslands) { 4733 let islandName = Array.from(message.actions).map((action) => action.metadata.island.name).sort().join("|"); 4734 let islandSymbols = componentIslandSymbols.get(component); 4735 if (!islandSymbols) { 4736 islandSymbols = { [islandName]: Symbol() }; 4737 componentIslandSymbols.set(component, islandSymbols); 4738 } 4739 if (!islandSymbols[islandName]) { 4740 islandSymbols[islandName] = Symbol(); 4741 } 4742 return islandSymbols[islandName]; 4743 } 4744 if (!componentSymbols.has(component)) { 4745 componentSymbols.set(component, Symbol()); 4746 } 4747 return componentSymbols.get(component); 4748 } 4749 function scopeSymbolFromAction(action) { 4750 let component = action.component; 4751 let isIsland = !!action.metadata.island; 4752 if (isIsland) { 4753 let islandName = action.metadata.island.name; 4754 let islandSymbols = componentIslandSymbols.get(component); 4755 if (!islandSymbols) { 4756 islandSymbols = { [islandName]: Symbol() }; 4757 componentIslandSymbols.set(component, islandSymbols); 4758 } 4759 if (!islandSymbols[islandName]) { 4760 islandSymbols[islandName] = Symbol(); 4761 } 4762 return islandSymbols[islandName]; 4763 } 4764 if (!componentSymbols.has(component)) { 4765 componentSymbols.set(component, Symbol()); 4766 } 4767 return componentSymbols.get(component); 4768 } 4769 var MessageBus = class { 4770 pendingMessages = /* @__PURE__ */ new Set(); 4771 activeMessages = /* @__PURE__ */ new Set(); 4772 bufferingMessages = /* @__PURE__ */ new Set(); 4773 constructor() { 4774 } 4775 messageBuffer(message, callback) { 4776 if (this.bufferingMessages.has(message)) { 4777 return; 4778 } 4779 this.bufferingMessages.add(message); 4780 setTimeout(() => { 4781 callback(); 4782 this.bufferingMessages.delete(message); 4783 }, 5); 4784 } 4785 addPendingMessage(message) { 4786 this.pendingMessages.add(message); 4787 } 4788 clearPendingMessages() { 4789 this.pendingMessages.clear(); 4790 } 4791 getPendingMessages() { 4792 return Array.from(this.pendingMessages); 4793 } 4794 addActiveMessage(message) { 4795 this.activeMessages.add(message); 4796 } 4797 removeActiveMessage(message) { 4798 this.activeMessages.delete(message); 4799 } 4800 findScopedPendingMessage(action) { 4801 if (action.isAsync()) 4802 return null; 4803 let actionScope = scopeSymbolFromAction(action); 4804 return Array.from(this.pendingMessages).find((message) => { 4805 if (message.component !== action.component) 4806 return false; 4807 return Array.from(message.actions).some( 4808 (existingAction) => scopeSymbolFromAction(existingAction) === actionScope 4809 ); 4810 }); 4811 } 4812 activeMessageMatchingScope(action) { 4813 return Array.from(this.activeMessages).find((message) => this.matchesScope(message, action)); 4814 } 4815 matchesScope(message, action) { 4816 return message.scope === scopeSymbolFromAction(action); 4817 } 4818 allScopedMessages(action) { 4819 return [...Array.from(this.activeMessages), ...Array.from(this.pendingMessages)].filter((message) => { 4820 return this.matchesScope(message, action); 4821 }); 4822 } 4823 eachPendingMessage(callback) { 4824 Array.from(this.pendingMessages).forEach(callback); 4825 } 4826 }; 4827 4828
4828// js/request/message.js 4829 var Message = class { 4830 actions = /* @__PURE__ */ new Set(); 4831 snapshot = null; 4832 updates = null; 4833 calls = null; 4834 payload = null; 4835 responsePayload = null; 4836 pendingReturns = []; 4837 pendingReturnsMeta = {}; 4838 interceptors = []; 4839 cancelled = false; 4840 skipped = false; 4841 request = null; 4842 _scope = null; 4843 get scope() { 4844 if (!this._scope) { 4845 throw new Error("Message scope has not been set yet"); 4846 } 4847 return this._scope; 4848 } 4849 set scope(scope2) { 4850 this._scope = scope2; 4851 } 4852 constructor(component) { 4853 this.component = component; 4854 } 4855 addAction(action) { 4856 let actionsByFingerprint = /* @__PURE__ */ new Map(); 4857 Array.from(this.actions).forEach((action2) => { 4858 actionsByFingerprint.set(action2.fingerprint, action2); 4859 }); 4860 if (actionsByFingerprint.has(action.fingerprint)) { 4861 actionsByFingerprint.get(action.fingerprint).addSquashedAction(action); 4862 return; 4863 } 4864 action.message = this; 4865 this.actions.add(action); 4866 } 4867 removeAction(action) { 4868 this.actions.delete(action); 4869 action.message = null; 4870 if (this.actions.size === 0) { 4871 this.cancel(); 4872 } 4873 } 4874 getActions() { 4875 return Array.from(this.actions); 4876 } 4877 hasActionForIsland(island) { 4878 return this.getActions().some((action) => { 4879 return action.metadata.island?.name === island.metadata.name; 4880 }); 4881 } 4882 hasActionForComponent() { 4883 return this.getActions().some((action) => { 4884 return action.metadata.island === void 0; 4885 }); 4886 } 4887 setInterceptors(interceptors3) { 4888 this.interceptors = interceptors3; 4889 } 4890 addInterceptor(callback) { 4891 let interceptor2 = new MessageInterceptor(this, callback); 4892 this.interceptors.push(interceptor2); 4893 interceptor2.init(); 4894 } 4895 setRequest(request) { 4896 this.request = request; 4897 } 4898 getInterceptors() { 4899 return this.interceptors; 4900 } 4901 cancel() { 4902 if (this.cancelled) 4903 return; 4904 this.cancelled = true; 4905 this.invokeOnCancel(); 4906 if (this.request?.hasAllCancelledMessages()) { 4907 this.request.cancel(); 4908 } 4909 } 4910 isCancelled() { 4911 return this.cancelled; 4912 } 4913 markSkipped() { 4914 this.skipped = true; 4915 } 4916 isSkipped() { 4917 return this.skipped; 4918 } 4919 isAsync() { 4920 return Array.from(this.actions).every((action) => action.isAsync()); 4921 } 4922 invokeOnSend() { 4923 this.interceptors.forEach((interceptor2) => interceptor2.onSend({ 4924 payload: this.payload 4925 })); 4926 Array.from(this.actions).forEach((action, index2) => { 4927 let call = this.calls[index2]; 4928 action.invokeOnSend({ call }); 4929 }); 4930 } 4931 invokeOnCancel() { 4932 this.interceptors.forEach((interceptor2) => interceptor2.onCancel()); 4933 this.rejectActionPromises({ status: null, body: null, json: null, errors: null }); 4934 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4935 this.invokeOnFinish(); 4936 } 4937 invokeOnFailure(error2) { 4938 this.interceptors.forEach((interceptor2) => interceptor2.onFailure({ error: error2 })); 4939 Array.from(this.actions).forEach((action) => action.invokeOnFailure({ error: error2 })); 4940 this.rejectActionPromises({ status: null, body: null, json: null, errors: null }); 4941 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4942 this.invokeOnFinish(); 4943 } 4944 invokeOnError({ response, body, preventDefault }) { 4945 this.interceptors.forEach((interceptor2) => interceptor2.onError({ 4946 response, 4947 body, 4948 preventDefault 4949 })); 4950 Array.from(this.actions).forEach((action) => action.invokeOnError({ response, body, preventDefault })); 4951 let json = null; 4952 try { 4953 json = JSON.parse(body); 4954 } catch (e) { 4955 } 4956 this.rejectActionPromises({ status: response.status, body, json, errors: null }); 4957 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4958 this.invokeOnFinish(); 4959 } 4960 invokeOnStream({ json }) {
4961 this.interceptors.forEach((interceptor2) => interceptor2.onStream({ json })); 4962 } 4963 invokeOnSuccess() { 4964 this.interceptors.forEach((interceptor2) => { 4965 interceptor2.onSuccess({ 4966 payload: this.responsePayload, 4967 onSync: (callback) => interceptor2.onSync = callback, 4968 onEffect: (callback) => interceptor2.onEffect = callback, 4969 onMorph: (callback) => interceptor2.onMorph = callback, 4970 onRender: (callback) => interceptor2.onRender = callback 4971 }); 4972 }); 4973 this.pendingReturns = []; 4974 this.pendingReturnsMeta = {}; 4975 if (Object.prototype.hasOwnProperty.call(this.responsePayload.effects, "returns") && this.responsePayload.effects["returns"]) { 4976 this.pendingReturns = this.responsePayload.effects["returns"]; 4977 } 4978 if (Object.prototype.hasOwnProperty.call(this.responsePayload.effects, "returnsMeta") && this.responsePayload.effects["returnsMeta"]) { 4979 this.pendingReturnsMeta = this.responsePayload.effects["returnsMeta"]; 4980 } 4981 } 4982 invokeOnSync() { 4983 this.interceptors.forEach((interceptor2) => interceptor2.onSync()); 4984 } 4985 invokeOnEffect() { 4986 this.interceptors.forEach((interceptor2) => interceptor2.onEffect()); 4987 } 4988 async invokeOnMorph() { 4989 await Promise.all( 4990 this.interceptors.map((interceptor2) => interceptor2.onMorph()) 4991 ); 4992 } 4993 invokeOnRender() { 4994 this.interceptors.forEach((interceptor2) => interceptor2.onRender()); 4995 } 4996 invokeOnFinish() { 4997 this.interceptors.forEach((interceptor2) => interceptor2.onFinish()); 4998 } 4999 invokeOnSkipped() { 5000 this.interceptors.forEach((interceptor2) => interceptor2.onSkipped()); 5001 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 5002 } 5003 rejectActionPromises({ status, body, json, errors }) { 5004 Array.from(this.actions).forEach((action) => { 5005 action.rejectPromise({ status, body, json, errors }); 5006 }); 5007 } 5008 resolveActionPromises(returns, returnsMeta) { 5009 let resolvedActions = /* @__PURE__ */ new Set(); 5010 returns.forEach((value, index2) => { 5011 let action = Array.from(this.actions)[index2]; 5012 if (!action) 5013 return; 5014 let meta = returnsMeta[index2]; 5015 if (meta?.errors) { 5016 action.rejectPromise({ status: 422, body: null, json: null, errors: meta.errors }); 5017 action.invokeOnFinish(); 5018 resolvedActions.add(action); 5019 return; 5020 } 5021 if (meta?.status) { 5022 action.rejectPromise({ status: meta.status, body: null, json: null, errors: null }); 5023 action.invokeOnFinish(); 5024 resolvedActions.add(action); 5025 return; 5026 } 5027 action.invokeOnSuccess(value); 5028 action.resolvePromise(value); 5029 action.invokeOnFinish(); 5030 resolvedActions.add(action); 5031 }); 5032 Array.from(this.actions).forEach((action) => { 5033 if (resolvedActions.has(action)) 5034 return; 5035 action.invokeOnSuccess(void 0); 5036 action.resolvePromise(); 5037 action.invokeOnFinish(); 5038 }); 5039 } 5040 }; 5041 5042
5042// js/request/action.js 5043 var Action = class { 5044 squashedActions = /* @__PURE__ */ new Set(); 5045 onSendCallbacks = []; 5046 onCancelCallbacks = []; 5047 onSuccessCallbacks = []; 5048 onErrorCallbacks = []; 5049 onFailureCallbacks = []; 5050 onFinishCallbacks = []; 5051 message = null; 5052 cancelled = false; 5053 deferred = false; 5054 _fire = null; 5055 constructor(component, name, params = [], metadata = {}, origin = null) { 5056 this.component = component; 5057 this.name = name; 5058 this.params = params; 5059 this.metadata = metadata; 5060 this.origin = origin; 5061 this.promise = new Promise((resolve, reject) => { 5062 this.promiseResolution = { resolve, reject }; 5063 }); 5064 this.promise._livewireAction = this; 5065 } 5066 cancel() { 5067 if (this.cancelled) 5068 return; 5069 this.cancelled = true; 5070 this.invokeOnCancel(); 5071 this.invokeOnFinish(); 5072 this.rejectPromise({ status: null, body: null, json: null, errors: null }); 5073 this.squashedActions.forEach((action) => action.cancel()); 5074 if (this.message) { 5075 this.message.removeAction(this); 5076 } 5077 } 5078 isCancelled() { 5079 return this.cancelled; 5080 } 5081 defer() { 5082 this.deferred = true; 5083 } 5084 isDeferred() { 5085 return this.deferred; 5086 } 5087 fire() { 5088 if (this._fire) { 5089 this._fire(this); 5090 } 5091 } 5092 get fingerprint() { 5093 let componentId = this.component.id; 5094 let name = this.name; 5095 let params = JSON.stringify(this.params); 5096 let metadata = JSON.stringify(this.metadata); 5097 let bytes = new TextEncoder().encode(componentId + name + params + metadata); 5098 let binary = ""; 5099 let chunkSize = 8192; 5100 for (let i = 0; i < bytes.length; i += chunkSize) { 5101 binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize)); 5102 } 5103 return window.btoa(binary); 5104 } 5105 isAsync() { 5106 let asyncMethods = this.component.snapshot.memo?.async || []; 5107 let methodIsMarkedAsync = asyncMethods.includes(this.name); 5108 let actionIsAsync = this.origin?.directive?.modifiers.includes("async") || !!this.metadata.async; 5109 return methodIsMarkedAsync || actionIsAsync; 5110 } 5111 isJson() { 5112 let jsonMethods = this.component.snapshot.memo?.json || []; 5113 return jsonMethods.includes(this.name); 5114 } 5115 addInterceptor(callback) { 5116 callback({ 5117 action: this, 5118 onSend: (cb) => this.onSendCallbacks.push(cb), 5119 onCancel: (cb) => this.onCancelCallbacks.push(cb), 5120 onSuccess: (cb) => this.onSuccessCallbacks.push(cb), 5121 onError: (cb) => this.onErrorCallbacks.push(cb), 5122 onFailure: (cb) => this.onFailureCallbacks.push(cb), 5123 onFinish: (cb) => this.onFinishCallbacks.push(cb) 5124 }); 5125 } 5126 invokeOnSend({ call }) { 5127 this.onSendCallbacks.forEach((cb) => cb({ call })); 5128 this.squashedActions.forEach((action) => action.invokeOnSend({ call })); 5129 } 5130 invokeOnCancel() { 5131 this.onCancelCallbacks.forEach((cb) => cb()); 5132 this.squashedActions.forEach((action) => action.invokeOnCancel()); 5133 } 5134 invokeOnSuccess(result) { 5135 this.onSuccessCallbacks.forEach((cb) => cb(result)); 5136 this.squashedActions.forEach((action) => action.invokeOnSuccess(result)); 5137 } 5138 invokeOnError({ response, body, preventDefault }) { 5139 this.onErrorCallbacks.forEach((cb) => cb({ response, body, preventDefault })); 5140 this.squashedActions.forEach((action) => action.invokeOnError({ response, body, preventDefault })); 5141 } 5142 invokeOnFailure({ error: error2 }) { 5143 this.onFailureCallbacks.forEach((cb) => cb({ error: error2 })); 5144 this.squashedActions.forEach((action) => action.invokeOnFailure({ error: error2 })); 5145 } 5146 invokeOnFinish() { 5147 this.onFinishCallbacks.forEach((cb) => cb()); 5148 this.squashedActions.forEach((action) => action.invokeOnFinish()); 5149 } 5150 mergeMetadata(metadata) { 5151 this.metadata = { ...this.metadata, ...metadata }; 5152 } 5153 rejectPromise(error2) { 5154 this.squashedActions.forEach((action) => action.rejectPromise(error2)); 5155 this.promiseResolution.reject(error2); 5156 } 5157 addSquashedAction(action) { 5158 this.squashedActions.add(action); 5159 } 5160 resolvePromise(value) { 5161 this.squashedActions.forEach((action) => action.resolvePromise(value)); 5162 this.promiseResolution.resolve(value); 5163 } 5164 }; 5165 5166
5166// js/request/legacy.js 5167 function registerLegacyEventSupport(interceptRequest2, interceptMessage2) { 5168 interceptRequest2(({ 5169 request, 5170 onFailure, 5171 onResponse, 5172 onError, 5173 onSuccess 5174 }) => { 5175 let respondCallbacks = []; 5176 let succeedCallbacks = []; 5177 let failCallbacks = []; 5178 trigger2("request", { 5179 url: request.uri, 5180 options: request.options, 5181 payload: request.options.body, 5182 respond: (i) => respondCallbacks.push(i), 5183 succeed: (i) => succeedCallbacks.push(i), 5184 fail: (i) => failCallbacks.push(i) 5185 }); 5186 onResponse(({ response }) => { 5187 respondCallbacks.forEach((callback) => callback({ 5188 status: response.status, 5189 response 5190 })); 5191 }); 5192 onSuccess(({ response, json }) => { 5193 succeedCallbacks.forEach((callback) => callback({ 5194 status: response.status, 5195 json 5196 })); 5197 }); 5198 onFailure(({ error: error2 }) => { 5199 failCallbacks.forEach((callback) => callback({ 5200 status: 503, 5201 content: null, 5202 preventDefault: () => { 5203 } 5204 })); 5205 }); 5206 onError(({ response, body, preventDefault }) => { 5207 failCallbacks.forEach((callback) => callback({ 5208 status: response.status, 5209 content: body, 5210 preventDefault 5211 })); 5212 }); 5213 }); 5214 interceptMessage2(({ 5215 message, 5216 onCancel, 5217 onError, 5218 onSuccess, 5219 onFinish 5220 }) => { 5221 let respondCallbacks = []; 5222 let succeedCallbacks = []; 5223 let failCallbacks = []; 5224 trigger2("commit", { 5225 component: message.component, 5226 commit: message.payload, 5227 respond: (callback) => { 5228 respondCallbacks.push(callback); 5229 }, 5230 succeed: (callback) => { 5231 succeedCallbacks.push(callback); 5232 }, 5233 fail: (callback) => { 5234 failCallbacks.push(callback); 5235 } 5236 }); 5237 onFinish(() => { 5238 respondCallbacks.forEach((callback) => callback()); 5239 }); 5240 onSuccess(({ payload, onSync, onMorph, onRender }) => { 5241 onRender(() => { 5242 succeedCallbacks.forEach((callback) => callback({ 5243 snapshot: payload.snapshot, 5244 effects: payload.effects 5245 })); 5246 }); 5247 }); 5248 onError(() => { 5249 failCallbacks.forEach((callback) => callback()); 5250 }); 5251 onCancel(() => { 5252 failCallbacks.forEach((callback) => callback()); 5253 }); 5254 }); 5255 } 5256 5257
5257// js/request/index.js 5258 var outstandingActionOrigin = null; 5259 var outstandingActionMetadata = {}; 5260 var outstandingActionInterceptors = []; 5261 var interceptors2 = new InterceptorRegistry(); 5262 var messageBus = new MessageBus(); 5263 var actionInterceptors = []; 5264 var partitionInterceptors = []; 5265 var sessionExpired = false; 5266 function sessionIsExpired() { 5267 return sessionExpired; 5268 } 5269 function setNextActionOrigin(origin) { 5270 outstandingActionOrigin = origin; 5271 } 5272 function setNextActionMetadata(metadata) { 5273 outstandingActionMetadata = metadata; 5274 } 5275 function setNextActionInterceptor(callback) { 5276 outstandingActionInterceptors.push(callback); 5277 } 5278 function interceptAction(callback) { 5279 actionInterceptors.push(callback); 5280 return () => { 5281 actionInterceptors.splice(actionInterceptors.indexOf(callback), 1); 5282 }; 5283 } 5284 function interceptMessage(callback) { 5285 return interceptors2.addMessageInterceptor(callback); 5286 } 5287 function interceptRequest(callback) { 5288 return interceptors2.addRequestInterceptor(callback); 5289 } 5290 function interceptPartition(callback) { 5291 partitionInterceptors.push(callback); 5292 return () => { 5293 partitionInterceptors.splice(partitionInterceptors.indexOf(callback), 1); 5294 }; 5295 } 5296 function interceptComponentAction(component, actionNameOrCallback, maybeCallback) { 5297 let actionName = typeof actionNameOrCallback === "string" ? actionNameOrCallback : null; 5298 let callback = actionName ? maybeCallback : actionNameOrCallback; 5299 return interceptAction(({ action, ...rest }) => { 5300 if (action.component !== component) 5301 return; 5302 if (actionName && action.name !== actionName) 5303 return; 5304 callback({ action, ...rest }); 5305 }); 5306 } 5307 function interceptComponentMessage(component, actionNameOrCallback, maybeCallback) { 5308 let actionName = typeof actionNameOrCallback === "string" ? actionNameOrCallback : null; 5309 let callback = actionName ? maybeCallback : actionNameOrCallback; 5310 return interceptors2.addInterceptor(component, ({ message, ...rest }) => { 5311 if (actionName) { 5312 let hasAction = Array.from(message.actions).some((a) => a.name === actionName); 5313 if (!hasAction) 5314 return; 5315 } 5316 callback({ message, ...rest }); 5317 }); 5318 } 5319 function interceptComponentRequest(component, actionNameOrCallback, maybeCallback) { 5320 let actionName = typeof actionNameOrCallback === "string" ? actionNameOrCallback : null; 5321 let callback = actionName ? maybeCallback : actionNameOrCallback; 5322 return interceptRequest(({ request, ...rest }) => { 5323 let matchingMessages = Array.from(request.messages).filter((m) => { 5324 if (m.component !== component) 5325 return false; 5326 if (actionName) { 5327 return Array.from(m.actions).some((a) => a.name === actionName); 5328 } 5329 return true; 5330 }); 5331 if (matchingMessages.length === 0) 5332 return; 5333 callback({ request, ...rest }); 5334 }); 5335 } 5336 interceptMessage(({ message, onFinish }) => { 5337 messageBus.addActiveMessage(message); 5338 onFinish(() => messageBus.removeActiveMessage(message)); 5339 }); 5340 queueMicrotask(() => { 5341 coordinateNetworkInteractions(messageBus); 5342 }); 5343 function fireAction(component, method, params = [], metadata = {}) { 5344 if (component.__isWireProxy) 5345 component = component.__instance; 5346 let action = constructAction(component, method, params, metadata); 5347 actionInterceptors.forEach((callback) => { 5348 callback({ 5349 action, 5350 onSend: (cb) => action.onSendCallbacks.push(cb), 5351 onCancel: (cb) => action.onCancelCallbacks.push(cb), 5352 onSuccess: (cb) => action.onSuccessCallbacks.push(cb), 5353 onError: (cb) => action.onErrorCallbacks.push(cb), 5354 onFailure: (cb) => action.onFailureCallbacks.push(cb), 5355 onFinish: (cb) => action.onFinishCallbacks.push(cb) 5356 }); 5357 }); 5358 if (action.isCancelled() || action.isDeferred()) 5359 return action.promise; 5360 return fireActionInstance(action); 5361 } 5362 function constructAction(component, method, params, metadata) { 5363 let origin = outstandingActionOrigin; 5364 let pendingInterceptors = outstandingActionInterceptors; 5365 outstandingActionOrigin = null; 5366 outstandingActionInterceptors = []; 5367 metadata = { 5368 ...metadata, 5369 ...outstandingActionMetadata 5370 }; 5371 outstandingActionMetadata = {}; 5372 let action = new Action(component, method, params, metadata, origin); 5373 action._fire = fireActionInstance;
5374 pendingInterceptors.forEach((callback) => action.addInterceptor(callback)); 5375 return action; 5376 } 5377 function fireActionInstance(action) { 5378 let message = createOrAddToOutstandingMessage(action); 5379 messageBus.messageBuffer(message, () => { 5380 sendMessages(); 5381 }); 5382 return action.promise; 5383 } 5384 function createOrAddToOutstandingMessage(action) { 5385 let message = messageBus.findScopedPendingMessage(action); 5386 if (!message) 5387 message = new Message(action.component); 5388 message.addAction(action); 5389 messageBus.addPendingMessage(message); 5390 return message; 5391 } 5392 function sendMessages() { 5393 let requests = /* @__PURE__ */ new Set(); 5394 messageBus.eachPendingMessage((message) => { 5395 partitionInterceptors.forEach((callback) => { 5396 callback({ 5397 message, 5398 compileRequest: (messages2) => { 5399 let existingRequest = Array.from(requests).find( 5400 (request2) => messages2.some((message2) => request2.messages.has(message2)) 5401 ); 5402 if (existingRequest) { 5403 messages2.forEach((message2) => { 5404 if (!existingRequest.messages.has(message2)) { 5405 existingRequest.addMessage(message2); 5406 } 5407 }); 5408 return existingRequest; 5409 } 5410 let request = new MessageRequest(); 5411 messages2.forEach((message2) => request.addMessage(message2)); 5412 requests.add(request); 5413 return request; 5414 } 5415 }); 5416 }); 5417 }); 5418 let messages = messageBus.getPendingMessages(); 5419 messageBus.clearPendingMessages(); 5420 for (let message of messages) { 5421 if (Array.from(requests).some((request) => request.messages.has(message))) { 5422 continue; 5423 } 5424 let hasFoundRequest = false; 5425 requests.forEach((request) => { 5426 if (!hasFoundRequest) { 5427 let hasMessageForSameComponent = Array.from(request.messages).some((m) => m.component === message.component); 5428 if (hasMessageForSameComponent) 5429 return; 5430 request.addMessage(message);
5431 hasFoundRequest = true; 5432 } 5433 }); 5434 if (!hasFoundRequest) { 5435 let request = new MessageRequest(); 5436 request.addMessage(message); 5437 requests.add(request); 5438 } 5439 } 5440 requests.forEach((request) => { 5441 request.messages.forEach((message) => { 5442 message.snapshot = message.component.getEncodedSnapshotWithLatestChildrenMergedIn(); 5443 message.updates = message.component.getUpdates(); 5444 message.calls = Array.from(message.actions).map((i) => ({ 5445 method: i.name, 5446 params: i.params, 5447 metadata: i.metadata 5448 })); 5449 message.payload = { 5450 snapshot: message.snapshot, 5451 updates: message.updates, 5452 calls: message.calls 5453 }; 5454 }); 5455 }); 5456 requests.forEach((request) => { 5457 request.messages.forEach((message) => { 5458 message.scope = scopeSymbolFromMessage(message); 5459 }); 5460 }); 5461 requests.forEach((request) => { 5462 request.uri = getUpdateUri(); 5463 Object.defineProperty(request, "payload", { 5464 get() { 5465 return { 5466 _token: getCsrfToken(), 5467 components: Array.from(request.messages, (i) => i.payload) 5468 }; 5469 } 5470 }); 5471 let cachedOptions = null; 5472 Object.defineProperty(request, "options", { 5473 get() { 5474 if (cachedOptions) 5475 return cachedOptions; 5476 cachedOptions = { 5477 method: "POST", 5478 body: JSON.stringify(request.payload), 5479 headers: { 5480 "Content-type": "application/json", 5481 "X-Livewire": "1" 5482 }, 5483 signal: request.controller.signal 5484 }; 5485 return cachedOptions; 5486 } 5487 }); 5488 }); 5489 requests.forEach((request) => { 5490 request.initInterceptors(interceptors2); 5491 if (request.hasAllCancelledMessages()) { 5492 request.cancel(); 5493 } 5494 sendRequest(request, { 5495 send: ({ responsePromise }) => { 5496 request.invokeOnSend({ responsePromise }); 5497 }, 5498 failure: ({ error: error2 }) => { 5499 request.invokeOnFailure({ error: error2 }); 5500 }, 5501 finish: () => { 5502 request.invokeOnFinish(); 5503 }, 5504 response: ({ response }) => { 5505 request.invokeOnResponse({ response }); 5506 }, 5507 stream: async ({ response }) => { 5508 request.invokeOnStream({ response }); 5509 let finalResponse = ""; 5510 try { 5511 finalResponse = await interceptStreamAndReturnFinalResponse(response, (json) => { 5512 let componentId = json.id; 5513 request.messages.forEach((message) => { 5514 if (message.component.id === componentId) { 5515 message.invokeOnStream({ json }); 5516 } 5517 }); 5518 trigger2("stream", json); 5519 }); 5520 } catch (e) { 5521 request.cancel(); 5522 throw e; 5523 } 5524 return finalResponse; 5525 }, 5526 parsed: ({ response, responseBody }) => { 5527 request.invokeOnParsed({ response, body: responseBody }); 5528 }, 5529 error: ({ response, responseBody }) => { 5530 let preventDefault = false;
5531 request.invokeOnError({ response, body: responseBody, preventDefault: () => preventDefault = true }); 5532 if (preventDefault) 5533 return; 5534 if (response.status === 419) { 5535 if (sessionExpired) 5536 return; 5537 sessionExpired = true; 5538 confirm( 5539 "This page has expired.\nWould you like to refresh the page?" 5540 ) && window.location.reload(); 5541 return; 5542 } 5543 if (response.aborted) 5544 return; 5545 showHtmlModal(responseBody); 5546 }, 5547 redirect: (url) => { 5548 let preventDefault = false; 5549 request.invokeOnRedirect({ url, preventDefault: () => preventDefault = true }); 5550 if (preventDefault) 5551 return; 5552 window.location.href = url; 5553 }, 5554 dump: (html) => { 5555 let preventDefault = false; 5556 request.invokeOnDump({ html, preventDefault: () => preventDefault = true }); 5557 if (preventDefault) 5558 return; 5559 showHtmlModal(html); 5560 }, 5561 success: async ({ response, responseBody, responseJson }) => { 5562 request.invokeOnSuccess({ response, body: responseBody, json: responseJson }); 5563 await triggerAsync("payload.intercept", responseJson); 5564 let messageResponsePayloads = responseJson.components; 5565 request.messages.forEach((message) => { 5566 messageResponsePayloads.forEach((payload) => { 5567 if (message.isCancelled()) 5568 return; 5569 if (payload.skip) { 5570 if (payload.id === message.component.id) { 5571 message.responsePayload = payload; 5572 message.markSkipped(); 5573 message.invokeOnSkipped(); 5574 message.resolveActionPromises([], []); 5575 message.invokeOnFinish(); 5576 } 5577 return; 5578 } 5579 let { snapshot: snapshotEncoded, effects } = payload; 5580 let snapshot = JSON.parse(snapshotEncoded); 5581 if (snapshot.memo.id === message.component.id) { 5582 message.responsePayload = { snapshot, effects }; 5583 message.invokeOnSuccess(); 5584 if (message.isCancelled()) 5585 return; 5586 Alpine.transaction(async () => { 5587 message.component.mergeNewSnapshot(snapshotEncoded, effects, message.updates); 5588 message.invokeOnSync(); 5589 if (message.isCancelled()) 5590 return; 5591 message.component.processEffects(effects, request); 5592 message.invokeOnEffect(); 5593 if (message.isCancelled()) 5594 return; 5595 await message.invokeOnMorph(); 5596 }).then(() => { 5597 if (!message.isCancelled()) { 5598 message.resolveActionPromises( 5599 message.pendingReturns, 5600 message.pendingReturnsMeta 5601 ); 5602 message.invokeOnFinish(); 5603 } 5604 requestAnimationFrame(() => { 5605 if (message.isCancelled()) 5606 return; 5607 message.invokeOnRender(); 5608 }); 5609 }); 5610 } 5611 }); 5612 }); 5613 } 5614 }); 5615 }); 5616 } 5617 async function sendRequest(request, handlers) { 5618 let response; 5619 try { 5620 if (request.isCancelled()) 5621 return; 5622 let responsePromise = fetch(request.uri, request.options); 5623 if (request.isCancelled()) 5624 return; 5625 handlers.send({ responsePromise }); 5626 response = await responsePromise; 5627 } catch (e) { 5628 if (request.isCancelled()) 5629 return; 5630 handlers.failure({ error: e }); 5631 handlers.finish(); 5632 return; 5633 } 5634 handlers.response({ response }); 5635 let responseBody = null; 5636 if (response.headers.has("X-Livewire-Stream")) { 5637 responseBody = await handlers.stream({ response }); 5638 } else { 5639 responseBody = await response.text(); 5640 } 5641 if (request.isCancelled()) 5642 return; 5643 handlers.parsed({ response, responseBody }); 5644 if (!response.ok) { 5645 handlers.error({ response, responseBody }); 5646 handlers.finish(); 5647 return; 5648 } 5649 if (response.redirected) { 5650 handlers.redirect(response.url); 5651 handlers.finish(); 5652 return; 5653 } 5654 if (contentIsFromDump(responseBody)) { 5655 let dump; 5656 [dump, responseBody] = splitDumpFromContent(responseBody); 5657 handlers.dump(dump); 5658 } 5659 let responseJson = null; 5660 try { 5661 responseJson = JSON.parse(responseBody); 5662 } catch (e) { 5663 console.error(e); 5664 handlers.error({ response, responseBody }); 5665 handlers.finish(); 5666 return; 5667 } 5668 handlers.success({ response, responseBody, responseJson }); 5669 handlers.finish(); 5670 } 5671 async function interceptStreamAndReturnFinalResponse(response, callback) { 5672 let reader = response.body.getReader(); 5673 let remainingResponse = ""; 5674 while (true) { 5675 let { done, value: chunk } = await reader.read(); 5676 let decoder = new TextDecoder(); 5677 let output = decoder.decode(chunk); 5678 let [streams, remaining] = extractStreamObjects(remainingResponse + output);
5679 streams.forEach((stream) => { 5680 callback(stream); 5681 }); 5682 remainingResponse = remaining; 5683 if (done) 5684 return remainingResponse; 5685 } 5686 } 5687 function extractStreamObjects(raw2) { 5688 let regex = /({"stream":true.*?"endStream":true})/g; 5689 let matches3 = raw2.match(regex); 5690 let parsed = []; 5691 if (matches3) { 5692 for (let i = 0; i < matches3.length; i++) { 5693 parsed.push(JSON.parse(matches3[i]).body); 5694 } 5695 } 5696 let remaining = raw2.replace(regex, ""); 5697 return [parsed, remaining]; 5698 } 5699 async function sendNavigateRequest(uri, callback, errorCallback) { 5700 let request = new PageRequest(uri); 5701 let options = { 5702 headers: { 5703 "X-Livewire-Navigate": "1" 5704 }, 5705 signal: request.controller.signal 5706 }; 5707 trigger2("navigate.request", { 5708 uri, 5709 options 5710 }); 5711 let response; 5712 try { 5713 response = await fetch(uri, options); 5714 let destination = getDestination(uri, response); 5715 let html = await response.text(); 5716 let status = response.status; 5717 callback(html, destination, status); 5718 } catch (error2) { 5719 errorCallback(error2); 5720 throw error2; 5721 } 5722 } 5723 function getDestination(uri, response) { 5724 let destination = createUrlObjectFromString(uri); 5725 let finalDestination = createUrlObjectFromString(response.url); 5726 if (destination.pathname + destination.search === finalDestination.pathname + finalDestination.search) { 5727 finalDestination.hash = destination.hash; 5728 } 5729 return finalDestination; 5730 } 5731 function createUrlObjectFromString(urlString) { 5732 return urlString !== null && new URL(urlString, document.baseURI); 5733 } 5734 registerLegacyEventSupport(interceptRequest, interceptMessage); 5735 5736
5736// js/features/supportErrors.js 5737 function getErrorsObject(component) { 5738 let state = component.__errorsState ??= module_default.reactive({ 5739 clientErrors: null 5740 }); 5741 component.__lastErrorsSnapshot ??= component.snapshot; 5742 return { 5743 messages() { 5744 if (component.__lastErrorsSnapshot !== component.snapshot) { 5745 state.clientErrors = null; 5746 component.__lastErrorsSnapshot = component.snapshot; 5747 } 5748 return state.clientErrors ??= component.snapshot.memo.errors; 5749 }, 5750 keys() { 5751 return Object.keys(this.messages()); 5752 }, 5753 has(...keys) { 5754 if (this.isEmpty()) 5755 return false; 5756 if (keys.length === 0 || keys.length === 1 && keys[0] == null) 5757 return this.any(); 5758 if (keys.length === 1 && Array.isArray(keys[0])) 5759 keys = keys[0]; 5760 for (let key of keys) { 5761 if (this.first(key) === "") 5762 return false; 5763 } 5764 return true; 5765 }, 5766 hasAny(keys) { 5767 if (this.isEmpty()) 5768 return false; 5769 if (keys.length === 1 && Array.isArray(keys[0])) 5770 keys = keys[0]; 5771 for (let key of keys) { 5772 if (this.has(key)) 5773 return true; 5774 } 5775 return false; 5776 }, 5777 missing(...keys) { 5778 if (keys.length === 1 && Array.isArray(keys[0])) 5779 keys = keys[0]; 5780 return !this.hasAny(keys); 5781 }, 5782 first(key = null) { 5783 let messages = key === null ? this.all() : this.get(key); 5784 let firstMessage = messages.length > 0 ? messages[0] : ""; 5785 return Array.isArray(firstMessage) ? firstMessage[0] : firstMessage; 5786 }, 5787 get(key) { 5788 return this.messages()[key] || []; 5789 }, 5790 all() { 5791 return Object.values(this.messages()).flat(); 5792 }, 5793 isEmpty() { 5794 return !this.any(); 5795 }, 5796 isNotEmpty() { 5797 return this.any(); 5798 }, 5799 any() { 5800 return Object.keys(this.messages()).length > 0; 5801 }, 5802 count() { 5803 return Object.values(this.messages()).reduce((total, array) => { 5804 return total + array.length; 5805 }, 0); 5806 }, 5807 clear(field = null) { 5808 if (field === null) { 5809 state.clientErrors = {}; 5810 } else { 5811 let errors = { ...state.clientErrors ?? component.snapshot.memo.errors }; 5812 delete errors[field]; 5813 state.clientErrors = errors; 5814 } 5815 } 5816 }; 5817 } 5818 5819
5819// js/features/supportRefs.js 5820 function findRefEl(component, name) { 5821 let refEl = component.el.querySelector(`[wire\\:ref="${name}"]`); 5822 if (!refEl) 5823 return console.error(`Ref "${name}" not found in component "${component.id}"`); 5824 return refEl; 5825 } 5826 5827
5827// js/directives.js 5828 var customDirectiveNames = /* @__PURE__ */ new Set(); 5829 function matchesForLivewireDirective(attributeName) { 5830 return attributeName.match(new RegExp("wire:")); 5831 } 5832 function extractDirective(el, name) { 5833 let [value, ...modifiers] = name.replace(new RegExp("wire:"), "").split("."); 5834 return new Directive(value, modifiers, name, el); 5835 } 5836 function directive2(name, callback) { 5837 if (customDirectiveNames.has(name)) 5838 return; 5839 customDirectiveNames.add(name); 5840 on2("directive.init", ({ el, component, directive: directive3, cleanup: cleanup2 }) => { 5841 if (directive3.value === name) { 5842 callback({ 5843 el, 5844 directive: directive3, 5845 component, 5846 $wire: component.$wire, 5847 cleanup: cleanup2 5848 }); 5849 } 5850 }); 5851 } 5852 function globalDirective(name, callback) { 5853 if (customDirectiveNames.has(name)) 5854 return; 5855 customDirectiveNames.add(name); 5856 on2("directive.global.init", ({ el, directive: directive3, cleanup: cleanup2 }) => { 5857 if (directive3.value === name) { 5858 callback({ el, directive: directive3, cleanup: cleanup2 }); 5859 } 5860 }); 5861 } 5862 function getDirectives(el) { 5863 return new DirectiveManager(el); 5864 } 5865 function customDirectiveHasBeenRegistered(name) { 5866 return customDirectiveNames.has(name); 5867 } 5868 var DirectiveManager = class { 5869 constructor(el) { 5870 this.el = el; 5871 this.directives = this.extractTypeModifiersAndValue(); 5872 } 5873 all() { 5874 return this.directives; 5875 } 5876 has(value) { 5877 return this.directives.map((directive3) => directive3.value).includes(value); 5878 } 5879 missing(value) { 5880 return !this.has(value); 5881 } 5882 get(value) { 5883 return this.directives.find((directive3) => directive3.value === value); 5884 } 5885 extractTypeModifiersAndValue() { 5886 return Array.from(this.el.getAttributeNames().filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(this.el, name))); 5887 } 5888 }; 5889 var Directive = class { 5890 constructor(value, modifiers, rawName, el) { 5891 this.rawName = this.raw = rawName; 5892 this.el = el; 5893 this.eventContext; 5894 this.wire; 5895 this.value = value; 5896 this.modifiers = modifiers; 5897 this.expression = this.el.getAttribute(this.rawName); 5898 } 5899 get method() { 5900 const methods = this.parseOutMethodsAndParams(this.expression); 5901 return methods[0].method; 5902 } 5903 get methods() { 5904 return this.parseOutMethodsAndParams(this.expression); 5905 } 5906 get params() { 5907 const methods = this.parseOutMethodsAndParams(this.expression); 5908 return methods[0].params; 5909 } 5910 parseOutMethodsAndParams(rawMethod) { 5911 let methods = []; 5912 let parsedMethods = this.splitAndParseMethods(rawMethod); 5913 for (let { method, paramString } of parsedMethods) { 5914 let params = []; 5915 if (paramString.length > 0) { 5916 let argumentsToArray = function() { 5917 for (var l = arguments.length, p = new Array(l), k = 0; k < l; k++) { 5918 p[k] = arguments[k]; 5919 } 5920 return [].concat(p); 5921 }; 5922 try { 5923 params = Alpine.evaluate( 5924 document, 5925 "argumentsToArray(" + paramString + ")", 5926 { 5927 scope: { argumentsToArray } 5928 } 5929 ); 5930 } catch (error2) { 5931 console.warn("Failed to parse parameters:", paramString, error2); 5932 params = []; 5933 } 5934 } 5935 methods.push({ method, params }); 5936 } 5937 return methods; 5938 } 5939 splitAndParseMethods(methodExpression) { 5940 let methods = []; 5941 let current = ""; 5942 let parenCount = 0; 5943 let inString = false; 5944 let stringChar = null; 5945 let trimmedExpression = methodExpression.trim(); 5946 for (let i = 0; i < trimmedExpression.length; i++) { 5947 let char = trimmedExpression[i]; 5948 if (!inString) { 5949 if (char === '"' || char === "'") { 5950 inString = true; 5951 stringChar = char; 5952 current += char; 5953 } else if (char === "(") { 5954 parenCount++; 5955 current += char; 5956 } else if (char === ")") { 5957 parenCount--; 5958 current += char; 5959 } else if (char === "," && parenCount === 0) { 5960 methods.push(this.parseMethodCall(current.trim())); 5961 current = ""; 5962 } else { 5963 current += char; 5964 } 5965 } else { 5966 if (char === stringChar && trimmedExpression[i - 1] !== "\\") { 5967 inString = false;
5968 stringChar = null; 5969 } 5970 current += char; 5971 } 5972 } 5973 if (current.trim().length > 0) { 5974 methods.push(this.parseMethodCall(current.trim())); 5975 } 5976 return methods; 5977 } 5978 parseMethodCall(methodString) { 5979 let methodMatch = methodString.match(/^([^(]+)\(/); 5980 if (!methodMatch) { 5981 return { 5982 method: methodString.trim(), 5983 paramString: "" 5984 }; 5985 } 5986 let method = methodMatch[1].trim(); 5987 let paramStart = methodMatch[0].length - 1; 5988 let lastParenIndex = methodString.lastIndexOf(")"); 5989 if (lastParenIndex === -1) { 5990 throw new Error(`Missing closing parenthesis for method "${method}"`); 5991 } 5992 let paramString = methodString.slice(paramStart + 1, lastParenIndex).trim(); 5993 return { 5994 method, 5995 paramString 5996 }; 5997 } 5998 }; 5999 6000
6000// js/directives/shared.js 6001 function toggleBooleanStateDirective(el, directive3, isTruthy, cachedDisplay = null) { 6002 isTruthy = directive3.modifiers.includes("remove") ? !isTruthy : isTruthy; 6003 if (directive3.modifiers.includes("class")) { 6004 let classes = directive3.expression.split(" ").filter(String); 6005 if (isTruthy) { 6006 el.classList.add(...classes); 6007 } else { 6008 el.classList.remove(...classes); 6009 } 6010 } else if (directive3.modifiers.includes("attr")) { 6011 if (isTruthy) { 6012 el.setAttribute(directive3.expression, true); 6013 } else { 6014 el.removeAttribute(directive3.expression); 6015 } 6016 } else { 6017 let cache = cachedDisplay ?? window.getComputedStyle(el, null).getPropertyValue("display"); 6018 let display = ["inline", "list-item", "block", "table", "flex", "grid", "inline-flex"].filter((i) => directive3.modifiers.includes(i))[0] || "inline-block"; 6019 display = directive3.modifiers.includes("remove") && !isTruthy ? cache : display; 6020 el.style.display = isTruthy ? display : "none"; 6021 } 6022 } 6023 6024
6024// js/directives/wire-dirty.js 6025 var refreshDirtyStatesByComponent = new WeakBag(); 6026 on2("commit", ({ component, succeed }) => { 6027 succeed(() => { 6028 setTimeout(() => { 6029 refreshDirtyStatesByComponent.each(component, (i) => i(false)); 6030 }); 6031 }); 6032 }); 6033 directive2("dirty", ({ el, directive: directive3, component }) => { 6034 let targets = dirtyTargets(el); 6035 let oldIsDirty = false; 6036 let initialDisplay = el.style.display; 6037 let refreshDirtyState = (isDirty) => { 6038 toggleBooleanStateDirective(el, directive3, isDirty, initialDisplay); 6039 oldIsDirty = isDirty; 6040 }; 6041 refreshDirtyStatesByComponent.add(component, refreshDirtyState); 6042 Alpine.effect(() => { 6043 let isDirty = false; 6044 isDirty = checkDirty(component, targets.length === 0 ? void 0 : targets); 6045 if (oldIsDirty !== isDirty) { 6046 refreshDirtyState(isDirty); 6047 } 6048 oldIsDirty = isDirty; 6049 }); 6050 }); 6051 function checkDirty(component, targets) { 6052 let isDirty = false; 6053 if (targets === void 0) { 6054 isDirty = JSON.stringify(component.canonical) !== JSON.stringify(component.reactive); 6055 } else if (Array.isArray(targets)) { 6056 for (let i = 0; i < targets.length; i++) { 6057 if (isDirty) 6058 break; 6059 let target = targets[i]; 6060 isDirty = JSON.stringify(dataGet(component.canonical, target)) !== JSON.stringify(dataGet(component.reactive, target)); 6061 } 6062 } else { 6063 isDirty = JSON.stringify(dataGet(component.canonical, targets)) !== JSON.stringify(dataGet(component.reactive, targets)); 6064 } 6065 return isDirty; 6066 } 6067 function dirtyTargets(el) { 6068 let directives2 = getDirectives(el); 6069 let targets = []; 6070 if (directives2.has("model")) { 6071 targets.push(directives2.get("model").expression); 6072 } 6073 if (directives2.has("target")) { 6074 targets = targets.concat( 6075 directives2.get("target").expression.split(",").map((s) => s.trim()) 6076 ); 6077 } 6078 return targets; 6079 } 6080 6081
6081// js/features/supportJsModules.js 6082 var pendingComponentAssets = /* @__PURE__ */ new WeakMap(); 6083 on2("effect", ({ component, effects }) => { 6084 let scriptModuleHash; 6085 if (Object.prototype.hasOwnProperty.call(effects, "scriptModule")) { 6086 scriptModuleHash = effects.scriptModule; 6087 } 6088 if (scriptModuleHash) { 6089 let encodedName = component.name.replace(/\./g, "--").replace(/::/g, "---").replace(/:/g, "----"); 6090 let path = `${getModuleUrl()}/js/${encodedName}.js?v=${scriptModuleHash}`; 6091 pendingComponentAssets.set(component, Alpine.reactive({ 6092 loading: true, 6093 afterLoaded: [] 6094 })); 6095 import( 6096 /* @vite-ignore */ 6097 path 6098 ).then((module) => { 6099 module.run.call(component.$wire, component.$wire, component.$wire.js); 6100 pendingComponentAssets.get(component).loading = false; 6101 pendingComponentAssets.get(component).afterLoaded.forEach((callback) => callback()); 6102 pendingComponentAssets.delete(component); 6103 }); 6104 } 6105 }); 6106 function assetIsPendingFor(component) { 6107 return pendingComponentAssets.has(component) && pendingComponentAssets.get(component).loading; 6108 } 6109 function runAfterAssetIsLoadedFor(component, callback) { 6110 if (assetIsPendingFor(component)) { 6111 pendingComponentAssets.get(component).afterLoaded.push(() => callback()); 6112 } else { 6113 callback(); 6114 } 6115 } 6116 6117 // js/$wire.js 6118 var properties = {}; 6119 var fallback; 6120 function wireProperty(name, callback, component = null) { 6121 properties[name] = callback; 6122 } 6123 function wireFallback(callback) { 6124 fallback = callback; 6125 } 6126 var aliases = { 6127 "on": "$on", 6128 "el": "$el", 6129 "id": "$id", 6130 "js": "$js", 6131 "get": "$get", 6132 "set": "$set", 6133 "refs": "$refs", 6134 "call": "$call", 6135 "hook": "$hook", 6136 "watch": "$watch", 6137 "dirty": "$dirty", 6138 "effect": "$effect", 6139 "commit": "$commit", 6140 "errors": "$errors", 6141 "island": "$island", 6142 "upload": "$upload", 6143 "entangle": "$entangle", 6144 "dispatch": "$dispatch", 6145 "intercept": "$intercept", 6146 "interceptAction": "$interceptAction", 6147 "interceptMessage": "$interceptMessage", 6148 "interceptRequest": "$interceptRequest", 6149 "dispatchTo": "$dispatchTo", 6150 "dispatchSelf": "$dispatchSelf", 6151 "dispatchEl": "$dispatchEl", 6152 "dispatchRef": "$dispatchRef", 6153 "removeUpload": "$removeUpload", 6154 "cancelUpload": "$cancelUpload", 6155 "uploadMultiple": "$uploadMultiple" 6156 }; 6157 function generateWireObject(component, state) { 6158 let isScoped = false; 6159 return new Proxy({}, { 6160 get(target, property) { 6161 if (property === "__instance") 6162 return component; 6163 if (property in aliases) { 6164 return getProperty(component, aliases[property]); 6165 } else if (property in properties) { 6166 return getProperty(component, property); 6167 } else if (property in state) { 6168 return state[property]; 6169 } else if (property === "toJSON") { 6170 return () => component.toJSON(); 6171 } else if (!["then"].includes(property)) { 6172 return getFallback(component)(property); 6173 } 6174 }, 6175 set(target, property, value) { 6176 if (property in state) { 6177 state[property] = value; 6178 } 6179 return true; 6180 } 6181 }); 6182 } 6183 function getProperty(component, name) { 6184 return properties[name](component); 6185 } 6186 function getFallback(component) { 6187 return fallback(component); 6188 } 6189 module_default.magic("wire", (el, { cleanup: cleanup2 }) => {
6190 let component; 6191 return new Proxy({}, { 6192 get(target, property) { 6193 if (!component) { 6194 try { 6195 component = findComponentByEl(el); 6196 } catch (e) { 6197 return () => { 6198 }; 6199 } 6200 } 6201 if (["$entangle", "entangle"].includes(property)) { 6202 return generateEntangleFunction(component, cleanup2); 6203 } 6204 return component.$wire[property]; 6205 }, 6206 set(target, property, value) { 6207 if (!component) { 6208 try { 6209 component = findComponentByEl(el); 6210 } catch (e) { 6211 return true; 6212 } 6213 } 6214 component.$wire[property] = value; 6215 return true; 6216 } 6217 }); 6218 }); 6219 wireProperty("__instance", (component) => component); 6220 wireProperty("$get", (component) => (property, reactive3 = true) => dataGet(reactive3 ? component.reactive : component.ephemeral, property)); 6221 wireProperty("$el", (component) => { 6222 return component.el; 6223 }); 6224 wireProperty("$id", (component) => { 6225 return component.id; 6226 }); 6227 wireProperty("$js", (component) => { 6228 let fn = component.addJsAction.bind(component); 6229 let jsActions = component.getJsActions(); 6230 Object.keys(jsActions).forEach((name) => { 6231 fn[name] = jsActions[name]; 6232 }); 6233 return new Proxy(fn, { 6234 set(target, property, value) { 6235 component.addJsAction(property, value); 6236 return true; 6237 }, 6238 get(target, property) { 6239 if (assetIsPendingFor(component)) { 6240 let resolver = null; 6241 let promise = new Promise((resolve) => { 6242 resolver = resolve; 6243 }); 6244 return (...params) => { 6245 runAfterAssetIsLoadedFor(component, () => { 6246 resolver(component.getJsAction(property)(...params)); 6247 }); 6248 return promise; 6249 }; 6250 } 6251 return target[property]; 6252 } 6253 }); 6254 }); 6255 wireProperty("$set", (component) => async (property, value, live = true) => { 6256 dataSet(component.reactive, property, value); 6257 if (live) { 6258 component.queueUpdate(property, value); 6259 return fireAction(component, "$set"); 6260 } 6261 return Promise.resolve(); 6262 }); 6263 wireProperty("$refs", (component) => { 6264 let fn = (name) => findRefEl(component, name); 6265 return new Proxy(fn, { 6266 get(target, property) { 6267 if (property in target) { 6268 return target[property]; 6269 } 6270 return fn(property); 6271 } 6272 }); 6273 }); 6274 wireProperty("$dirty", (component) => (property) => { 6275 let reactive3 = module_default.reactive({ dirty: false }); 6276 interceptComponentMessage(component, ({ onFinish }) => { 6277 onFinish(() => { 6278 queueMicrotask(() => { 6279 reactive3.dirty = checkDirty(component, property); 6280 }); 6281 }); 6282 }); 6283 module_default.effect(() => { 6284 reactive3.dirty = checkDirty(component, property); 6285 }); 6286 return reactive3.dirty; 6287 }); 6288 wireProperty("$intercept", (component) => (actionNameOrCallback, maybeCallback) => { 6289 return interceptComponentAction(component, actionNameOrCallback, maybeCallback); 6290 }); 6291 wireProperty("$interceptAction", (component) => (actionNameOrCallback, maybeCallback) => { 6292 return interceptComponentAction(component, actionNameOrCallback, maybeCallback); 6293 }); 6294 wireProperty("$interceptMessage", (component) => (actionNameOrCallback, maybeCallback) => { 6295 return interceptComponentMessage(component, actionNameOrCallback, maybeCallback); 6296 }); 6297 wireProperty("$interceptRequest", (component) => (actionNameOrCallback, maybeCallback) => { 6298 return interceptComponentRequest(component, actionNameOrCallback, maybeCallback); 6299 }); 6300 wireProperty("$errors", (component) => getErrorsObject(component)); 6301 wireProperty("$call", (component) => async (method, ...params) => { 6302 return await component.$wire[method](...params); 6303 }); 6304 wireProperty("$island", (component) => (name, options = {}) => { 6305 setNextActionMetadata({ island: { name, mode: "morph", ...options } }); 6306 return component.$wire; 6307 }); 6308 wireProperty("$entangle", (component) => (name, live = false) => { 6309 return generateEntangleFunction(component)(name, live); 6310 }); 6311 wireProperty("$toggle", (component) => (name, live = true) => { 6312 return component.$wire.set(name, !component.$wire.get(name), live); 6313 }); 6314 wireProperty("$watch", (component) => (path, callback) => { 6315 let getter = () => { 6316 return dataGet(component.reactive, path); 6317 }; 6318 let unwatch = module_default.watch(getter, callback); 6319 let removeCleanup = component.addCleanup(unwatch); 6320 return () => { 6321 removeCleanup(); 6322 unwatch(); 6323 }; 6324 }); 6325 wireProperty("$effect", (component) => (callback) => { 6326 let effect3 = module_default.effect(callback); 6327 component.addCleanup(effect3); 6328 return effect3; 6329 }); 6330 wireProperty("$refresh", (component) => async () => { 6331 return fireAction(component, "$refresh"); 6332 }); 6333 wireProperty("$commit", (component) => async () => { 6334 return fireAction(component, "$commit"); 6335 }); 6336 wireProperty("$on", (component) => (...params) => listen2(component, ...params)); 6337 wireProperty("$hook", (component) => (name, callback) => { 6338 let unhook = on2(name, ({ component: hookComponent, ...params }) => { 6339 if (hookComponent === void 0) 6340 return callback(params); 6341 if (hookComponent.id === component.id) 6342 return callback({ component: hookComponent, ...params }); 6343 }); 6344 component.addCleanup(unhook); 6345 return unhook; 6346 });
6347 wireProperty("$dispatch", (component) => (...params) => dispatch3(component, ...params)); 6348 wireProperty("$dispatchSelf", (component) => (...params) => dispatchSelf(component, ...params)); 6349 wireProperty("$dispatchTo", () => (...params) => dispatchTo(...params)); 6350 wireProperty("$dispatchEl", (component) => (...params) => dispatchEl(component, ...params)); 6351 wireProperty("$dispatchRef", (component) => (...params) => dispatchRef(component, ...params)); 6352 wireProperty("$upload", (component) => (...params) => upload(component, ...params)); 6353 wireProperty("$uploadMultiple", (component) => (...params) => uploadMultiple(component, ...params)); 6354 wireProperty("$removeUpload", (component) => (...params) => removeUpload(component, ...params)); 6355 wireProperty("$cancelUpload", (component) => (...params) => cancelUpload(component, ...params)); 6356 var parentMemo = /* @__PURE__ */ new WeakMap(); 6357 wireProperty("$parent", (component) => { 6358 if (parentMemo.has(component)) 6359 return parentMemo.get(component).$wire; 6360 let parent = findComponentByEl(component.el.parentElement, false); 6361 if (!parent) 6362 return; 6363 parentMemo.set(component, parent); 6364 return parent.$wire; 6365 }); 6366 var overriddenMethods = /* @__PURE__ */ new WeakMap(); 6367 function overrideMethod(component, method, callback) { 6368 if (!overriddenMethods.has(component)) { 6369 overriddenMethods.set(component, {}); 6370 } 6371 let obj = overriddenMethods.get(component); 6372 obj[method] = callback; 6373 overriddenMethods.set(component, obj); 6374 } 6375 wireFallback((component) => (property) => (...params) => { 6376 if (params.length === 1 && params[0] instanceof Event) { 6377 params = []; 6378 } 6379 if (overriddenMethods.has(component)) { 6380 let overrides = overriddenMethods.get(component); 6381 if (typeof overrides[property] === "function") { 6382 return overrides[property](params); 6383 } 6384 } 6385 return fireAction(component, property, params); 6386 }); 6387 6388
6388// js/component.js 6389 var Component = class { 6390 constructor(el) { 6391 if (el.__livewire) 6392 throw "Component already initialized"; 6393 el.__livewire = this; 6394 this.el = el; 6395 this.id = el.getAttribute("wire:id"); 6396 this.key = el.getAttribute("wire:key"); 6397 this.__livewireId = this.id; 6398 this.snapshotEncoded = el.getAttribute("wire:snapshot"); 6399 this.snapshot = JSON.parse(this.snapshotEncoded); 6400 if (!this.snapshot) { 6401 throw `Snapshot missing on Livewire component with id: ` + this.id; 6402 } 6403 this.name = this.snapshot.memo.name; 6404 this.effects = JSON.parse(el.getAttribute("wire:effects")); 6405 this.originalEffects = deepClone(this.effects); 6406 this.canonical = extractData(deepClone(this.snapshot.data)); 6407 this.ephemeral = extractData(deepClone(this.snapshot.data)); 6408 this.reactive = Alpine.reactive(this.ephemeral); 6409 this.queuedUpdates = {}; 6410 this.jsActions = {}; 6411 this.$wire = generateWireObject(this, this.reactive); 6412 el.$wire = this.$wire; 6413 this.cleanups = []; 6414 this.processEffects(this.effects); 6415 } 6416 addActionContext(context) { 6417 if (context.el || context.directive) { 6418 setNextActionOrigin({ 6419 el: context.el, 6420 directive: context.directive 6421 }); 6422 } 6423 } 6424 intercept(action, callback = null) { 6425 return this.$wire.$intercept(action, callback); 6426 } 6427 mergeNewSnapshot(snapshotEncoded, effects, updates = {}) { 6428 let snapshot = JSON.parse(snapshotEncoded); 6429 let oldCanonical = deepClone(this.canonical); 6430 let updatedOldCanonical = this.applyUpdates(oldCanonical, updates); 6431 let newCanonical = extractData(deepClone(snapshot.data)); 6432 let dirty = diff(updatedOldCanonical, newCanonical); 6433 this.snapshotEncoded = snapshotEncoded; 6434 this.snapshot = snapshot; 6435 this.effects = effects; 6436 this.canonical = extractData(deepClone(snapshot.data)); 6437 let newData = extractData(deepClone(snapshot.data)); 6438 diffAndPatchRecursive(updatedOldCanonical, newData, this.reactive); 6439 return dirty; 6440 } 6441 queueUpdate(propertyName, value) { 6442 this.queuedUpdates[propertyName] = value; 6443 } 6444 mergeQueuedUpdates(diff2) { 6445 Object.entries(this.queuedUpdates).forEach(([updateKey, updateValue]) => { 6446 Object.entries(diff2).forEach(([diffKey, diffValue]) => { 6447 if (diffKey.startsWith(updateKey)) { 6448 delete diff2[diffKey]; 6449 } 6450 }); 6451 diff2[updateKey] = updateValue; 6452 }); 6453 this.queuedUpdates = []; 6454 return diff2; 6455 } 6456 getUpdates() { 6457 let propertiesDiff = diffAndConsolidate(this.canonical, this.ephemeral); 6458 return this.mergeQueuedUpdates(propertiesDiff); 6459 } 6460 applyUpdates(object, updates) { 6461 for (let key in updates) { 6462 dataSet(object, key, updates[key]); 6463 } 6464 return object; 6465 } 6466 replayUpdate(snapshot, html) { 6467 let effects = { ...this.effects, html }; 6468 this.mergeNewSnapshot(JSON.stringify(snapshot), effects); 6469 this.processEffects({ html }); 6470 } 6471 processEffects(effects, request) { 6472 trigger2("effects", this, effects); 6473 trigger2("effect", { 6474 component: this, 6475 effects, 6476 cleanup: (i) => this.addCleanup(i), 6477 request 6478 }); 6479 } 6480 get children() { 6481 let componentEl = this.el; 6482 let children = []; 6483 componentEl.querySelectorAll("[wire\\:id]").forEach((el) => { 6484 let parentComponentEl = el.parentElement.closest("[wire\\:id]"); 6485 if (parentComponentEl !== componentEl) 6486 return; 6487 let componentInstance = el.__livewire; 6488 if (!componentInstance) 6489 return; 6490 children.push(componentInstance); 6491 }); 6492 return children; 6493 } 6494 get islands() { 6495 let islands = this.snapshot.memo.islands; 6496 return islands; 6497 } 6498 get parent() { 6499 return findComponentByEl(this.el.parentElement); 6500 } 6501 get isIsolated() { 6502 return this.snapshot.memo.isolate; 6503 } 6504 get isLazy() { 6505 return this.snapshot.memo.lazyLoaded !== void 0; 6506 } 6507 get hasBeenLazyLoaded() { 6508 return this.snapshot.memo.lazyLoaded === true; 6509 } 6510 get isLazyIsolated() { 6511 return !!this.snapshot.memo.lazyIsolated; 6512 } 6513 getDeepChildrenWithBindings(callback) { 6514 this.getDeepChildren((child) => { 6515 if (child.isLazy && !child.hasBeenLazyLoaded) 6516 return; 6517 if (child.hasReactiveProps() || child.hasWireModelableBindings()) { 6518 callback(child); 6519 } 6520 }); 6521 } 6522 hasReactiveProps() { 6523 let meta = this.snapshot.memo; 6524 let props = meta.props; 6525 return !!props; 6526 } 6527 hasWireModelableBindings() { 6528 let meta = this.snapshot.memo; 6529 let bindings = meta.bindings; 6530 return !!bindings; 6531 } 6532 getDeepChildren(callback) {
6533 this.children.forEach((child) => { 6534 callback(child); 6535 child.getDeepChildren(callback); 6536 }); 6537 } 6538 getEncodedSnapshotWithLatestChildrenMergedIn() { 6539 let { snapshotEncoded, children, snapshot } = this; 6540 let childrenMemo = {}; 6541 children.forEach((child) => { 6542 childrenMemo[child.key] = [child.el.tagName.toLowerCase(), child.id]; 6543 }); 6544 return snapshotEncoded.replace( 6545 /"children":\{[^}]*\}/, 6546 `"children":${JSON.stringify(childrenMemo)}` 6547 ); 6548 } 6549 inscribeSnapshotAndEffectsOnElement() { 6550 let el = this.el; 6551 el.setAttribute("wire:snapshot", this.snapshotEncoded); 6552 let effects = {}; 6553 if (Object.prototype.hasOwnProperty.call(this.originalEffects, "listeners") && this.originalEffects.listeners) { 6554 effects.listeners = this.originalEffects.listeners; 6555 } 6556 if (Object.prototype.hasOwnProperty.call(this.originalEffects, "url") && this.originalEffects.url) { 6557 effects.url = this.originalEffects.url; 6558 } 6559 if (Object.prototype.hasOwnProperty.call(this.originalEffects, "scripts") && this.originalEffects.scripts) { 6560 effects.scripts = this.originalEffects.scripts; 6561 } 6562 el.setAttribute("wire:effects", JSON.stringify(effects)); 6563 el.setAttribute("wire:key", this.key); 6564 } 6565 addJsAction(name, action) { 6566 this.jsActions[name] = action; 6567 } 6568 hasJsAction(name) { 6569 return this.jsActions[name] !== void 0; 6570 } 6571 getJsAction(name) { 6572 return this.jsActions[name].bind(this.$wire); 6573 } 6574 getJsActions() { 6575 let actions = {}; 6576 for (let key of Object.keys(this.jsActions)) { 6577 actions[key] = this.getJsAction(key); 6578 } 6579 return actions; 6580 } 6581 toJSON() { 6582 return { 6583 id: this.id, 6584 name: this.name, 6585 key: this.key, 6586 data: Object.fromEntries(Object.entries(this.ephemeral)) 6587 }; 6588 } 6589 addCleanup(cleanup2) { 6590 this.cleanups.push(cleanup2); 6591 return () => { 6592 let index2 = this.cleanups.indexOf(cleanup2); 6593 if (index2 === -1) 6594 return; 6595 this.cleanups.splice(index2, 1); 6596 }; 6597 } 6598 cleanup() { 6599 delete this.el.__livewire; 6600 while (this.cleanups.length > 0) { 6601 this.cleanups.pop()(); 6602 } 6603 } 6604 }; 6605 6606
6606// js/fragment.js 6607 function closestFragment(el, { isMatch, hasReachedBoundary }) { 6608 if (!hasReachedBoundary) 6609 hasReachedBoundary = () => false; 6610 let current = el; 6611 while (current) { 6612 let sibling = current.previousSibling; 6613 let foundEndMarker = []; 6614 while (sibling) { 6615 if (isEndFragmentMarker(sibling)) { 6616 foundEndMarker.push("a"); 6617 } 6618 if (isStartFragmentMarker(sibling)) { 6619 if (foundEndMarker.length > 0) { 6620 foundEndMarker.pop(); 6621 } else { 6622 let metadata = extractFragmentMetadataFromMarkerNode(sibling); 6623 if (isMatch(metadata)) { 6624 return new Fragment(sibling); 6625 } 6626 } 6627 } 6628 sibling = sibling.previousSibling; 6629 } 6630 current = current.parentElement; 6631 if (current && hasReachedBoundary({ el: current })) { 6632 break; 6633 } 6634 } 6635 return null; 6636 } 6637 function findFragment(el, { isMatch, hasReachedBoundary }) { 6638 if (!hasReachedBoundary) 6639 hasReachedBoundary = () => false; 6640 let startNode = null; 6641 let rootEl2 = el; 6642 walkElements(rootEl2, (el2, { skip, stop: stop2 }) => { 6643 if (el2.hasAttribute && el2 !== rootEl2 && hasReachedBoundary({ el: el2 })) { 6644 return skip(); 6645 } 6646 Array.from(el2.childNodes).forEach((node) => { 6647 if (isStartFragmentMarker(node)) { 6648 let metadata = extractFragmentMetadataFromMarkerNode(node); 6649 if (isMatch(metadata)) { 6650 startNode = node; 6651 stop2(); 6652 } 6653 } 6654 }); 6655 }); 6656 return startNode && new Fragment(startNode); 6657 } 6658 function isStartFragmentMarker(el) { 6659 return el.nodeType === 8 && el.textContent.startsWith("[if FRAGMENT"); 6660 } 6661 function isEndFragmentMarker(el) { 6662 return el.nodeType === 8 && el.textContent.startsWith("[if ENDFRAGMENT"); 6663 } 6664 function walkElements(el, callback) { 6665 let skip = false; 6666 let stop2 = false; 6667 callback(el, { skip: () => skip = true, stop: () => stop2 = true }); 6668 if (skip || stop2) 6669 return; 6670 Array.from(el.children).forEach((child) => { 6671 walkElements(child, callback); 6672 if (stop2) 6673 return; 6674 }); 6675 } 6676 var Fragment = class { 6677 constructor(startMarkerNode) { 6678 this.startMarkerNode = startMarkerNode;
6679 this.metadata = extractFragmentMetadataFromMarkerNode(startMarkerNode); 6680 } 6681 get endMarkerNode() { 6682 return findMatchingEndMarkerNode(this.startMarkerNode, this.metadata); 6683 } 6684 append(mountContainerTagName, html) { 6685 let container = document.createElement(mountContainerTagName); 6686 container.innerHTML = html; 6687 Array.from(container.childNodes).forEach((node) => { 6688 this.endMarkerNode.before(node); 6689 }); 6690 } 6691 prepend(mountContainerTagName, html) { 6692 let container = document.createElement(mountContainerTagName); 6693 container.innerHTML = html; 6694 Array.from(container.childNodes).reverse().forEach((node) => { 6695 this.startMarkerNode.after(node); 6696 }); 6697 } 6698 }; 6699 function findMatchingEndMarkerNode(startMarkerNode, metadata) { 6700 let current = startMarkerNode; 6701 while (current) { 6702 if (isEndFragmentMarker(current)) { 6703 let currentMetadata = extractFragmentMetadataFromMarkerNode(current); 6704 if (Object.keys(metadata).every((key) => metadata[key] === currentMetadata[key])) { 6705 return current; 6706 } 6707 } 6708 current = current.nextSibling; 6709 } 6710 return null; 6711 } 6712 function extractInnerHtmlFromFragmentHtml(fragmentHtml) { 6713 let regex = /<!--\[if FRAGMENT\b.*?\]><!\[endif\]-->([\s\S]*)<!--\[if ENDFRAGMENT\b.*?\]><!\[endif\]-->/i; 6714 let match = fragmentHtml.match(regex); 6715 if (!match) 6716 throw new Error("Invalid fragment marker"); 6717 let [_, html] = match; 6718 return html; 6719 } 6720 function extractFragmentMetadataFromHtml(fragmentHtml) { 6721 let regex = /\[if (FRAGMENT|ENDFRAGMENT):(.*?)\]/; 6722 let match = fragmentHtml.match(regex); 6723 if (!match) 6724 throw new Error("Invalid fragment marker"); 6725 let [_, __, encodedMetadata] = match; 6726 return decodeMetadata(encodedMetadata); 6727 } 6728 function extractFragmentMetadataFromMarkerNode(startMarkerNode) { 6729 let regex = /\[if (FRAGMENT|ENDFRAGMENT):(.*?)\]/; 6730 let match = startMarkerNode.textContent.match(regex); 6731 if (!match) 6732 throw new Error("Invalid fragment marker"); 6733 let [_, __, encodedMetadata] = match; 6734 return decodeMetadata(encodedMetadata); 6735 } 6736 function decodeMetadata(encodedMetadata) { 6737 let metadata = {}; 6738 let pairs = encodedMetadata.split("|"); 6739 pairs.forEach((pair) => { 6740 let [key, value] = pair.split("="); 6741 metadata[key] = value; 6742 }); 6743 return metadata; 6744 } 6745 6746
6746// js/store.js 6747 var components = {}; 6748 function initComponent(el) { 6749 let component = new Component(el); 6750 if (components[component.id]) 6751 throw "Component already registered"; 6752 let cleanup2 = (i) => component.addCleanup(i); 6753 trigger2("component.init", { component, cleanup: cleanup2 }); 6754 components[component.id] = component; 6755 return component; 6756 } 6757 function destroyComponent(id) { 6758 let component = components[id]; 6759 if (!component) 6760 return; 6761 component.cleanup(); 6762 delete components[id]; 6763 } 6764 function hasComponent(id) { 6765 return !!components[id]; 6766 } 6767 function findComponent(id, strict = true) { 6768 let component = components[id]; 6769 if (!component) { 6770 if (strict) 6771 throw "Component not found: " + id; 6772 return; 6773 } 6774 return component; 6775 } 6776 function findComponentByEl(el, strict = true) { 6777 let componentId = walkUpwards(el, (node, { stop: stop2 }) => { 6778 if (node.__livewire) 6779 return stop2(node.__livewire.id); 6780 let endMarkers = []; 6781 let slotParentId = walkBackwards(node, (siblingNode, { stop: stop3 }) => { 6782 if (isEndFragmentMarker(siblingNode)) { 6783 let metadata = extractFragmentMetadataFromMarkerNode(siblingNode); 6784 if (metadata.type !== "slot") 6785 return; 6786 endMarkers.push("a"); 6787 return; 6788 } 6789 if (isStartFragmentMarker(siblingNode)) { 6790 let metadata = extractFragmentMetadataFromMarkerNode(siblingNode); 6791 if (metadata.type !== "slot") 6792 return; 6793 if (endMarkers.length > 0) { 6794 endMarkers.pop(); 6795 } else { 6796 return stop3(metadata.parent); 6797 } 6798 } 6799 }); 6800 if (slotParentId) 6801 return stop2(slotParentId); 6802 }); 6803 let component = findComponent(componentId, strict); 6804 if (!component) { 6805 if (strict) 6806 throw "Could not find Livewire component in DOM tree"; 6807 return; 6808 } 6809 return component; 6810 } 6811 function componentsByName(name) { 6812 return Object.values(components).filter((component) => { 6813 return name == component.name; 6814 }); 6815 } 6816 function getByName(name) { 6817 return componentsByName(name).map((i) => i.$wire); 6818 } 6819 function find(id) {
6820 let component = components[id]; 6821 return component && component.$wire; 6822 } 6823 function first() { 6824 return Object.values(components)[0].$wire; 6825 } 6826 function all() { 6827 return Object.values(components); 6828 } 6829 6830
6830// js/events.js 6831 function dispatch3(component, name, params) { 6832 dispatchEvent(component.el, name, params); 6833 } 6834 function dispatchGlobal(name, params) { 6835 dispatchEvent(window, name, params); 6836 } 6837 function dispatchSelf(component, name, params) { 6838 dispatchEvent(component.el, name, params, false); 6839 } 6840 function dispatchEl(component, selector, name, params) { 6841 let targets = component.el.querySelectorAll(selector); 6842 targets.forEach((target) => { 6843 dispatchEvent(target, name, params, false); 6844 }); 6845 } 6846 function dispatchTo(componentName, name, params) { 6847 let targets = componentsByName(componentName); 6848 targets.forEach((target) => { 6849 dispatchEvent(target.el, name, params, false); 6850 }); 6851 } 6852 function dispatchRef(component, ref, name, params) { 6853 let el = findRefEl(component, ref); 6854 dispatchEvent(el, name, params, false); 6855 } 6856 function listen2(component, name, callback) { 6857 component.el.addEventListener(name, (e) => { 6858 callback(e.detail); 6859 }); 6860 } 6861 function on3(eventName, callback) { 6862 let handler4 = (e) => { 6863 if (!e.__livewire) 6864 return; 6865 callback(e.detail); 6866 }; 6867 window.addEventListener(eventName, handler4); 6868 return () => { 6869 window.removeEventListener(eventName, handler4); 6870 }; 6871 } 6872 function dispatchEvent(target, name, params, bubbles = true) { 6873 if (typeof params === "string") { 6874 params = [params]; 6875 } 6876 let e = new CustomEvent(name, { bubbles, detail: params }); 6877 e.__livewire = { name, params, receivedBy: [] }; 6878 target.dispatchEvent(e); 6879 } 6880 6881
vendor: 3,044 bytes, lines 6881-6975
6881// node_modules/@alpinejs/collapse/dist/module.esm.js 6882 function src_default2(Alpine3) { 6883 Alpine3.directive("collapse", collapse); 6884 collapse.inline = (el, { modifiers }) => { 6885 if (!modifiers.includes("min")) 6886 return; 6887 el._x_doShow = () => { 6888 }; 6889 el._x_doHide = () => { 6890 }; 6891 }; 6892 function collapse(el, { modifiers }) { 6893 let duration = modifierValue2(modifiers, "duration", 250) / 1e3; 6894 let floor2 = modifierValue2(modifiers, "min", 0); 6895 let fullyHide = !modifiers.includes("min"); 6896 if (!el._x_isShown) 6897 el.style.height = `${floor2}px`; 6898 if (!el._x_isShown && fullyHide) 6899 el.hidden = true; 6900 if (!el._x_isShown) 6901 el.style.overflow = "hidden"; 6902 let setFunction = (el2, styles) => { 6903 let revertFunction = Alpine3.setStyles(el2, styles); 6904 return styles.height ? () => { 6905 } : revertFunction; 6906 }; 6907 let transitionStyles = { 6908 transitionProperty: "height", 6909 transitionDuration: `${duration}s`, 6910 transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)" 6911 }; 6912 el._x_transition = { 6913 in(before = () => { 6914 }, after = () => { 6915 }) { 6916 if (fullyHide) 6917 el.hidden = false; 6918 if (fullyHide) 6919 el.style.display = null; 6920 let current = el.getBoundingClientRect().height; 6921 el.style.height = "auto"; 6922 let full = el.getBoundingClientRect().height; 6923 if (current === full) { 6924 current = floor2; 6925 } 6926 Alpine3.transition(el, Alpine3.setStyles, { 6927 during: transitionStyles, 6928 start: { height: current + "px" }, 6929 end: { height: full + "px" } 6930 }, () => el._x_isShown = true, () => { 6931 if (Math.abs(el.getBoundingClientRect().height - full) < 1) { 6932 el.style.overflow = null; 6933 } 6934 }); 6935 }, 6936 out(before = () => { 6937 }, after = () => { 6938 }) { 6939 let full = el.getBoundingClientRect().height; 6940 Alpine3.transition(el, setFunction, { 6941 during: transitionStyles, 6942 start: { height: full + "px" }, 6943 end: { height: floor2 + "px" } 6944 }, () => el.style.overflow = "hidden", () => { 6945 el._x_isShown = false; 6946 if (el.style.height == `${floor2}px` && fullyHide) { 6947 el.style.display = "none"; 6948 el.hidden = true; 6949 } 6950 }); 6951 } 6952 }; 6953 } 6954 } 6955 function modifierValue2(modifiers, key, fallback2) { 6956 if (modifiers.indexOf(key) === -1) 6957 return fallback2; 6958 const rawValue = modifiers[modifiers.indexOf(key) + 1]; 6959 if (!rawValue) 6960 return fallback2; 6961 if (key === "duration") { 6962 let match = rawValue.match(/([0-9]+)ms/); 6963 if (match) 6964 return match[1]; 6965 } 6966 if (key === "min") { 6967 let match = rawValue.match(/([0-9]+)px/); 6968 if (match) 6969 return match[1]; 6970 } 6971 return rawValue; 6972 } 6973 var module_default2 = src_default2; 6974 6975
vendor: 61,070 bytes, lines 6975-8540
6975// node_modules/@alpinejs/focus/dist/module.esm.js 6976 var candidateSelectors = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"]; 6977 var candidateSelector = /* @__PURE__ */ candidateSelectors.join(","); 6978 var NoElement = typeof Element === "undefined"; 6979 var matches = NoElement ? function() { 6980 } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 6981 var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) { 6982 var _element$getRootNode; 6983 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element); 6984 } : function(element) { 6985 return element === null || element === void 0 ? void 0 : element.ownerDocument; 6986 }; 6987 var _isInert = function isInert(node, lookUp) { 6988 var _node$getAttribute; 6989 if (lookUp === void 0) { 6990 lookUp = true; 6991 } 6992 var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert"); 6993 var inert = inertAtt === "" || inertAtt === "true"; 6994 var result = inert || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode)); 6995 return result; 6996 }; 6997 var isContentEditable = function isContentEditable2(node) { 6998 var _node$getAttribute2; 6999 var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable"); 7000 return attValue === "" || attValue === "true"; 7001 }; 7002 var getCandidates = function getCandidates2(el, includeContainer, filter) { 7003 if (_isInert(el)) { 7004 return []; 7005 } 7006 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); 7007 if (includeContainer && matches.call(el, candidateSelector)) { 7008 candidates.unshift(el); 7009 } 7010 candidates = candidates.filter(filter); 7011 return candidates; 7012 }; 7013 var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { 7014 var candidates = []; 7015 var elementsToCheck = Array.from(elements); 7016 while (elementsToCheck.length) { 7017 var element = elementsToCheck.shift(); 7018 if (_isInert(element, false)) { 7019 continue; 7020 } 7021 if (element.tagName === "SLOT") { 7022 var assigned = element.assignedElements(); 7023 var content = assigned.length ? assigned : element.children; 7024 var nestedCandidates = _getCandidatesIteratively(content, true, options); 7025 if (options.flatten) { 7026 candidates.push.apply(candidates, nestedCandidates); 7027 } else { 7028 candidates.push({ 7029 scopeParent: element, 7030 candidates: nestedCandidates 7031 }); 7032 } 7033 } else { 7034 var validCandidate = matches.call(element, candidateSelector); 7035 if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) { 7036 candidates.push(element); 7037 } 7038 var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element); 7039 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element)); 7040 if (shadowRoot && validShadowRoot) { 7041 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options); 7042 if (options.flatten) { 7043 candidates.push.apply(candidates, _nestedCandidates); 7044 } else { 7045 candidates.push({ 7046 scopeParent: element, 7047 candidates: _nestedCandidates 7048 }); 7049 } 7050 } else { 7051 elementsToCheck.unshift.apply(elementsToCheck, element.children); 7052 } 7053 } 7054 } 7055 return candidates; 7056 }; 7057 var hasTabIndex = function hasTabIndex2(node) { 7058 return !isNaN(parseInt(node.getAttribute("tabindex"), 10)); 7059 }; 7060 var getTabIndex = function getTabIndex2(node) { 7061 if (!node) { 7062 throw new Error("No node provided"); 7063 } 7064 if (node.tabIndex < 0) { 7065 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) { 7066 return 0; 7067 } 7068 } 7069 return node.tabIndex; 7070 }; 7071 var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) { 7072 var tabIndex = getTabIndex(node); 7073 if (tabIndex < 0 && isScope && !hasTabIndex(node)) { 7074 return 0; 7075 } 7076 return tabIndex; 7077 }; 7078 var sortOrderedTabbables = function sortOrderedTabbables2(a, b) { 7079 return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; 7080 }; 7081 var isInput = function isInput2(node) { 7082 return node.tagName === "INPUT"; 7083 }; 7084 var isHiddenInput = function isHiddenInput2(node) { 7085 return isInput(node) && node.type === "hidden"; 7086 }; 7087 var isDetailsWithSummary = function isDetailsWithSummary2(node) { 7088 var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) { 7089 return child.tagName === "SUMMARY"; 7090 }); 7091 return r; 7092 }; 7093 var getCheckedRadio = function getCheckedRadio2(nodes, form) { 7094 for (var i = 0; i < nodes.length; i++) { 7095 if (nodes[i].checked && nodes[i].form === form) { 7096 return nodes[i]; 7097 } 7098 } 7099 }; 7100 var isTabbableRadio = function isTabbableRadio2(node) { 7101 if (!node.name) { 7102 return true; 7103 } 7104 var radioScope = node.form || getRootNode(node); 7105 var queryRadios = function queryRadios2(name) { 7106 return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]'); 7107 }; 7108 var radioSet; 7109 if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") { 7110 radioSet = queryRadios(window.CSS.escape(node.name)); 7111 } else { 7112 try { 7113 radioSet = queryRadios(node.name); 7114 } catch (err) { 7115 console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message); 7116 return false; 7117 } 7118 } 7119 var checked = getCheckedRadio(radioSet, node.form); 7120 return !checked || checked === node; 7121 }; 7122 var isRadio2 = function isRadio22(node) { 7123 return isInput(node) && node.type === "radio"; 7124 }; 7125 var isNonTabbableRadio = function isNonTabbableRadio2(node) { 7126 return isRadio2(node) && !isTabbableRadio(node); 7127 }; 7128 var isNodeAttached = function isNodeAttached2(node) { 7129 var _nodeRoot; 7130 var nodeRoot = node && getRootNode(node); 7131 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; 7132 var attached = false; 7133 if (nodeRoot && nodeRoot !== node) { 7134 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; 7135 attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node)); 7136 while (!attached && nodeRootHost) { 7137 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; 7138 nodeRoot = getRootNode(nodeRootHost); 7139 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; 7140 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); 7141 } 7142 } 7143 return attached; 7144 }; 7145 var isZeroArea = function isZeroArea2(node) { 7146 var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; 7147 return width === 0 && height === 0; 7148 }; 7149 var isHidden = function isHidden2(node, _ref) { 7150 var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot; 7151 if (displayCheck === "full-native") { 7152 if ("checkVisibility" in node) { 7153 var visible = node.checkVisibility({ 7154 checkOpacity: false, 7155 opacityProperty: false, 7156 contentVisibilityAuto: true, 7157 visibilityProperty: true, 7158 checkVisibilityCSS: true 7159 }); 7160 return !visible; 7161 } 7162 } 7163 if (getComputedStyle(node).visibility === "hidden") { 7164 return true; 7165 } 7166 var isDirectSummary = matches.call(node, "details>summary:first-of-type"); 7167 var nodeUnderDetails = isDirectSummary ? node.parentElement : node; 7168 if (matches.call(nodeUnderDetails, "details:not([open]) *")) { 7169 return true; 7170 } 7171 if (!displayCheck || displayCheck === "full" || displayCheck === "full-native" || displayCheck === "legacy-full") { 7172 if (typeof getShadowRoot === "function") { 7173 var originalNode = node; 7174 while (node) { 7175 var parentElement = node.parentElement; 7176 var rootNode = getRootNode(node); 7177 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) { 7178 return isZeroArea(node); 7179 } else if (node.assignedSlot) { 7180 node = node.assignedSlot; 7181 } else if (!parentElement && rootNode !== node.ownerDocument) { 7182 node = rootNode.host; 7183 } else { 7184 node = parentElement; 7185 } 7186 } 7187 node = originalNode; 7188 } 7189 if (isNodeAttached(node)) { 7190 return !node.getClientRects().length; 7191 } 7192 if (displayCheck !== "legacy-full") { 7193 return true; 7194 } 7195 } else if (displayCheck === "non-zero-area") { 7196 return isZeroArea(node); 7197 } 7198 return false; 7199 }; 7200 var isDisabledFromFieldset = function isDisabledFromFieldset2(node) { 7201 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { 7202 var parentNode = node.parentElement; 7203 while (parentNode) { 7204 if (parentNode.tagName === "FIELDSET" && parentNode.disabled) { 7205 for (var i = 0; i < parentNode.children.length; i++) { 7206 var child = parentNode.children.item(i); 7207 if (child.tagName === "LEGEND") { 7208 return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node); 7209 } 7210 } 7211 return true; 7212 } 7213 parentNode = parentNode.parentElement; 7214 } 7215 } 7216 return false; 7217 }; 7218 var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) { 7219 if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) { 7220 return false; 7221 } 7222 return true; 7223 }; 7224 var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) { 7225 if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) { 7226 return false; 7227 } 7228 return true; 7229 }; 7230 var isShadowRootTabbable = function isShadowRootTabbable2(shadowHostNode) { 7231 var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10); 7232 if (isNaN(tabIndex) || tabIndex >= 0) { 7233 return true; 7234 } 7235 return false; 7236 }; 7237 var _sortByOrder = function sortByOrder(candidates) { 7238 var regularTabbables = []; 7239 var orderedTabbables = []; 7240 candidates.forEach(function(item, i) { 7241 var isScope = !!item.scopeParent; 7242 var element = isScope ? item.scopeParent : item; 7243 var candidateTabindex = getSortOrderTabIndex(element, isScope); 7244 var elements = isScope ? _sortByOrder(item.candidates) : element; 7245 if (candidateTabindex === 0) { 7246 isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element); 7247 } else { 7248 orderedTabbables.push({ 7249 documentOrder: i, 7250 tabIndex: candidateTabindex, 7251 item, 7252 isScope, 7253 content: elements 7254 }); 7255 } 7256 }); 7257 return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) { 7258 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); 7259 return acc; 7260 }, []).concat(regularTabbables); 7261 }; 7262 var tabbable = function tabbable2(container, options) { 7263 options = options || {}; 7264 var candidates; 7265 if (options.getShadowRoot) { 7266 candidates = _getCandidatesIteratively([container], options.includeContainer, { 7267 filter: isNodeMatchingSelectorTabbable.bind(null, options), 7268 flatten: false, 7269 getShadowRoot: options.getShadowRoot, 7270 shadowRootFilter: isShadowRootTabbable 7271 }); 7272 } else { 7273 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); 7274 } 7275 return _sortByOrder(candidates); 7276 }; 7277 var focusable = function focusable2(container, options) { 7278 options = options || {}; 7279 var candidates; 7280 if (options.getShadowRoot) { 7281 candidates = _getCandidatesIteratively([container], options.includeContainer, { 7282 filter: isNodeMatchingSelectorFocusable.bind(null, options), 7283 flatten: true, 7284 getShadowRoot: options.getShadowRoot 7285 }); 7286 } else { 7287 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options)); 7288 } 7289 return candidates; 7290 }; 7291 var isTabbable = function isTabbable2(node, options) { 7292 options = options || {}; 7293 if (!node) { 7294 throw new Error("No node provided"); 7295 } 7296 if (matches.call(node, candidateSelector) === false) { 7297 return false; 7298 } 7299 return isNodeMatchingSelectorTabbable(options, node); 7300 }; 7301 var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(","); 7302 var isFocusable = function isFocusable2(node, options) { 7303 options = options || {}; 7304 if (!node) { 7305 throw new Error("No node provided"); 7306 } 7307 if (matches.call(node, focusableCandidateSelector) === false) { 7308 return false; 7309 } 7310 return isNodeMatchingSelectorFocusable(options, node); 7311 }; 7312 function _arrayLikeToArray(r, a) { 7313 (null == a || a > r.length) && (a = r.length); 7314 for (var e = 0, n = Array(a); e < a; e++) 7315 n[e] = r[e]; 7316 return n; 7317 } 7318 function _arrayWithoutHoles(r) { 7319 if (Array.isArray(r)) 7320 return _arrayLikeToArray(r); 7321 } 7322 function asyncGeneratorStep(n, t, e, r, o, a, c) { 7323 try { 7324 var i = n[a](c), u = i.value; 7325 } catch (n2) { 7326 return void e(n2); 7327 } 7328 i.done ? t(u) : Promise.resolve(u).then(r, o); 7329 } 7330 function _asyncToGenerator(n) { 7331 return function() { 7332 var t = this, e = arguments; 7333 return new Promise(function(r, o) { 7334 var a = n.apply(t, e); 7335 function _next(n2) { 7336 asyncGeneratorStep(a, r, o, _next, _throw, "next", n2); 7337 } 7338 function _throw(n2) { 7339 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2); 7340 } 7341 _next(void 0); 7342 }); 7343 }; 7344 } 7345 function _createForOfIteratorHelper(r, e) { 7346 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 7347 if (!t) { 7348 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { 7349 t && (r = t); 7350 var n = 0, F = function() { 7351 }; 7352 return { 7353 s: F, 7354 n: function() { 7355 return n >= r.length ? { 7356 done: true 7357 } : { 7358 done: false, 7359 value: r[n++] 7360 }; 7361 }, 7362 e: function(r2) { 7363 throw r2; 7364 }, 7365 f: F 7366 }; 7367 } 7368 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 7369 } 7370 var o, a = true, u = false; 7371 return { 7372 s: function() { 7373 t = t.call(r); 7374 }, 7375 n: function() { 7376 var r2 = t.next(); 7377 return a = r2.done, r2; 7378 }, 7379 e: function(r2) { 7380 u = true, o = r2; 7381 }, 7382 f: function() { 7383 try { 7384 a || null == t.return || t.return(); 7385 } finally { 7386 if (u) 7387 throw o; 7388 } 7389 } 7390 }; 7391 } 7392 function _defineProperty(e, r, t) { 7393 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 7394 value: t, 7395 enumerable: true, 7396 configurable: true, 7397 writable: true 7398 }) : e[r] = t, e; 7399 } 7400 function _iterableToArray(r) { 7401 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) 7402 return Array.from(r); 7403 } 7404 function _nonIterableSpread() { 7405 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 7406 } 7407 function ownKeys2(e, r) { 7408 var t = Object.keys(e); 7409 if (Object.getOwnPropertySymbols) { 7410 var o = Object.getOwnPropertySymbols(e); 7411 r && (o = o.filter(function(r2) { 7412 return Object.getOwnPropertyDescriptor(e, r2).enumerable; 7413 })), t.push.apply(t, o); 7414 } 7415 return t; 7416 } 7417 function _objectSpread2(e) { 7418 for (var r = 1; r < arguments.length; r++) { 7419 var t = null != arguments[r] ? arguments[r] : {}; 7420 r % 2 ? ownKeys2(Object(t), true).forEach(function(r2) { 7421 _defineProperty(e, r2, t[r2]); 7422 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r2) { 7423 Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); 7424 }); 7425 } 7426 return e; 7427 } 7428 function _regenerator() { 7429 var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; 7430 function i(r2, n2, o2, i2) { 7431 var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype); 7432 return _regeneratorDefine(u2, "_invoke", function(r3, n3, o3) { 7433 var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { 7434 p: 0, 7435 n: 0, 7436 v: e, 7437 a: d, 7438 f: d.bind(e, 4), 7439 d: function(t2, r4) { 7440 return i3 = t2, c3 = 0, u3 = e, G.n = r4, a; 7441 } 7442 }; 7443 function d(r4, n4) { 7444 for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) { 7445 var o4, i4 = p[t], d2 = G.p, l = i4[2]; 7446 r4 > 3 ? (o4 = l === n4) && (u3 = i4[(c3 = i4[4]) ? 5 : (c3 = 3, 3)], i4[4] = i4[5] = e) : i4[0] <= d2 && ((o4 = r4 < 2 && d2 < i4[1]) ? (c3 = 0, G.v = n4, G.n = i4[1]) : d2 < l && (o4 = r4 < 3 || i4[0] > n4 || n4 > l) && (i4[4] = r4, i4[5] = n4, G.n = l, c3 = 0)); 7447 } 7448 if (o4 || r4 > 1) 7449 return a; 7450 throw y = true, n4; 7451 } 7452 return function(o4, p2, l) { 7453 if (f2 > 1) 7454 throw TypeError("Generator is already running"); 7455 for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) { 7456 i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3); 7457 try { 7458 if (f2 = 2, i3) { 7459 if (c3 || (o4 = "next"), t = i3[o4]) { 7460 if (!(t = t.call(i3, u3))) 7461 throw TypeError("iterator result is not an object"); 7462 if (!t.done) 7463 return t; 7464 u3 = t.value, c3 < 2 && (c3 = 0); 7465 } else 7466 1 === c3 && (t = i3.return) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1); 7467 i3 = e; 7468 } else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) 7469 break; 7470 } catch (t2) { 7471 i3 = e, c3 = 1, u3 = t2; 7472 } finally { 7473 f2 = 1; 7474 } 7475 } 7476 return { 7477 value: t, 7478 done: y 7479 }; 7480 }; 7481 }(r2, o2, i2), true), u2; 7482 } 7483 var a = {}; 7484 function Generator() { 7485 } 7486 function GeneratorFunction() { 7487 } 7488 function GeneratorFunctionPrototype() { 7489 } 7490 t = Object.getPrototypeOf; 7491 var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function() { 7492 return this; 7493 }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); 7494 function f(e2) { 7495 return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2; 7496 } 7497 return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function() { 7498 return this; 7499 }), _regeneratorDefine(u, "toString", function() { 7500 return "[object Generator]"; 7501 }), (_regenerator = function() { 7502 return { 7503 w: i, 7504 m: f 7505 }; 7506 })(); 7507 } 7508 function _regeneratorDefine(e, r, n, t) { 7509 var i = Object.defineProperty; 7510 try { 7511 i({}, "", {}); 7512 } catch (e2) { 7513 i = 0; 7514 } 7515 _regeneratorDefine = function(e2, r2, n2, t2) { 7516 function o(r3, n3) { 7517 _regeneratorDefine(e2, r3, function(e3) { 7518 return this._invoke(r3, n3, e3); 7519 }); 7520 } 7521 r2 ? i ? i(e2, r2, { 7522 value: n2, 7523 enumerable: !t2, 7524 configurable: !t2, 7525 writable: !t2 7526 }) : e2[r2] = n2 : (o("next", 0), o("throw", 1), o("return", 2)); 7527 }, _regeneratorDefine(e, r, n, t); 7528 } 7529 function _toConsumableArray(r) { 7530 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); 7531 } 7532 function _toPrimitive(t, r) { 7533 if ("object" != typeof t || !t) 7534 return t; 7535 var e = t[Symbol.toPrimitive]; 7536 if (void 0 !== e) { 7537 var i = e.call(t, r); 7538 if ("object" != typeof i) 7539 return i; 7540 throw new TypeError("@@toPrimitive must return a primitive value."); 7541 } 7542 return ("string" === r ? String : Number)(t); 7543 } 7544 function _toPropertyKey(t) { 7545 var i = _toPrimitive(t, "string"); 7546 return "symbol" == typeof i ? i : i + ""; 7547 } 7548 function _unsupportedIterableToArray(r, a) { 7549 if (r) { 7550 if ("string" == typeof r) 7551 return _arrayLikeToArray(r, a); 7552 var t = {}.toString.call(r).slice(8, -1); 7553 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 7554 } 7555 } 7556 var activeFocusTraps = { 7557 getActiveTrap: function getActiveTrap(trapStack) { 7558 if ((trapStack === null || trapStack === void 0 ? void 0 : trapStack.length) > 0) { 7559 return trapStack[trapStack.length - 1]; 7560 } 7561 return null; 7562 }, 7563 activateTrap: function activateTrap(trapStack, trap) { 7564 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 7565 if (trap !== activeTrap) { 7566 activeFocusTraps.pauseTrap(trapStack); 7567 } 7568 var trapIndex = trapStack.indexOf(trap); 7569 if (trapIndex === -1) { 7570 trapStack.push(trap); 7571 } else { 7572 trapStack.splice(trapIndex, 1); 7573 trapStack.push(trap); 7574 } 7575 }, 7576 deactivateTrap: function deactivateTrap(trapStack, trap) { 7577 var trapIndex = trapStack.indexOf(trap); 7578 if (trapIndex !== -1) { 7579 trapStack.splice(trapIndex, 1); 7580 } 7581 activeFocusTraps.unpauseTrap(trapStack); 7582 }, 7583 pauseTrap: function pauseTrap(trapStack) { 7584 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 7585 activeTrap === null || activeTrap === void 0 || activeTrap._setPausedState(true); 7586 }, 7587 unpauseTrap: function unpauseTrap(trapStack) { 7588 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 7589 if (activeTrap && !activeTrap._isManuallyPaused()) { 7590 activeTrap._setPausedState(false); 7591 } 7592 } 7593 }; 7594 var isSelectableInput = function isSelectableInput2(node) { 7595 return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function"; 7596 }; 7597 var isEscapeEvent = function isEscapeEvent2(e) { 7598 return (e === null || e === void 0 ? void 0 : e.key) === "Escape" || (e === null || e === void 0 ? void 0 : e.key) === "Esc" || (e === null || e === void 0 ? void 0 : e.keyCode) === 27; 7599 }; 7600 var isTabEvent = function isTabEvent2(e) { 7601 return (e === null || e === void 0 ? void 0 : e.key) === "Tab" || (e === null || e === void 0 ? void 0 : e.keyCode) === 9; 7602 }; 7603 var isKeyForward = function isKeyForward2(e) { 7604 return isTabEvent(e) && !e.shiftKey; 7605 }; 7606 var isKeyBackward = function isKeyBackward2(e) { 7607 return isTabEvent(e) && e.shiftKey; 7608 }; 7609 var delay = function delay2(fn) { 7610 return setTimeout(fn, 0); 7611 }; 7612 var valueOrHandler = function valueOrHandler2(value) { 7613 for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 7614 params[_key - 1] = arguments[_key]; 7615 } 7616 return typeof value === "function" ? value.apply(void 0, params) : value; 7617 }; 7618 var getActualTarget = function getActualTarget2(event) { 7619 return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target; 7620 }; 7621 var internalTrapStack = []; 7622 var createFocusTrap = function createFocusTrap2(elements, userOptions) { 7623 var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document; 7624 var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack; 7625 var config = _objectSpread2({ 7626 returnFocusOnDeactivate: true, 7627 escapeDeactivates: true, 7628 delayInitialFocus: true, 7629 isolateSubtrees: false, 7630 isKeyForward, 7631 isKeyBackward 7632 }, userOptions); 7633 var state = { 7634 containers: [], 7635 containerGroups: [], 7636 tabbableGroups: [], 7637 adjacentElements: /* @__PURE__ */ new Set(), 7638 alreadySilent: /* @__PURE__ */ new Set(), 7639 nodeFocusedBeforeActivation: null, 7640 mostRecentlyFocusedNode: null, 7641 active: false, 7642 paused: false, 7643 manuallyPaused: false, 7644 delayInitialFocusTimer: void 0, 7645 recentNavEvent: void 0 7646 }; 7647 var trap; 7648 var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) { 7649 return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName]; 7650 }; 7651 var findContainerIndex = function findContainerIndex2(element, event) { 7652 var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === "function" ? event.composedPath() : void 0; 7653 return state.containerGroups.findIndex(function(_ref) { 7654 var container = _ref.container, tabbableNodes = _ref.tabbableNodes; 7655 return container.contains(element) || (composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function(node) { 7656 return node === element; 7657 }); 7658 }); 7659 }; 7660 var getNodeForOption = function getNodeForOption2(optionName) { 7661 var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref2$hasFallback = _ref2.hasFallback, hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback, _ref2$params = _ref2.params, params = _ref2$params === void 0 ? [] : _ref2$params; 7662 var optionValue = config[optionName]; 7663 if (typeof optionValue === "function") { 7664 optionValue = optionValue.apply(void 0, _toConsumableArray(params)); 7665 } 7666 if (optionValue === true) { 7667 optionValue = void 0; 7668 } 7669 if (!optionValue) { 7670 if (optionValue === void 0 || optionValue === false) { 7671 return optionValue; 7672 } 7673 throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node")); 7674 } 7675 var node = optionValue; 7676 if (typeof optionValue === "string") { 7677 try { 7678 node = doc.querySelector(optionValue); 7679 } catch (err) { 7680 throw new Error("`".concat(optionName, '` appears to be an invalid selector; error="').concat(err.message, '"')); 7681 } 7682 if (!node) { 7683 if (!hasFallback) { 7684 throw new Error("`".concat(optionName, "` as selector refers to no known node")); 7685 } 7686 } 7687 } 7688 return node; 7689 }; 7690 var getInitialFocusNode = function getInitialFocusNode2() { 7691 var node = getNodeForOption("initialFocus", { 7692 hasFallback: true 7693 }); 7694 if (node === false) { 7695 return false; 7696 } 7697 if (node === void 0 || node && !isFocusable(node, config.tabbableOptions)) { 7698 if (findContainerIndex(doc.activeElement) >= 0) { 7699 node = doc.activeElement; 7700 } else { 7701 var firstTabbableGroup = state.tabbableGroups[0]; 7702 var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; 7703 node = firstTabbableNode || getNodeForOption("fallbackFocus"); 7704 } 7705 } else if (node === null) { 7706 node = getNodeForOption("fallbackFocus"); 7707 } 7708 if (!node) { 7709 throw new Error("Your focus-trap needs to have at least one focusable element"); 7710 } 7711 return node; 7712 }; 7713 var updateTabbableNodes = function updateTabbableNodes2() { 7714 state.containerGroups = state.containers.map(function(container) { 7715 var tabbableNodes = tabbable(container, config.tabbableOptions); 7716 var focusableNodes = focusable(container, config.tabbableOptions); 7717 var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : void 0; 7718 var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : void 0; 7719 var firstDomTabbableNode = focusableNodes.find(function(node) { 7720 return isTabbable(node); 7721 }); 7722 var lastDomTabbableNode = focusableNodes.slice().reverse().find(function(node) { 7723 return isTabbable(node); 7724 }); 7725 var posTabIndexesFound = !!tabbableNodes.find(function(node) { 7726 return getTabIndex(node) > 0; 7727 }); 7728 return { 7729 container, 7730 tabbableNodes, 7731 focusableNodes, 7732 posTabIndexesFound, 7733 firstTabbableNode, 7734 lastTabbableNode, 7735 firstDomTabbableNode, 7736 lastDomTabbableNode, 7737 nextTabbableNode: function nextTabbableNode(node) { 7738 var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; 7739 var nodeIdx = tabbableNodes.indexOf(node); 7740 if (nodeIdx < 0) { 7741 if (forward) { 7742 return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function(el) { 7743 return isTabbable(el); 7744 }); 7745 } 7746 return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function(el) { 7747 return isTabbable(el); 7748 }); 7749 } 7750 return tabbableNodes[nodeIdx + (forward ? 1 : -1)]; 7751 } 7752 }; 7753 }); 7754 state.tabbableGroups = state.containerGroups.filter(function(group) { 7755 return group.tabbableNodes.length > 0; 7756 }); 7757 if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) { 7758 throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times"); 7759 } 7760 if (state.containerGroups.find(function(g) { 7761 return g.posTabIndexesFound; 7762 }) && state.containerGroups.length > 1) { 7763 throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps."); 7764 } 7765 }; 7766 var _getActiveElement = function getActiveElement(el) { 7767 var activeElement = el.activeElement; 7768 if (!activeElement) { 7769 return; 7770 } 7771 if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) { 7772 return _getActiveElement(activeElement.shadowRoot); 7773 } 7774 return activeElement; 7775 }; 7776 var _tryFocus = function tryFocus(node) { 7777 if (node === false) { 7778 return; 7779 } 7780 if (node === _getActiveElement(document)) { 7781 return; 7782 } 7783 if (!node || !node.focus) { 7784 _tryFocus(getInitialFocusNode()); 7785 return; 7786 } 7787 node.focus({ 7788 preventScroll: !!config.preventScroll 7789 }); 7790 state.mostRecentlyFocusedNode = node; 7791 if (isSelectableInput(node)) { 7792 node.select(); 7793 } 7794 }; 7795 var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) { 7796 var node = getNodeForOption("setReturnFocus", { 7797 params: [previousActiveElement] 7798 }); 7799 return node ? node : node === false ? false : previousActiveElement; 7800 }; 7801 var findNextNavNode = function findNextNavNode2(_ref3) { 7802 var target = _ref3.target, event = _ref3.event, _ref3$isBackward = _ref3.isBackward, isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward; 7803 target = target || getActualTarget(event); 7804 updateTabbableNodes(); 7805 var destinationNode = null; 7806 if (state.tabbableGroups.length > 0) { 7807 var containerIndex = findContainerIndex(target, event); 7808 var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0; 7809 if (containerIndex < 0) { 7810 if (isBackward) { 7811 destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode; 7812 } else { 7813 destinationNode = state.tabbableGroups[0].firstTabbableNode; 7814 } 7815 } else if (isBackward) { 7816 var startOfGroupIndex = state.tabbableGroups.findIndex(function(_ref4) { 7817 var firstTabbableNode = _ref4.firstTabbableNode; 7818 return target === firstTabbableNode; 7819 }); 7820 if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) { 7821 startOfGroupIndex = containerIndex; 7822 } 7823 if (startOfGroupIndex >= 0) { 7824 var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1; 7825 var destinationGroup = state.tabbableGroups[destinationGroupIndex]; 7826 destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode; 7827 } else if (!isTabEvent(event)) { 7828 destinationNode = containerGroup.nextTabbableNode(target, false); 7829 } 7830 } else { 7831 var lastOfGroupIndex = state.tabbableGroups.findIndex(function(_ref5) { 7832 var lastTabbableNode = _ref5.lastTabbableNode; 7833 return target === lastTabbableNode; 7834 }); 7835 if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) { 7836 lastOfGroupIndex = containerIndex; 7837 } 7838 if (lastOfGroupIndex >= 0) { 7839 var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1; 7840 var _destinationGroup = state.tabbableGroups[_destinationGroupIndex]; 7841 destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode; 7842 } else if (!isTabEvent(event)) { 7843 destinationNode = containerGroup.nextTabbableNode(target); 7844 } 7845 } 7846 } else { 7847 destinationNode = getNodeForOption("fallbackFocus"); 7848 } 7849 return destinationNode; 7850 }; 7851 var checkPointerDown = function checkPointerDown2(e) { 7852 var target = getActualTarget(e); 7853 if (findContainerIndex(target, e) >= 0) { 7854 return; 7855 } 7856 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 7857 trap.deactivate({ 7858 returnFocus: config.returnFocusOnDeactivate 7859 }); 7860 return; 7861 } 7862 if (valueOrHandler(config.allowOutsideClick, e)) { 7863 return; 7864 } 7865 e.preventDefault(); 7866 }; 7867 var checkFocusIn = function checkFocusIn2(event) { 7868 var target = getActualTarget(event); 7869 var targetContained = findContainerIndex(target, event) >= 0; 7870 if (targetContained || target instanceof Document) { 7871 if (targetContained) { 7872 state.mostRecentlyFocusedNode = target; 7873 } 7874 } else { 7875 event.stopImmediatePropagation(); 7876 var nextNode; 7877 var navAcrossContainers = true; 7878 if (state.mostRecentlyFocusedNode) { 7879 if (getTabIndex(state.mostRecentlyFocusedNode) > 0) { 7880 var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode); 7881 var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes; 7882 if (tabbableNodes.length > 0) { 7883 var mruTabIdx = tabbableNodes.findIndex(function(node) { 7884 return node === state.mostRecentlyFocusedNode; 7885 }); 7886 if (mruTabIdx >= 0) { 7887 if (config.isKeyForward(state.recentNavEvent)) { 7888 if (mruTabIdx + 1 < tabbableNodes.length) { 7889 nextNode = tabbableNodes[mruTabIdx + 1]; 7890 navAcrossContainers = false; 7891 } 7892 } else { 7893 if (mruTabIdx - 1 >= 0) { 7894 nextNode = tabbableNodes[mruTabIdx - 1]; 7895 navAcrossContainers = false; 7896 } 7897 } 7898 } 7899 } 7900 } else { 7901 if (!state.containerGroups.some(function(g) { 7902 return g.tabbableNodes.some(function(n) { 7903 return getTabIndex(n) > 0; 7904 }); 7905 })) { 7906 navAcrossContainers = false; 7907 } 7908 } 7909 } else { 7910 navAcrossContainers = false; 7911 } 7912 if (navAcrossContainers) { 7913 nextNode = findNextNavNode({ 7914 target: state.mostRecentlyFocusedNode, 7915 isBackward: config.isKeyBackward(state.recentNavEvent) 7916 }); 7917 } 7918 if (nextNode) { 7919 _tryFocus(nextNode); 7920 } else { 7921 _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); 7922 } 7923 } 7924 state.recentNavEvent = void 0; 7925 }; 7926 var checkKeyNav = function checkKeyNav2(event) { 7927 var isBackward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; 7928 state.recentNavEvent = event; 7929 var destinationNode = findNextNavNode({ 7930 event, 7931 isBackward 7932 }); 7933 if (destinationNode) { 7934 if (isTabEvent(event)) { 7935 event.preventDefault(); 7936 } 7937 _tryFocus(destinationNode); 7938 } 7939 }; 7940 var checkTabKey = function checkTabKey2(event) { 7941 if (config.isKeyForward(event) || config.isKeyBackward(event)) { 7942 checkKeyNav(event, config.isKeyBackward(event)); 7943 } 7944 }; 7945 var checkEscapeKey = function checkEscapeKey2(event) { 7946 if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) { 7947 event.preventDefault(); 7948 trap.deactivate(); 7949 } 7950 }; 7951 var checkClick = function checkClick2(e) { 7952 var target = getActualTarget(e); 7953 if (findContainerIndex(target, e) >= 0) { 7954 return; 7955 } 7956 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 7957 return; 7958 } 7959 if (valueOrHandler(config.allowOutsideClick, e)) { 7960 return; 7961 } 7962 e.preventDefault(); 7963 e.stopImmediatePropagation(); 7964 }; 7965 var addListeners = function addListeners2() { 7966 if (!state.active) { 7967 return Promise.resolve(); 7968 } 7969 activeFocusTraps.activateTrap(trapStack, trap); 7970 var promise; 7971 if (config.delayInitialFocus) { 7972 promise = new Promise(function(resolve) { 7973 state.delayInitialFocusTimer = delay(function() { 7974 _tryFocus(getInitialFocusNode()); 7975 resolve(); 7976 }); 7977 }); 7978 } else { 7979 promise = Promise.resolve(); 7980 _tryFocus(getInitialFocusNode()); 7981 } 7982 doc.addEventListener("focusin", checkFocusIn, true); 7983 doc.addEventListener("mousedown", checkPointerDown, { 7984 capture: true, 7985 passive: false 7986 }); 7987 doc.addEventListener("touchstart", checkPointerDown, { 7988 capture: true, 7989 passive: false 7990 }); 7991 doc.addEventListener("click", checkClick, { 7992 capture: true, 7993 passive: false 7994 }); 7995 doc.addEventListener("keydown", checkTabKey, { 7996 capture: true, 7997 passive: false 7998 }); 7999 doc.addEventListener("keydown", checkEscapeKey); 8000 return promise; 8001 }; 8002 var collectAdjacentElements = function collectAdjacentElements2(containers) { 8003 if (state.active && !state.paused) { 8004 trap._setSubtreeIsolation(false); 8005 } 8006 state.adjacentElements.clear(); 8007 state.alreadySilent.clear(); 8008 var containerAncestors = /* @__PURE__ */ new Set(); 8009 var adjacentElements = /* @__PURE__ */ new Set(); 8010 var _iterator = _createForOfIteratorHelper(containers), _step; 8011 try { 8012 for (_iterator.s(); !(_step = _iterator.n()).done; ) { 8013 var container = _step.value; 8014 containerAncestors.add(container); 8015 var insideShadowRoot = typeof ShadowRoot !== "undefined" && container.getRootNode() instanceof ShadowRoot; 8016 var current = container; 8017 while (current) { 8018 containerAncestors.add(current); 8019 var parent = current.parentElement; 8020 var siblings = []; 8021 if (parent) { 8022 siblings = parent.children; 8023 } else if (!parent && insideShadowRoot) { 8024 siblings = current.getRootNode().children; 8025 parent = current.getRootNode().host; 8026 insideShadowRoot = typeof ShadowRoot !== "undefined" && parent.getRootNode() instanceof ShadowRoot; 8027 } 8028 var _iterator2 = _createForOfIteratorHelper(siblings), _step2; 8029 try { 8030 for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { 8031 var child = _step2.value; 8032 adjacentElements.add(child); 8033 } 8034 } catch (err) { 8035 _iterator2.e(err); 8036 } finally { 8037 _iterator2.f(); 8038 } 8039 current = parent; 8040 } 8041 } 8042 } catch (err) { 8043 _iterator.e(err); 8044 } finally { 8045 _iterator.f(); 8046 } 8047 containerAncestors.forEach(function(el) { 8048 adjacentElements["delete"](el); 8049 }); 8050 state.adjacentElements = adjacentElements; 8051 }; 8052 var removeListeners = function removeListeners2() { 8053 if (!state.active) { 8054 return; 8055 } 8056 doc.removeEventListener("focusin", checkFocusIn, true); 8057 doc.removeEventListener("mousedown", checkPointerDown, true); 8058 doc.removeEventListener("touchstart", checkPointerDown, true); 8059 doc.removeEventListener("click", checkClick, true); 8060 doc.removeEventListener("keydown", checkTabKey, true); 8061 doc.removeEventListener("keydown", checkEscapeKey); 8062 return trap; 8063 }; 8064 var checkDomRemoval = function checkDomRemoval2(mutations) { 8065 var isFocusedNodeRemoved = mutations.some(function(mutation) { 8066 var removedNodes = Array.from(mutation.removedNodes); 8067 return removedNodes.some(function(node) { 8068 return node === state.mostRecentlyFocusedNode; 8069 }); 8070 }); 8071 if (isFocusedNodeRemoved) { 8072 _tryFocus(getInitialFocusNode()); 8073 } 8074 }; 8075 var mutationObserver = typeof window !== "undefined" && "MutationObserver" in window ? new MutationObserver(checkDomRemoval) : void 0; 8076 var updateObservedNodes = function updateObservedNodes2() { 8077 if (!mutationObserver) { 8078 return; 8079 } 8080 mutationObserver.disconnect(); 8081 if (state.active && !state.paused) { 8082 state.containers.map(function(container) { 8083 mutationObserver.observe(container, { 8084 subtree: true, 8085 childList: true 8086 }); 8087 }); 8088 } 8089 }; 8090 trap = { 8091 get active() { 8092 return state.active; 8093 }, 8094 get paused() { 8095 return state.paused; 8096 }, 8097 activate: function activate(activateOptions) { 8098 if (state.active) { 8099 return this; 8100 } 8101 var onActivate = getOption(activateOptions, "onActivate"); 8102 var onPostActivate = getOption(activateOptions, "onPostActivate"); 8103 var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap"); 8104 var preexistingTrap = activeFocusTraps.getActiveTrap(trapStack); 8105 var revertState = false; 8106 if (preexistingTrap && !preexistingTrap.paused) { 8107 var _preexistingTrap$_set; 8108 (_preexistingTrap$_set = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set === void 0 || _preexistingTrap$_set.call(preexistingTrap, false); 8109 revertState = true; 8110 } 8111 try { 8112 if (!checkCanFocusTrap) { 8113 updateTabbableNodes(); 8114 } 8115 state.active = true; 8116 state.paused = false; 8117 state.nodeFocusedBeforeActivation = _getActiveElement(doc); 8118 onActivate === null || onActivate === void 0 || onActivate(); 8119 var finishActivation = /* @__PURE__ */ function() { 8120 var _ref6 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee() { 8121 return _regenerator().w(function(_context) { 8122 while (1) 8123 switch (_context.n) { 8124 case 0: 8125 if (checkCanFocusTrap) { 8126 updateTabbableNodes(); 8127 } 8128 _context.n = 1; 8129 return addListeners(); 8130 case 1: 8131 trap._setSubtreeIsolation(true); 8132 updateObservedNodes(); 8133 onPostActivate === null || onPostActivate === void 0 || onPostActivate(); 8134 case 2: 8135 return _context.a(2); 8136 } 8137 }, _callee); 8138 })); 8139 return function finishActivation2() { 8140 return _ref6.apply(this, arguments); 8141 }; 8142 }(); 8143 if (checkCanFocusTrap) { 8144 checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation); 8145 return this; 8146 } 8147 finishActivation(); 8148 } catch (error2) { 8149 if (preexistingTrap === activeFocusTraps.getActiveTrap(trapStack) && revertState) { 8150 var _preexistingTrap$_set2; 8151 (_preexistingTrap$_set2 = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set2 === void 0 || _preexistingTrap$_set2.call(preexistingTrap, true); 8152 } 8153 throw error2; 8154 } 8155 return this; 8156 }, 8157 deactivate: function deactivate(deactivateOptions) { 8158 if (!state.active) { 8159 return this; 8160 } 8161 var options = _objectSpread2({ 8162 onDeactivate: config.onDeactivate, 8163 onPostDeactivate: config.onPostDeactivate, 8164 checkCanReturnFocus: config.checkCanReturnFocus 8165 }, deactivateOptions); 8166 clearTimeout(state.delayInitialFocusTimer); 8167 state.delayInitialFocusTimer = void 0; 8168 if (!state.paused) { 8169 trap._setSubtreeIsolation(false); 8170 } 8171 state.alreadySilent.clear(); 8172 removeListeners(); 8173 state.active = false; 8174 state.paused = false; 8175 updateObservedNodes(); 8176 activeFocusTraps.deactivateTrap(trapStack, trap); 8177 var onDeactivate = getOption(options, "onDeactivate"); 8178 var onPostDeactivate = getOption(options, "onPostDeactivate"); 8179 var checkCanReturnFocus = getOption(options, "checkCanReturnFocus"); 8180 var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate"); 8181 onDeactivate === null || onDeactivate === void 0 || onDeactivate(); 8182 var finishDeactivation = function finishDeactivation2() { 8183 delay(function() { 8184 if (returnFocus) { 8185 _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)); 8186 } 8187 onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate(); 8188 }); 8189 }; 8190 if (returnFocus && checkCanReturnFocus) { 8191 checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation); 8192 return this; 8193 } 8194 finishDeactivation(); 8195 return this; 8196 }, 8197 pause: function pause(pauseOptions) { 8198 if (!state.active) { 8199 return this; 8200 } 8201 state.manuallyPaused = true; 8202 return this._setPausedState(true, pauseOptions); 8203 }, 8204 unpause: function unpause(unpauseOptions) { 8205 if (!state.active) { 8206 return this; 8207 } 8208 state.manuallyPaused = false; 8209 if (trapStack[trapStack.length - 1] !== this) { 8210 return this; 8211 } 8212 return this._setPausedState(false, unpauseOptions); 8213 }, 8214 updateContainerElements: function updateContainerElements(containerElements) { 8215 var elementsAsArray = [].concat(containerElements).filter(Boolean); 8216 state.containers = elementsAsArray.map(function(element) { 8217 return typeof element === "string" ? doc.querySelector(element) : element; 8218 }); 8219 if (config.isolateSubtrees) { 8220 collectAdjacentElements(state.containers); 8221 } 8222 if (state.active) { 8223 updateTabbableNodes(); 8224 if (!state.paused) { 8225 trap._setSubtreeIsolation(true); 8226 } 8227 } 8228 updateObservedNodes(); 8229 return this; 8230 } 8231 }; 8232 Object.defineProperties(trap, { 8233 _isManuallyPaused: { 8234 value: function value() { 8235 return state.manuallyPaused; 8236 } 8237 }, 8238 _setPausedState: { 8239 value: function value(paused, options) { 8240 if (state.paused === paused) { 8241 return this; 8242 } 8243 state.paused = paused; 8244 if (paused) { 8245 var onPause = getOption(options, "onPause"); 8246 var onPostPause = getOption(options, "onPostPause"); 8247 onPause === null || onPause === void 0 || onPause(); 8248 removeListeners(); 8249 trap._setSubtreeIsolation(false); 8250 updateObservedNodes(); 8251 onPostPause === null || onPostPause === void 0 || onPostPause(); 8252 } else { 8253 var onUnpause = getOption(options, "onUnpause"); 8254 var onPostUnpause = getOption(options, "onPostUnpause"); 8255 onUnpause === null || onUnpause === void 0 || onUnpause(); 8256 var finishUnpause = /* @__PURE__ */ function() { 8257 var _ref7 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee2() { 8258 return _regenerator().w(function(_context2) { 8259 while (1) 8260 switch (_context2.n) { 8261 case 0: 8262 updateTabbableNodes(); 8263 _context2.n = 1; 8264 return addListeners(); 8265 case 1: 8266 trap._setSubtreeIsolation(true); 8267 updateObservedNodes(); 8268 onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause(); 8269 case 2: 8270 return _context2.a(2); 8271 } 8272 }, _callee2); 8273 })); 8274 return function finishUnpause2() { 8275 return _ref7.apply(this, arguments); 8276 }; 8277 }(); 8278 finishUnpause(); 8279 } 8280 return this; 8281 } 8282 }, 8283 _setSubtreeIsolation: { 8284 value: function value(isEnabled) { 8285 if (config.isolateSubtrees) { 8286 state.adjacentElements.forEach(function(el) { 8287 var _el$getAttribute; 8288 if (isEnabled) { 8289 switch (config.isolateSubtrees) { 8290 case "aria-hidden": 8291 if (el.ariaHidden === "true" || ((_el$getAttribute = el.getAttribute("aria-hidden")) === null || _el$getAttribute === void 0 ? void 0 : _el$getAttribute.toLowerCase()) === "true") { 8292 state.alreadySilent.add(el); 8293 } 8294 el.setAttribute("aria-hidden", "true"); 8295 break; 8296 default: 8297 if (el.inert || el.hasAttribute("inert")) { 8298 state.alreadySilent.add(el); 8299 } 8300 el.setAttribute("inert", true); 8301 break; 8302 } 8303 } else { 8304 if (state.alreadySilent.has(el)) 8305 ; 8306 else { 8307 switch (config.isolateSubtrees) { 8308 case "aria-hidden": 8309 el.removeAttribute("aria-hidden"); 8310 break; 8311 default: 8312 el.removeAttribute("inert"); 8313 break; 8314 } 8315 } 8316 } 8317 }); 8318 } 8319 } 8320 } 8321 }); 8322 trap.updateContainerElements(elements); 8323 return trap; 8324 }; 8325 function src_default3(Alpine3) { 8326 let lastFocused; 8327 let currentFocused; 8328 window.addEventListener("focusin", () => { 8329 lastFocused = currentFocused; 8330 currentFocused = document.activeElement; 8331 }); 8332 Alpine3.magic("focus", (el) => { 8333 let within = el; 8334 return { 8335 __noscroll: false, 8336 __wrapAround: false, 8337 within(el2) { 8338 within = el2; 8339 return this; 8340 }, 8341 withoutScrolling() { 8342 this.__noscroll = true; 8343 return this; 8344 }, 8345 noscroll() { 8346 this.__noscroll = true; 8347 return this; 8348 }, 8349 withWrapAround() { 8350 this.__wrapAround = true; 8351 return this; 8352 }, 8353 wrap() { 8354 return this.withWrapAround(); 8355 }, 8356 focusable(el2) { 8357 return isFocusable(el2); 8358 }, 8359 previouslyFocused() { 8360 return lastFocused; 8361 }, 8362 lastFocused() { 8363 return lastFocused; 8364 }, 8365 focused() { 8366 return currentFocused; 8367 }, 8368 focusables() { 8369 if (Array.isArray(within)) 8370 return within; 8371 return focusable(within, { displayCheck: "none" }); 8372 }, 8373 all() { 8374 return this.focusables(); 8375 }, 8376 isFirst(el2) { 8377 let els2 = this.all(); 8378 return els2[0] && els2[0].isSameNode(el2); 8379 }, 8380 isLast(el2) { 8381 let els2 = this.all(); 8382 return els2.length && els2.slice(-1)[0].isSameNode(el2); 8383 }, 8384 getFirst() { 8385 return this.all()[0]; 8386 }, 8387 getLast() { 8388 return this.all().slice(-1)[0]; 8389 }, 8390 getNext() { 8391 let list = this.all(); 8392 let current = document.activeElement; 8393 if (list.indexOf(current) === -1) 8394 return; 8395 if (this.__wrapAround && list.indexOf(current) === list.length - 1) { 8396 return list[0]; 8397 } 8398 return list[list.indexOf(current) + 1]; 8399 }, 8400 getPrevious() { 8401 let list = this.all(); 8402 let current = document.activeElement; 8403 if (list.indexOf(current) === -1) 8404 return; 8405 if (this.__wrapAround && list.indexOf(current) === 0) { 8406 return list.slice(-1)[0]; 8407 } 8408 return list[list.indexOf(current) - 1]; 8409 }, 8410 first() { 8411 this.focus(this.getFirst()); 8412 }, 8413 last() { 8414 this.focus(this.getLast()); 8415 }, 8416 next() { 8417 this.focus(this.getNext()); 8418 }, 8419 previous() { 8420 this.focus(this.getPrevious()); 8421 }, 8422 prev() { 8423 return this.previous(); 8424 }, 8425 focus(el2) { 8426 if (!el2) 8427 return; 8428 setTimeout(() => { 8429 if (!el2.hasAttribute("tabindex")) 8430 el2.setAttribute("tabindex", "0"); 8431 el2.focus({ preventScroll: this.__noscroll }); 8432 }); 8433 } 8434 }; 8435 }); 8436 Alpine3.directive("trap", Alpine3.skipDuringClone( 8437 (el, { expression, modifiers }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 8438 let evaluator = evaluateLater2(expression); 8439 let oldValue = false; 8440 let options = { 8441 escapeDeactivates: false, 8442 allowOutsideClick: true, 8443 fallbackFocus: () => el 8444 }; 8445 let undoInert = () => { 8446 }; 8447 if (modifiers.includes("noautofocus")) { 8448 options.initialFocus = false; 8449 } else { 8450 let autofocusEl = el.querySelector("[autofocus]"); 8451 if (autofocusEl) 8452 options.initialFocus = autofocusEl; 8453 } 8454 if (modifiers.includes("inert")) { 8455 options.onPostActivate = () => { 8456 Alpine3.nextTick(() => { 8457 undoInert = setInert(el); 8458 }); 8459 }; 8460 } 8461 let trap = createFocusTrap(el, options); 8462 let undoDisableScrolling = () => { 8463 }; 8464 const releaseFocus = () => { 8465 undoInert(); 8466 undoInert = () => { 8467 }; 8468 undoDisableScrolling(); 8469 undoDisableScrolling = () => { 8470 }; 8471 trap.deactivate({ 8472 returnFocus: !modifiers.includes("noreturn") 8473 }); 8474 }; 8475 effect3(() => evaluator((value) => { 8476 if (oldValue === value) 8477 return; 8478 if (value && !oldValue) { 8479 if (modifiers.includes("noscroll")) 8480 undoDisableScrolling = disableScrolling(); 8481 setTimeout(() => { 8482 trap.activate(); 8483 }, 15); 8484 } 8485 if (!value && oldValue) { 8486 releaseFocus(); 8487 } 8488 oldValue = !!value; 8489 })); 8490 cleanup2(releaseFocus); 8491 }, 8492 (el, { expression, modifiers }, { evaluate: evaluate3 }) => { 8493 if (modifiers.includes("inert") && evaluate3(expression)) 8494 setInert(el); 8495 } 8496 )); 8497 } 8498 function setInert(el) { 8499 let undos = []; 8500 crawlSiblingsUp(el, (sibling) => { 8501 let cache = sibling.hasAttribute("aria-hidden"); 8502 sibling.setAttribute("aria-hidden", "true"); 8503 undos.push(() => cache || sibling.removeAttribute("aria-hidden")); 8504 }); 8505 return () => { 8506 while (undos.length) 8507 undos.pop()(); 8508 }; 8509 } 8510 function crawlSiblingsUp(el, callback) { 8511 if (el.isSameNode(document.body) || !el.parentNode) 8512 return; 8513 Array.from(el.parentNode.children).forEach((sibling) => { 8514 if (sibling.isSameNode(el)) { 8515 crawlSiblingsUp(el.parentNode, callback); 8516 } else { 8517 callback(sibling); 8518 } 8519 }); 8520 } 8521 function disableScrolling() { 8522 let overflow = document.documentElement.style.overflow; 8523 let paddingRight = document.documentElement.style.paddingRight; 8524 let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 8525 let scrollbarGutter = window.getComputedStyle(document.documentElement).scrollbarGutter; 8526 document.documentElement.style.overflow = "hidden"; 8527 if (scrollbarGutter && scrollbarGutter !== "auto") { 8528 return () => { 8529 document.documentElement.style.overflow = overflow; 8530 }; 8531 } 8532 document.documentElement.style.paddingRight = `${scrollbarWidth}px`; 8533 return () => { 8534 document.documentElement.style.overflow = overflow; 8535 document.documentElement.style.paddingRight = paddingRight; 8536 }; 8537 } 8538 var module_default3 = src_default3; 8539 8540
vendor: 1,953 bytes, lines 8540-8602
8540// node_modules/@alpinejs/persist/dist/module.esm.js 8541 function src_default4(Alpine3) { 8542 let persist = () => { 8543 let alias; 8544 let storage; 8545 try { 8546 storage = localStorage; 8547 } catch (e) { 8548 console.error(e); 8549 console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable."); 8550 let dummy = /* @__PURE__ */ new Map(); 8551 storage = { 8552 getItem: dummy.get.bind(dummy), 8553 setItem: dummy.set.bind(dummy) 8554 }; 8555 } 8556 return Alpine3.interceptor((initialValue, getter, setter, path, key) => { 8557 let lookup = alias || `_x_${path}`; 8558 let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue; 8559 setter(initial); 8560 Alpine3.effect(() => { 8561 let value = getter(); 8562 storageSet(lookup, value, storage); 8563 setter(value); 8564 }); 8565 return initial; 8566 }, (func) => { 8567 func.as = (key) => { 8568 alias = key; 8569 return func; 8570 }, func.using = (target) => { 8571 storage = target; 8572 return func; 8573 }; 8574 }); 8575 }; 8576 Object.defineProperty(Alpine3, "$persist", { get: () => persist() }); 8577 Alpine3.magic("persist", persist); 8578 Alpine3.persist = (key, { get: get3, set: set3 }, storage = localStorage) => { 8579 let initial = storageHas(key, storage) ? storageGet(key, storage) : get3(); 8580 set3(initial); 8581 Alpine3.effect(() => { 8582 let value = get3(); 8583 storageSet(key, value, storage); 8584 set3(value); 8585 }); 8586 }; 8587 } 8588 function storageHas(key, storage) { 8589 return storage.getItem(key) !== null; 8590 } 8591 function storageGet(key, storage) { 8592 let value = storage.getItem(key); 8593 if (value === void 0) 8594 return; 8595 return JSON.parse(value); 8596 } 8597 function storageSet(key, value, storage) { 8598 storage.setItem(key, JSON.stringify(value)); 8599 } 8600 var module_default4 = src_default4; 8601 8602
vendor: 1,854 bytes, lines 8602-8657
8602// node_modules/@alpinejs/intersect/dist/module.esm.js 8603 function src_default5(Alpine3) { 8604 Alpine3.directive("intersect", Alpine3.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 8605 let evaluate3 = evaluateLater2(expression); 8606 let options = { 8607 rootMargin: getRootMargin(modifiers), 8608 threshold: getThreshold(modifiers) 8609 }; 8610 let observer2 = new IntersectionObserver((entries) => { 8611 entries.forEach((entry) => { 8612 if (entry.isIntersecting === (value === "leave")) 8613 return; 8614 evaluate3(); 8615 modifiers.includes("once") && observer2.disconnect(); 8616 }); 8617 }, options); 8618 observer2.observe(el); 8619 cleanup2(() => { 8620 observer2.disconnect(); 8621 }); 8622 })); 8623 } 8624 function getThreshold(modifiers) { 8625 if (modifiers.includes("full")) 8626 return 0.99; 8627 if (modifiers.includes("half")) 8628 return 0.5; 8629 if (!modifiers.includes("threshold")) 8630 return 0; 8631 let threshold = modifiers[modifiers.indexOf("threshold") + 1]; 8632 if (threshold === "100") 8633 return 1; 8634 if (threshold === "0") 8635 return 0; 8636 return Number(`.${threshold}`); 8637 } 8638 function getLengthValue(rawValue) { 8639 let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/); 8640 return match ? match[1] + (match[2] || "px") : void 0; 8641 } 8642 function getRootMargin(modifiers) { 8643 const key = "margin"; 8644 const fallback2 = "0px 0px 0px 0px"; 8645 const index2 = modifiers.indexOf(key); 8646 if (index2 === -1) 8647 return fallback2; 8648 let values = []; 8649 for (let i = 1; i < 5; i++) { 8650 values.push(getLengthValue(modifiers[index2 + i] || "")); 8651 } 8652 values = values.filter((v) => v !== void 0); 8653 return values.length ? values.join(" ").trim() : fallback2; 8654 } 8655 var module_default5 = src_default5; 8656 8657
vendor: 89,203 bytes, lines 8657-11002
8657// node_modules/@alpinejs/sort/dist/module.esm.js 8658 function ownKeys3(object, enumerableOnly) { 8659 var keys = Object.keys(object); 8660 if (Object.getOwnPropertySymbols) { 8661 var symbols = Object.getOwnPropertySymbols(object); 8662 if (enumerableOnly) { 8663 symbols = symbols.filter(function(sym) { 8664 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 8665 }); 8666 } 8667 keys.push.apply(keys, symbols); 8668 } 8669 return keys; 8670 } 8671 function _objectSpread22(target) { 8672 for (var i = 1; i < arguments.length; i++) { 8673 var source = arguments[i] != null ? arguments[i] : {}; 8674 if (i % 2) { 8675 ownKeys3(Object(source), true).forEach(function(key) { 8676 _defineProperty2(target, key, source[key]); 8677 }); 8678 } else if (Object.getOwnPropertyDescriptors) { 8679 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 8680 } else { 8681 ownKeys3(Object(source)).forEach(function(key) { 8682 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 8683 }); 8684 } 8685 } 8686 return target; 8687 } 8688 function _typeof(obj) { 8689 "@babel/helpers - typeof"; 8690 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 8691 _typeof = function(obj2) { 8692 return typeof obj2; 8693 }; 8694 } else { 8695 _typeof = function(obj2) { 8696 return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 8697 }; 8698 } 8699 return _typeof(obj); 8700 } 8701 function _defineProperty2(obj, key, value) { 8702 if (key in obj) { 8703 Object.defineProperty(obj, key, { 8704 value, 8705 enumerable: true, 8706 configurable: true, 8707 writable: true 8708 }); 8709 } else { 8710 obj[key] = value; 8711 } 8712 return obj; 8713 } 8714 function _extends() { 8715 _extends = Object.assign || function(target) { 8716 for (var i = 1; i < arguments.length; i++) { 8717 var source = arguments[i]; 8718 for (var key in source) { 8719 if (Object.prototype.hasOwnProperty.call(source, key)) { 8720 target[key] = source[key]; 8721 } 8722 } 8723 } 8724 return target; 8725 }; 8726 return _extends.apply(this, arguments); 8727 } 8728 function _objectWithoutPropertiesLoose(source, excluded) { 8729 if (source == null) 8730 return {}; 8731 var target = {}; 8732 var sourceKeys = Object.keys(source); 8733 var key, i; 8734 for (i = 0; i < sourceKeys.length; i++) { 8735 key = sourceKeys[i]; 8736 if (excluded.indexOf(key) >= 0) 8737 continue; 8738 target[key] = source[key]; 8739 } 8740 return target; 8741 } 8742 function _objectWithoutProperties(source, excluded) { 8743 if (source == null) 8744 return {}; 8745 var target = _objectWithoutPropertiesLoose(source, excluded); 8746 var key, i; 8747 if (Object.getOwnPropertySymbols) { 8748 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 8749 for (i = 0; i < sourceSymbolKeys.length; i++) { 8750 key = sourceSymbolKeys[i]; 8751 if (excluded.indexOf(key) >= 0) 8752 continue; 8753 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 8754 continue; 8755 target[key] = source[key]; 8756 } 8757 } 8758 return target; 8759 } 8760 var version = "1.15.2"; 8761 function userAgent(pattern) { 8762 if (typeof window !== "undefined" && window.navigator) { 8763 return !!/* @__PURE__ */ navigator.userAgent.match(pattern); 8764 } 8765 } 8766 var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); 8767 var Edge = userAgent(/Edge/i); 8768 var FireFox = userAgent(/firefox/i); 8769 var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); 8770 var IOS = userAgent(/iP(ad|od|hone)/i); 8771 var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); 8772 var captureMode = { 8773 capture: false, 8774 passive: false 8775 }; 8776 function on4(el, event, fn) { 8777 el.addEventListener(event, fn, !IE11OrLess && captureMode); 8778 } 8779 function off(el, event, fn) { 8780 el.removeEventListener(event, fn, !IE11OrLess && captureMode); 8781 } 8782 function matches2(el, selector) { 8783 if (!selector) 8784 return; 8785 selector[0] === ">" && (selector = selector.substring(1)); 8786 if (el) { 8787 try { 8788 if (el.matches) { 8789 return el.matches(selector); 8790 } else if (el.msMatchesSelector) { 8791 return el.msMatchesSelector(selector); 8792 } else if (el.webkitMatchesSelector) { 8793 return el.webkitMatchesSelector(selector); 8794 } 8795 } catch (_) { 8796 return false; 8797 } 8798 } 8799 return false; 8800 } 8801 function getParentOrHost(el) { 8802 return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; 8803 } 8804 function closest(el, selector, ctx, includeCTX) { 8805 if (el) { 8806 ctx = ctx || document; 8807 do { 8808 if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches2(el, selector) : matches2(el, selector)) || includeCTX && el === ctx) { 8809 return el; 8810 } 8811 if (el === ctx) 8812 break; 8813 } while (el = getParentOrHost(el)); 8814 } 8815 return null; 8816 } 8817 var R_SPACE = /\s+/g; 8818 function toggleClass(el, name, state) { 8819 if (el && name) { 8820 if (el.classList) { 8821 el.classList[state ? "add" : "remove"](name); 8822 } else { 8823 var className = (" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " "); 8824 el.className = (className + (state ? " " + name : "")).replace(R_SPACE, " "); 8825 } 8826 } 8827 } 8828 function css(el, prop, val) { 8829 var style = el && el.style; 8830 if (style) { 8831 if (val === void 0) { 8832 if (document.defaultView && document.defaultView.getComputedStyle) { 8833 val = document.defaultView.getComputedStyle(el, ""); 8834 } else if (el.currentStyle) { 8835 val = el.currentStyle; 8836 } 8837 return prop === void 0 ? val : val[prop]; 8838 } else { 8839 if (!(prop in style) && prop.indexOf("webkit") === -1) { 8840 prop = "-webkit-" + prop; 8841 } 8842 style[prop] = val + (typeof val === "string" ? "" : "px"); 8843 } 8844 } 8845 } 8846 function matrix(el, selfOnly) { 8847 var appliedTransforms = ""; 8848 if (typeof el === "string") { 8849 appliedTransforms = el; 8850 } else { 8851 do { 8852 var transform = css(el, "transform"); 8853 if (transform && transform !== "none") { 8854 appliedTransforms = transform + " " + appliedTransforms; 8855 } 8856 } while (!selfOnly && (el = el.parentNode)); 8857 } 8858 var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; 8859 return matrixFn && new matrixFn(appliedTransforms); 8860 } 8861 function find2(ctx, tagName, iterator) { 8862 if (ctx) { 8863 var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length; 8864 if (iterator) { 8865 for (; i < n; i++) { 8866 iterator(list[i], i); 8867 } 8868 } 8869 return list; 8870 } 8871 return []; 8872 } 8873 function getWindowScrollingElement() { 8874 var scrollingElement = document.scrollingElement; 8875 if (scrollingElement) { 8876 return scrollingElement; 8877 } else { 8878 return document.documentElement; 8879 } 8880 } 8881 function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { 8882 if (!el.getBoundingClientRect && el !== window) 8883 return; 8884 var elRect, top, left, bottom, right, height, width; 8885 if (el !== window && el.parentNode && el !== getWindowScrollingElement()) { 8886 elRect = el.getBoundingClientRect(); 8887 top = elRect.top; 8888 left = elRect.left; 8889 bottom = elRect.bottom; 8890 right = elRect.right; 8891 height = elRect.height; 8892 width = elRect.width; 8893 } else { 8894 top = 0; 8895 left = 0; 8896 bottom = window.innerHeight; 8897 right = window.innerWidth; 8898 height = window.innerHeight; 8899 width = window.innerWidth; 8900 } 8901 if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { 8902 container = container || el.parentNode; 8903 if (!IE11OrLess) { 8904 do { 8905 if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) { 8906 var containerRect = container.getBoundingClientRect(); 8907 top -= containerRect.top + parseInt(css(container, "border-top-width")); 8908 left -= containerRect.left + parseInt(css(container, "border-left-width")); 8909 bottom = top + elRect.height; 8910 right = left + elRect.width; 8911 break; 8912 } 8913 } while (container = container.parentNode); 8914 } 8915 } 8916 if (undoScale && el !== window) { 8917 var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d; 8918 if (elMatrix) { 8919 top /= scaleY; 8920 left /= scaleX; 8921 width /= scaleX; 8922 height /= scaleY; 8923 bottom = top + height; 8924 right = left + width; 8925 } 8926 } 8927 return { 8928 top, 8929 left, 8930 bottom, 8931 right, 8932 width, 8933 height 8934 }; 8935 } 8936 function isScrolledPast(el, elSide, parentSide) { 8937 var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide]; 8938 while (parent) { 8939 var parentSideVal = getRect(parent)[parentSide], visible = void 0; 8940 if (parentSide === "top" || parentSide === "left") { 8941 visible = elSideVal >= parentSideVal; 8942 } else { 8943 visible = elSideVal <= parentSideVal; 8944 } 8945 if (!visible) 8946 return parent; 8947 if (parent === getWindowScrollingElement()) 8948 break; 8949 parent = getParentAutoScrollElement(parent, false); 8950 } 8951 return false; 8952 } 8953 function getChild(el, childNum, options, includeDragEl) { 8954 var currentChild = 0, i = 0, children = el.children; 8955 while (i < children.length) { 8956 if (children[i].style.display !== "none" && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) { 8957 if (currentChild === childNum) { 8958 return children[i]; 8959 } 8960 currentChild++; 8961 } 8962 i++; 8963 } 8964 return null; 8965 } 8966 function lastChild(el, selector) { 8967 var last = el.lastElementChild; 8968 while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches2(last, selector))) { 8969 last = last.previousElementSibling; 8970 } 8971 return last || null; 8972 } 8973 function index(el, selector) { 8974 var index2 = 0; 8975 if (!el || !el.parentNode) { 8976 return -1; 8977 } 8978 while (el = el.previousElementSibling) { 8979 if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches2(el, selector))) { 8980 index2++; 8981 } 8982 } 8983 return index2; 8984 } 8985 function getRelativeScrollOffset(el) { 8986 var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement(); 8987 if (el) { 8988 do { 8989 var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d; 8990 offsetLeft += el.scrollLeft * scaleX; 8991 offsetTop += el.scrollTop * scaleY; 8992 } while (el !== winScroller && (el = el.parentNode)); 8993 } 8994 return [offsetLeft, offsetTop]; 8995 } 8996 function indexOfObject(arr, obj) { 8997 for (var i in arr) { 8998 if (!arr.hasOwnProperty(i)) 8999 continue; 9000 for (var key in obj) { 9001 if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) 9002 return Number(i); 9003 } 9004 } 9005 return -1; 9006 } 9007 function getParentAutoScrollElement(el, includeSelf) { 9008 if (!el || !el.getBoundingClientRect) 9009 return getWindowScrollingElement(); 9010 var elem = el; 9011 var gotSelf = false; 9012 do { 9013 if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { 9014 var elemCSS = css(elem); 9015 if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) { 9016 if (!elem.getBoundingClientRect || elem === document.body) 9017 return getWindowScrollingElement(); 9018 if (gotSelf || includeSelf) 9019 return elem; 9020 gotSelf = true; 9021 } 9022 } 9023 } while (elem = elem.parentNode); 9024 return getWindowScrollingElement(); 9025 } 9026 function extend(dst, src) { 9027 if (dst && src) { 9028 for (var key in src) { 9029 if (src.hasOwnProperty(key)) { 9030 dst[key] = src[key]; 9031 } 9032 } 9033 } 9034 return dst; 9035 } 9036 function isRectEqual(rect1, rect2) { 9037 return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); 9038 } 9039 var _throttleTimeout; 9040 function throttle2(callback, ms) { 9041 return function() { 9042 if (!_throttleTimeout) { 9043 var args = arguments, _this = this; 9044 if (args.length === 1) { 9045 callback.call(_this, args[0]); 9046 } else { 9047 callback.apply(_this, args); 9048 } 9049 _throttleTimeout = setTimeout(function() { 9050 _throttleTimeout = void 0; 9051 }, ms); 9052 } 9053 }; 9054 } 9055 function cancelThrottle() { 9056 clearTimeout(_throttleTimeout); 9057 _throttleTimeout = void 0; 9058 } 9059 function scrollBy(el, x, y) { 9060 el.scrollLeft += x; 9061 el.scrollTop += y; 9062 } 9063 function clone2(el) { 9064 var Polymer = window.Polymer; 9065 var $ = window.jQuery || window.Zepto; 9066 if (Polymer && Polymer.dom) { 9067 return Polymer.dom(el).cloneNode(true); 9068 } else if ($) { 9069 return $(el).clone(true)[0]; 9070 } else { 9071 return el.cloneNode(true); 9072 } 9073 } 9074 function getChildContainingRectFromElement(container, options, ghostEl2) { 9075 var rect = {}; 9076 Array.from(container.children).forEach(function(child) { 9077 var _rect$left, _rect$top, _rect$right, _rect$bottom; 9078 if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl2) 9079 return; 9080 var childRect = getRect(child); 9081 rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left); 9082 rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top); 9083 rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right); 9084 rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom); 9085 }); 9086 rect.width = rect.right - rect.left; 9087 rect.height = rect.bottom - rect.top; 9088 rect.x = rect.left; 9089 rect.y = rect.top; 9090 return rect; 9091 } 9092 var expando = "Sortable" + new Date().getTime(); 9093 function AnimationStateManager() { 9094 var animationStates = [], animationCallbackId; 9095 return { 9096 captureAnimationState: function captureAnimationState() { 9097 animationStates = []; 9098 if (!this.options.animation) 9099 return; 9100 var children = [].slice.call(this.el.children); 9101 children.forEach(function(child) { 9102 if (css(child, "display") === "none" || child === Sortable.ghost) 9103 return; 9104 animationStates.push({ 9105 target: child, 9106 rect: getRect(child) 9107 }); 9108 var fromRect = _objectSpread22({}, animationStates[animationStates.length - 1].rect); 9109 if (child.thisAnimationDuration) { 9110 var childMatrix = matrix(child, true); 9111 if (childMatrix) { 9112 fromRect.top -= childMatrix.f; 9113 fromRect.left -= childMatrix.e; 9114 } 9115 } 9116 child.fromRect = fromRect; 9117 }); 9118 }, 9119 addAnimationState: function addAnimationState(state) { 9120 animationStates.push(state); 9121 }, 9122 removeAnimationState: function removeAnimationState(target) { 9123 animationStates.splice(indexOfObject(animationStates, { 9124 target 9125 }), 1); 9126 }, 9127 animateAll: function animateAll(callback) { 9128 var _this = this; 9129 if (!this.options.animation) { 9130 clearTimeout(animationCallbackId); 9131 if (typeof callback === "function") 9132 callback(); 9133 return; 9134 } 9135 var animating = false, animationTime = 0; 9136 animationStates.forEach(function(state) { 9137 var time = 0, target = state.target, fromRect = target.fromRect, toRect = getRect(target), prevFromRect = target.prevFromRect, prevToRect = target.prevToRect, animatingRect = state.rect, targetMatrix = matrix(target, true); 9138 if (targetMatrix) { 9139 toRect.top -= targetMatrix.f; 9140 toRect.left -= targetMatrix.e; 9141 } 9142 target.toRect = toRect; 9143 if (target.thisAnimationDuration) { 9144 if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { 9145 time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); 9146 } 9147 } 9148 if (!isRectEqual(toRect, fromRect)) { 9149 target.prevFromRect = fromRect; 9150 target.prevToRect = toRect; 9151 if (!time) { 9152 time = _this.options.animation; 9153 } 9154 _this.animate(target, animatingRect, toRect, time); 9155 } 9156 if (time) { 9157 animating = true; 9158 animationTime = Math.max(animationTime, time); 9159 clearTimeout(target.animationResetTimer); 9160 target.animationResetTimer = setTimeout(function() { 9161 target.animationTime = 0; 9162 target.prevFromRect = null; 9163 target.fromRect = null; 9164 target.prevToRect = null; 9165 target.thisAnimationDuration = null; 9166 }, time); 9167 target.thisAnimationDuration = time; 9168 } 9169 }); 9170 clearTimeout(animationCallbackId); 9171 if (!animating) { 9172 if (typeof callback === "function") 9173 callback(); 9174 } else { 9175 animationCallbackId = setTimeout(function() { 9176 if (typeof callback === "function") 9177 callback(); 9178 }, animationTime); 9179 } 9180 animationStates = []; 9181 }, 9182 animate: function animate(target, currentRect, toRect, duration) { 9183 if (duration) { 9184 css(target, "transition", ""); 9185 css(target, "transform", ""); 9186 var elMatrix = matrix(this.el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d, translateX = (currentRect.left - toRect.left) / (scaleX || 1), translateY = (currentRect.top - toRect.top) / (scaleY || 1); 9187 target.animatingX = !!translateX; 9188 target.animatingY = !!translateY; 9189 css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)"); 9190 this.forRepaintDummy = repaint(target); 9191 css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : "")); 9192 css(target, "transform", "translate3d(0,0,0)"); 9193 typeof target.animated === "number" && clearTimeout(target.animated); 9194 target.animated = setTimeout(function() { 9195 css(target, "transition", ""); 9196 css(target, "transform", ""); 9197 target.animated = false; 9198 target.animatingX = false; 9199 target.animatingY = false; 9200 }, duration); 9201 } 9202 } 9203 }; 9204 } 9205 function repaint(target) { 9206 return target.offsetWidth; 9207 } 9208 function calculateRealTime(animatingRect, fromRect, toRect, options) { 9209 return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; 9210 } 9211 var plugins = []; 9212 var defaults = { 9213 initializeByDefault: true 9214 }; 9215 var PluginManager = { 9216 mount: function mount(plugin2) { 9217 for (var option2 in defaults) { 9218 if (defaults.hasOwnProperty(option2) && !(option2 in plugin2)) { 9219 plugin2[option2] = defaults[option2]; 9220 } 9221 } 9222 plugins.forEach(function(p) { 9223 if (p.pluginName === plugin2.pluginName) { 9224 throw "Sortable: Cannot mount plugin ".concat(plugin2.pluginName, " more than once"); 9225 } 9226 }); 9227 plugins.push(plugin2); 9228 }, 9229 pluginEvent: function pluginEvent(eventName, sortable, evt) { 9230 var _this = this; 9231 this.eventCanceled = false; 9232 evt.cancel = function() { 9233 _this.eventCanceled = true; 9234 }; 9235 var eventNameGlobal = eventName + "Global"; 9236 plugins.forEach(function(plugin2) { 9237 if (!sortable[plugin2.pluginName]) 9238 return; 9239 if (sortable[plugin2.pluginName][eventNameGlobal]) { 9240 sortable[plugin2.pluginName][eventNameGlobal](_objectSpread22({ 9241 sortable 9242 }, evt)); 9243 } 9244 if (sortable.options[plugin2.pluginName] && sortable[plugin2.pluginName][eventName]) { 9245 sortable[plugin2.pluginName][eventName](_objectSpread22({ 9246 sortable 9247 }, evt)); 9248 } 9249 }); 9250 }, 9251 initializePlugins: function initializePlugins(sortable, el, defaults2, options) { 9252 plugins.forEach(function(plugin2) { 9253 var pluginName = plugin2.pluginName; 9254 if (!sortable.options[pluginName] && !plugin2.initializeByDefault) 9255 return; 9256 var initialized = new plugin2(sortable, el, sortable.options); 9257 initialized.sortable = sortable; 9258 initialized.options = sortable.options; 9259 sortable[pluginName] = initialized; 9260 _extends(defaults2, initialized.defaults); 9261 }); 9262 for (var option2 in sortable.options) { 9263 if (!sortable.options.hasOwnProperty(option2)) 9264 continue; 9265 var modified = this.modifyOption(sortable, option2, sortable.options[option2]); 9266 if (typeof modified !== "undefined") { 9267 sortable.options[option2] = modified; 9268 } 9269 } 9270 }, 9271 getEventProperties: function getEventProperties(name, sortable) { 9272 var eventProperties = {}; 9273 plugins.forEach(function(plugin2) { 9274 if (typeof plugin2.eventProperties !== "function") 9275 return; 9276 _extends(eventProperties, plugin2.eventProperties.call(sortable[plugin2.pluginName], name)); 9277 }); 9278 return eventProperties; 9279 }, 9280 modifyOption: function modifyOption(sortable, name, value) { 9281 var modifiedValue; 9282 plugins.forEach(function(plugin2) { 9283 if (!sortable[plugin2.pluginName]) 9284 return; 9285 if (plugin2.optionListeners && typeof plugin2.optionListeners[name] === "function") { 9286 modifiedValue = plugin2.optionListeners[name].call(sortable[plugin2.pluginName], value); 9287 } 9288 }); 9289 return modifiedValue; 9290 } 9291 }; 9292 function dispatchEvent2(_ref) { 9293 var sortable = _ref.sortable, rootEl2 = _ref.rootEl, name = _ref.name, targetEl = _ref.targetEl, cloneEl2 = _ref.cloneEl, toEl = _ref.toEl, fromEl = _ref.fromEl, oldIndex2 = _ref.oldIndex, newIndex2 = _ref.newIndex, oldDraggableIndex2 = _ref.oldDraggableIndex, newDraggableIndex2 = _ref.newDraggableIndex, originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, extraEventProperties = _ref.extraEventProperties; 9294 sortable = sortable || rootEl2 && rootEl2[expando]; 9295 if (!sortable) 9296 return; 9297 var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1); 9298 if (window.CustomEvent && !IE11OrLess && !Edge) { 9299 evt = new CustomEvent(name, { 9300 bubbles: true, 9301 cancelable: true 9302 }); 9303 } else { 9304 evt = document.createEvent("Event"); 9305 evt.initEvent(name, true, true); 9306 } 9307 evt.to = toEl || rootEl2; 9308 evt.from = fromEl || rootEl2; 9309 evt.item = targetEl || rootEl2; 9310 evt.clone = cloneEl2; 9311 evt.oldIndex = oldIndex2; 9312 evt.newIndex = newIndex2; 9313 evt.oldDraggableIndex = oldDraggableIndex2; 9314 evt.newDraggableIndex = newDraggableIndex2; 9315 evt.originalEvent = originalEvent; 9316 evt.pullMode = putSortable2 ? putSortable2.lastPutMode : void 0; 9317 var allEventProperties = _objectSpread22(_objectSpread22({}, extraEventProperties), PluginManager.getEventProperties(name, sortable)); 9318 for (var option2 in allEventProperties) { 9319 evt[option2] = allEventProperties[option2]; 9320 } 9321 if (rootEl2) { 9322 rootEl2.dispatchEvent(evt); 9323 } 9324 if (options[onName]) { 9325 options[onName].call(sortable, evt); 9326 } 9327 } 9328 var _excluded = ["evt"]; 9329 var pluginEvent2 = function pluginEvent3(eventName, sortable) { 9330 var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data2 = _objectWithoutProperties(_ref, _excluded); 9331 PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread22({ 9332 dragEl, 9333 parentEl, 9334 ghostEl, 9335 rootEl, 9336 nextEl, 9337 lastDownEl, 9338 cloneEl, 9339 cloneHidden, 9340 dragStarted: moved, 9341 putSortable, 9342 activeSortable: Sortable.active, 9343 originalEvent, 9344 oldIndex, 9345 oldDraggableIndex, 9346 newIndex, 9347 newDraggableIndex, 9348 hideGhostForTarget: _hideGhostForTarget, 9349 unhideGhostForTarget: _unhideGhostForTarget, 9350 cloneNowHidden: function cloneNowHidden() { 9351 cloneHidden = true; 9352 }, 9353 cloneNowShown: function cloneNowShown() { 9354 cloneHidden = false; 9355 }, 9356 dispatchSortableEvent: function dispatchSortableEvent(name) { 9357 _dispatchEvent({ 9358 sortable, 9359 name, 9360 originalEvent 9361 }); 9362 } 9363 }, data2)); 9364 }; 9365 function _dispatchEvent(info) { 9366 dispatchEvent2(_objectSpread22({ 9367 putSortable, 9368 cloneEl, 9369 targetEl: dragEl, 9370 rootEl, 9371 oldIndex, 9372 oldDraggableIndex, 9373 newIndex, 9374 newDraggableIndex 9375 }, info)); 9376 } 9377 var dragEl; 9378 var parentEl; 9379 var ghostEl; 9380 var rootEl; 9381 var nextEl; 9382 var lastDownEl; 9383 var cloneEl; 9384 var cloneHidden; 9385 var oldIndex; 9386 var newIndex; 9387 var oldDraggableIndex; 9388 var newDraggableIndex; 9389 var activeGroup; 9390 var putSortable; 9391 var awaitingDragStarted = false; 9392 var ignoreNextClick = false; 9393 var sortables = []; 9394 var tapEvt; 9395 var touchEvt; 9396 var lastDx; 9397 var lastDy; 9398 var tapDistanceLeft; 9399 var tapDistanceTop; 9400 var moved; 9401 var lastTarget; 9402 var lastDirection; 9403 var pastFirstInvertThresh = false; 9404 var isCircumstantialInvert = false; 9405 var targetMoveDistance; 9406 var ghostRelativeParent; 9407 var ghostRelativeParentInitialScroll = []; 9408 var _silent = false; 9409 var savedInputChecked = []; 9410 var documentExists = typeof document !== "undefined"; 9411 var PositionGhostAbsolutely = IOS; 9412 var CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float"; 9413 var supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"); 9414 var supportCssPointerEvents = function() { 9415 if (!documentExists) 9416 return; 9417 if (IE11OrLess) { 9418 return false; 9419 } 9420 var el = document.createElement("x"); 9421 el.style.cssText = "pointer-events:auto"; 9422 return el.style.pointerEvents === "auto"; 9423 }(); 9424 var _detectDirection = function _detectDirection2(el, options) { 9425 var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; 9426 if (elCSS.display === "flex") { 9427 return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal"; 9428 } 9429 if (elCSS.display === "grid") { 9430 return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal"; 9431 } 9432 if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") { 9433 var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right"; 9434 return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal"; 9435 } 9436 return child1 && (firstChildCSS.display === "block" || firstChildCSS.display === "flex" || firstChildCSS.display === "table" || firstChildCSS.display === "grid" || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === "none" || child2 && elCSS[CSSFloatProperty] === "none" && firstChildWidth + secondChildWidth > elWidth) ? "vertical" : "horizontal"; 9437 }; 9438 var _dragElInRowColumn = function _dragElInRowColumn2(dragRect, targetRect, vertical) { 9439 var dragElS1Opp = vertical ? dragRect.left : dragRect.top, dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, dragElOppLength = vertical ? dragRect.width : dragRect.height, targetS1Opp = vertical ? targetRect.left : targetRect.top, targetS2Opp = vertical ? targetRect.right : targetRect.bottom, targetOppLength = vertical ? targetRect.width : targetRect.height; 9440 return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; 9441 }; 9442 var _detectNearestEmptySortable = function _detectNearestEmptySortable2(x, y) { 9443 var ret; 9444 sortables.some(function(sortable) { 9445 var threshold = sortable[expando].options.emptyInsertThreshold; 9446 if (!threshold || lastChild(sortable)) 9447 return; 9448 var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; 9449 if (insideHorizontally && insideVertically) { 9450 return ret = sortable; 9451 } 9452 }); 9453 return ret; 9454 }; 9455 var _prepareGroup = function _prepareGroup2(options) { 9456 function toFn(value, pull) { 9457 return function(to, from, dragEl2, evt) { 9458 var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; 9459 if (value == null && (pull || sameGroup)) { 9460 return true; 9461 } else if (value == null || value === false) { 9462 return false; 9463 } else if (pull && value === "clone") { 9464 return value; 9465 } else if (typeof value === "function") { 9466 return toFn(value(to, from, dragEl2, evt), pull)(to, from, dragEl2, evt); 9467 } else { 9468 var otherGroup = (pull ? to : from).options.group.name; 9469 return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; 9470 } 9471 }; 9472 } 9473 var group = {}; 9474 var originalGroup = options.group; 9475 if (!originalGroup || _typeof(originalGroup) != "object") { 9476 originalGroup = { 9477 name: originalGroup 9478 }; 9479 } 9480 group.name = originalGroup.name; 9481 group.checkPull = toFn(originalGroup.pull, true); 9482 group.checkPut = toFn(originalGroup.put); 9483 group.revertClone = originalGroup.revertClone; 9484 options.group = group; 9485 }; 9486 var _hideGhostForTarget = function _hideGhostForTarget2() { 9487 if (!supportCssPointerEvents && ghostEl) { 9488 css(ghostEl, "display", "none"); 9489 } 9490 }; 9491 var _unhideGhostForTarget = function _unhideGhostForTarget2() { 9492 if (!supportCssPointerEvents && ghostEl) { 9493 css(ghostEl, "display", ""); 9494 } 9495 }; 9496 if (documentExists && !ChromeForAndroid) { 9497 document.addEventListener("click", function(evt) { 9498 if (ignoreNextClick) { 9499 evt.preventDefault(); 9500 evt.stopPropagation && evt.stopPropagation(); 9501 evt.stopImmediatePropagation && evt.stopImmediatePropagation(); 9502 ignoreNextClick = false; 9503 return false; 9504 } 9505 }, true); 9506 } 9507 var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt) { 9508 if (dragEl) { 9509 evt = evt.touches ? evt.touches[0] : evt; 9510 var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); 9511 if (nearest) { 9512 var event = {}; 9513 for (var i in evt) { 9514 if (evt.hasOwnProperty(i)) { 9515 event[i] = evt[i]; 9516 } 9517 } 9518 event.target = event.rootEl = nearest; 9519 event.preventDefault = void 0; 9520 event.stopPropagation = void 0; 9521 nearest[expando]._onDragOver(event); 9522 } 9523 } 9524 }; 9525 var _checkOutsideTargetEl = function _checkOutsideTargetEl2(evt) { 9526 if (dragEl) { 9527 dragEl.parentNode[expando]._isOutsideThisEl(evt.target); 9528 } 9529 }; 9530 function Sortable(el, options) { 9531 if (!(el && el.nodeType && el.nodeType === 1)) { 9532 throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); 9533 } 9534 this.el = el; 9535 this.options = options = _extends({}, options); 9536 el[expando] = this; 9537 var defaults2 = { 9538 group: null, 9539 sort: true, 9540 disabled: false, 9541 store: null, 9542 handle: null, 9543 draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*", 9544 swapThreshold: 1, 9545 invertSwap: false, 9546 invertedSwapThreshold: null, 9547 removeCloneOnHide: true, 9548 direction: function direction() { 9549 return _detectDirection(el, this.options); 9550 }, 9551 ghostClass: "sortable-ghost", 9552 chosenClass: "sortable-chosen", 9553 dragClass: "sortable-drag", 9554 ignore: "a, img", 9555 filter: null, 9556 preventOnFilter: true, 9557 animation: 0, 9558 easing: null, 9559 setData: function setData(dataTransfer, dragEl2) { 9560 dataTransfer.setData("Text", dragEl2.textContent); 9561 }, 9562 dropBubble: false, 9563 dragoverBubble: false, 9564 dataIdAttr: "data-id", 9565 delay: 0, 9566 delayOnTouchOnly: false, 9567 touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, 9568 forceFallback: false, 9569 fallbackClass: "sortable-fallback", 9570 fallbackOnBody: false, 9571 fallbackTolerance: 0, 9572 fallbackOffset: { 9573 x: 0, 9574 y: 0 9575 }, 9576 supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && !Safari, 9577 emptyInsertThreshold: 5 9578 }; 9579 PluginManager.initializePlugins(this, el, defaults2); 9580 for (var name in defaults2) { 9581 !(name in options) && (options[name] = defaults2[name]); 9582 } 9583 _prepareGroup(options); 9584 for (var fn in this) { 9585 if (fn.charAt(0) === "_" && typeof this[fn] === "function") { 9586 this[fn] = this[fn].bind(this); 9587 } 9588 } 9589 this.nativeDraggable = options.forceFallback ? false : supportDraggable; 9590 if (this.nativeDraggable) { 9591 this.options.touchStartThreshold = 1; 9592 } 9593 if (options.supportPointer) { 9594 on4(el, "pointerdown", this._onTapStart); 9595 } else { 9596 on4(el, "mousedown", this._onTapStart); 9597 on4(el, "touchstart", this._onTapStart); 9598 } 9599 if (this.nativeDraggable) { 9600 on4(el, "dragover", this); 9601 on4(el, "dragenter", this); 9602 } 9603 sortables.push(this.el); 9604 options.store && options.store.get && this.sort(options.store.get(this) || []); 9605 _extends(this, AnimationStateManager()); 9606 } 9607 Sortable.prototype = { 9608 constructor: Sortable, 9609 _isOutsideThisEl: function _isOutsideThisEl(target) { 9610 if (!this.el.contains(target) && target !== this.el) { 9611 lastTarget = null; 9612 } 9613 }, 9614 _getDirection: function _getDirection(evt, target) { 9615 return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; 9616 }, 9617 _onTapStart: function _onTapStart(evt) { 9618 if (!evt.cancelable) 9619 return; 9620 var _this = this, el = this.el, options = this.options, preventOnFilter = options.preventOnFilter, type = evt.type, touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === "touch" && evt, target = (touch || evt).target, originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, filter = options.filter; 9621 _saveInputCheckedState(el); 9622 if (dragEl) { 9623 return; 9624 } 9625 if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { 9626 return; 9627 } 9628 if (originalTarget.isContentEditable) { 9629 return; 9630 } 9631 if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") { 9632 return; 9633 } 9634 target = closest(target, options.draggable, el, false); 9635 if (target && target.animated) { 9636 return; 9637 } 9638 if (lastDownEl === target) { 9639 return; 9640 } 9641 oldIndex = index(target); 9642 oldDraggableIndex = index(target, options.draggable); 9643 if (typeof filter === "function") { 9644 if (filter.call(this, evt, target, this)) { 9645 _dispatchEvent({ 9646 sortable: _this, 9647 rootEl: originalTarget, 9648 name: "filter", 9649 targetEl: target, 9650 toEl: el, 9651 fromEl: el 9652 }); 9653 pluginEvent2("filter", _this, { 9654 evt 9655 }); 9656 preventOnFilter && evt.cancelable && evt.preventDefault(); 9657 return; 9658 } 9659 } else if (filter) { 9660 filter = filter.split(",").some(function(criteria) { 9661 criteria = closest(originalTarget, criteria.trim(), el, false); 9662 if (criteria) { 9663 _dispatchEvent({ 9664 sortable: _this, 9665 rootEl: criteria, 9666 name: "filter", 9667 targetEl: target, 9668 fromEl: el, 9669 toEl: el 9670 }); 9671 pluginEvent2("filter", _this, { 9672 evt 9673 }); 9674 return true; 9675 } 9676 }); 9677 if (filter) { 9678 preventOnFilter && evt.cancelable && evt.preventDefault(); 9679 return; 9680 } 9681 } 9682 if (options.handle && !closest(originalTarget, options.handle, el, false)) { 9683 return; 9684 } 9685 this._prepareDragStart(evt, touch, target); 9686 }, 9687 _prepareDragStart: function _prepareDragStart(evt, touch, target) { 9688 var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn; 9689 if (target && !dragEl && target.parentNode === el) { 9690 var dragRect = getRect(target); 9691 rootEl = el; 9692 dragEl = target; 9693 parentEl = dragEl.parentNode; 9694 nextEl = dragEl.nextSibling; 9695 lastDownEl = target; 9696 activeGroup = options.group; 9697 Sortable.dragged = dragEl; 9698 tapEvt = { 9699 target: dragEl, 9700 clientX: (touch || evt).clientX, 9701 clientY: (touch || evt).clientY 9702 }; 9703 tapDistanceLeft = tapEvt.clientX - dragRect.left; 9704 tapDistanceTop = tapEvt.clientY - dragRect.top; 9705 this._lastX = (touch || evt).clientX; 9706 this._lastY = (touch || evt).clientY; 9707 dragEl.style["will-change"] = "all"; 9708 dragStartFn = function dragStartFn2() { 9709 pluginEvent2("delayEnded", _this, { 9710 evt 9711 }); 9712 if (Sortable.eventCanceled) { 9713 _this._onDrop(); 9714 return; 9715 } 9716 _this._disableDelayedDragEvents(); 9717 if (!FireFox && _this.nativeDraggable) { 9718 dragEl.draggable = true; 9719 } 9720 _this._triggerDragStart(evt, touch); 9721 _dispatchEvent({ 9722 sortable: _this, 9723 name: "choose", 9724 originalEvent: evt 9725 }); 9726 toggleClass(dragEl, options.chosenClass, true); 9727 }; 9728 options.ignore.split(",").forEach(function(criteria) { 9729 find2(dragEl, criteria.trim(), _disableDraggable); 9730 }); 9731 on4(ownerDocument, "dragover", nearestEmptyInsertDetectEvent); 9732 on4(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent); 9733 on4(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent); 9734 on4(ownerDocument, "mouseup", _this._onDrop); 9735 on4(ownerDocument, "touchend", _this._onDrop); 9736 on4(ownerDocument, "touchcancel", _this._onDrop); 9737 if (FireFox && this.nativeDraggable) { 9738 this.options.touchStartThreshold = 4; 9739 dragEl.draggable = true; 9740 } 9741 pluginEvent2("delayStart", this, { 9742 evt 9743 }); 9744 if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { 9745 if (Sortable.eventCanceled) { 9746 this._onDrop(); 9747 return; 9748 } 9749 on4(ownerDocument, "mouseup", _this._disableDelayedDrag); 9750 on4(ownerDocument, "touchend", _this._disableDelayedDrag); 9751 on4(ownerDocument, "touchcancel", _this._disableDelayedDrag); 9752 on4(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler); 9753 on4(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler); 9754 options.supportPointer && on4(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler); 9755 _this._dragStartTimer = setTimeout(dragStartFn, options.delay); 9756 } else { 9757 dragStartFn(); 9758 } 9759 } 9760 }, 9761 _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) { 9762 var touch = e.touches ? e.touches[0] : e; 9763 if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { 9764 this._disableDelayedDrag(); 9765 } 9766 }, 9767 _disableDelayedDrag: function _disableDelayedDrag() { 9768 dragEl && _disableDraggable(dragEl); 9769 clearTimeout(this._dragStartTimer); 9770 this._disableDelayedDragEvents(); 9771 }, 9772 _disableDelayedDragEvents: function _disableDelayedDragEvents() { 9773 var ownerDocument = this.el.ownerDocument; 9774 off(ownerDocument, "mouseup", this._disableDelayedDrag); 9775 off(ownerDocument, "touchend", this._disableDelayedDrag); 9776 off(ownerDocument, "touchcancel", this._disableDelayedDrag); 9777 off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler); 9778 off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler); 9779 off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler); 9780 }, 9781 _triggerDragStart: function _triggerDragStart(evt, touch) { 9782 touch = touch || evt.pointerType == "touch" && evt; 9783 if (!this.nativeDraggable || touch) { 9784 if (this.options.supportPointer) { 9785 on4(document, "pointermove", this._onTouchMove); 9786 } else if (touch) { 9787 on4(document, "touchmove", this._onTouchMove); 9788 } else { 9789 on4(document, "mousemove", this._onTouchMove); 9790 } 9791 } else { 9792 on4(dragEl, "dragend", this); 9793 on4(rootEl, "dragstart", this._onDragStart); 9794 } 9795 try { 9796 if (document.selection) { 9797 _nextTick(function() { 9798 document.selection.empty(); 9799 }); 9800 } else { 9801 window.getSelection().removeAllRanges(); 9802 } 9803 } catch (err) { 9804 } 9805 }, 9806 _dragStarted: function _dragStarted(fallback2, evt) { 9807 awaitingDragStarted = false; 9808 if (rootEl && dragEl) { 9809 pluginEvent2("dragStarted", this, { 9810 evt 9811 }); 9812 if (this.nativeDraggable) { 9813 on4(document, "dragover", _checkOutsideTargetEl); 9814 } 9815 var options = this.options; 9816 !fallback2 && toggleClass(dragEl, options.dragClass, false); 9817 toggleClass(dragEl, options.ghostClass, true); 9818 Sortable.active = this; 9819 fallback2 && this._appendGhost(); 9820 _dispatchEvent({ 9821 sortable: this, 9822 name: "start", 9823 originalEvent: evt 9824 }); 9825 } else { 9826 this._nulling(); 9827 } 9828 }, 9829 _emulateDragOver: function _emulateDragOver() { 9830 if (touchEvt) { 9831 this._lastX = touchEvt.clientX; 9832 this._lastY = touchEvt.clientY; 9833 _hideGhostForTarget(); 9834 var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); 9835 var parent = target; 9836 while (target && target.shadowRoot) { 9837 target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); 9838 if (target === parent) 9839 break; 9840 parent = target; 9841 } 9842 dragEl.parentNode[expando]._isOutsideThisEl(target); 9843 if (parent) { 9844 do { 9845 if (parent[expando]) { 9846 var inserted = void 0; 9847 inserted = parent[expando]._onDragOver({ 9848 clientX: touchEvt.clientX, 9849 clientY: touchEvt.clientY, 9850 target, 9851 rootEl: parent 9852 }); 9853 if (inserted && !this.options.dragoverBubble) { 9854 break; 9855 } 9856 } 9857 target = parent; 9858 } while (parent = parent.parentNode); 9859 } 9860 _unhideGhostForTarget(); 9861 } 9862 }, 9863 _onTouchMove: function _onTouchMove(evt) { 9864 if (tapEvt) { 9865 var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, ghostMatrix = ghostEl && matrix(ghostEl, true), scaleX = ghostEl && ghostMatrix && ghostMatrix.a, scaleY = ghostEl && ghostMatrix && ghostMatrix.d, relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); 9866 if (!Sortable.active && !awaitingDragStarted) { 9867 if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { 9868 return; 9869 } 9870 this._onDragStart(evt, true); 9871 } 9872 if (ghostEl) { 9873 if (ghostMatrix) { 9874 ghostMatrix.e += dx - (lastDx || 0); 9875 ghostMatrix.f += dy - (lastDy || 0); 9876 } else { 9877 ghostMatrix = { 9878 a: 1, 9879 b: 0, 9880 c: 0, 9881 d: 1, 9882 e: dx, 9883 f: dy 9884 }; 9885 } 9886 var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); 9887 css(ghostEl, "webkitTransform", cssMatrix); 9888 css(ghostEl, "mozTransform", cssMatrix); 9889 css(ghostEl, "msTransform", cssMatrix); 9890 css(ghostEl, "transform", cssMatrix); 9891 lastDx = dx; 9892 lastDy = dy; 9893 touchEvt = touch; 9894 } 9895 evt.cancelable && evt.preventDefault(); 9896 } 9897 }, 9898 _appendGhost: function _appendGhost() { 9899 if (!ghostEl) { 9900 var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options; 9901 if (PositionGhostAbsolutely) { 9902 ghostRelativeParent = container; 9903 while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) { 9904 ghostRelativeParent = ghostRelativeParent.parentNode; 9905 } 9906 if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { 9907 if (ghostRelativeParent === document) 9908 ghostRelativeParent = getWindowScrollingElement(); 9909 rect.top += ghostRelativeParent.scrollTop; 9910 rect.left += ghostRelativeParent.scrollLeft; 9911 } else { 9912 ghostRelativeParent = getWindowScrollingElement(); 9913 } 9914 ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); 9915 } 9916 ghostEl = dragEl.cloneNode(true); 9917 toggleClass(ghostEl, options.ghostClass, false); 9918 toggleClass(ghostEl, options.fallbackClass, true); 9919 toggleClass(ghostEl, options.dragClass, true); 9920 css(ghostEl, "transition", ""); 9921 css(ghostEl, "transform", ""); 9922 css(ghostEl, "box-sizing", "border-box"); 9923 css(ghostEl, "margin", 0); 9924 css(ghostEl, "top", rect.top); 9925 css(ghostEl, "left", rect.left); 9926 css(ghostEl, "width", rect.width); 9927 css(ghostEl, "height", rect.height); 9928 css(ghostEl, "opacity", "0.8"); 9929 css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed"); 9930 css(ghostEl, "zIndex", "100000"); 9931 css(ghostEl, "pointerEvents", "none"); 9932 Sortable.ghost = ghostEl; 9933 container.appendChild(ghostEl); 9934 css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%"); 9935 } 9936 }, 9937 _onDragStart: function _onDragStart(evt, fallback2) { 9938 var _this = this; 9939 var dataTransfer = evt.dataTransfer; 9940 var options = _this.options; 9941 pluginEvent2("dragStart", this, { 9942 evt 9943 }); 9944 if (Sortable.eventCanceled) { 9945 this._onDrop(); 9946 return; 9947 } 9948 pluginEvent2("setupClone", this); 9949 if (!Sortable.eventCanceled) { 9950 cloneEl = clone2(dragEl); 9951 cloneEl.removeAttribute("id"); 9952 cloneEl.draggable = false; 9953 cloneEl.style["will-change"] = ""; 9954 this._hideClone(); 9955 toggleClass(cloneEl, this.options.chosenClass, false); 9956 Sortable.clone = cloneEl; 9957 } 9958 _this.cloneId = _nextTick(function() { 9959 pluginEvent2("clone", _this); 9960 if (Sortable.eventCanceled) 9961 return; 9962 if (!_this.options.removeCloneOnHide) { 9963 rootEl.insertBefore(cloneEl, dragEl); 9964 } 9965 _this._hideClone(); 9966 _dispatchEvent({ 9967 sortable: _this, 9968 name: "clone" 9969 }); 9970 }); 9971 !fallback2 && toggleClass(dragEl, options.dragClass, true); 9972 if (fallback2) { 9973 ignoreNextClick = true; 9974 _this._loopId = setInterval(_this._emulateDragOver, 50); 9975 } else { 9976 off(document, "mouseup", _this._onDrop); 9977 off(document, "touchend", _this._onDrop); 9978 off(document, "touchcancel", _this._onDrop); 9979 if (dataTransfer) { 9980 dataTransfer.effectAllowed = "move"; 9981 options.setData && options.setData.call(_this, dataTransfer, dragEl); 9982 } 9983 on4(document, "drop", _this); 9984 css(dragEl, "transform", "translateZ(0)"); 9985 } 9986 awaitingDragStarted = true; 9987 _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback2, evt)); 9988 on4(document, "selectstart", _this); 9989 moved = true; 9990 if (Safari) { 9991 css(document.body, "user-select", "none"); 9992 } 9993 }, 9994 _onDragOver: function _onDragOver(evt) { 9995 var el = this.el, target = evt.target, dragRect, targetRect, revert, options = this.options, group = options.group, activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, vertical, _this = this, completedFired = false; 9996 if (_silent) 9997 return; 9998 function dragOverEvent(name, extra) { 9999 pluginEvent2(name, _this, _objectSpread22({ 10000 evt, 10001 isOwner, 10002 axis: vertical ? "vertical" : "horizontal", 10003 revert, 10004 dragRect, 10005 targetRect, 10006 canSort, 10007 fromSortable, 10008 target, 10009 completed, 10010 onMove: function onMove(target2, after2) { 10011 return _onMove(rootEl, el, dragEl, dragRect, target2, getRect(target2), evt, after2); 10012 }, 10013 changed 10014 }, extra)); 10015 } 10016 function capture() { 10017 dragOverEvent("dragOverAnimationCapture"); 10018 _this.captureAnimationState(); 10019 if (_this !== fromSortable) { 10020 fromSortable.captureAnimationState(); 10021 } 10022 } 10023 function completed(insertion) { 10024 dragOverEvent("dragOverCompleted", { 10025 insertion 10026 }); 10027 if (insertion) { 10028 if (isOwner) { 10029 activeSortable._hideClone(); 10030 } else { 10031 activeSortable._showClone(_this); 10032 } 10033 if (_this !== fromSortable) { 10034 toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); 10035 toggleClass(dragEl, options.ghostClass, true); 10036 } 10037 if (putSortable !== _this && _this !== Sortable.active) { 10038 putSortable = _this; 10039 } else if (_this === Sortable.active && putSortable) { 10040 putSortable = null; 10041 } 10042 if (fromSortable === _this) { 10043 _this._ignoreWhileAnimating = target; 10044 } 10045 _this.animateAll(function() { 10046 dragOverEvent("dragOverAnimationComplete"); 10047 _this._ignoreWhileAnimating = null; 10048 }); 10049 if (_this !== fromSortable) { 10050 fromSortable.animateAll(); 10051 fromSortable._ignoreWhileAnimating = null; 10052 } 10053 } 10054 if (target === dragEl && !dragEl.animated || target === el && !target.animated) { 10055 lastTarget = null; 10056 } 10057 if (!options.dragoverBubble && !evt.rootEl && target !== document) { 10058 dragEl.parentNode[expando]._isOutsideThisEl(evt.target); 10059 !insertion && nearestEmptyInsertDetectEvent(evt); 10060 } 10061 !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); 10062 return completedFired = true; 10063 } 10064 function changed() { 10065 newIndex = index(dragEl); 10066 newDraggableIndex = index(dragEl, options.draggable); 10067 _dispatchEvent({ 10068 sortable: _this, 10069 name: "change", 10070 toEl: el, 10071 newIndex, 10072 newDraggableIndex, 10073 originalEvent: evt 10074 }); 10075 } 10076 if (evt.preventDefault !== void 0) { 10077 evt.cancelable && evt.preventDefault(); 10078 } 10079 target = closest(target, options.draggable, el, true); 10080 dragOverEvent("dragOver"); 10081 if (Sortable.eventCanceled) 10082 return completedFired; 10083 if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { 10084 return completed(false); 10085 } 10086 ignoreNextClick = false; 10087 if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { 10088 vertical = this._getDirection(evt, target) === "vertical"; 10089 dragRect = getRect(dragEl); 10090 dragOverEvent("dragOverValid"); 10091 if (Sortable.eventCanceled) 10092 return completedFired; 10093 if (revert) { 10094 parentEl = rootEl; 10095 capture(); 10096 this._hideClone(); 10097 dragOverEvent("revert"); 10098 if (!Sortable.eventCanceled) { 10099 if (nextEl) { 10100 rootEl.insertBefore(dragEl, nextEl); 10101 } else { 10102 rootEl.appendChild(dragEl); 10103 } 10104 } 10105 return completed(true); 10106 } 10107 var elLastChild = lastChild(el, options.draggable); 10108 if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { 10109 if (elLastChild === dragEl) { 10110 return completed(false); 10111 } 10112 if (elLastChild && el === evt.target) { 10113 target = elLastChild; 10114 } 10115 if (target) { 10116 targetRect = getRect(target); 10117 } 10118 if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { 10119 capture(); 10120 if (elLastChild && elLastChild.nextSibling) { 10121 el.insertBefore(dragEl, elLastChild.nextSibling); 10122 } else { 10123 el.appendChild(dragEl); 10124 } 10125 parentEl = el; 10126 changed(); 10127 return completed(true); 10128 } 10129 } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) { 10130 var firstChild = getChild(el, 0, options, true); 10131 if (firstChild === dragEl) { 10132 return completed(false); 10133 } 10134 target = firstChild; 10135 targetRect = getRect(target); 10136 if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) { 10137 capture(); 10138 el.insertBefore(dragEl, firstChild); 10139 parentEl = el; 10140 changed(); 10141 return completed(true); 10142 } 10143 } else if (target.parentNode === el) { 10144 targetRect = getRect(target); 10145 var direction = 0, targetBeforeFirstSwap, differentLevel = dragEl.parentNode !== el, differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), side1 = vertical ? "top" : "left", scrolledPastTop = isScrolledPast(target, "top", "top") || isScrolledPast(dragEl, "top", "top"), scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; 10146 if (lastTarget !== target) { 10147 targetBeforeFirstSwap = targetRect[side1]; 10148 pastFirstInvertThresh = false; 10149 isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; 10150 } 10151 direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); 10152 var sibling; 10153 if (direction !== 0) { 10154 var dragIndex = index(dragEl); 10155 do { 10156 dragIndex -= direction; 10157 sibling = parentEl.children[dragIndex]; 10158 } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl)); 10159 } 10160 if (direction === 0 || sibling === target) { 10161 return completed(false); 10162 } 10163 lastTarget = target; 10164 lastDirection = direction; 10165 var nextSibling = target.nextElementSibling, after = false; 10166 after = direction === 1; 10167 var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); 10168 if (moveVector !== false) { 10169 if (moveVector === 1 || moveVector === -1) { 10170 after = moveVector === 1; 10171 } 10172 _silent = true; 10173 setTimeout(_unsilent, 30); 10174 capture(); 10175 if (after && !nextSibling) { 10176 el.appendChild(dragEl); 10177 } else { 10178 target.parentNode.insertBefore(dragEl, after ? nextSibling : target); 10179 } 10180 if (scrolledPastTop) { 10181 scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); 10182 } 10183 parentEl = dragEl.parentNode; 10184 if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) { 10185 targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); 10186 } 10187 changed(); 10188 return completed(true); 10189 } 10190 } 10191 if (el.contains(dragEl)) { 10192 return completed(false); 10193 } 10194 } 10195 return false; 10196 }, 10197 _ignoreWhileAnimating: null, 10198 _offMoveEvents: function _offMoveEvents() { 10199 off(document, "mousemove", this._onTouchMove); 10200 off(document, "touchmove", this._onTouchMove); 10201 off(document, "pointermove", this._onTouchMove); 10202 off(document, "dragover", nearestEmptyInsertDetectEvent); 10203 off(document, "mousemove", nearestEmptyInsertDetectEvent); 10204 off(document, "touchmove", nearestEmptyInsertDetectEvent); 10205 }, 10206 _offUpEvents: function _offUpEvents() { 10207 var ownerDocument = this.el.ownerDocument; 10208 off(ownerDocument, "mouseup", this._onDrop); 10209 off(ownerDocument, "touchend", this._onDrop); 10210 off(ownerDocument, "pointerup", this._onDrop); 10211 off(ownerDocument, "touchcancel", this._onDrop); 10212 off(document, "selectstart", this); 10213 }, 10214 _onDrop: function _onDrop(evt) { 10215 var el = this.el, options = this.options; 10216 newIndex = index(dragEl); 10217 newDraggableIndex = index(dragEl, options.draggable); 10218 pluginEvent2("drop", this, { 10219 evt 10220 }); 10221 parentEl = dragEl && dragEl.parentNode; 10222 newIndex = index(dragEl); 10223 newDraggableIndex = index(dragEl, options.draggable); 10224 if (Sortable.eventCanceled) { 10225 this._nulling(); 10226 return; 10227 } 10228 awaitingDragStarted = false; 10229 isCircumstantialInvert = false; 10230 pastFirstInvertThresh = false; 10231 clearInterval(this._loopId); 10232 clearTimeout(this._dragStartTimer); 10233 _cancelNextTick(this.cloneId); 10234 _cancelNextTick(this._dragStartId); 10235 if (this.nativeDraggable) { 10236 off(document, "drop", this); 10237 off(el, "dragstart", this._onDragStart); 10238 } 10239 this._offMoveEvents(); 10240 this._offUpEvents(); 10241 if (Safari) { 10242 css(document.body, "user-select", ""); 10243 } 10244 css(dragEl, "transform", ""); 10245 if (evt) { 10246 if (moved) { 10247 evt.cancelable && evt.preventDefault(); 10248 !options.dropBubble && evt.stopPropagation(); 10249 } 10250 ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); 10251 if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") { 10252 cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); 10253 } 10254 if (dragEl) { 10255 if (this.nativeDraggable) { 10256 off(dragEl, "dragend", this); 10257 } 10258 _disableDraggable(dragEl); 10259 dragEl.style["will-change"] = ""; 10260 if (moved && !awaitingDragStarted) { 10261 toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); 10262 } 10263 toggleClass(dragEl, this.options.chosenClass, false); 10264 _dispatchEvent({ 10265 sortable: this, 10266 name: "unchoose", 10267 toEl: parentEl, 10268 newIndex: null, 10269 newDraggableIndex: null, 10270 originalEvent: evt 10271 }); 10272 if (rootEl !== parentEl) { 10273 if (newIndex >= 0) { 10274 _dispatchEvent({ 10275 rootEl: parentEl, 10276 name: "add", 10277 toEl: parentEl, 10278 fromEl: rootEl, 10279 originalEvent: evt 10280 }); 10281 _dispatchEvent({ 10282 sortable: this, 10283 name: "remove", 10284 toEl: parentEl, 10285 originalEvent: evt 10286 }); 10287 _dispatchEvent({ 10288 rootEl: parentEl, 10289 name: "sort", 10290 toEl: parentEl, 10291 fromEl: rootEl, 10292 originalEvent: evt 10293 }); 10294 _dispatchEvent({ 10295 sortable: this, 10296 name: "sort", 10297 toEl: parentEl, 10298 originalEvent: evt 10299 }); 10300 } 10301 putSortable && putSortable.save(); 10302 } else { 10303 if (newIndex !== oldIndex) { 10304 if (newIndex >= 0) { 10305 _dispatchEvent({ 10306 sortable: this, 10307 name: "update", 10308 toEl: parentEl, 10309 originalEvent: evt 10310 }); 10311 _dispatchEvent({ 10312 sortable: this, 10313 name: "sort", 10314 toEl: parentEl, 10315 originalEvent: evt 10316 }); 10317 } 10318 } 10319 } 10320 if (Sortable.active) { 10321 if (newIndex == null || newIndex === -1) { 10322 newIndex = oldIndex; 10323 newDraggableIndex = oldDraggableIndex; 10324 } 10325 _dispatchEvent({ 10326 sortable: this, 10327 name: "end", 10328 toEl: parentEl, 10329 originalEvent: evt 10330 }); 10331 this.save(); 10332 } 10333 } 10334 } 10335 this._nulling(); 10336 }, 10337 _nulling: function _nulling() { 10338 pluginEvent2("nulling", this); 10339 rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; 10340 savedInputChecked.forEach(function(el) { 10341 el.checked = true; 10342 }); 10343 savedInputChecked.length = lastDx = lastDy = 0; 10344 }, 10345 handleEvent: function handleEvent(evt) { 10346 switch (evt.type) { 10347 case "drop": 10348 case "dragend": 10349 this._onDrop(evt); 10350 break; 10351 case "dragenter": 10352 case "dragover": 10353 if (dragEl) { 10354 this._onDragOver(evt); 10355 _globalDragOver(evt); 10356 } 10357 break; 10358 case "selectstart": 10359 evt.preventDefault(); 10360 break; 10361 } 10362 }, 10363 toArray: function toArray() { 10364 var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options; 10365 for (; i < n; i++) { 10366 el = children[i]; 10367 if (closest(el, options.draggable, this.el, false)) { 10368 order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); 10369 } 10370 } 10371 return order; 10372 }, 10373 sort: function sort(order, useAnimation) { 10374 var items = {}, rootEl2 = this.el; 10375 this.toArray().forEach(function(id, i) { 10376 var el = rootEl2.children[i]; 10377 if (closest(el, this.options.draggable, rootEl2, false)) { 10378 items[id] = el; 10379 } 10380 }, this); 10381 useAnimation && this.captureAnimationState(); 10382 order.forEach(function(id) { 10383 if (items[id]) { 10384 rootEl2.removeChild(items[id]); 10385 rootEl2.appendChild(items[id]); 10386 } 10387 }); 10388 useAnimation && this.animateAll(); 10389 }, 10390 save: function save() { 10391 var store2 = this.options.store; 10392 store2 && store2.set && store2.set(this); 10393 }, 10394 closest: function closest$1(el, selector) { 10395 return closest(el, selector || this.options.draggable, this.el, false); 10396 }, 10397 option: function option(name, value) { 10398 var options = this.options; 10399 if (value === void 0) { 10400 return options[name]; 10401 } else { 10402 var modifiedValue = PluginManager.modifyOption(this, name, value); 10403 if (typeof modifiedValue !== "undefined") { 10404 options[name] = modifiedValue; 10405 } else { 10406 options[name] = value; 10407 } 10408 if (name === "group") { 10409 _prepareGroup(options); 10410 } 10411 } 10412 }, 10413 destroy: function destroy() { 10414 pluginEvent2("destroy", this); 10415 var el = this.el; 10416 el[expando] = null; 10417 off(el, "mousedown", this._onTapStart); 10418 off(el, "touchstart", this._onTapStart); 10419 off(el, "pointerdown", this._onTapStart); 10420 if (this.nativeDraggable) { 10421 off(el, "dragover", this); 10422 off(el, "dragenter", this); 10423 } 10424 Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el2) { 10425 el2.removeAttribute("draggable"); 10426 }); 10427 this._onDrop(); 10428 this._disableDelayedDragEvents(); 10429 sortables.splice(sortables.indexOf(this.el), 1); 10430 this.el = el = null; 10431 }, 10432 _hideClone: function _hideClone() { 10433 if (!cloneHidden) { 10434 pluginEvent2("hideClone", this); 10435 if (Sortable.eventCanceled) 10436 return; 10437 css(cloneEl, "display", "none"); 10438 if (this.options.removeCloneOnHide && cloneEl.parentNode) { 10439 cloneEl.parentNode.removeChild(cloneEl); 10440 } 10441 cloneHidden = true; 10442 } 10443 }, 10444 _showClone: function _showClone(putSortable2) { 10445 if (putSortable2.lastPutMode !== "clone") { 10446 this._hideClone(); 10447 return; 10448 } 10449 if (cloneHidden) { 10450 pluginEvent2("showClone", this); 10451 if (Sortable.eventCanceled) 10452 return; 10453 if (dragEl.parentNode == rootEl && !this.options.group.revertClone) { 10454 rootEl.insertBefore(cloneEl, dragEl); 10455 } else if (nextEl) { 10456 rootEl.insertBefore(cloneEl, nextEl); 10457 } else { 10458 rootEl.appendChild(cloneEl); 10459 } 10460 if (this.options.group.revertClone) { 10461 this.animate(dragEl, cloneEl); 10462 } 10463 css(cloneEl, "display", ""); 10464 cloneHidden = false; 10465 } 10466 } 10467 }; 10468 function _globalDragOver(evt) { 10469 if (evt.dataTransfer) { 10470 evt.dataTransfer.dropEffect = "move"; 10471 } 10472 evt.cancelable && evt.preventDefault(); 10473 } 10474 function _onMove(fromEl, toEl, dragEl2, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { 10475 var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal; 10476 if (window.CustomEvent && !IE11OrLess && !Edge) { 10477 evt = new CustomEvent("move", { 10478 bubbles: true, 10479 cancelable: true 10480 }); 10481 } else { 10482 evt = document.createEvent("Event"); 10483 evt.initEvent("move", true, true); 10484 } 10485 evt.to = toEl; 10486 evt.from = fromEl; 10487 evt.dragged = dragEl2; 10488 evt.draggedRect = dragRect; 10489 evt.related = targetEl || toEl; 10490 evt.relatedRect = targetRect || getRect(toEl); 10491 evt.willInsertAfter = willInsertAfter; 10492 evt.originalEvent = originalEvent; 10493 fromEl.dispatchEvent(evt); 10494 if (onMoveFn) { 10495 retVal = onMoveFn.call(sortable, evt, originalEvent); 10496 } 10497 return retVal; 10498 } 10499 function _disableDraggable(el) { 10500 el.draggable = false; 10501 } 10502 function _unsilent() { 10503 _silent = false; 10504 } 10505 function _ghostIsFirst(evt, vertical, sortable) { 10506 var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true)); 10507 var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl); 10508 var spacer = 10; 10509 return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left; 10510 } 10511 function _ghostIsLast(evt, vertical, sortable) { 10512 var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable)); 10513 var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl); 10514 var spacer = 10; 10515 return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top; 10516 } 10517 function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { 10518 var mouseOnAxis = vertical ? evt.clientY : evt.clientX, targetLength = vertical ? targetRect.height : targetRect.width, targetS1 = vertical ? targetRect.top : targetRect.left, targetS2 = vertical ? targetRect.bottom : targetRect.right, invert = false; 10519 if (!invertSwap) { 10520 if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { 10521 if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { 10522 pastFirstInvertThresh = true; 10523 } 10524 if (!pastFirstInvertThresh) { 10525 if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) { 10526 return -lastDirection; 10527 } 10528 } else { 10529 invert = true; 10530 } 10531 } else { 10532 if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { 10533 return _getInsertDirection(target); 10534 } 10535 } 10536 } 10537 invert = invert || invertSwap; 10538 if (invert) { 10539 if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { 10540 return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; 10541 } 10542 } 10543 return 0; 10544 } 10545 function _getInsertDirection(target) { 10546 if (index(dragEl) < index(target)) { 10547 return 1; 10548 } else { 10549 return -1; 10550 } 10551 } 10552 function _generateId(el) { 10553 var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0; 10554 while (i--) { 10555 sum += str.charCodeAt(i); 10556 } 10557 return sum.toString(36); 10558 } 10559 function _saveInputCheckedState(root) { 10560 savedInputChecked.length = 0; 10561 var inputs = root.getElementsByTagName("input"); 10562 var idx = inputs.length; 10563 while (idx--) { 10564 var el = inputs[idx]; 10565 el.checked && savedInputChecked.push(el); 10566 } 10567 } 10568 function _nextTick(fn) { 10569 return setTimeout(fn, 0); 10570 } 10571 function _cancelNextTick(id) { 10572 return clearTimeout(id); 10573 } 10574 if (documentExists) { 10575 on4(document, "touchmove", function(evt) { 10576 if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { 10577 evt.preventDefault(); 10578 } 10579 }); 10580 } 10581 Sortable.utils = { 10582 on: on4, 10583 off, 10584 css, 10585 find: find2, 10586 is: function is(el, selector) { 10587 return !!closest(el, selector, el, false); 10588 }, 10589 extend, 10590 throttle: throttle2, 10591 closest, 10592 toggleClass, 10593 clone: clone2, 10594 index, 10595 nextTick: _nextTick, 10596 cancelNextTick: _cancelNextTick, 10597 detectDirection: _detectDirection, 10598 getChild 10599 }; 10600 Sortable.get = function(element) { 10601 return element[expando]; 10602 }; 10603 Sortable.mount = function() { 10604 for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) { 10605 plugins2[_key] = arguments[_key]; 10606 } 10607 if (plugins2[0].constructor === Array) 10608 plugins2 = plugins2[0]; 10609 plugins2.forEach(function(plugin2) { 10610 if (!plugin2.prototype || !plugin2.prototype.constructor) { 10611 throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin2)); 10612 } 10613 if (plugin2.utils) 10614 Sortable.utils = _objectSpread22(_objectSpread22({}, Sortable.utils), plugin2.utils); 10615 PluginManager.mount(plugin2); 10616 }); 10617 }; 10618 Sortable.create = function(el, options) { 10619 return new Sortable(el, options); 10620 }; 10621 Sortable.version = version; 10622 var autoScrolls = []; 10623 var scrollEl; 10624 var scrollRootEl; 10625 var scrolling = false; 10626 var lastAutoScrollX; 10627 var lastAutoScrollY; 10628 var touchEvt$1; 10629 var pointerElemChangedInterval; 10630 function AutoScrollPlugin() { 10631 function AutoScroll() { 10632 this.defaults = { 10633 scroll: true, 10634 forceAutoScrollFallback: false, 10635 scrollSensitivity: 30, 10636 scrollSpeed: 10, 10637 bubbleScroll: true 10638 }; 10639 for (var fn in this) { 10640 if (fn.charAt(0) === "_" && typeof this[fn] === "function") { 10641 this[fn] = this[fn].bind(this); 10642 } 10643 } 10644 } 10645 AutoScroll.prototype = { 10646 dragStarted: function dragStarted(_ref) { 10647 var originalEvent = _ref.originalEvent; 10648 if (this.sortable.nativeDraggable) { 10649 on4(document, "dragover", this._handleAutoScroll); 10650 } else { 10651 if (this.options.supportPointer) { 10652 on4(document, "pointermove", this._handleFallbackAutoScroll); 10653 } else if (originalEvent.touches) { 10654 on4(document, "touchmove", this._handleFallbackAutoScroll); 10655 } else { 10656 on4(document, "mousemove", this._handleFallbackAutoScroll); 10657 } 10658 } 10659 }, 10660 dragOverCompleted: function dragOverCompleted(_ref2) { 10661 var originalEvent = _ref2.originalEvent; 10662 if (!this.options.dragOverBubble && !originalEvent.rootEl) { 10663 this._handleAutoScroll(originalEvent); 10664 } 10665 }, 10666 drop: function drop3() { 10667 if (this.sortable.nativeDraggable) { 10668 off(document, "dragover", this._handleAutoScroll); 10669 } else { 10670 off(document, "pointermove", this._handleFallbackAutoScroll); 10671 off(document, "touchmove", this._handleFallbackAutoScroll); 10672 off(document, "mousemove", this._handleFallbackAutoScroll); 10673 } 10674 clearPointerElemChangedInterval(); 10675 clearAutoScrolls(); 10676 cancelThrottle(); 10677 }, 10678 nulling: function nulling() { 10679 touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; 10680 autoScrolls.length = 0; 10681 }, 10682 _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { 10683 this._handleAutoScroll(evt, true); 10684 }, 10685 _handleAutoScroll: function _handleAutoScroll(evt, fallback2) { 10686 var _this = this; 10687 var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y); 10688 touchEvt$1 = evt; 10689 if (fallback2 || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) { 10690 autoScroll(evt, this.options, elem, fallback2); 10691 var ogElemScroller = getParentAutoScrollElement(elem, true); 10692 if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { 10693 pointerElemChangedInterval && clearPointerElemChangedInterval(); 10694 pointerElemChangedInterval = setInterval(function() { 10695 var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); 10696 if (newElem !== ogElemScroller) { 10697 ogElemScroller = newElem; 10698 clearAutoScrolls(); 10699 } 10700 autoScroll(evt, _this.options, newElem, fallback2); 10701 }, 10); 10702 lastAutoScrollX = x; 10703 lastAutoScrollY = y; 10704 } 10705 } else { 10706 if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { 10707 clearAutoScrolls(); 10708 return; 10709 } 10710 autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); 10711 } 10712 } 10713 }; 10714 return _extends(AutoScroll, { 10715 pluginName: "scroll", 10716 initializeByDefault: true 10717 }); 10718 } 10719 function clearAutoScrolls() { 10720 autoScrolls.forEach(function(autoScroll2) { 10721 clearInterval(autoScroll2.pid); 10722 }); 10723 autoScrolls = []; 10724 } 10725 function clearPointerElemChangedInterval() { 10726 clearInterval(pointerElemChangedInterval); 10727 } 10728 var autoScroll = throttle2(function(evt, options, rootEl2, isFallback) { 10729 if (!options.scroll) 10730 return; 10731 var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, sens = options.scrollSensitivity, speed = options.scrollSpeed, winScroller = getWindowScrollingElement(); 10732 var scrollThisInstance = false, scrollCustomFn; 10733 if (scrollRootEl !== rootEl2) { 10734 scrollRootEl = rootEl2; 10735 clearAutoScrolls(); 10736 scrollEl = options.scroll; 10737 scrollCustomFn = options.scrollFn; 10738 if (scrollEl === true) { 10739 scrollEl = getParentAutoScrollElement(rootEl2, true); 10740 } 10741 } 10742 var layersOut = 0; 10743 var currentParent = scrollEl; 10744 do { 10745 var el = currentParent, rect = getRect(el), top = rect.top, bottom = rect.bottom, left = rect.left, right = rect.right, width = rect.width, height = rect.height, canScrollX = void 0, canScrollY = void 0, scrollWidth = el.scrollWidth, scrollHeight = el.scrollHeight, elCSS = css(el), scrollPosX = el.scrollLeft, scrollPosY = el.scrollTop; 10746 if (el === winScroller) { 10747 canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible"); 10748 canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible"); 10749 } else { 10750 canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll"); 10751 canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll"); 10752 } 10753 var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); 10754 var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); 10755 if (!autoScrolls[layersOut]) { 10756 for (var i = 0; i <= layersOut; i++) { 10757 if (!autoScrolls[i]) { 10758 autoScrolls[i] = {}; 10759 } 10760 } 10761 } 10762 if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { 10763 autoScrolls[layersOut].el = el; 10764 autoScrolls[layersOut].vx = vx; 10765 autoScrolls[layersOut].vy = vy; 10766 clearInterval(autoScrolls[layersOut].pid); 10767 if (vx != 0 || vy != 0) { 10768 scrollThisInstance = true; 10769 autoScrolls[layersOut].pid = setInterval(function() { 10770 if (isFallback && this.layer === 0) { 10771 Sortable.active._onTouchMove(touchEvt$1); 10772 } 10773 var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; 10774 var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; 10775 if (typeof scrollCustomFn === "function") { 10776 if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") { 10777 return; 10778 } 10779 } 10780 scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); 10781 }.bind({ 10782 layer: layersOut 10783 }), 24); 10784 } 10785 } 10786 layersOut++; 10787 } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); 10788 scrolling = scrollThisInstance; 10789 }, 30); 10790 var drop = function drop2(_ref) { 10791 var originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, dragEl2 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget; 10792 if (!originalEvent) 10793 return; 10794 var toSortable = putSortable2 || activeSortable; 10795 hideGhostForTarget(); 10796 var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; 10797 var target = document.elementFromPoint(touch.clientX, touch.clientY); 10798 unhideGhostForTarget(); 10799 if (toSortable && !toSortable.el.contains(target)) { 10800 dispatchSortableEvent("spill"); 10801 this.onSpill({ 10802 dragEl: dragEl2, 10803 putSortable: putSortable2 10804 }); 10805 } 10806 }; 10807 function Revert() { 10808 } 10809 Revert.prototype = { 10810 startIndex: null, 10811 dragStart: function dragStart(_ref2) { 10812 var oldDraggableIndex2 = _ref2.oldDraggableIndex; 10813 this.startIndex = oldDraggableIndex2; 10814 }, 10815 onSpill: function onSpill(_ref3) { 10816 var dragEl2 = _ref3.dragEl, putSortable2 = _ref3.putSortable; 10817 this.sortable.captureAnimationState(); 10818 if (putSortable2) { 10819 putSortable2.captureAnimationState(); 10820 } 10821 var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); 10822 if (nextSibling) { 10823 this.sortable.el.insertBefore(dragEl2, nextSibling); 10824 } else { 10825 this.sortable.el.appendChild(dragEl2); 10826 } 10827 this.sortable.animateAll(); 10828 if (putSortable2) { 10829 putSortable2.animateAll(); 10830 } 10831 }, 10832 drop 10833 }; 10834 _extends(Revert, { 10835 pluginName: "revertOnSpill" 10836 }); 10837 function Remove() { 10838 } 10839 Remove.prototype = { 10840 onSpill: function onSpill2(_ref4) { 10841 var dragEl2 = _ref4.dragEl, putSortable2 = _ref4.putSortable; 10842 var parentSortable = putSortable2 || this.sortable; 10843 parentSortable.captureAnimationState(); 10844 dragEl2.parentNode && dragEl2.parentNode.removeChild(dragEl2); 10845 parentSortable.animateAll(); 10846 }, 10847 drop 10848 }; 10849 _extends(Remove, { 10850 pluginName: "removeOnSpill" 10851 }); 10852 Sortable.mount(new AutoScrollPlugin()); 10853 Sortable.mount(Remove, Revert); 10854 var sortable_esm_default = Sortable; 10855 function walk2(el, callback) { 10856 if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) { 10857 Array.from(el.children).forEach((el2) => walk2(el2, callback)); 10858 return; 10859 } 10860 let skip = false; 10861 callback(el, () => skip = true); 10862 if (skip) 10863 return; 10864 let node = el.firstElementChild; 10865 while (node) { 10866 walk2(node, callback, false); 10867 node = node.nextElementSibling; 10868 } 10869 } 10870 function src_default6(Alpine3) { 10871 Alpine3.directive("sort", (el, { value, modifiers, expression }, { effect: effect3, evaluate: evaluate3, cleanup: cleanup2 }) => { 10872 if (value === "config") { 10873 return; 10874 } 10875 if (value === "handle") { 10876 return; 10877 } 10878 if (value === "group") { 10879 return; 10880 } 10881 if (value === "key" || value === "item") { 10882 if ([void 0, null, ""].includes(expression)) 10883 return; 10884 el._x_sort_key = evaluate3(expression); 10885 return; 10886 } 10887 let handleSelector = "[x-sort\\:handle],[wire\\:sort\\:handle]"; 10888 let preferences = { 10889 hideGhost: !modifiers.includes("ghost"), 10890 useHandles: !!el.querySelector(handleSelector) || Array.from(el.querySelectorAll("template:not(svg template)")).some((tmpl) => tmpl.content?.querySelector(handleSelector)), 10891 group: getGroupName(el, modifiers) 10892 }; 10893 let handleSort = generateSortHandler(expression, evaluate3); 10894 let config = getConfigurationOverrides(el, modifiers, evaluate3); 10895 let sortable = initSortable(el, config, preferences, (key, position) => { 10896 handleSort(key, position); 10897 }); 10898 cleanup2(() => sortable.destroy()); 10899 }); 10900 } 10901 function generateSortHandler(expression, evaluate3) { 10902 if ([void 0, null, ""].includes(expression)) 10903 return () => { 10904 }; 10905 return (key, position) => { 10906 evaluate3(expression, { scope: { 10907 $key: key, 10908 $item: key, 10909 $position: position 10910 }, params: [ 10911 key, 10912 position 10913 ] }); 10914 }; 10915 } 10916 function getConfigurationOverrides(el, modifiers, evaluate3) { 10917 if (el.hasAttribute("x-sort:config")) { 10918 return evaluate3(el.getAttribute("x-sort:config")); 10919 } 10920 if (el.hasAttribute("wire:sort:config")) { 10921 return evaluate3(el.getAttribute("wire:sort:config")); 10922 } 10923 return {}; 10924 } 10925 function initSortable(el, config, preferences, handle) { 10926 let ghostRef; 10927 let options = { 10928 animation: 150, 10929 handle: preferences.useHandles ? "[x-sort\\:handle],[wire\\:sort\\:handle]" : null, 10930 group: preferences.group, 10931 scroll: true, 10932 forceAutoScrollFallback: true, 10933 scrollSensitivity: 50, 10934 preventOnFilter: false, 10935 filter(e) { 10936 if (e.target.hasAttribute("x-sort:ignore") || e.target.hasAttribute("wire:sort:ignore")) 10937 return true; 10938 if (e.target.closest("[x-sort\\:ignore]") || e.target.closest("[wire\\:sort\\:ignore]")) 10939 return true; 10940 if (!el.querySelector("[x-sort\\:item],[wire\\:sort\\:item]")) 10941 return false; 10942 let itemHasAttribute = e.target.closest("[x-sort\\:item],[wire\\:sort\\:item]"); 10943 return itemHasAttribute ? false : true; 10944 }, 10945 onSort(e) { 10946 if (e.from !== e.to) { 10947 if (e.to !== e.target) { 10948 return; 10949 } 10950 } 10951 let key = void 0; 10952 walk2(e.item, (el2, skip) => { 10953 if (key !== void 0) 10954 return; 10955 if (el2._x_sort_key) { 10956 key = el2._x_sort_key; 10957 skip(); 10958 } 10959 }); 10960 let position = e.newIndex; 10961 if (key !== void 0 || key !== null) { 10962 handle(key, position); 10963 } 10964 }, 10965 onStart() { 10966 document.body.classList.add("sorting"); 10967 ghostRef = document.querySelector(".sortable-ghost"); 10968 if (preferences.hideGhost && ghostRef) 10969 ghostRef.style.opacity = "0"; 10970 }, 10971 onEnd() { 10972 document.body.classList.remove("sorting"); 10973 if (preferences.hideGhost && ghostRef) 10974 ghostRef.style.opacity = "1"; 10975 ghostRef = void 0; 10976 keepElementsWithinMorphMarkers(el); 10977 } 10978 }; 10979 return new sortable_esm_default(el, { ...options, ...config }); 10980 } 10981 function keepElementsWithinMorphMarkers(el) { 10982 let cursor = el.firstChild; 10983 while (cursor.nextSibling) { 10984 if (cursor.textContent.trim() === "[if ENDBLOCK]><![endif]") { 10985 el.append(cursor); 10986 break; 10987 } 10988 cursor = cursor.nextSibling; 10989 } 10990 } 10991 function getGroupName(el, modifiers) { 10992 if (el.hasAttribute("x-sort:group")) { 10993 return el.getAttribute("x-sort:group"); 10994 } 10995 if (el.hasAttribute("wire:sort:group")) { 10996 return el.getAttribute("wire:sort:group"); 10997 } 10998 return modifiers.indexOf("group") !== -1 ? modifiers[modifiers.indexOf("group") + 1] : null; 10999 } 11000 var module_default6 = src_default6; 11001 11002
vendor: 1,679 bytes, lines 11002-11047
11002// node_modules/@alpinejs/resize/dist/module.esm.js 11003 function src_default7(Alpine3) { 11004 Alpine3.directive("resize", Alpine3.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 11005 let evaluator = evaluateLater2(expression); 11006 let evaluate3 = (width, height) => { 11007 evaluator(() => { 11008 }, { scope: { "$width": width, "$height": height } }); 11009 }; 11010 let off2 = modifiers.includes("document") ? onDocumentResize(evaluate3) : onElResize(el, evaluate3); 11011 cleanup2(() => off2()); 11012 })); 11013 } 11014 function onElResize(el, callback) { 11015 let observer2 = new ResizeObserver((entries) => { 11016 let [width, height] = dimensions(entries); 11017 callback(width, height); 11018 }); 11019 observer2.observe(el); 11020 return () => observer2.disconnect(); 11021 } 11022 var documentResizeObserver; 11023 var documentResizeObserverCallbacks = /* @__PURE__ */ new Set(); 11024 function onDocumentResize(callback) { 11025 documentResizeObserverCallbacks.add(callback); 11026 if (!documentResizeObserver) { 11027 documentResizeObserver = new ResizeObserver((entries) => { 11028 let [width, height] = dimensions(entries); 11029 documentResizeObserverCallbacks.forEach((i) => i(width, height)); 11030 }); 11031 documentResizeObserver.observe(document.documentElement); 11032 } 11033 return () => { 11034 documentResizeObserverCallbacks.delete(callback); 11035 }; 11036 } 11037 function dimensions(entries) { 11038 let width, height; 11039 for (let entry of entries) { 11040 width = entry.borderBoxSize[0].inlineSize; 11041 height = entry.borderBoxSize[0].blockSize; 11042 } 11043 return [width, height]; 11044 } 11045 var module_default7 = src_default7; 11046 11047
vendor: 43,028 bytes, lines 11047-12299
11047// node_modules/@alpinejs/anchor/dist/module.esm.js 11048 var min = Math.min; 11049 var max = Math.max; 11050 var round = Math.round; 11051 var floor = Math.floor; 11052 var createCoords = (v) => ({ 11053 x: v, 11054 y: v 11055 }); 11056 var oppositeSideMap = { 11057 left: "right", 11058 right: "left", 11059 bottom: "top", 11060 top: "bottom" 11061 }; 11062 var oppositeAlignmentMap = { 11063 start: "end", 11064 end: "start" 11065 }; 11066 function clamp(start3, value, end) { 11067 return max(start3, min(value, end)); 11068 } 11069 function evaluate2(value, param) { 11070 return typeof value === "function" ? value(param) : value; 11071 } 11072 function getSide(placement) { 11073 return placement.split("-")[0]; 11074 } 11075 function getAlignment(placement) { 11076 return placement.split("-")[1]; 11077 } 11078 function getOppositeAxis(axis) { 11079 return axis === "x" ? "y" : "x"; 11080 } 11081 function getAxisLength(axis) { 11082 return axis === "y" ? "height" : "width"; 11083 } 11084 function getSideAxis(placement) { 11085 return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; 11086 } 11087 function getAlignmentAxis(placement) { 11088 return getOppositeAxis(getSideAxis(placement)); 11089 } 11090 function getAlignmentSides(placement, rects, rtl) { 11091 if (rtl === void 0) { 11092 rtl = false; 11093 } 11094 const alignment = getAlignment(placement); 11095 const alignmentAxis = getAlignmentAxis(placement); 11096 const length = getAxisLength(alignmentAxis); 11097 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 11098 if (rects.reference[length] > rects.floating[length]) { 11099 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 11100 } 11101 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 11102 } 11103 function getExpandedPlacements(placement) { 11104 const oppositePlacement = getOppositePlacement(placement); 11105 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 11106 } 11107 function getOppositeAlignmentPlacement(placement) { 11108 return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); 11109 } 11110 function getSideList(side, isStart, rtl) { 11111 const lr = ["left", "right"]; 11112 const rl = ["right", "left"]; 11113 const tb = ["top", "bottom"]; 11114 const bt = ["bottom", "top"]; 11115 switch (side) { 11116 case "top": 11117 case "bottom": 11118 if (rtl) 11119 return isStart ? rl : lr; 11120 return isStart ? lr : rl; 11121 case "left": 11122 case "right": 11123 return isStart ? tb : bt; 11124 default: 11125 return []; 11126 } 11127 } 11128 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 11129 const alignment = getAlignment(placement); 11130 let list = getSideList(getSide(placement), direction === "start", rtl); 11131 if (alignment) { 11132 list = list.map((side) => side + "-" + alignment); 11133 if (flipAlignment) { 11134 list = list.concat(list.map(getOppositeAlignmentPlacement)); 11135 } 11136 } 11137 return list; 11138 } 11139 function getOppositePlacement(placement) { 11140 return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); 11141 } 11142 function expandPaddingObject(padding) { 11143 return { 11144 top: 0, 11145 right: 0, 11146 bottom: 0, 11147 left: 0, 11148 ...padding 11149 }; 11150 } 11151 function getPaddingObject(padding) { 11152 return typeof padding !== "number" ? expandPaddingObject(padding) : { 11153 top: padding, 11154 right: padding, 11155 bottom: padding, 11156 left: padding 11157 }; 11158 } 11159 function rectToClientRect(rect) { 11160 return { 11161 ...rect, 11162 top: rect.y, 11163 left: rect.x, 11164 right: rect.x + rect.width, 11165 bottom: rect.y + rect.height 11166 }; 11167 } 11168 function computeCoordsFromPlacement(_ref, placement, rtl) { 11169 let { 11170 reference, 11171 floating 11172 } = _ref; 11173 const sideAxis = getSideAxis(placement); 11174 const alignmentAxis = getAlignmentAxis(placement); 11175 const alignLength = getAxisLength(alignmentAxis); 11176 const side = getSide(placement); 11177 const isVertical = sideAxis === "y"; 11178 const commonX = reference.x + reference.width / 2 - floating.width / 2; 11179 const commonY = reference.y + reference.height / 2 - floating.height / 2; 11180 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 11181 let coords; 11182 switch (side) { 11183 case "top": 11184 coords = { 11185 x: commonX, 11186 y: reference.y - floating.height 11187 }; 11188 break; 11189 case "bottom": 11190 coords = { 11191 x: commonX, 11192 y: reference.y + reference.height 11193 }; 11194 break; 11195 case "right": 11196 coords = { 11197 x: reference.x + reference.width, 11198 y: commonY 11199 }; 11200 break; 11201 case "left": 11202 coords = { 11203 x: reference.x - floating.width, 11204 y: commonY 11205 }; 11206 break; 11207 default: 11208 coords = { 11209 x: reference.x, 11210 y: reference.y 11211 }; 11212 } 11213 switch (getAlignment(placement)) { 11214 case "start": 11215 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 11216 break; 11217 case "end": 11218 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 11219 break; 11220 } 11221 return coords; 11222 } 11223 var computePosition = async (reference, floating, config) => { 11224 const { 11225 placement = "bottom", 11226 strategy = "absolute", 11227 middleware = [], 11228 platform: platform2 11229 } = config; 11230 const validMiddleware = middleware.filter(Boolean); 11231 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); 11232 let rects = await platform2.getElementRects({ 11233 reference, 11234 floating, 11235 strategy 11236 }); 11237 let { 11238 x, 11239 y 11240 } = computeCoordsFromPlacement(rects, placement, rtl); 11241 let statefulPlacement = placement; 11242 let middlewareData = {}; 11243 let resetCount = 0; 11244 for (let i = 0; i < validMiddleware.length; i++) { 11245 const { 11246 name, 11247 fn 11248 } = validMiddleware[i]; 11249 const { 11250 x: nextX, 11251 y: nextY, 11252 data: data2, 11253 reset 11254 } = await fn({ 11255 x, 11256 y, 11257 initialPlacement: placement, 11258 placement: statefulPlacement, 11259 strategy, 11260 middlewareData, 11261 rects, 11262 platform: platform2, 11263 elements: { 11264 reference, 11265 floating 11266 } 11267 }); 11268 x = nextX != null ? nextX : x; 11269 y = nextY != null ? nextY : y; 11270 middlewareData = { 11271 ...middlewareData, 11272 [name]: { 11273 ...middlewareData[name], 11274 ...data2 11275 } 11276 }; 11277 if (reset && resetCount <= 50) { 11278 resetCount++; 11279 if (typeof reset === "object") { 11280 if (reset.placement) { 11281 statefulPlacement = reset.placement; 11282 } 11283 if (reset.rects) { 11284 rects = reset.rects === true ? await platform2.getElementRects({ 11285 reference, 11286 floating, 11287 strategy 11288 }) : reset.rects; 11289 } 11290 ({ 11291 x, 11292 y 11293 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 11294 } 11295 i = -1; 11296 continue; 11297 } 11298 } 11299 return { 11300 x, 11301 y, 11302 placement: statefulPlacement, 11303 strategy, 11304 middlewareData 11305 }; 11306 }; 11307 async function detectOverflow(state, options) { 11308 var _await$platform$isEle; 11309 if (options === void 0) { 11310 options = {}; 11311 } 11312 const { 11313 x, 11314 y, 11315 platform: platform2, 11316 rects, 11317 elements, 11318 strategy 11319 } = state; 11320 const { 11321 boundary = "clippingAncestors", 11322 rootBoundary = "viewport", 11323 elementContext = "floating", 11324 altBoundary = false, 11325 padding = 0 11326 } = evaluate2(options, state); 11327 const paddingObject = getPaddingObject(padding); 11328 const altContext = elementContext === "floating" ? "reference" : "floating"; 11329 const element = elements[altBoundary ? altContext : elementContext]; 11330 const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ 11331 element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)), 11332 boundary, 11333 rootBoundary, 11334 strategy 11335 })); 11336 const rect = elementContext === "floating" ? { 11337 ...rects.floating, 11338 x, 11339 y 11340 } : rects.reference; 11341 const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); 11342 const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { 11343 x: 1, 11344 y: 1 11345 } : { 11346 x: 1, 11347 y: 1 11348 }; 11349 const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ 11350 rect, 11351 offsetParent, 11352 strategy 11353 }) : rect); 11354 return { 11355 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 11356 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 11357 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 11358 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 11359 }; 11360 } 11361 var flip = function(options) { 11362 if (options === void 0) { 11363 options = {}; 11364 } 11365 return { 11366 name: "flip", 11367 options, 11368 async fn(state) { 11369 var _middlewareData$arrow, _middlewareData$flip; 11370 const { 11371 placement, 11372 middlewareData, 11373 rects, 11374 initialPlacement, 11375 platform: platform2, 11376 elements 11377 } = state; 11378 const { 11379 mainAxis: checkMainAxis = true, 11380 crossAxis: checkCrossAxis = true, 11381 fallbackPlacements: specifiedFallbackPlacements, 11382 fallbackStrategy = "bestFit", 11383 fallbackAxisSideDirection = "none", 11384 flipAlignment = true, 11385 ...detectOverflowOptions 11386 } = evaluate2(options, state); 11387 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 11388 return {}; 11389 } 11390 const side = getSide(placement); 11391 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 11392 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); 11393 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 11394 if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") { 11395 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 11396 } 11397 const placements2 = [initialPlacement, ...fallbackPlacements]; 11398 const overflow = await detectOverflow(state, detectOverflowOptions); 11399 const overflows = []; 11400 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 11401 if (checkMainAxis) { 11402 overflows.push(overflow[side]); 11403 } 11404 if (checkCrossAxis) { 11405 const sides2 = getAlignmentSides(placement, rects, rtl); 11406 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 11407 } 11408 overflowsData = [...overflowsData, { 11409 placement, 11410 overflows 11411 }]; 11412 if (!overflows.every((side2) => side2 <= 0)) { 11413 var _middlewareData$flip2, _overflowsData$filter; 11414 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 11415 const nextPlacement = placements2[nextIndex]; 11416 if (nextPlacement) { 11417 return { 11418 data: { 11419 index: nextIndex, 11420 overflows: overflowsData 11421 }, 11422 reset: { 11423 placement: nextPlacement 11424 } 11425 }; 11426 } 11427 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 11428 if (!resetPlacement) { 11429 switch (fallbackStrategy) { 11430 case "bestFit": { 11431 var _overflowsData$map$so; 11432 const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; 11433 if (placement2) { 11434 resetPlacement = placement2; 11435 } 11436 break; 11437 } 11438 case "initialPlacement": 11439 resetPlacement = initialPlacement; 11440 break; 11441 } 11442 } 11443 if (placement !== resetPlacement) { 11444 return { 11445 reset: { 11446 placement: resetPlacement 11447 } 11448 }; 11449 } 11450 } 11451 return {}; 11452 } 11453 }; 11454 }; 11455 async function convertValueToCoords(state, options) { 11456 const { 11457 placement, 11458 platform: platform2, 11459 elements 11460 } = state; 11461 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); 11462 const side = getSide(placement); 11463 const alignment = getAlignment(placement); 11464 const isVertical = getSideAxis(placement) === "y"; 11465 const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1; 11466 const crossAxisMulti = rtl && isVertical ? -1 : 1; 11467 const rawValue = evaluate2(options, state); 11468 let { 11469 mainAxis, 11470 crossAxis, 11471 alignmentAxis 11472 } = typeof rawValue === "number" ? { 11473 mainAxis: rawValue, 11474 crossAxis: 0, 11475 alignmentAxis: null 11476 } : { 11477 mainAxis: 0, 11478 crossAxis: 0, 11479 alignmentAxis: null, 11480 ...rawValue 11481 }; 11482 if (alignment && typeof alignmentAxis === "number") { 11483 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 11484 } 11485 return isVertical ? { 11486 x: crossAxis * crossAxisMulti, 11487 y: mainAxis * mainAxisMulti 11488 } : { 11489 x: mainAxis * mainAxisMulti, 11490 y: crossAxis * crossAxisMulti 11491 }; 11492 } 11493 var offset = function(options) { 11494 if (options === void 0) { 11495 options = 0; 11496 } 11497 return { 11498 name: "offset", 11499 options, 11500 async fn(state) { 11501 const { 11502 x, 11503 y 11504 } = state; 11505 const diffCoords = await convertValueToCoords(state, options); 11506 return { 11507 x: x + diffCoords.x, 11508 y: y + diffCoords.y, 11509 data: diffCoords 11510 }; 11511 } 11512 }; 11513 }; 11514 var shift = function(options) { 11515 if (options === void 0) { 11516 options = {}; 11517 } 11518 return { 11519 name: "shift", 11520 options, 11521 async fn(state) { 11522 const { 11523 x, 11524 y, 11525 placement 11526 } = state; 11527 const { 11528 mainAxis: checkMainAxis = true, 11529 crossAxis: checkCrossAxis = false, 11530 limiter = { 11531 fn: (_ref) => { 11532 let { 11533 x: x2, 11534 y: y2 11535 } = _ref; 11536 return { 11537 x: x2, 11538 y: y2 11539 }; 11540 } 11541 }, 11542 ...detectOverflowOptions 11543 } = evaluate2(options, state); 11544 const coords = { 11545 x, 11546 y 11547 }; 11548 const overflow = await detectOverflow(state, detectOverflowOptions); 11549 const crossAxis = getSideAxis(getSide(placement)); 11550 const mainAxis = getOppositeAxis(crossAxis); 11551 let mainAxisCoord = coords[mainAxis]; 11552 let crossAxisCoord = coords[crossAxis]; 11553 if (checkMainAxis) { 11554 const minSide = mainAxis === "y" ? "top" : "left"; 11555 const maxSide = mainAxis === "y" ? "bottom" : "right"; 11556 const min2 = mainAxisCoord + overflow[minSide]; 11557 const max2 = mainAxisCoord - overflow[maxSide]; 11558 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 11559 } 11560 if (checkCrossAxis) { 11561 const minSide = crossAxis === "y" ? "top" : "left"; 11562 const maxSide = crossAxis === "y" ? "bottom" : "right"; 11563 const min2 = crossAxisCoord + overflow[minSide]; 11564 const max2 = crossAxisCoord - overflow[maxSide]; 11565 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 11566 } 11567 const limitedCoords = limiter.fn({ 11568 ...state, 11569 [mainAxis]: mainAxisCoord, 11570 [crossAxis]: crossAxisCoord 11571 }); 11572 return { 11573 ...limitedCoords, 11574 data: { 11575 x: limitedCoords.x - x, 11576 y: limitedCoords.y - y 11577 } 11578 }; 11579 } 11580 }; 11581 }; 11582 function getNodeName(node) { 11583 if (isNode(node)) { 11584 return (node.nodeName || "").toLowerCase(); 11585 } 11586 return "#document"; 11587 } 11588 function getWindow(node) { 11589 var _node$ownerDocument; 11590 return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 11591 } 11592 function getDocumentElement(node) { 11593 var _ref; 11594 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 11595 } 11596 function isNode(value) { 11597 return value instanceof Node || value instanceof getWindow(value).Node; 11598 } 11599 function isElement(value) { 11600 return value instanceof Element || value instanceof getWindow(value).Element; 11601 } 11602 function isHTMLElement(value) { 11603 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 11604 } 11605 function isShadowRoot(value) { 11606 if (typeof ShadowRoot === "undefined") { 11607 return false; 11608 } 11609 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 11610 } 11611 function isOverflowElement(element) { 11612 const { 11613 overflow, 11614 overflowX, 11615 overflowY, 11616 display 11617 } = getComputedStyle2(element); 11618 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); 11619 } 11620 function isTableElement(element) { 11621 return ["table", "td", "th"].includes(getNodeName(element)); 11622 } 11623 function isContainingBlock(element) { 11624 const webkit = isWebKit(); 11625 const css2 = getComputedStyle2(element); 11626 return css2.transform !== "none" || css2.perspective !== "none" || (css2.containerType ? css2.containerType !== "normal" : false) || !webkit && (css2.backdropFilter ? css2.backdropFilter !== "none" : false) || !webkit && (css2.filter ? css2.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css2.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css2.contain || "").includes(value)); 11627 } 11628 function getContainingBlock(element) { 11629 let currentNode = getParentNode(element); 11630 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 11631 if (isContainingBlock(currentNode)) { 11632 return currentNode; 11633 } else { 11634 currentNode = getParentNode(currentNode); 11635 } 11636 } 11637 return null; 11638 } 11639 function isWebKit() { 11640 if (typeof CSS === "undefined" || !CSS.supports) 11641 return false; 11642 return CSS.supports("-webkit-backdrop-filter", "none"); 11643 } 11644 function isLastTraversableNode(node) { 11645 return ["html", "body", "#document"].includes(getNodeName(node)); 11646 } 11647 function getComputedStyle2(element) { 11648 return getWindow(element).getComputedStyle(element); 11649 } 11650 function getNodeScroll(element) { 11651 if (isElement(element)) { 11652 return { 11653 scrollLeft: element.scrollLeft, 11654 scrollTop: element.scrollTop 11655 }; 11656 } 11657 return { 11658 scrollLeft: element.pageXOffset, 11659 scrollTop: element.pageYOffset 11660 }; 11661 } 11662 function getParentNode(node) { 11663 if (getNodeName(node) === "html") { 11664 return node; 11665 } 11666 const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node); 11667 return isShadowRoot(result) ? result.host : result; 11668 } 11669 function getNearestOverflowAncestor(node) { 11670 const parentNode = getParentNode(node); 11671 if (isLastTraversableNode(parentNode)) { 11672 return node.ownerDocument ? node.ownerDocument.body : node.body; 11673 } 11674 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 11675 return parentNode; 11676 } 11677 return getNearestOverflowAncestor(parentNode); 11678 } 11679 function getOverflowAncestors(node, list, traverseIframes) { 11680 var _node$ownerDocument2; 11681 if (list === void 0) { 11682 list = []; 11683 } 11684 if (traverseIframes === void 0) { 11685 traverseIframes = true; 11686 } 11687 const scrollableAncestor = getNearestOverflowAncestor(node); 11688 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 11689 const win = getWindow(scrollableAncestor); 11690 if (isBody) { 11691 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []); 11692 } 11693 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 11694 } 11695 function getCssDimensions(element) { 11696 const css2 = getComputedStyle2(element); 11697 let width = parseFloat(css2.width) || 0; 11698 let height = parseFloat(css2.height) || 0; 11699 const hasOffset = isHTMLElement(element); 11700 const offsetWidth = hasOffset ? element.offsetWidth : width; 11701 const offsetHeight = hasOffset ? element.offsetHeight : height; 11702 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 11703 if (shouldFallback) { 11704 width = offsetWidth; 11705 height = offsetHeight; 11706 } 11707 return { 11708 width, 11709 height, 11710 $: shouldFallback 11711 }; 11712 } 11713 function unwrapElement(element) { 11714 return !isElement(element) ? element.contextElement : element; 11715 } 11716 function getScale(element) { 11717 const domElement = unwrapElement(element); 11718 if (!isHTMLElement(domElement)) { 11719 return createCoords(1); 11720 } 11721 const rect = domElement.getBoundingClientRect(); 11722 const { 11723 width, 11724 height, 11725 $ 11726 } = getCssDimensions(domElement); 11727 let x = ($ ? round(rect.width) : rect.width) / width; 11728 let y = ($ ? round(rect.height) : rect.height) / height; 11729 if (!x || !Number.isFinite(x)) { 11730 x = 1; 11731 } 11732 if (!y || !Number.isFinite(y)) { 11733 y = 1; 11734 } 11735 return { 11736 x, 11737 y 11738 }; 11739 } 11740 var noOffsets = /* @__PURE__ */ createCoords(0); 11741 function getVisualOffsets(element) { 11742 const win = getWindow(element); 11743 if (!isWebKit() || !win.visualViewport) { 11744 return noOffsets; 11745 } 11746 return { 11747 x: win.visualViewport.offsetLeft, 11748 y: win.visualViewport.offsetTop 11749 }; 11750 } 11751 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 11752 if (isFixed === void 0) { 11753 isFixed = false; 11754 } 11755 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 11756 return false; 11757 } 11758 return isFixed; 11759 } 11760 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 11761 if (includeScale === void 0) { 11762 includeScale = false; 11763 } 11764 if (isFixedStrategy === void 0) { 11765 isFixedStrategy = false; 11766 } 11767 const clientRect = element.getBoundingClientRect(); 11768 const domElement = unwrapElement(element); 11769 let scale = createCoords(1); 11770 if (includeScale) { 11771 if (offsetParent) { 11772 if (isElement(offsetParent)) { 11773 scale = getScale(offsetParent); 11774 } 11775 } else { 11776 scale = getScale(element); 11777 } 11778 } 11779 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 11780 let x = (clientRect.left + visualOffsets.x) / scale.x; 11781 let y = (clientRect.top + visualOffsets.y) / scale.y; 11782 let width = clientRect.width / scale.x; 11783 let height = clientRect.height / scale.y; 11784 if (domElement) { 11785 const win = getWindow(domElement); 11786 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 11787 let currentIFrame = win.frameElement; 11788 while (currentIFrame && offsetParent && offsetWin !== win) { 11789 const iframeScale = getScale(currentIFrame); 11790 const iframeRect = currentIFrame.getBoundingClientRect(); 11791 const css2 = getComputedStyle2(currentIFrame); 11792 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x; 11793 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y; 11794 x *= iframeScale.x; 11795 y *= iframeScale.y; 11796 width *= iframeScale.x; 11797 height *= iframeScale.y; 11798 x += left; 11799 y += top; 11800 currentIFrame = getWindow(currentIFrame).frameElement; 11801 } 11802 } 11803 return rectToClientRect({ 11804 width, 11805 height, 11806 x, 11807 y 11808 }); 11809 } 11810 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 11811 let { 11812 rect, 11813 offsetParent, 11814 strategy 11815 } = _ref; 11816 const isOffsetParentAnElement = isHTMLElement(offsetParent); 11817 const documentElement = getDocumentElement(offsetParent); 11818 if (offsetParent === documentElement) { 11819 return rect; 11820 } 11821 let scroll = { 11822 scrollLeft: 0, 11823 scrollTop: 0 11824 }; 11825 let scale = createCoords(1); 11826 const offsets = createCoords(0); 11827 if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") { 11828 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 11829 scroll = getNodeScroll(offsetParent); 11830 } 11831 if (isHTMLElement(offsetParent)) { 11832 const offsetRect = getBoundingClientRect(offsetParent); 11833 scale = getScale(offsetParent); 11834 offsets.x = offsetRect.x + offsetParent.clientLeft; 11835 offsets.y = offsetRect.y + offsetParent.clientTop; 11836 } 11837 } 11838 return { 11839 width: rect.width * scale.x, 11840 height: rect.height * scale.y, 11841 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, 11842 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y 11843 }; 11844 } 11845 function getClientRects(element) { 11846 return Array.from(element.getClientRects()); 11847 } 11848 function getWindowScrollBarX(element) { 11849 return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; 11850 } 11851 function getDocumentRect(element) { 11852 const html = getDocumentElement(element); 11853 const scroll = getNodeScroll(element); 11854 const body = element.ownerDocument.body; 11855 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 11856 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 11857 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 11858 const y = -scroll.scrollTop; 11859 if (getComputedStyle2(body).direction === "rtl") { 11860 x += max(html.clientWidth, body.clientWidth) - width; 11861 } 11862 return { 11863 width, 11864 height, 11865 x, 11866 y 11867 }; 11868 } 11869 function getViewportRect(element, strategy) { 11870 const win = getWindow(element); 11871 const html = getDocumentElement(element); 11872 const visualViewport = win.visualViewport; 11873 let width = html.clientWidth; 11874 let height = html.clientHeight; 11875 let x = 0; 11876 let y = 0; 11877 if (visualViewport) { 11878 width = visualViewport.width; 11879 height = visualViewport.height; 11880 const visualViewportBased = isWebKit(); 11881 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 11882 x = visualViewport.offsetLeft; 11883 y = visualViewport.offsetTop; 11884 } 11885 } 11886 return { 11887 width, 11888 height, 11889 x, 11890 y 11891 }; 11892 } 11893 function getInnerBoundingClientRect(element, strategy) { 11894 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 11895 const top = clientRect.top + element.clientTop; 11896 const left = clientRect.left + element.clientLeft; 11897 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 11898 const width = element.clientWidth * scale.x; 11899 const height = element.clientHeight * scale.y; 11900 const x = left * scale.x; 11901 const y = top * scale.y; 11902 return { 11903 width, 11904 height, 11905 x, 11906 y 11907 }; 11908 } 11909 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 11910 let rect; 11911 if (clippingAncestor === "viewport") { 11912 rect = getViewportRect(element, strategy); 11913 } else if (clippingAncestor === "document") { 11914 rect = getDocumentRect(getDocumentElement(element)); 11915 } else if (isElement(clippingAncestor)) { 11916 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 11917 } else { 11918 const visualOffsets = getVisualOffsets(element); 11919 rect = { 11920 ...clippingAncestor, 11921 x: clippingAncestor.x - visualOffsets.x, 11922 y: clippingAncestor.y - visualOffsets.y 11923 }; 11924 } 11925 return rectToClientRect(rect); 11926 } 11927 function hasFixedPositionAncestor(element, stopNode) { 11928 const parentNode = getParentNode(element); 11929 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 11930 return false; 11931 } 11932 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 11933 } 11934 function getClippingElementAncestors(element, cache) { 11935 const cachedResult = cache.get(element); 11936 if (cachedResult) { 11937 return cachedResult; 11938 } 11939 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 11940 let currentContainingBlockComputedStyle = null; 11941 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 11942 let currentNode = elementIsFixed ? getParentNode(element) : element; 11943 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 11944 const computedStyle = getComputedStyle2(currentNode); 11945 const currentNodeIsContaining = isContainingBlock(currentNode); 11946 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 11947 currentContainingBlockComputedStyle = null; 11948 } 11949 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 11950 if (shouldDropCurrentNode) { 11951 result = result.filter((ancestor) => ancestor !== currentNode); 11952 } else { 11953 currentContainingBlockComputedStyle = computedStyle; 11954 } 11955 currentNode = getParentNode(currentNode); 11956 } 11957 cache.set(element, result); 11958 return result; 11959 } 11960 function getClippingRect(_ref) { 11961 let { 11962 element, 11963 boundary, 11964 rootBoundary, 11965 strategy 11966 } = _ref; 11967 const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary); 11968 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 11969 const firstClippingAncestor = clippingAncestors[0]; 11970 const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { 11971 const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); 11972 accRect.top = max(rect.top, accRect.top); 11973 accRect.right = min(rect.right, accRect.right); 11974 accRect.bottom = min(rect.bottom, accRect.bottom); 11975 accRect.left = max(rect.left, accRect.left); 11976 return accRect; 11977 }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); 11978 return { 11979 width: clippingRect.right - clippingRect.left, 11980 height: clippingRect.bottom - clippingRect.top, 11981 x: clippingRect.left, 11982 y: clippingRect.top 11983 }; 11984 } 11985 function getDimensions(element) { 11986 return getCssDimensions(element); 11987 } 11988 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 11989 const isOffsetParentAnElement = isHTMLElement(offsetParent); 11990 const documentElement = getDocumentElement(offsetParent); 11991 const isFixed = strategy === "fixed"; 11992 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 11993 let scroll = { 11994 scrollLeft: 0, 11995 scrollTop: 0 11996 }; 11997 const offsets = createCoords(0); 11998 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 11999 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 12000 scroll = getNodeScroll(offsetParent); 12001 } 12002 if (isOffsetParentAnElement) { 12003 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 12004 offsets.x = offsetRect.x + offsetParent.clientLeft; 12005 offsets.y = offsetRect.y + offsetParent.clientTop; 12006 } else if (documentElement) { 12007 offsets.x = getWindowScrollBarX(documentElement); 12008 } 12009 } 12010 return { 12011 x: rect.left + scroll.scrollLeft - offsets.x, 12012 y: rect.top + scroll.scrollTop - offsets.y, 12013 width: rect.width, 12014 height: rect.height 12015 }; 12016 } 12017 function getTrueOffsetParent(element, polyfill) { 12018 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 12019 return null; 12020 } 12021 if (polyfill) { 12022 return polyfill(element); 12023 } 12024 return element.offsetParent; 12025 } 12026 function getOffsetParent(element, polyfill) { 12027 const window2 = getWindow(element); 12028 if (!isHTMLElement(element)) { 12029 return window2; 12030 } 12031 let offsetParent = getTrueOffsetParent(element, polyfill); 12032 while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") { 12033 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 12034 } 12035 if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static" && !isContainingBlock(offsetParent))) { 12036 return window2; 12037 } 12038 return offsetParent || getContainingBlock(element) || window2; 12039 } 12040 var getElementRects = async function(_ref) { 12041 let { 12042 reference, 12043 floating, 12044 strategy 12045 } = _ref; 12046 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 12047 const getDimensionsFn = this.getDimensions; 12048 return { 12049 reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy), 12050 floating: { 12051 x: 0, 12052 y: 0, 12053 ...await getDimensionsFn(floating) 12054 } 12055 }; 12056 }; 12057 function isRTL(element) { 12058 return getComputedStyle2(element).direction === "rtl"; 12059 } 12060 var platform = { 12061 convertOffsetParentRelativeRectToViewportRelativeRect, 12062 getDocumentElement, 12063 getClippingRect, 12064 getOffsetParent, 12065 getElementRects, 12066 getClientRects, 12067 getDimensions, 12068 getScale, 12069 isElement, 12070 isRTL 12071 }; 12072 function observeMove(element, onMove) { 12073 let io = null; 12074 let timeoutId; 12075 const root = getDocumentElement(element); 12076 function cleanup2() { 12077 clearTimeout(timeoutId); 12078 io && io.disconnect(); 12079 io = null; 12080 } 12081 function refresh(skip, threshold) { 12082 if (skip === void 0) { 12083 skip = false; 12084 } 12085 if (threshold === void 0) { 12086 threshold = 1; 12087 } 12088 cleanup2(); 12089 const { 12090 left, 12091 top, 12092 width, 12093 height 12094 } = element.getBoundingClientRect(); 12095 if (!skip) { 12096 onMove(); 12097 } 12098 if (!width || !height) { 12099 return; 12100 } 12101 const insetTop = floor(top); 12102 const insetRight = floor(root.clientWidth - (left + width)); 12103 const insetBottom = floor(root.clientHeight - (top + height)); 12104 const insetLeft = floor(left); 12105 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 12106 const options = { 12107 rootMargin, 12108 threshold: max(0, min(1, threshold)) || 1 12109 }; 12110 let isFirstUpdate = true; 12111 function handleObserve(entries) { 12112 const ratio = entries[0].intersectionRatio; 12113 if (ratio !== threshold) { 12114 if (!isFirstUpdate) { 12115 return refresh(); 12116 } 12117 if (!ratio) { 12118 timeoutId = setTimeout(() => { 12119 refresh(false, 1e-7); 12120 }, 100); 12121 } else { 12122 refresh(false, ratio); 12123 } 12124 } 12125 isFirstUpdate = false; 12126 } 12127 try { 12128 io = new IntersectionObserver(handleObserve, { 12129 ...options, 12130 root: root.ownerDocument 12131 }); 12132 } catch (e) { 12133 io = new IntersectionObserver(handleObserve, options); 12134 } 12135 io.observe(element); 12136 } 12137 refresh(true); 12138 return cleanup2; 12139 } 12140 function autoUpdate(reference, floating, update, options) { 12141 if (options === void 0) { 12142 options = {}; 12143 } 12144 const { 12145 ancestorScroll = true, 12146 ancestorResize = true, 12147 elementResize = typeof ResizeObserver === "function", 12148 layoutShift = typeof IntersectionObserver === "function", 12149 animationFrame = false 12150 } = options; 12151 const referenceEl = unwrapElement(reference); 12152 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : []; 12153 ancestors.forEach((ancestor) => { 12154 ancestorScroll && ancestor.addEventListener("scroll", update, { 12155 passive: true 12156 }); 12157 ancestorResize && ancestor.addEventListener("resize", update); 12158 }); 12159 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 12160 let reobserveFrame = -1; 12161 let resizeObserver = null; 12162 if (elementResize) { 12163 resizeObserver = new ResizeObserver((_ref) => { 12164 let [firstEntry] = _ref; 12165 if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { 12166 resizeObserver.unobserve(floating); 12167 cancelAnimationFrame(reobserveFrame); 12168 reobserveFrame = requestAnimationFrame(() => { 12169 resizeObserver && resizeObserver.observe(floating); 12170 }); 12171 } 12172 update(); 12173 }); 12174 if (referenceEl && !animationFrame) { 12175 resizeObserver.observe(referenceEl); 12176 } 12177 resizeObserver.observe(floating); 12178 } 12179 let frameId; 12180 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 12181 if (animationFrame) { 12182 frameLoop(); 12183 } 12184 function frameLoop() { 12185 const nextRefRect = getBoundingClientRect(reference); 12186 if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) { 12187 update(); 12188 } 12189 prevRefRect = nextRefRect; 12190 frameId = requestAnimationFrame(frameLoop); 12191 } 12192 update(); 12193 return () => { 12194 ancestors.forEach((ancestor) => { 12195 ancestorScroll && ancestor.removeEventListener("scroll", update); 12196 ancestorResize && ancestor.removeEventListener("resize", update); 12197 }); 12198 cleanupIo && cleanupIo(); 12199 resizeObserver && resizeObserver.disconnect(); 12200 resizeObserver = null; 12201 if (animationFrame) { 12202 cancelAnimationFrame(frameId); 12203 } 12204 }; 12205 } 12206 var computePosition2 = (reference, floating, options) => { 12207 const cache = /* @__PURE__ */ new Map(); 12208 const mergedOptions = { 12209 platform, 12210 ...options 12211 }; 12212 const platformWithCache = { 12213 ...mergedOptions.platform, 12214 _c: cache 12215 }; 12216 return computePosition(reference, floating, { 12217 ...mergedOptions, 12218 platform: platformWithCache 12219 }); 12220 }; 12221 function src_default8(Alpine3) { 12222 Alpine3.magic("anchor", (el) => { 12223 if (!el._x_anchor) 12224 throw "Alpine: No x-anchor directive found on element using $anchor..."; 12225 return el._x_anchor; 12226 }); 12227 Alpine3.interceptClone((from, to) => { 12228 if (from && from._x_anchor && !to._x_anchor) { 12229 to._x_anchor = from._x_anchor; 12230 } 12231 }); 12232 Alpine3.directive("anchor", Alpine3.skipDuringClone( 12233 (el, { expression, modifiers, value }, { evaluate: evaluate22, effect: effect3, cleanup: cleanup2 }) => { 12234 let { placement, offsetValue, unstyled, strategy, allowFlip } = getOptions(modifiers); 12235 el._x_anchor = Alpine3.reactive({ x: 0, y: 0 }); 12236 let previousReference = null; 12237 let release2 = null; 12238 effect3(() => { 12239 let reference = evaluate22(expression); 12240 if (!reference) 12241 return; 12242 if (previousReference !== reference) { 12243 if (release2) 12244 release2(); 12245 previousReference = reference; 12246 let compute = () => { 12247 let previousValue; 12248 computePosition2(reference, el, { 12249 placement, 12250 strategy, 12251 middleware: [allowFlip && flip(), shift({ padding: 5 }), offset(offsetValue)] 12252 }).then(({ x, y }) => { 12253 unstyled || setStyles2(el, x, y, strategy); 12254 if (JSON.stringify({ x, y }) !== previousValue) { 12255 el._x_anchor.x = x; 12256 el._x_anchor.y = y; 12257 } 12258 previousValue = JSON.stringify({ x, y }); 12259 }); 12260 }; 12261 release2 = autoUpdate(reference, el, () => compute()); 12262 } 12263 }); 12264 cleanup2(() => { 12265 if (release2) 12266 release2(); 12267 }); 12268 }, 12269 (el, { expression, modifiers, value }, { cleanup: cleanup2, evaluate: evaluate22 }) => { 12270 let { placement, offsetValue, unstyled, strategy } = getOptions(modifiers); 12271 if (el._x_anchor) { 12272 unstyled || setStyles2(el, el._x_anchor.x, el._x_anchor.y, strategy); 12273 } 12274 } 12275 )); 12276 } 12277 function setStyles2(el, x, y, strategy = "absolute") { 12278 Object.assign(el.style, { 12279 left: x + "px", 12280 top: y + "px", 12281 position: strategy 12282 }); 12283 } 12284 function getOptions(modifiers) { 12285 let positions = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"]; 12286 let placement = positions.find((i) => modifiers.includes(i)); 12287 let offsetValue = 0; 12288 if (modifiers.includes("offset")) { 12289 let idx = modifiers.findIndex((i) => i === "offset"); 12290 offsetValue = modifiers[idx + 1] !== void 0 ? Number(modifiers[idx + 1]) : offsetValue; 12291 } 12292 let unstyled = modifiers.includes("no-style"); 12293 let allowFlip = !modifiers.includes("noflip"); 12294 let strategy = modifiers.includes("fixed") ? "fixed" : "absolute"; 12295 return { placement, offsetValue, unstyled, strategy, allowFlip }; 12296 } 12297 var module_default8 = src_default8; 12298 12299
12299// js/plugins/history/utils.js 12300 function unwrap(object) { 12301 if (object === void 0) 12302 return void 0; 12303 return JSON.parse(JSON.stringify(object)); 12304 } 12305 function batch(callback) { 12306 let batch2 = { 12307 queued: false, 12308 updates: {}, 12309 add(updates) { 12310 Object.assign(batch2.updates, updates); 12311 if (batch2.queued) 12312 return; 12313 batch2.queued = true; 12314 queueMicrotask(batch2.flush); 12315 }, 12316 flush() { 12317 if (Object.keys(batch2.updates).length) { 12318 callback(batch2.updates); 12319 } 12320 batch2.queued = false; 12321 batch2.updates = {}; 12322 } 12323 }; 12324 return batch2; 12325 } 12326 12327
12327// js/plugins/history/coordinator.js 12328 var HistoryCoordinator = class { 12329 constructor() { 12330 this.url = null; 12331 this.errorHandlers = {}; 12332 this.batch = batch((updates) => { 12333 let url = this.getUrl(); 12334 this.writeToHistory("replaceState", url, (state) => { 12335 state.alpine = { ...state.alpine, ...unwrap(updates) }; 12336 return state; 12337 }); 12338 this.url = null; 12339 }); 12340 } 12341 addErrorHandler(key, callback) { 12342 this.errorHandlers[key] = callback; 12343 } 12344 getUrl() { 12345 if (this.url) { 12346 if (this.url instanceof URL) 12347 this.url.hash = window.location.hash; 12348 return this.url; 12349 } 12350 return new URL(window.location.href); 12351 } 12352 replaceState(url, updates) { 12353 this.url = url; 12354 this.batch.add(updates); 12355 } 12356 pushState(url, updates) { 12357 this.batch.flush(); 12358 this.writeToHistory("pushState", url, (state) => { 12359 state = { alpine: { ...state.alpine, ...unwrap(updates) } }; 12360 return state; 12361 }); 12362 } 12363 writeToHistory(method, url, callback) { 12364 let state = window.history.state ? { ...window.history.state } : {}; 12365 if (!state.alpine) 12366 state.alpine = {}; 12367 state = callback(state);
12368 try { 12369 window.history[method](state, "", url.toString()); 12370 } catch (error2) { 12371 Object.values(this.errorHandlers).forEach( 12372 (handler4) => typeof handler4 === "function" && handler4(error2, url) 12373 ); 12374 this.errorHandlers = {}; 12375 console.error(error2); 12376 } 12377 } 12378 }; 12379 var historyCoordinator = new HistoryCoordinator(); 12380 var coordinator_default = historyCoordinator; 12381 12382
12382// js/plugins/navigate/history.js 12383 var Snapshot = class { 12384 constructor(url, html) { 12385 this.url = url; 12386 this.html = html; 12387 } 12388 }; 12389 var snapshotCache = { 12390 currentKey: null, 12391 currentUrl: null, 12392 keys: [], 12393 lookup: {}, 12394 limit: 10, 12395 has(location) { 12396 return this.lookup[location] !== void 0; 12397 }, 12398 retrieve(location) { 12399 let snapshot = this.lookup[location]; 12400 if (snapshot === void 0) 12401 throw "No back button cache found for current location: " + location; 12402 return snapshot; 12403 }, 12404 replace(key, snapshot) { 12405 if (this.has(key)) { 12406 this.lookup[key] = snapshot; 12407 } else { 12408 this.push(key, snapshot); 12409 } 12410 }, 12411 push(key, snapshot) { 12412 this.lookup[key] = snapshot; 12413 let index2 = this.keys.indexOf(key); 12414 if (index2 > -1) 12415 this.keys.splice(index2, 1); 12416 this.keys.unshift(key); 12417 this.trim(); 12418 }, 12419 trim() { 12420 for (let key of this.keys.splice(this.limit)) { 12421 delete this.lookup[key]; 12422 } 12423 } 12424 }; 12425 var currentPageStatus = null; 12426 function storeCurrentPageStatus(status) { 12427 currentPageStatus = status; 12428 } 12429 function updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks() { 12430 let url = coordinator_default.getUrl(); 12431 replaceUrl(url, document.documentElement.outerHTML); 12432 } 12433 function updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(key, url) { 12434 let html = document.documentElement.outerHTML; 12435 snapshotCache.replace(key, new Snapshot(url, html)); 12436 } 12437 function whenTheBackOrForwardButtonIsClicked(registerFallback, handleHtml) { 12438 let fallback2; 12439 registerFallback((i) => fallback2 = i); 12440 window.addEventListener("popstate", (e) => { 12441 let state = e.state || {}; 12442 let alpine = state.alpine || {}; 12443 if (currentPageStatus && (currentPageStatus < 200 || currentPageStatus >= 300)) { 12444 return window.location.href = alpine.url; 12445 } 12446 if (Object.keys(state).length === 0) 12447 return; 12448 if (!alpine.snapshotIdx) 12449 return; 12450 if (snapshotCache.has(alpine.snapshotIdx)) { 12451 let snapshot = snapshotCache.retrieve(alpine.snapshotIdx); 12452 handleHtml(snapshot.html, snapshot.url, snapshotCache.currentUrl, snapshotCache.currentKey); 12453 snapshotCache.currentKey = alpine.snapshotIdx; 12454 snapshotCache.currentUrl = snapshot.url; 12455 } else { 12456 snapshotCache.currentKey = null; 12457 snapshotCache.currentUrl = null; 12458 fallback2(alpine.url); 12459 } 12460 }); 12461 } 12462 function updateUrlAndStoreLatestHtmlForFutureBackButtons(html, destination) { 12463 pushUrl(destination, html); 12464 } 12465 function pushUrl(url, html) { 12466 updateUrl("pushState", url, html); 12467 } 12468 function replaceUrl(url, html) { 12469 updateUrl("replaceState", url, html); 12470 } 12471 function updateUrl(method, url, html) { 12472 let key = url.toString() + "-" + Math.random(); 12473 method === "pushState" ? snapshotCache.push(key, new Snapshot(url, html)) : snapshotCache.replace(key = snapshotCache.currentKey ?? key, new Snapshot(url, html)); 12474 coordinator_default.addErrorHandler("navigate", (error2) => { 12475 if (error2 instanceof DOMException && error2.name === "SecurityError") { 12476 console.error( 12477 "Livewire: You can't use wire:navigate with a link to a different root domain: " + url 12478 ); 12479 } 12480 }); 12481 coordinator_default[method](url, { snapshotIdx: key, url: url.toString() }); 12482 snapshotCache.currentKey = key; 12483 snapshotCache.currentUrl = url; 12484 } 12485 12486
12486// js/plugins/navigate/links.js 12487 function whenThisLinkIsPressed(el, callback) { 12488 let isProgrammaticClick = (e) => !e.isTrusted; 12489 let isNotPlainLeftClick = (e) => e.which > 1 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; 12490 let isNotPlainEnterKey = (e) => e.which !== 13 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; 12491 el.addEventListener("click", (e) => { 12492 if (isProgrammaticClick(e)) { 12493 if (linkShouldBeHandledNatively(el)) 12494 return; 12495 e.preventDefault(); 12496 callback((whenReleased) => whenReleased()); 12497 return; 12498 } 12499 if (isNotPlainLeftClick(e)) 12500 return; 12501 if (linkShouldBeHandledNatively(el)) 12502 return; 12503 e.preventDefault(); 12504 }); 12505 el.addEventListener("mousedown", (e) => { 12506 if (isNotPlainLeftClick(e)) 12507 return; 12508 if (linkShouldBeHandledNatively(el)) 12509 return; 12510 e.preventDefault(); 12511 callback((whenReleased) => { 12512 let handler4 = (e2) => { 12513 e2.preventDefault(); 12514 requestAnimationFrame(() => { 12515 whenReleased(); 12516 }); 12517 el.removeEventListener("mouseup", handler4); 12518 }; 12519 el.addEventListener("mouseup", handler4); 12520 }); 12521 }); 12522 el.addEventListener("keydown", (e) => { 12523 if (isNotPlainEnterKey(e)) 12524 return; 12525 if (linkShouldBeHandledNatively(el)) 12526 return; 12527 e.preventDefault(); 12528 callback((whenReleased) => whenReleased()); 12529 }); 12530 } 12531 function whenThisLinkIsHoveredFor(el, ms = 60, callback) { 12532 el.addEventListener("mouseenter", (e) => { 12533 let timeout = setTimeout(() => { 12534 callback(e); 12535 }, ms); 12536 let handler4 = () => { 12537 clearTimeout(timeout); 12538 el.removeEventListener("mouseleave", handler4); 12539 }; 12540 el.addEventListener("mouseleave", handler4); 12541 }); 12542 } 12543 function extractDestinationFromLink(linkEl) { 12544 return createUrlObjectFromString2(linkEl.getAttribute("href")); 12545 } 12546 function createUrlObjectFromString2(urlString) { 12547 return urlString !== null && new URL(urlString, document.baseURI); 12548 } 12549 function linkShouldBeHandledNatively(linkEl, destination = extractDestinationFromLink(linkEl)) { 12550 if (!destination) 12551 return true; 12552 if (!["http:", "https:"].includes(destination.protocol)) 12553 return true; 12554 if (destination.origin !== window.location.origin) 12555 return true; 12556 if (linkEl.hasAttribute("download")) 12557 return true; 12558 let target = linkEl.getAttribute("target")?.trim().toLowerCase(); 12559 if (target && target !== "_self") 12560 return true; 12561 return false; 12562 } 12563 function getUriStringFromUrlObject(urlObject) { 12564 return urlObject.pathname + urlObject.search + urlObject.hash; 12565 } 12566 12567
12567// js/plugins/navigate/fetch.js 12568 function fetchHtml(destination, callback, errorCallback) { 12569 let uri = getUriStringFromUrlObject(destination); 12570 performFetch(uri, (html, finalDestination, status) => { 12571 storeCurrentPageStatus(status); 12572 callback(html, finalDestination); 12573 }, errorCallback); 12574 } 12575 function performFetch(uri, callback, errorCallback) { 12576 sendNavigateRequest(uri, callback, errorCallback); 12577 } 12578 12579
12579// js/plugins/navigate/prefetch.js 12580 var prefetches = {}; 12581 var cacheDuration = 3e4; 12582 function prefetchHtml(destination, callback, errorCallback) { 12583 let uri = getUriStringFromUrlObject(destination); 12584 if (prefetches[uri]) 12585 return; 12586 prefetches[uri] = { finished: false, html: null, whenFinished: () => setTimeout(() => delete prefetches[uri], cacheDuration) }; 12587 performFetch(uri, (html, routedUri, status) => { 12588 storeCurrentPageStatus(status); 12589 callback(html, routedUri); 12590 }, () => { 12591 delete prefetches[uri]; 12592 errorCallback(); 12593 }); 12594 } 12595 function storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination) { 12596 let state = prefetches[getUriStringFromUrlObject(destination)]; 12597 state.html = html; 12598 state.finished = true; 12599 state.finalDestination = finalDestination; 12600 state.whenFinished(); 12601 } 12602 function getPretchedHtmlOr(destination, receive, ifNoPrefetchExists) { 12603 let uri = getUriStringFromUrlObject(destination); 12604 if (!prefetches[uri]) 12605 return ifNoPrefetchExists(); 12606 if (prefetches[uri].finished) { 12607 let html = prefetches[uri].html; 12608 let finalDestination = prefetches[uri].finalDestination; 12609 delete prefetches[uri]; 12610 return receive(html, finalDestination); 12611 } else { 12612 prefetches[uri].whenFinished = () => { 12613 let html = prefetches[uri].html; 12614 let finalDestination = prefetches[uri].finalDestination; 12615 delete prefetches[uri]; 12616 receive(html, finalDestination); 12617 }; 12618 } 12619 } 12620 12621
12621// js/plugins/navigate/teleport.js 12622 function packUpPersistedTeleports(persistedEl) { 12623 module_default.mutateDom(() => { 12624 persistedEl.querySelectorAll("[data-teleport-template]").forEach((i) => i._x_teleport.remove()); 12625 }); 12626 } 12627 function removeAnyLeftOverStaleTeleportTargets(body) { 12628 module_default.mutateDom(() => { 12629 body.querySelectorAll("[data-teleport-target]").forEach((i) => i.remove()); 12630 }); 12631 } 12632 function unPackPersistedTeleports(persistedEl) { 12633 module_default.walk(persistedEl, (el, skip) => { 12634 if (!el._x_teleport) 12635 return; 12636 el._x_teleportPutBack(); 12637 skip(); 12638 }); 12639 } 12640 function isTeleportTarget(el) { 12641 return el.hasAttribute("data-teleport-target"); 12642 } 12643 12644
12644// js/plugins/navigate/scroll.js 12645 function storeScrollInformationInHtmlBeforeNavigatingAway() { 12646 document.body.setAttribute("data-scroll-x", document.body.scrollLeft); 12647 document.body.setAttribute("data-scroll-y", document.body.scrollTop); 12648 document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:navigate\\:scroll]"]).forEach((el) => { 12649 el.setAttribute("data-scroll-x", el.scrollLeft); 12650 el.setAttribute("data-scroll-y", el.scrollTop); 12651 }); 12652 } 12653 function restoreScrollPositionOrScrollToTop() { 12654 let scroll = (el) => { 12655 if (!el.hasAttribute("data-scroll-x")) { 12656 window.scrollTo({ top: 0, left: 0, behavior: "instant" }); 12657 } else { 12658 el.scrollTo({ 12659 top: Number(el.getAttribute("data-scroll-y")), 12660 left: Number(el.getAttribute("data-scroll-x")), 12661 behavior: "instant" 12662 }); 12663 el.removeAttribute("data-scroll-x"); 12664 el.removeAttribute("data-scroll-y"); 12665 } 12666 }; 12667 queueMicrotask(() => { 12668 queueMicrotask(() => { 12669 scroll(document.body); 12670 document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:navigate\\:scroll]"]).forEach(scroll); 12671 }); 12672 }); 12673 } 12674 12675
12675// js/plugins/navigate/persist.js 12676 var els = {}; 12677 function storePersistantElementsForLater(callback) { 12678 els = {}; 12679 document.querySelectorAll("[x-persist]").forEach((i) => { 12680 els[i.getAttribute("x-persist")] = i; 12681 callback(i); 12682 module_default.mutateDom(() => { 12683 i.remove(); 12684 }); 12685 }); 12686 } 12687 function putPersistantElementsBack(callback) { 12688 let usedPersists = []; 12689 document.querySelectorAll("[x-persist]").forEach((i) => { 12690 let old = els[i.getAttribute("x-persist")]; 12691 if (!old) 12692 return; 12693 usedPersists.push(i.getAttribute("x-persist")); 12694 old._x_wasPersisted = true; 12695 callback(old, i); 12696 module_default.mutateDom(() => { 12697 i.replaceWith(old); 12698 }); 12699 }); 12700 Object.entries(els).forEach(([key, el]) => { 12701 if (usedPersists.includes(key)) 12702 return; 12703 module_default.destroyTree(el); 12704 }); 12705 els = {}; 12706 } 12707 function isPersistedElement(el) { 12708 return el.hasAttribute("x-persist"); 12709 } 12710 12711
12711// js/plugins/navigate/bar.js 12712 var import_nprogress = __toESM(require_nprogress()); 12713 import_nprogress.default.configure({ 12714 minimum: 0.1, 12715 trickleSpeed: 200, 12716 showSpinner: false, 12717 parent: "body" 12718 }); 12719 injectStyles(); 12720 var inProgress = false; 12721 function showAndStartProgressBar() { 12722 inProgress = true; 12723 setTimeout(() => { 12724 if (!inProgress) 12725 return; 12726 import_nprogress.default.start(); 12727 }, 150); 12728 } 12729 function finishAndHideProgressBar() { 12730 inProgress = false; 12731 import_nprogress.default.done(); 12732 } 12733 function removeAnyLeftOverStaleProgressBars() { 12734 import_nprogress.default.remove(); 12735 } 12736 function injectStyles() { 12737 let style = document.createElement("style"); 12738 style.innerHTML = `/* Make clicks pass-through */ 12739 12740 #nprogress { 12741 pointer-events: none; 12742 } 12743 12744 #nprogress .bar { 12745 background: var(--livewire-progress-bar-color, #29d); 12746 12747 position: fixed; 12748 z-index: 1031; 12749 top: 0; 12750 left: 0; 12751 12752 width: 100%; 12753 height: 2px; 12754 } 12755 12756 /* Fancy blur effect */ 12757 #nprogress .peg { 12758 display: block; 12759 position: absolute; 12760 right: 0px; 12761 width: 100px; 12762 height: 100%; 12763 box-shadow: 0 0 10px var(--livewire-progress-bar-color, #29d), 0 0 5px var(--livewire-progress-bar-color, #29d); 12764 opacity: 1.0; 12765 12766 -webkit-transform: rotate(3deg) translate(0px, -4px); 12767 -ms-transform: rotate(3deg) translate(0px, -4px); 12768 transform: rotate(3deg) translate(0px, -4px); 12769 } 12770 12771 /* Remove these to get rid of the spinner */ 12772 #nprogress .spinner { 12773 display: block; 12774 position: fixed; 12775 z-index: 1031; 12776 top: 15px; 12777 right: 15px; 12778 } 12779 12780 #nprogress .spinner-icon { 12781 width: 18px; 12782 height: 18px; 12783 box-sizing: border-box; 12784 12785 border: solid 2px transparent; 12786 border-top-color: var(--livewire-progress-bar-color, #29d); 12787 border-left-color: var(--livewire-progress-bar-color, #29d); 12788 border-radius: 50%; 12789 12790 -webkit-animation: nprogress-spinner 400ms linear infinite; 12791 animation: nprogress-spinner 400ms linear infinite; 12792 } 12793 12794 .nprogress-custom-parent { 12795 overflow: hidden; 12796 position: relative; 12797 } 12798 12799 .nprogress-custom-parent #nprogress .spinner, 12800 .nprogress-custom-parent #nprogress .bar { 12801 position: absolute; 12802 } 12803 12804 @-webkit-keyframes nprogress-spinner { 12805 0% { -webkit-transform: rotate(0deg); } 12806 100% { -webkit-transform: rotate(360deg); } 12807 } 12808 @keyframes nprogress-spinner { 12809 0% { transform: rotate(0deg); } 12810 100% { transform: rotate(360deg); } 12811 } 12812 `; 12813 let nonce2 = getNonce(); 12814 if (nonce2) 12815 style.nonce = nonce2; 12816 document.head.appendChild(style); 12817 } 12818 12819
12819// js/plugins/navigate/popover.js 12820 function packUpPersistedPopovers(persistedEl) { 12821 if (!isPopoverSupported()) 12822 return; 12823 persistedEl.querySelectorAll(":popover-open").forEach((el) => { 12824 el.setAttribute("data-navigate-popover-open", ""); 12825 let animations = el.getAnimations(); 12826 el._pausedAnimations = animations.map((animation) => ({ 12827 keyframes: animation.effect.getKeyframes(), 12828 options: { 12829 duration: animation.effect.getTiming().duration, 12830 easing: animation.effect.getTiming().easing, 12831 fill: animation.effect.getTiming().fill, 12832 iterations: animation.effect.getTiming().iterations 12833 }, 12834 currentTime: animation.currentTime, 12835 playState: animation.playState 12836 })); 12837 animations.forEach((i) => i.pause()); 12838 }); 12839 } 12840 function unPackPersistedPopovers(persistedEl) { 12841 if (!isPopoverSupported()) 12842 return; 12843 persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { 12844 el.removeAttribute("data-navigate-popover-open"); 12845 queueMicrotask(() => { 12846 if (!el.isConnected) 12847 return; 12848 el.showPopover(); 12849 el.getAnimations().forEach((i) => i.finish()); 12850 if (el._pausedAnimations) { 12851 el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { 12852 let animation = el.animate(keyframes, options); 12853 animation.currentTime = currentTime; 12854 }); 12855 delete el._pausedAnimations; 12856 } 12857 }); 12858 }); 12859 } 12860 function isPopoverSupported() { 12861 return typeof document.createElement("div").showPopover === "function"; 12862 } 12863 12864
12864// js/plugins/navigate/page.js 12865 var oldBodyScriptTagHashes = []; 12866 var attributesExemptFromScriptTagHashing = [ 12867 "data-csrf", 12868 "nonce", 12869 "aria-hidden" 12870 ]; 12871 function swapCurrentPageWithNewHtml(html, andThen) { 12872 html = replaceNoncesInHtml(html); 12873 let newDocument = new DOMParser().parseFromString(html, "text/html"); 12874 let newHtml = newDocument.documentElement; 12875 let newBody = document.adoptNode(newDocument.body); 12876 let newHead = document.adoptNode(newDocument.head); 12877 oldBodyScriptTagHashes = oldBodyScriptTagHashes.concat(Array.from(document.body.querySelectorAll("script")).map((i) => { 12878 return simpleHash(ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing)); 12879 })); 12880 let afterRemoteScriptsHaveLoaded = () => { 12881 }; 12882 replaceHtmlAttributes(newHtml); 12883 mergeNewHead(newHead).finally(() => { 12884 afterRemoteScriptsHaveLoaded(); 12885 }); 12886 prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes); 12887 let oldBody = document.body; 12888 document.body.replaceWith(newBody); 12889 Alpine.destroyTree(oldBody); 12890 andThen((i) => afterRemoteScriptsHaveLoaded = i); 12891 } 12892 function prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes2) { 12893 newBody.querySelectorAll("script").forEach((i) => { 12894 if (i.hasAttribute("data-navigate-once")) { 12895 let hash = simpleHash( 12896 ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing) 12897 ); 12898 if (oldBodyScriptTagHashes2.includes(hash)) 12899 return; 12900 } 12901 i.replaceWith(cloneScriptTag(i)); 12902 }); 12903 } 12904 function replaceHtmlAttributes(newHtmlElement) { 12905 let currentHtmlElement = document.documentElement; 12906 Array.from(newHtmlElement.attributes).forEach((attr) => { 12907 const name = attr.name; 12908 const value = attr.value; 12909 if (currentHtmlElement.getAttribute(name) !== value) { 12910 currentHtmlElement.setAttribute(name, value); 12911 } 12912 }); 12913 Array.from(currentHtmlElement.attributes).forEach((attr) => { 12914 if (!newHtmlElement.hasAttribute(attr.name)) { 12915 currentHtmlElement.removeAttribute(attr.name); 12916 } 12917 }); 12918 } 12919 function mergeNewHead(newHead) {
12920 let children = Array.from(document.head.children); 12921 let headChildrenHtmlLookup = children.map( 12922 (i) => ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing) 12923 ); 12924 let garbageCollector = document.createDocumentFragment(); 12925 let touchedHeadElements = []; 12926 let remoteScriptsPromises = []; 12927 for (let child of Array.from(newHead.children)) { 12928 if (isAsset(child)) { 12929 let childHtml = ignoreAttributes(child.outerHTML, attributesExemptFromScriptTagHashing); 12930 if (!headChildrenHtmlLookup.includes(childHtml)) { 12931 if (isTracked(child)) { 12932 if (ifTheQueryStringChangedSinceLastRequest(child, children)) { 12933 setTimeout(() => window.location.reload()); 12934 } 12935 } 12936 if (isScript(child)) { 12937 try { 12938 remoteScriptsPromises.push( 12939 injectScriptTagAndWaitForItToFullyLoad( 12940 cloneScriptTag(child) 12941 ) 12942 ); 12943 } catch (error2) { 12944 } 12945 } else { 12946 document.head.appendChild(child); 12947 } 12948 } else { 12949 garbageCollector.appendChild(child); 12950 } 12951 touchedHeadElements.push(child); 12952 } 12953 } 12954 for (let child of Array.from(document.head.children)) { 12955 if (!isAsset(child)) 12956 child.remove(); 12957 } 12958 for (let child of Array.from(newHead.children)) { 12959 if (child.tagName.toLowerCase() === "noscript") 12960 continue; 12961 document.head.appendChild(child); 12962 } 12963 return Promise.all(remoteScriptsPromises); 12964 } 12965 async function injectScriptTagAndWaitForItToFullyLoad(script) { 12966 return new Promise((resolve, reject) => { 12967 if (script.src) { 12968 script.onload = () => resolve(); 12969 script.onerror = () => reject(); 12970 } else { 12971 resolve(); 12972 } 12973 document.head.appendChild(script); 12974 }); 12975 } 12976 function isTracked(el) { 12977 return el.hasAttribute("data-navigate-track"); 12978 } 12979 function ifTheQueryStringChangedSinceLastRequest(el, currentHeadChildren) { 12980 let [uri, queryString] = extractUriAndQueryString(el); 12981 return currentHeadChildren.some((child) => { 12982 if (!isTracked(child)) 12983 return false; 12984 let [currentUri, currentQueryString] = extractUriAndQueryString(child); 12985 if (currentUri === uri && queryString !== currentQueryString) 12986 return true; 12987 }); 12988 } 12989 function extractUriAndQueryString(el) { 12990 let url = isScript(el) ? el.src : el.href; 12991 return url.split("?"); 12992 } 12993 function isAsset(el) { 12994 return el.tagName.toLowerCase() === "link" && el.getAttribute("rel").toLowerCase() === "stylesheet" || el.tagName.toLowerCase() === "style" || el.tagName.toLowerCase() === "script"; 12995 } 12996 function isScript(el) { 12997 return el.tagName.toLowerCase() === "script"; 12998 } 12999 function simpleHash(str) { 13000 return str.split("").reduce((a, b) => { 13001 a = (a << 5) - a + b.charCodeAt(0); 13002 return a & a; 13003 }, 0); 13004 } 13005 function ignoreAttributes(subject, attributesToRemove) { 13006 let result = subject; 13007 attributesToRemove.forEach((attr) => { 13008 const regex = new RegExp(`${attr}="[^"]*"|${attr}='[^']*'`, "g"); 13009 result = result.replace(regex, ""); 13010 }); 13011 result = result.replaceAll(" ", ""); 13012 return result.trim(); 13013 } 13014 13015
13015// js/plugins/navigate/index.js 13016 var enablePersist = true; 13017 var showProgressBar = true; 13018 var restoreScroll = true; 13019 function navigate_default(Alpine3) { 13020 Alpine3.navigate = (url, options = {}) => { 13021 let { preserveScroll = false } = options; 13022 let destination = createUrlObjectFromString2(url); 13023 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 13024 url: destination, 13025 history: false, 13026 cached: false 13027 }); 13028 if (prevented) 13029 return; 13030 navigateTo(destination, { preserveScroll }); 13031 }; 13032 Alpine3.navigate.disableProgressBar = () => { 13033 showProgressBar = false; 13034 }; 13035 Alpine3.addInitSelector(() => `[${Alpine3.prefixed("navigate")}]`); 13036 Alpine3.directive("navigate", (el, { modifiers }) => { 13037 let shouldPrefetchOnHover = modifiers.includes("hover"); 13038 let preserveScroll = modifiers.includes("preserve-scroll"); 13039 shouldPrefetchOnHover && whenThisLinkIsHoveredFor(el, 60, () => { 13040 let destination = extractDestinationFromLink(el); 13041 if (linkShouldBeHandledNatively(el, destination)) 13042 return; 13043 prefetchHtml(destination, (html, finalDestination) => { 13044 storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); 13045 }, () => { 13046 showProgressBar && finishAndHideProgressBar(); 13047 }); 13048 }); 13049 whenThisLinkIsPressed(el, (whenItIsReleased) => { 13050 let destination = extractDestinationFromLink(el); 13051 prefetchHtml(destination, (html, finalDestination) => { 13052 storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); 13053 }, () => { 13054 showProgressBar && finishAndHideProgressBar(); 13055 }); 13056 whenItIsReleased(() => { 13057 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 13058 url: destination, 13059 history: false, 13060 cached: false 13061 }); 13062 if (prevented) 13063 return; 13064 navigateTo(destination, { preserveScroll }); 13065 }); 13066 }); 13067 }); 13068 function navigateTo(destination, { preserveScroll = false, shouldPushToHistoryState = true }) { 13069 showProgressBar && showAndStartProgressBar(); 13070 fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { 13071 let swapCallbacks = []; 13072 fireEventForOtherLibrariesToHookInto("alpine:navigating", { 13073 onSwap: (callback) => swapCallbacks.push(callback) 13074 }); 13075 restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); 13076 cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); 13077 shouldPushToHistoryState && updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks(); 13078 preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { 13079 enablePersist && storePersistantElementsForLater((persistedEl) => { 13080 packUpPersistedTeleports(persistedEl); 13081 packUpPersistedPopovers(persistedEl); 13082 }); 13083 if (shouldPushToHistoryState) { 13084 updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); 13085 } else { 13086 replaceUrl(finalDestination, html); 13087 } 13088 swapCurrentPageWithNewHtml(html, (afterNewScriptsAreDoneLoading) => { 13089 removeAnyLeftOverStaleTeleportTargets(document.body); 13090 enablePersist && putPersistantElementsBack((persistedEl, newStub) => { 13091 unPackPersistedTeleports(persistedEl); 13092 unPackPersistedPopovers(persistedEl); 13093 }); 13094 !preserveScroll && restoreScrollPositionOrScrollToTop(); 13095 swapCallbacks.forEach((callback) => callback()); 13096 afterNewScriptsAreDoneLoading(() => { 13097 andAfterAllThis(() => { 13098 nowInitializeAlpineOnTheNewPage(Alpine3); 13099 autofocusElementsWithTheAutofocusAttribute(); 13100 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 13101 showProgressBar && finishAndHideProgressBar(); 13102 }); 13103 }); 13104 }); 13105 }); 13106 }, () => { 13107 showProgressBar && finishAndHideProgressBar(); 13108 }); 13109 } 13110 whenTheBackOrForwardButtonIsClicked(
13111 (ifThePageBeingVisitedHasntBeenCached) => { 13112 ifThePageBeingVisitedHasntBeenCached((url) => { 13113 let destination = createUrlObjectFromString2(url); 13114 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 13115 url: destination, 13116 history: true, 13117 cached: false 13118 }); 13119 if (prevented) 13120 return; 13121 navigateTo(destination, { shouldPushToHistoryState: false }); 13122 }); 13123 }, 13124 (html, url, currentPageUrl, currentPageKey) => { 13125 let destination = createUrlObjectFromString2(url); 13126 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 13127 url: destination, 13128 history: true, 13129 cached: true 13130 }); 13131 if (prevented) 13132 return; 13133 storeScrollInformationInHtmlBeforeNavigatingAway(); 13134 let swapCallbacks = []; 13135 fireEventForOtherLibrariesToHookInto("alpine:navigating", { 13136 onSwap: (callback) => swapCallbacks.push(callback) 13137 }); 13138 cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); 13139 updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageKey, currentPageUrl); 13140 preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { 13141 enablePersist && storePersistantElementsForLater((persistedEl) => { 13142 packUpPersistedTeleports(persistedEl); 13143 packUpPersistedPopovers(persistedEl); 13144 }); 13145 swapCurrentPageWithNewHtml(html, () => { 13146 removeAnyLeftOverStaleProgressBars(); 13147 removeAnyLeftOverStaleTeleportTargets(document.body); 13148 enablePersist && putPersistantElementsBack((persistedEl, newStub) => { 13149 unPackPersistedTeleports(persistedEl); 13150 unPackPersistedPopovers(persistedEl); 13151 }); 13152 restoreScrollPositionOrScrollToTop(); 13153 swapCallbacks.forEach((callback) => callback()); 13154 andAfterAllThis(() => { 13155 nowInitializeAlpineOnTheNewPage(Alpine3); 13156 autofocusElementsWithTheAutofocusAttribute(); 13157 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 13158 }); 13159 }); 13160 }); 13161 } 13162 ); 13163 setTimeout(() => { 13164 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 13165 }); 13166 } 13167 function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback, errorCallback) { 13168 getPretchedHtmlOr(fromDestination, callback, () => { 13169 fetchHtml(fromDestination, callback, errorCallback); 13170 }); 13171 } 13172 function preventAlpineFromPickingUpDomChanges(Alpine3, callback) { 13173 Alpine3.stopObservingMutations(); 13174 callback((afterAllThis) => { 13175 Alpine3.startObservingMutations(); 13176 queueMicrotask(() => { 13177 afterAllThis(); 13178 }); 13179 }); 13180 } 13181 function fireEventForOtherLibrariesToHookInto(name, detail) { 13182 let event = new CustomEvent(name, { 13183 cancelable: true, 13184 bubbles: true, 13185 detail 13186 }); 13187 document.dispatchEvent(event); 13188 return event.defaultPrevented; 13189 } 13190 function nowInitializeAlpineOnTheNewPage(Alpine3) { 13191 Alpine3.initTree(document.body, void 0, (el, skip) => { 13192 if (el._x_wasPersisted) 13193 skip(); 13194 }); 13195 } 13196 function autofocusElementsWithTheAutofocusAttribute() { 13197 document.querySelector("[autofocus]") && document.querySelector("[autofocus]").focus(); 13198 } 13199 function cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement() { 13200 let walker = function(root, callback) { 13201 Alpine.walk(root, (el, skip) => { 13202 if (isPersistedElement(el)) 13203 skip(); 13204 if (isTeleportTarget(el)) 13205 skip(); 13206 else 13207 callback(el, skip); 13208 }); 13209 }; 13210 Alpine.destroyTree(document.body, walker); 13211 } 13212 13213
13213// js/plugins/history/index.js 13214 function history(Alpine3) { 13215 Alpine3.magic("queryString", (el, { interceptor: interceptor2 }) => { 13216 let alias; 13217 let alwaysShow = false; 13218 let usePush = false; 13219 return interceptor2((initialSeedValue, getter, setter, path, key) => { 13220 let queryKey = alias || path; 13221 let { initial, replace: replace2, push: push2, pop } = track2(queryKey, initialSeedValue, alwaysShow); 13222 setter(initial); 13223 if (!usePush) { 13224 Alpine3.effect(() => replace2(getter())); 13225 } else { 13226 Alpine3.effect(() => push2(getter())); 13227 pop(async (newValue) => { 13228 setter(newValue); 13229 let tillTheEndOfTheMicrotaskQueue = () => Promise.resolve(); 13230 await tillTheEndOfTheMicrotaskQueue(); 13231 }); 13232 } 13233 return initial; 13234 }, (func) => { 13235 func.alwaysShow = () => { 13236 alwaysShow = true; 13237 return func; 13238 }; 13239 func.usePush = () => { 13240 usePush = true; 13241 return func; 13242 }; 13243 func.as = (key) => { 13244 alias = key; 13245 return func; 13246 }; 13247 }); 13248 }); 13249 Alpine3.history = { track: track2 }; 13250 } 13251 function track2(name, initialSeedValue, alwaysShow = false, except = null) { 13252 let { has: has2, get: get3, set: set3, remove } = queryStringUtils(); 13253 let url = coordinator_default.getUrl(); 13254 let isInitiallyPresentInUrl = has2(url, name); 13255 let initialValue = isInitiallyPresentInUrl ? get3(url, name) : initialSeedValue; 13256 let initialValueMemo = JSON.stringify(initialValue); 13257 let exceptValueMemo = JSON.stringify(except); 13258 let hasReturnedToInitialValue = (newValue) => JSON.stringify(newValue) === initialValueMemo; 13259 let hasReturnedToExceptValue = (newValue) => JSON.stringify(newValue) === exceptValueMemo; 13260 if (alwaysShow) 13261 url = set3(url, name, initialValue); 13262 replace(url, name, { value: initialValue }); 13263 let lock = false; 13264 let update = (strategy, newValue) => { 13265 if (lock) 13266 return; 13267 let url2 = coordinator_default.getUrl(); 13268 if (!alwaysShow && !isInitiallyPresentInUrl && hasReturnedToInitialValue(newValue)) { 13269 url2 = remove(url2, name); 13270 } else if (newValue === void 0) { 13271 url2 = remove(url2, name); 13272 } else if (!alwaysShow && hasReturnedToExceptValue(newValue)) { 13273 url2 = remove(url2, name); 13274 } else { 13275 url2 = set3(url2, name, newValue); 13276 } 13277 strategy(url2, name, { value: newValue }); 13278 }; 13279 return { 13280 initial: initialValue, 13281 replace(newValue) { 13282 update(replace, newValue); 13283 }, 13284 push(newValue) { 13285 update(push, newValue); 13286 }, 13287 pop(receiver) { 13288 let handler4 = (e) => { 13289 if (!e.state || !e.state.alpine) 13290 return; 13291 Object.entries(e.state.alpine).forEach(([iName, { value: newValue }]) => { 13292 if (iName !== name) 13293 return; 13294 lock = true; 13295 let result = receiver(newValue); 13296 if (result instanceof Promise) { 13297 result.finally(() => lock = false); 13298 } else { 13299 lock = false; 13300 } 13301 }); 13302 }; 13303 window.addEventListener("popstate", handler4); 13304 return () => window.removeEventListener("popstate", handler4); 13305 } 13306 }; 13307 } 13308 function replace(url, key, object) { 13309 coordinator_default.replaceState(url, { [key]: object }); 13310 } 13311 function push(url, key, object) { 13312 coordinator_default.pushState(url, { [key]: object }); 13313 } 13314 function queryStringUtils() { 13315 return { 13316 has(url, key) { 13317 let search = url.search; 13318 if (!search) 13319 return false; 13320 let data2 = fromQueryString(search, key); 13321 return dataGet(data2, key) !== void 0; 13322 }, 13323 get(url, key) { 13324 let search = url.search; 13325 if (!search) 13326 return false; 13327 let data2 = fromQueryString(search, key); 13328 return dataGet(data2, key); 13329 }, 13330 set(url, key, value) { 13331 let data2 = fromQueryString(url.search, key); 13332 dataSet(data2, key, stripNulls(unwrap(value))); 13333 url.search = toQueryString(data2); 13334 return url; 13335 }, 13336 remove(url, key) { 13337 let data2 = fromQueryString(url.search, key); 13338 dataDelete(data2, key); 13339 url.search = toQueryString(data2); 13340 return url; 13341 } 13342 }; 13343 } 13344 function stripNulls(value) { 13345 if (!isObjecty(value)) 13346 return value; 13347 for (let key in value) { 13348 if (value[key] === null) 13349 delete value[key]; 13350 else 13351 value[key] = stripNulls(value[key]); 13352 } 13353 return value; 13354 } 13355 function toQueryString(data2) { 13356 let isObjecty2 = (subject) => typeof subject === "object" && subject !== null; 13357 let buildQueryStringEntries = (data3, entries2 = {}, baseKey = "") => { 13358 Object.entries(data3).forEach(([iKey, iValue]) => { 13359 let key = baseKey === "" ? iKey : `${baseKey}[${iKey}]`; 13360 if (iValue === null) {
13361 entries2[key] = ""; 13362 } else if (!isObjecty2(iValue)) { 13363 entries2[key] = encodeURIComponent(iValue).replaceAll("%20", "+").replaceAll("%2C", ","); 13364 } else { 13365 entries2 = { ...entries2, ...buildQueryStringEntries(iValue, entries2, key) }; 13366 } 13367 }); 13368 return entries2; 13369 }; 13370 let entries = buildQueryStringEntries(data2); 13371 return Object.entries(entries).map(([key, value]) => `${key}=${value}`).join("&"); 13372 } 13373 function fromQueryString(search, queryKey) { 13374 search = search.replace("?", ""); 13375 if (search === "") 13376 return {}; 13377 let insertDotNotatedValueIntoData = (key, value, data3) => { 13378 let [first2, second, ...rest] = key.split("."); 13379 if (first2 === "__proto__" || first2 === "constructor" || first2 === "prototype") 13380 return; 13381 if (!second) 13382 return data3[key] = value; 13383 if (!Object.prototype.hasOwnProperty.call(data3, first2)) { 13384 data3[first2] = isNaN(second) ? /* @__PURE__ */ Object.create(null) : []; 13385 } 13386 insertDotNotatedValueIntoData([second, ...rest].join("."), value, data3[first2]); 13387 }; 13388 let entries = search.split("&").map((i) => i.split("=")); 13389 let data2 = /* @__PURE__ */ Object.create(null); 13390 entries.forEach(([key, value]) => { 13391 if (typeof value == "undefined") 13392 return; 13393 value = decodeURIComponent(value.replaceAll("+", "%20")); 13394 let decodedKey = decodeURIComponent(key); 13395 let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", ""); 13396 let shouldBeHandledAsArray = decodedKey.includes("[") && (dotNotatedKey === queryKey || dotNotatedKey.startsWith(`${queryKey}.`)); 13397 if (!shouldBeHandledAsArray) { 13398 data2[key] = value; 13399 } else { 13400 insertDotNotatedValueIntoData(dotNotatedKey, value, data2); 13401 } 13402 }); 13403 return data2; 13404 } 13405 13406
vendor: 13,840 bytes, lines 13406-13792
13406// node_modules/@alpinejs/morph/dist/module.esm.js 13407 function morph(from, toHtml, options) { 13408 monkeyPatchDomSetAttributeToAllowAtSymbols(); 13409 let context = createMorphContext(options); 13410 let toEl = typeof toHtml === "string" ? createElement(toHtml) : toHtml; 13411 if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) { 13412 toEl._x_dataStack = window.Alpine.closestDataStack(from); 13413 toEl._x_dataStack && window.Alpine.cloneNode(from, toEl); 13414 } 13415 context.patch(from, toEl); 13416 return from; 13417 } 13418 function morphBetween(startMarker, endMarker, toHtml, options = {}) { 13419 monkeyPatchDomSetAttributeToAllowAtSymbols(); 13420 let context = createMorphContext(options); 13421 let fromContainer = startMarker.parentNode; 13422 let fromBlock = new Block(startMarker, endMarker); 13423 let toContainer = typeof toHtml === "string" ? (() => { 13424 let container = document.createElement("div"); 13425 container.insertAdjacentHTML("beforeend", toHtml); 13426 return container; 13427 })() : toHtml; 13428 let toStartMarker = document.createComment("[morph-start]"); 13429 let toEndMarker = document.createComment("[morph-end]"); 13430 toContainer.insertBefore(toStartMarker, toContainer.firstChild); 13431 toContainer.appendChild(toEndMarker); 13432 let toBlock = new Block(toStartMarker, toEndMarker); 13433 if (window.Alpine && window.Alpine.closestDataStack) { 13434 toContainer._x_dataStack = window.Alpine.closestDataStack(fromContainer); 13435 toContainer._x_dataStack && window.Alpine.cloneNode(fromContainer, toContainer); 13436 } 13437 context.patchChildren(fromBlock, toBlock); 13438 } 13439 function createMorphContext(options = {}) { 13440 let defaultGetKey = (el) => el.getAttribute("key"); 13441 let noop = () => { 13442 }; 13443 let context = { 13444 key: options.key || defaultGetKey, 13445 lookahead: options.lookahead || false, 13446 updating: options.updating || noop, 13447 updated: options.updated || noop, 13448 removing: options.removing || noop, 13449 removed: options.removed || noop, 13450 adding: options.adding || noop, 13451 added: options.added || noop 13452 }; 13453 context.patch = function(from, to) { 13454 if (context.differentElementNamesTypesOrKeys(from, to)) { 13455 return context.swapElements(from, to); 13456 } 13457 let updateChildrenOnly = false; 13458 let skipChildren = false; 13459 let skipUntil = (predicate) => context.skipUntilCondition = predicate; 13460 if (shouldSkipChildren(context.updating, () => skipChildren = true, skipUntil, from, to, () => updateChildrenOnly = true)) 13461 return; 13462 if (from.nodeType === 1 && window.Alpine) { 13463 window.Alpine.cloneNode(from, to); 13464 if (from._x_teleport && to._x_teleport) { 13465 context.patch(from._x_teleport, to._x_teleport); 13466 } 13467 } 13468 if (textOrComment(to)) { 13469 context.patchNodeValue(from, to); 13470 context.updated(from, to); 13471 return; 13472 } 13473 if (!updateChildrenOnly) { 13474 context.patchAttributes(from, to); 13475 } 13476 context.updated(from, to); 13477 if (!skipChildren) { 13478 context.patchChildren(from, to); 13479 } 13480 }; 13481 context.differentElementNamesTypesOrKeys = function(from, to) { 13482 return from.nodeType != to.nodeType || from.nodeName != to.nodeName || context.getKey(from) != context.getKey(to); 13483 }; 13484 context.swapElements = function(from, to) { 13485 if (shouldSkip(context.removing, from)) 13486 return; 13487 let toCloned = to.cloneNode(true); 13488 if (shouldSkip(context.adding, toCloned)) 13489 return; 13490 from.replaceWith(toCloned); 13491 context.removed(from); 13492 context.added(toCloned); 13493 }; 13494 context.patchNodeValue = function(from, to) { 13495 let value = to.nodeValue; 13496 if (from.nodeValue !== value) { 13497 from.nodeValue = value; 13498 } 13499 }; 13500 context.patchAttributes = function(from, to) { 13501 if (from._x_transitioning) 13502 return; 13503 if (from._x_isShown && !to._x_isShown) { 13504 return; 13505 } 13506 if (!from._x_isShown && to._x_isShown) { 13507 return; 13508 } 13509 let domAttributes = Array.from(from.attributes); 13510 let toAttributes = Array.from(to.attributes); 13511 for (let i = domAttributes.length - 1; i >= 0; i--) { 13512 let name = domAttributes[i].name; 13513 if (!to.hasAttribute(name)) { 13514 if (name === "open" && from.nodeName === "DIALOG" && from.open) { 13515 from.close(); 13516 } else { 13517 from.removeAttribute(name); 13518 } 13519 } 13520 } 13521 for (let i = toAttributes.length - 1; i >= 0; i--) { 13522 let name = toAttributes[i].name; 13523 let value = toAttributes[i].value; 13524 if (from.getAttribute(name) !== value) { 13525 from.setAttribute(name, value); 13526 } 13527 } 13528 }; 13529 context.patchChildren = function(from, to) { 13530 let fromKeys = context.keyToMap(from.children); 13531 let fromKeyHoldovers = {}; 13532 let currentTo = getFirstNode(to); 13533 let currentFrom = getFirstNode(from); 13534 while (currentTo) { 13535 seedingMatchingId(currentTo, currentFrom); 13536 let toKey = context.getKey(currentTo); 13537 let fromKey = context.getKey(currentFrom); 13538 if (context.skipUntilCondition) { 13539 let fromDone = !currentFrom || context.skipUntilCondition(currentFrom); 13540 let toDone = !currentTo || context.skipUntilCondition(currentTo); 13541 if (fromDone && toDone) { 13542 context.skipUntilCondition = null; 13543 } else { 13544 if (!fromDone) 13545 currentFrom = currentFrom && getNextSibling(from, currentFrom); 13546 if (!toDone) 13547 currentTo = currentTo && getNextSibling(to, currentTo); 13548 continue; 13549 } 13550 } 13551 if (!currentFrom) { 13552 if (toKey && fromKeyHoldovers[toKey]) { 13553 let holdover = fromKeyHoldovers[toKey]; 13554 from.appendChild(holdover); 13555 currentFrom = holdover; 13556 fromKey = context.getKey(currentFrom); 13557 } else { 13558 if (!shouldSkip(context.adding, currentTo)) { 13559 let clone3 = currentTo.cloneNode(true); 13560 from.appendChild(clone3); 13561 context.added(clone3); 13562 } 13563 currentTo = getNextSibling(to, currentTo); 13564 continue; 13565 } 13566 } 13567 let isIf = (node) => node && node.nodeType === 8 && node.textContent === "[if BLOCK]><![endif]"; 13568 let isEnd = (node) => node && node.nodeType === 8 && node.textContent === "[if ENDBLOCK]><![endif]"; 13569 if (isIf(currentTo) && isIf(currentFrom)) { 13570 let nestedIfCount = 0; 13571 let fromBlockStart = currentFrom; 13572 while (currentFrom) { 13573 let next = getNextSibling(from, currentFrom); 13574 if (isIf(next)) { 13575 nestedIfCount++; 13576 } else if (isEnd(next) && nestedIfCount > 0) { 13577 nestedIfCount--; 13578 } else if (isEnd(next) && nestedIfCount === 0) { 13579 currentFrom = next; 13580 break; 13581 } 13582 currentFrom = next; 13583 } 13584 let fromBlockEnd = currentFrom; 13585 nestedIfCount = 0; 13586 let toBlockStart = currentTo; 13587 while (currentTo) { 13588 let next = getNextSibling(to, currentTo); 13589 if (isIf(next)) { 13590 nestedIfCount++; 13591 } else if (isEnd(next) && nestedIfCount > 0) { 13592 nestedIfCount--; 13593 } else if (isEnd(next) && nestedIfCount === 0) { 13594 currentTo = next; 13595 break; 13596 } 13597 currentTo = next; 13598 } 13599 let toBlockEnd = currentTo; 13600 let fromBlock = new Block(fromBlockStart, fromBlockEnd); 13601 let toBlock = new Block(toBlockStart, toBlockEnd); 13602 context.patchChildren(fromBlock, toBlock); 13603 continue; 13604 } 13605 if (currentFrom.nodeType === 1 && context.lookahead && !currentFrom.isEqualNode(currentTo)) { 13606 let nextToElementSibling = getNextSibling(to, currentTo); 13607 let found = false; 13608 while (!found && nextToElementSibling) { 13609 if (nextToElementSibling.nodeType === 1 && currentFrom.isEqualNode(nextToElementSibling)) { 13610 found = true; 13611 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 13612 fromKey = context.getKey(currentFrom); 13613 } 13614 nextToElementSibling = getNextSibling(to, nextToElementSibling); 13615 } 13616 } 13617 if (toKey !== fromKey) { 13618 if (!toKey && fromKey) { 13619 fromKeyHoldovers[fromKey] = currentFrom; 13620 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 13621 fromKeyHoldovers[fromKey].remove(); 13622 currentFrom = getNextSibling(from, currentFrom); 13623 currentTo = getNextSibling(to, currentTo); 13624 continue; 13625 } 13626 if (toKey && !fromKey) { 13627 if (fromKeys[toKey]) { 13628 currentFrom.replaceWith(fromKeys[toKey]); 13629 currentFrom = fromKeys[toKey]; 13630 fromKey = context.getKey(currentFrom); 13631 } 13632 } 13633 if (toKey && fromKey) { 13634 let fromKeyNode = fromKeys[toKey]; 13635 if (fromKeyNode) { 13636 fromKeyHoldovers[fromKey] = currentFrom; 13637 currentFrom.replaceWith(fromKeyNode); 13638 currentFrom = fromKeyNode; 13639 fromKey = context.getKey(currentFrom); 13640 } else { 13641 fromKeyHoldovers[fromKey] = currentFrom; 13642 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 13643 fromKeyHoldovers[fromKey].remove(); 13644 currentFrom = getNextSibling(from, currentFrom); 13645 currentTo = getNextSibling(to, currentTo); 13646 continue; 13647 } 13648 } 13649 } 13650 let currentFromNext = currentFrom && getNextSibling(from, currentFrom); 13651 context.patch(currentFrom, currentTo); 13652 currentTo = currentTo && getNextSibling(to, currentTo); 13653 currentFrom = currentFromNext; 13654 } 13655 let removals = []; 13656 while (currentFrom) { 13657 if (!shouldSkip(context.removing, currentFrom)) 13658 removals.push(currentFrom); 13659 currentFrom = getNextSibling(from, currentFrom); 13660 } 13661 while (removals.length) { 13662 let domForRemoval = removals.shift(); 13663 domForRemoval.remove(); 13664 context.removed(domForRemoval); 13665 } 13666 }; 13667 context.getKey = function(el) { 13668 return el && el.nodeType === 1 && context.key(el); 13669 }; 13670 context.keyToMap = function(els2) { 13671 let map = {}; 13672 for (let el of els2) { 13673 let theKey = context.getKey(el); 13674 if (theKey) { 13675 map[theKey] = el; 13676 } 13677 } 13678 return map; 13679 }; 13680 context.addNodeBefore = function(parent, node, beforeMe) { 13681 if (!shouldSkip(context.adding, node)) { 13682 let clone3 = node.cloneNode(true); 13683 parent.insertBefore(clone3, beforeMe); 13684 context.added(clone3); 13685 return clone3; 13686 } 13687 return node; 13688 }; 13689 return context; 13690 } 13691 morph.step = () => { 13692 }; 13693 morph.log = () => { 13694 }; 13695 function shouldSkip(hook, ...args) { 13696 let skip = false; 13697 hook(...args, () => skip = true); 13698 return skip; 13699 } 13700 function shouldSkipChildren(hook, skipChildren, skipUntil, ...args) { 13701 let skip = false; 13702 hook(...args, () => skip = true, skipChildren, skipUntil); 13703 return skip; 13704 } 13705 var patched = false; 13706 function createElement(html) { 13707 const template = document.createElement("template"); 13708 template.innerHTML = html; 13709 return template.content.firstElementChild; 13710 } 13711 function textOrComment(el) { 13712 return el.nodeType === 3 || el.nodeType === 8; 13713 } 13714 var Block = class { 13715 constructor(start3, end) { 13716 this.startComment = start3; 13717 this.endComment = end; 13718 } 13719 get children() { 13720 let children = []; 13721 let currentNode = this.startComment.nextSibling; 13722 while (currentNode && currentNode !== this.endComment) { 13723 children.push(currentNode); 13724 currentNode = currentNode.nextSibling; 13725 } 13726 return children; 13727 } 13728 appendChild(child) { 13729 this.endComment.before(child); 13730 } 13731 get firstChild() { 13732 let first2 = this.startComment.nextSibling; 13733 if (first2 === this.endComment) 13734 return; 13735 return first2; 13736 } 13737 nextNode(reference) { 13738 let next = reference.nextSibling; 13739 if (next === this.endComment) 13740 return; 13741 return next; 13742 } 13743 insertBefore(newNode, reference) { 13744 reference.before(newNode); 13745 return newNode; 13746 } 13747 }; 13748 function getFirstNode(parent) { 13749 return parent.firstChild; 13750 } 13751 function getNextSibling(parent, reference) { 13752 let next; 13753 if (parent instanceof Block) { 13754 next = parent.nextNode(reference); 13755 } else { 13756 next = reference.nextSibling; 13757 } 13758 return next; 13759 } 13760 function monkeyPatchDomSetAttributeToAllowAtSymbols() { 13761 if (patched) 13762 return; 13763 patched = true; 13764 let original = Element.prototype.setAttribute; 13765 let hostDiv = document.createElement("div"); 13766 Element.prototype.setAttribute = function newSetAttribute(name, value) { 13767 if (!name.includes("@")) { 13768 return original.call(this, name, value); 13769 } 13770 let escapedValue = value.replace(/&/g, "&").replace(/"/g, """); 13771 hostDiv.innerHTML = `<span ${name}="${escapedValue}"></span>`; 13772 let attr = hostDiv.firstElementChild.getAttributeNode(name); 13773 hostDiv.firstElementChild.removeAttributeNode(attr); 13774 this.setAttributeNode(attr); 13775 }; 13776 } 13777 function seedingMatchingId(to, from) { 13778 let fromId = from && from._x_bindings && from._x_bindings.id; 13779 if (!fromId) 13780 return; 13781 if (!to.setAttribute) 13782 return; 13783 to.setAttribute("id", fromId); 13784 to.id = fromId; 13785 } 13786 function src_default9(Alpine3) { 13787 Alpine3.morph = morph; 13788 Alpine3.morphBetween = morphBetween; 13789 } 13790 var module_default9 = src_default9; 13791 13792
vendor: 5,237 bytes, lines 13792-13946
13792// node_modules/@alpinejs/mask/dist/module.esm.js 13793 function src_default10(Alpine3) { 13794 Alpine3.directive("mask", (el, { value, expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 13795 let templateFn = () => expression; 13796 let lastInputValue = ""; 13797 queueMicrotask(() => { 13798 if (["function", "dynamic"].includes(value)) { 13799 let evaluator = evaluateLater2(expression); 13800 effect3(() => { 13801 templateFn = (input) => { 13802 let result; 13803 Alpine3.dontAutoEvaluateFunctions(() => { 13804 evaluator((value2) => { 13805 result = typeof value2 === "function" ? value2(input) : value2; 13806 }, { scope: { 13807 "$input": input, 13808 "$money": formatMoney.bind({ el }) 13809 } }); 13810 }); 13811 return result; 13812 }; 13813 processInputValue(el, false); 13814 }); 13815 } else { 13816 processInputValue(el, false); 13817 } 13818 if (el._x_model) { 13819 if (el._x_model.get() !== el.value) { 13820 if (!(el._x_model.get() === null && el.value === "")) { 13821 el._x_model.set(el.value); 13822 } 13823 } 13824 let updater = el._x_forceModelUpdate; 13825 el._x_forceModelUpdate = (value2) => { 13826 value2 = String(value2); 13827 let template = templateFn(value2); 13828 if (template && template !== "false") { 13829 value2 = formatInput(template, value2); 13830 } 13831 lastInputValue = value2; 13832 updater(value2); 13833 el._x_model.set(value2); 13834 }; 13835 } 13836 }); 13837 const controller = new AbortController(); 13838 cleanup2(() => { 13839 controller.abort(); 13840 }); 13841 el.addEventListener("input", () => processInputValue(el), { 13842 signal: controller.signal, 13843 capture: true 13844 }); 13845 el.addEventListener("blur", () => processInputValue(el, false), { signal: controller.signal }); 13846 function processInputValue(el2, shouldRestoreCursor = true) { 13847 let input = el2.value; 13848 let template = templateFn(input); 13849 if (!template || template === "false") 13850 return false; 13851 if (lastInputValue.length - el2.value.length === 1) { 13852 return lastInputValue = el2.value; 13853 } 13854 let setInput = () => { 13855 lastInputValue = el2.value = formatInput(template, input); 13856 }; 13857 if (shouldRestoreCursor) { 13858 restoreCursorPosition(el2, template, () => { 13859 setInput(); 13860 }); 13861 } else { 13862 setInput(); 13863 } 13864 } 13865 }).before("model"); 13866 } 13867 function restoreCursorPosition(el, template, callback) { 13868 let cursorPosition = el.selectionStart; 13869 let unformattedValue = el.value; 13870 callback(); 13871 let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition); 13872 let newPosition = formatInput( 13873 template, 13874 beforeLeftOfCursorBeforeFormatting 13875 ).length; 13876 el.setSelectionRange(newPosition, newPosition); 13877 } 13878 var regexes = { 13879 "9": /[0-9]/, 13880 "a": /[a-zA-Z]/, 13881 "*": /[a-zA-Z0-9]/ 13882 }; 13883 function formatInput(template, input) { 13884 let templateMark = 0; 13885 let inputMark = 0; 13886 let output = ""; 13887 while (templateMark < template.length && inputMark < input.length) { 13888 let templateChar = template[templateMark]; 13889 let inputChar = input[inputMark]; 13890 if (templateChar in regexes) { 13891 if (regexes[templateChar].test(inputChar)) { 13892 output += inputChar; 13893 templateMark++; 13894 } 13895 inputMark++; 13896 } else { 13897 output += templateChar; 13898 templateMark++; 13899 if (templateChar === input[inputMark]) 13900 inputMark++; 13901 } 13902 } 13903 return output; 13904 } 13905 function formatMoney(input, delimiter = ".", thousands, precision = 2) { 13906 if (input === "-") 13907 return "-"; 13908 if (/^\D+$/.test(input)) 13909 return "9"; 13910 if (thousands === null || thousands === void 0) { 13911 thousands = delimiter === "," ? "." : ","; 13912 } 13913 let addThousands = (input2, thousands2) => { 13914 let output = ""; 13915 let counter = 0; 13916 for (let i = input2.length - 1; i >= 0; i--) { 13917 if (input2[i] === thousands2) 13918 continue; 13919 if (counter === 3) { 13920 output = input2[i] + thousands2 + output; 13921 counter = 0; 13922 } else { 13923 output = input2[i] + output; 13924 } 13925 counter++; 13926 } 13927 return output; 13928 }; 13929 let minus = input.startsWith("-") ? "-" : ""; 13930 let strippedInput = input.replaceAll(new RegExp(`[^0-9\\${delimiter}]`, "g"), ""); 13931 let template = Array.from({ length: strippedInput.split(delimiter)[0].length }).fill("9").join(""); 13932 template = `${minus}${addThousands(template, thousands)}`; 13933 if (precision > 0 && input.includes(delimiter)) 13934 template += `${delimiter}` + "9".repeat(precision); 13935 queueMicrotask(() => { 13936 if (this.el.value.endsWith(delimiter)) 13937 return; 13938 if (this.el.value[this.el.selectionStart - 1] === delimiter) { 13939 this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1); 13940 } 13941 }); 13942 return template; 13943 } 13944 var module_default10 = src_default10; 13945 13946
13946// js/lifecycle.js 13947 function start2() { 13948 setTimeout(() => ensureLivewireScriptIsntMisplaced()); 13949 dispatch(document, "livewire:init"); 13950 dispatch(document, "livewire:initializing"); 13951 module_default.plugin(module_default9); 13952 module_default.plugin(history); 13953 module_default.plugin(module_default5); 13954 module_default.plugin(module_default6); 13955 module_default.plugin(module_default7); 13956 module_default.plugin(module_default2); 13957 module_default.plugin(module_default8); 13958 module_default.plugin(module_default3); 13959 module_default.plugin(module_default4); 13960 module_default.plugin(navigate_default); 13961 module_default.plugin(module_default10); 13962 module_default.addRootSelector(() => "[wire\\:id]"); 13963 module_default.onAttributesAdded((el, attributes) => { 13964 if (!Array.from(attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 13965 return; 13966 let component = findComponentByEl(el, false); 13967 if (!component) 13968 return; 13969 attributes.forEach((attribute) => { 13970 if (!matchesForLivewireDirective(attribute.name)) 13971 return; 13972 let directive3 = extractDirective(el, attribute.name); 13973 trigger2("directive.init", { el, component, directive: directive3, cleanup: (callback) => { 13974 module_default.onAttributeRemoved(el, directive3.raw, callback); 13975 } }); 13976 }); 13977 }); 13978 module_default.interceptInit( 13979 module_default.skipDuringClone( 13980 (el) => { 13981 if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 13982 return; 13983 if (el.hasAttribute("wire:id") && !el.__livewire && !hasComponent(el.getAttribute("wire:id"))) { 13984 let component2 = initComponent(el); 13985 module_default.onAttributeRemoved(el, "wire:id", () => { 13986 destroyComponent(component2.id); 13987 }); 13988 } 13989 let directives2 = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name)); 13990 directives2.forEach((directive3) => { 13991 trigger2("directive.global.init", { el, directive: directive3, cleanup: (callback) => { 13992 module_default.onAttributeRemoved(el, directive3.raw, callback); 13993 } }); 13994 }); 13995 let component = findComponentByEl(el, false); 13996 if (component) { 13997 trigger2("element.init", { el, component }); 13998 directives2.forEach((directive3) => { 13999 trigger2("directive.init", { el, component, directive: directive3, cleanup: (callback) => { 14000 module_default.onAttributeRemoved(el, directive3.raw, callback); 14001 } }); 14002 }); 14003 } 14004 }, 14005 (el) => { 14006 if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 14007 return; 14008 let directives2 = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name)); 14009 directives2.forEach((directive3) => { 14010 trigger2("directive.global.init", { el, directive: directive3, cleanup: (callback) => { 14011 module_default.onAttributeRemoved(el, directive3.raw, callback); 14012 } }); 14013 }); 14014 } 14015 ) 14016 ); 14017 module_default.start(); 14018 setTimeout(() => window.Livewire.initialRenderIsFinished = true); 14019 dispatch(document, "livewire:initialized"); 14020 } 14021 function ensureLivewireScriptIsntMisplaced() { 14022 let el = document.querySelector("script[data-update-uri][data-csrf]"); 14023 if (!el) 14024 return; 14025 let livewireEl = el.closest("[wire\\:id]"); 14026 if (livewireEl) { 14027 console.warn("Livewire: missing closing tags found. Ensure your template elements contain matching closing tags.", livewireEl); 14028 } 14029 } 14030 14031
14031// js/features/supportListeners.js 14032 on2("effect", ({ component, effects }) => { 14033 let listeners2 = []; 14034 if (Object.prototype.hasOwnProperty.call(effects, "listeners") && effects.listeners) { 14035 listeners2 = effects.listeners; 14036 } 14037 registerListeners(component, listeners2); 14038 }); 14039 function registerListeners(component, listeners2) { 14040 listeners2.forEach((name) => { 14041 let handler4 = (e) => { 14042 if (component.isLazy && !component.hasBeenLazyLoaded) 14043 return; 14044 if (e.__livewire) 14045 e.__livewire.receivedBy.push(component); 14046 component.$wire.call("__dispatch", name, e.detail || {}); 14047 }; 14048 window.addEventListener(name, handler4); 14049 component.addCleanup(() => window.removeEventListener(name, handler4)); 14050 component.el.addEventListener(name, (e) => { 14051 if (component.isLazy && !component.hasBeenLazyLoaded) 14052 return; 14053 if (!e.__livewire) 14054 return; 14055 if (e.bubbles) 14056 return; 14057 if (e.__livewire) 14058 e.__livewire.receivedBy.push(component.id); 14059 component.$wire.call("__dispatch", name, e.detail || {}); 14060 }); 14061 }); 14062 } 14063 14064
14064// js/evaluator.js 14065 function getAlpineScopeKeys(el) { 14066 let keys = []; 14067 let currentEl = el; 14068 while (currentEl) { 14069 if (currentEl._x_dataStack && currentEl._x_dataStack.length > 0) { 14070 let ownScope = currentEl._x_dataStack[0]; 14071 for (let key of Object.keys(ownScope)) { 14072 if (!keys.includes(key) && !key.startsWith("$")) 14073 keys.push(key); 14074 } 14075 } 14076 if (currentEl.hasAttribute && currentEl.hasAttribute("wire:id")) 14077 break; 14078 currentEl = currentEl.parentElement; 14079 } 14080 return keys; 14081 } 14082 function evaluateExpression(el, expression, options = {}) { 14083 if (!expression || expression.trim() === "") 14084 return; 14085 let result = module_default.evaluateRaw(el, expression, options); 14086 if (result instanceof Promise) { 14087 result.catch(() => { 14088 }); 14089 } 14090 return result; 14091 } 14092 function evaluateActionExpression(el, expression, options = {}) { 14093 if (!expression || expression.trim() === "") 14094 return; 14095 let contextualExpression = contextualizeExpression(expression, el); 14096 try { 14097 let result = module_default.evaluateRaw(el, contextualExpression, options); 14098 if (result instanceof Promise && result._livewireAction) { 14099 result.catch(() => { 14100 }); 14101 } 14102 return result; 14103 } catch (error2) { 14104 console.warn(`Livewire Expression Error: ${error2.message} 14105 14106${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); 14107 console.error(error2); 14108 } 14109 } 14110 function contextualizeExpression(expression, el) { 14111 let SKIP = ["JSON", "true", "false", "null", "undefined", "this", "$wire", "$event"]; 14112 if (el) { 14113 SKIP.push(...getAlpineScopeKeys(el)); 14114 } 14115 let strings = []; 14116 let result = expression.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*\1/g, (m) => { 14117 strings.push(m); 14118 return `___${strings.length - 1}___`; 14119 }); 14120 result = result.replace(/(^|[^.\w$])(\$?[a-zA-Z_]\w*)/g, (m, pre, ident, offset2) => { 14121 if (SKIP.includes(ident) || /^___\d+___$/.test(ident)) 14122 return pre + ident; 14123 if (result[offset2 + m.length] === ":") 14124 return pre + ident; 14125 return pre + "$wire." + ident; 14126 }); 14127 return result.replace(/___(\d+)___/g, (m, i) => strings[i]); 14128 } 14129 14130
14130// js/features/supportScriptsAndAssets.js 14131 var executedScripts = /* @__PURE__ */ new WeakMap(); 14132 var executedAssets = /* @__PURE__ */ new Set(); 14133 on2("payload.intercept", async ({ assets }) => { 14134 if (!assets) 14135 return; 14136 for (let [key, asset] of Object.entries(assets)) { 14137 await onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, async () => { 14138 await addAssetsToHeadTagOfPage(asset); 14139 }); 14140 } 14141 }); 14142 on2("component.init", ({ component }) => { 14143 let assets = component.snapshot.memo.assets; 14144 if (assets) { 14145 assets.forEach((key) => { 14146 if (executedAssets.has(key)) 14147 return; 14148 executedAssets.add(key); 14149 }); 14150 } 14151 }); 14152 on2("effect", ({ component, effects }) => { 14153 let scripts; 14154 if (Object.prototype.hasOwnProperty.call(effects, "scripts")) { 14155 scripts = effects.scripts; 14156 } 14157 if (scripts) { 14158 Object.entries(scripts).forEach(([key, content]) => { 14159 onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, () => { 14160 let scriptContent = extractScriptTagContent(content); 14161 scriptContent = scriptContent.includes("await") ? `(async()=>{ ${scriptContent} })()` : `(()=>{ ${scriptContent} })()`; 14162 module_default.dontAutoEvaluateFunctions(() => { 14163 evaluateExpression(component.el, scriptContent, { 14164 context: component.$wire, 14165 scope: { 14166 "$wire": component.$wire, 14167 "$js": component.$wire.js 14168 } 14169 }); 14170 }); 14171 }); 14172 }); 14173 } 14174 }); 14175 function onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, callback) { 14176 if (executedScripts.has(component)) { 14177 let alreadyRunKeys2 = executedScripts.get(component); 14178 if (alreadyRunKeys2.includes(key)) 14179 return; 14180 } 14181 callback(); 14182 if (!executedScripts.has(component)) 14183 executedScripts.set(component, []); 14184 let alreadyRunKeys = executedScripts.get(component); 14185 alreadyRunKeys.push(key); 14186 executedScripts.set(component, alreadyRunKeys); 14187 } 14188 function extractScriptTagContent(rawHtml) { 14189 let scriptRegex = /<script\b[^>]*>([\s\S]*?)<\/script>/gm; 14190 let matches3 = scriptRegex.exec(rawHtml); 14191 let innards = matches3 && matches3[1] ? matches3[1].trim() : ""; 14192 return innards; 14193 } 14194 async function onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, callback) { 14195 if (executedAssets.has(key)) 14196 return; 14197 executedAssets.add(key); 14198 await callback(); 14199 } 14200 async function addAssetsToHeadTagOfPage(rawHtml) { 14201 rawHtml = replaceNoncesInHtml(rawHtml); 14202 let newDocument = new DOMParser().parseFromString(rawHtml, "text/html"); 14203 let newHead = document.adoptNode(newDocument.head); 14204 for (let child of newHead.children) { 14205 try { 14206 await runAssetSynchronously(child); 14207 } catch (error2) { 14208 } 14209 } 14210 } 14211 async function runAssetSynchronously(child) { 14212 return new Promise((resolve, reject) => { 14213 if (isScript2(child)) { 14214 let script = cloneScriptTag(child); 14215 if (script.src) { 14216 script.onload = () => resolve(); 14217 script.onerror = () => reject(); 14218 } else { 14219 resolve(); 14220 } 14221 document.head.appendChild(script); 14222 } else { 14223 document.head.appendChild(child); 14224 resolve(); 14225 } 14226 }); 14227 } 14228 function isScript2(el) { 14229 return el.tagName.toLowerCase() === "script"; 14230 } 14231 14232
14232// js/features/supportJsEvaluation.js 14233 module_default.magic("js", (el) => { 14234 let component = findComponentByEl(el); 14235 return component.$wire.js; 14236 }); 14237 on2("effect", ({ component, effects }) => { 14238 let js; 14239 let xjs; 14240 if (Object.prototype.hasOwnProperty.call(effects, "js")) { 14241 js = effects.js; 14242 } 14243 if (Object.prototype.hasOwnProperty.call(effects, "xjs")) { 14244 xjs = effects.xjs; 14245 } 14246 if (js) { 14247 Object.entries(js).forEach(([method, body]) => { 14248 overrideMethod(component, method, () => { 14249 evaluateExpression(component.el, body); 14250 }); 14251 }); 14252 } 14253 if (xjs) { 14254 xjs.forEach(({ expression, params }) => { 14255 params = Object.values(params); 14256 evaluateExpression(component.el, expression, { scope: component.getJsActions(), params }); 14257 }); 14258 } 14259 }); 14260 14261
14261// js/directives/wire-transition.js 14262 var defaultName = "match-element"; 14263 globalDirective("transition", ({ el, directive: directive3, cleanup: cleanup2 }) => { 14264 }); 14265 function setTransitionNames(root, options = {}) { 14266 root.querySelectorAll("[wire\\:transition]").forEach((el) => { 14267 if (el.style.viewTransitionName) 14268 return; 14269 let name = el.getAttribute("wire:transition"); 14270 if (!name && options.type) 14271 return; 14272 el.style.viewTransitionName = name || defaultName; 14273 }); 14274 } 14275 function clearTransitionNames(root) { 14276 root.querySelectorAll("[wire\\:transition]").forEach((el) => { 14277 el.style.viewTransitionName = ""; 14278 }); 14279 } 14280 async function transitionDomMutation(fromEl, toEl, callback, options = {}) { 14281 if (options.skip) 14282 return callback(); 14283 if (!fromEl.querySelector("[wire\\:transition]") && !toEl.querySelector("[wire\\:transition]")) 14284 return callback(); 14285 if (typeof document.startViewTransition !== "function") { 14286 return callback(); 14287 } 14288 if (document.querySelector("dialog:modal")) 14289 return callback(); 14290 setTransitionNames(fromEl, options); 14291 let style = document.createElement("style"); 14292 style.textContent = ` 14293 @media (prefers-reduced-motion: reduce) { 14294 ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { 14295 animation: none !important; 14296 } 14297 } 14298 14299 ::view-transition-old(root) { 14300 animation: none !important; 14301 opacity: 0 !important; 14302 } 14303 14304 ::view-transition-new(root) { 14305 animation: none !important; 14306 opacity: 1 !important; 14307 } 14308 `; 14309 document.head.appendChild(style); 14310 let update = () => { 14311 callback(); 14312 setTransitionNames(fromEl, options); 14313 }; 14314 let transitionConfig = { update }; 14315 if (options.type) { 14316 transitionConfig.types = [options.type]; 14317 } 14318 let cleanup2 = () => { 14319 style.remove(); 14320 clearTransitionNames(fromEl); 14321 }; 14322 let skipOnDialog = (transition2) => { 14323 let observer2 = new MutationObserver(() => { 14324 if (document.querySelector("dialog:modal")) { 14325 transition2.skipTransition(); 14326 observer2.disconnect(); 14327 } 14328 }); 14329 observer2.observe(document.documentElement, { 14330 attributes: true, 14331 attributeFilter: ["open"], 14332 subtree: true 14333 }); 14334 transition2.finished.finally(() => observer2.disconnect()); 14335 }; 14336 try { 14337 let transition2 = document.startViewTransition(transitionConfig); 14338 skipOnDialog(transition2); 14339 transition2.finished.finally(cleanup2); 14340 await transition2.updateCallbackDone; 14341 } catch (e) { 14342 let transition2 = document.startViewTransition(update); 14343 skipOnDialog(transition2); 14344 transition2.finished.finally(cleanup2); 14345 await transition2.updateCallbackDone; 14346 } 14347 } 14348 14349
14349// js/morph.js 14350 async function morph2(component, el, html) { 14351 let wrapperTag = getTagName(el.parentElement); 14352 let wrapper = document.createElement(wrapperTag); 14353 wrapper.innerHTML = html; 14354 let parentComponent; 14355 try { 14356 parentComponent = findComponentByEl(el.parentElement); 14357 } catch (e) { 14358 } 14359 parentComponent && (wrapper.__livewire = parentComponent); 14360 let to = wrapper.firstElementChild; 14361 to.setAttribute("wire:snapshot", component.snapshotEncoded); 14362 let effects = { ...component.effects }; 14363 delete effects.html; 14364 to.setAttribute("wire:effects", JSON.stringify(effects)); 14365 to.__livewire = component; 14366 trigger2("morph", { el, toEl: to, component }); 14367 let existingComponentsMap = {}; 14368 el.querySelectorAll("[wire\\:id]").forEach((component2) => { 14369 existingComponentsMap[component2.getAttribute("wire:id")] = component2; 14370 }); 14371 to.querySelectorAll("[wire\\:id]").forEach((child) => { 14372 if (child.hasAttribute("wire:snapshot")) 14373 return; 14374 let wireId = child.getAttribute("wire:id"); 14375 let existingComponent = existingComponentsMap[wireId]; 14376 if (existingComponent) { 14377 child.replaceWith(existingComponent.cloneNode(true)); 14378 } 14379 }); 14380 let transitionOptions = {}; 14381 if (Object.prototype.hasOwnProperty.call(component.effects, "transition") && component.effects.transition) { 14382 transitionOptions = component.effects.transition; 14383 } 14384 await transitionDomMutation(el, to, () => { 14385 module_default.morph(el, to, getMorphConfig(component)); 14386 }, transitionOptions); 14387 trigger2("morphed", { el, component }); 14388 } 14389 async function morphFragment(component, startNode, endNode, toHTML) { 14390 let fromContainer = startNode.parentElement; 14391 let fromContainerTag = getTagName(fromContainer); 14392 let toContainer = document.createElement(fromContainerTag); 14393 toContainer.innerHTML = toHTML; 14394 toContainer.__livewire = component; 14395 let parentElement = component.el.parentElement; 14396 let parentElementTag = getTagName(parentElement); 14397 let parentComponent; 14398 try { 14399 parentComponent = parentElement ? findComponentByEl(parentElement) : null; 14400 } catch (e) { 14401 } 14402 if (parentComponent) { 14403 let parentProviderWrapper = document.createElement(parentElementTag); 14404 parentProviderWrapper.appendChild(toContainer); 14405 parentProviderWrapper.__livewire = parentComponent; 14406 } 14407 trigger2("island.morph", { startNode, endNode, component }); 14408 let transitionOptions = {}; 14409 if (Object.prototype.hasOwnProperty.call(component.effects, "transition") && component.effects.transition) { 14410 transitionOptions = component.effects.transition; 14411 } 14412 let islandHasTransition = false; 14413 let node = startNode.nextSibling; 14414 while (node && node !== endNode) { 14415 if (node.nodeType === 1 && (node.hasAttribute?.("wire:transition") || node.querySelector?.("[wire\\:transition]"))) { 14416 islandHasTransition = true; 14417 break; 14418 } 14419 node = node.nextSibling; 14420 } 14421 let fromEl = islandHasTransition ? fromContainer : document.createElement("div"); 14422 await transitionDomMutation(fromEl, toContainer, () => { 14423 module_default.morphBetween(startNode, endNode, toContainer, getMorphConfig(component)); 14424 }, transitionOptions); 14425 trigger2("island.morphed", { startNode, endNode, component }); 14426 } 14427 function getMorphConfig(component) { 14428 return { 14429 updating: (el, toEl, childrenOnly, skip, skipChildren, skipUntil) => { 14430 if (isStartFragmentMarker(el) && isStartFragmentMarker(toEl)) { 14431 let metadata = extractFragmentMetadataFromMarkerNode(toEl); 14432 if (metadata.mode !== "morph") { 14433 skipUntil((node) => { 14434 if (isEndFragmentMarker(node)) { 14435 let endMarkerMetadata = extractFragmentMetadataFromMarkerNode(node); 14436 return endMarkerMetadata.token === metadata.token; 14437 } 14438 return false; 14439 }); 14440 } 14441 } 14442 if (isntElement(el)) 14443 return; 14444 trigger2("morph.updating", { el, toEl, component, skip, childrenOnly, skipChildren, skipUntil }); 14445 if (el.__livewire_replace === true) 14446 el.innerHTML = toEl.innerHTML; 14447 if (el.__livewire_replace_self === true) { 14448 el.outerHTML = toEl.outerHTML; 14449 return skip(); 14450 } 14451 if (el.__livewire_ignore === true) 14452 return skip(); 14453 if (el.__livewire_ignore_self === true) 14454 childrenOnly(); 14455 if (el.__livewire_ignore_children === true) 14456 return skipChildren(); 14457 if (isComponentRootEl(el) && el.getAttribute("wire:id") !== component.id) 14458 return skip(); 14459 if (isComponentRootEl(el)) 14460 toEl.__livewire = component; 14461 }, 14462 updated: (el) => { 14463 if (isntElement(el)) 14464 return; 14465 trigger2("morph.updated", { el, component }); 14466 }, 14467 removing: (el, skip) => { 14468 if (isntElement(el)) 14469 return; 14470 trigger2("morph.removing", { el, component, skip }); 14471 }, 14472 removed: (el) => { 14473 if (isntElement(el)) 14474 return; 14475 trigger2("morph.removed", { el, component }); 14476 }, 14477 adding: (el) => { 14478 trigger2("morph.adding", { el, component }); 14479 }, 14480 added: (el) => { 14481 if (isntElement(el)) 14482 return; 14483 trigger2("morph.added", { el }); 14484 }, 14485 key: (el) => { 14486 if (isntElement(el)) 14487 return; 14488 return el.hasAttribute(`wire:id`) ? el.getAttribute(`wire:id`) : el.hasAttribute(`wire:key`) ? el.getAttribute(`wire:key`) : el.id; 14489 }, 14490 lookahead: false 14491 }; 14492 } 14493 function isntElement(el) { 14494 return typeof el.hasAttribute !== "function"; 14495 } 14496 function isComponentRootEl(el) { 14497 return el.hasAttribute("wire:id"); 14498 } 14499 function getTagName(el) { 14500 let tag = el ? el.tagName.toLowerCase() : "div";
14501 let customElement = customElements.get(tag); 14502 return customElement ? customElement.name : tag; 14503 } 14504 14505
14505// js/features/supportMorphDom.js 14506 interceptMessage(({ message, onSuccess }) => { 14507 onSuccess(({ payload, onMorph }) => { 14508 onMorph(async () => { 14509 let html; 14510 if (Object.prototype.hasOwnProperty.call(payload.effects, "html")) { 14511 html = payload.effects.html; 14512 } 14513 if (!html) 14514 return; 14515 await morph2(message.component, message.component.el, html); 14516 }); 14517 }); 14518 }); 14519 14520
14520// js/features/supportDispatches.js 14521 on2("effect", ({ component, effects }) => { 14522 queueMicrotask(() => { 14523 queueMicrotask(() => { 14524 queueMicrotask(() => { 14525 let dispatches = []; 14526 if (Object.prototype.hasOwnProperty.call(effects, "dispatches") && effects.dispatches) { 14527 dispatches = effects.dispatches; 14528 } 14529 dispatchEvents(component, dispatches); 14530 }); 14531 }); 14532 }); 14533 }); 14534 function dispatchEvents(component, dispatches) { 14535 dispatches.forEach(({ name, params = {}, self = false, component: componentName, ref, el }) => { 14536 if (self) 14537 dispatchSelf(component, name, params); 14538 else if (componentName) 14539 dispatchTo(componentName, name, params); 14540 else if (ref) 14541 dispatchRef(component, ref, name, params); 14542 else if (el) 14543 dispatchEl(component, el, name, params); 14544 else 14545 dispatch3(component, name, params); 14546 }); 14547 } 14548 14549
14549// js/features/supportDisablingFormsDuringRequest.js 14550 var cleanups = new Bag(); 14551 on2("directive.init", ({ el, directive: directive3, cleanup: cleanup2, component }) => setTimeout(() => { 14552 if (directive3.value !== "submit") 14553 return; 14554 el.addEventListener("submit", () => { 14555 let componentId = directive3.expression.startsWith("$parent") ? component.parent.id : component.id; 14556 let cleanup3 = disableForm(el); 14557 cleanups.add(componentId, cleanup3); 14558 }); 14559 })); 14560 on2("commit", ({ component, respond }) => { 14561 respond(() => { 14562 cleanups.each(component.id, (i) => i()); 14563 cleanups.remove(component.id); 14564 }); 14565 }); 14566 function disableForm(formEl) { 14567 let undos = []; 14568 module_default.walk(formEl, (el, skip) => { 14569 if (!formEl.contains(el)) 14570 return; 14571 if (el.hasAttribute("wire:ignore")) 14572 return skip(); 14573 if (shouldMarkDisabled(el)) { 14574 undos.push(markDisabled(el)); 14575 } else if (shouldMarkReadOnly(el)) { 14576 undos.push(markReadOnly(el)); 14577 } 14578 }); 14579 return () => { 14580 while (undos.length > 0) 14581 undos.shift()(); 14582 }; 14583 } 14584 function shouldMarkDisabled(el) { 14585 let tag = el.tagName.toLowerCase(); 14586 let inputTypesThatDontSupportReadonly = [ 14587 "hidden", 14588 "range", 14589 "color", 14590 "checkbox", 14591 "radio", 14592 "file", 14593 "submit", 14594 "image", 14595 "reset", 14596 "button" 14597 ]; 14598 if (tag === "select") 14599 return true; 14600 if (tag === "button" && el.type === "submit") 14601 return true; 14602 if (tag === "input" && inputTypesThatDontSupportReadonly.includes(el.type)) 14603 return true; 14604 return false; 14605 } 14606 function shouldMarkReadOnly(el) { 14607 return ["input", "textarea"].includes(el.tagName.toLowerCase()); 14608 } 14609 function markDisabled(el) { 14610 let undo = el.disabled ? () => { 14611 } : () => el.disabled = false; 14612 el.disabled = true; 14613 return undo; 14614 } 14615 function markReadOnly(el) { 14616 let undo = el.readOnly ? () => { 14617 } : () => el.readOnly = false; 14618 el.readOnly = true; 14619 return undo; 14620 } 14621 14622
14622// js/features/supportFileDownloads.js 14623 on2("commit", ({ succeed }) => { 14624 succeed(({ effects }) => { 14625 let download; 14626 if (Object.prototype.hasOwnProperty.call(effects, "download")) { 14627 download = effects.download; 14628 } 14629 if (!download) 14630 return; 14631 let urlObject = window.webkitURL || window.URL; 14632 let url = urlObject.createObjectURL( 14633 base64toBlob(download.content, download.contentType) 14634 ); 14635 let invisibleLink = document.createElement("a"); 14636 invisibleLink.style.display = "none"; 14637 invisibleLink.href = url; 14638 invisibleLink.download = download.name; 14639 document.body.appendChild(invisibleLink); 14640 invisibleLink.click(); 14641 setTimeout(function() { 14642 urlObject.revokeObjectURL(url); 14643 }, 0); 14644 }); 14645 }); 14646 function base64toBlob(b64Data, contentType = "", sliceSize = 512) { 14647 const byteCharacters = atob(b64Data); 14648 const byteArrays = []; 14649 if (contentType === null) 14650 contentType = ""; 14651 for (let offset2 = 0; offset2 < byteCharacters.length; offset2 += sliceSize) { 14652 let slice = byteCharacters.slice(offset2, offset2 + sliceSize); 14653 let byteNumbers = new Array(slice.length); 14654 for (let i = 0; i < slice.length; i++) { 14655 byteNumbers[i] = slice.charCodeAt(i); 14656 } 14657 let byteArray = new Uint8Array(byteNumbers); 14658 byteArrays.push(byteArray); 14659 } 14660 return new Blob(byteArrays, { type: contentType }); 14661 } 14662 14663
14663// js/features/supportQueryString.js 14664 on2("effect", ({ component, effects, cleanup: cleanup2 }) => { 14665 let queryString; 14666 if (Object.prototype.hasOwnProperty.call(effects, "url")) { 14667 queryString = effects["url"]; 14668 } 14669 if (!queryString) 14670 return; 14671 Object.entries(queryString).forEach(([key, value]) => { 14672 let { name, as, use, alwaysShow, except } = normalizeQueryStringEntry(key, value); 14673 if (!as) 14674 as = name; 14675 let initialValue = [false, null, void 0].includes(except) ? dataGet(component.ephemeral, name) : except; 14676 let { replace: replace2, push: push2, pop } = track2(as, initialValue, alwaysShow, except); 14677 if (use === "replace") { 14678 let effectReference = module_default.effect(() => { 14679 replace2(dataGet(component.reactive, name)); 14680 }); 14681 cleanup2(() => module_default.release(effectReference)); 14682 } else if (use === "push") { 14683 let popNavigating = false; 14684 let forgetCommitHandler = on2("commit", ({ component: commitComponent, succeed }) => { 14685 if (component !== commitComponent) 14686 return; 14687 let beforeValue = dataGet(component.canonical, name); 14688 succeed(() => { 14689 let afterValue = dataGet(component.canonical, name); 14690 if (JSON.stringify(beforeValue) === JSON.stringify(afterValue)) 14691 return; 14692 if (popNavigating) { 14693 replace2(afterValue); 14694 } else { 14695 push2(afterValue); 14696 } 14697 }); 14698 }); 14699 let forgetPopHandler = pop(async (newValue) => { 14700 popNavigating = true; 14701 await component.$wire.set(name, newValue); 14702 document.querySelectorAll("input").forEach((el) => { 14703 el._x_forceModelUpdate && el._x_forceModelUpdate(el._x_model.get()); 14704 }); 14705 requestAnimationFrame(() => popNavigating = false); 14706 }); 14707 let currentValue = dataGet(component.ephemeral, name); 14708 if (JSON.stringify(currentValue) !== JSON.stringify(initialValue)) { 14709 replace2(currentValue); 14710 } 14711 cleanup2(() => { 14712 forgetCommitHandler(); 14713 forgetPopHandler(); 14714 }); 14715 } 14716 }); 14717 }); 14718 function normalizeQueryStringEntry(key, value) { 14719 let defaults2 = { use: "replace", alwaysShow: false }; 14720 if (typeof value === "string") { 14721 return { ...defaults2, name: value, as: value }; 14722 } else { 14723 let fullerDefaults = { ...defaults2, name: key, as: key }; 14724 return { ...fullerDefaults, ...value }; 14725 } 14726 } 14727 14728
14728// js/features/supportLaravelEcho.js 14729 on2("request", ({ options }) => { 14730 if (window.Echo) { 14731 options.headers["X-Socket-ID"] = window.Echo.socketId(); 14732 } 14733 }); 14734 on2("effect", ({ component, effects }) => { 14735 let listeners2 = []; 14736 if (Object.prototype.hasOwnProperty.call(effects, "listeners") && effects.listeners) { 14737 listeners2 = effects.listeners; 14738 } 14739 listeners2.forEach((event) => { 14740 if (event.startsWith("echo")) { 14741 if (typeof window.Echo === "undefined") { 14742 console.warn("Laravel Echo cannot be found"); 14743 return; 14744 } 14745 let event_parts = event.split(/(echo:|echo-)|:|,/); 14746 if (event_parts[1] == "echo:") { 14747 event_parts.splice(2, 0, "channel", void 0); 14748 } 14749 if (event_parts[2] == "notification") { 14750 event_parts.push(void 0, void 0); 14751 } 14752 let [ 14753 s1, 14754 signature, 14755 channel_type, 14756 s2, 14757 channel, 14758 s3, 14759 event_name 14760 ] = event_parts; 14761 if (["channel", "private", "encryptedPrivate"].includes(channel_type)) { 14762 let handler4 = (e) => dispatchSelf(component, event, [e]); 14763 window.Echo[channel_type](channel).listen(event_name, handler4); 14764 component.addCleanup(() => { 14765 window.Echo[channel_type](channel).stopListening(event_name, handler4); 14766 }); 14767 } else if (channel_type == "presence") { 14768 if (["here", "joining", "leaving"].includes(event_name)) { 14769 window.Echo.join(channel)[event_name]((e) => { 14770 dispatchSelf(component, event, [e]); 14771 }); 14772 component.addCleanup(() => { 14773 window.Echo.leave(channel); 14774 }); 14775 } else { 14776 let handler4 = (e) => dispatchSelf(component, event, [e]); 14777 window.Echo.join(channel).listen(event_name, handler4); 14778 component.addCleanup(() => { 14779 window.Echo.leave(channel); 14780 }); 14781 } 14782 } else if (channel_type == "notification") { 14783 window.Echo.private(channel).notification((notification) => { 14784 dispatchSelf(component, event, [notification]); 14785 }); 14786 component.addCleanup(() => { 14787 window.Echo.private(channel).stopListening(".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"); 14788 }); 14789 } else { 14790 console.warn("Echo channel type not yet supported"); 14791 } 14792 } 14793 }); 14794 }); 14795 14796
14796// js/features/supportStreaming.js 14797 interceptMessage(({ message, onStream }) => { 14798 onStream(({ json }) => { 14799 let { id, type, name, el, ref, content, mode } = json; 14800 if (type === "island") 14801 return; 14802 let component = findComponent(id); 14803 let targetEl = null; 14804 if (type === "directive") { 14805 const replaceEl = component.el.querySelector(`[wire\\:stream\\.replace="${name}"]`); 14806 if (replaceEl) { 14807 targetEl = replaceEl; 14808 mode = "replace"; 14809 } else { 14810 targetEl = component.el.querySelector(`[wire\\:stream="${name}"]`); 14811 } 14812 } else if (type === "ref") { 14813 targetEl = findRefEl(component, ref); 14814 } else if (type === "element") { 14815 targetEl = component.el.querySelector(el); 14816 } 14817 if (!targetEl) 14818 return; 14819 if (mode === "replace") { 14820 targetEl.innerHTML = content; 14821 } else { 14822 targetEl.insertAdjacentHTML("beforeend", content); 14823 } 14824 }); 14825 }); 14826 14827
14827// js/features/supportNavigate.js 14828 document.addEventListener("livewire:initialized", () => { 14829 shouldHideProgressBar() && Alpine.navigate.disableProgressBar(); 14830 }); 14831 document.addEventListener("alpine:navigate", (e) => forwardEvent("livewire:navigate", e)); 14832 document.addEventListener("alpine:navigating", (e) => forwardEvent("livewire:navigating", e)); 14833 document.addEventListener("alpine:navigated", (e) => forwardEvent("livewire:navigated", e)); 14834 function forwardEvent(name, original) { 14835 let event = new CustomEvent(name, { cancelable: true, bubbles: true, detail: original.detail }); 14836 document.dispatchEvent(event); 14837 if (event.defaultPrevented) { 14838 original.preventDefault(); 14839 } 14840 } 14841 function shouldRedirectUsingNavigateOr(effects, url, or) { 14842 let forceNavigate; 14843 if (Object.prototype.hasOwnProperty.call(effects, "redirectUsingNavigate")) { 14844 forceNavigate = effects.redirectUsingNavigate; 14845 } 14846 if (forceNavigate) { 14847 Alpine.navigate(url); 14848 } else { 14849 or(); 14850 } 14851 } 14852 function shouldHideProgressBar() { 14853 if (!!document.querySelector("[data-no-progress-bar]")) 14854 return true; 14855 if (window.livewireScriptConfig && window.livewireScriptConfig.progressBar === "data-no-progress-bar") 14856 return true; 14857 return false; 14858 } 14859 14860
14860// js/features/supportRedirects.js 14861 on2("effect", ({ effects, request }) => { 14862 if (!Object.prototype.hasOwnProperty.call(effects, "redirect") || !effects["redirect"]) 14863 return; 14864 let preventDefault = false; 14865 request.invokeOnRedirect({ url: effects["redirect"], preventDefault: () => preventDefault = true }); 14866 if (preventDefault) 14867 return; 14868 let url = effects["redirect"]; 14869 shouldRedirectUsingNavigateOr(effects, url, () => { 14870 window.location.href = url; 14871 }); 14872 }); 14873 14874
14874// js/features/supportIslands.js 14875 interceptAction(({ action }) => { 14876 let origin = action.origin; 14877 if (!origin) 14878 return; 14879 let { el, directive: directive3 } = origin; 14880 let islandAttr = Array.from(el.attributes).find((attr) => attr.name.startsWith("wire:island")); 14881 if (islandAttr) { 14882 let islandName = islandAttr.value; 14883 let attrParts = islandAttr.name.split("."); 14884 let isPrepend = attrParts.includes("prepend"); 14885 let isAppend = attrParts.includes("append"); 14886 let mode = isPrepend ? "prepend" : isAppend ? "append" : "morph"; 14887 action.mergeMetadata({ 14888 island: { 14889 name: islandName, 14890 mode 14891 } 14892 }); 14893 return; 14894 } 14895 let fragment = closestIsland(origin.el); 14896 if (!fragment) 14897 return; 14898 action.mergeMetadata({ 14899 island: { 14900 name: fragment.metadata.name, 14901 mode: "morph" 14902 } 14903 }); 14904 }); 14905 interceptMessage(({ message, onSuccess, onStream }) => { 14906 onStream(({ json }) => { 14907 let { type, islandFragment } = json; 14908 if (type !== "island") 14909 return; 14910 renderIsland(message.component, islandFragment); 14911 }); 14912 onSuccess(({ payload, onMorph }) => { 14913 onMorph(async () => { 14914 let fragments = []; 14915 if (Object.prototype.hasOwnProperty.call(payload.effects, "islandFragments") && payload.effects.islandFragments) { 14916 fragments = payload.effects.islandFragments; 14917 } 14918 fragments.forEach(async (fragmentHtml) => { 14919 await renderIsland(message.component, fragmentHtml); 14920 }); 14921 }); 14922 }); 14923 }); 14924 function closestIsland(el) { 14925 return closestFragment(el, { 14926 isMatch: ({ type }) => { 14927 return type === "island"; 14928 } 14929 }); 14930 } 14931 async function renderIsland(component, islandHtml) { 14932 let metadata = extractFragmentMetadataFromHtml(islandHtml); 14933 let fragment = findFragment(component.el, { 14934 isMatch: ({ type, token }) => { 14935 return type === metadata.type && token === metadata.token; 14936 } 14937 }); 14938 if (!fragment) 14939 return; 14940 let incomingMetadata = extractFragmentMetadataFromHtml(islandHtml); 14941 let strippedContent = extractInnerHtmlFromFragmentHtml(islandHtml); 14942 let parentElementTag = getTagName(fragment.startMarkerNode.parentElement); 14943 let mode = incomingMetadata.mode || "morph"; 14944 if (mode === "morph") { 14945 await morphFragment(component, fragment.startMarkerNode, fragment.endMarkerNode, strippedContent); 14946 } else if (mode === "append") { 14947 fragment.append(parentElementTag, strippedContent); 14948 } else if (mode === "prepend") { 14949 fragment.prepend(parentElementTag, strippedContent); 14950 } 14951 } 14952 14953
14953// js/features/supportSlots.js 14954 interceptMessage(({ message, onSuccess, onStream }) => { 14955 onSuccess(({ payload, onMorph }) => { 14956 onMorph(async () => { 14957 let fragments = []; 14958 if (Object.prototype.hasOwnProperty.call(payload.effects, "slotFragments") && payload.effects.slotFragments) { 14959 fragments = payload.effects.slotFragments; 14960 } 14961 fragments.forEach(async (fragmentHtml) => { 14962 await renderSlot(message.component, fragmentHtml); 14963 }); 14964 }); 14965 }); 14966 }); 14967 async function renderSlot(component, fragmentHtml) { 14968 let metadata = extractFragmentMetadataFromHtml(fragmentHtml); 14969 let targetComponent = findComponent(metadata.id); 14970 let fragment = findFragment(targetComponent.el, { 14971 isMatch: ({ name, token }) => { 14972 return name === metadata.name && token === metadata.token; 14973 } 14974 }); 14975 if (!fragment) 14976 return; 14977 let strippedContent = extractInnerHtmlFromFragmentHtml(fragmentHtml); 14978 await morphFragment(targetComponent, fragment.startMarkerNode, fragment.endMarkerNode, strippedContent); 14979 } 14980 14981
14981// js/features/supportDataLoading.js 14982 interceptMessage(({ message, onSend, onFinish }) => { 14983 let undos = []; 14984 onSend(() => { 14985 message.actions.forEach((action) => { 14986 let origin = action.origin; 14987 if (!origin) 14988 return; 14989 let el = origin.hasOwnProperty("targetEl") ? origin.targetEl : origin.el; 14990 if (!el) 14991 return; 14992 el.setAttribute("data-loading", "true"); 14993 undos.push(() => { 14994 el.removeAttribute("data-loading"); 14995 }); 14996 }); 14997 }); 14998 onFinish(() => undos.forEach((undo) => undo())); 14999 }); 15000 15001
15001// js/directives/wire-current.js 15002 module_default.addInitSelector(() => `[wire\\:current]`); 15003 var onPageChanges = /* @__PURE__ */ new Map(); 15004 document.addEventListener("livewire:navigated", () => { 15005 onPageChanges.forEach((i) => i(new URL(window.location.href))); 15006 }); 15007 globalDirective("current", ({ el, directive: directive3, cleanup: cleanup2 }) => { 15008 let expression = directive3.expression; 15009 let options = { 15010 exact: directive3.modifiers.includes("exact"), 15011 strict: directive3.modifiers.includes("strict"), 15012 ignore: directive3.modifiers.includes("ignore") 15013 }; 15014 if (options.ignore) 15015 return; 15016 if (expression.startsWith("#")) 15017 return; 15018 if (!el.hasAttribute("href")) 15019 return; 15020 let href = el.getAttribute("href"); 15021 let hrefUrl = new URL(href, window.location.href); 15022 let classes = expression.split(" ").filter(String); 15023 let refreshCurrent = (url) => { 15024 if (pathMatches(hrefUrl, url, options)) { 15025 el.classList.add(...classes); 15026 el.setAttribute("data-current", ""); 15027 } else { 15028 el.classList.remove(...classes); 15029 el.removeAttribute("data-current"); 15030 } 15031 };
15032 refreshCurrent(new URL(window.location.href)); 15033 onPageChanges.set(el, refreshCurrent); 15034 cleanup2(() => onPageChanges.delete(el)); 15035 }); 15036 function pathMatches(hrefUrl, actualUrl, options = {}) { 15037 if (hrefUrl.hostname !== actualUrl.hostname) 15038 return false; 15039 let hrefPath = options.strict ? hrefUrl.pathname : hrefUrl.pathname.replace(/\/+$/, ""); 15040 let actualPath = options.strict ? actualUrl.pathname : actualUrl.pathname.replace(/\/+$/, ""); 15041 if (options.exact) { 15042 return hrefPath === actualPath; 15043 } 15044 let hrefPathSegments = hrefPath.split("/"); 15045 let actualPathSegments = actualPath.split("/"); 15046 for (let i = 0; i < hrefPathSegments.length; i++) { 15047 if (hrefPathSegments[i] !== actualPathSegments[i]) 15048 return false; 15049 } 15050 return true; 15051 } 15052 15053
15053// js/directives/wire-navigate.js 15054 var wireNavigateSelectors = [ 15055 "[wire\\:navigate]", 15056 "[wire\\:navigate\\.hover]", 15057 "[wire\\:navigate\\.preserve-scroll]", 15058 "[wire\\:navigate\\.preserve-scroll\\.hover]", 15059 "[wire\\:navigate\\.hover\\.preserve-scroll]" 15060 ]; 15061 var wireNavigateSelector = wireNavigateSelectors.join(", "); 15062 var attributeMap = { 15063 "wire:navigate": "x-navigate", 15064 "wire:navigate.hover": "x-navigate.hover", 15065 "wire:navigate.preserve-scroll": "x-navigate.preserve-scroll", 15066 "wire:navigate.preserve-scroll.hover": "x-navigate.preserve-scroll.hover", 15067 "wire:navigate.hover.preserve-scroll": "x-navigate.hover.preserve-scroll" 15068 }; 15069 wireNavigateSelectors.forEach((selector) => { 15070 module_default.addInitSelector(() => selector); 15071 }); 15072 module_default.interceptInit( 15073 module_default.skipDuringClone((el) => { 15074 for (let [wireAttr, alpineDirective] of Object.entries(attributeMap)) { 15075 if (el.hasAttribute(wireAttr)) { 15076 module_default.bind(el, { [alpineDirective]: true }); 15077 break; 15078 } 15079 } 15080 }) 15081 ); 15082 document.addEventListener("alpine:navigating", () => { 15083 Livewire.all().forEach((component) => { 15084 component.inscribeSnapshotAndEffectsOnElement(); 15085 }); 15086 }); 15087 15088
15088// js/features/supportDataCurrent.js 15089 document.addEventListener("livewire:navigated", () => { 15090 updateNavigateLinks(); 15091 }); 15092 document.addEventListener("DOMContentLoaded", () => { 15093 updateNavigateLinks(); 15094 }); 15095 function updateNavigateLinks() { 15096 let currentUrl = new URL(window.location.href); 15097 let options = { 15098 exact: true 15099 }; 15100 document.querySelectorAll(wireNavigateSelector).forEach((el) => { 15101 if (Array.from(el.attributes).some((attr) => attr.name.startsWith("wire:current"))) 15102 return; 15103 let href = el.getAttribute("href"); 15104 if (!href || href.startsWith("#")) 15105 return; 15106 try { 15107 let hrefUrl = new URL(href, window.location.href); 15108 if (pathMatches(hrefUrl, currentUrl, options)) { 15109 el.setAttribute("data-current", ""); 15110 } else { 15111 el.removeAttribute("data-current"); 15112 } 15113 } catch (e) { 15114 } 15115 }); 15116 } 15117 15118
15118// js/features/supportPreserveScroll.js 15119 interceptMessage(({ message, onSuccess }) => { 15120 onSuccess(({ onSync, onMorph, onRender }) => { 15121 message.actions.forEach((action) => { 15122 let origin = action.origin; 15123 if (!origin || !origin.directive) 15124 return; 15125 let directive3 = origin.directive; 15126 if (!directive3.modifiers.includes("preserve-scroll")) 15127 return; 15128 let oldHeight; 15129 let oldScroll; 15130 onSync(() => { 15131 oldHeight = document.body.scrollHeight; 15132 oldScroll = window.scrollY; 15133 }); 15134 onMorph(async () => { 15135 let heightDiff = document.body.scrollHeight - oldHeight; 15136 window.scrollTo(0, oldScroll + heightDiff); 15137 oldHeight = null; 15138 oldScroll = null; 15139 }); 15140 }); 15141 }); 15142 }); 15143 15144
15144// js/features/supportWireIntersect.js 15145 module_default.interceptInit((el) => { 15146 for (let i = 0; i < el.attributes.length; i++) { 15147 if (el.attributes[i].name.startsWith("wire:intersect")) { 15148 let { name, value } = el.attributes[i]; 15149 let directive3 = extractDirective(el, name); 15150 let modifierString = name.split("wire:intersect")[1]; 15151 let expression = value.trim(); 15152 module_default.bind(el, { 15153 ["x-intersect" + modifierString](e) { 15154 directive3.eventContext = e; 15155 let component = findComponentByEl(el, false); 15156 if (!component) 15157 return; 15158 component.addActionContext({ 15159 el, 15160 directive: directive3 15161 }); 15162 evaluateActionExpression(el, expression); 15163 } 15164 }); 15165 } 15166 } 15167 }); 15168 15169
15169// js/features/supportWireSort.js 15170 module_default.interceptInit((el) => { 15171 for (let i = 0; i < el.attributes.length; i++) { 15172 if (el.attributes[i].name.startsWith("wire:sort:item")) { 15173 let directive3 = extractDirective(el, el.attributes[i].name); 15174 let modifierString = directive3.modifiers.join("."); 15175 let expression = directive3.expression; 15176 module_default.bind(el, { 15177 ["x-sort:item" + modifierString]() { 15178 return expression; 15179 } 15180 }); 15181 } else if (el.attributes[i].name.startsWith("wire:sort:group-id")) { 15182 continue; 15183 } else if (el.attributes[i].name.startsWith("wire:sort:group")) { 15184 return; 15185 } else if (el.attributes[i].name.startsWith("wire:sort")) { 15186 let directive3 = extractDirective(el, el.attributes[i].name); 15187 let attribute = directive3.rawName.replace("wire:", "x-"); 15188 if (directive3.modifiers.includes("async")) { 15189 attribute = attribute.replace(".async", ""); 15190 } 15191 if (directive3.modifiers.includes("renderless")) { 15192 attribute = attribute.replace(".renderless", ""); 15193 } 15194 if (directive3.modifiers.includes("prepend")) { 15195 attribute = attribute.replace(".prepend", ""); 15196 } 15197 if (directive3.modifiers.includes("append")) { 15198 attribute = attribute.replace(".append", ""); 15199 } 15200 let expression = directive3.expression; 15201 module_default.bind(el, { 15202 [attribute]() { 15203 setNextActionOrigin({ el, directive: directive3 }); 15204 let sortableChildren = Array.from(el.children).filter( 15205 (child) => child.hasAttribute("x-sort:item") || child.hasAttribute("wire:sort:item") 15206 ); 15207 let itemPosition = sortableChildren.findIndex((child) => child._x_sort_key === this.$item); 15208 let position = itemPosition !== -1 ? itemPosition : this.$position; 15209 let params = [this.$item, position]; 15210 let scope2 = { $item: this.$item, $position: position }; 15211 let sortId = el.getAttribute("wire:sort:group-id"); 15212 if (sortId !== null) { 15213 params.push(sortId); 15214 scope2.$id = sortId; 15215 } 15216 evaluateActionExpression(el, expression, { scope: scope2, params }); 15217 } 15218 }); 15219 } 15220 } 15221 }); 15222 15223
15223// js/features/supportCssModules.js 15224 var loadedStyles = /* @__PURE__ */ new Set(); 15225 on2("effect", ({ component, effects }) => { 15226 if (Object.prototype.hasOwnProperty.call(effects, "styleModule") && effects.styleModule) { 15227 let encodedName = component.name.replace(/\./g, "--").replace(/::/g, "---").replace(/:/g, "----"); 15228 let path = `${getModuleUrl()}/css/${encodedName}.css?v=${effects.styleModule}`; 15229 if (!loadedStyles.has(path)) { 15230 loadedStyles.add(path); 15231 injectStylesheet(path); 15232 } 15233 } 15234 if (Object.prototype.hasOwnProperty.call(effects, "globalStyleModule") && effects.globalStyleModule) { 15235 let encodedName = component.name.replace(/\./g, "--").replace(/::/g, "---").replace(/:/g, "----"); 15236 let path = `${getModuleUrl()}/css/${encodedName}.global.css?v=${effects.globalStyleModule}`; 15237 if (!loadedStyles.has(path)) { 15238 loadedStyles.add(path); 15239 injectStylesheet(path); 15240 } 15241 } 15242 }); 15243 function injectStylesheet(href) { 15244 let link = document.createElement("link"); 15245 link.rel = "stylesheet"; 15246 link.href = href; 15247 let nonce2 = getNonce(); 15248 if (nonce2) 15249 link.nonce = nonce2; 15250 document.head.appendChild(link); 15251 } 15252 15253
15253// js/debounce.js 15254 var callbacksByComponent = new WeakBag(); 15255 function callAndClearComponentDebounces(component, callback) { 15256 callbacksByComponent.each(component, (callbackRegister) => { 15257 callbackRegister.callback(); 15258 callbackRegister.callback = () => { 15259 }; 15260 }); 15261 callback(); 15262 } 15263 15264
15264// js/directives/wire-wildcard.js 15265 on2("directive.init", ({ el, directive: directive3, cleanup: cleanup2, component }) => { 15266 if (["snapshot", "effects", "model", "init", "loading", "poll", "ignore", "id", "data", "key", "target", "dirty", "sort"].includes(directive3.value)) 15267 return; 15268 if (customDirectiveHasBeenRegistered(directive3.value)) 15269 return; 15270 let attribute = directive3.rawName.replace("wire:", "x-on:"); 15271 if (directive3.value === "submit" && !directive3.modifiers.includes("prevent")) { 15272 attribute = attribute + ".prevent"; 15273 } 15274 if (directive3.modifiers.includes("async")) { 15275 attribute = attribute.replace(".async", ""); 15276 } 15277 if (directive3.modifiers.includes("renderless")) { 15278 attribute = attribute.replace(".renderless", ""); 15279 } 15280 if (directive3.modifiers.includes("prepend")) { 15281 attribute = attribute.replace(".prepend", ""); 15282 } 15283 if (directive3.modifiers.includes("append")) { 15284 attribute = attribute.replace(".append", ""); 15285 } 15286 let cleanupBinding = module_default.bind(el, { 15287 [attribute](e) { 15288 directive3.eventContext = e; 15289 directive3.wire = component.$wire; 15290 let execute = () => { 15291 callAndClearComponentDebounces(component, () => { 15292 if (directive3.value === "submit") { 15293 let submitButton = e.submitter || el.querySelector('button[type="submit"], input[type="submit"]'); 15294 setNextActionOrigin({ el, directive: directive3, targetEl: submitButton }); 15295 } else { 15296 setNextActionOrigin({ el, directive: directive3 }); 15297 } 15298 let livewireOptions = e.detail?.livewire; 15299 if (livewireOptions?.interceptAction) { 15300 setNextActionInterceptor(livewireOptions.interceptAction); 15301 } 15302 let expression = directive3.expression; 15303 if (livewireOptions?.defaultParams !== void 0 && !expression.includes("(")) { 15304 let params = Array.isArray(livewireOptions.defaultParams) ? livewireOptions.defaultParams : [livewireOptions.defaultParams]; 15305 expression = expression + "(" + params.map((p) => JSON.stringify(p)).join(", ") + ")"; 15306 } 15307 evaluateActionExpression(el, expression, { scope: { $event: e } }); 15308 }); 15309 }; 15310 if (el.__livewire_confirm) { 15311 el.__livewire_confirm(() => { 15312 execute(); 15313 }, () => { 15314 e.stopImmediatePropagation(); 15315 }); 15316 } else { 15317 execute(); 15318 } 15319 } 15320 }); 15321 cleanup2(cleanupBinding); 15322 }); 15323 15324
15324// js/directives/wire-confirm.js 15325 directive2("confirm", ({ el, directive: directive3 }) => { 15326 let message = directive3.expression; 15327 let shouldPrompt = directive3.modifiers.includes("prompt"); 15328 message = message.replaceAll("\\n", "\n"); 15329 if (message === "") 15330 message = "Are you sure?"; 15331 el.__livewire_confirm = (action, instead) => { 15332 if (shouldPrompt) { 15333 let [question, expected] = message.split("|"); 15334 if (!expected) { 15335 console.warn("Livewire: Must provide expectation with wire:confirm.prompt"); 15336 } else { 15337 let input = prompt(question); 15338 if (input === expected) { 15339 action(); 15340 } else { 15341 instead(); 15342 } 15343 } 15344 } else { 15345 if (confirm(message)) 15346 action(); 15347 else 15348 instead(); 15349 } 15350 }; 15351 }); 15352 15353
15353// js/directives/wire-offline.js 15354 var offlineHandlers = /* @__PURE__ */ new Set(); 15355 var onlineHandlers = /* @__PURE__ */ new Set(); 15356 window.addEventListener("offline", () => offlineHandlers.forEach((i) => i())); 15357 window.addEventListener("online", () => onlineHandlers.forEach((i) => i())); 15358 directive2("offline", ({ el, directive: directive3, cleanup: cleanup2 }) => { 15359 let setOffline = () => toggleBooleanStateDirective(el, directive3, true); 15360 let setOnline = () => toggleBooleanStateDirective(el, directive3, false); 15361 offlineHandlers.add(setOffline); 15362 onlineHandlers.add(setOnline); 15363 cleanup2(() => { 15364 offlineHandlers.delete(setOffline); 15365 onlineHandlers.delete(setOnline); 15366 }); 15367 }); 15368 15369
15369// js/directives/wire-loading.js 15370 directive2("loading", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 15371 let { targets, inverted } = getTargets(el); 15372 let [delay3, abortDelay] = applyDelay(directive3); 15373 let cleanupA = whenTargetsArePartOfRequest(component, el, targets, inverted, [ 15374 () => delay3(() => toggleBooleanStateDirective(el, directive3, true)), 15375 () => abortDelay(() => toggleBooleanStateDirective(el, directive3, false)) 15376 ]); 15377 let cleanupB = whenTargetsArePartOfFileUpload(component, targets, [ 15378 () => delay3(() => toggleBooleanStateDirective(el, directive3, true)), 15379 () => abortDelay(() => toggleBooleanStateDirective(el, directive3, false)) 15380 ]); 15381 cleanup2(() => { 15382 cleanupA(); 15383 cleanupB(); 15384 }); 15385 }); 15386 function applyDelay(directive3) { 15387 if (!directive3.modifiers.includes("delay") || directive3.modifiers.includes("none")) 15388 return [(i) => i(), (i) => i()]; 15389 let duration = 200; 15390 let delayModifiers = { 15391 "shortest": 50, 15392 "shorter": 100, 15393 "short": 150, 15394 "default": 200, 15395 "long": 300, 15396 "longer": 500, 15397 "longest": 1e3 15398 }; 15399 Object.keys(delayModifiers).some((key) => { 15400 if (directive3.modifiers.includes(key)) { 15401 duration = delayModifiers[key]; 15402 return true; 15403 } 15404 }); 15405 let timeout; 15406 let started2 = false; 15407 return [ 15408 (callback) => { 15409 timeout = setTimeout(() => { 15410 callback(); 15411 started2 = true; 15412 }, duration); 15413 }, 15414 async (callback) => { 15415 if (started2) { 15416 await callback(); 15417 started2 = false; 15418 } else { 15419 clearTimeout(timeout); 15420 } 15421 } 15422 ]; 15423 } 15424 function whenTargetsArePartOfRequest(component, el, targets, inverted, [startLoading, endLoading]) { 15425 return interceptMessage(({ message, onSend, onSuccess, onFinish }) => { 15426 if (component !== message.component) 15427 return; 15428 if (targets.length === 0) { 15429 let island = closestIsland(el); 15430 if (island && !message.hasActionForIsland(island)) { 15431 return; 15432 } 15433 if (!island && !message.hasActionForComponent()) { 15434 return; 15435 } 15436 } 15437 let matches3 = true; 15438 let cleared = false; 15439 onSend(({ payload }) => { 15440 if (targets.length > 0 && containsTargets(payload, targets) === inverted) { 15441 matches3 = false; 15442 } 15443 matches3 && startLoading(); 15444 }); 15445 onSuccess(({ onEffect }) => { 15446 onEffect(() => { 15447 if (matches3 && !cleared) { 15448 endLoading(); 15449 cleared = true; 15450 } 15451 }); 15452 }); 15453 onFinish(() => { 15454 if (matches3 && !cleared) { 15455 endLoading(); 15456 cleared = true; 15457 } 15458 }); 15459 }); 15460 } 15461 function whenTargetsArePartOfFileUpload(component, targets, [startLoading, endLoading]) { 15462 let eventMismatch = (e) => { 15463 let { id, property } = e.detail; 15464 if (id !== component.id) 15465 return true; 15466 if (targets.length > 0 && !targets.map((i) => i.target).includes(property)) 15467 return true; 15468 return false; 15469 }; 15470 let cleanupA = listen(window, "livewire-upload-start", (e) => { 15471 if (eventMismatch(e)) 15472 return; 15473 startLoading(); 15474 }); 15475 let cleanupB = listen(window, "livewire-upload-finish", (e) => { 15476 if (eventMismatch(e)) 15477 return; 15478 endLoading(); 15479 }); 15480 let cleanupC = listen(window, "livewire-upload-error", (e) => { 15481 if (eventMismatch(e)) 15482 return; 15483 endLoading(); 15484 }); 15485 return () => { 15486 cleanupA(); 15487 cleanupB(); 15488 cleanupC(); 15489 }; 15490 } 15491 function containsTargets(payload, targets) { 15492 let { updates, calls } = payload; 15493 return targets.some(({ target, params }) => { 15494 if (params) { 15495 return calls.some(({ method, params: methodParams }) => { 15496 return target === method && params === quickHash(JSON.stringify(methodParams)); 15497 }); 15498 } 15499 let hasMatchingUpdate = Object.keys(updates).some((property) => { 15500 if (property.includes(".")) { 15501 let propertyRoot = property.split(".")[0]; 15502 if (propertyRoot === target) 15503 return true; 15504 } 15505 return property === target; 15506 }); 15507 if (hasMatchingUpdate) 15508 return true; 15509 if (calls.map((i) => i.method).includes(target)) 15510 return true; 15511 }); 15512 } 15513 function getTargets(el) { 15514 let directives2 = getDirectives(el); 15515 let targets = []; 15516 let inverted = false;
15517 if (directives2.has("target")) { 15518 let directive3 = directives2.get("target"); 15519 if (directive3.modifiers.includes("except")) 15520 inverted = true; 15521 directive3.methods.forEach(({ method, params }) => { 15522 targets.push({ 15523 target: method, 15524 params: params && params.length > 0 ? quickHash(JSON.stringify(params)) : void 0 15525 }); 15526 }); 15527 } else { 15528 let nonActionOrModelLivewireDirectives = ["init", "dirty", "offline", "navigate", "target", "loading", "poll", "ignore", "key", "id"]; 15529 directives2.all().filter((i) => !nonActionOrModelLivewireDirectives.includes(i.value)).map((i) => i.expression.split("(")[0]).forEach((target) => targets.push({ target })); 15530 } 15531 return { targets, inverted }; 15532 } 15533 function quickHash(subject) { 15534 return btoa(encodeURIComponent(subject)); 15535 } 15536 15537
15537// js/directives/wire-replace.js 15538 directive2("replace", ({ el, directive: directive3 }) => { 15539 if (directive3.modifiers.includes("self")) { 15540 el.__livewire_replace_self = true; 15541 } else { 15542 el.__livewire_replace = true; 15543 } 15544 }); 15545 15546
15546// js/directives/wire-ignore.js 15547 directive2("ignore", ({ el, directive: directive3 }) => { 15548 if (directive3.modifiers.includes("self")) { 15549 el.__livewire_ignore_self = true; 15550 } else if (directive3.modifiers.includes("children")) { 15551 el.__livewire_ignore_children = true; 15552 } else { 15553 el.__livewire_ignore = true; 15554 } 15555 }); 15556 15557
15557// js/directives/wire-cloak.js 15558 module_default.interceptInit((el) => { 15559 if (el.hasAttribute("wire:cloak")) { 15560 module_default.mutateDom(() => el.removeAttribute("wire:cloak")); 15561 } 15562 }); 15563 15564
15564// js/directives/wire-model.js 15565 directive2("model", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 15566 component = findComponentByEl(el); 15567 let { expression, modifiers } = directive3; 15568 modifiers = modifiers.filter((m) => m !== "renderless"); 15569 if (!expression) { 15570 return console.warn("Livewire: [wire:model] is missing a value.", el); 15571 } 15572 if (componentIsMissingProperty(component, expression)) { 15573 return console.warn('Livewire: [wire:model="' + expression + '"] property does not exist on component: [' + component.name + "]", el); 15574 } 15575 if (el.type && el.type.toLowerCase() === "file") { 15576 return handleFileUpload(el, expression, component, cleanup2); 15577 } 15578 let liveIndex = modifiers.indexOf("live"); 15579 let isLive = liveIndex !== -1; 15580 let hasLazyWithoutLive = modifiers.includes("lazy") && !isLive; 15581 let shouldSendNetwork = isLive || hasLazyWithoutLive; 15582 let ephemeralModifiers = isLive && !hasLazyWithoutLive ? modifiers.slice(0, liveIndex) : modifiers.slice(); 15583 let networkModifiers = isLive && !hasLazyWithoutLive ? modifiers.slice(liveIndex + 1) : []; 15584 if (hasLazyWithoutLive) { 15585 ephemeralModifiers = ephemeralModifiers.filter((m) => m !== "lazy"); 15586 networkModifiers.push("change"); 15587 } 15588 if (!(ephemeralModifiers.includes("deep") || networkModifiers.includes("deep"))) { 15589 if (!ephemeralModifiers.includes("self")) { 15590 ephemeralModifiers.push("self"); 15591 } 15592 } 15593 let ephemeralOnBlur = ephemeralModifiers.includes("blur"); 15594 let ephemeralOnChange = ephemeralModifiers.includes("change") || ephemeralModifiers.includes("lazy"); 15595 let ephemeralOnEnter = ephemeralModifiers.includes("enter"); 15596 let hasEphemeralTriggers = ephemeralOnBlur || ephemeralOnChange || ephemeralOnEnter; 15597 let networkOnBlur = networkModifiers.includes("blur"); 15598 let networkOnChange = networkModifiers.includes("change") || networkModifiers.includes("lazy"); 15599 let networkOnEnter = networkModifiers.includes("enter"); 15600 let hasNetworkTriggers = networkOnBlur || networkOnChange || networkOnEnter; 15601 let isDebounced = networkModifiers.includes("debounce"); 15602 let isThrottled = networkModifiers.includes("throttle"); 15603 let update = () => { 15604 setNextActionOrigin({ el, directive: directive3 }); 15605 if (isLive || isDebounced) { 15606 setNextActionMetadata({ type: "model.live" }); 15607 } 15608 expression.startsWith("$parent") ? component.$wire.$parent.$commit() : component.$wire.$commit(); 15609 }; 15610 let debouncedUpdate = update; 15611 if (shouldSendNetwork && !hasNetworkTriggers && isRealtimeInput(el) || isDebounced) { 15612 debouncedUpdate = debounce2(debouncedUpdate, parseModifierDuration(networkModifiers, "debounce") || 150); 15613 } 15614 if (isThrottled) { 15615 debouncedUpdate = throttle3(debouncedUpdate, parseModifierDuration(networkModifiers, "throttle") || 150); 15616 } 15617 let bindings = {}; 15618 if (shouldSendNetwork && networkOnBlur) { 15619 bindings["@blur"] = () => { 15620 queueMicrotask(() => { 15621 let target = expression.startsWith("$parent") ? component.parent : component; 15622 if (target && !checkDirty(target)) 15623 return; 15624 update(); 15625 }); 15626 }; 15627 } 15628 if (shouldSendNetwork && networkOnChange) { 15629 bindings["@change"] = () => update(); 15630 } 15631 if (shouldSendNetwork && networkOnEnter) { 15632 bindings["@keydown.enter"] = () => update(); 15633 } 15634 let xModelTail = getModifierTail(ephemeralModifiers); 15635 bindings["x-model" + xModelTail] = () => { 15636 return { 15637 get() { 15638 return dataGet(component.$wire, expression); 15639 }, 15640 set(value) { 15641 dataSet(component.$wire, expression, value); 15642 if (shouldSendNetwork && !hasNetworkTriggers) { 15643 debouncedUpdate(); 15644 } 15645 } 15646 }; 15647 }; 15648 module_default.bind(el, bindings); 15649 }); 15650 function getModifierTail(modifiers) { 15651 modifiers = modifiers.filter((i) => ![ 15652 "defer", 15653 "live" 15654 ].includes(i)); 15655 if (modifiers.includes("debounce")) { 15656 let index2 = modifiers.indexOf("debounce"); 15657 let hasDuration = parseModifierDuration(modifiers, "debounce") !== void 0; 15658 modifiers.splice(index2, hasDuration ? 2 : 1); 15659 } 15660 if (modifiers.includes("throttle")) { 15661 let index2 = modifiers.indexOf("throttle"); 15662 let hasDuration = parseModifierDuration(modifiers, "throttle") !== void 0; 15663 modifiers.splice(index2, hasDuration ? 2 : 1); 15664 } 15665 if (modifiers.length === 0) 15666 return ""; 15667 return "." + modifiers.join("."); 15668 } 15669 function isRealtimeInput(el) { 15670 return ["INPUT", "TEXTAREA"].includes(el.tagName.toUpperCase()) && !["checkbox", "radio"].includes(el.type) || el.tagName.toUpperCase() === "UI-SLIDER" || el.tagName.toUpperCase() === "UI-COMPOSER"; 15671 } 15672 function componentIsMissingProperty(component, property) { 15673 if (property.startsWith("$parent")) { 15674 let parent = findComponentByEl(component.el.parentElement, false); 15675 if (!parent) 15676 return true; 15677 return componentIsMissingProperty(parent, property.slice(7).replace(/^\./, "")); 15678 } 15679 let match = property.match(/^\[['"]?([^\]'"]+)['"]?\]/) || property.match(/^([^.\[]+)/); 15680 let baseProperty = match[1]; 15681 return !Object.keys(component.canonical).includes(baseProperty); 15682 } 15683 function debounce2(func, wait) { 15684 var timeout; 15685 return function() { 15686 var context = this, args = arguments; 15687 var later = function() { 15688 timeout = null;
15689 func.apply(context, args); 15690 }; 15691 clearTimeout(timeout); 15692 timeout = setTimeout(later, wait); 15693 }; 15694 } 15695 function throttle3(func, limit) { 15696 let inThrottle; 15697 return function() { 15698 let context = this, args = arguments; 15699 if (!inThrottle) { 15700 func.apply(context, args); 15701 inThrottle = true; 15702 setTimeout(() => inThrottle = false, limit); 15703 } 15704 }; 15705 } 15706 function parseModifierDuration(modifiers, key) { 15707 let index2 = modifiers.indexOf(key); 15708 if (index2 === -1) 15709 return void 0; 15710 let nextModifier = modifiers[modifiers.indexOf(key) + 1] || "invalid-wait"; 15711 let duration = nextModifier.split("ms")[0]; 15712 return !isNaN(duration) ? duration : void 0; 15713 } 15714 15715
15715// js/directives/wire-init.js 15716 directive2("init", ({ component, el, directive: directive3 }) => { 15717 let fullMethod = directive3.expression ? directive3.expression : "$refresh"; 15718 setNextActionOrigin({ el, directive: directive3 }); 15719 evaluateActionExpression(el, fullMethod); 15720 }); 15721 15722
15722// js/directives/wire-poll.js 15723 directive2("poll", ({ el, directive: directive3, component }) => { 15724 let interval = extractDurationFrom(directive3.modifiers, 2e3); 15725 let { start: start3, pauseWhile, throttleWhile, stopWhen } = poll(() => { 15726 triggerComponentRequest(el, directive3, component); 15727 }, interval); 15728 start3(); 15729 throttleWhile(() => theTabIsInTheBackground() && theDirectiveIsMissingKeepAlive(directive3)); 15730 pauseWhile(() => theDirectiveHasVisible(directive3) && theElementIsNotInTheViewport(el)); 15731 pauseWhile(() => theDirectiveIsOffTheElement(el)); 15732 pauseWhile(() => livewireIsOffline()); 15733 pauseWhile(() => sessionIsExpired()); 15734 stopWhen(() => theElementIsDisconnected(el)); 15735 }); 15736 function triggerComponentRequest(el, directive3, component) { 15737 setNextActionOrigin({ el, directive: directive3, targetEl: null }); 15738 setNextActionMetadata({ type: "poll" }); 15739 let fullMethod = directive3.expression ? directive3.expression : "$refresh"; 15740 evaluateActionExpression(el, fullMethod); 15741 } 15742 function poll(callback, interval = 2e3) { 15743 let pauseConditions = []; 15744 let throttleConditions = []; 15745 let stopConditions = []; 15746 return { 15747 start() { 15748 let clear2 = syncronizedInterval(interval, () => { 15749 if (stopConditions.some((i) => i())) 15750 return clear2(); 15751 if (pauseConditions.some((i) => i())) 15752 return; 15753 if (throttleConditions.some((i) => i()) && Math.random() < 0.95) 15754 return; 15755 callback(); 15756 }); 15757 }, 15758 pauseWhile(condition) { 15759 pauseConditions.push(condition); 15760 }, 15761 throttleWhile(condition) { 15762 throttleConditions.push(condition); 15763 }, 15764 stopWhen(condition) { 15765 stopConditions.push(condition); 15766 } 15767 }; 15768 } 15769 var clocks = []; 15770 function syncronizedInterval(ms, callback) { 15771 if (!clocks[ms]) { 15772 let clock = { 15773 timer: setInterval(() => clock.callbacks.forEach((i) => i()), ms), 15774 callbacks: /* @__PURE__ */ new Set() 15775 }; 15776 clocks[ms] = clock; 15777 } 15778 clocks[ms].callbacks.add(callback); 15779 return () => { 15780 clocks[ms].callbacks.delete(callback); 15781 if (clocks[ms].callbacks.size === 0) { 15782 clearInterval(clocks[ms].timer); 15783 delete clocks[ms]; 15784 } 15785 }; 15786 } 15787 var isOffline = false; 15788 window.addEventListener("offline", () => isOffline = true); 15789 window.addEventListener("online", () => isOffline = false); 15790 function livewireIsOffline() { 15791 return isOffline; 15792 } 15793 var inBackground = false; 15794 document.addEventListener("visibilitychange", () => { 15795 inBackground = document.hidden; 15796 }, false); 15797 function theTabIsInTheBackground() { 15798 return inBackground; 15799 } 15800 function theDirectiveIsOffTheElement(el) { 15801 return !getDirectives(el).has("poll"); 15802 } 15803 function theDirectiveIsMissingKeepAlive(directive3) { 15804 return !directive3.modifiers.includes("keep-alive"); 15805 } 15806 function theDirectiveHasVisible(directive3) { 15807 return directive3.modifiers.includes("visible"); 15808 } 15809 function theElementIsNotInTheViewport(el) { 15810 let bounding = el.getBoundingClientRect(); 15811 return !(bounding.top < (window.innerHeight || document.documentElement.clientHeight) && bounding.left < (window.innerWidth || document.documentElement.clientWidth) && bounding.bottom > 0 && bounding.right > 0); 15812 } 15813 function theElementIsDisconnected(el) { 15814 return el.isConnected === false; 15815 } 15816 function extractDurationFrom(modifiers, defaultDuration) { 15817 let durationInMilliSeconds; 15818 let durationInMilliSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)ms/)); 15819 let durationInSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)s/)); 15820 if (durationInMilliSecondsString) { 15821 durationInMilliSeconds = Number(durationInMilliSecondsString.replace("ms", "")); 15822 } else if (durationInSecondsString) { 15823 durationInMilliSeconds = Number(durationInSecondsString.replace("s", "")) * 1e3; 15824 } 15825 return durationInMilliSeconds || defaultDuration; 15826 } 15827 15828
15828// js/directives/wire-show.js 15829 module_default.interceptInit((el) => { 15830 for (let i = 0; i < el.attributes.length; i++) { 15831 if (el.attributes[i].name.startsWith("wire:show")) { 15832 let { name, value } = el.attributes[i]; 15833 let modifierString = name.split("wire:show")[1]; 15834 let expression = value.trim(); 15835 module_default.bind(el, { 15836 ["x-show" + modifierString]() { 15837 return evaluateActionExpression(el, expression); 15838 } 15839 }); 15840 } 15841 } 15842 }); 15843 15844
15844// js/directives/wire-text.js 15845 module_default.interceptInit((el) => { 15846 for (let i = 0; i < el.attributes.length; i++) { 15847 if (el.attributes[i].name.startsWith("wire:text")) { 15848 let { name, value } = el.attributes[i]; 15849 let modifierString = name.split("wire:text")[1]; 15850 let expression = value.trim(); 15851 module_default.bind(el, { 15852 ["x-text" + modifierString]() { 15853 return evaluateActionExpression(el, expression); 15854 } 15855 }); 15856 } 15857 } 15858 }); 15859 15860
15860// js/directives/wire-bind.js 15861 module_default.interceptInit((el) => { 15862 for (let i = 0; i < el.attributes.length; i++) { 15863 if (el.attributes[i].name.startsWith("wire:bind:")) { 15864 let { name, value } = el.attributes[i]; 15865 let remainder = name.split("wire:bind")[1]; 15866 let expression = value.trim(); 15867 module_default.bind(el, { 15868 ["x-bind" + remainder]() { 15869 return evaluateActionExpression(el, expression); 15870 } 15871 }); 15872 } 15873 } 15874 }); 15875 15876
15876// js/index.js 15877 var Livewire2 = { 15878 directive: directive2, 15879 dispatchTo, 15880 interceptAction: (callback) => interceptAction(callback), 15881 interceptMessage: (callback) => interceptMessage(callback), 15882 interceptRequest: (callback) => interceptRequest(callback), 15883 fireAction: (component, method, params = [], metadata = {}) => fireAction(component, method, params, metadata), 15884 start: start2, 15885 first, 15886 find, 15887 getByName, 15888 all, 15889 hook: on2, 15890 trigger: trigger2, 15891 triggerAsync, 15892 dispatch: dispatchGlobal, 15893 on: on3, 15894 get navigate() { 15895 return module_default.navigate; 15896 } 15897 }; 15898 var warnAboutMultipleInstancesOf = (entity) => console.warn(`Detected multiple instances of ${entity} running`); 15899 if (window.Livewire) 15900 warnAboutMultipleInstancesOf("Livewire"); 15901 if (window.Alpine) 15902 warnAboutMultipleInstancesOf("Alpine"); 15903 window.Livewire = Livewire2; 15904 window.Alpine = module_default; 15905 if (window.livewireScriptConfig === void 0) { 15906 window.Alpine.__fromLivewire = true; 15907 document.addEventListener("DOMContentLoaded", () => { 15908 if (window.Alpine.__fromLivewire === void 0) { 15909 warnAboutMultipleInstancesOf("Alpine"); 15910 } 15911 Livewire2.start(); 15912 }); 15913 } 15914})(); 15915/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress 15916 * @license MIT */ 15917/*! Bundled license information: 15918 15919sortablejs/modular/sortable.esm.js: 15920 (**! 15921 * Sortable 1.15.2 15922 * @author RubaXa <[email protected]> 15923 * @author owenm <[email protected]> 15924 * @license MIT 15925 *) 15926*/ 15927/*! Bundled license information: 15928 15929tabbable/dist/index.esm.js: 15930 (*! 15931 * tabbable 6.4.0 15932 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE 15933 *) 15934 15935focus-trap/dist/focus-trap.esm.js: 15936 (*! 15937 * focus-trap 8.0.0 15938 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE 15939 *) 15940 (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *) 15941*/
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.