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 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 }); 718 } 719 var UploadManager = class { 720 constructor(component) { 721 this.component = component; 722 this.uploadBag = new MessageBag(); 723 this.removeBag = new MessageBag(); 724 } 725 registerListeners() { 726 this.component.$wire.$on("upload:generatedSignedUrl", ({ name, url }) => { 727 setUploadLoading(this.component, name); 728 this.handleSignedUrl(name, url); 729 }); 730 this.component.$wire.$on("upload:generatedSignedUrlForS3", ({ name, payload }) => { 731 setUploadLoading(this.component, name); 732 this.handleS3PreSignedUrl(name, payload); 733 }); 734 this.component.$wire.$on("upload:finished", ({ name, tmpFilenames }) => this.markUploadFinished(name, tmpFilenames)); 735 this.component.$wire.$on("upload:errored", ({ name }) => this.markUploadErrored(name)); 736 this.component.$wire.$on("upload:removed", ({ name, tmpFilename }) => this.removeBag.shift(name).finishCallback(tmpFilename)); 737 } 738 upload(name, file, finishCallback, errorCallback, progressCallback, cancelledCallback) { 739 this.setUpload(name, { 740 files: [file], 741 multiple: false, 742 finishCallback, 743 errorCallback, 744 progressCallback, 745 cancelledCallback, 746 append: false 747 }); 748 } 749 uploadMultiple(name, files, finishCallback, errorCallback, progressCallback, cancelledCallback, append = true) { 750 this.setUpload(name, { 751 files: Array.from(files), 752 multiple: true, 753 finishCallback, 754 errorCallback, 755 progressCallback, 756 cancelledCallback, 757 append 758 }); 759 } 760 removeUpload(name, tmpFilename, finishCallback) { 761 this.removeBag.push(name, { 762 tmpFilename, 763 finishCallback 764 }); 765 this.component.$wire.call("_removeUpload", name, tmpFilename); 766 } 767 setUpload(name, uploadObject) { 768 this.uploadBag.add(name, uploadObject); 769 if (this.uploadBag.get(name).length === 1) { 770 this.startUpload(name, uploadObject); 771 } 772 } 773 handleSignedUrl(name, url) { 774 let formData = new FormData();
775 Array.from(this.uploadBag.first(name).files).forEach((file) => formData.append("files[]", file, file.name)); 776 let headers = { 777 "Accept": "application/json" 778 }; 779 let csrfToken = getCsrfToken(); 780 if (csrfToken) 781 headers["X-CSRF-TOKEN"] = csrfToken; 782 this.makeRequest(name, formData, "post", url, headers, (response) => { 783 return response.paths; 784 }); 785 } 786 handleS3PreSignedUrl(name, payload) { 787 let formData = this.uploadBag.first(name).files[0]; 788 let headers = payload.headers; 789 if ("Host" in headers) 790 delete headers.Host; 791 let url = payload.url; 792 this.makeRequest(name, formData, "put", url, headers, (response) => { 793 return [payload.path]; 794 }); 795 } 796 makeRequest(name, formData, method, url, headers, retrievePaths) { 797 let request = new XMLHttpRequest(); 798 request.open(method, url); 799 Object.entries(headers).forEach(([key, value]) => { 800 request.setRequestHeader(key, value); 801 }); 802 request.upload.addEventListener("progress", (e) => { 803 e.detail = {}; 804 e.detail.progress = Math.floor(e.loaded * 100 / e.total); 805 this.uploadBag.first(name).progressCallback(e); 806 }); 807 request.addEventListener("load", () => { 808 if ((request.status + "")[0] === "2") { 809 let paths = retrievePaths(request.response && JSON.parse(request.response)); 810 this.component.$wire.call("_finishUpload", name, paths, this.uploadBag.first(name).multiple, this.uploadBag.first(name).append); 811 return; 812 } 813 let errors = null; 814 if (request.status === 422) { 815 errors = request.response; 816 } 817 this.component.$wire.call("_uploadErrored", name, errors, this.uploadBag.first(name).multiple); 818 }); 819 request.addEventListener("error", () => { 820 this.component.$wire.call("_uploadErrored", name, null, this.uploadBag.first(name).multiple); 821 }); 822 this.uploadBag.first(name).request = request; 823 request.send(formData); 824 } 825 startUpload(name, uploadObject) { 826 let fileInfos = uploadObject.files.map((file) => { 827 return { name: file.name, size: file.size, type: file.type }; 828 }); 829 this.component.$wire.call("_startUpload", name, fileInfos, uploadObject.multiple); 830 setUploadLoading(this.component, name); 831 } 832 markUploadFinished(name, tmpFilenames) { 833 unsetUploadLoading(this.component); 834 let uploadObject = this.uploadBag.shift(name); 835 uploadObject.finishCallback(uploadObject.multiple ? tmpFilenames : tmpFilenames[0]); 836 if (this.uploadBag.get(name).length > 0) 837 this.startUpload(name, this.uploadBag.last(name)); 838 } 839 markUploadErrored(name) { 840 unsetUploadLoading(this.component); 841 this.uploadBag.shift(name).errorCallback(); 842 if (this.uploadBag.get(name).length > 0) 843 this.startUpload(name, this.uploadBag.last(name)); 844 } 845 cancelUpload(name, cancelledCallback = null) { 846 unsetUploadLoading(this.component); 847 let uploadItem = this.uploadBag.first(name); 848 if (uploadItem) { 849 if (uploadItem.request) { 850 uploadItem.request.abort(); 851 } 852 this.uploadBag.shift(name).cancelledCallback(); 853 if (cancelledCallback) 854 cancelledCallback(); 855 } 856 } 857 }; 858 var MessageBag = class { 859 constructor() { 860 this.bag = {}; 861 } 862 add(name, thing) { 863 if (!this.bag[name]) { 864 this.bag[name] = []; 865 } 866 this.bag[name].push(thing); 867 } 868 push(name, thing) { 869 this.add(name, thing); 870 } 871 first(name) { 872 if (!this.bag[name]) 873 return null; 874 return this.bag[name][0]; 875 } 876 last(name) { 877 return this.bag[name].slice(-1)[0]; 878 } 879 get(name) { 880 return this.bag[name]; 881 } 882 shift(name) { 883 return this.bag[name].shift(); 884 } 885 call(name, ...params) { 886 (this.listeners[name] || []).forEach((callback) => { 887 callback(...params); 888 }); 889 } 890 has(name) { 891 return Object.keys(this.listeners).includes(name); 892 } 893 }; 894 function setUploadLoading() { 895 } 896 function unsetUploadLoading() { 897 } 898 function upload(component, name, file, finishCallback = () => { 899 }, errorCallback = () => { 900 }, progressCallback = () => { 901 }, cancelledCallback = () => { 902 }) { 903 let uploadManager = getUploadManager(component); 904 uploadManager.upload( 905 name, 906 file, 907 finishCallback, 908 errorCallback, 909 progressCallback, 910 cancelledCallback 911 ); 912 } 913 function uploadMultiple(component, name, files, finishCallback = () => { 914 }, errorCallback = () => { 915 }, progressCallback = () => { 916 }, cancelledCallback = () => { 917 }, append = true) { 918 let uploadManager = getUploadManager(component); 919 uploadManager.uploadMultiple( 920 name, 921 files, 922 finishCallback, 923 errorCallback, 924 progressCallback, 925 cancelledCallback, 926 append 927 ); 928 } 929 function removeUpload(component, name, tmpFilename, finishCallback = () => { 930 }, errorCallback = () => { 931 }) { 932 let uploadManager = getUploadManager(component); 933 uploadManager.removeUpload( 934 name, 935 tmpFilename, 936 finishCallback, 937 errorCallback 938 ); 939 } 940 function cancelUpload(component, name, cancelledCallback = () => { 941 }) { 942 let uploadManager = getUploadManager(component); 943 uploadManager.cancelUpload( 944 name, 945 cancelledCallback 946 ); 947 } 948 949
vendor: 109,781 bytes, lines 949-4300
949// node_modules/alpinejs/dist/module.esm.js 950 var flushPending = false; 951 var flushing = false; 952 var queue = []; 953 var lastFlushedIndex = -1; 954 var transactionActive = false; 955 function scheduler(callback) { 956 queueJob(callback); 957 } 958 function startTransaction() { 959 transactionActive = true; 960 } 961 function commitTransaction() { 962 transactionActive = false; 963 queueFlush(); 964 } 965 function queueJob(job) { 966 if (!queue.includes(job)) 967 queue.push(job); 968 queueFlush(); 969 } 970 function dequeueJob(job) { 971 let index2 = queue.indexOf(job); 972 if (index2 !== -1 && index2 > lastFlushedIndex) 973 queue.splice(index2, 1); 974 } 975 function queueFlush() { 976 if (!flushing && !flushPending) { 977 if (transactionActive) 978 return; 979 flushPending = true; 980 queueMicrotask(flushJobs); 981 } 982 } 983 function flushJobs() { 984 flushPending = false; 985 flushing = true; 986 for (let i = 0; i < queue.length; i++) { 987 queue[i](); 988 lastFlushedIndex = i; 989 } 990 queue.length = 0; 991 lastFlushedIndex = -1; 992 flushing = false; 993 } 994 var reactive; 995 var effect; 996 var release; 997 var raw; 998 var shouldSchedule = true; 999 function disableEffectScheduling(callback) { 1000 shouldSchedule = false; 1001 callback(); 1002 shouldSchedule = true; 1003 } 1004 function setReactivityEngine(engine) { 1005 reactive = engine.reactive; 1006 release = engine.release; 1007 effect = (callback) => engine.effect(callback, { scheduler: (task) => { 1008 if (shouldSchedule) { 1009 scheduler(task); 1010 } else { 1011 task(); 1012 } 1013 } }); 1014 raw = engine.raw; 1015 } 1016 function overrideEffect(override) { 1017 effect = override; 1018 } 1019 function elementBoundEffect(el) { 1020 let cleanup2 = () => { 1021 }; 1022 let wrappedEffect = (callback) => { 1023 let effectReference = effect(callback); 1024 if (!el._x_effects) { 1025 el._x_effects = /* @__PURE__ */ new Set(); 1026 el._x_runEffects = () => { 1027 el._x_effects.forEach((i) => i()); 1028 }; 1029 } 1030 el._x_effects.add(effectReference); 1031 cleanup2 = () => { 1032 if (effectReference === void 0) 1033 return; 1034 el._x_effects.delete(effectReference); 1035 release(effectReference); 1036 }; 1037 return effectReference; 1038 }; 1039 return [wrappedEffect, () => { 1040 cleanup2(); 1041 }]; 1042 } 1043 function watch(getter, callback) { 1044 let firstTime = true; 1045 let oldValue; 1046 let oldValueJSON; 1047 let effectReference = effect(() => { 1048 let value = getter(); 1049 let newJSON = JSON.stringify(value); 1050 if (!firstTime) { 1051 if (typeof value === "object" || value !== oldValue) { 1052 let previousValue = typeof oldValue === "object" ? JSON.parse(oldValueJSON) : oldValue; 1053 queueMicrotask(() => { 1054 callback(value, previousValue); 1055 }); 1056 } 1057 } 1058 oldValue = value; 1059 oldValueJSON = newJSON; 1060 firstTime = false; 1061 }); 1062 return () => release(effectReference); 1063 } 1064 async function transaction(callback) { 1065 startTransaction(); 1066 try { 1067 await callback(); 1068 await Promise.resolve(); 1069 } finally { 1070 commitTransaction(); 1071 } 1072 } 1073 var onAttributeAddeds = []; 1074 var onElRemoveds = []; 1075 var onElAddeds = []; 1076 function onElAdded(callback) { 1077 onElAddeds.push(callback); 1078 } 1079 function onElRemoved(el, callback) { 1080 if (typeof callback === "function") { 1081 if (!el._x_cleanups) 1082 el._x_cleanups = []; 1083 el._x_cleanups.push(callback); 1084 } else { 1085 callback = el; 1086 onElRemoveds.push(callback); 1087 } 1088 } 1089 function onAttributesAdded(callback) { 1090 onAttributeAddeds.push(callback); 1091 } 1092 function onAttributeRemoved(el, name, callback) { 1093 if (!el._x_attributeCleanups) 1094 el._x_attributeCleanups = {}; 1095 if (!el._x_attributeCleanups[name]) 1096 el._x_attributeCleanups[name] = []; 1097 el._x_attributeCleanups[name].push(callback); 1098 } 1099 function cleanupAttributes(el, names) { 1100 if (!el._x_attributeCleanups) 1101 return; 1102 Object.entries(el._x_attributeCleanups).forEach(([name, value]) => { 1103 if (names === void 0 || names.includes(name)) { 1104 value.forEach((i) => i()); 1105 delete el._x_attributeCleanups[name]; 1106 } 1107 }); 1108 } 1109 function cleanupElement(el) { 1110 el._x_effects?.forEach(dequeueJob); 1111 while (el._x_cleanups?.length) 1112 el._x_cleanups.pop()(); 1113 } 1114 var observer = new MutationObserver(onMutate); 1115 var currentlyObserving = false; 1116 function startObservingMutations() { 1117 observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true }); 1118 currentlyObserving = true; 1119 } 1120 function stopObservingMutations() { 1121 flushObserver(); 1122 observer.disconnect(); 1123 currentlyObserving = false; 1124 } 1125 var queuedMutations = []; 1126 function flushObserver() { 1127 let records = observer.takeRecords(); 1128 queuedMutations.push(() => records.length > 0 && onMutate(records)); 1129 let queueLengthWhenTriggered = queuedMutations.length; 1130 queueMicrotask(() => { 1131 if (queuedMutations.length === queueLengthWhenTriggered) { 1132 while (queuedMutations.length > 0) 1133 queuedMutations.shift()(); 1134 } 1135 }); 1136 } 1137 function mutateDom(callback) { 1138 if (!currentlyObserving) 1139 return callback(); 1140 stopObservingMutations(); 1141 let result = callback(); 1142 startObservingMutations(); 1143 return result; 1144 } 1145 var isCollecting = false; 1146 var deferredMutations = []; 1147 function deferMutations() { 1148 isCollecting = true; 1149 } 1150 function flushAndStopDeferringMutations() { 1151 isCollecting = false; 1152 onMutate(deferredMutations); 1153 deferredMutations = []; 1154 } 1155 function onMutate(mutations) { 1156 if (isCollecting) { 1157 deferredMutations = deferredMutations.concat(mutations); 1158 return; 1159 } 1160 let addedNodes = []; 1161 let removedNodes = /* @__PURE__ */ new Set(); 1162 let addedAttributes = /* @__PURE__ */ new Map(); 1163 let removedAttributes = /* @__PURE__ */ new Map(); 1164 for (let i = 0; i < mutations.length; i++) { 1165 if (mutations[i].target._x_ignoreMutationObserver) 1166 continue; 1167 if (mutations[i].type === "childList") { 1168 mutations[i].removedNodes.forEach((node) => { 1169 if (node.nodeType !== 1) 1170 return; 1171 if (!node._x_marker) 1172 return; 1173 removedNodes.add(node); 1174 }); 1175 mutations[i].addedNodes.forEach((node) => { 1176 if (node.nodeType !== 1) 1177 return; 1178 if (removedNodes.has(node)) { 1179 removedNodes.delete(node); 1180 return; 1181 } 1182 if (node._x_marker) 1183 return; 1184 addedNodes.push(node); 1185 }); 1186 } 1187 if (mutations[i].type === "attributes") { 1188 let el = mutations[i].target; 1189 let name = mutations[i].attributeName; 1190 let oldValue = mutations[i].oldValue; 1191 let add2 = () => { 1192 if (!addedAttributes.has(el)) 1193 addedAttributes.set(el, []); 1194 addedAttributes.get(el).push({ name, value: el.getAttribute(name) }); 1195 }; 1196 let remove = () => { 1197 if (!removedAttributes.has(el)) 1198 removedAttributes.set(el, []); 1199 removedAttributes.get(el).push(name); 1200 }; 1201 if (el.hasAttribute(name) && oldValue === null) { 1202 add2(); 1203 } else if (el.hasAttribute(name)) { 1204 remove(); 1205 add2(); 1206 } else { 1207 remove(); 1208 } 1209 } 1210 } 1211 removedAttributes.forEach((attrs, el) => { 1212 cleanupAttributes(el, attrs); 1213 }); 1214 addedAttributes.forEach((attrs, el) => { 1215 onAttributeAddeds.forEach((i) => i(el, attrs)); 1216 }); 1217 for (let node of removedNodes) { 1218 if (addedNodes.some((i) => i.contains(node))) 1219 continue; 1220 onElRemoveds.forEach((i) => i(node)); 1221 } 1222 for (let node of addedNodes) { 1223 if (!node.isConnected) 1224 continue; 1225 onElAddeds.forEach((i) => i(node)); 1226 } 1227 addedNodes = null; 1228 removedNodes = null; 1229 addedAttributes = null; 1230 removedAttributes = null; 1231 } 1232 function scope(node) { 1233 return mergeProxies(closestDataStack(node)); 1234 } 1235 function addScopeToNode(node, data2, referenceNode) { 1236 node._x_dataStack = [data2, ...closestDataStack(referenceNode || node)]; 1237 return () => { 1238 node._x_dataStack = node._x_dataStack.filter((i) => i !== data2); 1239 }; 1240 } 1241 function closestDataStack(node) { 1242 if (node._x_dataStack) 1243 return node._x_dataStack; 1244 if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) { 1245 return closestDataStack(node.host); 1246 } 1247 if (!node.parentNode) { 1248 return []; 1249 } 1250 return closestDataStack(node.parentNode); 1251 } 1252 function mergeProxies(objects) { 1253 return new Proxy({ objects }, mergeProxyTrap); 1254 } 1255 function keyInPrototypeChain(obj, key) { 1256 if (obj === null || obj === Object.prototype) 1257 return null; 1258 if (Object.prototype.hasOwnProperty.call(obj, key)) 1259 return obj; 1260 return keyInPrototypeChain(Object.getPrototypeOf(obj), key); 1261 } 1262 var mergeProxyTrap = { 1263 ownKeys({ objects }) { 1264 return Array.from( 1265 new Set(objects.flatMap((i) => Object.keys(i))) 1266 ); 1267 }, 1268 has({ objects }, name) { 1269 if (name == Symbol.unscopables) 1270 return false; 1271 return objects.some( 1272 (obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name) 1273 ); 1274 }, 1275 get({ objects }, name, thisProxy) { 1276 if (name == "toJSON") 1277 return collapseProxies; 1278 return Reflect.get( 1279 objects.find( 1280 (obj) => Reflect.has(obj, name) 1281 ) || {}, 1282 name, 1283 thisProxy 1284 ); 1285 }, 1286 set({ objects }, name, value, thisProxy) { 1287 let target; 1288 for (const obj of objects) { 1289 target = keyInPrototypeChain(obj, name); 1290 if (target) 1291 break; 1292 } 1293 if (!target) 1294 target = objects[objects.length - 1]; 1295 const descriptor = Object.getOwnPropertyDescriptor(target, name); 1296 if (descriptor?.set && descriptor?.get) 1297 return descriptor.set.call(thisProxy, value) || true; 1298 return Reflect.set(target, name, value); 1299 } 1300 }; 1301 function collapseProxies() { 1302 let keys = Reflect.ownKeys(this); 1303 return keys.reduce((acc, key) => { 1304 acc[key] = Reflect.get(this, key); 1305 return acc; 1306 }, {}); 1307 } 1308 function initInterceptors(data2) { 1309 let isObject3 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null; 1310 let recurse = (obj, basePath = "") => { 1311 Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => { 1312 if (enumerable === false || value === void 0) 1313 return; 1314 if (typeof value === "object" && value !== null && value.__v_skip) 1315 return; 1316 let path = basePath === "" ? key : `${basePath}.${key}`; 1317 if (typeof value === "object" && value !== null && value._x_interceptor) { 1318 obj[key] = value.initialize(data2, path, key); 1319 } else { 1320 if (isObject3(value) && value !== obj && !(value instanceof Element)) { 1321 recurse(value, path); 1322 } 1323 } 1324 }); 1325 }; 1326 return recurse(data2); 1327 } 1328 function interceptor(callback, mutateObj = () => { 1329 }) { 1330 let obj = { 1331 initialValue: void 0, 1332 _x_interceptor: true, 1333 initialize(data2, path, key) { 1334 return callback(this.initialValue, () => get(data2, path), (value) => set(data2, path, value), path, key); 1335 } 1336 }; 1337 mutateObj(obj); 1338 return (initialValue) => { 1339 if (typeof initialValue === "object" && initialValue !== null && initialValue._x_interceptor) { 1340 let initialize = obj.initialize.bind(obj); 1341 obj.initialize = (data2, path, key) => { 1342 let innerValue = initialValue.initialize(data2, path, key); 1343 obj.initialValue = innerValue; 1344 return initialize(data2, path, key); 1345 }; 1346 } else { 1347 obj.initialValue = initialValue; 1348 } 1349 return obj; 1350 }; 1351 } 1352 function get(obj, path) { 1353 return path.split(".").reduce((carry, segment) => carry[segment], obj); 1354 } 1355 function set(obj, path, value) { 1356 if (typeof path === "string") 1357 path = path.split("."); 1358 if (path.length === 1) 1359 obj[path[0]] = value; 1360 else if (path.length === 0) 1361 throw error; 1362 else { 1363 if (obj[path[0]]) 1364 return set(obj[path[0]], path.slice(1), value); 1365 else { 1366 obj[path[0]] = {}; 1367 return set(obj[path[0]], path.slice(1), value); 1368 } 1369 } 1370 } 1371 var magics = {}; 1372 function magic(name, callback) { 1373 magics[name] = callback; 1374 } 1375 function injectMagics(obj, el) { 1376 let memoizedUtilities = getUtilities(el); 1377 Object.entries(magics).forEach(([name, callback]) => { 1378 Object.defineProperty(obj, `$${name}`, { 1379 get() { 1380 return callback(el, memoizedUtilities); 1381 }, 1382 enumerable: false 1383 }); 1384 }); 1385 return obj; 1386 } 1387 function getUtilities(el) { 1388 let [utilities, cleanup2] = getElementBoundUtilities(el); 1389 let utils = { interceptor, ...utilities }; 1390 onElRemoved(el, cleanup2); 1391 return utils; 1392 } 1393 function tryCatch(el, expression, callback, ...args) { 1394 try { 1395 return callback(...args); 1396 } catch (e) { 1397 handleError(e, el, expression); 1398 } 1399 } 1400 function handleError(...args) { 1401 return errorHandler(...args); 1402 } 1403 var errorHandler = normalErrorHandler; 1404 function setErrorHandler(handler4) { 1405 errorHandler = handler4; 1406 } 1407 function normalErrorHandler(error2, el, expression = void 0) { 1408 error2 = Object.assign( 1409 error2 ?? { message: "No error message given." }, 1410 { el, expression } 1411 ); 1412 console.warn(`Alpine Expression Error: ${error2.message} 1413 1414${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); 1415 setTimeout(() => { 1416 throw error2; 1417 }, 0); 1418 } 1419 var shouldAutoEvaluateFunctions = true; 1420 function dontAutoEvaluateFunctions(callback) { 1421 let cache = shouldAutoEvaluateFunctions; 1422 shouldAutoEvaluateFunctions = false; 1423 let result = callback(); 1424 shouldAutoEvaluateFunctions = cache; 1425 return result; 1426 } 1427 function evaluate(el, expression, extras = {}) { 1428 let result; 1429 evaluateLater(el, expression)((value) => result = value, extras); 1430 return result; 1431 } 1432 function evaluateLater(...args) { 1433 return theEvaluatorFunction(...args); 1434 } 1435 var theEvaluatorFunction = () => { 1436 }; 1437 function setEvaluator(newEvaluator) { 1438 theEvaluatorFunction = newEvaluator; 1439 } 1440 var theRawEvaluatorFunction; 1441 function setRawEvaluator(newEvaluator) { 1442 theRawEvaluatorFunction = newEvaluator; 1443 } 1444 function normalEvaluator(el, expression) { 1445 let overriddenMagics = {}; 1446 injectMagics(overriddenMagics, el); 1447 let dataStack = [overriddenMagics, ...closestDataStack(el)]; 1448 let evaluator = typeof expression === "function" ? generateEvaluatorFromFunction(dataStack, expression) : generateEvaluatorFromString(dataStack, expression, el); 1449 return tryCatch.bind(null, el, expression, evaluator); 1450 } 1451 function generateEvaluatorFromFunction(dataStack, func) { 1452 return (receiver = () => { 1453 }, { scope: scope2 = {}, params = [], context } = {}) => { 1454 if (!shouldAutoEvaluateFunctions) { 1455 runIfTypeOfFunction(receiver, func, mergeProxies([scope2, ...dataStack]), params); 1456 return; 1457 } 1458 let result = func.apply(mergeProxies([scope2, ...dataStack]), params); 1459 runIfTypeOfFunction(receiver, result); 1460 }; 1461 } 1462 var evaluatorMemo = {}; 1463 function generateFunctionFromString(expression, el) { 1464 if (evaluatorMemo[expression]) { 1465 return evaluatorMemo[expression]; 1466 } 1467 let AsyncFunction = Object.getPrototypeOf(async function() { 1468 }).constructor; 1469 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; 1470 const safeAsyncFunction = () => { 1471 try { 1472 let func2 = new AsyncFunction( 1473 ["__self", "scope"], 1474 `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;` 1475 ); 1476 Object.defineProperty(func2, "name", { 1477 value: `[Alpine] ${expression}` 1478 }); 1479 return func2; 1480 } catch (error2) { 1481 handleError(error2, el, expression); 1482 return Promise.resolve(); 1483 } 1484 }; 1485 let func = safeAsyncFunction(); 1486 evaluatorMemo[expression] = func; 1487 return func; 1488 } 1489 function generateEvaluatorFromString(dataStack, expression, el) { 1490 let func = generateFunctionFromString(expression, el); 1491 return (receiver = () => { 1492 }, { scope: scope2 = {}, params = [], context } = {}) => { 1493 func.result = void 0; 1494 func.finished = false; 1495 let completeScope = mergeProxies([scope2, ...dataStack]); 1496 if (typeof func === "function") { 1497 let promise = func.call(context, func, completeScope).catch((error2) => handleError(error2, el, expression)); 1498 if (func.finished) { 1499 runIfTypeOfFunction(receiver, func.result, completeScope, params, el); 1500 func.result = void 0; 1501 } else { 1502 promise.then((result) => { 1503 runIfTypeOfFunction(receiver, result, completeScope, params, el); 1504 }).catch((error2) => handleError(error2, el, expression)).finally(() => func.result = void 0); 1505 } 1506 } 1507 }; 1508 } 1509 function runIfTypeOfFunction(receiver, value, scope2, params, el) { 1510 if (shouldAutoEvaluateFunctions && typeof value === "function") { 1511 let result = value.apply(scope2, params); 1512 if (result instanceof Promise) { 1513 result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value)); 1514 } else { 1515 receiver(result); 1516 } 1517 } else if (typeof value === "object" && value instanceof Promise) { 1518 value.then((i) => receiver(i)); 1519 } else { 1520 receiver(value); 1521 } 1522 } 1523 function evaluateRaw(...args) { 1524 return theRawEvaluatorFunction(...args); 1525 } 1526 function normalRawEvaluator(el, expression, extras = {}) { 1527 let overriddenMagics = {}; 1528 injectMagics(overriddenMagics, el); 1529 let dataStack = [overriddenMagics, ...closestDataStack(el)]; 1530 let scope2 = mergeProxies([extras.scope ?? {}, ...dataStack]); 1531 let params = extras.params ?? []; 1532 if (expression.includes("await")) { 1533 let AsyncFunction = Object.getPrototypeOf(async function() { 1534 }).constructor; 1535 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; 1536 let func = new AsyncFunction( 1537 ["scope"], 1538 `with (scope) { let __result = ${rightSideSafeExpression}; return __result }` 1539 ); 1540 let result = func.call(extras.context, scope2); 1541 return result; 1542 } else { 1543 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(()=>{ ${expression} })()` : expression; 1544 let func = new Function( 1545 ["scope"], 1546 `with (scope) { let __result = ${rightSideSafeExpression}; return __result }` 1547 ); 1548 let result = func.call(extras.context, scope2); 1549 if (typeof result === "function" && shouldAutoEvaluateFunctions) { 1550 return result.apply(scope2, params); 1551 } 1552 return result; 1553 } 1554 } 1555 var prefixAsString = "x-"; 1556 function prefix(subject = "") { 1557 return prefixAsString + subject; 1558 } 1559 function setPrefix(newPrefix) { 1560 prefixAsString = newPrefix; 1561 } 1562 var directiveHandlers = {}; 1563 function directive(name, callback) { 1564 directiveHandlers[name] = callback; 1565 return { 1566 before(directive22) { 1567 if (!directiveHandlers[directive22]) { 1568 console.warn(String.raw`Cannot find directive \`${directive22}\`. \`${name}\` will use the default order of execution`); 1569 return; 1570 } 1571 const pos = directiveOrder.indexOf(directive22); 1572 directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name); 1573 } 1574 }; 1575 } 1576 function directiveExists(name) { 1577 return Object.keys(directiveHandlers).includes(name); 1578 } 1579 function directives(el, attributes, originalAttributeOverride) { 1580 attributes = Array.from(attributes); 1581 if (el._x_virtualDirectives) { 1582 let vAttributes = Object.entries(el._x_virtualDirectives).map(([name, value]) => ({ name, value })); 1583 let staticAttributes = attributesOnly(vAttributes); 1584 vAttributes = vAttributes.map((attribute) => { 1585 if (staticAttributes.find((attr) => attr.name === attribute.name)) { 1586 return { 1587 name: `x-bind:${attribute.name}`, 1588 value: `"${attribute.value}"` 1589 }; 1590 } 1591 return attribute; 1592 }); 1593 attributes = attributes.concat(vAttributes); 1594 } 1595 let transformedAttributeMap = {}; 1596 let directives2 = attributes.map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority); 1597 return directives2.map((directive22) => { 1598 return getDirectiveHandler(el, directive22); 1599 }); 1600 } 1601 function attributesOnly(attributes) { 1602 return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr)); 1603 } 1604 var isDeferringHandlers = false; 1605 var directiveHandlerStacks = /* @__PURE__ */ new Map(); 1606 var currentHandlerStackKey = Symbol(); 1607 function deferHandlingDirectives(callback) { 1608 isDeferringHandlers = true; 1609 let key = Symbol(); 1610 currentHandlerStackKey = key; 1611 directiveHandlerStacks.set(key, []); 1612 let flushHandlers = () => { 1613 while (directiveHandlerStacks.get(key).length) 1614 directiveHandlerStacks.get(key).shift()(); 1615 directiveHandlerStacks.delete(key); 1616 }; 1617 let stopDeferring = () => { 1618 isDeferringHandlers = false; 1619 flushHandlers(); 1620 }; 1621 callback(flushHandlers); 1622 stopDeferring(); 1623 } 1624 function getElementBoundUtilities(el) { 1625 let cleanups2 = []; 1626 let cleanup2 = (callback) => cleanups2.push(callback); 1627 let [effect3, cleanupEffect] = elementBoundEffect(el); 1628 cleanups2.push(cleanupEffect); 1629 let utilities = { 1630 Alpine: alpine_default, 1631 effect: effect3, 1632 cleanup: cleanup2, 1633 evaluateLater: evaluateLater.bind(evaluateLater, el), 1634 evaluate: evaluate.bind(evaluate, el) 1635 }; 1636 let doCleanup = () => cleanups2.forEach((i) => i()); 1637 return [utilities, doCleanup]; 1638 } 1639 function getDirectiveHandler(el, directive22) { 1640 let noop = () => { 1641 }; 1642 let handler4 = directiveHandlers[directive22.type] || noop; 1643 let [utilities, cleanup2] = getElementBoundUtilities(el); 1644 onAttributeRemoved(el, directive22.original, cleanup2); 1645 let fullHandler = () => { 1646 if (el._x_ignore || el._x_ignoreSelf) 1647 return; 1648 handler4.inline && handler4.inline(el, directive22, utilities); 1649 handler4 = handler4.bind(handler4, el, directive22, utilities); 1650 isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4(); 1651 }; 1652 fullHandler.runCleanups = cleanup2; 1653 return fullHandler; 1654 } 1655 var startingWith = (subject, replacement) => ({ name, value }) => { 1656 if (name.startsWith(subject)) 1657 name = name.replace(subject, replacement); 1658 return { name, value }; 1659 }; 1660 var into = (i) => i; 1661 function toTransformedAttributes(callback = () => { 1662 }) { 1663 return ({ name, value }) => { 1664 let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => { 1665 return transform(carry); 1666 }, { name, value }); 1667 if (newName !== name) 1668 callback(newName, name); 1669 return { name: newName, value: newValue }; 1670 }; 1671 } 1672 var attributeTransformers = []; 1673 function mapAttributes(callback) { 1674 attributeTransformers.push(callback); 1675 } 1676 function outNonAlpineAttributes({ name }) { 1677 return alpineAttributeRegex().test(name); 1678 } 1679 var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`); 1680 function toParsedDirectives(transformedAttributeMap, originalAttributeOverride) { 1681 return ({ name, value }) => { 1682 if (name === value) 1683 value = ""; 1684 let typeMatch = name.match(alpineAttributeRegex()); 1685 let valueMatch = name.match(/:([a-zA-Z0-9\-_:]+)/); 1686 let modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || []; 1687 let original = originalAttributeOverride || transformedAttributeMap[name] || name; 1688 return { 1689 type: typeMatch ? typeMatch[1] : null, 1690 value: valueMatch ? valueMatch[1] : null, 1691 modifiers: modifiers.map((i) => i.replace(".", "")), 1692 expression: value, 1693 original 1694 }; 1695 }; 1696 } 1697 var DEFAULT = "DEFAULT"; 1698 var directiveOrder = [ 1699 "ignore", 1700 "ref", 1701 "id", 1702 "data", 1703 "anchor", 1704 "bind", 1705 "init", 1706 "for", 1707 "model", 1708 "modelable", 1709 "transition", 1710 "show", 1711 "if", 1712 DEFAULT, 1713 "teleport" 1714 ]; 1715 function byPriority(a, b) { 1716 let typeA = directiveOrder.indexOf(a.type) === -1 ? DEFAULT : a.type; 1717 let typeB = directiveOrder.indexOf(b.type) === -1 ? DEFAULT : b.type; 1718 return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB); 1719 } 1720 function dispatch2(el, name, detail = {}, options = {}) { 1721 return el.dispatchEvent( 1722 new CustomEvent(name, { 1723 detail, 1724 bubbles: true, 1725 composed: true, 1726 cancelable: true, 1727 ...options 1728 }) 1729 ); 1730 } 1731 function walk(el, callback) { 1732 if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) { 1733 Array.from(el.children).forEach((el2) => walk(el2, callback)); 1734 return; 1735 } 1736 let skip = false; 1737 callback(el, () => skip = true); 1738 if (skip) 1739 return; 1740 let node = el.firstElementChild; 1741 while (node) { 1742 walk(node, callback, false); 1743 node = node.nextElementSibling; 1744 } 1745 } 1746 function warn(message, ...args) { 1747 console.warn(`Alpine Warning: ${message}`, ...args); 1748 } 1749 var started = false; 1750 function start() { 1751 if (started) 1752 warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."); 1753 started = true; 1754 if (!document.body) 1755 warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"); 1756 dispatch2(document, "alpine:init"); 1757 dispatch2(document, "alpine:initializing"); 1758 startObservingMutations(); 1759 onElAdded((el) => initTree(el, walk)); 1760 onElRemoved((el) => destroyTree(el)); 1761 onAttributesAdded((el, attrs) => { 1762 directives(el, attrs).forEach((handle) => handle()); 1763 }); 1764 let outNestedComponents = (el) => !closestRoot(el.parentElement, true); 1765 Array.from(document.querySelectorAll(allSelectors().join(","))).filter(outNestedComponents).forEach((el) => { 1766 initTree(el); 1767 }); 1768 dispatch2(document, "alpine:initialized"); 1769 setTimeout(() => { 1770 warnAboutMissingPlugins(); 1771 }); 1772 } 1773 var rootSelectorCallbacks = []; 1774 var initSelectorCallbacks = []; 1775 function rootSelectors() { 1776 return rootSelectorCallbacks.map((fn) => fn()); 1777 } 1778 function allSelectors() { 1779 return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn()); 1780 } 1781 function addRootSelector(selectorCallback) { 1782 rootSelectorCallbacks.push(selectorCallback); 1783 } 1784 function addInitSelector(selectorCallback) { 1785 initSelectorCallbacks.push(selectorCallback); 1786 } 1787 function closestRoot(el, includeInitSelectors = false) { 1788 return findClosest(el, (element) => { 1789 const selectors = includeInitSelectors ? allSelectors() : rootSelectors(); 1790 if (selectors.some((selector) => element.matches(selector))) 1791 return true; 1792 }); 1793 } 1794 function findClosest(el, callback) { 1795 if (!el) 1796 return; 1797 if (callback(el)) 1798 return el; 1799 if (el._x_teleportBack) 1800 return findClosest(el._x_teleportBack, callback); 1801 if (el.parentNode instanceof ShadowRoot) { 1802 return findClosest(el.parentNode.host, callback); 1803 } 1804 if (!el.parentElement) 1805 return; 1806 return findClosest(el.parentElement, callback); 1807 } 1808 function isRoot(el) { 1809 return rootSelectors().some((selector) => el.matches(selector)); 1810 } 1811 var initInterceptors2 = []; 1812 function interceptInit(callback) { 1813 initInterceptors2.push(callback); 1814 } 1815 var markerDispenser = 1; 1816 function initTree(el, walker = walk, intercept = () => { 1817 }) { 1818 if (findClosest(el, (i) => i._x_ignore)) 1819 return; 1820 deferHandlingDirectives(() => { 1821 walker(el, (el2, skip) => { 1822 if (el2._x_marker) 1823 return; 1824 intercept(el2, skip); 1825 initInterceptors2.forEach((i) => i(el2, skip)); 1826 directives(el2, el2.attributes).forEach((handle) => handle()); 1827 if (!el2._x_ignore) 1828 el2._x_marker = markerDispenser++; 1829 el2._x_ignore && skip(); 1830 }); 1831 }); 1832 } 1833 function destroyTree(root, walker = walk) { 1834 walker(root, (el) => { 1835 cleanupElement(el); 1836 cleanupAttributes(el); 1837 delete el._x_marker; 1838 }); 1839 } 1840 function warnAboutMissingPlugins() { 1841 let pluginDirectives = [ 1842 ["ui", "dialog", ["[x-dialog], [x-popover]"]], 1843 ["anchor", "anchor", ["[x-anchor]"]], 1844 ["sort", "sort", ["[x-sort]"]] 1845 ]; 1846 pluginDirectives.forEach(([plugin2, directive22, selectors]) => { 1847 if (directiveExists(directive22)) 1848 return; 1849 selectors.some((selector) => { 1850 if (document.querySelector(selector)) { 1851 warn(`found "${selector}", but missing ${plugin2} plugin`); 1852 return true; 1853 } 1854 }); 1855 }); 1856 } 1857 var tickStack = []; 1858 var isHolding = false; 1859 function nextTick(callback = () => { 1860 }) { 1861 queueMicrotask(() => { 1862 isHolding || setTimeout(() => { 1863 releaseNextTicks(); 1864 }); 1865 }); 1866 return new Promise((res) => { 1867 tickStack.push(() => { 1868 callback(); 1869 res(); 1870 }); 1871 }); 1872 } 1873 function releaseNextTicks() { 1874 isHolding = false; 1875 while (tickStack.length) 1876 tickStack.shift()(); 1877 } 1878 function holdNextTicks() { 1879 isHolding = true; 1880 } 1881 function setClasses(el, value) { 1882 if (Array.isArray(value)) { 1883 return setClassesFromString(el, value.join(" ")); 1884 } else if (typeof value === "object" && value !== null) { 1885 return setClassesFromObject(el, value); 1886 } else if (typeof value === "function") { 1887 return setClasses(el, value()); 1888 } 1889 return setClassesFromString(el, value); 1890 } 1891 function splitClasses(classString) { 1892 return classString.split(/\s/).filter(Boolean); 1893 } 1894 function setClassesFromString(el, classString) { 1895 let missingClasses = (classString2) => splitClasses(classString2).filter((i) => !el.classList.contains(i)).filter(Boolean); 1896 let addClassesAndReturnUndo = (classes) => { 1897 el.classList.add(...classes); 1898 return () => { 1899 el.classList.remove(...classes); 1900 }; 1901 }; 1902 classString = classString === true ? classString = "" : classString || ""; 1903 return addClassesAndReturnUndo(missingClasses(classString)); 1904 } 1905 function setClassesFromObject(el, classObject) { 1906 let forAdd = Object.entries(classObject).flatMap(([classString, bool]) => bool ? splitClasses(classString) : false).filter(Boolean); 1907 let forRemove = Object.entries(classObject).flatMap(([classString, bool]) => !bool ? splitClasses(classString) : false).filter(Boolean); 1908 let added = []; 1909 let removed = []; 1910 forRemove.forEach((i) => { 1911 if (el.classList.contains(i)) { 1912 el.classList.remove(i); 1913 removed.push(i); 1914 } 1915 }); 1916 forAdd.forEach((i) => { 1917 if (!el.classList.contains(i)) { 1918 el.classList.add(i); 1919 added.push(i); 1920 } 1921 }); 1922 return () => { 1923 removed.forEach((i) => el.classList.add(i)); 1924 added.forEach((i) => el.classList.remove(i)); 1925 }; 1926 } 1927 function setStyles(el, value) { 1928 if (typeof value === "object" && value !== null) { 1929 return setStylesFromObject(el, value); 1930 } 1931 return setStylesFromString(el, value); 1932 } 1933 function setStylesFromObject(el, value) { 1934 let previousStyles = {}; 1935 Object.entries(value).forEach(([key, value2]) => { 1936 previousStyles[key] = el.style[key]; 1937 if (!key.startsWith("--")) { 1938 key = kebabCase(key); 1939 } 1940 el.style.setProperty(key, value2); 1941 }); 1942 setTimeout(() => { 1943 if (el.style.length === 0) { 1944 el.removeAttribute("style"); 1945 } 1946 }); 1947 return () => { 1948 setStyles(el, previousStyles); 1949 }; 1950 } 1951 function setStylesFromString(el, value) { 1952 let cache = el.getAttribute("style", value); 1953 el.setAttribute("style", value); 1954 return () => { 1955 el.setAttribute("style", cache || ""); 1956 }; 1957 } 1958 function kebabCase(subject) { 1959 return subject.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 1960 } 1961 function once(callback, fallback2 = () => { 1962 }) { 1963 let called = false; 1964 return function() { 1965 if (!called) { 1966 called = true; 1967 callback.apply(this, arguments); 1968 } else { 1969 fallback2.apply(this, arguments); 1970 } 1971 }; 1972 } 1973 directive("transition", (el, { value, modifiers, expression }, { evaluate: evaluate22 }) => { 1974 if (typeof expression === "function") 1975 expression = evaluate22(expression); 1976 if (expression === false) 1977 return; 1978 if (!expression || typeof expression === "boolean") { 1979 registerTransitionsFromHelper(el, modifiers, value); 1980 } else { 1981 registerTransitionsFromClassString(el, expression, value); 1982 } 1983 }); 1984 function registerTransitionsFromClassString(el, classString, stage) { 1985 registerTransitionObject(el, setClasses, ""); 1986 let directiveStorageMap = { 1987 "enter": (classes) => { 1988 el._x_transition.enter.during = classes; 1989 }, 1990 "enter-start": (classes) => { 1991 el._x_transition.enter.start = classes; 1992 }, 1993 "enter-end": (classes) => { 1994 el._x_transition.enter.end = classes; 1995 }, 1996 "leave": (classes) => { 1997 el._x_transition.leave.during = classes; 1998 }, 1999 "leave-start": (classes) => { 2000 el._x_transition.leave.start = classes; 2001 }, 2002 "leave-end": (classes) => { 2003 el._x_transition.leave.end = classes; 2004 } 2005 }; 2006 directiveStorageMap[stage](classString); 2007 } 2008 function registerTransitionsFromHelper(el, modifiers, stage) { 2009 registerTransitionObject(el, setStyles); 2010 let doesntSpecify = !modifiers.includes("in") && !modifiers.includes("out") && !stage; 2011 let transitioningIn = doesntSpecify || modifiers.includes("in") || ["enter"].includes(stage); 2012 let transitioningOut = doesntSpecify || modifiers.includes("out") || ["leave"].includes(stage); 2013 if (modifiers.includes("in") && !doesntSpecify) { 2014 modifiers = modifiers.filter((i, index2) => index2 < modifiers.indexOf("out")); 2015 } 2016 if (modifiers.includes("out") && !doesntSpecify) { 2017 modifiers = modifiers.filter((i, index2) => index2 > modifiers.indexOf("out")); 2018 } 2019 let wantsAll = !modifiers.includes("opacity") && !modifiers.includes("scale"); 2020 let wantsOpacity = wantsAll || modifiers.includes("opacity"); 2021 let wantsScale = wantsAll || modifiers.includes("scale"); 2022 let opacityValue = wantsOpacity ? 0 : 1; 2023 let scaleValue = wantsScale ? modifierValue(modifiers, "scale", 95) / 100 : 1; 2024 let delay3 = modifierValue(modifiers, "delay", 0) / 1e3; 2025 let origin = modifierValue(modifiers, "origin", "center"); 2026 let property = "opacity, transform"; 2027 let durationIn = modifierValue(modifiers, "duration", 150) / 1e3; 2028 let durationOut = modifierValue(modifiers, "duration", 75) / 1e3; 2029 let easing = `cubic-bezier(0.4, 0.0, 0.2, 1)`; 2030 if (transitioningIn) { 2031 el._x_transition.enter.during = { 2032 transformOrigin: origin, 2033 transitionDelay: `${delay3}s`, 2034 transitionProperty: property, 2035 transitionDuration: `${durationIn}s`, 2036 transitionTimingFunction: easing 2037 }; 2038 el._x_transition.enter.start = { 2039 opacity: opacityValue, 2040 transform: `scale(${scaleValue})` 2041 }; 2042 el._x_transition.enter.end = { 2043 opacity: 1, 2044 transform: `scale(1)` 2045 }; 2046 } 2047 if (transitioningOut) { 2048 el._x_transition.leave.during = { 2049 transformOrigin: origin, 2050 transitionDelay: `${delay3}s`, 2051 transitionProperty: property, 2052 transitionDuration: `${durationOut}s`, 2053 transitionTimingFunction: easing 2054 }; 2055 el._x_transition.leave.start = { 2056 opacity: 1, 2057 transform: `scale(1)` 2058 }; 2059 el._x_transition.leave.end = { 2060 opacity: opacityValue, 2061 transform: `scale(${scaleValue})` 2062 }; 2063 } 2064 } 2065 function registerTransitionObject(el, setFunction, defaultValue = {}) { 2066 if (!el._x_transition) 2067 el._x_transition = { 2068 enter: { during: defaultValue, start: defaultValue, end: defaultValue }, 2069 leave: { during: defaultValue, start: defaultValue, end: defaultValue }, 2070 in(before = () => { 2071 }, after = () => { 2072 }) { 2073 transition(el, setFunction, { 2074 during: this.enter.during, 2075 start: this.enter.start, 2076 end: this.enter.end 2077 }, before, after); 2078 }, 2079 out(before = () => { 2080 }, after = () => { 2081 }) { 2082 transition(el, setFunction, { 2083 during: this.leave.during, 2084 start: this.leave.start, 2085 end: this.leave.end 2086 }, before, after); 2087 } 2088 }; 2089 } 2090 window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) { 2091 const nextTick2 = document.visibilityState === "visible" ? requestAnimationFrame : setTimeout; 2092 let clickAwayCompatibleShow = () => nextTick2(show); 2093 if (value) { 2094 if (el._x_transition && (el._x_transition.enter || el._x_transition.leave)) { 2095 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(); 2096 } else { 2097 el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow(); 2098 } 2099 return; 2100 } 2101 el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => { 2102 el._x_transition.out(() => { 2103 }, () => resolve(hide)); 2104 el._x_transitioning && el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true })); 2105 }) : Promise.resolve(hide); 2106 queueMicrotask(() => { 2107 let closest2 = closestHide(el); 2108 if (closest2) { 2109 if (!closest2._x_hideChildren) 2110 closest2._x_hideChildren = []; 2111 closest2._x_hideChildren.push(el); 2112 } else { 2113 nextTick2(() => { 2114 let hideAfterChildren = (el2) => { 2115 let carry = Promise.all([ 2116 el2._x_hidePromise, 2117 ...(el2._x_hideChildren || []).map(hideAfterChildren) 2118 ]).then(([i]) => i?.()); 2119 delete el2._x_hidePromise; 2120 delete el2._x_hideChildren; 2121 return carry; 2122 }; 2123 hideAfterChildren(el).catch((e) => { 2124 if (!e.isFromCancelledTransition) 2125 throw e; 2126 }); 2127 }); 2128 } 2129 }); 2130 }; 2131 function closestHide(el) { 2132 let parent = el.parentNode; 2133 if (!parent) 2134 return; 2135 return parent._x_hidePromise ? parent : closestHide(parent); 2136 } 2137 function transition(el, setFunction, { during, start: start22, end } = {}, before = () => { 2138 }, after = () => { 2139 }) { 2140 if (el._x_transitioning) 2141 el._x_transitioning.cancel(); 2142 if (Object.keys(during).length === 0 && Object.keys(start22).length === 0 && Object.keys(end).length === 0) { 2143 before(); 2144 after(); 2145 return; 2146 } 2147 let undoStart, undoDuring, undoEnd; 2148 performTransition(el, { 2149 start() { 2150 undoStart = setFunction(el, start22); 2151 }, 2152 during() { 2153 undoDuring = setFunction(el, during); 2154 }, 2155 before, 2156 end() { 2157 undoStart(); 2158 undoEnd = setFunction(el, end); 2159 }, 2160 after, 2161 cleanup() { 2162 undoDuring(); 2163 undoEnd(); 2164 } 2165 }); 2166 } 2167 function performTransition(el, stages) { 2168 let interrupted, reachedBefore, reachedEnd; 2169 let finish = once(() => { 2170 mutateDom(() => { 2171 interrupted = true; 2172 if (!reachedBefore) 2173 stages.before(); 2174 if (!reachedEnd) { 2175 stages.end(); 2176 releaseNextTicks(); 2177 } 2178 stages.after(); 2179 if (el.isConnected) 2180 stages.cleanup(); 2181 delete el._x_transitioning; 2182 }); 2183 }); 2184 el._x_transitioning = { 2185 beforeCancels: [], 2186 beforeCancel(callback) { 2187 this.beforeCancels.push(callback); 2188 }, 2189 cancel: once(function() { 2190 while (this.beforeCancels.length) { 2191 this.beforeCancels.shift()(); 2192 } 2193 ; 2194 finish(); 2195 }), 2196 finish 2197 }; 2198 mutateDom(() => { 2199 stages.start(); 2200 stages.during(); 2201 }); 2202 holdNextTicks(); 2203 requestAnimationFrame(() => { 2204 if (interrupted) 2205 return; 2206 let duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, "").replace("s", "")) * 1e3; 2207 let delay3 = Number(getComputedStyle(el).transitionDelay.replace(/,.*/, "").replace("s", "")) * 1e3; 2208 if (duration === 0) 2209 duration = Number(getComputedStyle(el).animationDuration.replace("s", "")) * 1e3; 2210 mutateDom(() => { 2211 stages.before(); 2212 }); 2213 reachedBefore = true; 2214 requestAnimationFrame(() => { 2215 if (interrupted) 2216 return; 2217 mutateDom(() => { 2218 stages.end(); 2219 }); 2220 releaseNextTicks(); 2221 setTimeout(el._x_transitioning.finish, duration + delay3); 2222 reachedEnd = true; 2223 }); 2224 }); 2225 } 2226 function modifierValue(modifiers, key, fallback2) { 2227 if (modifiers.indexOf(key) === -1) 2228 return fallback2; 2229 const rawValue = modifiers[modifiers.indexOf(key) + 1]; 2230 if (!rawValue) 2231 return fallback2; 2232 if (key === "scale") { 2233 if (isNaN(rawValue)) 2234 return fallback2; 2235 } 2236 if (key === "duration" || key === "delay") { 2237 let match = rawValue.match(/([0-9]+)ms/); 2238 if (match) 2239 return match[1]; 2240 } 2241 if (key === "origin") { 2242 if (["top", "right", "left", "center", "bottom"].includes(modifiers[modifiers.indexOf(key) + 2])) { 2243 return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(" "); 2244 } 2245 } 2246 return rawValue; 2247 } 2248 var isCloning = false; 2249 function skipDuringClone(callback, fallback2 = () => { 2250 }) { 2251 return (...args) => isCloning ? fallback2(...args) : callback(...args); 2252 } 2253 function onlyDuringClone(callback) { 2254 return (...args) => isCloning && callback(...args); 2255 } 2256 var interceptors = []; 2257 function interceptClone(callback) { 2258 interceptors.push(callback); 2259 } 2260 function cloneNode(from, to) { 2261 interceptors.forEach((i) => i(from, to)); 2262 isCloning = true; 2263 dontRegisterReactiveSideEffects(() => { 2264 initTree(to, (el, callback) => { 2265 callback(el, () => { 2266 }); 2267 }); 2268 }); 2269 isCloning = false; 2270 } 2271 var isCloningLegacy = false; 2272 function clone(oldEl, newEl) { 2273 if (!newEl._x_dataStack) 2274 newEl._x_dataStack = oldEl._x_dataStack; 2275 isCloning = true; 2276 isCloningLegacy = true; 2277 dontRegisterReactiveSideEffects(() => { 2278 cloneTree(newEl); 2279 }); 2280 isCloning = false; 2281 isCloningLegacy = false; 2282 } 2283 function cloneTree(el) { 2284 let hasRunThroughFirstEl = false; 2285 let shallowWalker = (el2, callback) => { 2286 walk(el2, (el3, skip) => { 2287 if (hasRunThroughFirstEl && isRoot(el3)) 2288 return skip(); 2289 hasRunThroughFirstEl = true; 2290 callback(el3, skip); 2291 }); 2292 }; 2293 initTree(el, shallowWalker); 2294 } 2295 function dontRegisterReactiveSideEffects(callback) { 2296 let cache = effect; 2297 overrideEffect((callback2, el) => { 2298 let storedEffect = cache(callback2); 2299 release(storedEffect); 2300 return () => { 2301 }; 2302 }); 2303 callback(); 2304 overrideEffect(cache); 2305 } 2306 function bind(el, name, value, modifiers = []) { 2307 if (!el._x_bindings) 2308 el._x_bindings = reactive({}); 2309 el._x_bindings[name] = value; 2310 name = modifiers.includes("camel") ? camelCase(name) : name; 2311 switch (name) { 2312 case "value": 2313 bindInputValue(el, value); 2314 break; 2315 case "style": 2316 bindStyles(el, value); 2317 break; 2318 case "class": 2319 bindClasses(el, value); 2320 break; 2321 case "selected": 2322 case "checked": 2323 bindAttributeAndProperty(el, name, value); 2324 break; 2325 default: 2326 bindAttribute(el, name, value); 2327 break; 2328 } 2329 } 2330 function bindInputValue(el, value) { 2331 if (isRadio(el)) { 2332 if (el.attributes.value === void 0) { 2333 el.value = value; 2334 } 2335 } else if (isCheckbox(el)) { 2336 if (Number.isInteger(value)) { 2337 el.value = value; 2338 } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { 2339 el.value = String(value); 2340 } else { 2341 if (Array.isArray(value)) { 2342 el.checked = value.some((val) => checkedAttrLooseCompare(val, el.value)); 2343 } else { 2344 el.checked = !!value; 2345 } 2346 } 2347 } else if (el.tagName === "SELECT") { 2348 updateSelect(el, value); 2349 } else { 2350 if (el.value === value) 2351 return; 2352 el.value = value === void 0 ? "" : value; 2353 } 2354 } 2355 function bindClasses(el, value) { 2356 if (el._x_undoAddedClasses) 2357 el._x_undoAddedClasses(); 2358 el._x_undoAddedClasses = setClasses(el, value); 2359 } 2360 function bindStyles(el, value) { 2361 if (el._x_undoAddedStyles) 2362 el._x_undoAddedStyles(); 2363 el._x_undoAddedStyles = setStyles(el, value); 2364 } 2365 function bindAttributeAndProperty(el, name, value) { 2366 bindAttribute(el, name, value); 2367 setPropertyIfChanged(el, name, value); 2368 } 2369 function bindAttribute(el, name, value) { 2370 if ([null, void 0, false].includes(value) && attributeShouldntBePreservedIfFalsy(name)) { 2371 el.removeAttribute(name); 2372 } else { 2373 if (isBooleanAttr(name)) 2374 value = name; 2375 setIfChanged(el, name, value); 2376 } 2377 } 2378 function setIfChanged(el, attrName, value) { 2379 if (el.getAttribute(attrName) != value) { 2380 el.setAttribute(attrName, value); 2381 } 2382 } 2383 function setPropertyIfChanged(el, propName, value) { 2384 if (el[propName] !== value) { 2385 el[propName] = value; 2386 } 2387 } 2388 function updateSelect(el, value) { 2389 const arrayWrappedValue = [].concat(value).map((value2) => { 2390 return value2 + ""; 2391 }); 2392 Array.from(el.options).forEach((option2) => { 2393 option2.selected = arrayWrappedValue.includes(option2.value); 2394 }); 2395 } 2396 function camelCase(subject) { 2397 return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase()); 2398 } 2399 function checkedAttrLooseCompare(valueA, valueB) { 2400 return valueA == valueB; 2401 } 2402 function safeParseBoolean(rawValue) { 2403 if ([1, "1", "true", "on", "yes", true].includes(rawValue)) { 2404 return true; 2405 } 2406 if ([0, "0", "false", "off", "no", false].includes(rawValue)) { 2407 return false; 2408 } 2409 return rawValue ? Boolean(rawValue) : null; 2410 } 2411 var booleanAttributes = /* @__PURE__ */ new Set([ 2412 "allowfullscreen", 2413 "async", 2414 "autofocus", 2415 "autoplay", 2416 "checked", 2417 "controls", 2418 "default", 2419 "defer", 2420 "disabled", 2421 "formnovalidate", 2422 "inert", 2423 "ismap", 2424 "itemscope", 2425 "loop", 2426 "multiple", 2427 "muted", 2428 "nomodule", 2429 "novalidate", 2430 "open", 2431 "playsinline", 2432 "readonly", 2433 "required", 2434 "reversed", 2435 "selected", 2436 "shadowrootclonable", 2437 "shadowrootdelegatesfocus", 2438 "shadowrootserializable" 2439 ]); 2440 function isBooleanAttr(attrName) { 2441 return booleanAttributes.has(attrName); 2442 } 2443 function attributeShouldntBePreservedIfFalsy(name) { 2444 return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(name); 2445 } 2446 function getBinding(el, name, fallback2) { 2447 if (el._x_bindings && el._x_bindings[name] !== void 0) 2448 return el._x_bindings[name]; 2449 return getAttributeBinding(el, name, fallback2); 2450 } 2451 function extractProp(el, name, fallback2, extract = true) { 2452 if (el._x_bindings && el._x_bindings[name] !== void 0) 2453 return el._x_bindings[name]; 2454 if (el._x_inlineBindings && el._x_inlineBindings[name] !== void 0) { 2455 let binding = el._x_inlineBindings[name]; 2456 binding.extract = extract; 2457 return dontAutoEvaluateFunctions(() => { 2458 return evaluate(el, binding.expression); 2459 }); 2460 } 2461 return getAttributeBinding(el, name, fallback2); 2462 } 2463 function getAttributeBinding(el, name, fallback2) { 2464 let attr = el.getAttribute(name); 2465 if (attr === null) 2466 return typeof fallback2 === "function" ? fallback2() : fallback2; 2467 if (attr === "") 2468 return true; 2469 if (isBooleanAttr(name)) { 2470 return !![name, "true"].includes(attr); 2471 } 2472 return attr; 2473 } 2474 function isCheckbox(el) { 2475 return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; 2476 } 2477 function isRadio(el) { 2478 return el.type === "radio" || el.localName === "ui-radio"; 2479 } 2480 function debounce(func, wait) { 2481 let timeout; 2482 return function() { 2483 const context = this, args = arguments; 2484 const later = function() { 2485 timeout = null; 2486 func.apply(context, args); 2487 }; 2488 clearTimeout(timeout); 2489 timeout = setTimeout(later, wait); 2490 }; 2491 } 2492 function throttle(func, limit) { 2493 let inThrottle; 2494 return function() { 2495 let context = this, args = arguments; 2496 if (!inThrottle) { 2497 func.apply(context, args); 2498 inThrottle = true; 2499 setTimeout(() => inThrottle = false, limit); 2500 } 2501 }; 2502 } 2503 function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) { 2504 let firstRun = true; 2505 let outerHash; 2506 let innerHash; 2507 let reference = effect(() => { 2508 let outer = outerGet(); 2509 let inner = innerGet(); 2510 if (firstRun) { 2511 innerSet(cloneIfObject(outer)); 2512 firstRun = false; 2513 } else { 2514 let outerHashLatest = JSON.stringify(outer); 2515 let innerHashLatest = JSON.stringify(inner); 2516 if (outerHashLatest !== outerHash) { 2517 innerSet(cloneIfObject(outer)); 2518 } else if (outerHashLatest !== innerHashLatest) { 2519 outerSet(cloneIfObject(inner)); 2520 } else { 2521 } 2522 } 2523 outerHash = JSON.stringify(outerGet()); 2524 innerHash = JSON.stringify(innerGet()); 2525 }); 2526 return () => { 2527 release(reference); 2528 }; 2529 } 2530 function cloneIfObject(value) { 2531 return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; 2532 } 2533 function plugin(callback) { 2534 let callbacks = Array.isArray(callback) ? callback : [callback]; 2535 callbacks.forEach((i) => i(alpine_default)); 2536 } 2537 var stores = {}; 2538 var isReactive = false; 2539 function store(name, value) { 2540 if (!isReactive) { 2541 stores = reactive(stores); 2542 isReactive = true; 2543 } 2544 if (value === void 0) { 2545 return stores[name]; 2546 } 2547 stores[name] = value; 2548 initInterceptors(stores[name]); 2549 if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") { 2550 stores[name].init(); 2551 } 2552 } 2553 function getStores() { 2554 return stores; 2555 } 2556 var binds = {}; 2557 function bind2(name, bindings) { 2558 let getBindings = typeof bindings !== "function" ? () => bindings : bindings; 2559 if (name instanceof Element) { 2560 return applyBindingsObject(name, getBindings()); 2561 } else { 2562 binds[name] = getBindings; 2563 } 2564 return () => { 2565 }; 2566 } 2567 function injectBindingProviders(obj) { 2568 Object.entries(binds).forEach(([name, callback]) => { 2569 Object.defineProperty(obj, name, { 2570 get() { 2571 return (...args) => { 2572 return callback(...args); 2573 }; 2574 } 2575 }); 2576 }); 2577 return obj; 2578 } 2579 function applyBindingsObject(el, obj, original) { 2580 let cleanupRunners = []; 2581 while (cleanupRunners.length) 2582 cleanupRunners.pop()(); 2583 let attributes = Object.entries(obj).map(([name, value]) => ({ name, value })); 2584 let staticAttributes = attributesOnly(attributes); 2585 attributes = attributes.map((attribute) => { 2586 if (staticAttributes.find((attr) => attr.name === attribute.name)) { 2587 return { 2588 name: `x-bind:${attribute.name}`, 2589 value: `"${attribute.value}"` 2590 }; 2591 } 2592 return attribute; 2593 }); 2594 directives(el, attributes, original).map((handle) => { 2595 cleanupRunners.push(handle.runCleanups); 2596 handle(); 2597 }); 2598 return () => { 2599 while (cleanupRunners.length) 2600 cleanupRunners.pop()(); 2601 }; 2602 } 2603 var datas = {}; 2604 function data(name, callback) { 2605 datas[name] = callback; 2606 } 2607 function injectDataProviders(obj, context) { 2608 Object.entries(datas).forEach(([name, callback]) => { 2609 Object.defineProperty(obj, name, { 2610 get() { 2611 return (...args) => { 2612 return callback.bind(context)(...args); 2613 }; 2614 }, 2615 enumerable: false 2616 }); 2617 }); 2618 return obj; 2619 } 2620 var Alpine2 = { 2621 get reactive() { 2622 return reactive; 2623 }, 2624 get release() { 2625 return release; 2626 }, 2627 get effect() { 2628 return effect; 2629 }, 2630 get raw() { 2631 return raw; 2632 }, 2633 get transaction() { 2634 return transaction; 2635 }, 2636 version: "3.15.12", 2637 flushAndStopDeferringMutations, 2638 dontAutoEvaluateFunctions, 2639 disableEffectScheduling, 2640 startObservingMutations, 2641 stopObservingMutations, 2642 setReactivityEngine, 2643 onAttributeRemoved, 2644 onAttributesAdded, 2645 closestDataStack, 2646 skipDuringClone, 2647 onlyDuringClone, 2648 addRootSelector, 2649 addInitSelector, 2650 setErrorHandler, 2651 interceptClone, 2652 addScopeToNode, 2653 deferMutations, 2654 mapAttributes, 2655 evaluateLater, 2656 interceptInit, 2657 initInterceptors, 2658 injectMagics, 2659 setEvaluator, 2660 setRawEvaluator, 2661 mergeProxies, 2662 extractProp, 2663 findClosest, 2664 onElRemoved, 2665 closestRoot, 2666 destroyTree, 2667 interceptor, 2668 transition, 2669 setStyles, 2670 mutateDom, 2671 directive, 2672 entangle, 2673 throttle, 2674 debounce, 2675 evaluate, 2676 evaluateRaw, 2677 initTree, 2678 nextTick, 2679 prefixed: prefix, 2680 prefix: setPrefix, 2681 plugin, 2682 magic, 2683 store, 2684 start, 2685 clone, 2686 cloneNode, 2687 bound: getBinding, 2688 $data: scope, 2689 watch, 2690 walk, 2691 data, 2692 bind: bind2 2693 }; 2694 var alpine_default = Alpine2; 2695 function makeMap(str, expectsLowerCase) { 2696 const map = /* @__PURE__ */ Object.create(null); 2697 const list = str.split(","); 2698 for (let i = 0; i < list.length; i++) { 2699 map[list[i]] = true; 2700 } 2701 return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; 2702 } 2703 var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 2704 var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`); 2705 var EMPTY_OBJ = true ? Object.freeze({}) : {}; 2706 var EMPTY_ARR = true ? Object.freeze([]) : []; 2707 var hasOwnProperty = Object.prototype.hasOwnProperty; 2708 var hasOwn = (val, key) => hasOwnProperty.call(val, key); 2709 var isArray2 = Array.isArray; 2710 var isMap = (val) => toTypeString(val) === "[object Map]"; 2711 var isString = (val) => typeof val === "string"; 2712 var isSymbol = (val) => typeof val === "symbol"; 2713 var isObject2 = (val) => val !== null && typeof val === "object"; 2714 var objectToString = Object.prototype.toString; 2715 var toTypeString = (value) => objectToString.call(value); 2716 var toRawType = (value) => { 2717 return toTypeString(value).slice(8, -1); 2718 }; 2719 var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 2720 var cacheStringFunction = (fn) => { 2721 const cache = /* @__PURE__ */ Object.create(null); 2722 return (str) => { 2723 const hit = cache[str]; 2724 return hit || (cache[str] = fn(str)); 2725 }; 2726 }; 2727 var camelizeRE = /-(\w)/g; 2728 var camelize = cacheStringFunction((str) => { 2729 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); 2730 }); 2731 var hyphenateRE = /\B([A-Z])/g; 2732 var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); 2733 var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1)); 2734 var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``); 2735 var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue); 2736 var targetMap = /* @__PURE__ */ new WeakMap(); 2737 var effectStack = []; 2738 var activeEffect; 2739 var ITERATE_KEY = Symbol(true ? "iterate" : ""); 2740 var MAP_KEY_ITERATE_KEY = Symbol(true ? "Map key iterate" : ""); 2741 function isEffect(fn) { 2742 return fn && fn._isEffect === true; 2743 } 2744 function effect2(fn, options = EMPTY_OBJ) { 2745 if (isEffect(fn)) { 2746 fn = fn.raw; 2747 } 2748 const effect3 = createReactiveEffect(fn, options); 2749 if (!options.lazy) { 2750 effect3(); 2751 } 2752 return effect3; 2753 } 2754 function stop(effect3) { 2755 if (effect3.active) { 2756 cleanup(effect3); 2757 if (effect3.options.onStop) { 2758 effect3.options.onStop(); 2759 } 2760 effect3.active = false; 2761 } 2762 } 2763 var uid = 0; 2764 function createReactiveEffect(fn, options) { 2765 const effect3 = function reactiveEffect() { 2766 if (!effect3.active) { 2767 return fn(); 2768 } 2769 if (!effectStack.includes(effect3)) { 2770 cleanup(effect3); 2771 try { 2772 enableTracking(); 2773 effectStack.push(effect3); 2774 activeEffect = effect3; 2775 return fn(); 2776 } finally { 2777 effectStack.pop(); 2778 resetTracking(); 2779 activeEffect = effectStack[effectStack.length - 1]; 2780 } 2781 } 2782 }; 2783 effect3.id = uid++; 2784 effect3.allowRecurse = !!options.allowRecurse; 2785 effect3._isEffect = true; 2786 effect3.active = true; 2787 effect3.raw = fn; 2788 effect3.deps = []; 2789 effect3.options = options; 2790 return effect3; 2791 } 2792 function cleanup(effect3) { 2793 const { deps } = effect3; 2794 if (deps.length) { 2795 for (let i = 0; i < deps.length; i++) { 2796 deps[i].delete(effect3); 2797 } 2798 deps.length = 0; 2799 } 2800 } 2801 var shouldTrack = true; 2802 var trackStack = []; 2803 function pauseTracking() { 2804 trackStack.push(shouldTrack); 2805 shouldTrack = false; 2806 } 2807 function enableTracking() { 2808 trackStack.push(shouldTrack); 2809 shouldTrack = true; 2810 } 2811 function resetTracking() { 2812 const last = trackStack.pop(); 2813 shouldTrack = last === void 0 ? true : last; 2814 } 2815 function track(target, type, key) { 2816 if (!shouldTrack || activeEffect === void 0) { 2817 return; 2818 } 2819 let depsMap = targetMap.get(target); 2820 if (!depsMap) { 2821 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 2822 } 2823 let dep = depsMap.get(key); 2824 if (!dep) { 2825 depsMap.set(key, dep = /* @__PURE__ */ new Set()); 2826 } 2827 if (!dep.has(activeEffect)) { 2828 dep.add(activeEffect); 2829 activeEffect.deps.push(dep); 2830 if (activeEffect.options.onTrack) { 2831 activeEffect.options.onTrack({ 2832 effect: activeEffect, 2833 target, 2834 type, 2835 key 2836 }); 2837 } 2838 } 2839 } 2840 function trigger(target, type, key, newValue, oldValue, oldTarget) { 2841 const depsMap = targetMap.get(target); 2842 if (!depsMap) { 2843 return; 2844 } 2845 const effects = /* @__PURE__ */ new Set(); 2846 const add2 = (effectsToAdd) => { 2847 if (effectsToAdd) { 2848 effectsToAdd.forEach((effect3) => { 2849 if (effect3 !== activeEffect || effect3.allowRecurse) { 2850 effects.add(effect3); 2851 } 2852 }); 2853 } 2854 }; 2855 if (type === "clear") { 2856 depsMap.forEach(add2); 2857 } else if (key === "length" && isArray2(target)) { 2858 depsMap.forEach((dep, key2) => { 2859 if (key2 === "length" || key2 >= newValue) { 2860 add2(dep); 2861 } 2862 }); 2863 } else { 2864 if (key !== void 0) { 2865 add2(depsMap.get(key)); 2866 } 2867 switch (type) { 2868 case "add": 2869 if (!isArray2(target)) { 2870 add2(depsMap.get(ITERATE_KEY)); 2871 if (isMap(target)) { 2872 add2(depsMap.get(MAP_KEY_ITERATE_KEY)); 2873 } 2874 } else if (isIntegerKey(key)) { 2875 add2(depsMap.get("length")); 2876 } 2877 break; 2878 case "delete": 2879 if (!isArray2(target)) { 2880 add2(depsMap.get(ITERATE_KEY)); 2881 if (isMap(target)) { 2882 add2(depsMap.get(MAP_KEY_ITERATE_KEY)); 2883 } 2884 } 2885 break; 2886 case "set": 2887 if (isMap(target)) { 2888 add2(depsMap.get(ITERATE_KEY)); 2889 } 2890 break; 2891 } 2892 } 2893 const run = (effect3) => { 2894 if (effect3.options.onTrigger) { 2895 effect3.options.onTrigger({ 2896 effect: effect3, 2897 target, 2898 key, 2899 type, 2900 newValue, 2901 oldValue, 2902 oldTarget 2903 }); 2904 } 2905 if (effect3.options.scheduler) { 2906 effect3.options.scheduler(effect3); 2907 } else { 2908 effect3(); 2909 } 2910 }; 2911 effects.forEach(run); 2912 } 2913 var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 2914 var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol)); 2915 var get2 = /* @__PURE__ */ createGetter(); 2916 var readonlyGet = /* @__PURE__ */ createGetter(true); 2917 var arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); 2918 function createArrayInstrumentations() { 2919 const instrumentations = {}; 2920 ["includes", "indexOf", "lastIndexOf"].forEach((key) => { 2921 instrumentations[key] = function(...args) { 2922 const arr = toRaw(this); 2923 for (let i = 0, l = this.length; i < l; i++) { 2924 track(arr, "get", i + ""); 2925 } 2926 const res = arr[key](...args); 2927 if (res === -1 || res === false) { 2928 return arr[key](...args.map(toRaw)); 2929 } else { 2930 return res; 2931 } 2932 }; 2933 }); 2934 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => { 2935 instrumentations[key] = function(...args) { 2936 pauseTracking(); 2937 const res = toRaw(this)[key].apply(this, args); 2938 resetTracking(); 2939 return res; 2940 }; 2941 }); 2942 return instrumentations; 2943 } 2944 function createGetter(isReadonly = false, shallow = false) { 2945 return function get3(target, key, receiver) { 2946 if (key === "__v_isReactive") { 2947 return !isReadonly; 2948 } else if (key === "__v_isReadonly") { 2949 return isReadonly; 2950 } else if (key === "__v_raw" && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { 2951 return target; 2952 } 2953 const targetIsArray = isArray2(target); 2954 if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) { 2955 return Reflect.get(arrayInstrumentations, key, receiver); 2956 } 2957 const res = Reflect.get(target, key, receiver); 2958 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 2959 return res; 2960 } 2961 if (!isReadonly) { 2962 track(target, "get", key); 2963 } 2964 if (shallow) { 2965 return res; 2966 } 2967 if (isRef(res)) { 2968 const shouldUnwrap = !targetIsArray || !isIntegerKey(key); 2969 return shouldUnwrap ? res.value : res; 2970 } 2971 if (isObject2(res)) { 2972 return isReadonly ? readonly(res) : reactive2(res); 2973 } 2974 return res; 2975 }; 2976 } 2977 var set2 = /* @__PURE__ */ createSetter(); 2978 function createSetter(shallow = false) { 2979 return function set3(target, key, value, receiver) { 2980 let oldValue = target[key]; 2981 if (!shallow) { 2982 value = toRaw(value); 2983 oldValue = toRaw(oldValue); 2984 if (!isArray2(target) && isRef(oldValue) && !isRef(value)) { 2985 oldValue.value = value; 2986 return true; 2987 } 2988 } 2989 const hadKey = isArray2(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 2990 const result = Reflect.set(target, key, value, receiver); 2991 if (target === toRaw(receiver)) { 2992 if (!hadKey) { 2993 trigger(target, "add", key, value); 2994 } else if (hasChanged(value, oldValue)) { 2995 trigger(target, "set", key, value, oldValue); 2996 } 2997 } 2998 return result; 2999 }; 3000 } 3001 function deleteProperty(target, key) { 3002 const hadKey = hasOwn(target, key); 3003 const oldValue = target[key]; 3004 const result = Reflect.deleteProperty(target, key); 3005 if (result && hadKey) { 3006 trigger(target, "delete", key, void 0, oldValue); 3007 } 3008 return result; 3009 } 3010 function has(target, key) { 3011 const result = Reflect.has(target, key); 3012 if (!isSymbol(key) || !builtInSymbols.has(key)) { 3013 track(target, "has", key); 3014 } 3015 return result; 3016 } 3017 function ownKeys(target) { 3018 track(target, "iterate", isArray2(target) ? "length" : ITERATE_KEY); 3019 return Reflect.ownKeys(target); 3020 } 3021 var mutableHandlers = { 3022 get: get2, 3023 set: set2, 3024 deleteProperty, 3025 has, 3026 ownKeys 3027 }; 3028 var readonlyHandlers = { 3029 get: readonlyGet, 3030 set(target, key) { 3031 if (true) { 3032 console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target); 3033 } 3034 return true; 3035 }, 3036 deleteProperty(target, key) { 3037 if (true) { 3038 console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target); 3039 } 3040 return true; 3041 } 3042 }; 3043 var toReactive = (value) => isObject2(value) ? reactive2(value) : value; 3044 var toReadonly = (value) => isObject2(value) ? readonly(value) : value; 3045 var toShallow = (value) => value; 3046 var getProto = (v) => Reflect.getPrototypeOf(v); 3047 function get$1(target, key, isReadonly = false, isShallow = false) { 3048 target = target["__v_raw"]; 3049 const rawTarget = toRaw(target); 3050 const rawKey = toRaw(key); 3051 if (key !== rawKey) { 3052 !isReadonly && track(rawTarget, "get", key); 3053 } 3054 !isReadonly && track(rawTarget, "get", rawKey); 3055 const { has: has2 } = getProto(rawTarget); 3056 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 3057 if (has2.call(rawTarget, key)) { 3058 return wrap(target.get(key)); 3059 } else if (has2.call(rawTarget, rawKey)) { 3060 return wrap(target.get(rawKey)); 3061 } else if (target !== rawTarget) { 3062 target.get(key); 3063 } 3064 } 3065 function has$1(key, isReadonly = false) { 3066 const target = this["__v_raw"]; 3067 const rawTarget = toRaw(target); 3068 const rawKey = toRaw(key); 3069 if (key !== rawKey) { 3070 !isReadonly && track(rawTarget, "has", key); 3071 } 3072 !isReadonly && track(rawTarget, "has", rawKey); 3073 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 3074 } 3075 function size(target, isReadonly = false) { 3076 target = target["__v_raw"]; 3077 !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY); 3078 return Reflect.get(target, "size", target); 3079 } 3080 function add(value) { 3081 value = toRaw(value); 3082 const target = toRaw(this); 3083 const proto = getProto(target); 3084 const hadKey = proto.has.call(target, value); 3085 if (!hadKey) { 3086 target.add(value); 3087 trigger(target, "add", value, value); 3088 } 3089 return this; 3090 } 3091 function set$1(key, value) { 3092 value = toRaw(value); 3093 const target = toRaw(this); 3094 const { has: has2, get: get3 } = getProto(target); 3095 let hadKey = has2.call(target, key); 3096 if (!hadKey) { 3097 key = toRaw(key); 3098 hadKey = has2.call(target, key); 3099 } else if (true) { 3100 checkIdentityKeys(target, has2, key); 3101 } 3102 const oldValue = get3.call(target, key); 3103 target.set(key, value); 3104 if (!hadKey) { 3105 trigger(target, "add", key, value); 3106 } else if (hasChanged(value, oldValue)) { 3107 trigger(target, "set", key, value, oldValue); 3108 } 3109 return this; 3110 } 3111 function deleteEntry(key) { 3112 const target = toRaw(this); 3113 const { has: has2, get: get3 } = getProto(target); 3114 let hadKey = has2.call(target, key); 3115 if (!hadKey) { 3116 key = toRaw(key); 3117 hadKey = has2.call(target, key); 3118 } else if (true) { 3119 checkIdentityKeys(target, has2, key); 3120 } 3121 const oldValue = get3 ? get3.call(target, key) : void 0; 3122 const result = target.delete(key); 3123 if (hadKey) { 3124 trigger(target, "delete", key, void 0, oldValue); 3125 } 3126 return result; 3127 } 3128 function clear() { 3129 const target = toRaw(this); 3130 const hadItems = target.size !== 0; 3131 const oldTarget = true ? isMap(target) ? new Map(target) : new Set(target) : void 0; 3132 const result = target.clear(); 3133 if (hadItems) { 3134 trigger(target, "clear", void 0, void 0, oldTarget); 3135 } 3136 return result; 3137 } 3138 function createForEach(isReadonly, isShallow) { 3139 return function forEach(callback, thisArg) { 3140 const observed = this; 3141 const target = observed["__v_raw"]; 3142 const rawTarget = toRaw(target); 3143 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 3144 !isReadonly && track(rawTarget, "iterate", ITERATE_KEY); 3145 return target.forEach((value, key) => { 3146 return callback.call(thisArg, wrap(value), wrap(key), observed); 3147 }); 3148 }; 3149 } 3150 function createIterableMethod(method, isReadonly, isShallow) { 3151 return function(...args) { 3152 const target = this["__v_raw"]; 3153 const rawTarget = toRaw(target); 3154 const targetIsMap = isMap(rawTarget); 3155 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 3156 const isKeyOnly = method === "keys" && targetIsMap; 3157 const innerIterator = target[method](...args); 3158 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 3159 !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); 3160 return { 3161 next() { 3162 const { value, done } = innerIterator.next(); 3163 return done ? { value, done } : { 3164 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 3165 done 3166 }; 3167 }, 3168 [Symbol.iterator]() { 3169 return this; 3170 } 3171 }; 3172 }; 3173 } 3174 function createReadonlyMethod(type) { 3175 return function(...args) { 3176 if (true) { 3177 const key = args[0] ? `on key "${args[0]}" ` : ``; 3178 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this)); 3179 } 3180 return type === "delete" ? false : this; 3181 }; 3182 } 3183 function createInstrumentations() { 3184 const mutableInstrumentations2 = { 3185 get(key) { 3186 return get$1(this, key); 3187 }, 3188 get size() { 3189 return size(this); 3190 }, 3191 has: has$1, 3192 add, 3193 set: set$1, 3194 delete: deleteEntry, 3195 clear, 3196 forEach: createForEach(false, false) 3197 }; 3198 const shallowInstrumentations2 = { 3199 get(key) { 3200 return get$1(this, key, false, true); 3201 }, 3202 get size() { 3203 return size(this); 3204 }, 3205 has: has$1, 3206 add, 3207 set: set$1, 3208 delete: deleteEntry, 3209 clear, 3210 forEach: createForEach(false, true) 3211 }; 3212 const readonlyInstrumentations2 = { 3213 get(key) { 3214 return get$1(this, key, true); 3215 }, 3216 get size() { 3217 return size(this, true); 3218 }, 3219 has(key) { 3220 return has$1.call(this, key, true); 3221 }, 3222 add: createReadonlyMethod( 3223 "add" 3224 ), 3225 set: createReadonlyMethod( 3226 "set" 3227 ), 3228 delete: createReadonlyMethod( 3229 "delete" 3230 ), 3231 clear: createReadonlyMethod( 3232 "clear" 3233 ), 3234 forEach: createForEach(true, false) 3235 }; 3236 const shallowReadonlyInstrumentations2 = { 3237 get(key) { 3238 return get$1(this, key, true, true); 3239 }, 3240 get size() { 3241 return size(this, true); 3242 }, 3243 has(key) { 3244 return has$1.call(this, key, true); 3245 }, 3246 add: createReadonlyMethod( 3247 "add" 3248 ), 3249 set: createReadonlyMethod( 3250 "set" 3251 ), 3252 delete: createReadonlyMethod( 3253 "delete" 3254 ), 3255 clear: createReadonlyMethod( 3256 "clear" 3257 ), 3258 forEach: createForEach(true, true) 3259 }; 3260 const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; 3261 iteratorMethods.forEach((method) => { 3262 mutableInstrumentations2[method] = createIterableMethod(method, false, false); 3263 readonlyInstrumentations2[method] = createIterableMethod(method, true, false); 3264 shallowInstrumentations2[method] = createIterableMethod(method, false, true); 3265 shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true); 3266 }); 3267 return [ 3268 mutableInstrumentations2, 3269 readonlyInstrumentations2, 3270 shallowInstrumentations2, 3271 shallowReadonlyInstrumentations2 3272 ]; 3273 } 3274 var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations(); 3275 function createInstrumentationGetter(isReadonly, shallow) { 3276 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; 3277 return (target, key, receiver) => { 3278 if (key === "__v_isReactive") { 3279 return !isReadonly; 3280 } else if (key === "__v_isReadonly") { 3281 return isReadonly; 3282 } else if (key === "__v_raw") { 3283 return target; 3284 } 3285 return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver); 3286 }; 3287 } 3288 var mutableCollectionHandlers = { 3289 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 3290 }; 3291 var readonlyCollectionHandlers = { 3292 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 3293 }; 3294 function checkIdentityKeys(target, has2, key) { 3295 const rawKey = toRaw(key); 3296 if (rawKey !== key && has2.call(target, rawKey)) { 3297 const type = toRawType(target); 3298 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.`); 3299 } 3300 } 3301 var reactiveMap = /* @__PURE__ */ new WeakMap(); 3302 var shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 3303 var readonlyMap = /* @__PURE__ */ new WeakMap(); 3304 var shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 3305 function targetTypeMap(rawType) { 3306 switch (rawType) { 3307 case "Object": 3308 case "Array": 3309 return 1; 3310 case "Map": 3311 case "Set": 3312 case "WeakMap": 3313 case "WeakSet": 3314 return 2; 3315 default: 3316 return 0; 3317 } 3318 } 3319 function getTargetType(value) { 3320 return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); 3321 } 3322 function reactive2(target) { 3323 if (target && target["__v_isReadonly"]) { 3324 return target; 3325 } 3326 return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap); 3327 } 3328 function readonly(target) { 3329 return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap); 3330 } 3331 function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) { 3332 if (!isObject2(target)) { 3333 if (true) { 3334 console.warn(`value cannot be made reactive: ${String(target)}`); 3335 } 3336 return target; 3337 } 3338 if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) { 3339 return target; 3340 } 3341 const existingProxy = proxyMap.get(target); 3342 if (existingProxy) { 3343 return existingProxy; 3344 } 3345 const targetType = getTargetType(target); 3346 if (targetType === 0) { 3347 return target; 3348 } 3349 const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers); 3350 proxyMap.set(target, proxy); 3351 return proxy; 3352 } 3353 function toRaw(observed) { 3354 return observed && toRaw(observed["__v_raw"]) || observed; 3355 } 3356 function isRef(r) { 3357 return Boolean(r && r.__v_isRef === true); 3358 } 3359 magic("nextTick", () => nextTick); 3360 magic("dispatch", (el) => dispatch2.bind(dispatch2, el)); 3361 magic("watch", (el, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => (key, callback) => { 3362 let evaluate22 = evaluateLater2(key); 3363 let getter = () => { 3364 let value; 3365 evaluate22((i) => value = i); 3366 return value; 3367 }; 3368 let unwatch = watch(getter, callback); 3369 cleanup2(unwatch); 3370 }); 3371 magic("store", getStores); 3372 magic("data", (el) => scope(el)); 3373 magic("root", (el) => closestRoot(el)); 3374 magic("refs", (el) => { 3375 if (el._x_refs_proxy) 3376 return el._x_refs_proxy; 3377 el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el)); 3378 return el._x_refs_proxy; 3379 }); 3380 function getArrayOfRefObject(el) { 3381 let refObjects = []; 3382 findClosest(el, (i) => { 3383 if (i._x_refs) 3384 refObjects.push(i._x_refs); 3385 }); 3386 return refObjects; 3387 } 3388 var globalIdMemo = {}; 3389 function findAndIncrementId(name) { 3390 if (!globalIdMemo[name]) 3391 globalIdMemo[name] = 0; 3392 return ++globalIdMemo[name]; 3393 } 3394 function closestIdRoot(el, name) { 3395 return findClosest(el, (element) => { 3396 if (element._x_ids && element._x_ids[name]) 3397 return true; 3398 }); 3399 } 3400 function setIdRoot(el, name) { 3401 if (!el._x_ids) 3402 el._x_ids = {}; 3403 if (!el._x_ids[name]) 3404 el._x_ids[name] = findAndIncrementId(name); 3405 } 3406 magic("id", (el, { cleanup: cleanup2 }) => (name, key = null) => { 3407 let cacheKey = `${name}${key ? `-${key}` : ""}`; 3408 return cacheIdByNameOnElement(el, cacheKey, cleanup2, () => { 3409 let root = closestIdRoot(el, name); 3410 let id = root ? root._x_ids[name] : findAndIncrementId(name); 3411 return key ? `${name}-${id}-${key}` : `${name}-${id}`; 3412 }); 3413 }); 3414 interceptClone((from, to) => { 3415 if (from._x_id) { 3416 to._x_id = from._x_id; 3417 } 3418 }); 3419 function cacheIdByNameOnElement(el, cacheKey, cleanup2, callback) { 3420 if (!el._x_id) 3421 el._x_id = {}; 3422 if (el._x_id[cacheKey]) 3423 return el._x_id[cacheKey]; 3424 let output = callback(); 3425 el._x_id[cacheKey] = output; 3426 cleanup2(() => { 3427 delete el._x_id[cacheKey]; 3428 }); 3429 return output; 3430 } 3431 magic("el", (el) => el); 3432 warnMissingPluginMagic("Focus", "focus", "focus"); 3433 warnMissingPluginMagic("Persist", "persist", "persist"); 3434 function warnMissingPluginMagic(name, magicName, slug) { 3435 magic(magicName, (el) => warn(`You can't use [$${magicName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); 3436 } 3437 directive("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 3438 let func = evaluateLater2(expression); 3439 let innerGet = () => { 3440 let result; 3441 func((i) => result = i); 3442 return result; 3443 }; 3444 let evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`); 3445 let innerSet = (val) => evaluateInnerSet(() => { 3446 }, { scope: { "__placeholder": val } }); 3447 let initialValue = innerGet(); 3448 innerSet(initialValue); 3449 queueMicrotask(() => { 3450 if (!el._x_model) 3451 return; 3452 el._x_removeModelListeners["default"](); 3453 let outerGet = el._x_model.get; 3454 let outerSet = el._x_model.setWithModifiers; 3455 let releaseEntanglement = entangle( 3456 { 3457 get() { 3458 return outerGet(); 3459 }, 3460 set(value) { 3461 outerSet(value); 3462 } 3463 }, 3464 { 3465 get() { 3466 return innerGet(); 3467 }, 3468 set(value) { 3469 innerSet(value); 3470 } 3471 } 3472 ); 3473 cleanup2(releaseEntanglement); 3474 }); 3475 }); 3476 directive("teleport", (el, { modifiers, expression }, { cleanup: cleanup2 }) => { 3477 if (el.tagName.toLowerCase() !== "template") 3478 warn("x-teleport can only be used on a <template> tag", el); 3479 let target = getTarget(expression); 3480 let clone22 = el.content.cloneNode(true).firstElementChild; 3481 el._x_teleport = clone22; 3482 clone22._x_teleportBack = el; 3483 el.setAttribute("data-teleport-template", true); 3484 clone22.setAttribute("data-teleport-target", true); 3485 if (el._x_forwardEvents) { 3486 el._x_forwardEvents.forEach((eventName) => { 3487 clone22.addEventListener(eventName, (e) => { 3488 e.stopPropagation(); 3489 el.dispatchEvent(new e.constructor(e.type, e)); 3490 }); 3491 }); 3492 } 3493 addScopeToNode(clone22, {}, el); 3494 let placeInDom = (clone3, target2, modifiers2) => { 3495 if (modifiers2.includes("prepend")) { 3496 target2.parentNode.insertBefore(clone3, target2); 3497 } else if (modifiers2.includes("append")) { 3498 target2.parentNode.insertBefore(clone3, target2.nextSibling); 3499 } else { 3500 target2.appendChild(clone3); 3501 } 3502 }; 3503 mutateDom(() => { 3504 skipDuringClone(() => { 3505 placeInDom(clone22, target, modifiers); 3506 initTree(clone22); 3507 })(); 3508 }); 3509 el._x_teleportPutBack = () => { 3510 let target2 = getTarget(expression); 3511 mutateDom(() => { 3512 placeInDom(el._x_teleport, target2, modifiers); 3513 }); 3514 }; 3515 cleanup2( 3516 () => mutateDom(() => { 3517 clone22.remove(); 3518 destroyTree(clone22); 3519 }) 3520 ); 3521 }); 3522 var teleportContainerDuringClone = document.createElement("div"); 3523 function getTarget(expression) { 3524 let target = skipDuringClone(() => { 3525 return document.querySelector(expression); 3526 }, () => { 3527 return teleportContainerDuringClone; 3528 })(); 3529 if (!target) 3530 warn(`Cannot find x-teleport element for selector: "${expression}"`); 3531 return target; 3532 } 3533 var handler = () => { 3534 }; 3535 handler.inline = (el, { modifiers }, { cleanup: cleanup2 }) => { 3536 modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true; 3537 cleanup2(() => { 3538 modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore; 3539 }); 3540 }; 3541 directive("ignore", handler); 3542 directive("effect", skipDuringClone((el, { expression }, { effect: effect3 }) => { 3543 effect3(evaluateLater(el, expression)); 3544 })); 3545 function on(el, event, modifiers, callback) { 3546 let listenerTarget = el; 3547 let handler4 = (e) => callback(e); 3548 let options = {}; 3549 let wrapHandler = (callback2, wrapper) => (e) => wrapper(callback2, e); 3550 if (modifiers.includes("dot")) 3551 event = dotSyntax(event); 3552 if (modifiers.includes("camel")) 3553 event = camelCase2(event); 3554 if (modifiers.includes("capture")) 3555 options.capture = true; 3556 if (modifiers.includes("window")) 3557 listenerTarget = window; 3558 if (modifiers.includes("document")) 3559 listenerTarget = document; 3560 if (modifiers.includes("passive")) { 3561 options.passive = modifiers[modifiers.indexOf("passive") + 1] !== "false"; 3562 } 3563 handler4 = addDebounceOrThrottle(modifiers, handler4); 3564 if (modifiers.includes("prevent")) 3565 handler4 = wrapHandler(handler4, (next, e) => { 3566 e.preventDefault(); 3567 next(e); 3568 }); 3569 if (modifiers.includes("stop")) 3570 handler4 = wrapHandler(handler4, (next, e) => { 3571 e.stopPropagation(); 3572 next(e); 3573 }); 3574 if (modifiers.includes("once")) { 3575 handler4 = wrapHandler(handler4, (next, e) => { 3576 next(e); 3577 listenerTarget.removeEventListener(event, handler4, options); 3578 }); 3579 } 3580 if (modifiers.includes("away") || modifiers.includes("outside")) { 3581 listenerTarget = document; 3582 handler4 = wrapHandler(handler4, (next, e) => { 3583 if (el.contains(e.target)) 3584 return; 3585 if (e.target.isConnected === false) 3586 return; 3587 if (el.offsetWidth < 1 && el.offsetHeight < 1) 3588 return; 3589 if (el._x_isShown === false) 3590 return; 3591 next(e); 3592 }); 3593 } 3594 if (modifiers.includes("self")) 3595 handler4 = wrapHandler(handler4, (next, e) => { 3596 e.target === el && next(e); 3597 }); 3598 if (event === "submit") { 3599 handler4 = wrapHandler(handler4, (next, e) => { 3600 if (e.target._x_pendingModelUpdates) { 3601 e.target._x_pendingModelUpdates.forEach((fn) => fn()); 3602 } 3603 next(e); 3604 }); 3605 } 3606 if (isKeyEvent(event) || isClickEvent(event)) { 3607 handler4 = wrapHandler(handler4, (next, e) => { 3608 if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) { 3609 return; 3610 } 3611 next(e); 3612 }); 3613 } 3614 listenerTarget.addEventListener(event, handler4, options); 3615 return () => { 3616 listenerTarget.removeEventListener(event, handler4, options); 3617 }; 3618 } 3619 function addDebounceOrThrottle(modifiers, handler4) { 3620 if (modifiers.includes("debounce")) { 3621 let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait"; 3622 let wait = isNumeric2(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250; 3623 handler4 = debounce(handler4, wait); 3624 } 3625 if (modifiers.includes("throttle")) { 3626 let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait"; 3627 let wait = isNumeric2(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250; 3628 handler4 = throttle(handler4, wait); 3629 } 3630 return handler4; 3631 } 3632 function dotSyntax(subject) { 3633 return subject.replace(/-/g, "."); 3634 } 3635 function camelCase2(subject) { 3636 return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase()); 3637 } 3638 function isNumeric2(subject) { 3639 return !Array.isArray(subject) && !isNaN(subject); 3640 } 3641 function kebabCase2(subject) { 3642 if ([" ", "_"].includes( 3643 subject 3644 )) 3645 return subject; 3646 return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase(); 3647 } 3648 function isKeyEvent(event) { 3649 return ["keydown", "keyup"].includes(event); 3650 } 3651 function isClickEvent(event) { 3652 return ["contextmenu", "click", "mouse"].some((i) => event.includes(i)); 3653 } 3654 function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) { 3655 let keyModifiers = modifiers.filter((i) => { 3656 return !["window", "document", "prevent", "stop", "once", "capture", "self", "away", "outside", "passive", "preserve-scroll", "blur", "change", "lazy"].includes(i); 3657 }); 3658 if (keyModifiers.includes("debounce")) { 3659 let debounceIndex = keyModifiers.indexOf("debounce"); 3660 keyModifiers.splice(debounceIndex, isNumeric2((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1); 3661 } 3662 if (keyModifiers.includes("throttle")) { 3663 let debounceIndex = keyModifiers.indexOf("throttle"); 3664 keyModifiers.splice(debounceIndex, isNumeric2((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1); 3665 } 3666 if (keyModifiers.length === 0) 3667 return false; 3668 if (keyModifiers.length === 1 && keyToModifiers(e.key).includes(keyModifiers[0])) 3669 return false; 3670 const systemKeyModifiers = ["ctrl", "shift", "alt", "meta", "cmd", "super"]; 3671 const selectedSystemKeyModifiers = systemKeyModifiers.filter((modifier) => keyModifiers.includes(modifier)); 3672 keyModifiers = keyModifiers.filter((i) => !selectedSystemKeyModifiers.includes(i)); 3673 if (selectedSystemKeyModifiers.length > 0) { 3674 const activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter((modifier) => { 3675 if (modifier === "cmd" || modifier === "super") 3676 modifier = "meta"; 3677 return e[`${modifier}Key`]; 3678 }); 3679 if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) { 3680 if (isClickEvent(e.type)) 3681 return false; 3682 if (keyToModifiers(e.key).includes(keyModifiers[0])) 3683 return false; 3684 } 3685 } 3686 return true; 3687 } 3688 function keyToModifiers(key) { 3689 if (!key) 3690 return []; 3691 key = kebabCase2(key); 3692 let modifierToKeyMap = { 3693 "ctrl": "control", 3694 "slash": "/", 3695 "space": " ", 3696 "spacebar": " ", 3697 "cmd": "meta", 3698 "esc": "escape", 3699 "up": "arrow-up", 3700 "down": "arrow-down", 3701 "left": "arrow-left", 3702 "right": "arrow-right", 3703 "period": ".", 3704 "comma": ",", 3705 "equal": "=", 3706 "minus": "-", 3707 "underscore": "_" 3708 }; 3709 modifierToKeyMap[key] = key; 3710 return Object.keys(modifierToKeyMap).map((modifier) => { 3711 if (modifierToKeyMap[modifier] === key) 3712 return modifier; 3713 }).filter((modifier) => modifier); 3714 } 3715 directive("model", (el, { modifiers, expression }, { effect: effect3, cleanup: cleanup2 }) => { 3716 let scopeTarget = el; 3717 if (modifiers.includes("parent")) { 3718 scopeTarget = findClosest(el, (element) => element !== el); 3719 } 3720 let evaluateGet = evaluateLater(scopeTarget, expression); 3721 let evaluateSet; 3722 if (typeof expression === "string") { 3723 evaluateSet = evaluateLater(scopeTarget, `${expression} = __placeholder`); 3724 } else if (typeof expression === "function" && typeof expression() === "string") { 3725 evaluateSet = evaluateLater(scopeTarget, `${expression()} = __placeholder`); 3726 } else { 3727 evaluateSet = () => { 3728 }; 3729 } 3730 let getValue = () => { 3731 let result; 3732 evaluateGet((value) => result = value); 3733 return isGetterSetter(result) ? result.get() : result; 3734 }; 3735 let setValue = (value) => { 3736 let result; 3737 evaluateGet((value2) => result = value2); 3738 if (isGetterSetter(result)) { 3739 result.set(value); 3740 } else { 3741 evaluateSet(() => { 3742 }, { 3743 scope: { "__placeholder": value } 3744 }); 3745 } 3746 }; 3747 if (typeof expression === "string" && el.type === "radio") { 3748 mutateDom(() => { 3749 if (!el.hasAttribute("name")) 3750 el.setAttribute("name", expression); 3751 }); 3752 } 3753 let hasChangeModifier = modifiers.includes("change") || modifiers.includes("lazy"); 3754 let hasBlurModifier = modifiers.includes("blur"); 3755 let hasEnterModifier = modifiers.includes("enter"); 3756 let hasExplicitEventModifiers = hasChangeModifier || hasBlurModifier || hasEnterModifier; 3757 let removeListener; 3758 if (isCloning) { 3759 removeListener = () => { 3760 }; 3761 } else if (hasExplicitEventModifiers) { 3762 let listeners2 = []; 3763 let syncValue = (e) => setValue(getInputValue(el, modifiers, e, getValue())); 3764 if (hasChangeModifier) { 3765 listeners2.push(on(el, "change", modifiers, syncValue)); 3766 } 3767 if (hasBlurModifier) { 3768 listeners2.push(on(el, "blur", modifiers, syncValue)); 3769 if (el.form) { 3770 let form = el.form; 3771 let syncCallback = () => syncValue({ target: el }); 3772 if (!form._x_pendingModelUpdates) 3773 form._x_pendingModelUpdates = []; 3774 form._x_pendingModelUpdates.push(syncCallback); 3775 cleanup2(() => { 3776 if (form._x_pendingModelUpdates) { 3777 form._x_pendingModelUpdates.splice(form._x_pendingModelUpdates.indexOf(syncCallback), 1); 3778 } 3779 }); 3780 } 3781 } 3782 if (hasEnterModifier) { 3783 listeners2.push(on(el, "keydown", modifiers, (e) => { 3784 if (e.key === "Enter") 3785 syncValue(e); 3786 })); 3787 } 3788 removeListener = () => listeners2.forEach((remove) => remove()); 3789 } else { 3790 let event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) ? "change" : "input"; 3791 removeListener = on(el, event, modifiers, (e) => { 3792 setValue(getInputValue(el, modifiers, e, getValue())); 3793 }); 3794 } 3795 if (modifiers.includes("fill")) { 3796 if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { 3797 setValue( 3798 getInputValue(el, modifiers, { target: el }, getValue()) 3799 ); 3800 } 3801 } 3802 if (!el._x_removeModelListeners) 3803 el._x_removeModelListeners = {}; 3804 el._x_removeModelListeners["default"] = removeListener; 3805 cleanup2(() => el._x_removeModelListeners["default"]()); 3806 if (el.form) { 3807 let removeResetListener = on(el.form, "reset", [], (e) => { 3808 nextTick(() => el._x_model && el._x_model.set(getInputValue(el, modifiers, { target: el }, getValue()))); 3809 }); 3810 cleanup2(() => removeResetListener()); 3811 } 3812 el._x_model = { 3813 get() { 3814 return getValue(); 3815 }, 3816 set(value) { 3817 setValue(value); 3818 }, 3819 setWithModifiers: addDebounceOrThrottle(modifiers, setValue) 3820 }; 3821 el._x_forceModelUpdate = (value) => { 3822 if (value === void 0 && typeof expression === "string" && expression.match(/\./)) 3823 value = ""; 3824 mutateDom(() => { 3825 if (isCheckbox(el)) { 3826 if (Array.isArray(value)) { 3827 el.checked = value.some((val) => val == el.value); 3828 } else { 3829 el.checked = !!value; 3830 } 3831 } else if (isRadio(el)) { 3832 if (typeof value === "boolean") { 3833 el.checked = safeParseBoolean(el.value) === value; 3834 } else { 3835 el.checked = el.value == value; 3836 } 3837 } else { 3838 bind(el, "value", value); 3839 } 3840 }); 3841 }; 3842 effect3(() => { 3843 let value = getValue(); 3844 if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el)) 3845 return; 3846 el._x_forceModelUpdate(value); 3847 }); 3848 }); 3849 function getInputValue(el, modifiers, event, currentValue) { 3850 return mutateDom(() => { 3851 if (event instanceof CustomEvent && event.detail !== void 0) 3852 return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; 3853 else if (isCheckbox(el)) { 3854 if (Array.isArray(currentValue)) { 3855 let newValue = null; 3856 if (modifiers.includes("number")) { 3857 newValue = safeParseNumber(event.target.value); 3858 } else if (modifiers.includes("boolean")) { 3859 newValue = safeParseBoolean(event.target.value); 3860 } else { 3861 newValue = event.target.value; 3862 } 3863 return event.target.checked ? currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue)); 3864 } else { 3865 return event.target.checked; 3866 } 3867 } else if (el.tagName.toLowerCase() === "select" && el.multiple) { 3868 if (modifiers.includes("number")) { 3869 return Array.from(event.target.selectedOptions).map((option2) => { 3870 let rawValue = option2.value || option2.text; 3871 return safeParseNumber(rawValue); 3872 }); 3873 } else if (modifiers.includes("boolean")) { 3874 return Array.from(event.target.selectedOptions).map((option2) => { 3875 let rawValue = option2.value || option2.text; 3876 return safeParseBoolean(rawValue); 3877 }); 3878 } 3879 return Array.from(event.target.selectedOptions).map((option2) => { 3880 return option2.value || option2.text; 3881 }); 3882 } else { 3883 let newValue; 3884 if (isRadio(el)) { 3885 if (event.target.checked) { 3886 newValue = event.target.value; 3887 } else { 3888 newValue = currentValue; 3889 } 3890 } else { 3891 newValue = event.target.value; 3892 } 3893 if (modifiers.includes("number")) { 3894 return safeParseNumber(newValue); 3895 } else if (modifiers.includes("boolean")) { 3896 return safeParseBoolean(newValue); 3897 } else if (modifiers.includes("trim")) { 3898 return newValue.trim(); 3899 } else { 3900 return newValue; 3901 } 3902 } 3903 }); 3904 } 3905 function safeParseNumber(rawValue) { 3906 let number = rawValue ? parseFloat(rawValue) : null; 3907 return isNumeric22(number) ? number : rawValue; 3908 } 3909 function checkedAttrLooseCompare2(valueA, valueB) { 3910 return valueA == valueB; 3911 } 3912 function isNumeric22(subject) { 3913 return !Array.isArray(subject) && !isNaN(subject); 3914 } 3915 function isGetterSetter(value) { 3916 return value !== null && typeof value === "object" && typeof value.get === "function" && typeof value.set === "function"; 3917 } 3918 directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak"))))); 3919 addInitSelector(() => `[${prefix("init")}]`); 3920 directive("init", skipDuringClone((el, { expression }, { evaluate: evaluate22 }) => { 3921 if (typeof expression === "string") { 3922 return !!expression.trim() && evaluate22(expression, {}, false); 3923 } 3924 return evaluate22(expression, {}, false); 3925 })); 3926 directive("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => { 3927 let evaluate22 = evaluateLater2(expression); 3928 effect3(() => { 3929 evaluate22((value) => { 3930 mutateDom(() => { 3931 el.textContent = value; 3932 }); 3933 }); 3934 }); 3935 }); 3936 directive("html", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => { 3937 let evaluate22 = evaluateLater2(expression); 3938 effect3(() => { 3939 evaluate22((value) => { 3940 mutateDom(() => { 3941 el.innerHTML = value ?? ""; 3942 el._x_ignoreSelf = true; 3943 initTree(el); 3944 delete el._x_ignoreSelf; 3945 }); 3946 }); 3947 }); 3948 }); 3949 mapAttributes(startingWith(":", into(prefix("bind:")))); 3950 var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3, cleanup: cleanup2 }) => { 3951 if (!value) { 3952 let bindingProviders = {}; 3953 injectBindingProviders(bindingProviders); 3954 let getBindings = evaluateLater(el, expression); 3955 getBindings((bindings) => { 3956 applyBindingsObject(el, bindings, original); 3957 }, { scope: bindingProviders }); 3958 return; 3959 } 3960 if (value === "key") 3961 return storeKeyForXFor(el, expression); 3962 if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) { 3963 return; 3964 } 3965 let evaluate22 = evaluateLater(el, expression); 3966 effect3(() => evaluate22((result) => { 3967 if (result === void 0 && typeof expression === "string" && expression.match(/\./)) { 3968 result = ""; 3969 } 3970 mutateDom(() => bind(el, value, result, modifiers)); 3971 })); 3972 cleanup2(() => { 3973 el._x_undoAddedClasses && el._x_undoAddedClasses(); 3974 el._x_undoAddedStyles && el._x_undoAddedStyles(); 3975 }); 3976 }; 3977 handler2.inline = (el, { value, modifiers, expression }) => { 3978 if (!value) 3979 return; 3980 if (!el._x_inlineBindings) 3981 el._x_inlineBindings = {}; 3982 el._x_inlineBindings[value] = { expression, extract: false }; 3983 }; 3984 directive("bind", handler2); 3985 function storeKeyForXFor(el, expression) { 3986 el._x_keyExpression = expression; 3987 } 3988 addRootSelector(() => `[${prefix("data")}]`); 3989 directive("data", (el, { expression }, { cleanup: cleanup2 }) => { 3990 if (shouldSkipRegisteringDataDuringClone(el)) 3991 return; 3992 expression = expression === "" ? "{}" : expression; 3993 let magicContext = {}; 3994 injectMagics(magicContext, el); 3995 let dataProviderContext = {}; 3996 injectDataProviders(dataProviderContext, magicContext); 3997 let data2 = evaluate(el, expression, { scope: dataProviderContext }); 3998 if (data2 === void 0 || data2 === true) 3999 data2 = {}; 4000 injectMagics(data2, el); 4001 let reactiveData = reactive(data2); 4002 initInterceptors(reactiveData); 4003 let undo = addScopeToNode(el, reactiveData); 4004 reactiveData["init"] && evaluate(el, reactiveData["init"]); 4005 cleanup2(() => { 4006 reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]); 4007 undo(); 4008 }); 4009 }); 4010 interceptClone((from, to) => { 4011 if (from._x_dataStack) { 4012 to._x_dataStack = from._x_dataStack; 4013 to.setAttribute("data-has-alpine-state", true); 4014 } 4015 }); 4016 function shouldSkipRegisteringDataDuringClone(el) { 4017 if (!isCloning) 4018 return false; 4019 if (isCloningLegacy) 4020 return true; 4021 return el.hasAttribute("data-has-alpine-state"); 4022 } 4023 directive("show", (el, { modifiers, expression }, { effect: effect3 }) => { 4024 let evaluate22 = evaluateLater(el, expression); 4025 if (!el._x_doHide) 4026 el._x_doHide = () => { 4027 mutateDom(() => { 4028 el.style.setProperty("display", "none", modifiers.includes("important") ? "important" : void 0); 4029 }); 4030 }; 4031 if (!el._x_doShow) 4032 el._x_doShow = () => { 4033 mutateDom(() => { 4034 if (el.style.length === 1 && el.style.display === "none") { 4035 el.removeAttribute("style"); 4036 } else { 4037 el.style.removeProperty("display"); 4038 } 4039 }); 4040 }; 4041 let hide = () => { 4042 el._x_doHide(); 4043 el._x_isShown = false; 4044 }; 4045 let show = () => { 4046 el._x_doShow(); 4047 el._x_isShown = true; 4048 }; 4049 let clickAwayCompatibleShow = () => setTimeout(show); 4050 let toggle = once( 4051 (value) => value ? show() : hide(), 4052 (value) => { 4053 if (typeof el._x_toggleAndCascadeWithTransitions === "function") { 4054 el._x_toggleAndCascadeWithTransitions(el, value, show, hide); 4055 } else { 4056 value ? clickAwayCompatibleShow() : hide(); 4057 } 4058 } 4059 ); 4060 let oldValue; 4061 let firstTime = true; 4062 effect3(() => evaluate22((value) => { 4063 if (!firstTime && value === oldValue) 4064 return; 4065 if (modifiers.includes("immediate")) 4066 value ? clickAwayCompatibleShow() : hide(); 4067 toggle(value); 4068 oldValue = value; 4069 firstTime = false; 4070 })); 4071 }); 4072 directive("for", (el, { expression }, { effect: effect3, cleanup: cleanup2 }) => { 4073 let iteratorNames = parseForExpression(expression); 4074 let evaluateItems = evaluateLater(el, iteratorNames.items); 4075 let evaluateKey = evaluateLater( 4076 el, 4077 el._x_keyExpression || "index" 4078 ); 4079 el._x_lookup = /* @__PURE__ */ new Map(); 4080 effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey)); 4081 cleanup2(() => { 4082 el._x_lookup.forEach( 4083 (el2) => mutateDom(() => { 4084 destroyTree(el2); 4085 el2.remove(); 4086 }) 4087 ); 4088 delete el._x_lookup; 4089 }); 4090 }); 4091 function refreshScope(scope2) { 4092 return (newScope) => { 4093 Object.entries(newScope).forEach(([key, value]) => { 4094 scope2[key] = value; 4095 }); 4096 }; 4097 } 4098 function loop(templateEl, iteratorNames, evaluateItems, evaluateKey) { 4099 evaluateItems((items) => { 4100 if (isNumeric3(items)) 4101 items = Array.from({ length: items }, (_, i) => i + 1); 4102 if (items === void 0 || items === null) 4103 items = []; 4104 if (items instanceof Set) 4105 items = Array.from(items); 4106 if (items instanceof Map) 4107 items = Array.from(items); 4108 let oldLookup = templateEl._x_lookup; 4109 let lookup = /* @__PURE__ */ new Map(); 4110 templateEl._x_lookup = lookup; 4111 let hasStringKeys = isObject22(items); 4112 let scopeEntries = Object.entries(items).map(([index2, item]) => { 4113 if (!hasStringKeys) 4114 index2 = parseInt(index2); 4115 let scope2 = getIterationScopeVariables(iteratorNames, item, index2, items); 4116 let key; 4117 evaluateKey((innerKey) => { 4118 if (typeof innerKey === "object") 4119 warn("x-for key cannot be an object, it must be a string or an integer", templateEl); 4120 if (oldLookup.has(innerKey)) { 4121 lookup.set(innerKey, oldLookup.get(innerKey)); 4122 oldLookup.delete(innerKey); 4123 } 4124 key = innerKey; 4125 }, { scope: { index: index2, ...scope2 } }); 4126 return [key, scope2]; 4127 }); 4128 mutateDom(() => { 4129 oldLookup.forEach((el) => { 4130 destroyTree(el); 4131 el.remove(); 4132 }); 4133 let added = /* @__PURE__ */ new Set(); 4134 let prev = templateEl; 4135 scopeEntries.forEach(([key, scope2]) => { 4136 if (lookup.has(key)) { 4137 let el = lookup.get(key); 4138 el._x_refreshXForScope(scope2); 4139 if (prev.nextElementSibling !== el) { 4140 if (prev.nextElementSibling) 4141 el.replaceWith(prev.nextElementSibling); 4142 prev.after(el); 4143 } 4144 prev = el; 4145 if (el._x_currentIfEl) { 4146 if (el.nextElementSibling !== el._x_currentIfEl) 4147 prev.after(el._x_currentIfEl); 4148 prev = el._x_currentIfEl; 4149 } 4150 return; 4151 } 4152 if (templateEl.content.children.length > 1) 4153 warn("x-for templates require a single root element, additional elements will be ignored.", templateEl); 4154 let clone22 = document.importNode(templateEl.content, true).firstElementChild; 4155 let reactiveScope = reactive(scope2); 4156 addScopeToNode(clone22, reactiveScope, templateEl); 4157 clone22._x_refreshXForScope = refreshScope(reactiveScope); 4158 lookup.set(key, clone22); 4159 added.add(clone22); 4160 prev.after(clone22); 4161 prev = clone22; 4162 }); 4163 skipDuringClone(() => added.forEach((clone22) => initTree(clone22)))(); 4164 }); 4165 }); 4166 } 4167 function parseForExpression(expression) { 4168 let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 4169 let stripParensRE = /^\s*\(|\)\s*$/g; 4170 let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; 4171 let inMatch = expression.match(forAliasRE); 4172 if (!inMatch) 4173 return; 4174 let res = {}; 4175 res.items = inMatch[2].trim(); 4176 let item = inMatch[1].replace(stripParensRE, "").trim(); 4177 let iteratorMatch = item.match(forIteratorRE); 4178 if (iteratorMatch) { 4179 res.item = item.replace(forIteratorRE, "").trim(); 4180 res.index = iteratorMatch[1].trim(); 4181 if (iteratorMatch[2]) { 4182 res.collection = iteratorMatch[2].trim(); 4183 } 4184 } else { 4185 res.item = item; 4186 } 4187 return res; 4188 } 4189 function getIterationScopeVariables(iteratorNames, item, index2, items) { 4190 let scopeVariables = {}; 4191 if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) { 4192 let names = iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i) => i.trim()); 4193 names.forEach((name, i) => { 4194 scopeVariables[name] = item[i]; 4195 }); 4196 } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") { 4197 let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim()); 4198 names.forEach((name) => { 4199 scopeVariables[name] = item[name]; 4200 }); 4201 } else { 4202 scopeVariables[iteratorNames.item] = item; 4203 } 4204 if (iteratorNames.index) 4205 scopeVariables[iteratorNames.index] = index2; 4206 if (iteratorNames.collection) 4207 scopeVariables[iteratorNames.collection] = items; 4208 return scopeVariables; 4209 } 4210 function isNumeric3(subject) { 4211 return typeof subject !== "object" && !isNaN(subject); 4212 } 4213 function isObject22(subject) { 4214 return typeof subject === "object" && !Array.isArray(subject); 4215 } 4216 function handler3() { 4217 } 4218 handler3.inline = (el, { expression }, { cleanup: cleanup2 }) => { 4219 let root = closestRoot(el); 4220 if (!root) 4221 return; 4222 if (!root._x_refs) 4223 root._x_refs = {}; 4224 root._x_refs[expression] = el; 4225 cleanup2(() => delete root._x_refs[expression]); 4226 }; 4227 directive("ref", handler3); 4228 directive("if", (el, { expression }, { effect: effect3, cleanup: cleanup2 }) => { 4229 if (el.tagName.toLowerCase() !== "template") 4230 warn("x-if can only be used on a <template> tag", el); 4231 let evaluate22 = evaluateLater(el, expression); 4232 let show = () => { 4233 if (el._x_currentIfEl) 4234 return el._x_currentIfEl; 4235 let clone22 = el.content.cloneNode(true).firstElementChild; 4236 addScopeToNode(clone22, {}, el); 4237 mutateDom(() => { 4238 el.after(clone22); 4239 skipDuringClone(() => initTree(clone22))(); 4240 }); 4241 el._x_currentIfEl = clone22; 4242 el._x_undoIf = () => { 4243 mutateDom(() => { 4244 destroyTree(clone22); 4245 clone22.remove(); 4246 }); 4247 delete el._x_currentIfEl; 4248 }; 4249 return clone22; 4250 }; 4251 let hide = () => { 4252 if (!el._x_undoIf) 4253 return; 4254 el._x_undoIf(); 4255 delete el._x_undoIf; 4256 }; 4257 effect3(() => evaluate22((value) => { 4258 value ? show() : hide(); 4259 })); 4260 cleanup2(() => el._x_undoIf && el._x_undoIf()); 4261 }); 4262 directive("id", (el, { expression }, { evaluate: evaluate22 }) => { 4263 let names = evaluate22(expression); 4264 names.forEach((name) => setIdRoot(el, name)); 4265 }); 4266 interceptClone((from, to) => { 4267 if (from._x_ids) { 4268 to._x_ids = from._x_ids; 4269 } 4270 }); 4271 mapAttributes(startingWith("@", into(prefix("on:")))); 4272 directive("on", skipDuringClone((el, { value, modifiers, expression }, { cleanup: cleanup2 }) => { 4273 let evaluate22 = expression ? evaluateLater(el, expression) : () => { 4274 }; 4275 if (el.tagName.toLowerCase() === "template") { 4276 if (!el._x_forwardEvents) 4277 el._x_forwardEvents = []; 4278 if (!el._x_forwardEvents.includes(value)) 4279 el._x_forwardEvents.push(value); 4280 } 4281 let removeListener = on(el, value, modifiers, (e) => { 4282 evaluate22(() => { 4283 }, { scope: { "$event": e }, params: [e] }); 4284 }); 4285 cleanup2(() => removeListener()); 4286 })); 4287 warnMissingPluginDirective("Collapse", "collapse", "collapse"); 4288 warnMissingPluginDirective("Intersect", "intersect", "intersect"); 4289 warnMissingPluginDirective("Focus", "trap", "focus"); 4290 warnMissingPluginDirective("Mask", "mask", "mask"); 4291 function warnMissingPluginDirective(name, directiveName, slug) { 4292 directive(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); 4293 } 4294 alpine_default.setEvaluator(normalEvaluator); 4295 alpine_default.setRawEvaluator(normalRawEvaluator); 4296 alpine_default.setReactivityEngine({ reactive: reactive2, effect: effect2, release: stop, raw: toRaw }); 4297 var src_default = alpine_default; 4298 var module_default = src_default; 4299 4300
4300// js/features/supportEntangle.js 4301 function generateEntangleFunction(component, cleanup2) { 4302 if (!cleanup2) 4303 cleanup2 = () => { 4304 }; 4305 return (name, live = false) => { 4306 let isLive = live; 4307 let livewireProperty = name; 4308 let livewireComponent = component.$wire; 4309 let livewirePropertyValue = livewireComponent.get(livewireProperty); 4310 let interceptor2 = module_default.interceptor((initialValue, getter, setter, path, key) => { 4311 if (typeof livewirePropertyValue === "undefined") { 4312 console.error(`Livewire Entangle Error: Livewire property ['${livewireProperty}'] cannot be found on component: ['${component.name}']`); 4313 return; 4314 } 4315 let release2 = module_default.entangle({ 4316 get() { 4317 return livewireComponent.get(name); 4318 }, 4319 set(value) { 4320 livewireComponent.set(name, value, isLive); 4321 } 4322 }, { 4323 get() { 4324 return getter(); 4325 }, 4326 set(value) { 4327 setter(value); 4328 } 4329 }); 4330 cleanup2(() => release2()); 4331 return cloneIfObject2(livewireComponent.get(name)); 4332 }, (obj) => { 4333 Object.defineProperty(obj, "live", { 4334 get() { 4335 isLive = true; 4336 return obj; 4337 } 4338 }); 4339 }); 4340 return interceptor2(livewirePropertyValue); 4341 }; 4342 } 4343 function cloneIfObject2(value) { 4344 return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; 4345 } 4346 4347
4347// js/hooks.js 4348 var listeners = []; 4349 function on2(name, callback) { 4350 if (!listeners[name]) 4351 listeners[name] = []; 4352 listeners[name].push(callback); 4353 return () => { 4354 listeners[name] = listeners[name].filter((i) => i !== callback); 4355 }; 4356 } 4357 function trigger2(name, ...params) { 4358 let callbacks = listeners[name] || []; 4359 let finishers = []; 4360 for (let i = 0; i < callbacks.length; i++) { 4361 let finisher = callbacks[i](...params); 4362 if (isFunction(finisher)) 4363 finishers.push(finisher); 4364 } 4365 return (result) => { 4366 return runFinishers(finishers, result); 4367 }; 4368 } 4369 async function triggerAsync(name, ...params) { 4370 let callbacks = listeners[name] || []; 4371 let finishers = []; 4372 for (let i = 0; i < callbacks.length; i++) { 4373 let finisher = await callbacks[i](...params); 4374 if (isFunction(finisher)) 4375 finishers.push(finisher); 4376 } 4377 return (result) => { 4378 return runFinishers(finishers, result); 4379 }; 4380 } 4381 function runFinishers(finishers, result) { 4382 let latest = result; 4383 for (let i = 0; i < finishers.length; i++) { 4384 let iResult = finishers[i](latest); 4385 if (iResult !== void 0) { 4386 latest = iResult; 4387 } 4388 } 4389 return latest; 4390 } 4391 4392
4392// js/request/interactions.js 4393 function coordinateNetworkInteractions(messageBus2) { 4394 interceptPartition(({ message, compileRequest }) => { 4395 if (!message.component.isIsolated) 4396 return; 4397 compileRequest([message]); 4398 }); 4399 interceptPartition(({ message, compileRequest }) => { 4400 if (message.component.isLazy && !message.component.hasBeenLazyLoaded && message.component.isLazyIsolated) { 4401 compileRequest([message]); 4402 } 4403 }); 4404 interceptPartition(({ message, compileRequest }) => { 4405 let component = message.component; 4406 let bundledMessages = []; 4407 component.getDeepChildrenWithBindings((child) => { 4408 let action = constructAction(child, "$commit"); 4409 let message2 = createOrAddToOutstandingMessage(action); 4410 bundledMessages.push(message2); 4411 }); 4412 if (bundledMessages.length > 0) { 4413 compileRequest([message, ...bundledMessages]); 4414 } 4415 }); 4416 interceptAction(({ action }) => { 4417 let isRenderless = action?.origin?.directive?.modifiers.includes("renderless"); 4418 if (isRenderless) { 4419 action.metadata.renderless = true; 4420 } 4421 let message = messageBus2.activeMessageMatchingScope(action); 4422 if (message) { 4423 if (message.isAsync() || action.isAsync()) 4424 return; 4425 if (action.metadata.type === "poll") { 4426 return action.cancel(); 4427 } 4428 if (Array.from(message.actions).every((action2) => action2.metadata.type === "poll")) { 4429 return message.cancel(); 4430 } 4431 if (Array.from(message.actions).every((action2) => action2.metadata.type === "model.live")) { 4432 if (action.metadata.type === "model.live") { 4433 return; 4434 } 4435 } 4436 action.defer(); 4437 message.addInterceptor(({ onFinish }) => { 4438 onFinish(() => action.fire()); 4439 }); 4440 } 4441 }); 4442 } 4443 4444
4444// js/request/request.js 4445 var MessageRequest = class { 4446 messages = /* @__PURE__ */ new Set(); 4447 controller = new AbortController(); 4448 interceptors = []; 4449 cancelled = false; 4450 uri = null; 4451 payload = null; 4452 options = null; 4453 addMessage(message) { 4454 message.setRequest(this); 4455 this.messages.add(message); 4456 } 4457 getActiveMessages() { 4458 return new Set([...this.messages].filter((message) => !message.isCancelled())); 4459 } 4460 initInterceptors(interceptorRegistry) { 4461 this.interceptors = interceptorRegistry.getRequestInterceptors(this); 4462 this.messages.forEach((message) => { 4463 let messageInterceptors = interceptorRegistry.getMessageInterceptors(message); 4464 message.setInterceptors(messageInterceptors); 4465 }); 4466 this.interceptors.forEach((interceptor2) => interceptor2.init()); 4467 this.messages.forEach((message) => { 4468 message.getInterceptors().forEach((interceptor2) => interceptor2.init()); 4469 }); 4470 } 4471 cancel() { 4472 if (this.cancelled) 4473 return; 4474 this.cancelled = true; 4475 this.controller.abort(); 4476 this.messages.forEach((message) => { 4477 if (message.isCancelled()) 4478 return; 4479 message.cancel(); 4480 }); 4481 } 4482 hasAllCancelledMessages() { 4483 return this.getActiveMessages().size === 0; 4484 } 4485 isCancelled() { 4486 return this.cancelled; 4487 } 4488 invokeOnSend({ responsePromise }) { 4489 this.interceptors.forEach((interceptor2) => interceptor2.onSend({ responsePromise })); 4490 this.messages.forEach((message) => message.invokeOnSend()); 4491 } 4492 invokeOnCancel() { 4493 this.interceptors.forEach((interceptor2) => interceptor2.onCancel()); 4494 } 4495 invokeOnFailure({ error: error2 }) { 4496 this.interceptors.forEach((interceptor2) => interceptor2.onFailure({ error: error2 })); 4497 this.messages.forEach((message) => message.invokeOnFailure(error2)); 4498 } 4499 invokeOnResponse({ response }) { 4500 this.interceptors.forEach((interceptor2) => interceptor2.onResponse({ response })); 4501 } 4502 invokeOnStream({ response }) { 4503 this.interceptors.forEach((interceptor2) => interceptor2.onStream({ response })); 4504 } 4505 invokeOnParsed({ response, body }) { 4506 this.interceptors.forEach((interceptor2) => interceptor2.onParsed({ response, body })); 4507 } 4508 invokeOnRedirect({ url, preventDefault }) { 4509 this.interceptors.forEach((interceptor2) => interceptor2.onRedirect({ url, preventDefault })); 4510 } 4511 invokeOnDump({ html, preventDefault }) { 4512 this.interceptors.forEach((interceptor2) => interceptor2.onDump({ html, preventDefault })); 4513 } 4514 invokeOnError({ response, body, preventDefault }) { 4515 this.interceptors.forEach((interceptor2) => interceptor2.onError({ response, body, preventDefault })); 4516 this.messages.forEach((message) => message.invokeOnError({ response, body, preventDefault })); 4517 } 4518 invokeOnSuccess({ response, body, json }) { 4519 this.interceptors.forEach((interceptor2) => interceptor2.onSuccess({ response, body, json })); 4520 } 4521 invokeOnFinish() { 4522 this.interceptors.forEach((interceptor2) => interceptor2.onFinish()); 4523 } 4524 }; 4525 var PageRequest = class { 4526 controller = new AbortController(); 4527 constructor(uri) { 4528 this.uri = uri; 4529 } 4530 cancel() { 4531 this.controller.abort(); 4532 } 4533 isCancelled() { 4534 return this.controller.signal.aborted; 4535 } 4536 }; 4537 4538
4538// js/request/interceptor.js 4539 var MessageInterceptor = class { 4540 onSend = () => { 4541 }; 4542 onCancel = () => { 4543 }; 4544 onFailure = () => { 4545 }; 4546 onError = () => { 4547 }; 4548 onStream = () => { 4549 }; 4550 onSuccess = () => { 4551 }; 4552 onSkipped = () => { 4553 }; 4554 onFinish = () => { 4555 }; 4556 onSync = () => { 4557 }; 4558 onEffect = () => { 4559 }; 4560 onMorph = async () => { 4561 }; 4562 onRender = () => { 4563 }; 4564 constructor(message, callback) { 4565 this.message = message; 4566 this.callback = callback; 4567 this.callback({ 4568 message: this.message, 4569 cancel: () => { 4570 let attachedToMessage = this.message.getInterceptors().includes(this); 4571 if (!attachedToMessage) { 4572 this.onCancel(); 4573 } 4574 this.message.cancel(); 4575 }, 4576 onSend: (callback2) => this.onSend = callback2, 4577 onCancel: (callback2) => this.onCancel = callback2, 4578 onFailure: (callback2) => this.onFailure = callback2, 4579 onError: (callback2) => this.onError = callback2, 4580 onStream: (callback2) => this.onStream = callback2, 4581 onSuccess: (callback2) => this.onSuccess = callback2, 4582 onSkipped: (callback2) => this.onSkipped = callback2, 4583 onFinish: (callback2) => this.onFinish = callback2 4584 }); 4585 } 4586 init() { 4587 } 4588 }; 4589 var RequestInterceptor = class { 4590 onSend = () => { 4591 }; 4592 onCancel = () => { 4593 }; 4594 onFailure = () => { 4595 }; 4596 onResponse = () => { 4597 }; 4598 onParsed = () => { 4599 }; 4600 onError = () => { 4601 }; 4602 onStream = () => { 4603 }; 4604 onRedirect = () => { 4605 }; 4606 onDump = () => { 4607 }; 4608 onSuccess = () => { 4609 }; 4610 onFinish = () => { 4611 }; 4612 constructor(request, callback) { 4613 this.request = request; 4614 this.callback = callback; 4615 this.callback({ 4616 request: this.request, 4617 onSend: (callback2) => this.onSend = callback2, 4618 onCancel: (callback2) => this.onCancel = callback2, 4619 onFailure: (callback2) => this.onFailure = callback2, 4620 onResponse: (callback2) => this.onResponse = callback2, 4621 onParsed: (callback2) => this.onParsed = callback2, 4622 onError: (callback2) => this.onError = callback2, 4623 onStream: (callback2) => this.onStream = callback2, 4624 onRedirect: (callback2) => this.onRedirect = callback2, 4625 onDump: (callback2) => this.onDump = callback2, 4626 onSuccess: (callback2) => this.onSuccess = callback2, 4627 onFinish: (callback2) => this.onFinish = callback2 4628 }); 4629 } 4630 init() { 4631 } 4632 }; 4633 var InterceptorRegistry = class { 4634 messageInterceptorCallbacks = []; 4635 messageInterceptorCallbacksByComponent = new WeakBag(); 4636 requestInterceptorCallbacks = []; 4637 addInterceptor(component, callback) { 4638 this.messageInterceptorCallbacksByComponent.add(component, callback); 4639 return () => { 4640 this.messageInterceptorCallbacksByComponent.delete(component, callback); 4641 }; 4642 } 4643 addMessageInterceptor(callback) { 4644 this.messageInterceptorCallbacks.push(callback); 4645 return () => { 4646 this.messageInterceptorCallbacks.splice(this.messageInterceptorCallbacks.indexOf(callback), 1); 4647 }; 4648 } 4649 addRequestInterceptor(callback) { 4650 this.requestInterceptorCallbacks.push(callback); 4651 return () => { 4652 this.requestInterceptorCallbacks.splice(this.requestInterceptorCallbacks.indexOf(callback), 1); 4653 }; 4654 } 4655 getMessageInterceptors(message) { 4656 let callbacks = [ 4657 ...this.messageInterceptorCallbacksByComponent.get(message.component), 4658 ...this.messageInterceptorCallbacks 4659 ]; 4660 return callbacks.map((callback) => { 4661 return new MessageInterceptor(message, callback); 4662 }); 4663 } 4664 getRequestInterceptors(request) { 4665 return this.requestInterceptorCallbacks.map((callback) => { 4666 return new RequestInterceptor(request, callback); 4667 }); 4668 } 4669 }; 4670 4671
4671// js/utils/modal.js 4672 function showHtmlModal(html) { 4673 let page = document.createElement("html"); 4674 page.innerHTML = html; 4675 page.querySelectorAll("a").forEach( 4676 (a) => a.setAttribute("target", "_top") 4677 ); 4678 let modal = document.getElementById("livewire-error"); 4679 if (typeof modal != "undefined" && modal != null) { 4680 modal.innerHTML = ""; 4681 } else { 4682 modal = document.createElement("dialog"); 4683 modal.id = "livewire-error"; 4684 modal.style.margin = "50px"; 4685 modal.style.width = "calc(100% - 100px)"; 4686 modal.style.height = "calc(100% - 100px)"; 4687 modal.style.borderRadius = "5px"; 4688 modal.style.padding = "0px"; 4689 } 4690 let iframe = document.createElement("iframe"); 4691 iframe.style.backgroundColor = "#17161A"; 4692 iframe.style.borderRadius = "5px"; 4693 iframe.style.width = "100%"; 4694 iframe.style.height = "100%"; 4695 modal.appendChild(iframe); 4696 document.body.prepend(modal); 4697 document.body.style.overflow = "hidden"; 4698 iframe.contentWindow.document.open(); 4699 iframe.contentWindow.document.write(page.outerHTML); 4700 iframe.contentWindow.document.close(); 4701 modal.addEventListener("click", () => hideHtmlModal(modal)); 4702 modal.addEventListener("close", () => cleanupModal(modal)); 4703 modal.showModal(); 4704 modal.focus(); 4705 modal.blur(); 4706 } 4707 function hideHtmlModal(modal) { 4708 modal.close(); 4709 } 4710 function cleanupModal(modal) { 4711 modal.outerHTML = ""; 4712 document.body.style.overflow = "visible"; 4713 } 4714 4715
4715// js/request/messageBus.js 4716 var componentSymbols = /* @__PURE__ */ new WeakMap(); 4717 var componentIslandSymbols = /* @__PURE__ */ new WeakMap(); 4718 function scopeSymbolFromMessage(message) { 4719 let component = message.component; 4720 let hasAllIslands = Array.from(message.actions).every((action) => action.metadata.island); 4721 if (hasAllIslands) { 4722 let islandName = Array.from(message.actions).map((action) => action.metadata.island.name).sort().join("|"); 4723 let islandSymbols = componentIslandSymbols.get(component); 4724 if (!islandSymbols) { 4725 islandSymbols = { [islandName]: Symbol() }; 4726 componentIslandSymbols.set(component, islandSymbols); 4727 } 4728 if (!islandSymbols[islandName]) { 4729 islandSymbols[islandName] = Symbol(); 4730 } 4731 return islandSymbols[islandName]; 4732 } 4733 if (!componentSymbols.has(component)) { 4734 componentSymbols.set(component, Symbol()); 4735 } 4736 return componentSymbols.get(component); 4737 } 4738 function scopeSymbolFromAction(action) { 4739 let component = action.component; 4740 let isIsland = !!action.metadata.island; 4741 if (isIsland) { 4742 let islandName = action.metadata.island.name; 4743 let islandSymbols = componentIslandSymbols.get(component); 4744 if (!islandSymbols) { 4745 islandSymbols = { [islandName]: Symbol() }; 4746 componentIslandSymbols.set(component, islandSymbols); 4747 } 4748 if (!islandSymbols[islandName]) { 4749 islandSymbols[islandName] = Symbol(); 4750 } 4751 return islandSymbols[islandName]; 4752 } 4753 if (!componentSymbols.has(component)) { 4754 componentSymbols.set(component, Symbol()); 4755 } 4756 return componentSymbols.get(component); 4757 } 4758 var MessageBus = class { 4759 pendingMessages = /* @__PURE__ */ new Set(); 4760 activeMessages = /* @__PURE__ */ new Set(); 4761 bufferingMessages = /* @__PURE__ */ new Set(); 4762 constructor() { 4763 } 4764 messageBuffer(message, callback) { 4765 if (this.bufferingMessages.has(message)) { 4766 return; 4767 } 4768 this.bufferingMessages.add(message); 4769 setTimeout(() => { 4770 callback(); 4771 this.bufferingMessages.delete(message); 4772 }, 5); 4773 } 4774 addPendingMessage(message) { 4775 this.pendingMessages.add(message); 4776 } 4777 clearPendingMessages() { 4778 this.pendingMessages.clear(); 4779 } 4780 getPendingMessages() { 4781 return Array.from(this.pendingMessages); 4782 } 4783 addActiveMessage(message) { 4784 this.activeMessages.add(message); 4785 } 4786 removeActiveMessage(message) { 4787 this.activeMessages.delete(message); 4788 } 4789 findScopedPendingMessage(action) { 4790 if (action.isAsync()) 4791 return null; 4792 let actionScope = scopeSymbolFromAction(action); 4793 return Array.from(this.pendingMessages).find((message) => { 4794 if (message.component !== action.component) 4795 return false; 4796 return Array.from(message.actions).some( 4797 (existingAction) => scopeSymbolFromAction(existingAction) === actionScope 4798 ); 4799 }); 4800 } 4801 activeMessageMatchingScope(action) { 4802 return Array.from(this.activeMessages).find((message) => this.matchesScope(message, action)); 4803 } 4804 matchesScope(message, action) { 4805 return message.scope === scopeSymbolFromAction(action); 4806 } 4807 allScopedMessages(action) { 4808 return [...Array.from(this.activeMessages), ...Array.from(this.pendingMessages)].filter((message) => { 4809 return this.matchesScope(message, action); 4810 }); 4811 } 4812 eachPendingMessage(callback) { 4813 Array.from(this.pendingMessages).forEach(callback); 4814 } 4815 }; 4816 4817
4817// js/request/message.js 4818 var Message = class { 4819 actions = /* @__PURE__ */ new Set(); 4820 snapshot = null; 4821 updates = null; 4822 calls = null; 4823 payload = null; 4824 responsePayload = null; 4825 pendingReturns = []; 4826 pendingReturnsMeta = {}; 4827 interceptors = []; 4828 cancelled = false; 4829 skipped = false; 4830 request = null; 4831 _scope = null; 4832 get scope() { 4833 if (!this._scope) { 4834 throw new Error("Message scope has not been set yet"); 4835 } 4836 return this._scope; 4837 } 4838 set scope(scope2) { 4839 this._scope = scope2; 4840 } 4841 constructor(component) { 4842 this.component = component; 4843 } 4844 addAction(action) { 4845 let actionsByFingerprint = /* @__PURE__ */ new Map(); 4846 Array.from(this.actions).forEach((action2) => { 4847 actionsByFingerprint.set(action2.fingerprint, action2); 4848 }); 4849 if (actionsByFingerprint.has(action.fingerprint)) { 4850 actionsByFingerprint.get(action.fingerprint).addSquashedAction(action); 4851 return; 4852 } 4853 action.message = this; 4854 this.actions.add(action); 4855 } 4856 removeAction(action) { 4857 this.actions.delete(action); 4858 action.message = null; 4859 if (this.actions.size === 0) { 4860 this.cancel(); 4861 } 4862 } 4863 getActions() { 4864 return Array.from(this.actions); 4865 } 4866 hasActionForIsland(island) { 4867 return this.getActions().some((action) => { 4868 return action.metadata.island?.name === island.metadata.name; 4869 }); 4870 } 4871 hasActionForComponent() { 4872 return this.getActions().some((action) => { 4873 return action.metadata.island === void 0; 4874 }); 4875 } 4876 setInterceptors(interceptors3) { 4877 this.interceptors = interceptors3; 4878 } 4879 addInterceptor(callback) { 4880 let interceptor2 = new MessageInterceptor(this, callback); 4881 this.interceptors.push(interceptor2); 4882 interceptor2.init(); 4883 } 4884 setRequest(request) { 4885 this.request = request; 4886 } 4887 getInterceptors() { 4888 return this.interceptors; 4889 } 4890 cancel() { 4891 if (this.cancelled) 4892 return; 4893 this.cancelled = true; 4894 this.invokeOnCancel(); 4895 if (this.request?.hasAllCancelledMessages()) { 4896 this.request.cancel(); 4897 } 4898 } 4899 isCancelled() { 4900 return this.cancelled; 4901 } 4902 markSkipped() { 4903 this.skipped = true; 4904 } 4905 isSkipped() { 4906 return this.skipped; 4907 } 4908 isAsync() { 4909 return Array.from(this.actions).every((action) => action.isAsync()); 4910 } 4911 invokeOnSend() { 4912 this.interceptors.forEach((interceptor2) => interceptor2.onSend({ 4913 payload: this.payload 4914 })); 4915 Array.from(this.actions).forEach((action, index2) => { 4916 let call = this.calls[index2]; 4917 action.invokeOnSend({ call }); 4918 }); 4919 } 4920 invokeOnCancel() { 4921 this.interceptors.forEach((interceptor2) => interceptor2.onCancel()); 4922 this.rejectActionPromises({ status: null, body: null, json: null, errors: null }); 4923 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4924 this.invokeOnFinish(); 4925 } 4926 invokeOnFailure(error2) { 4927 this.interceptors.forEach((interceptor2) => interceptor2.onFailure({ error: error2 })); 4928 Array.from(this.actions).forEach((action) => action.invokeOnFailure({ error: error2 })); 4929 this.rejectActionPromises({ status: null, body: null, json: null, errors: null }); 4930 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4931 this.invokeOnFinish(); 4932 } 4933 invokeOnError({ response, body, preventDefault }) { 4934 this.interceptors.forEach((interceptor2) => interceptor2.onError({ 4935 response, 4936 body, 4937 preventDefault 4938 })); 4939 Array.from(this.actions).forEach((action) => action.invokeOnError({ response, body, preventDefault })); 4940 let json = null; 4941 try { 4942 json = JSON.parse(body); 4943 } catch (e) { 4944 } 4945 this.rejectActionPromises({ status: response.status, body, json, errors: null }); 4946 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4947 this.invokeOnFinish(); 4948 } 4949 invokeOnStream({ json }) {
4950 this.interceptors.forEach((interceptor2) => interceptor2.onStream({ json })); 4951 } 4952 invokeOnSuccess() { 4953 this.interceptors.forEach((interceptor2) => { 4954 interceptor2.onSuccess({ 4955 payload: this.responsePayload, 4956 onSync: (callback) => interceptor2.onSync = callback, 4957 onEffect: (callback) => interceptor2.onEffect = callback, 4958 onMorph: (callback) => interceptor2.onMorph = callback, 4959 onRender: (callback) => interceptor2.onRender = callback 4960 }); 4961 }); 4962 this.pendingReturns = this.responsePayload.effects["returns"] || []; 4963 this.pendingReturnsMeta = this.responsePayload.effects["returnsMeta"] || {}; 4964 } 4965 invokeOnSync() { 4966 this.interceptors.forEach((interceptor2) => interceptor2.onSync()); 4967 } 4968 invokeOnEffect() { 4969 this.interceptors.forEach((interceptor2) => interceptor2.onEffect()); 4970 } 4971 async invokeOnMorph() { 4972 await Promise.all( 4973 this.interceptors.map((interceptor2) => interceptor2.onMorph()) 4974 ); 4975 } 4976 invokeOnRender() { 4977 this.interceptors.forEach((interceptor2) => interceptor2.onRender()); 4978 } 4979 invokeOnFinish() { 4980 this.interceptors.forEach((interceptor2) => interceptor2.onFinish()); 4981 } 4982 invokeOnSkipped() { 4983 this.interceptors.forEach((interceptor2) => interceptor2.onSkipped()); 4984 Array.from(this.actions).forEach((action) => action.invokeOnFinish()); 4985 } 4986 rejectActionPromises({ status, body, json, errors }) { 4987 Array.from(this.actions).forEach((action) => { 4988 action.rejectPromise({ status, body, json, errors }); 4989 }); 4990 } 4991 resolveActionPromises(returns, returnsMeta) { 4992 let resolvedActions = /* @__PURE__ */ new Set(); 4993 returns.forEach((value, index2) => { 4994 let action = Array.from(this.actions)[index2]; 4995 if (!action) 4996 return; 4997 let meta = returnsMeta[index2]; 4998 if (meta?.errors) { 4999 action.rejectPromise({ status: 422, body: null, json: null, errors: meta.errors }); 5000 action.invokeOnFinish(); 5001 resolvedActions.add(action); 5002 return; 5003 } 5004 if (meta?.status) { 5005 action.rejectPromise({ status: meta.status, body: null, json: null, errors: null }); 5006 action.invokeOnFinish(); 5007 resolvedActions.add(action); 5008 return; 5009 } 5010 action.invokeOnSuccess(value); 5011 action.resolvePromise(value); 5012 action.invokeOnFinish(); 5013 resolvedActions.add(action); 5014 }); 5015 Array.from(this.actions).forEach((action) => { 5016 if (resolvedActions.has(action)) 5017 return; 5018 action.invokeOnSuccess(void 0); 5019 action.resolvePromise(); 5020 action.invokeOnFinish(); 5021 }); 5022 } 5023 }; 5024 5025
5025// js/request/action.js 5026 var Action = class { 5027 squashedActions = /* @__PURE__ */ new Set(); 5028 onSendCallbacks = []; 5029 onCancelCallbacks = []; 5030 onSuccessCallbacks = []; 5031 onErrorCallbacks = []; 5032 onFailureCallbacks = []; 5033 onFinishCallbacks = []; 5034 message = null; 5035 cancelled = false; 5036 deferred = false; 5037 _fire = null; 5038 constructor(component, name, params = [], metadata = {}, origin = null) { 5039 this.component = component; 5040 this.name = name; 5041 this.params = params; 5042 this.metadata = metadata; 5043 this.origin = origin; 5044 this.promise = new Promise((resolve, reject) => { 5045 this.promiseResolution = { resolve, reject }; 5046 }); 5047 this.promise._livewireAction = this; 5048 } 5049 cancel() { 5050 if (this.cancelled) 5051 return; 5052 this.cancelled = true; 5053 this.invokeOnCancel(); 5054 this.invokeOnFinish(); 5055 this.rejectPromise({ status: null, body: null, json: null, errors: null }); 5056 this.squashedActions.forEach((action) => action.cancel()); 5057 if (this.message) { 5058 this.message.removeAction(this); 5059 } 5060 } 5061 isCancelled() { 5062 return this.cancelled; 5063 } 5064 defer() { 5065 this.deferred = true; 5066 } 5067 isDeferred() { 5068 return this.deferred; 5069 } 5070 fire() { 5071 if (this._fire) { 5072 this._fire(this); 5073 } 5074 } 5075 get fingerprint() { 5076 let componentId = this.component.id; 5077 let name = this.name; 5078 let params = JSON.stringify(this.params); 5079 let metadata = JSON.stringify(this.metadata); 5080 let bytes = new TextEncoder().encode(componentId + name + params + metadata); 5081 let binary = ""; 5082 let chunkSize = 8192; 5083 for (let i = 0; i < bytes.length; i += chunkSize) { 5084 binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize)); 5085 } 5086 return window.btoa(binary); 5087 } 5088 isAsync() { 5089 let asyncMethods = this.component.snapshot.memo?.async || []; 5090 let methodIsMarkedAsync = asyncMethods.includes(this.name); 5091 let actionIsAsync = this.origin?.directive?.modifiers.includes("async") || !!this.metadata.async; 5092 return methodIsMarkedAsync || actionIsAsync; 5093 } 5094 isJson() { 5095 let jsonMethods = this.component.snapshot.memo?.json || []; 5096 return jsonMethods.includes(this.name); 5097 } 5098 addInterceptor(callback) { 5099 callback({ 5100 action: this, 5101 onSend: (cb) => this.onSendCallbacks.push(cb), 5102 onCancel: (cb) => this.onCancelCallbacks.push(cb), 5103 onSuccess: (cb) => this.onSuccessCallbacks.push(cb), 5104 onError: (cb) => this.onErrorCallbacks.push(cb), 5105 onFailure: (cb) => this.onFailureCallbacks.push(cb), 5106 onFinish: (cb) => this.onFinishCallbacks.push(cb) 5107 }); 5108 } 5109 invokeOnSend({ call }) { 5110 this.onSendCallbacks.forEach((cb) => cb({ call })); 5111 this.squashedActions.forEach((action) => action.invokeOnSend({ call })); 5112 } 5113 invokeOnCancel() { 5114 this.onCancelCallbacks.forEach((cb) => cb()); 5115 this.squashedActions.forEach((action) => action.invokeOnCancel()); 5116 } 5117 invokeOnSuccess(result) { 5118 this.onSuccessCallbacks.forEach((cb) => cb(result)); 5119 this.squashedActions.forEach((action) => action.invokeOnSuccess(result)); 5120 } 5121 invokeOnError({ response, body, preventDefault }) { 5122 this.onErrorCallbacks.forEach((cb) => cb({ response, body, preventDefault })); 5123 this.squashedActions.forEach((action) => action.invokeOnError({ response, body, preventDefault })); 5124 } 5125 invokeOnFailure({ error: error2 }) { 5126 this.onFailureCallbacks.forEach((cb) => cb({ error: error2 })); 5127 this.squashedActions.forEach((action) => action.invokeOnFailure({ error: error2 })); 5128 } 5129 invokeOnFinish() { 5130 this.onFinishCallbacks.forEach((cb) => cb()); 5131 this.squashedActions.forEach((action) => action.invokeOnFinish()); 5132 } 5133 mergeMetadata(metadata) { 5134 this.metadata = { ...this.metadata, ...metadata }; 5135 } 5136 rejectPromise(error2) { 5137 this.squashedActions.forEach((action) => action.rejectPromise(error2)); 5138 this.promiseResolution.reject(error2); 5139 } 5140 addSquashedAction(action) { 5141 this.squashedActions.add(action); 5142 } 5143 resolvePromise(value) { 5144 this.squashedActions.forEach((action) => action.resolvePromise(value)); 5145 this.promiseResolution.resolve(value); 5146 } 5147 }; 5148 5149
5149// js/request/legacy.js 5150 function registerLegacyEventSupport(interceptRequest2, interceptMessage2) { 5151 interceptRequest2(({ 5152 request, 5153 onFailure, 5154 onResponse, 5155 onError, 5156 onSuccess 5157 }) => { 5158 let respondCallbacks = []; 5159 let succeedCallbacks = []; 5160 let failCallbacks = []; 5161 trigger2("request", { 5162 url: request.uri, 5163 options: request.options, 5164 payload: request.options.body, 5165 respond: (i) => respondCallbacks.push(i), 5166 succeed: (i) => succeedCallbacks.push(i), 5167 fail: (i) => failCallbacks.push(i) 5168 }); 5169 onResponse(({ response }) => { 5170 respondCallbacks.forEach((callback) => callback({ 5171 status: response.status, 5172 response 5173 })); 5174 }); 5175 onSuccess(({ response, json }) => { 5176 succeedCallbacks.forEach((callback) => callback({ 5177 status: response.status, 5178 json 5179 })); 5180 }); 5181 onFailure(({ error: error2 }) => { 5182 failCallbacks.forEach((callback) => callback({ 5183 status: 503, 5184 content: null, 5185 preventDefault: () => { 5186 } 5187 })); 5188 }); 5189 onError(({ response, body, preventDefault }) => { 5190 failCallbacks.forEach((callback) => callback({ 5191 status: response.status, 5192 content: body, 5193 preventDefault 5194 })); 5195 }); 5196 }); 5197 interceptMessage2(({ 5198 message, 5199 onCancel, 5200 onError, 5201 onSuccess, 5202 onFinish 5203 }) => { 5204 let respondCallbacks = []; 5205 let succeedCallbacks = []; 5206 let failCallbacks = []; 5207 trigger2("commit", { 5208 component: message.component, 5209 commit: message.payload, 5210 respond: (callback) => { 5211 respondCallbacks.push(callback); 5212 }, 5213 succeed: (callback) => { 5214 succeedCallbacks.push(callback); 5215 }, 5216 fail: (callback) => { 5217 failCallbacks.push(callback); 5218 } 5219 }); 5220 onFinish(() => { 5221 respondCallbacks.forEach((callback) => callback()); 5222 }); 5223 onSuccess(({ payload, onSync, onMorph, onRender }) => { 5224 onRender(() => { 5225 succeedCallbacks.forEach((callback) => callback({ 5226 snapshot: payload.snapshot, 5227 effects: payload.effects 5228 })); 5229 }); 5230 }); 5231 onError(() => { 5232 failCallbacks.forEach((callback) => callback()); 5233 }); 5234 onCancel(() => { 5235 failCallbacks.forEach((callback) => callback()); 5236 }); 5237 }); 5238 } 5239 5240
5240// js/request/index.js 5241 var outstandingActionOrigin = null; 5242 var outstandingActionMetadata = {}; 5243 var outstandingActionInterceptors = []; 5244 var interceptors2 = new InterceptorRegistry(); 5245 var messageBus = new MessageBus(); 5246 var actionInterceptors = []; 5247 var partitionInterceptors = []; 5248 var sessionExpired = false; 5249 function sessionIsExpired() { 5250 return sessionExpired; 5251 } 5252 function setNextActionOrigin(origin) { 5253 outstandingActionOrigin = origin; 5254 } 5255 function setNextActionMetadata(metadata) { 5256 outstandingActionMetadata = metadata; 5257 } 5258 function setNextActionInterceptor(callback) { 5259 outstandingActionInterceptors.push(callback); 5260 } 5261 function interceptAction(callback) { 5262 actionInterceptors.push(callback); 5263 return () => { 5264 actionInterceptors.splice(actionInterceptors.indexOf(callback), 1); 5265 }; 5266 } 5267 function interceptMessage(callback) { 5268 return interceptors2.addMessageInterceptor(callback); 5269 } 5270 function interceptRequest(callback) { 5271 return interceptors2.addRequestInterceptor(callback); 5272 } 5273 function interceptPartition(callback) { 5274 partitionInterceptors.push(callback); 5275 return () => { 5276 partitionInterceptors.splice(partitionInterceptors.indexOf(callback), 1); 5277 }; 5278 } 5279 function interceptComponentAction(component, actionNameOrCallback, maybeCallback) { 5280 let actionName = typeof actionNameOrCallback === "string" ? actionNameOrCallback : null; 5281 let callback = actionName ? maybeCallback : actionNameOrCallback; 5282 return interceptAction(({ action, ...rest }) => { 5283 if (action.component !== component) 5284 return; 5285 if (actionName && action.name !== actionName) 5286 return; 5287 callback({ action, ...rest }); 5288 }); 5289 } 5290 function interceptComponentMessage(component, actionNameOrCallback, maybeCallback) { 5291 let actionName = typeof actionNameOrCallback === "string" ? actionNameOrCallback : null; 5292 let callback = actionName ? maybeCallback : actionNameOrCallback; 5293 return interceptors2.addInterceptor(component, ({ message, ...rest }) => { 5294 if (actionName) { 5295 let hasAction = Array.from(message.actions).some((a) => a.name === actionName); 5296 if (!hasAction) 5297 return; 5298 } 5299 callback({ message, ...rest }); 5300 }); 5301 } 5302 function interceptComponentRequest(component, actionNameOrCallback, maybeCallback) { 5303 let actionName = typeof actionNameOrCallback === "string" ? actionNameOrCallback : null; 5304 let callback = actionName ? maybeCallback : actionNameOrCallback; 5305 return interceptRequest(({ request, ...rest }) => { 5306 let matchingMessages = Array.from(request.messages).filter((m) => { 5307 if (m.component !== component) 5308 return false; 5309 if (actionName) { 5310 return Array.from(m.actions).some((a) => a.name === actionName); 5311 } 5312 return true; 5313 }); 5314 if (matchingMessages.length === 0) 5315 return; 5316 callback({ request, ...rest }); 5317 }); 5318 } 5319 interceptMessage(({ message, onFinish }) => { 5320 messageBus.addActiveMessage(message); 5321 onFinish(() => messageBus.removeActiveMessage(message)); 5322 }); 5323 queueMicrotask(() => { 5324 coordinateNetworkInteractions(messageBus); 5325 }); 5326 function fireAction(component, method, params = [], metadata = {}) { 5327 if (component.__isWireProxy) 5328 component = component.__instance; 5329 let action = constructAction(component, method, params, metadata); 5330 actionInterceptors.forEach((callback) => { 5331 callback({ 5332 action, 5333 onSend: (cb) => action.onSendCallbacks.push(cb), 5334 onCancel: (cb) => action.onCancelCallbacks.push(cb), 5335 onSuccess: (cb) => action.onSuccessCallbacks.push(cb), 5336 onError: (cb) => action.onErrorCallbacks.push(cb), 5337 onFailure: (cb) => action.onFailureCallbacks.push(cb), 5338 onFinish: (cb) => action.onFinishCallbacks.push(cb) 5339 }); 5340 }); 5341 if (action.isCancelled() || action.isDeferred()) 5342 return action.promise; 5343 return fireActionInstance(action); 5344 } 5345 function constructAction(component, method, params, metadata) { 5346 let origin = outstandingActionOrigin; 5347 let pendingInterceptors = outstandingActionInterceptors; 5348 outstandingActionOrigin = null; 5349 outstandingActionInterceptors = []; 5350 metadata = { 5351 ...metadata, 5352 ...outstandingActionMetadata 5353 }; 5354 outstandingActionMetadata = {}; 5355 let action = new Action(component, method, params, metadata, origin); 5356 action._fire = fireActionInstance;
5357 pendingInterceptors.forEach((callback) => action.addInterceptor(callback)); 5358 return action; 5359 } 5360 function fireActionInstance(action) { 5361 let message = createOrAddToOutstandingMessage(action); 5362 messageBus.messageBuffer(message, () => { 5363 sendMessages(); 5364 }); 5365 return action.promise; 5366 } 5367 function createOrAddToOutstandingMessage(action) { 5368 let message = messageBus.findScopedPendingMessage(action); 5369 if (!message) 5370 message = new Message(action.component); 5371 message.addAction(action); 5372 messageBus.addPendingMessage(message); 5373 return message; 5374 } 5375 function sendMessages() { 5376 let requests = /* @__PURE__ */ new Set(); 5377 messageBus.eachPendingMessage((message) => { 5378 partitionInterceptors.forEach((callback) => { 5379 callback({ 5380 message, 5381 compileRequest: (messages2) => { 5382 let existingRequest = Array.from(requests).find( 5383 (request2) => messages2.some((message2) => request2.messages.has(message2)) 5384 ); 5385 if (existingRequest) { 5386 messages2.forEach((message2) => { 5387 if (!existingRequest.messages.has(message2)) { 5388 existingRequest.addMessage(message2); 5389 } 5390 }); 5391 return existingRequest; 5392 } 5393 let request = new MessageRequest(); 5394 messages2.forEach((message2) => request.addMessage(message2)); 5395 requests.add(request); 5396 return request; 5397 } 5398 }); 5399 }); 5400 }); 5401 let messages = messageBus.getPendingMessages(); 5402 messageBus.clearPendingMessages(); 5403 for (let message of messages) { 5404 if (Array.from(requests).some((request) => request.messages.has(message))) { 5405 continue; 5406 } 5407 let hasFoundRequest = false; 5408 requests.forEach((request) => { 5409 if (!hasFoundRequest) { 5410 let hasMessageForSameComponent = Array.from(request.messages).some((m) => m.component === message.component); 5411 if (hasMessageForSameComponent) 5412 return; 5413 request.addMessage(message);
5414 hasFoundRequest = true; 5415 } 5416 }); 5417 if (!hasFoundRequest) { 5418 let request = new MessageRequest(); 5419 request.addMessage(message); 5420 requests.add(request); 5421 } 5422 } 5423 requests.forEach((request) => { 5424 request.messages.forEach((message) => { 5425 message.snapshot = message.component.getEncodedSnapshotWithLatestChildrenMergedIn(); 5426 message.updates = message.component.getUpdates(); 5427 message.calls = Array.from(message.actions).map((i) => ({ 5428 method: i.name, 5429 params: i.params, 5430 metadata: i.metadata 5431 })); 5432 message.payload = { 5433 snapshot: message.snapshot, 5434 updates: message.updates, 5435 calls: message.calls 5436 }; 5437 }); 5438 }); 5439 requests.forEach((request) => { 5440 request.messages.forEach((message) => { 5441 message.scope = scopeSymbolFromMessage(message); 5442 }); 5443 }); 5444 requests.forEach((request) => { 5445 request.uri = getUpdateUri(); 5446 Object.defineProperty(request, "payload", { 5447 get() { 5448 return { 5449 _token: getCsrfToken(), 5450 components: Array.from(request.messages, (i) => i.payload) 5451 }; 5452 } 5453 }); 5454 let cachedOptions = null; 5455 Object.defineProperty(request, "options", { 5456 get() { 5457 if (cachedOptions) 5458 return cachedOptions; 5459 cachedOptions = { 5460 method: "POST", 5461 body: JSON.stringify(request.payload), 5462 headers: { 5463 "Content-type": "application/json", 5464 "X-Livewire": "1" 5465 }, 5466 signal: request.controller.signal 5467 }; 5468 return cachedOptions; 5469 } 5470 }); 5471 }); 5472 requests.forEach((request) => { 5473 request.initInterceptors(interceptors2); 5474 if (request.hasAllCancelledMessages()) { 5475 request.cancel(); 5476 } 5477 sendRequest(request, { 5478 send: ({ responsePromise }) => { 5479 request.invokeOnSend({ responsePromise }); 5480 }, 5481 failure: ({ error: error2 }) => { 5482 request.invokeOnFailure({ error: error2 }); 5483 }, 5484 finish: () => { 5485 request.invokeOnFinish(); 5486 }, 5487 response: ({ response }) => { 5488 request.invokeOnResponse({ response }); 5489 }, 5490 stream: async ({ response }) => { 5491 request.invokeOnStream({ response }); 5492 let finalResponse = ""; 5493 try { 5494 finalResponse = await interceptStreamAndReturnFinalResponse(response, (json) => { 5495 let componentId = json.id; 5496 request.messages.forEach((message) => { 5497 if (message.component.id === componentId) { 5498 message.invokeOnStream({ json }); 5499 } 5500 }); 5501 trigger2("stream", json); 5502 }); 5503 } catch (e) { 5504 request.cancel(); 5505 throw e; 5506 } 5507 return finalResponse; 5508 }, 5509 parsed: ({ response, responseBody }) => { 5510 request.invokeOnParsed({ response, body: responseBody }); 5511 }, 5512 error: ({ response, responseBody }) => { 5513 let preventDefault = false;
5514 request.invokeOnError({ response, body: responseBody, preventDefault: () => preventDefault = true }); 5515 if (preventDefault) 5516 return; 5517 if (response.status === 419) { 5518 if (sessionExpired) 5519 return; 5520 sessionExpired = true; 5521 confirm( 5522 "This page has expired.\nWould you like to refresh the page?" 5523 ) && window.location.reload(); 5524 return; 5525 } 5526 if (response.aborted) 5527 return; 5528 showHtmlModal(responseBody); 5529 }, 5530 redirect: (url) => { 5531 let preventDefault = false; 5532 request.invokeOnRedirect({ url, preventDefault: () => preventDefault = true }); 5533 if (preventDefault) 5534 return; 5535 window.location.href = url; 5536 }, 5537 dump: (html) => { 5538 let preventDefault = false; 5539 request.invokeOnDump({ html, preventDefault: () => preventDefault = true }); 5540 if (preventDefault) 5541 return; 5542 showHtmlModal(html); 5543 }, 5544 success: async ({ response, responseBody, responseJson }) => { 5545 request.invokeOnSuccess({ response, body: responseBody, json: responseJson }); 5546 await triggerAsync("payload.intercept", responseJson); 5547 let messageResponsePayloads = responseJson.components; 5548 request.messages.forEach((message) => { 5549 messageResponsePayloads.forEach((payload) => { 5550 if (message.isCancelled()) 5551 return; 5552 if (payload.skip) { 5553 if (payload.id === message.component.id) { 5554 message.responsePayload = payload; 5555 message.markSkipped(); 5556 message.invokeOnSkipped(); 5557 message.resolveActionPromises([], []); 5558 message.invokeOnFinish(); 5559 } 5560 return; 5561 } 5562 let { snapshot: snapshotEncoded, effects } = payload; 5563 let snapshot = JSON.parse(snapshotEncoded); 5564 if (snapshot.memo.id === message.component.id) { 5565 message.responsePayload = { snapshot, effects }; 5566 message.invokeOnSuccess(); 5567 if (message.isCancelled()) 5568 return; 5569 Alpine.transaction(async () => { 5570 message.component.mergeNewSnapshot(snapshotEncoded, effects, message.updates); 5571 message.invokeOnSync(); 5572 if (message.isCancelled()) 5573 return; 5574 message.component.processEffects(effects, request); 5575 message.invokeOnEffect(); 5576 if (message.isCancelled()) 5577 return; 5578 await message.invokeOnMorph(); 5579 }).then(() => { 5580 if (!message.isCancelled()) { 5581 message.resolveActionPromises( 5582 message.pendingReturns, 5583 message.pendingReturnsMeta 5584 ); 5585 message.invokeOnFinish(); 5586 } 5587 requestAnimationFrame(() => { 5588 if (message.isCancelled()) 5589 return; 5590 message.invokeOnRender(); 5591 }); 5592 }); 5593 } 5594 }); 5595 }); 5596 } 5597 }); 5598 }); 5599 } 5600 async function sendRequest(request, handlers) { 5601 let response; 5602 try { 5603 if (request.isCancelled()) 5604 return; 5605 let responsePromise = fetch(request.uri, request.options); 5606 if (request.isCancelled()) 5607 return; 5608 handlers.send({ responsePromise }); 5609 response = await responsePromise; 5610 } catch (e) { 5611 if (request.isCancelled()) 5612 return; 5613 handlers.failure({ error: e }); 5614 handlers.finish(); 5615 return; 5616 } 5617 handlers.response({ response }); 5618 let responseBody = null; 5619 if (response.headers.has("X-Livewire-Stream")) { 5620 responseBody = await handlers.stream({ response }); 5621 } else { 5622 responseBody = await response.text(); 5623 } 5624 if (request.isCancelled()) 5625 return; 5626 handlers.parsed({ response, responseBody }); 5627 if (!response.ok) { 5628 handlers.error({ response, responseBody }); 5629 handlers.finish(); 5630 return; 5631 } 5632 if (response.redirected) { 5633 handlers.redirect(response.url); 5634 } 5635 if (contentIsFromDump(responseBody)) { 5636 let dump; 5637 [dump, responseBody] = splitDumpFromContent(responseBody); 5638 handlers.dump(dump); 5639 } 5640 let responseJson = null; 5641 try { 5642 responseJson = JSON.parse(responseBody); 5643 } catch (e) { 5644 console.error(e); 5645 handlers.error({ response, responseBody }); 5646 handlers.finish(); 5647 return; 5648 } 5649 handlers.success({ response, responseBody, responseJson }); 5650 handlers.finish(); 5651 } 5652 async function interceptStreamAndReturnFinalResponse(response, callback) { 5653 let reader = response.body.getReader(); 5654 let remainingResponse = ""; 5655 while (true) { 5656 let { done, value: chunk } = await reader.read(); 5657 let decoder = new TextDecoder(); 5658 let output = decoder.decode(chunk); 5659 let [streams, remaining] = extractStreamObjects(remainingResponse + output);
5660 streams.forEach((stream) => { 5661 callback(stream); 5662 }); 5663 remainingResponse = remaining; 5664 if (done) 5665 return remainingResponse; 5666 } 5667 } 5668 function extractStreamObjects(raw2) { 5669 let regex = /({"stream":true.*?"endStream":true})/g; 5670 let matches3 = raw2.match(regex); 5671 let parsed = []; 5672 if (matches3) { 5673 for (let i = 0; i < matches3.length; i++) { 5674 parsed.push(JSON.parse(matches3[i]).body); 5675 } 5676 } 5677 let remaining = raw2.replace(regex, ""); 5678 return [parsed, remaining]; 5679 } 5680 async function sendNavigateRequest(uri, callback, errorCallback) { 5681 let request = new PageRequest(uri); 5682 let options = { 5683 headers: { 5684 "X-Livewire-Navigate": "1" 5685 }, 5686 signal: request.controller.signal 5687 }; 5688 trigger2("navigate.request", { 5689 uri, 5690 options 5691 }); 5692 let response; 5693 try { 5694 response = await fetch(uri, options); 5695 let destination = getDestination(uri, response); 5696 let html = await response.text(); 5697 let status = response.status; 5698 callback(html, destination, status); 5699 } catch (error2) { 5700 errorCallback(error2); 5701 throw error2; 5702 } 5703 } 5704 function getDestination(uri, response) { 5705 let destination = createUrlObjectFromString(uri); 5706 let finalDestination = createUrlObjectFromString(response.url); 5707 if (destination.pathname + destination.search === finalDestination.pathname + finalDestination.search) { 5708 finalDestination.hash = destination.hash; 5709 } 5710 return finalDestination; 5711 } 5712 function createUrlObjectFromString(urlString) { 5713 return urlString !== null && new URL(urlString, document.baseURI); 5714 } 5715 registerLegacyEventSupport(interceptRequest, interceptMessage); 5716 5717
5717// js/features/supportErrors.js 5718 function getErrorsObject(component) { 5719 let state = component.__errorsState ??= module_default.reactive({ 5720 clientErrors: null 5721 }); 5722 component.__lastErrorsSnapshot ??= component.snapshot; 5723 return { 5724 messages() { 5725 if (component.__lastErrorsSnapshot !== component.snapshot) { 5726 state.clientErrors = null; 5727 component.__lastErrorsSnapshot = component.snapshot; 5728 } 5729 return state.clientErrors ??= component.snapshot.memo.errors; 5730 }, 5731 keys() { 5732 return Object.keys(this.messages()); 5733 }, 5734 has(...keys) { 5735 if (this.isEmpty()) 5736 return false; 5737 if (keys.length === 0 || keys.length === 1 && keys[0] == null) 5738 return this.any(); 5739 if (keys.length === 1 && Array.isArray(keys[0])) 5740 keys = keys[0]; 5741 for (let key of keys) { 5742 if (this.first(key) === "") 5743 return false; 5744 } 5745 return true; 5746 }, 5747 hasAny(keys) { 5748 if (this.isEmpty()) 5749 return false; 5750 if (keys.length === 1 && Array.isArray(keys[0])) 5751 keys = keys[0]; 5752 for (let key of keys) { 5753 if (this.has(key)) 5754 return true; 5755 } 5756 return false; 5757 }, 5758 missing(...keys) { 5759 if (keys.length === 1 && Array.isArray(keys[0])) 5760 keys = keys[0]; 5761 return !this.hasAny(keys); 5762 }, 5763 first(key = null) { 5764 let messages = key === null ? this.all() : this.get(key); 5765 let firstMessage = messages.length > 0 ? messages[0] : ""; 5766 return Array.isArray(firstMessage) ? firstMessage[0] : firstMessage; 5767 }, 5768 get(key) { 5769 return this.messages()[key] || []; 5770 }, 5771 all() { 5772 return Object.values(this.messages()).flat(); 5773 }, 5774 isEmpty() { 5775 return !this.any(); 5776 }, 5777 isNotEmpty() { 5778 return this.any(); 5779 }, 5780 any() { 5781 return Object.keys(this.messages()).length > 0; 5782 }, 5783 count() { 5784 return Object.values(this.messages()).reduce((total, array) => { 5785 return total + array.length; 5786 }, 0); 5787 }, 5788 clear(field = null) { 5789 if (field === null) { 5790 state.clientErrors = {}; 5791 } else { 5792 let errors = { ...state.clientErrors ?? component.snapshot.memo.errors }; 5793 delete errors[field]; 5794 state.clientErrors = errors; 5795 } 5796 } 5797 }; 5798 } 5799 5800
5800// js/features/supportRefs.js 5801 function findRefEl(component, name) { 5802 let refEl = component.el.querySelector(`[wire\\:ref="${name}"]`); 5803 if (!refEl) 5804 return console.error(`Ref "${name}" not found in component "${component.id}"`); 5805 return refEl; 5806 } 5807 5808
5808// js/directives.js 5809 var customDirectiveNames = /* @__PURE__ */ new Set(); 5810 function matchesForLivewireDirective(attributeName) { 5811 return attributeName.match(new RegExp("wire:")); 5812 } 5813 function extractDirective(el, name) { 5814 let [value, ...modifiers] = name.replace(new RegExp("wire:"), "").split("."); 5815 return new Directive(value, modifiers, name, el); 5816 } 5817 function directive2(name, callback) { 5818 if (customDirectiveNames.has(name)) 5819 return; 5820 customDirectiveNames.add(name); 5821 on2("directive.init", ({ el, component, directive: directive3, cleanup: cleanup2 }) => { 5822 if (directive3.value === name) { 5823 callback({ 5824 el, 5825 directive: directive3, 5826 component, 5827 $wire: component.$wire, 5828 cleanup: cleanup2 5829 }); 5830 } 5831 }); 5832 } 5833 function globalDirective(name, callback) { 5834 if (customDirectiveNames.has(name)) 5835 return; 5836 customDirectiveNames.add(name); 5837 on2("directive.global.init", ({ el, directive: directive3, cleanup: cleanup2 }) => { 5838 if (directive3.value === name) { 5839 callback({ el, directive: directive3, cleanup: cleanup2 }); 5840 } 5841 }); 5842 } 5843 function getDirectives(el) { 5844 return new DirectiveManager(el); 5845 } 5846 function customDirectiveHasBeenRegistered(name) { 5847 return customDirectiveNames.has(name); 5848 } 5849 var DirectiveManager = class { 5850 constructor(el) { 5851 this.el = el; 5852 this.directives = this.extractTypeModifiersAndValue(); 5853 } 5854 all() { 5855 return this.directives; 5856 } 5857 has(value) { 5858 return this.directives.map((directive3) => directive3.value).includes(value); 5859 } 5860 missing(value) { 5861 return !this.has(value); 5862 } 5863 get(value) { 5864 return this.directives.find((directive3) => directive3.value === value); 5865 } 5866 extractTypeModifiersAndValue() { 5867 return Array.from(this.el.getAttributeNames().filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(this.el, name))); 5868 } 5869 }; 5870 var Directive = class { 5871 constructor(value, modifiers, rawName, el) { 5872 this.rawName = this.raw = rawName; 5873 this.el = el; 5874 this.eventContext; 5875 this.wire; 5876 this.value = value; 5877 this.modifiers = modifiers; 5878 this.expression = this.el.getAttribute(this.rawName); 5879 } 5880 get method() { 5881 const methods = this.parseOutMethodsAndParams(this.expression); 5882 return methods[0].method; 5883 } 5884 get methods() { 5885 return this.parseOutMethodsAndParams(this.expression); 5886 } 5887 get params() { 5888 const methods = this.parseOutMethodsAndParams(this.expression); 5889 return methods[0].params; 5890 } 5891 parseOutMethodsAndParams(rawMethod) { 5892 let methods = []; 5893 let parsedMethods = this.splitAndParseMethods(rawMethod); 5894 for (let { method, paramString } of parsedMethods) { 5895 let params = []; 5896 if (paramString.length > 0) { 5897 let argumentsToArray = function() { 5898 for (var l = arguments.length, p = new Array(l), k = 0; k < l; k++) { 5899 p[k] = arguments[k]; 5900 } 5901 return [].concat(p); 5902 }; 5903 try { 5904 params = Alpine.evaluate( 5905 document, 5906 "argumentsToArray(" + paramString + ")", 5907 { 5908 scope: { argumentsToArray } 5909 } 5910 ); 5911 } catch (error2) { 5912 console.warn("Failed to parse parameters:", paramString, error2); 5913 params = []; 5914 } 5915 } 5916 methods.push({ method, params }); 5917 } 5918 return methods; 5919 } 5920 splitAndParseMethods(methodExpression) { 5921 let methods = []; 5922 let current = ""; 5923 let parenCount = 0; 5924 let inString = false; 5925 let stringChar = null; 5926 let trimmedExpression = methodExpression.trim(); 5927 for (let i = 0; i < trimmedExpression.length; i++) { 5928 let char = trimmedExpression[i]; 5929 if (!inString) { 5930 if (char === '"' || char === "'") { 5931 inString = true; 5932 stringChar = char; 5933 current += char; 5934 } else if (char === "(") { 5935 parenCount++; 5936 current += char; 5937 } else if (char === ")") { 5938 parenCount--; 5939 current += char; 5940 } else if (char === "," && parenCount === 0) { 5941 methods.push(this.parseMethodCall(current.trim())); 5942 current = ""; 5943 } else { 5944 current += char; 5945 } 5946 } else { 5947 if (char === stringChar && trimmedExpression[i - 1] !== "\\") { 5948 inString = false;
5949 stringChar = null; 5950 } 5951 current += char; 5952 } 5953 } 5954 if (current.trim().length > 0) { 5955 methods.push(this.parseMethodCall(current.trim())); 5956 } 5957 return methods; 5958 } 5959 parseMethodCall(methodString) { 5960 let methodMatch = methodString.match(/^([^(]+)\(/); 5961 if (!methodMatch) { 5962 return { 5963 method: methodString.trim(), 5964 paramString: "" 5965 }; 5966 } 5967 let method = methodMatch[1].trim(); 5968 let paramStart = methodMatch[0].length - 1; 5969 let lastParenIndex = methodString.lastIndexOf(")"); 5970 if (lastParenIndex === -1) { 5971 throw new Error(`Missing closing parenthesis for method "${method}"`); 5972 } 5973 let paramString = methodString.slice(paramStart + 1, lastParenIndex).trim(); 5974 return { 5975 method, 5976 paramString 5977 }; 5978 } 5979 }; 5980 5981
5981// js/directives/shared.js 5982 function toggleBooleanStateDirective(el, directive3, isTruthy, cachedDisplay = null) { 5983 isTruthy = directive3.modifiers.includes("remove") ? !isTruthy : isTruthy; 5984 if (directive3.modifiers.includes("class")) { 5985 let classes = directive3.expression.split(" ").filter(String); 5986 if (isTruthy) { 5987 el.classList.add(...classes); 5988 } else { 5989 el.classList.remove(...classes); 5990 } 5991 } else if (directive3.modifiers.includes("attr")) { 5992 if (isTruthy) { 5993 el.setAttribute(directive3.expression, true); 5994 } else { 5995 el.removeAttribute(directive3.expression); 5996 } 5997 } else { 5998 let cache = cachedDisplay ?? window.getComputedStyle(el, null).getPropertyValue("display"); 5999 let display = ["inline", "list-item", "block", "table", "flex", "grid", "inline-flex"].filter((i) => directive3.modifiers.includes(i))[0] || "inline-block"; 6000 display = directive3.modifiers.includes("remove") && !isTruthy ? cache : display; 6001 el.style.display = isTruthy ? display : "none"; 6002 } 6003 } 6004 6005
6005// js/directives/wire-dirty.js 6006 var refreshDirtyStatesByComponent = new WeakBag(); 6007 on2("commit", ({ component, succeed }) => { 6008 succeed(() => { 6009 setTimeout(() => { 6010 refreshDirtyStatesByComponent.each(component, (i) => i(false)); 6011 }); 6012 }); 6013 }); 6014 directive2("dirty", ({ el, directive: directive3, component }) => { 6015 let targets = dirtyTargets(el); 6016 let oldIsDirty = false; 6017 let initialDisplay = el.style.display; 6018 let refreshDirtyState = (isDirty) => { 6019 toggleBooleanStateDirective(el, directive3, isDirty, initialDisplay); 6020 oldIsDirty = isDirty; 6021 }; 6022 refreshDirtyStatesByComponent.add(component, refreshDirtyState); 6023 Alpine.effect(() => { 6024 let isDirty = false; 6025 isDirty = checkDirty(component, targets.length === 0 ? void 0 : targets); 6026 if (oldIsDirty !== isDirty) { 6027 refreshDirtyState(isDirty); 6028 } 6029 oldIsDirty = isDirty; 6030 }); 6031 }); 6032 function checkDirty(component, targets) { 6033 let isDirty = false; 6034 if (targets === void 0) { 6035 isDirty = JSON.stringify(component.canonical) !== JSON.stringify(component.reactive); 6036 } else if (Array.isArray(targets)) { 6037 for (let i = 0; i < targets.length; i++) { 6038 if (isDirty) 6039 break; 6040 let target = targets[i]; 6041 isDirty = JSON.stringify(dataGet(component.canonical, target)) !== JSON.stringify(dataGet(component.reactive, target)); 6042 } 6043 } else { 6044 isDirty = JSON.stringify(dataGet(component.canonical, targets)) !== JSON.stringify(dataGet(component.reactive, targets)); 6045 } 6046 return isDirty; 6047 } 6048 function dirtyTargets(el) { 6049 let directives2 = getDirectives(el); 6050 let targets = []; 6051 if (directives2.has("model")) { 6052 targets.push(directives2.get("model").expression); 6053 } 6054 if (directives2.has("target")) { 6055 targets = targets.concat( 6056 directives2.get("target").expression.split(",").map((s) => s.trim()) 6057 ); 6058 } 6059 return targets; 6060 } 6061 6062
6062// js/features/supportJsModules.js 6063 var pendingComponentAssets = /* @__PURE__ */ new WeakMap(); 6064 on2("effect", ({ component, effects }) => { 6065 let scriptModuleHash = effects.scriptModule; 6066 if (scriptModuleHash) { 6067 let encodedName = component.name.replace(/\./g, "--").replace(/::/g, "---").replace(/:/g, "----"); 6068 let path = `${getModuleUrl()}/js/${encodedName}.js?v=${scriptModuleHash}`; 6069 pendingComponentAssets.set(component, Alpine.reactive({ 6070 loading: true, 6071 afterLoaded: [] 6072 })); 6073 import( 6074 /* @vite-ignore */ 6075 path 6076 ).then((module) => { 6077 module.run.call(component.$wire, component.$wire, component.$wire.js); 6078 pendingComponentAssets.get(component).loading = false; 6079 pendingComponentAssets.get(component).afterLoaded.forEach((callback) => callback()); 6080 pendingComponentAssets.delete(component); 6081 }); 6082 } 6083 }); 6084 function assetIsPendingFor(component) { 6085 return pendingComponentAssets.has(component) && pendingComponentAssets.get(component).loading; 6086 } 6087 function runAfterAssetIsLoadedFor(component, callback) { 6088 if (assetIsPendingFor(component)) { 6089 pendingComponentAssets.get(component).afterLoaded.push(() => callback()); 6090 } else { 6091 callback(); 6092 } 6093 } 6094 6095 // js/$wire.js 6096 var properties = {}; 6097 var fallback; 6098 function wireProperty(name, callback, component = null) { 6099 properties[name] = callback; 6100 } 6101 function wireFallback(callback) { 6102 fallback = callback; 6103 } 6104 var aliases = { 6105 "on": "$on", 6106 "el": "$el", 6107 "id": "$id", 6108 "js": "$js", 6109 "get": "$get", 6110 "set": "$set", 6111 "refs": "$refs", 6112 "call": "$call", 6113 "hook": "$hook", 6114 "watch": "$watch", 6115 "dirty": "$dirty", 6116 "effect": "$effect", 6117 "commit": "$commit", 6118 "errors": "$errors", 6119 "island": "$island", 6120 "upload": "$upload", 6121 "entangle": "$entangle", 6122 "dispatch": "$dispatch", 6123 "intercept": "$intercept", 6124 "interceptAction": "$interceptAction", 6125 "interceptMessage": "$interceptMessage", 6126 "interceptRequest": "$interceptRequest", 6127 "dispatchTo": "$dispatchTo", 6128 "dispatchSelf": "$dispatchSelf", 6129 "dispatchEl": "$dispatchEl", 6130 "dispatchRef": "$dispatchRef", 6131 "removeUpload": "$removeUpload", 6132 "cancelUpload": "$cancelUpload", 6133 "uploadMultiple": "$uploadMultiple" 6134 }; 6135 function generateWireObject(component, state) { 6136 let isScoped = false; 6137 return new Proxy({}, { 6138 get(target, property) { 6139 if (property === "__instance") 6140 return component; 6141 if (property in aliases) { 6142 return getProperty(component, aliases[property]); 6143 } else if (property in properties) { 6144 return getProperty(component, property); 6145 } else if (property in state) { 6146 return state[property]; 6147 } else if (property === "toJSON") { 6148 return () => component.toJSON(); 6149 } else if (!["then"].includes(property)) { 6150 return getFallback(component)(property); 6151 } 6152 }, 6153 set(target, property, value) { 6154 if (property in state) { 6155 state[property] = value; 6156 } 6157 return true; 6158 } 6159 }); 6160 } 6161 function getProperty(component, name) { 6162 return properties[name](component); 6163 } 6164 function getFallback(component) { 6165 return fallback(component); 6166 } 6167 module_default.magic("wire", (el, { cleanup: cleanup2 }) => {
6168 let component; 6169 return new Proxy({}, { 6170 get(target, property) { 6171 if (!component) { 6172 try { 6173 component = findComponentByEl(el); 6174 } catch (e) { 6175 return () => { 6176 }; 6177 } 6178 } 6179 if (["$entangle", "entangle"].includes(property)) { 6180 return generateEntangleFunction(component, cleanup2); 6181 } 6182 return component.$wire[property]; 6183 }, 6184 set(target, property, value) { 6185 if (!component) { 6186 try { 6187 component = findComponentByEl(el); 6188 } catch (e) { 6189 return true; 6190 } 6191 } 6192 component.$wire[property] = value; 6193 return true; 6194 } 6195 }); 6196 }); 6197 wireProperty("__instance", (component) => component); 6198 wireProperty("$get", (component) => (property, reactive3 = true) => dataGet(reactive3 ? component.reactive : component.ephemeral, property)); 6199 wireProperty("$el", (component) => { 6200 return component.el; 6201 }); 6202 wireProperty("$id", (component) => { 6203 return component.id; 6204 }); 6205 wireProperty("$js", (component) => { 6206 let fn = component.addJsAction.bind(component); 6207 let jsActions = component.getJsActions(); 6208 Object.keys(jsActions).forEach((name) => { 6209 fn[name] = jsActions[name]; 6210 }); 6211 return new Proxy(fn, { 6212 set(target, property, value) { 6213 component.addJsAction(property, value); 6214 return true; 6215 }, 6216 get(target, property) { 6217 if (assetIsPendingFor(component)) { 6218 let resolver = null; 6219 let promise = new Promise((resolve) => { 6220 resolver = resolve; 6221 }); 6222 return (...params) => { 6223 runAfterAssetIsLoadedFor(component, () => { 6224 resolver(component.getJsAction(property)(...params)); 6225 }); 6226 return promise; 6227 }; 6228 } 6229 return target[property]; 6230 } 6231 }); 6232 }); 6233 wireProperty("$set", (component) => async (property, value, live = true) => { 6234 dataSet(component.reactive, property, value); 6235 if (live) { 6236 component.queueUpdate(property, value); 6237 return fireAction(component, "$set"); 6238 } 6239 return Promise.resolve(); 6240 }); 6241 wireProperty("$refs", (component) => { 6242 let fn = (name) => findRefEl(component, name); 6243 return new Proxy(fn, { 6244 get(target, property) { 6245 if (property in target) { 6246 return target[property]; 6247 } 6248 return fn(property); 6249 } 6250 }); 6251 }); 6252 wireProperty("$dirty", (component) => (property) => { 6253 let reactive3 = module_default.reactive({ dirty: false }); 6254 interceptComponentMessage(component, ({ onFinish }) => { 6255 onFinish(() => { 6256 queueMicrotask(() => { 6257 reactive3.dirty = checkDirty(component, property); 6258 }); 6259 }); 6260 }); 6261 module_default.effect(() => { 6262 reactive3.dirty = checkDirty(component, property); 6263 }); 6264 return reactive3.dirty; 6265 }); 6266 wireProperty("$intercept", (component) => (actionNameOrCallback, maybeCallback) => { 6267 return interceptComponentAction(component, actionNameOrCallback, maybeCallback); 6268 }); 6269 wireProperty("$interceptAction", (component) => (actionNameOrCallback, maybeCallback) => { 6270 return interceptComponentAction(component, actionNameOrCallback, maybeCallback); 6271 }); 6272 wireProperty("$interceptMessage", (component) => (actionNameOrCallback, maybeCallback) => { 6273 return interceptComponentMessage(component, actionNameOrCallback, maybeCallback); 6274 }); 6275 wireProperty("$interceptRequest", (component) => (actionNameOrCallback, maybeCallback) => { 6276 return interceptComponentRequest(component, actionNameOrCallback, maybeCallback); 6277 }); 6278 wireProperty("$errors", (component) => getErrorsObject(component)); 6279 wireProperty("$call", (component) => async (method, ...params) => { 6280 return await component.$wire[method](...params); 6281 }); 6282 wireProperty("$island", (component) => (name, options = {}) => { 6283 setNextActionMetadata({ island: { name, mode: "morph", ...options } }); 6284 return component.$wire; 6285 }); 6286 wireProperty("$entangle", (component) => (name, live = false) => { 6287 return generateEntangleFunction(component)(name, live); 6288 }); 6289 wireProperty("$toggle", (component) => (name, live = true) => { 6290 return component.$wire.set(name, !component.$wire.get(name), live); 6291 }); 6292 wireProperty("$watch", (component) => (path, callback) => { 6293 let getter = () => { 6294 return dataGet(component.reactive, path); 6295 }; 6296 let unwatch = module_default.watch(getter, callback); 6297 component.addCleanup(unwatch); 6298 return unwatch; 6299 }); 6300 wireProperty("$effect", (component) => (callback) => { 6301 let effect3 = module_default.effect(callback); 6302 component.addCleanup(effect3); 6303 return effect3; 6304 }); 6305 wireProperty("$refresh", (component) => async () => { 6306 return fireAction(component, "$refresh"); 6307 }); 6308 wireProperty("$commit", (component) => async () => { 6309 return fireAction(component, "$commit"); 6310 }); 6311 wireProperty("$on", (component) => (...params) => listen2(component, ...params)); 6312 wireProperty("$hook", (component) => (name, callback) => { 6313 let unhook = on2(name, ({ component: hookComponent, ...params }) => { 6314 if (hookComponent === void 0) 6315 return callback(params); 6316 if (hookComponent.id === component.id) 6317 return callback({ component: hookComponent, ...params }); 6318 }); 6319 component.addCleanup(unhook); 6320 return unhook; 6321 });
6322 wireProperty("$dispatch", (component) => (...params) => dispatch3(component, ...params)); 6323 wireProperty("$dispatchSelf", (component) => (...params) => dispatchSelf(component, ...params)); 6324 wireProperty("$dispatchTo", () => (...params) => dispatchTo(...params)); 6325 wireProperty("$dispatchEl", (component) => (...params) => dispatchEl(component, ...params)); 6326 wireProperty("$dispatchRef", (component) => (...params) => dispatchRef(component, ...params)); 6327 wireProperty("$upload", (component) => (...params) => upload(component, ...params)); 6328 wireProperty("$uploadMultiple", (component) => (...params) => uploadMultiple(component, ...params)); 6329 wireProperty("$removeUpload", (component) => (...params) => removeUpload(component, ...params)); 6330 wireProperty("$cancelUpload", (component) => (...params) => cancelUpload(component, ...params)); 6331 var parentMemo = /* @__PURE__ */ new WeakMap(); 6332 wireProperty("$parent", (component) => { 6333 if (parentMemo.has(component)) 6334 return parentMemo.get(component).$wire; 6335 let parent = findComponentByEl(component.el.parentElement, false); 6336 if (!parent) 6337 return; 6338 parentMemo.set(component, parent); 6339 return parent.$wire; 6340 }); 6341 var overriddenMethods = /* @__PURE__ */ new WeakMap(); 6342 function overrideMethod(component, method, callback) { 6343 if (!overriddenMethods.has(component)) { 6344 overriddenMethods.set(component, {}); 6345 } 6346 let obj = overriddenMethods.get(component); 6347 obj[method] = callback; 6348 overriddenMethods.set(component, obj); 6349 } 6350 wireFallback((component) => (property) => (...params) => { 6351 if (params.length === 1 && params[0] instanceof Event) { 6352 params = []; 6353 } 6354 if (overriddenMethods.has(component)) { 6355 let overrides = overriddenMethods.get(component); 6356 if (typeof overrides[property] === "function") { 6357 return overrides[property](params); 6358 } 6359 } 6360 return fireAction(component, property, params); 6361 }); 6362 6363
6363// js/component.js 6364 var Component = class { 6365 constructor(el) { 6366 if (el.__livewire) 6367 throw "Component already initialized"; 6368 el.__livewire = this; 6369 this.el = el; 6370 this.id = el.getAttribute("wire:id"); 6371 this.key = el.getAttribute("wire:key"); 6372 this.__livewireId = this.id; 6373 this.snapshotEncoded = el.getAttribute("wire:snapshot"); 6374 this.snapshot = JSON.parse(this.snapshotEncoded); 6375 if (!this.snapshot) { 6376 throw `Snapshot missing on Livewire component with id: ` + this.id; 6377 } 6378 this.name = this.snapshot.memo.name; 6379 this.effects = JSON.parse(el.getAttribute("wire:effects")); 6380 this.originalEffects = deepClone(this.effects); 6381 this.canonical = extractData(deepClone(this.snapshot.data)); 6382 this.ephemeral = extractData(deepClone(this.snapshot.data)); 6383 this.reactive = Alpine.reactive(this.ephemeral); 6384 this.queuedUpdates = {}; 6385 this.jsActions = {}; 6386 this.$wire = generateWireObject(this, this.reactive); 6387 el.$wire = this.$wire; 6388 this.cleanups = []; 6389 this.processEffects(this.effects); 6390 } 6391 addActionContext(context) { 6392 if (context.el || context.directive) { 6393 setNextActionOrigin({ 6394 el: context.el, 6395 directive: context.directive 6396 }); 6397 } 6398 } 6399 intercept(action, callback = null) { 6400 return this.$wire.$intercept(action, callback); 6401 } 6402 mergeNewSnapshot(snapshotEncoded, effects, updates = {}) { 6403 let snapshot = JSON.parse(snapshotEncoded); 6404 let oldCanonical = deepClone(this.canonical); 6405 let updatedOldCanonical = this.applyUpdates(oldCanonical, updates); 6406 let newCanonical = extractData(deepClone(snapshot.data)); 6407 let dirty = diff(updatedOldCanonical, newCanonical); 6408 this.snapshotEncoded = snapshotEncoded; 6409 this.snapshot = snapshot; 6410 this.effects = effects; 6411 this.canonical = extractData(deepClone(snapshot.data)); 6412 let newData = extractData(deepClone(snapshot.data)); 6413 diffAndPatchRecursive(updatedOldCanonical, newData, this.reactive); 6414 return dirty; 6415 } 6416 queueUpdate(propertyName, value) { 6417 this.queuedUpdates[propertyName] = value; 6418 } 6419 mergeQueuedUpdates(diff2) { 6420 Object.entries(this.queuedUpdates).forEach(([updateKey, updateValue]) => { 6421 Object.entries(diff2).forEach(([diffKey, diffValue]) => { 6422 if (diffKey.startsWith(updateKey)) { 6423 delete diff2[diffKey]; 6424 } 6425 }); 6426 diff2[updateKey] = updateValue; 6427 }); 6428 this.queuedUpdates = []; 6429 return diff2; 6430 } 6431 getUpdates() { 6432 let propertiesDiff = diffAndConsolidate(this.canonical, this.ephemeral); 6433 return this.mergeQueuedUpdates(propertiesDiff); 6434 } 6435 applyUpdates(object, updates) { 6436 for (let key in updates) { 6437 dataSet(object, key, updates[key]); 6438 } 6439 return object; 6440 } 6441 replayUpdate(snapshot, html) { 6442 let effects = { ...this.effects, html }; 6443 this.mergeNewSnapshot(JSON.stringify(snapshot), effects); 6444 this.processEffects({ html }); 6445 } 6446 processEffects(effects, request) { 6447 trigger2("effects", this, effects); 6448 trigger2("effect", { 6449 component: this, 6450 effects, 6451 cleanup: (i) => this.addCleanup(i), 6452 request 6453 }); 6454 } 6455 get children() { 6456 let componentEl = this.el; 6457 let children = []; 6458 componentEl.querySelectorAll("[wire\\:id]").forEach((el) => { 6459 let parentComponentEl = el.parentElement.closest("[wire\\:id]"); 6460 if (parentComponentEl !== componentEl) 6461 return; 6462 let componentInstance = el.__livewire; 6463 if (!componentInstance) 6464 return; 6465 children.push(componentInstance); 6466 }); 6467 return children; 6468 } 6469 get islands() { 6470 let islands = this.snapshot.memo.islands; 6471 return islands; 6472 } 6473 get parent() { 6474 return findComponentByEl(this.el.parentElement); 6475 } 6476 get isIsolated() { 6477 return this.snapshot.memo.isolate; 6478 } 6479 get isLazy() { 6480 return this.snapshot.memo.lazyLoaded !== void 0; 6481 } 6482 get hasBeenLazyLoaded() { 6483 return this.snapshot.memo.lazyLoaded === true; 6484 } 6485 get isLazyIsolated() { 6486 return !!this.snapshot.memo.lazyIsolated; 6487 } 6488 getDeepChildrenWithBindings(callback) { 6489 this.getDeepChildren((child) => { 6490 if (child.isLazy && !child.hasBeenLazyLoaded) 6491 return; 6492 if (child.hasReactiveProps() || child.hasWireModelableBindings()) { 6493 callback(child); 6494 } 6495 }); 6496 } 6497 hasReactiveProps() { 6498 let meta = this.snapshot.memo; 6499 let props = meta.props; 6500 return !!props; 6501 } 6502 hasWireModelableBindings() { 6503 let meta = this.snapshot.memo; 6504 let bindings = meta.bindings; 6505 return !!bindings; 6506 } 6507 getDeepChildren(callback) {
6508 this.children.forEach((child) => { 6509 callback(child); 6510 child.getDeepChildren(callback); 6511 }); 6512 } 6513 getEncodedSnapshotWithLatestChildrenMergedIn() { 6514 let { snapshotEncoded, children, snapshot } = this; 6515 let childrenMemo = {}; 6516 children.forEach((child) => { 6517 childrenMemo[child.key] = [child.el.tagName.toLowerCase(), child.id]; 6518 }); 6519 return snapshotEncoded.replace( 6520 /"children":\{[^}]*\}/, 6521 `"children":${JSON.stringify(childrenMemo)}` 6522 ); 6523 } 6524 inscribeSnapshotAndEffectsOnElement() { 6525 let el = this.el; 6526 el.setAttribute("wire:snapshot", this.snapshotEncoded); 6527 let effects = this.originalEffects.listeners ? { listeners: this.originalEffects.listeners } : {}; 6528 if (this.originalEffects.url) { 6529 effects.url = this.originalEffects.url; 6530 } 6531 if (this.originalEffects.scripts) { 6532 effects.scripts = this.originalEffects.scripts; 6533 } 6534 el.setAttribute("wire:effects", JSON.stringify(effects)); 6535 el.setAttribute("wire:key", this.key); 6536 } 6537 addJsAction(name, action) { 6538 this.jsActions[name] = action; 6539 } 6540 hasJsAction(name) { 6541 return this.jsActions[name] !== void 0; 6542 } 6543 getJsAction(name) { 6544 return this.jsActions[name].bind(this.$wire); 6545 } 6546 getJsActions() { 6547 let actions = {}; 6548 for (let key of Object.keys(this.jsActions)) { 6549 actions[key] = this.getJsAction(key); 6550 } 6551 return actions; 6552 } 6553 toJSON() { 6554 return { 6555 id: this.id, 6556 name: this.name, 6557 key: this.key, 6558 data: Object.fromEntries(Object.entries(this.ephemeral)) 6559 }; 6560 } 6561 addCleanup(cleanup2) { 6562 this.cleanups.push(cleanup2); 6563 } 6564 cleanup() { 6565 delete this.el.__livewire; 6566 while (this.cleanups.length > 0) { 6567 this.cleanups.pop()(); 6568 } 6569 } 6570 }; 6571 6572
6572// js/fragment.js 6573 function closestFragment(el, { isMatch, hasReachedBoundary }) { 6574 if (!hasReachedBoundary) 6575 hasReachedBoundary = () => false; 6576 let current = el; 6577 while (current) { 6578 let sibling = current.previousSibling; 6579 let foundEndMarker = []; 6580 while (sibling) { 6581 if (isEndFragmentMarker(sibling)) { 6582 foundEndMarker.push("a"); 6583 } 6584 if (isStartFragmentMarker(sibling)) { 6585 if (foundEndMarker.length > 0) { 6586 foundEndMarker.pop(); 6587 } else { 6588 let metadata = extractFragmentMetadataFromMarkerNode(sibling); 6589 if (isMatch(metadata)) { 6590 return new Fragment(sibling); 6591 } 6592 } 6593 } 6594 sibling = sibling.previousSibling; 6595 } 6596 current = current.parentElement; 6597 if (current && hasReachedBoundary({ el: current })) { 6598 break; 6599 } 6600 } 6601 return null; 6602 } 6603 function findFragment(el, { isMatch, hasReachedBoundary }) { 6604 if (!hasReachedBoundary) 6605 hasReachedBoundary = () => false; 6606 let startNode = null; 6607 let rootEl2 = el; 6608 walkElements(rootEl2, (el2, { skip, stop: stop2 }) => { 6609 if (el2.hasAttribute && el2 !== rootEl2 && hasReachedBoundary({ el: el2 })) { 6610 return skip(); 6611 } 6612 Array.from(el2.childNodes).forEach((node) => { 6613 if (isStartFragmentMarker(node)) { 6614 let metadata = extractFragmentMetadataFromMarkerNode(node); 6615 if (isMatch(metadata)) { 6616 startNode = node; 6617 stop2(); 6618 } 6619 } 6620 }); 6621 }); 6622 return startNode && new Fragment(startNode); 6623 } 6624 function isStartFragmentMarker(el) { 6625 return el.nodeType === 8 && el.textContent.startsWith("[if FRAGMENT"); 6626 } 6627 function isEndFragmentMarker(el) { 6628 return el.nodeType === 8 && el.textContent.startsWith("[if ENDFRAGMENT"); 6629 } 6630 function walkElements(el, callback) { 6631 let skip = false; 6632 let stop2 = false; 6633 callback(el, { skip: () => skip = true, stop: () => stop2 = true }); 6634 if (skip || stop2) 6635 return; 6636 Array.from(el.children).forEach((child) => { 6637 walkElements(child, callback); 6638 if (stop2) 6639 return; 6640 }); 6641 } 6642 var Fragment = class { 6643 constructor(startMarkerNode) { 6644 this.startMarkerNode = startMarkerNode;
6645 this.metadata = extractFragmentMetadataFromMarkerNode(startMarkerNode); 6646 } 6647 get endMarkerNode() { 6648 return findMatchingEndMarkerNode(this.startMarkerNode, this.metadata); 6649 } 6650 append(mountContainerTagName, html) { 6651 let container = document.createElement(mountContainerTagName); 6652 container.innerHTML = html; 6653 Array.from(container.childNodes).forEach((node) => { 6654 this.endMarkerNode.before(node); 6655 }); 6656 } 6657 prepend(mountContainerTagName, html) { 6658 let container = document.createElement(mountContainerTagName); 6659 container.innerHTML = html; 6660 Array.from(container.childNodes).reverse().forEach((node) => { 6661 this.startMarkerNode.after(node); 6662 }); 6663 } 6664 }; 6665 function findMatchingEndMarkerNode(startMarkerNode, metadata) { 6666 let current = startMarkerNode; 6667 while (current) { 6668 if (isEndFragmentMarker(current)) { 6669 let currentMetadata = extractFragmentMetadataFromMarkerNode(current); 6670 if (Object.keys(metadata).every((key) => metadata[key] === currentMetadata[key])) { 6671 return current; 6672 } 6673 } 6674 current = current.nextSibling; 6675 } 6676 return null; 6677 } 6678 function extractInnerHtmlFromFragmentHtml(fragmentHtml) { 6679 let regex = /<!--\[if FRAGMENT\b.*?\]><!\[endif\]-->([\s\S]*)<!--\[if ENDFRAGMENT\b.*?\]><!\[endif\]-->/i; 6680 let match = fragmentHtml.match(regex); 6681 if (!match) 6682 throw new Error("Invalid fragment marker"); 6683 let [_, html] = match; 6684 return html; 6685 } 6686 function extractFragmentMetadataFromHtml(fragmentHtml) { 6687 let regex = /\[if (FRAGMENT|ENDFRAGMENT):(.*?)\]/; 6688 let match = fragmentHtml.match(regex); 6689 if (!match) 6690 throw new Error("Invalid fragment marker"); 6691 let [_, __, encodedMetadata] = match; 6692 return decodeMetadata(encodedMetadata); 6693 } 6694 function extractFragmentMetadataFromMarkerNode(startMarkerNode) { 6695 let regex = /\[if (FRAGMENT|ENDFRAGMENT):(.*?)\]/; 6696 let match = startMarkerNode.textContent.match(regex); 6697 if (!match) 6698 throw new Error("Invalid fragment marker"); 6699 let [_, __, encodedMetadata] = match; 6700 return decodeMetadata(encodedMetadata); 6701 } 6702 function decodeMetadata(encodedMetadata) { 6703 let metadata = {}; 6704 let pairs = encodedMetadata.split("|"); 6705 pairs.forEach((pair) => { 6706 let [key, value] = pair.split("="); 6707 metadata[key] = value; 6708 }); 6709 return metadata; 6710 } 6711 6712
6712// js/store.js 6713 var components = {}; 6714 function initComponent(el) { 6715 let component = new Component(el); 6716 if (components[component.id]) 6717 throw "Component already registered"; 6718 let cleanup2 = (i) => component.addCleanup(i); 6719 trigger2("component.init", { component, cleanup: cleanup2 }); 6720 components[component.id] = component; 6721 return component; 6722 } 6723 function destroyComponent(id) { 6724 let component = components[id]; 6725 if (!component) 6726 return; 6727 component.cleanup(); 6728 delete components[id]; 6729 } 6730 function hasComponent(id) { 6731 return !!components[id]; 6732 } 6733 function findComponent(id, strict = true) { 6734 let component = components[id]; 6735 if (!component) { 6736 if (strict) 6737 throw "Component not found: " + id; 6738 return; 6739 } 6740 return component; 6741 } 6742 function findComponentByEl(el, strict = true) { 6743 let componentId = walkUpwards(el, (node, { stop: stop2 }) => { 6744 if (node.__livewire) 6745 return stop2(node.__livewire.id); 6746 let endMarkers = []; 6747 let slotParentId = walkBackwards(node, (siblingNode, { stop: stop3 }) => { 6748 if (isEndFragmentMarker(siblingNode)) { 6749 let metadata = extractFragmentMetadataFromMarkerNode(siblingNode); 6750 if (metadata.type !== "slot") 6751 return; 6752 endMarkers.push("a"); 6753 return; 6754 } 6755 if (isStartFragmentMarker(siblingNode)) { 6756 let metadata = extractFragmentMetadataFromMarkerNode(siblingNode); 6757 if (metadata.type !== "slot") 6758 return; 6759 if (endMarkers.length > 0) { 6760 endMarkers.pop(); 6761 } else { 6762 return stop3(metadata.parent); 6763 } 6764 } 6765 }); 6766 if (slotParentId) 6767 return stop2(slotParentId); 6768 }); 6769 let component = findComponent(componentId, strict); 6770 if (!component) { 6771 if (strict) 6772 throw "Could not find Livewire component in DOM tree"; 6773 return; 6774 } 6775 return component; 6776 } 6777 function componentsByName(name) { 6778 return Object.values(components).filter((component) => { 6779 return name == component.name; 6780 }); 6781 } 6782 function getByName(name) { 6783 return componentsByName(name).map((i) => i.$wire); 6784 } 6785 function find(id) {
6786 let component = components[id]; 6787 return component && component.$wire; 6788 } 6789 function first() { 6790 return Object.values(components)[0].$wire; 6791 } 6792 function all() { 6793 return Object.values(components); 6794 } 6795 6796
6796// js/events.js 6797 function dispatch3(component, name, params) { 6798 dispatchEvent(component.el, name, params); 6799 } 6800 function dispatchGlobal(name, params) { 6801 dispatchEvent(window, name, params); 6802 } 6803 function dispatchSelf(component, name, params) { 6804 dispatchEvent(component.el, name, params, false); 6805 } 6806 function dispatchEl(component, selector, name, params) { 6807 let targets = component.el.querySelectorAll(selector); 6808 targets.forEach((target) => { 6809 dispatchEvent(target, name, params, false); 6810 }); 6811 } 6812 function dispatchTo(componentName, name, params) { 6813 let targets = componentsByName(componentName); 6814 targets.forEach((target) => { 6815 dispatchEvent(target.el, name, params, false); 6816 }); 6817 } 6818 function dispatchRef(component, ref, name, params) { 6819 let el = findRefEl(component, ref); 6820 dispatchEvent(el, name, params, false); 6821 } 6822 function listen2(component, name, callback) { 6823 component.el.addEventListener(name, (e) => { 6824 callback(e.detail); 6825 }); 6826 } 6827 function on3(eventName, callback) { 6828 let handler4 = (e) => { 6829 if (!e.__livewire) 6830 return; 6831 callback(e.detail); 6832 }; 6833 window.addEventListener(eventName, handler4); 6834 return () => { 6835 window.removeEventListener(eventName, handler4); 6836 }; 6837 } 6838 function dispatchEvent(target, name, params, bubbles = true) { 6839 if (typeof params === "string") { 6840 params = [params]; 6841 } 6842 let e = new CustomEvent(name, { bubbles, detail: params }); 6843 e.__livewire = { name, params, receivedBy: [] }; 6844 target.dispatchEvent(e); 6845 } 6846 6847
vendor: 3,044 bytes, lines 6847-6941
6847// node_modules/@alpinejs/collapse/dist/module.esm.js 6848 function src_default2(Alpine3) { 6849 Alpine3.directive("collapse", collapse); 6850 collapse.inline = (el, { modifiers }) => { 6851 if (!modifiers.includes("min")) 6852 return; 6853 el._x_doShow = () => { 6854 }; 6855 el._x_doHide = () => { 6856 }; 6857 }; 6858 function collapse(el, { modifiers }) { 6859 let duration = modifierValue2(modifiers, "duration", 250) / 1e3; 6860 let floor2 = modifierValue2(modifiers, "min", 0); 6861 let fullyHide = !modifiers.includes("min"); 6862 if (!el._x_isShown) 6863 el.style.height = `${floor2}px`; 6864 if (!el._x_isShown && fullyHide) 6865 el.hidden = true; 6866 if (!el._x_isShown) 6867 el.style.overflow = "hidden"; 6868 let setFunction = (el2, styles) => { 6869 let revertFunction = Alpine3.setStyles(el2, styles); 6870 return styles.height ? () => { 6871 } : revertFunction; 6872 }; 6873 let transitionStyles = { 6874 transitionProperty: "height", 6875 transitionDuration: `${duration}s`, 6876 transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)" 6877 }; 6878 el._x_transition = { 6879 in(before = () => { 6880 }, after = () => { 6881 }) { 6882 if (fullyHide) 6883 el.hidden = false; 6884 if (fullyHide) 6885 el.style.display = null; 6886 let current = el.getBoundingClientRect().height; 6887 el.style.height = "auto"; 6888 let full = el.getBoundingClientRect().height; 6889 if (current === full) { 6890 current = floor2; 6891 } 6892 Alpine3.transition(el, Alpine3.setStyles, { 6893 during: transitionStyles, 6894 start: { height: current + "px" }, 6895 end: { height: full + "px" } 6896 }, () => el._x_isShown = true, () => { 6897 if (Math.abs(el.getBoundingClientRect().height - full) < 1) { 6898 el.style.overflow = null; 6899 } 6900 }); 6901 }, 6902 out(before = () => { 6903 }, after = () => { 6904 }) { 6905 let full = el.getBoundingClientRect().height; 6906 Alpine3.transition(el, setFunction, { 6907 during: transitionStyles, 6908 start: { height: full + "px" }, 6909 end: { height: floor2 + "px" } 6910 }, () => el.style.overflow = "hidden", () => { 6911 el._x_isShown = false; 6912 if (el.style.height == `${floor2}px` && fullyHide) { 6913 el.style.display = "none"; 6914 el.hidden = true; 6915 } 6916 }); 6917 } 6918 }; 6919 } 6920 } 6921 function modifierValue2(modifiers, key, fallback2) { 6922 if (modifiers.indexOf(key) === -1) 6923 return fallback2; 6924 const rawValue = modifiers[modifiers.indexOf(key) + 1]; 6925 if (!rawValue) 6926 return fallback2; 6927 if (key === "duration") { 6928 let match = rawValue.match(/([0-9]+)ms/); 6929 if (match) 6930 return match[1]; 6931 } 6932 if (key === "min") { 6933 let match = rawValue.match(/([0-9]+)px/); 6934 if (match) 6935 return match[1]; 6936 } 6937 return rawValue; 6938 } 6939 var module_default2 = src_default2; 6940 6941
vendor: 61,070 bytes, lines 6941-8506
6941// node_modules/@alpinejs/focus/dist/module.esm.js 6942 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] *)"]; 6943 var candidateSelector = /* @__PURE__ */ candidateSelectors.join(","); 6944 var NoElement = typeof Element === "undefined"; 6945 var matches = NoElement ? function() { 6946 } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 6947 var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) { 6948 var _element$getRootNode; 6949 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element); 6950 } : function(element) { 6951 return element === null || element === void 0 ? void 0 : element.ownerDocument; 6952 }; 6953 var _isInert = function isInert(node, lookUp) { 6954 var _node$getAttribute; 6955 if (lookUp === void 0) { 6956 lookUp = true; 6957 } 6958 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"); 6959 var inert = inertAtt === "" || inertAtt === "true"; 6960 var result = inert || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode)); 6961 return result; 6962 }; 6963 var isContentEditable = function isContentEditable2(node) { 6964 var _node$getAttribute2; 6965 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"); 6966 return attValue === "" || attValue === "true"; 6967 }; 6968 var getCandidates = function getCandidates2(el, includeContainer, filter) { 6969 if (_isInert(el)) { 6970 return []; 6971 } 6972 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); 6973 if (includeContainer && matches.call(el, candidateSelector)) { 6974 candidates.unshift(el); 6975 } 6976 candidates = candidates.filter(filter); 6977 return candidates; 6978 }; 6979 var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { 6980 var candidates = []; 6981 var elementsToCheck = Array.from(elements); 6982 while (elementsToCheck.length) { 6983 var element = elementsToCheck.shift(); 6984 if (_isInert(element, false)) { 6985 continue; 6986 } 6987 if (element.tagName === "SLOT") { 6988 var assigned = element.assignedElements(); 6989 var content = assigned.length ? assigned : element.children; 6990 var nestedCandidates = _getCandidatesIteratively(content, true, options); 6991 if (options.flatten) { 6992 candidates.push.apply(candidates, nestedCandidates); 6993 } else { 6994 candidates.push({ 6995 scopeParent: element, 6996 candidates: nestedCandidates 6997 }); 6998 } 6999 } else { 7000 var validCandidate = matches.call(element, candidateSelector); 7001 if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) { 7002 candidates.push(element); 7003 } 7004 var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element); 7005 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element)); 7006 if (shadowRoot && validShadowRoot) { 7007 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options); 7008 if (options.flatten) { 7009 candidates.push.apply(candidates, _nestedCandidates); 7010 } else { 7011 candidates.push({ 7012 scopeParent: element, 7013 candidates: _nestedCandidates 7014 }); 7015 } 7016 } else { 7017 elementsToCheck.unshift.apply(elementsToCheck, element.children); 7018 } 7019 } 7020 } 7021 return candidates; 7022 }; 7023 var hasTabIndex = function hasTabIndex2(node) { 7024 return !isNaN(parseInt(node.getAttribute("tabindex"), 10)); 7025 }; 7026 var getTabIndex = function getTabIndex2(node) { 7027 if (!node) { 7028 throw new Error("No node provided"); 7029 } 7030 if (node.tabIndex < 0) { 7031 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) { 7032 return 0; 7033 } 7034 } 7035 return node.tabIndex; 7036 }; 7037 var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) { 7038 var tabIndex = getTabIndex(node); 7039 if (tabIndex < 0 && isScope && !hasTabIndex(node)) { 7040 return 0; 7041 } 7042 return tabIndex; 7043 }; 7044 var sortOrderedTabbables = function sortOrderedTabbables2(a, b) { 7045 return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; 7046 }; 7047 var isInput = function isInput2(node) { 7048 return node.tagName === "INPUT"; 7049 }; 7050 var isHiddenInput = function isHiddenInput2(node) { 7051 return isInput(node) && node.type === "hidden"; 7052 }; 7053 var isDetailsWithSummary = function isDetailsWithSummary2(node) { 7054 var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) { 7055 return child.tagName === "SUMMARY"; 7056 }); 7057 return r; 7058 }; 7059 var getCheckedRadio = function getCheckedRadio2(nodes, form) { 7060 for (var i = 0; i < nodes.length; i++) { 7061 if (nodes[i].checked && nodes[i].form === form) { 7062 return nodes[i]; 7063 } 7064 } 7065 }; 7066 var isTabbableRadio = function isTabbableRadio2(node) { 7067 if (!node.name) { 7068 return true; 7069 } 7070 var radioScope = node.form || getRootNode(node); 7071 var queryRadios = function queryRadios2(name) { 7072 return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]'); 7073 }; 7074 var radioSet; 7075 if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") { 7076 radioSet = queryRadios(window.CSS.escape(node.name)); 7077 } else { 7078 try { 7079 radioSet = queryRadios(node.name); 7080 } catch (err) { 7081 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); 7082 return false; 7083 } 7084 } 7085 var checked = getCheckedRadio(radioSet, node.form); 7086 return !checked || checked === node; 7087 }; 7088 var isRadio2 = function isRadio22(node) { 7089 return isInput(node) && node.type === "radio"; 7090 }; 7091 var isNonTabbableRadio = function isNonTabbableRadio2(node) { 7092 return isRadio2(node) && !isTabbableRadio(node); 7093 }; 7094 var isNodeAttached = function isNodeAttached2(node) { 7095 var _nodeRoot; 7096 var nodeRoot = node && getRootNode(node); 7097 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; 7098 var attached = false; 7099 if (nodeRoot && nodeRoot !== node) { 7100 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; 7101 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)); 7102 while (!attached && nodeRootHost) { 7103 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; 7104 nodeRoot = getRootNode(nodeRootHost); 7105 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; 7106 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); 7107 } 7108 } 7109 return attached; 7110 }; 7111 var isZeroArea = function isZeroArea2(node) { 7112 var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; 7113 return width === 0 && height === 0; 7114 }; 7115 var isHidden = function isHidden2(node, _ref) { 7116 var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot; 7117 if (displayCheck === "full-native") { 7118 if ("checkVisibility" in node) { 7119 var visible = node.checkVisibility({ 7120 checkOpacity: false, 7121 opacityProperty: false, 7122 contentVisibilityAuto: true, 7123 visibilityProperty: true, 7124 checkVisibilityCSS: true 7125 }); 7126 return !visible; 7127 } 7128 } 7129 if (getComputedStyle(node).visibility === "hidden") { 7130 return true; 7131 } 7132 var isDirectSummary = matches.call(node, "details>summary:first-of-type"); 7133 var nodeUnderDetails = isDirectSummary ? node.parentElement : node; 7134 if (matches.call(nodeUnderDetails, "details:not([open]) *")) { 7135 return true; 7136 } 7137 if (!displayCheck || displayCheck === "full" || displayCheck === "full-native" || displayCheck === "legacy-full") { 7138 if (typeof getShadowRoot === "function") { 7139 var originalNode = node; 7140 while (node) { 7141 var parentElement = node.parentElement; 7142 var rootNode = getRootNode(node); 7143 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) { 7144 return isZeroArea(node); 7145 } else if (node.assignedSlot) { 7146 node = node.assignedSlot; 7147 } else if (!parentElement && rootNode !== node.ownerDocument) { 7148 node = rootNode.host; 7149 } else { 7150 node = parentElement; 7151 } 7152 } 7153 node = originalNode; 7154 } 7155 if (isNodeAttached(node)) { 7156 return !node.getClientRects().length; 7157 } 7158 if (displayCheck !== "legacy-full") { 7159 return true; 7160 } 7161 } else if (displayCheck === "non-zero-area") { 7162 return isZeroArea(node); 7163 } 7164 return false; 7165 }; 7166 var isDisabledFromFieldset = function isDisabledFromFieldset2(node) { 7167 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { 7168 var parentNode = node.parentElement; 7169 while (parentNode) { 7170 if (parentNode.tagName === "FIELDSET" && parentNode.disabled) { 7171 for (var i = 0; i < parentNode.children.length; i++) { 7172 var child = parentNode.children.item(i); 7173 if (child.tagName === "LEGEND") { 7174 return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node); 7175 } 7176 } 7177 return true; 7178 } 7179 parentNode = parentNode.parentElement; 7180 } 7181 } 7182 return false; 7183 }; 7184 var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) { 7185 if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) { 7186 return false; 7187 } 7188 return true; 7189 }; 7190 var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) { 7191 if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) { 7192 return false; 7193 } 7194 return true; 7195 }; 7196 var isShadowRootTabbable = function isShadowRootTabbable2(shadowHostNode) { 7197 var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10); 7198 if (isNaN(tabIndex) || tabIndex >= 0) { 7199 return true; 7200 } 7201 return false; 7202 }; 7203 var _sortByOrder = function sortByOrder(candidates) { 7204 var regularTabbables = []; 7205 var orderedTabbables = []; 7206 candidates.forEach(function(item, i) { 7207 var isScope = !!item.scopeParent; 7208 var element = isScope ? item.scopeParent : item; 7209 var candidateTabindex = getSortOrderTabIndex(element, isScope); 7210 var elements = isScope ? _sortByOrder(item.candidates) : element; 7211 if (candidateTabindex === 0) { 7212 isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element); 7213 } else { 7214 orderedTabbables.push({ 7215 documentOrder: i, 7216 tabIndex: candidateTabindex, 7217 item, 7218 isScope, 7219 content: elements 7220 }); 7221 } 7222 }); 7223 return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) { 7224 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); 7225 return acc; 7226 }, []).concat(regularTabbables); 7227 }; 7228 var tabbable = function tabbable2(container, options) { 7229 options = options || {}; 7230 var candidates; 7231 if (options.getShadowRoot) { 7232 candidates = _getCandidatesIteratively([container], options.includeContainer, { 7233 filter: isNodeMatchingSelectorTabbable.bind(null, options), 7234 flatten: false, 7235 getShadowRoot: options.getShadowRoot, 7236 shadowRootFilter: isShadowRootTabbable 7237 }); 7238 } else { 7239 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); 7240 } 7241 return _sortByOrder(candidates); 7242 }; 7243 var focusable = function focusable2(container, options) { 7244 options = options || {}; 7245 var candidates; 7246 if (options.getShadowRoot) { 7247 candidates = _getCandidatesIteratively([container], options.includeContainer, { 7248 filter: isNodeMatchingSelectorFocusable.bind(null, options), 7249 flatten: true, 7250 getShadowRoot: options.getShadowRoot 7251 }); 7252 } else { 7253 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options)); 7254 } 7255 return candidates; 7256 }; 7257 var isTabbable = function isTabbable2(node, options) { 7258 options = options || {}; 7259 if (!node) { 7260 throw new Error("No node provided"); 7261 } 7262 if (matches.call(node, candidateSelector) === false) { 7263 return false; 7264 } 7265 return isNodeMatchingSelectorTabbable(options, node); 7266 }; 7267 var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(","); 7268 var isFocusable = function isFocusable2(node, options) { 7269 options = options || {}; 7270 if (!node) { 7271 throw new Error("No node provided"); 7272 } 7273 if (matches.call(node, focusableCandidateSelector) === false) { 7274 return false; 7275 } 7276 return isNodeMatchingSelectorFocusable(options, node); 7277 }; 7278 function _arrayLikeToArray(r, a) { 7279 (null == a || a > r.length) && (a = r.length); 7280 for (var e = 0, n = Array(a); e < a; e++) 7281 n[e] = r[e]; 7282 return n; 7283 } 7284 function _arrayWithoutHoles(r) { 7285 if (Array.isArray(r)) 7286 return _arrayLikeToArray(r); 7287 } 7288 function asyncGeneratorStep(n, t, e, r, o, a, c) { 7289 try { 7290 var i = n[a](c), u = i.value; 7291 } catch (n2) { 7292 return void e(n2); 7293 } 7294 i.done ? t(u) : Promise.resolve(u).then(r, o); 7295 } 7296 function _asyncToGenerator(n) { 7297 return function() { 7298 var t = this, e = arguments; 7299 return new Promise(function(r, o) { 7300 var a = n.apply(t, e); 7301 function _next(n2) { 7302 asyncGeneratorStep(a, r, o, _next, _throw, "next", n2); 7303 } 7304 function _throw(n2) { 7305 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2); 7306 } 7307 _next(void 0); 7308 }); 7309 }; 7310 } 7311 function _createForOfIteratorHelper(r, e) { 7312 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 7313 if (!t) { 7314 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { 7315 t && (r = t); 7316 var n = 0, F = function() { 7317 }; 7318 return { 7319 s: F, 7320 n: function() { 7321 return n >= r.length ? { 7322 done: true 7323 } : { 7324 done: false, 7325 value: r[n++] 7326 }; 7327 }, 7328 e: function(r2) { 7329 throw r2; 7330 }, 7331 f: F 7332 }; 7333 } 7334 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 7335 } 7336 var o, a = true, u = false; 7337 return { 7338 s: function() { 7339 t = t.call(r); 7340 }, 7341 n: function() { 7342 var r2 = t.next(); 7343 return a = r2.done, r2; 7344 }, 7345 e: function(r2) { 7346 u = true, o = r2; 7347 }, 7348 f: function() { 7349 try { 7350 a || null == t.return || t.return(); 7351 } finally { 7352 if (u) 7353 throw o; 7354 } 7355 } 7356 }; 7357 } 7358 function _defineProperty(e, r, t) { 7359 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 7360 value: t, 7361 enumerable: true, 7362 configurable: true, 7363 writable: true 7364 }) : e[r] = t, e; 7365 } 7366 function _iterableToArray(r) { 7367 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) 7368 return Array.from(r); 7369 } 7370 function _nonIterableSpread() { 7371 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 7372 } 7373 function ownKeys2(e, r) { 7374 var t = Object.keys(e); 7375 if (Object.getOwnPropertySymbols) { 7376 var o = Object.getOwnPropertySymbols(e); 7377 r && (o = o.filter(function(r2) { 7378 return Object.getOwnPropertyDescriptor(e, r2).enumerable; 7379 })), t.push.apply(t, o); 7380 } 7381 return t; 7382 } 7383 function _objectSpread2(e) { 7384 for (var r = 1; r < arguments.length; r++) { 7385 var t = null != arguments[r] ? arguments[r] : {}; 7386 r % 2 ? ownKeys2(Object(t), true).forEach(function(r2) { 7387 _defineProperty(e, r2, t[r2]); 7388 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r2) { 7389 Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); 7390 }); 7391 } 7392 return e; 7393 } 7394 function _regenerator() { 7395 var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; 7396 function i(r2, n2, o2, i2) { 7397 var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype); 7398 return _regeneratorDefine(u2, "_invoke", function(r3, n3, o3) { 7399 var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { 7400 p: 0, 7401 n: 0, 7402 v: e, 7403 a: d, 7404 f: d.bind(e, 4), 7405 d: function(t2, r4) { 7406 return i3 = t2, c3 = 0, u3 = e, G.n = r4, a; 7407 } 7408 }; 7409 function d(r4, n4) { 7410 for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) { 7411 var o4, i4 = p[t], d2 = G.p, l = i4[2]; 7412 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)); 7413 } 7414 if (o4 || r4 > 1) 7415 return a; 7416 throw y = true, n4; 7417 } 7418 return function(o4, p2, l) { 7419 if (f2 > 1) 7420 throw TypeError("Generator is already running"); 7421 for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) { 7422 i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3); 7423 try { 7424 if (f2 = 2, i3) { 7425 if (c3 || (o4 = "next"), t = i3[o4]) { 7426 if (!(t = t.call(i3, u3))) 7427 throw TypeError("iterator result is not an object"); 7428 if (!t.done) 7429 return t; 7430 u3 = t.value, c3 < 2 && (c3 = 0); 7431 } else 7432 1 === c3 && (t = i3.return) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1); 7433 i3 = e; 7434 } else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) 7435 break; 7436 } catch (t2) { 7437 i3 = e, c3 = 1, u3 = t2; 7438 } finally { 7439 f2 = 1; 7440 } 7441 } 7442 return { 7443 value: t, 7444 done: y 7445 }; 7446 }; 7447 }(r2, o2, i2), true), u2; 7448 } 7449 var a = {}; 7450 function Generator() { 7451 } 7452 function GeneratorFunction() { 7453 } 7454 function GeneratorFunctionPrototype() { 7455 } 7456 t = Object.getPrototypeOf; 7457 var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function() { 7458 return this; 7459 }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); 7460 function f(e2) { 7461 return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2; 7462 } 7463 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() { 7464 return this; 7465 }), _regeneratorDefine(u, "toString", function() { 7466 return "[object Generator]"; 7467 }), (_regenerator = function() { 7468 return { 7469 w: i, 7470 m: f 7471 }; 7472 })(); 7473 } 7474 function _regeneratorDefine(e, r, n, t) { 7475 var i = Object.defineProperty; 7476 try { 7477 i({}, "", {}); 7478 } catch (e2) { 7479 i = 0; 7480 } 7481 _regeneratorDefine = function(e2, r2, n2, t2) { 7482 function o(r3, n3) { 7483 _regeneratorDefine(e2, r3, function(e3) { 7484 return this._invoke(r3, n3, e3); 7485 }); 7486 } 7487 r2 ? i ? i(e2, r2, { 7488 value: n2, 7489 enumerable: !t2, 7490 configurable: !t2, 7491 writable: !t2 7492 }) : e2[r2] = n2 : (o("next", 0), o("throw", 1), o("return", 2)); 7493 }, _regeneratorDefine(e, r, n, t); 7494 } 7495 function _toConsumableArray(r) { 7496 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); 7497 } 7498 function _toPrimitive(t, r) { 7499 if ("object" != typeof t || !t) 7500 return t; 7501 var e = t[Symbol.toPrimitive]; 7502 if (void 0 !== e) { 7503 var i = e.call(t, r); 7504 if ("object" != typeof i) 7505 return i; 7506 throw new TypeError("@@toPrimitive must return a primitive value."); 7507 } 7508 return ("string" === r ? String : Number)(t); 7509 } 7510 function _toPropertyKey(t) { 7511 var i = _toPrimitive(t, "string"); 7512 return "symbol" == typeof i ? i : i + ""; 7513 } 7514 function _unsupportedIterableToArray(r, a) { 7515 if (r) { 7516 if ("string" == typeof r) 7517 return _arrayLikeToArray(r, a); 7518 var t = {}.toString.call(r).slice(8, -1); 7519 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; 7520 } 7521 } 7522 var activeFocusTraps = { 7523 getActiveTrap: function getActiveTrap(trapStack) { 7524 if ((trapStack === null || trapStack === void 0 ? void 0 : trapStack.length) > 0) { 7525 return trapStack[trapStack.length - 1]; 7526 } 7527 return null; 7528 }, 7529 activateTrap: function activateTrap(trapStack, trap) { 7530 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 7531 if (trap !== activeTrap) { 7532 activeFocusTraps.pauseTrap(trapStack); 7533 } 7534 var trapIndex = trapStack.indexOf(trap); 7535 if (trapIndex === -1) { 7536 trapStack.push(trap); 7537 } else { 7538 trapStack.splice(trapIndex, 1); 7539 trapStack.push(trap); 7540 } 7541 }, 7542 deactivateTrap: function deactivateTrap(trapStack, trap) { 7543 var trapIndex = trapStack.indexOf(trap); 7544 if (trapIndex !== -1) { 7545 trapStack.splice(trapIndex, 1); 7546 } 7547 activeFocusTraps.unpauseTrap(trapStack); 7548 }, 7549 pauseTrap: function pauseTrap(trapStack) { 7550 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 7551 activeTrap === null || activeTrap === void 0 || activeTrap._setPausedState(true); 7552 }, 7553 unpauseTrap: function unpauseTrap(trapStack) { 7554 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 7555 if (activeTrap && !activeTrap._isManuallyPaused()) { 7556 activeTrap._setPausedState(false); 7557 } 7558 } 7559 }; 7560 var isSelectableInput = function isSelectableInput2(node) { 7561 return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function"; 7562 }; 7563 var isEscapeEvent = function isEscapeEvent2(e) { 7564 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; 7565 }; 7566 var isTabEvent = function isTabEvent2(e) { 7567 return (e === null || e === void 0 ? void 0 : e.key) === "Tab" || (e === null || e === void 0 ? void 0 : e.keyCode) === 9; 7568 }; 7569 var isKeyForward = function isKeyForward2(e) { 7570 return isTabEvent(e) && !e.shiftKey; 7571 }; 7572 var isKeyBackward = function isKeyBackward2(e) { 7573 return isTabEvent(e) && e.shiftKey; 7574 }; 7575 var delay = function delay2(fn) { 7576 return setTimeout(fn, 0); 7577 }; 7578 var valueOrHandler = function valueOrHandler2(value) { 7579 for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 7580 params[_key - 1] = arguments[_key]; 7581 } 7582 return typeof value === "function" ? value.apply(void 0, params) : value; 7583 }; 7584 var getActualTarget = function getActualTarget2(event) { 7585 return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target; 7586 }; 7587 var internalTrapStack = []; 7588 var createFocusTrap = function createFocusTrap2(elements, userOptions) { 7589 var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document; 7590 var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack; 7591 var config = _objectSpread2({ 7592 returnFocusOnDeactivate: true, 7593 escapeDeactivates: true, 7594 delayInitialFocus: true, 7595 isolateSubtrees: false, 7596 isKeyForward, 7597 isKeyBackward 7598 }, userOptions); 7599 var state = { 7600 containers: [], 7601 containerGroups: [], 7602 tabbableGroups: [], 7603 adjacentElements: /* @__PURE__ */ new Set(), 7604 alreadySilent: /* @__PURE__ */ new Set(), 7605 nodeFocusedBeforeActivation: null, 7606 mostRecentlyFocusedNode: null, 7607 active: false, 7608 paused: false, 7609 manuallyPaused: false, 7610 delayInitialFocusTimer: void 0, 7611 recentNavEvent: void 0 7612 }; 7613 var trap; 7614 var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) { 7615 return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName]; 7616 }; 7617 var findContainerIndex = function findContainerIndex2(element, event) { 7618 var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === "function" ? event.composedPath() : void 0; 7619 return state.containerGroups.findIndex(function(_ref) { 7620 var container = _ref.container, tabbableNodes = _ref.tabbableNodes; 7621 return container.contains(element) || (composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function(node) { 7622 return node === element; 7623 }); 7624 }); 7625 }; 7626 var getNodeForOption = function getNodeForOption2(optionName) { 7627 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; 7628 var optionValue = config[optionName]; 7629 if (typeof optionValue === "function") { 7630 optionValue = optionValue.apply(void 0, _toConsumableArray(params)); 7631 } 7632 if (optionValue === true) { 7633 optionValue = void 0; 7634 } 7635 if (!optionValue) { 7636 if (optionValue === void 0 || optionValue === false) { 7637 return optionValue; 7638 } 7639 throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node")); 7640 } 7641 var node = optionValue; 7642 if (typeof optionValue === "string") { 7643 try { 7644 node = doc.querySelector(optionValue); 7645 } catch (err) { 7646 throw new Error("`".concat(optionName, '` appears to be an invalid selector; error="').concat(err.message, '"')); 7647 } 7648 if (!node) { 7649 if (!hasFallback) { 7650 throw new Error("`".concat(optionName, "` as selector refers to no known node")); 7651 } 7652 } 7653 } 7654 return node; 7655 }; 7656 var getInitialFocusNode = function getInitialFocusNode2() { 7657 var node = getNodeForOption("initialFocus", { 7658 hasFallback: true 7659 }); 7660 if (node === false) { 7661 return false; 7662 } 7663 if (node === void 0 || node && !isFocusable(node, config.tabbableOptions)) { 7664 if (findContainerIndex(doc.activeElement) >= 0) { 7665 node = doc.activeElement; 7666 } else { 7667 var firstTabbableGroup = state.tabbableGroups[0]; 7668 var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; 7669 node = firstTabbableNode || getNodeForOption("fallbackFocus"); 7670 } 7671 } else if (node === null) { 7672 node = getNodeForOption("fallbackFocus"); 7673 } 7674 if (!node) { 7675 throw new Error("Your focus-trap needs to have at least one focusable element"); 7676 } 7677 return node; 7678 }; 7679 var updateTabbableNodes = function updateTabbableNodes2() { 7680 state.containerGroups = state.containers.map(function(container) { 7681 var tabbableNodes = tabbable(container, config.tabbableOptions); 7682 var focusableNodes = focusable(container, config.tabbableOptions); 7683 var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : void 0; 7684 var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : void 0; 7685 var firstDomTabbableNode = focusableNodes.find(function(node) { 7686 return isTabbable(node); 7687 }); 7688 var lastDomTabbableNode = focusableNodes.slice().reverse().find(function(node) { 7689 return isTabbable(node); 7690 }); 7691 var posTabIndexesFound = !!tabbableNodes.find(function(node) { 7692 return getTabIndex(node) > 0; 7693 }); 7694 return { 7695 container, 7696 tabbableNodes, 7697 focusableNodes, 7698 posTabIndexesFound, 7699 firstTabbableNode, 7700 lastTabbableNode, 7701 firstDomTabbableNode, 7702 lastDomTabbableNode, 7703 nextTabbableNode: function nextTabbableNode(node) { 7704 var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; 7705 var nodeIdx = tabbableNodes.indexOf(node); 7706 if (nodeIdx < 0) { 7707 if (forward) { 7708 return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function(el) { 7709 return isTabbable(el); 7710 }); 7711 } 7712 return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function(el) { 7713 return isTabbable(el); 7714 }); 7715 } 7716 return tabbableNodes[nodeIdx + (forward ? 1 : -1)]; 7717 } 7718 }; 7719 }); 7720 state.tabbableGroups = state.containerGroups.filter(function(group) { 7721 return group.tabbableNodes.length > 0; 7722 }); 7723 if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) { 7724 throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times"); 7725 } 7726 if (state.containerGroups.find(function(g) { 7727 return g.posTabIndexesFound; 7728 }) && state.containerGroups.length > 1) { 7729 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."); 7730 } 7731 }; 7732 var _getActiveElement = function getActiveElement(el) { 7733 var activeElement = el.activeElement; 7734 if (!activeElement) { 7735 return; 7736 } 7737 if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) { 7738 return _getActiveElement(activeElement.shadowRoot); 7739 } 7740 return activeElement; 7741 }; 7742 var _tryFocus = function tryFocus(node) { 7743 if (node === false) { 7744 return; 7745 } 7746 if (node === _getActiveElement(document)) { 7747 return; 7748 } 7749 if (!node || !node.focus) { 7750 _tryFocus(getInitialFocusNode()); 7751 return; 7752 } 7753 node.focus({ 7754 preventScroll: !!config.preventScroll 7755 }); 7756 state.mostRecentlyFocusedNode = node; 7757 if (isSelectableInput(node)) { 7758 node.select(); 7759 } 7760 }; 7761 var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) { 7762 var node = getNodeForOption("setReturnFocus", { 7763 params: [previousActiveElement] 7764 }); 7765 return node ? node : node === false ? false : previousActiveElement; 7766 }; 7767 var findNextNavNode = function findNextNavNode2(_ref3) { 7768 var target = _ref3.target, event = _ref3.event, _ref3$isBackward = _ref3.isBackward, isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward; 7769 target = target || getActualTarget(event); 7770 updateTabbableNodes(); 7771 var destinationNode = null; 7772 if (state.tabbableGroups.length > 0) { 7773 var containerIndex = findContainerIndex(target, event); 7774 var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0; 7775 if (containerIndex < 0) { 7776 if (isBackward) { 7777 destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode; 7778 } else { 7779 destinationNode = state.tabbableGroups[0].firstTabbableNode; 7780 } 7781 } else if (isBackward) { 7782 var startOfGroupIndex = state.tabbableGroups.findIndex(function(_ref4) { 7783 var firstTabbableNode = _ref4.firstTabbableNode; 7784 return target === firstTabbableNode; 7785 }); 7786 if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) { 7787 startOfGroupIndex = containerIndex; 7788 } 7789 if (startOfGroupIndex >= 0) { 7790 var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1; 7791 var destinationGroup = state.tabbableGroups[destinationGroupIndex]; 7792 destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode; 7793 } else if (!isTabEvent(event)) { 7794 destinationNode = containerGroup.nextTabbableNode(target, false); 7795 } 7796 } else { 7797 var lastOfGroupIndex = state.tabbableGroups.findIndex(function(_ref5) { 7798 var lastTabbableNode = _ref5.lastTabbableNode; 7799 return target === lastTabbableNode; 7800 }); 7801 if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) { 7802 lastOfGroupIndex = containerIndex; 7803 } 7804 if (lastOfGroupIndex >= 0) { 7805 var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1; 7806 var _destinationGroup = state.tabbableGroups[_destinationGroupIndex]; 7807 destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode; 7808 } else if (!isTabEvent(event)) { 7809 destinationNode = containerGroup.nextTabbableNode(target); 7810 } 7811 } 7812 } else { 7813 destinationNode = getNodeForOption("fallbackFocus"); 7814 } 7815 return destinationNode; 7816 }; 7817 var checkPointerDown = function checkPointerDown2(e) { 7818 var target = getActualTarget(e); 7819 if (findContainerIndex(target, e) >= 0) { 7820 return; 7821 } 7822 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 7823 trap.deactivate({ 7824 returnFocus: config.returnFocusOnDeactivate 7825 }); 7826 return; 7827 } 7828 if (valueOrHandler(config.allowOutsideClick, e)) { 7829 return; 7830 } 7831 e.preventDefault(); 7832 }; 7833 var checkFocusIn = function checkFocusIn2(event) { 7834 var target = getActualTarget(event); 7835 var targetContained = findContainerIndex(target, event) >= 0; 7836 if (targetContained || target instanceof Document) { 7837 if (targetContained) { 7838 state.mostRecentlyFocusedNode = target; 7839 } 7840 } else { 7841 event.stopImmediatePropagation(); 7842 var nextNode; 7843 var navAcrossContainers = true; 7844 if (state.mostRecentlyFocusedNode) { 7845 if (getTabIndex(state.mostRecentlyFocusedNode) > 0) { 7846 var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode); 7847 var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes; 7848 if (tabbableNodes.length > 0) { 7849 var mruTabIdx = tabbableNodes.findIndex(function(node) { 7850 return node === state.mostRecentlyFocusedNode; 7851 }); 7852 if (mruTabIdx >= 0) { 7853 if (config.isKeyForward(state.recentNavEvent)) { 7854 if (mruTabIdx + 1 < tabbableNodes.length) { 7855 nextNode = tabbableNodes[mruTabIdx + 1]; 7856 navAcrossContainers = false; 7857 } 7858 } else { 7859 if (mruTabIdx - 1 >= 0) { 7860 nextNode = tabbableNodes[mruTabIdx - 1]; 7861 navAcrossContainers = false; 7862 } 7863 } 7864 } 7865 } 7866 } else { 7867 if (!state.containerGroups.some(function(g) { 7868 return g.tabbableNodes.some(function(n) { 7869 return getTabIndex(n) > 0; 7870 }); 7871 })) { 7872 navAcrossContainers = false; 7873 } 7874 } 7875 } else { 7876 navAcrossContainers = false; 7877 } 7878 if (navAcrossContainers) { 7879 nextNode = findNextNavNode({ 7880 target: state.mostRecentlyFocusedNode, 7881 isBackward: config.isKeyBackward(state.recentNavEvent) 7882 }); 7883 } 7884 if (nextNode) { 7885 _tryFocus(nextNode); 7886 } else { 7887 _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); 7888 } 7889 } 7890 state.recentNavEvent = void 0; 7891 }; 7892 var checkKeyNav = function checkKeyNav2(event) { 7893 var isBackward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; 7894 state.recentNavEvent = event; 7895 var destinationNode = findNextNavNode({ 7896 event, 7897 isBackward 7898 }); 7899 if (destinationNode) { 7900 if (isTabEvent(event)) { 7901 event.preventDefault(); 7902 } 7903 _tryFocus(destinationNode); 7904 } 7905 }; 7906 var checkTabKey = function checkTabKey2(event) { 7907 if (config.isKeyForward(event) || config.isKeyBackward(event)) { 7908 checkKeyNav(event, config.isKeyBackward(event)); 7909 } 7910 }; 7911 var checkEscapeKey = function checkEscapeKey2(event) { 7912 if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) { 7913 event.preventDefault(); 7914 trap.deactivate(); 7915 } 7916 }; 7917 var checkClick = function checkClick2(e) { 7918 var target = getActualTarget(e); 7919 if (findContainerIndex(target, e) >= 0) { 7920 return; 7921 } 7922 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 7923 return; 7924 } 7925 if (valueOrHandler(config.allowOutsideClick, e)) { 7926 return; 7927 } 7928 e.preventDefault(); 7929 e.stopImmediatePropagation(); 7930 }; 7931 var addListeners = function addListeners2() { 7932 if (!state.active) { 7933 return Promise.resolve(); 7934 } 7935 activeFocusTraps.activateTrap(trapStack, trap); 7936 var promise; 7937 if (config.delayInitialFocus) { 7938 promise = new Promise(function(resolve) { 7939 state.delayInitialFocusTimer = delay(function() { 7940 _tryFocus(getInitialFocusNode()); 7941 resolve(); 7942 }); 7943 }); 7944 } else { 7945 promise = Promise.resolve(); 7946 _tryFocus(getInitialFocusNode()); 7947 } 7948 doc.addEventListener("focusin", checkFocusIn, true); 7949 doc.addEventListener("mousedown", checkPointerDown, { 7950 capture: true, 7951 passive: false 7952 }); 7953 doc.addEventListener("touchstart", checkPointerDown, { 7954 capture: true, 7955 passive: false 7956 }); 7957 doc.addEventListener("click", checkClick, { 7958 capture: true, 7959 passive: false 7960 }); 7961 doc.addEventListener("keydown", checkTabKey, { 7962 capture: true, 7963 passive: false 7964 }); 7965 doc.addEventListener("keydown", checkEscapeKey); 7966 return promise; 7967 }; 7968 var collectAdjacentElements = function collectAdjacentElements2(containers) { 7969 if (state.active && !state.paused) { 7970 trap._setSubtreeIsolation(false); 7971 } 7972 state.adjacentElements.clear(); 7973 state.alreadySilent.clear(); 7974 var containerAncestors = /* @__PURE__ */ new Set(); 7975 var adjacentElements = /* @__PURE__ */ new Set(); 7976 var _iterator = _createForOfIteratorHelper(containers), _step; 7977 try { 7978 for (_iterator.s(); !(_step = _iterator.n()).done; ) { 7979 var container = _step.value; 7980 containerAncestors.add(container); 7981 var insideShadowRoot = typeof ShadowRoot !== "undefined" && container.getRootNode() instanceof ShadowRoot; 7982 var current = container; 7983 while (current) { 7984 containerAncestors.add(current); 7985 var parent = current.parentElement; 7986 var siblings = []; 7987 if (parent) { 7988 siblings = parent.children; 7989 } else if (!parent && insideShadowRoot) { 7990 siblings = current.getRootNode().children; 7991 parent = current.getRootNode().host; 7992 insideShadowRoot = typeof ShadowRoot !== "undefined" && parent.getRootNode() instanceof ShadowRoot; 7993 } 7994 var _iterator2 = _createForOfIteratorHelper(siblings), _step2; 7995 try { 7996 for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { 7997 var child = _step2.value; 7998 adjacentElements.add(child); 7999 } 8000 } catch (err) { 8001 _iterator2.e(err); 8002 } finally { 8003 _iterator2.f(); 8004 } 8005 current = parent; 8006 } 8007 } 8008 } catch (err) { 8009 _iterator.e(err); 8010 } finally { 8011 _iterator.f(); 8012 } 8013 containerAncestors.forEach(function(el) { 8014 adjacentElements["delete"](el); 8015 }); 8016 state.adjacentElements = adjacentElements; 8017 }; 8018 var removeListeners = function removeListeners2() { 8019 if (!state.active) { 8020 return; 8021 } 8022 doc.removeEventListener("focusin", checkFocusIn, true); 8023 doc.removeEventListener("mousedown", checkPointerDown, true); 8024 doc.removeEventListener("touchstart", checkPointerDown, true); 8025 doc.removeEventListener("click", checkClick, true); 8026 doc.removeEventListener("keydown", checkTabKey, true); 8027 doc.removeEventListener("keydown", checkEscapeKey); 8028 return trap; 8029 }; 8030 var checkDomRemoval = function checkDomRemoval2(mutations) { 8031 var isFocusedNodeRemoved = mutations.some(function(mutation) { 8032 var removedNodes = Array.from(mutation.removedNodes); 8033 return removedNodes.some(function(node) { 8034 return node === state.mostRecentlyFocusedNode; 8035 }); 8036 }); 8037 if (isFocusedNodeRemoved) { 8038 _tryFocus(getInitialFocusNode()); 8039 } 8040 }; 8041 var mutationObserver = typeof window !== "undefined" && "MutationObserver" in window ? new MutationObserver(checkDomRemoval) : void 0; 8042 var updateObservedNodes = function updateObservedNodes2() { 8043 if (!mutationObserver) { 8044 return; 8045 } 8046 mutationObserver.disconnect(); 8047 if (state.active && !state.paused) { 8048 state.containers.map(function(container) { 8049 mutationObserver.observe(container, { 8050 subtree: true, 8051 childList: true 8052 }); 8053 }); 8054 } 8055 }; 8056 trap = { 8057 get active() { 8058 return state.active; 8059 }, 8060 get paused() { 8061 return state.paused; 8062 }, 8063 activate: function activate(activateOptions) { 8064 if (state.active) { 8065 return this; 8066 } 8067 var onActivate = getOption(activateOptions, "onActivate"); 8068 var onPostActivate = getOption(activateOptions, "onPostActivate"); 8069 var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap"); 8070 var preexistingTrap = activeFocusTraps.getActiveTrap(trapStack); 8071 var revertState = false; 8072 if (preexistingTrap && !preexistingTrap.paused) { 8073 var _preexistingTrap$_set; 8074 (_preexistingTrap$_set = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set === void 0 || _preexistingTrap$_set.call(preexistingTrap, false); 8075 revertState = true; 8076 } 8077 try { 8078 if (!checkCanFocusTrap) { 8079 updateTabbableNodes(); 8080 } 8081 state.active = true; 8082 state.paused = false; 8083 state.nodeFocusedBeforeActivation = _getActiveElement(doc); 8084 onActivate === null || onActivate === void 0 || onActivate(); 8085 var finishActivation = /* @__PURE__ */ function() { 8086 var _ref6 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee() { 8087 return _regenerator().w(function(_context) { 8088 while (1) 8089 switch (_context.n) { 8090 case 0: 8091 if (checkCanFocusTrap) { 8092 updateTabbableNodes(); 8093 } 8094 _context.n = 1; 8095 return addListeners(); 8096 case 1: 8097 trap._setSubtreeIsolation(true); 8098 updateObservedNodes(); 8099 onPostActivate === null || onPostActivate === void 0 || onPostActivate(); 8100 case 2: 8101 return _context.a(2); 8102 } 8103 }, _callee); 8104 })); 8105 return function finishActivation2() { 8106 return _ref6.apply(this, arguments); 8107 }; 8108 }(); 8109 if (checkCanFocusTrap) { 8110 checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation); 8111 return this; 8112 } 8113 finishActivation(); 8114 } catch (error2) { 8115 if (preexistingTrap === activeFocusTraps.getActiveTrap(trapStack) && revertState) { 8116 var _preexistingTrap$_set2; 8117 (_preexistingTrap$_set2 = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set2 === void 0 || _preexistingTrap$_set2.call(preexistingTrap, true); 8118 } 8119 throw error2; 8120 } 8121 return this; 8122 }, 8123 deactivate: function deactivate(deactivateOptions) { 8124 if (!state.active) { 8125 return this; 8126 } 8127 var options = _objectSpread2({ 8128 onDeactivate: config.onDeactivate, 8129 onPostDeactivate: config.onPostDeactivate, 8130 checkCanReturnFocus: config.checkCanReturnFocus 8131 }, deactivateOptions); 8132 clearTimeout(state.delayInitialFocusTimer); 8133 state.delayInitialFocusTimer = void 0; 8134 if (!state.paused) { 8135 trap._setSubtreeIsolation(false); 8136 } 8137 state.alreadySilent.clear(); 8138 removeListeners(); 8139 state.active = false; 8140 state.paused = false; 8141 updateObservedNodes(); 8142 activeFocusTraps.deactivateTrap(trapStack, trap); 8143 var onDeactivate = getOption(options, "onDeactivate"); 8144 var onPostDeactivate = getOption(options, "onPostDeactivate"); 8145 var checkCanReturnFocus = getOption(options, "checkCanReturnFocus"); 8146 var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate"); 8147 onDeactivate === null || onDeactivate === void 0 || onDeactivate(); 8148 var finishDeactivation = function finishDeactivation2() { 8149 delay(function() { 8150 if (returnFocus) { 8151 _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)); 8152 } 8153 onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate(); 8154 }); 8155 }; 8156 if (returnFocus && checkCanReturnFocus) { 8157 checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation); 8158 return this; 8159 } 8160 finishDeactivation(); 8161 return this; 8162 }, 8163 pause: function pause(pauseOptions) { 8164 if (!state.active) { 8165 return this; 8166 } 8167 state.manuallyPaused = true; 8168 return this._setPausedState(true, pauseOptions); 8169 }, 8170 unpause: function unpause(unpauseOptions) { 8171 if (!state.active) { 8172 return this; 8173 } 8174 state.manuallyPaused = false; 8175 if (trapStack[trapStack.length - 1] !== this) { 8176 return this; 8177 } 8178 return this._setPausedState(false, unpauseOptions); 8179 }, 8180 updateContainerElements: function updateContainerElements(containerElements) { 8181 var elementsAsArray = [].concat(containerElements).filter(Boolean); 8182 state.containers = elementsAsArray.map(function(element) { 8183 return typeof element === "string" ? doc.querySelector(element) : element; 8184 }); 8185 if (config.isolateSubtrees) { 8186 collectAdjacentElements(state.containers); 8187 } 8188 if (state.active) { 8189 updateTabbableNodes(); 8190 if (!state.paused) { 8191 trap._setSubtreeIsolation(true); 8192 } 8193 } 8194 updateObservedNodes(); 8195 return this; 8196 } 8197 }; 8198 Object.defineProperties(trap, { 8199 _isManuallyPaused: { 8200 value: function value() { 8201 return state.manuallyPaused; 8202 } 8203 }, 8204 _setPausedState: { 8205 value: function value(paused, options) { 8206 if (state.paused === paused) { 8207 return this; 8208 } 8209 state.paused = paused; 8210 if (paused) { 8211 var onPause = getOption(options, "onPause"); 8212 var onPostPause = getOption(options, "onPostPause"); 8213 onPause === null || onPause === void 0 || onPause(); 8214 removeListeners(); 8215 trap._setSubtreeIsolation(false); 8216 updateObservedNodes(); 8217 onPostPause === null || onPostPause === void 0 || onPostPause(); 8218 } else { 8219 var onUnpause = getOption(options, "onUnpause"); 8220 var onPostUnpause = getOption(options, "onPostUnpause"); 8221 onUnpause === null || onUnpause === void 0 || onUnpause(); 8222 var finishUnpause = /* @__PURE__ */ function() { 8223 var _ref7 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee2() { 8224 return _regenerator().w(function(_context2) { 8225 while (1) 8226 switch (_context2.n) { 8227 case 0: 8228 updateTabbableNodes(); 8229 _context2.n = 1; 8230 return addListeners(); 8231 case 1: 8232 trap._setSubtreeIsolation(true); 8233 updateObservedNodes(); 8234 onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause(); 8235 case 2: 8236 return _context2.a(2); 8237 } 8238 }, _callee2); 8239 })); 8240 return function finishUnpause2() { 8241 return _ref7.apply(this, arguments); 8242 }; 8243 }(); 8244 finishUnpause(); 8245 } 8246 return this; 8247 } 8248 }, 8249 _setSubtreeIsolation: { 8250 value: function value(isEnabled) { 8251 if (config.isolateSubtrees) { 8252 state.adjacentElements.forEach(function(el) { 8253 var _el$getAttribute; 8254 if (isEnabled) { 8255 switch (config.isolateSubtrees) { 8256 case "aria-hidden": 8257 if (el.ariaHidden === "true" || ((_el$getAttribute = el.getAttribute("aria-hidden")) === null || _el$getAttribute === void 0 ? void 0 : _el$getAttribute.toLowerCase()) === "true") { 8258 state.alreadySilent.add(el); 8259 } 8260 el.setAttribute("aria-hidden", "true"); 8261 break; 8262 default: 8263 if (el.inert || el.hasAttribute("inert")) { 8264 state.alreadySilent.add(el); 8265 } 8266 el.setAttribute("inert", true); 8267 break; 8268 } 8269 } else { 8270 if (state.alreadySilent.has(el)) 8271 ; 8272 else { 8273 switch (config.isolateSubtrees) { 8274 case "aria-hidden": 8275 el.removeAttribute("aria-hidden"); 8276 break; 8277 default: 8278 el.removeAttribute("inert"); 8279 break; 8280 } 8281 } 8282 } 8283 }); 8284 } 8285 } 8286 } 8287 }); 8288 trap.updateContainerElements(elements); 8289 return trap; 8290 }; 8291 function src_default3(Alpine3) { 8292 let lastFocused; 8293 let currentFocused; 8294 window.addEventListener("focusin", () => { 8295 lastFocused = currentFocused; 8296 currentFocused = document.activeElement; 8297 }); 8298 Alpine3.magic("focus", (el) => { 8299 let within = el; 8300 return { 8301 __noscroll: false, 8302 __wrapAround: false, 8303 within(el2) { 8304 within = el2; 8305 return this; 8306 }, 8307 withoutScrolling() { 8308 this.__noscroll = true; 8309 return this; 8310 }, 8311 noscroll() { 8312 this.__noscroll = true; 8313 return this; 8314 }, 8315 withWrapAround() { 8316 this.__wrapAround = true; 8317 return this; 8318 }, 8319 wrap() { 8320 return this.withWrapAround(); 8321 }, 8322 focusable(el2) { 8323 return isFocusable(el2); 8324 }, 8325 previouslyFocused() { 8326 return lastFocused; 8327 }, 8328 lastFocused() { 8329 return lastFocused; 8330 }, 8331 focused() { 8332 return currentFocused; 8333 }, 8334 focusables() { 8335 if (Array.isArray(within)) 8336 return within; 8337 return focusable(within, { displayCheck: "none" }); 8338 }, 8339 all() { 8340 return this.focusables(); 8341 }, 8342 isFirst(el2) { 8343 let els2 = this.all(); 8344 return els2[0] && els2[0].isSameNode(el2); 8345 }, 8346 isLast(el2) { 8347 let els2 = this.all(); 8348 return els2.length && els2.slice(-1)[0].isSameNode(el2); 8349 }, 8350 getFirst() { 8351 return this.all()[0]; 8352 }, 8353 getLast() { 8354 return this.all().slice(-1)[0]; 8355 }, 8356 getNext() { 8357 let list = this.all(); 8358 let current = document.activeElement; 8359 if (list.indexOf(current) === -1) 8360 return; 8361 if (this.__wrapAround && list.indexOf(current) === list.length - 1) { 8362 return list[0]; 8363 } 8364 return list[list.indexOf(current) + 1]; 8365 }, 8366 getPrevious() { 8367 let list = this.all(); 8368 let current = document.activeElement; 8369 if (list.indexOf(current) === -1) 8370 return; 8371 if (this.__wrapAround && list.indexOf(current) === 0) { 8372 return list.slice(-1)[0]; 8373 } 8374 return list[list.indexOf(current) - 1]; 8375 }, 8376 first() { 8377 this.focus(this.getFirst()); 8378 }, 8379 last() { 8380 this.focus(this.getLast()); 8381 }, 8382 next() { 8383 this.focus(this.getNext()); 8384 }, 8385 previous() { 8386 this.focus(this.getPrevious()); 8387 }, 8388 prev() { 8389 return this.previous(); 8390 }, 8391 focus(el2) { 8392 if (!el2) 8393 return; 8394 setTimeout(() => { 8395 if (!el2.hasAttribute("tabindex")) 8396 el2.setAttribute("tabindex", "0"); 8397 el2.focus({ preventScroll: this.__noscroll }); 8398 }); 8399 } 8400 }; 8401 }); 8402 Alpine3.directive("trap", Alpine3.skipDuringClone( 8403 (el, { expression, modifiers }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 8404 let evaluator = evaluateLater2(expression); 8405 let oldValue = false; 8406 let options = { 8407 escapeDeactivates: false, 8408 allowOutsideClick: true, 8409 fallbackFocus: () => el 8410 }; 8411 let undoInert = () => { 8412 }; 8413 if (modifiers.includes("noautofocus")) { 8414 options.initialFocus = false; 8415 } else { 8416 let autofocusEl = el.querySelector("[autofocus]"); 8417 if (autofocusEl) 8418 options.initialFocus = autofocusEl; 8419 } 8420 if (modifiers.includes("inert")) { 8421 options.onPostActivate = () => { 8422 Alpine3.nextTick(() => { 8423 undoInert = setInert(el); 8424 }); 8425 }; 8426 } 8427 let trap = createFocusTrap(el, options); 8428 let undoDisableScrolling = () => { 8429 }; 8430 const releaseFocus = () => { 8431 undoInert(); 8432 undoInert = () => { 8433 }; 8434 undoDisableScrolling(); 8435 undoDisableScrolling = () => { 8436 }; 8437 trap.deactivate({ 8438 returnFocus: !modifiers.includes("noreturn") 8439 }); 8440 }; 8441 effect3(() => evaluator((value) => { 8442 if (oldValue === value) 8443 return; 8444 if (value && !oldValue) { 8445 if (modifiers.includes("noscroll")) 8446 undoDisableScrolling = disableScrolling(); 8447 setTimeout(() => { 8448 trap.activate(); 8449 }, 15); 8450 } 8451 if (!value && oldValue) { 8452 releaseFocus(); 8453 } 8454 oldValue = !!value; 8455 })); 8456 cleanup2(releaseFocus); 8457 }, 8458 (el, { expression, modifiers }, { evaluate: evaluate3 }) => { 8459 if (modifiers.includes("inert") && evaluate3(expression)) 8460 setInert(el); 8461 } 8462 )); 8463 } 8464 function setInert(el) { 8465 let undos = []; 8466 crawlSiblingsUp(el, (sibling) => { 8467 let cache = sibling.hasAttribute("aria-hidden"); 8468 sibling.setAttribute("aria-hidden", "true"); 8469 undos.push(() => cache || sibling.removeAttribute("aria-hidden")); 8470 }); 8471 return () => { 8472 while (undos.length) 8473 undos.pop()(); 8474 }; 8475 } 8476 function crawlSiblingsUp(el, callback) { 8477 if (el.isSameNode(document.body) || !el.parentNode) 8478 return; 8479 Array.from(el.parentNode.children).forEach((sibling) => { 8480 if (sibling.isSameNode(el)) { 8481 crawlSiblingsUp(el.parentNode, callback); 8482 } else { 8483 callback(sibling); 8484 } 8485 }); 8486 } 8487 function disableScrolling() { 8488 let overflow = document.documentElement.style.overflow; 8489 let paddingRight = document.documentElement.style.paddingRight; 8490 let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 8491 let scrollbarGutter = window.getComputedStyle(document.documentElement).scrollbarGutter; 8492 document.documentElement.style.overflow = "hidden"; 8493 if (scrollbarGutter && scrollbarGutter !== "auto") { 8494 return () => { 8495 document.documentElement.style.overflow = overflow; 8496 }; 8497 } 8498 document.documentElement.style.paddingRight = `${scrollbarWidth}px`; 8499 return () => { 8500 document.documentElement.style.overflow = overflow; 8501 document.documentElement.style.paddingRight = paddingRight; 8502 }; 8503 } 8504 var module_default3 = src_default3; 8505 8506
vendor: 1,953 bytes, lines 8506-8568
8506// node_modules/@alpinejs/persist/dist/module.esm.js 8507 function src_default4(Alpine3) { 8508 let persist = () => { 8509 let alias; 8510 let storage; 8511 try { 8512 storage = localStorage; 8513 } catch (e) { 8514 console.error(e); 8515 console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable."); 8516 let dummy = /* @__PURE__ */ new Map(); 8517 storage = { 8518 getItem: dummy.get.bind(dummy), 8519 setItem: dummy.set.bind(dummy) 8520 }; 8521 } 8522 return Alpine3.interceptor((initialValue, getter, setter, path, key) => { 8523 let lookup = alias || `_x_${path}`; 8524 let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue; 8525 setter(initial); 8526 Alpine3.effect(() => { 8527 let value = getter(); 8528 storageSet(lookup, value, storage); 8529 setter(value); 8530 }); 8531 return initial; 8532 }, (func) => { 8533 func.as = (key) => { 8534 alias = key; 8535 return func; 8536 }, func.using = (target) => { 8537 storage = target; 8538 return func; 8539 }; 8540 }); 8541 }; 8542 Object.defineProperty(Alpine3, "$persist", { get: () => persist() }); 8543 Alpine3.magic("persist", persist); 8544 Alpine3.persist = (key, { get: get3, set: set3 }, storage = localStorage) => { 8545 let initial = storageHas(key, storage) ? storageGet(key, storage) : get3(); 8546 set3(initial); 8547 Alpine3.effect(() => { 8548 let value = get3(); 8549 storageSet(key, value, storage); 8550 set3(value); 8551 }); 8552 }; 8553 } 8554 function storageHas(key, storage) { 8555 return storage.getItem(key) !== null; 8556 } 8557 function storageGet(key, storage) { 8558 let value = storage.getItem(key); 8559 if (value === void 0) 8560 return; 8561 return JSON.parse(value); 8562 } 8563 function storageSet(key, value, storage) { 8564 storage.setItem(key, JSON.stringify(value)); 8565 } 8566 var module_default4 = src_default4; 8567 8568
vendor: 1,854 bytes, lines 8568-8623
8568// node_modules/@alpinejs/intersect/dist/module.esm.js 8569 function src_default5(Alpine3) { 8570 Alpine3.directive("intersect", Alpine3.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 8571 let evaluate3 = evaluateLater2(expression); 8572 let options = { 8573 rootMargin: getRootMargin(modifiers), 8574 threshold: getThreshold(modifiers) 8575 }; 8576 let observer2 = new IntersectionObserver((entries) => { 8577 entries.forEach((entry) => { 8578 if (entry.isIntersecting === (value === "leave")) 8579 return; 8580 evaluate3(); 8581 modifiers.includes("once") && observer2.disconnect(); 8582 }); 8583 }, options); 8584 observer2.observe(el); 8585 cleanup2(() => { 8586 observer2.disconnect(); 8587 }); 8588 })); 8589 } 8590 function getThreshold(modifiers) { 8591 if (modifiers.includes("full")) 8592 return 0.99; 8593 if (modifiers.includes("half")) 8594 return 0.5; 8595 if (!modifiers.includes("threshold")) 8596 return 0; 8597 let threshold = modifiers[modifiers.indexOf("threshold") + 1]; 8598 if (threshold === "100") 8599 return 1; 8600 if (threshold === "0") 8601 return 0; 8602 return Number(`.${threshold}`); 8603 } 8604 function getLengthValue(rawValue) { 8605 let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/); 8606 return match ? match[1] + (match[2] || "px") : void 0; 8607 } 8608 function getRootMargin(modifiers) { 8609 const key = "margin"; 8610 const fallback2 = "0px 0px 0px 0px"; 8611 const index2 = modifiers.indexOf(key); 8612 if (index2 === -1) 8613 return fallback2; 8614 let values = []; 8615 for (let i = 1; i < 5; i++) { 8616 values.push(getLengthValue(modifiers[index2 + i] || "")); 8617 } 8618 values = values.filter((v) => v !== void 0); 8619 return values.length ? values.join(" ").trim() : fallback2; 8620 } 8621 var module_default5 = src_default5; 8622 8623
vendor: 89,203 bytes, lines 8623-10968
8623// node_modules/@alpinejs/sort/dist/module.esm.js 8624 function ownKeys3(object, enumerableOnly) { 8625 var keys = Object.keys(object); 8626 if (Object.getOwnPropertySymbols) { 8627 var symbols = Object.getOwnPropertySymbols(object); 8628 if (enumerableOnly) { 8629 symbols = symbols.filter(function(sym) { 8630 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 8631 }); 8632 } 8633 keys.push.apply(keys, symbols); 8634 } 8635 return keys; 8636 } 8637 function _objectSpread22(target) { 8638 for (var i = 1; i < arguments.length; i++) { 8639 var source = arguments[i] != null ? arguments[i] : {}; 8640 if (i % 2) { 8641 ownKeys3(Object(source), true).forEach(function(key) { 8642 _defineProperty2(target, key, source[key]); 8643 }); 8644 } else if (Object.getOwnPropertyDescriptors) { 8645 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 8646 } else { 8647 ownKeys3(Object(source)).forEach(function(key) { 8648 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 8649 }); 8650 } 8651 } 8652 return target; 8653 } 8654 function _typeof(obj) { 8655 "@babel/helpers - typeof"; 8656 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 8657 _typeof = function(obj2) { 8658 return typeof obj2; 8659 }; 8660 } else { 8661 _typeof = function(obj2) { 8662 return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; 8663 }; 8664 } 8665 return _typeof(obj); 8666 } 8667 function _defineProperty2(obj, key, value) { 8668 if (key in obj) { 8669 Object.defineProperty(obj, key, { 8670 value, 8671 enumerable: true, 8672 configurable: true, 8673 writable: true 8674 }); 8675 } else { 8676 obj[key] = value; 8677 } 8678 return obj; 8679 } 8680 function _extends() { 8681 _extends = Object.assign || function(target) { 8682 for (var i = 1; i < arguments.length; i++) { 8683 var source = arguments[i]; 8684 for (var key in source) { 8685 if (Object.prototype.hasOwnProperty.call(source, key)) { 8686 target[key] = source[key]; 8687 } 8688 } 8689 } 8690 return target; 8691 }; 8692 return _extends.apply(this, arguments); 8693 } 8694 function _objectWithoutPropertiesLoose(source, excluded) { 8695 if (source == null) 8696 return {}; 8697 var target = {}; 8698 var sourceKeys = Object.keys(source); 8699 var key, i; 8700 for (i = 0; i < sourceKeys.length; i++) { 8701 key = sourceKeys[i]; 8702 if (excluded.indexOf(key) >= 0) 8703 continue; 8704 target[key] = source[key]; 8705 } 8706 return target; 8707 } 8708 function _objectWithoutProperties(source, excluded) { 8709 if (source == null) 8710 return {}; 8711 var target = _objectWithoutPropertiesLoose(source, excluded); 8712 var key, i; 8713 if (Object.getOwnPropertySymbols) { 8714 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 8715 for (i = 0; i < sourceSymbolKeys.length; i++) { 8716 key = sourceSymbolKeys[i]; 8717 if (excluded.indexOf(key) >= 0) 8718 continue; 8719 if (!Object.prototype.propertyIsEnumerable.call(source, key)) 8720 continue; 8721 target[key] = source[key]; 8722 } 8723 } 8724 return target; 8725 } 8726 var version = "1.15.2"; 8727 function userAgent(pattern) { 8728 if (typeof window !== "undefined" && window.navigator) { 8729 return !!/* @__PURE__ */ navigator.userAgent.match(pattern); 8730 } 8731 } 8732 var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); 8733 var Edge = userAgent(/Edge/i); 8734 var FireFox = userAgent(/firefox/i); 8735 var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); 8736 var IOS = userAgent(/iP(ad|od|hone)/i); 8737 var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); 8738 var captureMode = { 8739 capture: false, 8740 passive: false 8741 }; 8742 function on4(el, event, fn) { 8743 el.addEventListener(event, fn, !IE11OrLess && captureMode); 8744 } 8745 function off(el, event, fn) { 8746 el.removeEventListener(event, fn, !IE11OrLess && captureMode); 8747 } 8748 function matches2(el, selector) { 8749 if (!selector) 8750 return; 8751 selector[0] === ">" && (selector = selector.substring(1)); 8752 if (el) { 8753 try { 8754 if (el.matches) { 8755 return el.matches(selector); 8756 } else if (el.msMatchesSelector) { 8757 return el.msMatchesSelector(selector); 8758 } else if (el.webkitMatchesSelector) { 8759 return el.webkitMatchesSelector(selector); 8760 } 8761 } catch (_) { 8762 return false; 8763 } 8764 } 8765 return false; 8766 } 8767 function getParentOrHost(el) { 8768 return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; 8769 } 8770 function closest(el, selector, ctx, includeCTX) { 8771 if (el) { 8772 ctx = ctx || document; 8773 do { 8774 if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches2(el, selector) : matches2(el, selector)) || includeCTX && el === ctx) { 8775 return el; 8776 } 8777 if (el === ctx) 8778 break; 8779 } while (el = getParentOrHost(el)); 8780 } 8781 return null; 8782 } 8783 var R_SPACE = /\s+/g; 8784 function toggleClass(el, name, state) { 8785 if (el && name) { 8786 if (el.classList) { 8787 el.classList[state ? "add" : "remove"](name); 8788 } else { 8789 var className = (" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " "); 8790 el.className = (className + (state ? " " + name : "")).replace(R_SPACE, " "); 8791 } 8792 } 8793 } 8794 function css(el, prop, val) { 8795 var style = el && el.style; 8796 if (style) { 8797 if (val === void 0) { 8798 if (document.defaultView && document.defaultView.getComputedStyle) { 8799 val = document.defaultView.getComputedStyle(el, ""); 8800 } else if (el.currentStyle) { 8801 val = el.currentStyle; 8802 } 8803 return prop === void 0 ? val : val[prop]; 8804 } else { 8805 if (!(prop in style) && prop.indexOf("webkit") === -1) { 8806 prop = "-webkit-" + prop; 8807 } 8808 style[prop] = val + (typeof val === "string" ? "" : "px"); 8809 } 8810 } 8811 } 8812 function matrix(el, selfOnly) { 8813 var appliedTransforms = ""; 8814 if (typeof el === "string") { 8815 appliedTransforms = el; 8816 } else { 8817 do { 8818 var transform = css(el, "transform"); 8819 if (transform && transform !== "none") { 8820 appliedTransforms = transform + " " + appliedTransforms; 8821 } 8822 } while (!selfOnly && (el = el.parentNode)); 8823 } 8824 var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; 8825 return matrixFn && new matrixFn(appliedTransforms); 8826 } 8827 function find2(ctx, tagName, iterator) { 8828 if (ctx) { 8829 var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length; 8830 if (iterator) { 8831 for (; i < n; i++) { 8832 iterator(list[i], i); 8833 } 8834 } 8835 return list; 8836 } 8837 return []; 8838 } 8839 function getWindowScrollingElement() { 8840 var scrollingElement = document.scrollingElement; 8841 if (scrollingElement) { 8842 return scrollingElement; 8843 } else { 8844 return document.documentElement; 8845 } 8846 } 8847 function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { 8848 if (!el.getBoundingClientRect && el !== window) 8849 return; 8850 var elRect, top, left, bottom, right, height, width; 8851 if (el !== window && el.parentNode && el !== getWindowScrollingElement()) { 8852 elRect = el.getBoundingClientRect(); 8853 top = elRect.top; 8854 left = elRect.left; 8855 bottom = elRect.bottom; 8856 right = elRect.right; 8857 height = elRect.height; 8858 width = elRect.width; 8859 } else { 8860 top = 0; 8861 left = 0; 8862 bottom = window.innerHeight; 8863 right = window.innerWidth; 8864 height = window.innerHeight; 8865 width = window.innerWidth; 8866 } 8867 if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { 8868 container = container || el.parentNode; 8869 if (!IE11OrLess) { 8870 do { 8871 if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) { 8872 var containerRect = container.getBoundingClientRect(); 8873 top -= containerRect.top + parseInt(css(container, "border-top-width")); 8874 left -= containerRect.left + parseInt(css(container, "border-left-width")); 8875 bottom = top + elRect.height; 8876 right = left + elRect.width; 8877 break; 8878 } 8879 } while (container = container.parentNode); 8880 } 8881 } 8882 if (undoScale && el !== window) { 8883 var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d; 8884 if (elMatrix) { 8885 top /= scaleY; 8886 left /= scaleX; 8887 width /= scaleX; 8888 height /= scaleY; 8889 bottom = top + height; 8890 right = left + width; 8891 } 8892 } 8893 return { 8894 top, 8895 left, 8896 bottom, 8897 right, 8898 width, 8899 height 8900 }; 8901 } 8902 function isScrolledPast(el, elSide, parentSide) { 8903 var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide]; 8904 while (parent) { 8905 var parentSideVal = getRect(parent)[parentSide], visible = void 0; 8906 if (parentSide === "top" || parentSide === "left") { 8907 visible = elSideVal >= parentSideVal; 8908 } else { 8909 visible = elSideVal <= parentSideVal; 8910 } 8911 if (!visible) 8912 return parent; 8913 if (parent === getWindowScrollingElement()) 8914 break; 8915 parent = getParentAutoScrollElement(parent, false); 8916 } 8917 return false; 8918 } 8919 function getChild(el, childNum, options, includeDragEl) { 8920 var currentChild = 0, i = 0, children = el.children; 8921 while (i < children.length) { 8922 if (children[i].style.display !== "none" && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) { 8923 if (currentChild === childNum) { 8924 return children[i]; 8925 } 8926 currentChild++; 8927 } 8928 i++; 8929 } 8930 return null; 8931 } 8932 function lastChild(el, selector) { 8933 var last = el.lastElementChild; 8934 while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches2(last, selector))) { 8935 last = last.previousElementSibling; 8936 } 8937 return last || null; 8938 } 8939 function index(el, selector) { 8940 var index2 = 0; 8941 if (!el || !el.parentNode) { 8942 return -1; 8943 } 8944 while (el = el.previousElementSibling) { 8945 if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches2(el, selector))) { 8946 index2++; 8947 } 8948 } 8949 return index2; 8950 } 8951 function getRelativeScrollOffset(el) { 8952 var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement(); 8953 if (el) { 8954 do { 8955 var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d; 8956 offsetLeft += el.scrollLeft * scaleX; 8957 offsetTop += el.scrollTop * scaleY; 8958 } while (el !== winScroller && (el = el.parentNode)); 8959 } 8960 return [offsetLeft, offsetTop]; 8961 } 8962 function indexOfObject(arr, obj) { 8963 for (var i in arr) { 8964 if (!arr.hasOwnProperty(i)) 8965 continue; 8966 for (var key in obj) { 8967 if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) 8968 return Number(i); 8969 } 8970 } 8971 return -1; 8972 } 8973 function getParentAutoScrollElement(el, includeSelf) { 8974 if (!el || !el.getBoundingClientRect) 8975 return getWindowScrollingElement(); 8976 var elem = el; 8977 var gotSelf = false; 8978 do { 8979 if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { 8980 var elemCSS = css(elem); 8981 if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) { 8982 if (!elem.getBoundingClientRect || elem === document.body) 8983 return getWindowScrollingElement(); 8984 if (gotSelf || includeSelf) 8985 return elem; 8986 gotSelf = true; 8987 } 8988 } 8989 } while (elem = elem.parentNode); 8990 return getWindowScrollingElement(); 8991 } 8992 function extend(dst, src) { 8993 if (dst && src) { 8994 for (var key in src) { 8995 if (src.hasOwnProperty(key)) { 8996 dst[key] = src[key]; 8997 } 8998 } 8999 } 9000 return dst; 9001 } 9002 function isRectEqual(rect1, rect2) { 9003 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); 9004 } 9005 var _throttleTimeout; 9006 function throttle2(callback, ms) { 9007 return function() { 9008 if (!_throttleTimeout) { 9009 var args = arguments, _this = this; 9010 if (args.length === 1) { 9011 callback.call(_this, args[0]); 9012 } else { 9013 callback.apply(_this, args); 9014 } 9015 _throttleTimeout = setTimeout(function() { 9016 _throttleTimeout = void 0; 9017 }, ms); 9018 } 9019 }; 9020 } 9021 function cancelThrottle() { 9022 clearTimeout(_throttleTimeout); 9023 _throttleTimeout = void 0; 9024 } 9025 function scrollBy(el, x, y) { 9026 el.scrollLeft += x; 9027 el.scrollTop += y; 9028 } 9029 function clone2(el) { 9030 var Polymer = window.Polymer; 9031 var $ = window.jQuery || window.Zepto; 9032 if (Polymer && Polymer.dom) { 9033 return Polymer.dom(el).cloneNode(true); 9034 } else if ($) { 9035 return $(el).clone(true)[0]; 9036 } else { 9037 return el.cloneNode(true); 9038 } 9039 } 9040 function getChildContainingRectFromElement(container, options, ghostEl2) { 9041 var rect = {}; 9042 Array.from(container.children).forEach(function(child) { 9043 var _rect$left, _rect$top, _rect$right, _rect$bottom; 9044 if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl2) 9045 return; 9046 var childRect = getRect(child); 9047 rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left); 9048 rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top); 9049 rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right); 9050 rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom); 9051 }); 9052 rect.width = rect.right - rect.left; 9053 rect.height = rect.bottom - rect.top; 9054 rect.x = rect.left; 9055 rect.y = rect.top; 9056 return rect; 9057 } 9058 var expando = "Sortable" + new Date().getTime(); 9059 function AnimationStateManager() { 9060 var animationStates = [], animationCallbackId; 9061 return { 9062 captureAnimationState: function captureAnimationState() { 9063 animationStates = []; 9064 if (!this.options.animation) 9065 return; 9066 var children = [].slice.call(this.el.children); 9067 children.forEach(function(child) { 9068 if (css(child, "display") === "none" || child === Sortable.ghost) 9069 return; 9070 animationStates.push({ 9071 target: child, 9072 rect: getRect(child) 9073 }); 9074 var fromRect = _objectSpread22({}, animationStates[animationStates.length - 1].rect); 9075 if (child.thisAnimationDuration) { 9076 var childMatrix = matrix(child, true); 9077 if (childMatrix) { 9078 fromRect.top -= childMatrix.f; 9079 fromRect.left -= childMatrix.e; 9080 } 9081 } 9082 child.fromRect = fromRect; 9083 }); 9084 }, 9085 addAnimationState: function addAnimationState(state) { 9086 animationStates.push(state); 9087 }, 9088 removeAnimationState: function removeAnimationState(target) { 9089 animationStates.splice(indexOfObject(animationStates, { 9090 target 9091 }), 1); 9092 }, 9093 animateAll: function animateAll(callback) { 9094 var _this = this; 9095 if (!this.options.animation) { 9096 clearTimeout(animationCallbackId); 9097 if (typeof callback === "function") 9098 callback(); 9099 return; 9100 } 9101 var animating = false, animationTime = 0; 9102 animationStates.forEach(function(state) { 9103 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); 9104 if (targetMatrix) { 9105 toRect.top -= targetMatrix.f; 9106 toRect.left -= targetMatrix.e; 9107 } 9108 target.toRect = toRect; 9109 if (target.thisAnimationDuration) { 9110 if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { 9111 time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); 9112 } 9113 } 9114 if (!isRectEqual(toRect, fromRect)) { 9115 target.prevFromRect = fromRect; 9116 target.prevToRect = toRect; 9117 if (!time) { 9118 time = _this.options.animation; 9119 } 9120 _this.animate(target, animatingRect, toRect, time); 9121 } 9122 if (time) { 9123 animating = true; 9124 animationTime = Math.max(animationTime, time); 9125 clearTimeout(target.animationResetTimer); 9126 target.animationResetTimer = setTimeout(function() { 9127 target.animationTime = 0; 9128 target.prevFromRect = null; 9129 target.fromRect = null; 9130 target.prevToRect = null; 9131 target.thisAnimationDuration = null; 9132 }, time); 9133 target.thisAnimationDuration = time; 9134 } 9135 }); 9136 clearTimeout(animationCallbackId); 9137 if (!animating) { 9138 if (typeof callback === "function") 9139 callback(); 9140 } else { 9141 animationCallbackId = setTimeout(function() { 9142 if (typeof callback === "function") 9143 callback(); 9144 }, animationTime); 9145 } 9146 animationStates = []; 9147 }, 9148 animate: function animate(target, currentRect, toRect, duration) { 9149 if (duration) { 9150 css(target, "transition", ""); 9151 css(target, "transform", ""); 9152 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); 9153 target.animatingX = !!translateX; 9154 target.animatingY = !!translateY; 9155 css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)"); 9156 this.forRepaintDummy = repaint(target); 9157 css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : "")); 9158 css(target, "transform", "translate3d(0,0,0)"); 9159 typeof target.animated === "number" && clearTimeout(target.animated); 9160 target.animated = setTimeout(function() { 9161 css(target, "transition", ""); 9162 css(target, "transform", ""); 9163 target.animated = false; 9164 target.animatingX = false; 9165 target.animatingY = false; 9166 }, duration); 9167 } 9168 } 9169 }; 9170 } 9171 function repaint(target) { 9172 return target.offsetWidth; 9173 } 9174 function calculateRealTime(animatingRect, fromRect, toRect, options) { 9175 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; 9176 } 9177 var plugins = []; 9178 var defaults = { 9179 initializeByDefault: true 9180 }; 9181 var PluginManager = { 9182 mount: function mount(plugin2) { 9183 for (var option2 in defaults) { 9184 if (defaults.hasOwnProperty(option2) && !(option2 in plugin2)) { 9185 plugin2[option2] = defaults[option2]; 9186 } 9187 } 9188 plugins.forEach(function(p) { 9189 if (p.pluginName === plugin2.pluginName) { 9190 throw "Sortable: Cannot mount plugin ".concat(plugin2.pluginName, " more than once"); 9191 } 9192 }); 9193 plugins.push(plugin2); 9194 }, 9195 pluginEvent: function pluginEvent(eventName, sortable, evt) { 9196 var _this = this; 9197 this.eventCanceled = false; 9198 evt.cancel = function() { 9199 _this.eventCanceled = true; 9200 }; 9201 var eventNameGlobal = eventName + "Global"; 9202 plugins.forEach(function(plugin2) { 9203 if (!sortable[plugin2.pluginName]) 9204 return; 9205 if (sortable[plugin2.pluginName][eventNameGlobal]) { 9206 sortable[plugin2.pluginName][eventNameGlobal](_objectSpread22({ 9207 sortable 9208 }, evt)); 9209 } 9210 if (sortable.options[plugin2.pluginName] && sortable[plugin2.pluginName][eventName]) { 9211 sortable[plugin2.pluginName][eventName](_objectSpread22({ 9212 sortable 9213 }, evt)); 9214 } 9215 }); 9216 }, 9217 initializePlugins: function initializePlugins(sortable, el, defaults2, options) { 9218 plugins.forEach(function(plugin2) { 9219 var pluginName = plugin2.pluginName; 9220 if (!sortable.options[pluginName] && !plugin2.initializeByDefault) 9221 return; 9222 var initialized = new plugin2(sortable, el, sortable.options); 9223 initialized.sortable = sortable; 9224 initialized.options = sortable.options; 9225 sortable[pluginName] = initialized; 9226 _extends(defaults2, initialized.defaults); 9227 }); 9228 for (var option2 in sortable.options) { 9229 if (!sortable.options.hasOwnProperty(option2)) 9230 continue; 9231 var modified = this.modifyOption(sortable, option2, sortable.options[option2]); 9232 if (typeof modified !== "undefined") { 9233 sortable.options[option2] = modified; 9234 } 9235 } 9236 }, 9237 getEventProperties: function getEventProperties(name, sortable) { 9238 var eventProperties = {}; 9239 plugins.forEach(function(plugin2) { 9240 if (typeof plugin2.eventProperties !== "function") 9241 return; 9242 _extends(eventProperties, plugin2.eventProperties.call(sortable[plugin2.pluginName], name)); 9243 }); 9244 return eventProperties; 9245 }, 9246 modifyOption: function modifyOption(sortable, name, value) { 9247 var modifiedValue; 9248 plugins.forEach(function(plugin2) { 9249 if (!sortable[plugin2.pluginName]) 9250 return; 9251 if (plugin2.optionListeners && typeof plugin2.optionListeners[name] === "function") { 9252 modifiedValue = plugin2.optionListeners[name].call(sortable[plugin2.pluginName], value); 9253 } 9254 }); 9255 return modifiedValue; 9256 } 9257 }; 9258 function dispatchEvent2(_ref) { 9259 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; 9260 sortable = sortable || rootEl2 && rootEl2[expando]; 9261 if (!sortable) 9262 return; 9263 var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1); 9264 if (window.CustomEvent && !IE11OrLess && !Edge) { 9265 evt = new CustomEvent(name, { 9266 bubbles: true, 9267 cancelable: true 9268 }); 9269 } else { 9270 evt = document.createEvent("Event"); 9271 evt.initEvent(name, true, true); 9272 } 9273 evt.to = toEl || rootEl2; 9274 evt.from = fromEl || rootEl2; 9275 evt.item = targetEl || rootEl2; 9276 evt.clone = cloneEl2; 9277 evt.oldIndex = oldIndex2; 9278 evt.newIndex = newIndex2; 9279 evt.oldDraggableIndex = oldDraggableIndex2; 9280 evt.newDraggableIndex = newDraggableIndex2; 9281 evt.originalEvent = originalEvent; 9282 evt.pullMode = putSortable2 ? putSortable2.lastPutMode : void 0; 9283 var allEventProperties = _objectSpread22(_objectSpread22({}, extraEventProperties), PluginManager.getEventProperties(name, sortable)); 9284 for (var option2 in allEventProperties) { 9285 evt[option2] = allEventProperties[option2]; 9286 } 9287 if (rootEl2) { 9288 rootEl2.dispatchEvent(evt); 9289 } 9290 if (options[onName]) { 9291 options[onName].call(sortable, evt); 9292 } 9293 } 9294 var _excluded = ["evt"]; 9295 var pluginEvent2 = function pluginEvent3(eventName, sortable) { 9296 var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data2 = _objectWithoutProperties(_ref, _excluded); 9297 PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread22({ 9298 dragEl, 9299 parentEl, 9300 ghostEl, 9301 rootEl, 9302 nextEl, 9303 lastDownEl, 9304 cloneEl, 9305 cloneHidden, 9306 dragStarted: moved, 9307 putSortable, 9308 activeSortable: Sortable.active, 9309 originalEvent, 9310 oldIndex, 9311 oldDraggableIndex, 9312 newIndex, 9313 newDraggableIndex, 9314 hideGhostForTarget: _hideGhostForTarget, 9315 unhideGhostForTarget: _unhideGhostForTarget, 9316 cloneNowHidden: function cloneNowHidden() { 9317 cloneHidden = true; 9318 }, 9319 cloneNowShown: function cloneNowShown() { 9320 cloneHidden = false; 9321 }, 9322 dispatchSortableEvent: function dispatchSortableEvent(name) { 9323 _dispatchEvent({ 9324 sortable, 9325 name, 9326 originalEvent 9327 }); 9328 } 9329 }, data2)); 9330 }; 9331 function _dispatchEvent(info) { 9332 dispatchEvent2(_objectSpread22({ 9333 putSortable, 9334 cloneEl, 9335 targetEl: dragEl, 9336 rootEl, 9337 oldIndex, 9338 oldDraggableIndex, 9339 newIndex, 9340 newDraggableIndex 9341 }, info)); 9342 } 9343 var dragEl; 9344 var parentEl; 9345 var ghostEl; 9346 var rootEl; 9347 var nextEl; 9348 var lastDownEl; 9349 var cloneEl; 9350 var cloneHidden; 9351 var oldIndex; 9352 var newIndex; 9353 var oldDraggableIndex; 9354 var newDraggableIndex; 9355 var activeGroup; 9356 var putSortable; 9357 var awaitingDragStarted = false; 9358 var ignoreNextClick = false; 9359 var sortables = []; 9360 var tapEvt; 9361 var touchEvt; 9362 var lastDx; 9363 var lastDy; 9364 var tapDistanceLeft; 9365 var tapDistanceTop; 9366 var moved; 9367 var lastTarget; 9368 var lastDirection; 9369 var pastFirstInvertThresh = false; 9370 var isCircumstantialInvert = false; 9371 var targetMoveDistance; 9372 var ghostRelativeParent; 9373 var ghostRelativeParentInitialScroll = []; 9374 var _silent = false; 9375 var savedInputChecked = []; 9376 var documentExists = typeof document !== "undefined"; 9377 var PositionGhostAbsolutely = IOS; 9378 var CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float"; 9379 var supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"); 9380 var supportCssPointerEvents = function() { 9381 if (!documentExists) 9382 return; 9383 if (IE11OrLess) { 9384 return false; 9385 } 9386 var el = document.createElement("x"); 9387 el.style.cssText = "pointer-events:auto"; 9388 return el.style.pointerEvents === "auto"; 9389 }(); 9390 var _detectDirection = function _detectDirection2(el, options) { 9391 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; 9392 if (elCSS.display === "flex") { 9393 return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal"; 9394 } 9395 if (elCSS.display === "grid") { 9396 return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal"; 9397 } 9398 if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") { 9399 var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right"; 9400 return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal"; 9401 } 9402 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"; 9403 }; 9404 var _dragElInRowColumn = function _dragElInRowColumn2(dragRect, targetRect, vertical) { 9405 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; 9406 return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; 9407 }; 9408 var _detectNearestEmptySortable = function _detectNearestEmptySortable2(x, y) { 9409 var ret; 9410 sortables.some(function(sortable) { 9411 var threshold = sortable[expando].options.emptyInsertThreshold; 9412 if (!threshold || lastChild(sortable)) 9413 return; 9414 var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; 9415 if (insideHorizontally && insideVertically) { 9416 return ret = sortable; 9417 } 9418 }); 9419 return ret; 9420 }; 9421 var _prepareGroup = function _prepareGroup2(options) { 9422 function toFn(value, pull) { 9423 return function(to, from, dragEl2, evt) { 9424 var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; 9425 if (value == null && (pull || sameGroup)) { 9426 return true; 9427 } else if (value == null || value === false) { 9428 return false; 9429 } else if (pull && value === "clone") { 9430 return value; 9431 } else if (typeof value === "function") { 9432 return toFn(value(to, from, dragEl2, evt), pull)(to, from, dragEl2, evt); 9433 } else { 9434 var otherGroup = (pull ? to : from).options.group.name; 9435 return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; 9436 } 9437 }; 9438 } 9439 var group = {}; 9440 var originalGroup = options.group; 9441 if (!originalGroup || _typeof(originalGroup) != "object") { 9442 originalGroup = { 9443 name: originalGroup 9444 }; 9445 } 9446 group.name = originalGroup.name; 9447 group.checkPull = toFn(originalGroup.pull, true); 9448 group.checkPut = toFn(originalGroup.put); 9449 group.revertClone = originalGroup.revertClone; 9450 options.group = group; 9451 }; 9452 var _hideGhostForTarget = function _hideGhostForTarget2() { 9453 if (!supportCssPointerEvents && ghostEl) { 9454 css(ghostEl, "display", "none"); 9455 } 9456 }; 9457 var _unhideGhostForTarget = function _unhideGhostForTarget2() { 9458 if (!supportCssPointerEvents && ghostEl) { 9459 css(ghostEl, "display", ""); 9460 } 9461 }; 9462 if (documentExists && !ChromeForAndroid) { 9463 document.addEventListener("click", function(evt) { 9464 if (ignoreNextClick) { 9465 evt.preventDefault(); 9466 evt.stopPropagation && evt.stopPropagation(); 9467 evt.stopImmediatePropagation && evt.stopImmediatePropagation(); 9468 ignoreNextClick = false; 9469 return false; 9470 } 9471 }, true); 9472 } 9473 var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt) { 9474 if (dragEl) { 9475 evt = evt.touches ? evt.touches[0] : evt; 9476 var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); 9477 if (nearest) { 9478 var event = {}; 9479 for (var i in evt) { 9480 if (evt.hasOwnProperty(i)) { 9481 event[i] = evt[i]; 9482 } 9483 } 9484 event.target = event.rootEl = nearest; 9485 event.preventDefault = void 0; 9486 event.stopPropagation = void 0; 9487 nearest[expando]._onDragOver(event); 9488 } 9489 } 9490 }; 9491 var _checkOutsideTargetEl = function _checkOutsideTargetEl2(evt) { 9492 if (dragEl) { 9493 dragEl.parentNode[expando]._isOutsideThisEl(evt.target); 9494 } 9495 }; 9496 function Sortable(el, options) { 9497 if (!(el && el.nodeType && el.nodeType === 1)) { 9498 throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); 9499 } 9500 this.el = el; 9501 this.options = options = _extends({}, options); 9502 el[expando] = this; 9503 var defaults2 = { 9504 group: null, 9505 sort: true, 9506 disabled: false, 9507 store: null, 9508 handle: null, 9509 draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*", 9510 swapThreshold: 1, 9511 invertSwap: false, 9512 invertedSwapThreshold: null, 9513 removeCloneOnHide: true, 9514 direction: function direction() { 9515 return _detectDirection(el, this.options); 9516 }, 9517 ghostClass: "sortable-ghost", 9518 chosenClass: "sortable-chosen", 9519 dragClass: "sortable-drag", 9520 ignore: "a, img", 9521 filter: null, 9522 preventOnFilter: true, 9523 animation: 0, 9524 easing: null, 9525 setData: function setData(dataTransfer, dragEl2) { 9526 dataTransfer.setData("Text", dragEl2.textContent); 9527 }, 9528 dropBubble: false, 9529 dragoverBubble: false, 9530 dataIdAttr: "data-id", 9531 delay: 0, 9532 delayOnTouchOnly: false, 9533 touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, 9534 forceFallback: false, 9535 fallbackClass: "sortable-fallback", 9536 fallbackOnBody: false, 9537 fallbackTolerance: 0, 9538 fallbackOffset: { 9539 x: 0, 9540 y: 0 9541 }, 9542 supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && !Safari, 9543 emptyInsertThreshold: 5 9544 }; 9545 PluginManager.initializePlugins(this, el, defaults2); 9546 for (var name in defaults2) { 9547 !(name in options) && (options[name] = defaults2[name]); 9548 } 9549 _prepareGroup(options); 9550 for (var fn in this) { 9551 if (fn.charAt(0) === "_" && typeof this[fn] === "function") { 9552 this[fn] = this[fn].bind(this); 9553 } 9554 } 9555 this.nativeDraggable = options.forceFallback ? false : supportDraggable; 9556 if (this.nativeDraggable) { 9557 this.options.touchStartThreshold = 1; 9558 } 9559 if (options.supportPointer) { 9560 on4(el, "pointerdown", this._onTapStart); 9561 } else { 9562 on4(el, "mousedown", this._onTapStart); 9563 on4(el, "touchstart", this._onTapStart); 9564 } 9565 if (this.nativeDraggable) { 9566 on4(el, "dragover", this); 9567 on4(el, "dragenter", this); 9568 } 9569 sortables.push(this.el); 9570 options.store && options.store.get && this.sort(options.store.get(this) || []); 9571 _extends(this, AnimationStateManager()); 9572 } 9573 Sortable.prototype = { 9574 constructor: Sortable, 9575 _isOutsideThisEl: function _isOutsideThisEl(target) { 9576 if (!this.el.contains(target) && target !== this.el) { 9577 lastTarget = null; 9578 } 9579 }, 9580 _getDirection: function _getDirection(evt, target) { 9581 return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; 9582 }, 9583 _onTapStart: function _onTapStart(evt) { 9584 if (!evt.cancelable) 9585 return; 9586 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; 9587 _saveInputCheckedState(el); 9588 if (dragEl) { 9589 return; 9590 } 9591 if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { 9592 return; 9593 } 9594 if (originalTarget.isContentEditable) { 9595 return; 9596 } 9597 if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") { 9598 return; 9599 } 9600 target = closest(target, options.draggable, el, false); 9601 if (target && target.animated) { 9602 return; 9603 } 9604 if (lastDownEl === target) { 9605 return; 9606 } 9607 oldIndex = index(target); 9608 oldDraggableIndex = index(target, options.draggable); 9609 if (typeof filter === "function") { 9610 if (filter.call(this, evt, target, this)) { 9611 _dispatchEvent({ 9612 sortable: _this, 9613 rootEl: originalTarget, 9614 name: "filter", 9615 targetEl: target, 9616 toEl: el, 9617 fromEl: el 9618 }); 9619 pluginEvent2("filter", _this, { 9620 evt 9621 }); 9622 preventOnFilter && evt.cancelable && evt.preventDefault(); 9623 return; 9624 } 9625 } else if (filter) { 9626 filter = filter.split(",").some(function(criteria) { 9627 criteria = closest(originalTarget, criteria.trim(), el, false); 9628 if (criteria) { 9629 _dispatchEvent({ 9630 sortable: _this, 9631 rootEl: criteria, 9632 name: "filter", 9633 targetEl: target, 9634 fromEl: el, 9635 toEl: el 9636 }); 9637 pluginEvent2("filter", _this, { 9638 evt 9639 }); 9640 return true; 9641 } 9642 }); 9643 if (filter) { 9644 preventOnFilter && evt.cancelable && evt.preventDefault(); 9645 return; 9646 } 9647 } 9648 if (options.handle && !closest(originalTarget, options.handle, el, false)) { 9649 return; 9650 } 9651 this._prepareDragStart(evt, touch, target); 9652 }, 9653 _prepareDragStart: function _prepareDragStart(evt, touch, target) { 9654 var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn; 9655 if (target && !dragEl && target.parentNode === el) { 9656 var dragRect = getRect(target); 9657 rootEl = el; 9658 dragEl = target; 9659 parentEl = dragEl.parentNode; 9660 nextEl = dragEl.nextSibling; 9661 lastDownEl = target; 9662 activeGroup = options.group; 9663 Sortable.dragged = dragEl; 9664 tapEvt = { 9665 target: dragEl, 9666 clientX: (touch || evt).clientX, 9667 clientY: (touch || evt).clientY 9668 }; 9669 tapDistanceLeft = tapEvt.clientX - dragRect.left; 9670 tapDistanceTop = tapEvt.clientY - dragRect.top; 9671 this._lastX = (touch || evt).clientX; 9672 this._lastY = (touch || evt).clientY; 9673 dragEl.style["will-change"] = "all"; 9674 dragStartFn = function dragStartFn2() { 9675 pluginEvent2("delayEnded", _this, { 9676 evt 9677 }); 9678 if (Sortable.eventCanceled) { 9679 _this._onDrop(); 9680 return; 9681 } 9682 _this._disableDelayedDragEvents(); 9683 if (!FireFox && _this.nativeDraggable) { 9684 dragEl.draggable = true; 9685 } 9686 _this._triggerDragStart(evt, touch); 9687 _dispatchEvent({ 9688 sortable: _this, 9689 name: "choose", 9690 originalEvent: evt 9691 }); 9692 toggleClass(dragEl, options.chosenClass, true); 9693 }; 9694 options.ignore.split(",").forEach(function(criteria) { 9695 find2(dragEl, criteria.trim(), _disableDraggable); 9696 }); 9697 on4(ownerDocument, "dragover", nearestEmptyInsertDetectEvent); 9698 on4(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent); 9699 on4(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent); 9700 on4(ownerDocument, "mouseup", _this._onDrop); 9701 on4(ownerDocument, "touchend", _this._onDrop); 9702 on4(ownerDocument, "touchcancel", _this._onDrop); 9703 if (FireFox && this.nativeDraggable) { 9704 this.options.touchStartThreshold = 4; 9705 dragEl.draggable = true; 9706 } 9707 pluginEvent2("delayStart", this, { 9708 evt 9709 }); 9710 if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { 9711 if (Sortable.eventCanceled) { 9712 this._onDrop(); 9713 return; 9714 } 9715 on4(ownerDocument, "mouseup", _this._disableDelayedDrag); 9716 on4(ownerDocument, "touchend", _this._disableDelayedDrag); 9717 on4(ownerDocument, "touchcancel", _this._disableDelayedDrag); 9718 on4(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler); 9719 on4(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler); 9720 options.supportPointer && on4(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler); 9721 _this._dragStartTimer = setTimeout(dragStartFn, options.delay); 9722 } else { 9723 dragStartFn(); 9724 } 9725 } 9726 }, 9727 _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) { 9728 var touch = e.touches ? e.touches[0] : e; 9729 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))) { 9730 this._disableDelayedDrag(); 9731 } 9732 }, 9733 _disableDelayedDrag: function _disableDelayedDrag() { 9734 dragEl && _disableDraggable(dragEl); 9735 clearTimeout(this._dragStartTimer); 9736 this._disableDelayedDragEvents(); 9737 }, 9738 _disableDelayedDragEvents: function _disableDelayedDragEvents() { 9739 var ownerDocument = this.el.ownerDocument; 9740 off(ownerDocument, "mouseup", this._disableDelayedDrag); 9741 off(ownerDocument, "touchend", this._disableDelayedDrag); 9742 off(ownerDocument, "touchcancel", this._disableDelayedDrag); 9743 off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler); 9744 off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler); 9745 off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler); 9746 }, 9747 _triggerDragStart: function _triggerDragStart(evt, touch) { 9748 touch = touch || evt.pointerType == "touch" && evt; 9749 if (!this.nativeDraggable || touch) { 9750 if (this.options.supportPointer) { 9751 on4(document, "pointermove", this._onTouchMove); 9752 } else if (touch) { 9753 on4(document, "touchmove", this._onTouchMove); 9754 } else { 9755 on4(document, "mousemove", this._onTouchMove); 9756 } 9757 } else { 9758 on4(dragEl, "dragend", this); 9759 on4(rootEl, "dragstart", this._onDragStart); 9760 } 9761 try { 9762 if (document.selection) { 9763 _nextTick(function() { 9764 document.selection.empty(); 9765 }); 9766 } else { 9767 window.getSelection().removeAllRanges(); 9768 } 9769 } catch (err) { 9770 } 9771 }, 9772 _dragStarted: function _dragStarted(fallback2, evt) { 9773 awaitingDragStarted = false; 9774 if (rootEl && dragEl) { 9775 pluginEvent2("dragStarted", this, { 9776 evt 9777 }); 9778 if (this.nativeDraggable) { 9779 on4(document, "dragover", _checkOutsideTargetEl); 9780 } 9781 var options = this.options; 9782 !fallback2 && toggleClass(dragEl, options.dragClass, false); 9783 toggleClass(dragEl, options.ghostClass, true); 9784 Sortable.active = this; 9785 fallback2 && this._appendGhost(); 9786 _dispatchEvent({ 9787 sortable: this, 9788 name: "start", 9789 originalEvent: evt 9790 }); 9791 } else { 9792 this._nulling(); 9793 } 9794 }, 9795 _emulateDragOver: function _emulateDragOver() { 9796 if (touchEvt) { 9797 this._lastX = touchEvt.clientX; 9798 this._lastY = touchEvt.clientY; 9799 _hideGhostForTarget(); 9800 var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); 9801 var parent = target; 9802 while (target && target.shadowRoot) { 9803 target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); 9804 if (target === parent) 9805 break; 9806 parent = target; 9807 } 9808 dragEl.parentNode[expando]._isOutsideThisEl(target); 9809 if (parent) { 9810 do { 9811 if (parent[expando]) { 9812 var inserted = void 0; 9813 inserted = parent[expando]._onDragOver({ 9814 clientX: touchEvt.clientX, 9815 clientY: touchEvt.clientY, 9816 target, 9817 rootEl: parent 9818 }); 9819 if (inserted && !this.options.dragoverBubble) { 9820 break; 9821 } 9822 } 9823 target = parent; 9824 } while (parent = parent.parentNode); 9825 } 9826 _unhideGhostForTarget(); 9827 } 9828 }, 9829 _onTouchMove: function _onTouchMove(evt) { 9830 if (tapEvt) { 9831 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); 9832 if (!Sortable.active && !awaitingDragStarted) { 9833 if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { 9834 return; 9835 } 9836 this._onDragStart(evt, true); 9837 } 9838 if (ghostEl) { 9839 if (ghostMatrix) { 9840 ghostMatrix.e += dx - (lastDx || 0); 9841 ghostMatrix.f += dy - (lastDy || 0); 9842 } else { 9843 ghostMatrix = { 9844 a: 1, 9845 b: 0, 9846 c: 0, 9847 d: 1, 9848 e: dx, 9849 f: dy 9850 }; 9851 } 9852 var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); 9853 css(ghostEl, "webkitTransform", cssMatrix); 9854 css(ghostEl, "mozTransform", cssMatrix); 9855 css(ghostEl, "msTransform", cssMatrix); 9856 css(ghostEl, "transform", cssMatrix); 9857 lastDx = dx; 9858 lastDy = dy; 9859 touchEvt = touch; 9860 } 9861 evt.cancelable && evt.preventDefault(); 9862 } 9863 }, 9864 _appendGhost: function _appendGhost() { 9865 if (!ghostEl) { 9866 var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options; 9867 if (PositionGhostAbsolutely) { 9868 ghostRelativeParent = container; 9869 while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) { 9870 ghostRelativeParent = ghostRelativeParent.parentNode; 9871 } 9872 if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { 9873 if (ghostRelativeParent === document) 9874 ghostRelativeParent = getWindowScrollingElement(); 9875 rect.top += ghostRelativeParent.scrollTop; 9876 rect.left += ghostRelativeParent.scrollLeft; 9877 } else { 9878 ghostRelativeParent = getWindowScrollingElement(); 9879 } 9880 ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); 9881 } 9882 ghostEl = dragEl.cloneNode(true); 9883 toggleClass(ghostEl, options.ghostClass, false); 9884 toggleClass(ghostEl, options.fallbackClass, true); 9885 toggleClass(ghostEl, options.dragClass, true); 9886 css(ghostEl, "transition", ""); 9887 css(ghostEl, "transform", ""); 9888 css(ghostEl, "box-sizing", "border-box"); 9889 css(ghostEl, "margin", 0); 9890 css(ghostEl, "top", rect.top); 9891 css(ghostEl, "left", rect.left); 9892 css(ghostEl, "width", rect.width); 9893 css(ghostEl, "height", rect.height); 9894 css(ghostEl, "opacity", "0.8"); 9895 css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed"); 9896 css(ghostEl, "zIndex", "100000"); 9897 css(ghostEl, "pointerEvents", "none"); 9898 Sortable.ghost = ghostEl; 9899 container.appendChild(ghostEl); 9900 css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%"); 9901 } 9902 }, 9903 _onDragStart: function _onDragStart(evt, fallback2) { 9904 var _this = this; 9905 var dataTransfer = evt.dataTransfer; 9906 var options = _this.options; 9907 pluginEvent2("dragStart", this, { 9908 evt 9909 }); 9910 if (Sortable.eventCanceled) { 9911 this._onDrop(); 9912 return; 9913 } 9914 pluginEvent2("setupClone", this); 9915 if (!Sortable.eventCanceled) { 9916 cloneEl = clone2(dragEl); 9917 cloneEl.removeAttribute("id"); 9918 cloneEl.draggable = false; 9919 cloneEl.style["will-change"] = ""; 9920 this._hideClone(); 9921 toggleClass(cloneEl, this.options.chosenClass, false); 9922 Sortable.clone = cloneEl; 9923 } 9924 _this.cloneId = _nextTick(function() { 9925 pluginEvent2("clone", _this); 9926 if (Sortable.eventCanceled) 9927 return; 9928 if (!_this.options.removeCloneOnHide) { 9929 rootEl.insertBefore(cloneEl, dragEl); 9930 } 9931 _this._hideClone(); 9932 _dispatchEvent({ 9933 sortable: _this, 9934 name: "clone" 9935 }); 9936 }); 9937 !fallback2 && toggleClass(dragEl, options.dragClass, true); 9938 if (fallback2) { 9939 ignoreNextClick = true; 9940 _this._loopId = setInterval(_this._emulateDragOver, 50); 9941 } else { 9942 off(document, "mouseup", _this._onDrop); 9943 off(document, "touchend", _this._onDrop); 9944 off(document, "touchcancel", _this._onDrop); 9945 if (dataTransfer) { 9946 dataTransfer.effectAllowed = "move"; 9947 options.setData && options.setData.call(_this, dataTransfer, dragEl); 9948 } 9949 on4(document, "drop", _this); 9950 css(dragEl, "transform", "translateZ(0)"); 9951 } 9952 awaitingDragStarted = true; 9953 _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback2, evt)); 9954 on4(document, "selectstart", _this); 9955 moved = true; 9956 if (Safari) { 9957 css(document.body, "user-select", "none"); 9958 } 9959 }, 9960 _onDragOver: function _onDragOver(evt) { 9961 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; 9962 if (_silent) 9963 return; 9964 function dragOverEvent(name, extra) { 9965 pluginEvent2(name, _this, _objectSpread22({ 9966 evt, 9967 isOwner, 9968 axis: vertical ? "vertical" : "horizontal", 9969 revert, 9970 dragRect, 9971 targetRect, 9972 canSort, 9973 fromSortable, 9974 target, 9975 completed, 9976 onMove: function onMove(target2, after2) { 9977 return _onMove(rootEl, el, dragEl, dragRect, target2, getRect(target2), evt, after2); 9978 }, 9979 changed 9980 }, extra)); 9981 } 9982 function capture() { 9983 dragOverEvent("dragOverAnimationCapture"); 9984 _this.captureAnimationState(); 9985 if (_this !== fromSortable) { 9986 fromSortable.captureAnimationState(); 9987 } 9988 } 9989 function completed(insertion) { 9990 dragOverEvent("dragOverCompleted", { 9991 insertion 9992 }); 9993 if (insertion) { 9994 if (isOwner) { 9995 activeSortable._hideClone(); 9996 } else { 9997 activeSortable._showClone(_this); 9998 } 9999 if (_this !== fromSortable) { 10000 toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); 10001 toggleClass(dragEl, options.ghostClass, true); 10002 } 10003 if (putSortable !== _this && _this !== Sortable.active) { 10004 putSortable = _this; 10005 } else if (_this === Sortable.active && putSortable) { 10006 putSortable = null; 10007 } 10008 if (fromSortable === _this) { 10009 _this._ignoreWhileAnimating = target; 10010 } 10011 _this.animateAll(function() { 10012 dragOverEvent("dragOverAnimationComplete"); 10013 _this._ignoreWhileAnimating = null; 10014 }); 10015 if (_this !== fromSortable) { 10016 fromSortable.animateAll(); 10017 fromSortable._ignoreWhileAnimating = null; 10018 } 10019 } 10020 if (target === dragEl && !dragEl.animated || target === el && !target.animated) { 10021 lastTarget = null; 10022 } 10023 if (!options.dragoverBubble && !evt.rootEl && target !== document) { 10024 dragEl.parentNode[expando]._isOutsideThisEl(evt.target); 10025 !insertion && nearestEmptyInsertDetectEvent(evt); 10026 } 10027 !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); 10028 return completedFired = true; 10029 } 10030 function changed() { 10031 newIndex = index(dragEl); 10032 newDraggableIndex = index(dragEl, options.draggable); 10033 _dispatchEvent({ 10034 sortable: _this, 10035 name: "change", 10036 toEl: el, 10037 newIndex, 10038 newDraggableIndex, 10039 originalEvent: evt 10040 }); 10041 } 10042 if (evt.preventDefault !== void 0) { 10043 evt.cancelable && evt.preventDefault(); 10044 } 10045 target = closest(target, options.draggable, el, true); 10046 dragOverEvent("dragOver"); 10047 if (Sortable.eventCanceled) 10048 return completedFired; 10049 if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { 10050 return completed(false); 10051 } 10052 ignoreNextClick = false; 10053 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))) { 10054 vertical = this._getDirection(evt, target) === "vertical"; 10055 dragRect = getRect(dragEl); 10056 dragOverEvent("dragOverValid"); 10057 if (Sortable.eventCanceled) 10058 return completedFired; 10059 if (revert) { 10060 parentEl = rootEl; 10061 capture(); 10062 this._hideClone(); 10063 dragOverEvent("revert"); 10064 if (!Sortable.eventCanceled) { 10065 if (nextEl) { 10066 rootEl.insertBefore(dragEl, nextEl); 10067 } else { 10068 rootEl.appendChild(dragEl); 10069 } 10070 } 10071 return completed(true); 10072 } 10073 var elLastChild = lastChild(el, options.draggable); 10074 if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { 10075 if (elLastChild === dragEl) { 10076 return completed(false); 10077 } 10078 if (elLastChild && el === evt.target) { 10079 target = elLastChild; 10080 } 10081 if (target) { 10082 targetRect = getRect(target); 10083 } 10084 if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { 10085 capture(); 10086 if (elLastChild && elLastChild.nextSibling) { 10087 el.insertBefore(dragEl, elLastChild.nextSibling); 10088 } else { 10089 el.appendChild(dragEl); 10090 } 10091 parentEl = el; 10092 changed(); 10093 return completed(true); 10094 } 10095 } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) { 10096 var firstChild = getChild(el, 0, options, true); 10097 if (firstChild === dragEl) { 10098 return completed(false); 10099 } 10100 target = firstChild; 10101 targetRect = getRect(target); 10102 if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) { 10103 capture(); 10104 el.insertBefore(dragEl, firstChild); 10105 parentEl = el; 10106 changed(); 10107 return completed(true); 10108 } 10109 } else if (target.parentNode === el) { 10110 targetRect = getRect(target); 10111 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; 10112 if (lastTarget !== target) { 10113 targetBeforeFirstSwap = targetRect[side1]; 10114 pastFirstInvertThresh = false; 10115 isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; 10116 } 10117 direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); 10118 var sibling; 10119 if (direction !== 0) { 10120 var dragIndex = index(dragEl); 10121 do { 10122 dragIndex -= direction; 10123 sibling = parentEl.children[dragIndex]; 10124 } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl)); 10125 } 10126 if (direction === 0 || sibling === target) { 10127 return completed(false); 10128 } 10129 lastTarget = target; 10130 lastDirection = direction; 10131 var nextSibling = target.nextElementSibling, after = false; 10132 after = direction === 1; 10133 var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); 10134 if (moveVector !== false) { 10135 if (moveVector === 1 || moveVector === -1) { 10136 after = moveVector === 1; 10137 } 10138 _silent = true; 10139 setTimeout(_unsilent, 30); 10140 capture(); 10141 if (after && !nextSibling) { 10142 el.appendChild(dragEl); 10143 } else { 10144 target.parentNode.insertBefore(dragEl, after ? nextSibling : target); 10145 } 10146 if (scrolledPastTop) { 10147 scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); 10148 } 10149 parentEl = dragEl.parentNode; 10150 if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) { 10151 targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); 10152 } 10153 changed(); 10154 return completed(true); 10155 } 10156 } 10157 if (el.contains(dragEl)) { 10158 return completed(false); 10159 } 10160 } 10161 return false; 10162 }, 10163 _ignoreWhileAnimating: null, 10164 _offMoveEvents: function _offMoveEvents() { 10165 off(document, "mousemove", this._onTouchMove); 10166 off(document, "touchmove", this._onTouchMove); 10167 off(document, "pointermove", this._onTouchMove); 10168 off(document, "dragover", nearestEmptyInsertDetectEvent); 10169 off(document, "mousemove", nearestEmptyInsertDetectEvent); 10170 off(document, "touchmove", nearestEmptyInsertDetectEvent); 10171 }, 10172 _offUpEvents: function _offUpEvents() { 10173 var ownerDocument = this.el.ownerDocument; 10174 off(ownerDocument, "mouseup", this._onDrop); 10175 off(ownerDocument, "touchend", this._onDrop); 10176 off(ownerDocument, "pointerup", this._onDrop); 10177 off(ownerDocument, "touchcancel", this._onDrop); 10178 off(document, "selectstart", this); 10179 }, 10180 _onDrop: function _onDrop(evt) { 10181 var el = this.el, options = this.options; 10182 newIndex = index(dragEl); 10183 newDraggableIndex = index(dragEl, options.draggable); 10184 pluginEvent2("drop", this, { 10185 evt 10186 }); 10187 parentEl = dragEl && dragEl.parentNode; 10188 newIndex = index(dragEl); 10189 newDraggableIndex = index(dragEl, options.draggable); 10190 if (Sortable.eventCanceled) { 10191 this._nulling(); 10192 return; 10193 } 10194 awaitingDragStarted = false; 10195 isCircumstantialInvert = false; 10196 pastFirstInvertThresh = false; 10197 clearInterval(this._loopId); 10198 clearTimeout(this._dragStartTimer); 10199 _cancelNextTick(this.cloneId); 10200 _cancelNextTick(this._dragStartId); 10201 if (this.nativeDraggable) { 10202 off(document, "drop", this); 10203 off(el, "dragstart", this._onDragStart); 10204 } 10205 this._offMoveEvents(); 10206 this._offUpEvents(); 10207 if (Safari) { 10208 css(document.body, "user-select", ""); 10209 } 10210 css(dragEl, "transform", ""); 10211 if (evt) { 10212 if (moved) { 10213 evt.cancelable && evt.preventDefault(); 10214 !options.dropBubble && evt.stopPropagation(); 10215 } 10216 ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); 10217 if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") { 10218 cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); 10219 } 10220 if (dragEl) { 10221 if (this.nativeDraggable) { 10222 off(dragEl, "dragend", this); 10223 } 10224 _disableDraggable(dragEl); 10225 dragEl.style["will-change"] = ""; 10226 if (moved && !awaitingDragStarted) { 10227 toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); 10228 } 10229 toggleClass(dragEl, this.options.chosenClass, false); 10230 _dispatchEvent({ 10231 sortable: this, 10232 name: "unchoose", 10233 toEl: parentEl, 10234 newIndex: null, 10235 newDraggableIndex: null, 10236 originalEvent: evt 10237 }); 10238 if (rootEl !== parentEl) { 10239 if (newIndex >= 0) { 10240 _dispatchEvent({ 10241 rootEl: parentEl, 10242 name: "add", 10243 toEl: parentEl, 10244 fromEl: rootEl, 10245 originalEvent: evt 10246 }); 10247 _dispatchEvent({ 10248 sortable: this, 10249 name: "remove", 10250 toEl: parentEl, 10251 originalEvent: evt 10252 }); 10253 _dispatchEvent({ 10254 rootEl: parentEl, 10255 name: "sort", 10256 toEl: parentEl, 10257 fromEl: rootEl, 10258 originalEvent: evt 10259 }); 10260 _dispatchEvent({ 10261 sortable: this, 10262 name: "sort", 10263 toEl: parentEl, 10264 originalEvent: evt 10265 }); 10266 } 10267 putSortable && putSortable.save(); 10268 } else { 10269 if (newIndex !== oldIndex) { 10270 if (newIndex >= 0) { 10271 _dispatchEvent({ 10272 sortable: this, 10273 name: "update", 10274 toEl: parentEl, 10275 originalEvent: evt 10276 }); 10277 _dispatchEvent({ 10278 sortable: this, 10279 name: "sort", 10280 toEl: parentEl, 10281 originalEvent: evt 10282 }); 10283 } 10284 } 10285 } 10286 if (Sortable.active) { 10287 if (newIndex == null || newIndex === -1) { 10288 newIndex = oldIndex; 10289 newDraggableIndex = oldDraggableIndex; 10290 } 10291 _dispatchEvent({ 10292 sortable: this, 10293 name: "end", 10294 toEl: parentEl, 10295 originalEvent: evt 10296 }); 10297 this.save(); 10298 } 10299 } 10300 } 10301 this._nulling(); 10302 }, 10303 _nulling: function _nulling() { 10304 pluginEvent2("nulling", this); 10305 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; 10306 savedInputChecked.forEach(function(el) { 10307 el.checked = true; 10308 }); 10309 savedInputChecked.length = lastDx = lastDy = 0; 10310 }, 10311 handleEvent: function handleEvent(evt) { 10312 switch (evt.type) { 10313 case "drop": 10314 case "dragend": 10315 this._onDrop(evt); 10316 break; 10317 case "dragenter": 10318 case "dragover": 10319 if (dragEl) { 10320 this._onDragOver(evt); 10321 _globalDragOver(evt); 10322 } 10323 break; 10324 case "selectstart": 10325 evt.preventDefault(); 10326 break; 10327 } 10328 }, 10329 toArray: function toArray() { 10330 var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options; 10331 for (; i < n; i++) { 10332 el = children[i]; 10333 if (closest(el, options.draggable, this.el, false)) { 10334 order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); 10335 } 10336 } 10337 return order; 10338 }, 10339 sort: function sort(order, useAnimation) { 10340 var items = {}, rootEl2 = this.el; 10341 this.toArray().forEach(function(id, i) { 10342 var el = rootEl2.children[i]; 10343 if (closest(el, this.options.draggable, rootEl2, false)) { 10344 items[id] = el; 10345 } 10346 }, this); 10347 useAnimation && this.captureAnimationState(); 10348 order.forEach(function(id) { 10349 if (items[id]) { 10350 rootEl2.removeChild(items[id]); 10351 rootEl2.appendChild(items[id]); 10352 } 10353 }); 10354 useAnimation && this.animateAll(); 10355 }, 10356 save: function save() { 10357 var store2 = this.options.store; 10358 store2 && store2.set && store2.set(this); 10359 }, 10360 closest: function closest$1(el, selector) { 10361 return closest(el, selector || this.options.draggable, this.el, false); 10362 }, 10363 option: function option(name, value) { 10364 var options = this.options; 10365 if (value === void 0) { 10366 return options[name]; 10367 } else { 10368 var modifiedValue = PluginManager.modifyOption(this, name, value); 10369 if (typeof modifiedValue !== "undefined") { 10370 options[name] = modifiedValue; 10371 } else { 10372 options[name] = value; 10373 } 10374 if (name === "group") { 10375 _prepareGroup(options); 10376 } 10377 } 10378 }, 10379 destroy: function destroy() { 10380 pluginEvent2("destroy", this); 10381 var el = this.el; 10382 el[expando] = null; 10383 off(el, "mousedown", this._onTapStart); 10384 off(el, "touchstart", this._onTapStart); 10385 off(el, "pointerdown", this._onTapStart); 10386 if (this.nativeDraggable) { 10387 off(el, "dragover", this); 10388 off(el, "dragenter", this); 10389 } 10390 Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el2) { 10391 el2.removeAttribute("draggable"); 10392 }); 10393 this._onDrop(); 10394 this._disableDelayedDragEvents(); 10395 sortables.splice(sortables.indexOf(this.el), 1); 10396 this.el = el = null; 10397 }, 10398 _hideClone: function _hideClone() { 10399 if (!cloneHidden) { 10400 pluginEvent2("hideClone", this); 10401 if (Sortable.eventCanceled) 10402 return; 10403 css(cloneEl, "display", "none"); 10404 if (this.options.removeCloneOnHide && cloneEl.parentNode) { 10405 cloneEl.parentNode.removeChild(cloneEl); 10406 } 10407 cloneHidden = true; 10408 } 10409 }, 10410 _showClone: function _showClone(putSortable2) { 10411 if (putSortable2.lastPutMode !== "clone") { 10412 this._hideClone(); 10413 return; 10414 } 10415 if (cloneHidden) { 10416 pluginEvent2("showClone", this); 10417 if (Sortable.eventCanceled) 10418 return; 10419 if (dragEl.parentNode == rootEl && !this.options.group.revertClone) { 10420 rootEl.insertBefore(cloneEl, dragEl); 10421 } else if (nextEl) { 10422 rootEl.insertBefore(cloneEl, nextEl); 10423 } else { 10424 rootEl.appendChild(cloneEl); 10425 } 10426 if (this.options.group.revertClone) { 10427 this.animate(dragEl, cloneEl); 10428 } 10429 css(cloneEl, "display", ""); 10430 cloneHidden = false; 10431 } 10432 } 10433 }; 10434 function _globalDragOver(evt) { 10435 if (evt.dataTransfer) { 10436 evt.dataTransfer.dropEffect = "move"; 10437 } 10438 evt.cancelable && evt.preventDefault(); 10439 } 10440 function _onMove(fromEl, toEl, dragEl2, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { 10441 var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal; 10442 if (window.CustomEvent && !IE11OrLess && !Edge) { 10443 evt = new CustomEvent("move", { 10444 bubbles: true, 10445 cancelable: true 10446 }); 10447 } else { 10448 evt = document.createEvent("Event"); 10449 evt.initEvent("move", true, true); 10450 } 10451 evt.to = toEl; 10452 evt.from = fromEl; 10453 evt.dragged = dragEl2; 10454 evt.draggedRect = dragRect; 10455 evt.related = targetEl || toEl; 10456 evt.relatedRect = targetRect || getRect(toEl); 10457 evt.willInsertAfter = willInsertAfter; 10458 evt.originalEvent = originalEvent; 10459 fromEl.dispatchEvent(evt); 10460 if (onMoveFn) { 10461 retVal = onMoveFn.call(sortable, evt, originalEvent); 10462 } 10463 return retVal; 10464 } 10465 function _disableDraggable(el) { 10466 el.draggable = false; 10467 } 10468 function _unsilent() { 10469 _silent = false; 10470 } 10471 function _ghostIsFirst(evt, vertical, sortable) { 10472 var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true)); 10473 var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl); 10474 var spacer = 10; 10475 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; 10476 } 10477 function _ghostIsLast(evt, vertical, sortable) { 10478 var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable)); 10479 var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl); 10480 var spacer = 10; 10481 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; 10482 } 10483 function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { 10484 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; 10485 if (!invertSwap) { 10486 if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { 10487 if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { 10488 pastFirstInvertThresh = true; 10489 } 10490 if (!pastFirstInvertThresh) { 10491 if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) { 10492 return -lastDirection; 10493 } 10494 } else { 10495 invert = true; 10496 } 10497 } else { 10498 if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { 10499 return _getInsertDirection(target); 10500 } 10501 } 10502 } 10503 invert = invert || invertSwap; 10504 if (invert) { 10505 if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { 10506 return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; 10507 } 10508 } 10509 return 0; 10510 } 10511 function _getInsertDirection(target) { 10512 if (index(dragEl) < index(target)) { 10513 return 1; 10514 } else { 10515 return -1; 10516 } 10517 } 10518 function _generateId(el) { 10519 var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0; 10520 while (i--) { 10521 sum += str.charCodeAt(i); 10522 } 10523 return sum.toString(36); 10524 } 10525 function _saveInputCheckedState(root) { 10526 savedInputChecked.length = 0; 10527 var inputs = root.getElementsByTagName("input"); 10528 var idx = inputs.length; 10529 while (idx--) { 10530 var el = inputs[idx]; 10531 el.checked && savedInputChecked.push(el); 10532 } 10533 } 10534 function _nextTick(fn) { 10535 return setTimeout(fn, 0); 10536 } 10537 function _cancelNextTick(id) { 10538 return clearTimeout(id); 10539 } 10540 if (documentExists) { 10541 on4(document, "touchmove", function(evt) { 10542 if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { 10543 evt.preventDefault(); 10544 } 10545 }); 10546 } 10547 Sortable.utils = { 10548 on: on4, 10549 off, 10550 css, 10551 find: find2, 10552 is: function is(el, selector) { 10553 return !!closest(el, selector, el, false); 10554 }, 10555 extend, 10556 throttle: throttle2, 10557 closest, 10558 toggleClass, 10559 clone: clone2, 10560 index, 10561 nextTick: _nextTick, 10562 cancelNextTick: _cancelNextTick, 10563 detectDirection: _detectDirection, 10564 getChild 10565 }; 10566 Sortable.get = function(element) { 10567 return element[expando]; 10568 }; 10569 Sortable.mount = function() { 10570 for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) { 10571 plugins2[_key] = arguments[_key]; 10572 } 10573 if (plugins2[0].constructor === Array) 10574 plugins2 = plugins2[0]; 10575 plugins2.forEach(function(plugin2) { 10576 if (!plugin2.prototype || !plugin2.prototype.constructor) { 10577 throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin2)); 10578 } 10579 if (plugin2.utils) 10580 Sortable.utils = _objectSpread22(_objectSpread22({}, Sortable.utils), plugin2.utils); 10581 PluginManager.mount(plugin2); 10582 }); 10583 }; 10584 Sortable.create = function(el, options) { 10585 return new Sortable(el, options); 10586 }; 10587 Sortable.version = version; 10588 var autoScrolls = []; 10589 var scrollEl; 10590 var scrollRootEl; 10591 var scrolling = false; 10592 var lastAutoScrollX; 10593 var lastAutoScrollY; 10594 var touchEvt$1; 10595 var pointerElemChangedInterval; 10596 function AutoScrollPlugin() { 10597 function AutoScroll() { 10598 this.defaults = { 10599 scroll: true, 10600 forceAutoScrollFallback: false, 10601 scrollSensitivity: 30, 10602 scrollSpeed: 10, 10603 bubbleScroll: true 10604 }; 10605 for (var fn in this) { 10606 if (fn.charAt(0) === "_" && typeof this[fn] === "function") { 10607 this[fn] = this[fn].bind(this); 10608 } 10609 } 10610 } 10611 AutoScroll.prototype = { 10612 dragStarted: function dragStarted(_ref) { 10613 var originalEvent = _ref.originalEvent; 10614 if (this.sortable.nativeDraggable) { 10615 on4(document, "dragover", this._handleAutoScroll); 10616 } else { 10617 if (this.options.supportPointer) { 10618 on4(document, "pointermove", this._handleFallbackAutoScroll); 10619 } else if (originalEvent.touches) { 10620 on4(document, "touchmove", this._handleFallbackAutoScroll); 10621 } else { 10622 on4(document, "mousemove", this._handleFallbackAutoScroll); 10623 } 10624 } 10625 }, 10626 dragOverCompleted: function dragOverCompleted(_ref2) { 10627 var originalEvent = _ref2.originalEvent; 10628 if (!this.options.dragOverBubble && !originalEvent.rootEl) { 10629 this._handleAutoScroll(originalEvent); 10630 } 10631 }, 10632 drop: function drop3() { 10633 if (this.sortable.nativeDraggable) { 10634 off(document, "dragover", this._handleAutoScroll); 10635 } else { 10636 off(document, "pointermove", this._handleFallbackAutoScroll); 10637 off(document, "touchmove", this._handleFallbackAutoScroll); 10638 off(document, "mousemove", this._handleFallbackAutoScroll); 10639 } 10640 clearPointerElemChangedInterval(); 10641 clearAutoScrolls(); 10642 cancelThrottle(); 10643 }, 10644 nulling: function nulling() { 10645 touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; 10646 autoScrolls.length = 0; 10647 }, 10648 _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { 10649 this._handleAutoScroll(evt, true); 10650 }, 10651 _handleAutoScroll: function _handleAutoScroll(evt, fallback2) { 10652 var _this = this; 10653 var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y); 10654 touchEvt$1 = evt; 10655 if (fallback2 || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) { 10656 autoScroll(evt, this.options, elem, fallback2); 10657 var ogElemScroller = getParentAutoScrollElement(elem, true); 10658 if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { 10659 pointerElemChangedInterval && clearPointerElemChangedInterval(); 10660 pointerElemChangedInterval = setInterval(function() { 10661 var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); 10662 if (newElem !== ogElemScroller) { 10663 ogElemScroller = newElem; 10664 clearAutoScrolls(); 10665 } 10666 autoScroll(evt, _this.options, newElem, fallback2); 10667 }, 10); 10668 lastAutoScrollX = x; 10669 lastAutoScrollY = y; 10670 } 10671 } else { 10672 if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { 10673 clearAutoScrolls(); 10674 return; 10675 } 10676 autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); 10677 } 10678 } 10679 }; 10680 return _extends(AutoScroll, { 10681 pluginName: "scroll", 10682 initializeByDefault: true 10683 }); 10684 } 10685 function clearAutoScrolls() { 10686 autoScrolls.forEach(function(autoScroll2) { 10687 clearInterval(autoScroll2.pid); 10688 }); 10689 autoScrolls = []; 10690 } 10691 function clearPointerElemChangedInterval() { 10692 clearInterval(pointerElemChangedInterval); 10693 } 10694 var autoScroll = throttle2(function(evt, options, rootEl2, isFallback) { 10695 if (!options.scroll) 10696 return; 10697 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(); 10698 var scrollThisInstance = false, scrollCustomFn; 10699 if (scrollRootEl !== rootEl2) { 10700 scrollRootEl = rootEl2; 10701 clearAutoScrolls(); 10702 scrollEl = options.scroll; 10703 scrollCustomFn = options.scrollFn; 10704 if (scrollEl === true) { 10705 scrollEl = getParentAutoScrollElement(rootEl2, true); 10706 } 10707 } 10708 var layersOut = 0; 10709 var currentParent = scrollEl; 10710 do { 10711 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; 10712 if (el === winScroller) { 10713 canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible"); 10714 canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible"); 10715 } else { 10716 canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll"); 10717 canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll"); 10718 } 10719 var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); 10720 var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); 10721 if (!autoScrolls[layersOut]) { 10722 for (var i = 0; i <= layersOut; i++) { 10723 if (!autoScrolls[i]) { 10724 autoScrolls[i] = {}; 10725 } 10726 } 10727 } 10728 if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { 10729 autoScrolls[layersOut].el = el; 10730 autoScrolls[layersOut].vx = vx; 10731 autoScrolls[layersOut].vy = vy; 10732 clearInterval(autoScrolls[layersOut].pid); 10733 if (vx != 0 || vy != 0) { 10734 scrollThisInstance = true; 10735 autoScrolls[layersOut].pid = setInterval(function() { 10736 if (isFallback && this.layer === 0) { 10737 Sortable.active._onTouchMove(touchEvt$1); 10738 } 10739 var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; 10740 var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; 10741 if (typeof scrollCustomFn === "function") { 10742 if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") { 10743 return; 10744 } 10745 } 10746 scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); 10747 }.bind({ 10748 layer: layersOut 10749 }), 24); 10750 } 10751 } 10752 layersOut++; 10753 } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); 10754 scrolling = scrollThisInstance; 10755 }, 30); 10756 var drop = function drop2(_ref) { 10757 var originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, dragEl2 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget; 10758 if (!originalEvent) 10759 return; 10760 var toSortable = putSortable2 || activeSortable; 10761 hideGhostForTarget(); 10762 var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; 10763 var target = document.elementFromPoint(touch.clientX, touch.clientY); 10764 unhideGhostForTarget(); 10765 if (toSortable && !toSortable.el.contains(target)) { 10766 dispatchSortableEvent("spill"); 10767 this.onSpill({ 10768 dragEl: dragEl2, 10769 putSortable: putSortable2 10770 }); 10771 } 10772 }; 10773 function Revert() { 10774 } 10775 Revert.prototype = { 10776 startIndex: null, 10777 dragStart: function dragStart(_ref2) { 10778 var oldDraggableIndex2 = _ref2.oldDraggableIndex; 10779 this.startIndex = oldDraggableIndex2; 10780 }, 10781 onSpill: function onSpill(_ref3) { 10782 var dragEl2 = _ref3.dragEl, putSortable2 = _ref3.putSortable; 10783 this.sortable.captureAnimationState(); 10784 if (putSortable2) { 10785 putSortable2.captureAnimationState(); 10786 } 10787 var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); 10788 if (nextSibling) { 10789 this.sortable.el.insertBefore(dragEl2, nextSibling); 10790 } else { 10791 this.sortable.el.appendChild(dragEl2); 10792 } 10793 this.sortable.animateAll(); 10794 if (putSortable2) { 10795 putSortable2.animateAll(); 10796 } 10797 }, 10798 drop 10799 }; 10800 _extends(Revert, { 10801 pluginName: "revertOnSpill" 10802 }); 10803 function Remove() { 10804 } 10805 Remove.prototype = { 10806 onSpill: function onSpill2(_ref4) { 10807 var dragEl2 = _ref4.dragEl, putSortable2 = _ref4.putSortable; 10808 var parentSortable = putSortable2 || this.sortable; 10809 parentSortable.captureAnimationState(); 10810 dragEl2.parentNode && dragEl2.parentNode.removeChild(dragEl2); 10811 parentSortable.animateAll(); 10812 }, 10813 drop 10814 }; 10815 _extends(Remove, { 10816 pluginName: "removeOnSpill" 10817 }); 10818 Sortable.mount(new AutoScrollPlugin()); 10819 Sortable.mount(Remove, Revert); 10820 var sortable_esm_default = Sortable; 10821 function walk2(el, callback) { 10822 if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) { 10823 Array.from(el.children).forEach((el2) => walk2(el2, callback)); 10824 return; 10825 } 10826 let skip = false; 10827 callback(el, () => skip = true); 10828 if (skip) 10829 return; 10830 let node = el.firstElementChild; 10831 while (node) { 10832 walk2(node, callback, false); 10833 node = node.nextElementSibling; 10834 } 10835 } 10836 function src_default6(Alpine3) { 10837 Alpine3.directive("sort", (el, { value, modifiers, expression }, { effect: effect3, evaluate: evaluate3, cleanup: cleanup2 }) => { 10838 if (value === "config") { 10839 return; 10840 } 10841 if (value === "handle") { 10842 return; 10843 } 10844 if (value === "group") { 10845 return; 10846 } 10847 if (value === "key" || value === "item") { 10848 if ([void 0, null, ""].includes(expression)) 10849 return; 10850 el._x_sort_key = evaluate3(expression); 10851 return; 10852 } 10853 let handleSelector = "[x-sort\\:handle],[wire\\:sort\\:handle]"; 10854 let preferences = { 10855 hideGhost: !modifiers.includes("ghost"), 10856 useHandles: !!el.querySelector(handleSelector) || Array.from(el.querySelectorAll("template:not(svg template)")).some((tmpl) => tmpl.content?.querySelector(handleSelector)), 10857 group: getGroupName(el, modifiers) 10858 }; 10859 let handleSort = generateSortHandler(expression, evaluate3); 10860 let config = getConfigurationOverrides(el, modifiers, evaluate3); 10861 let sortable = initSortable(el, config, preferences, (key, position) => { 10862 handleSort(key, position); 10863 }); 10864 cleanup2(() => sortable.destroy()); 10865 }); 10866 } 10867 function generateSortHandler(expression, evaluate3) { 10868 if ([void 0, null, ""].includes(expression)) 10869 return () => { 10870 }; 10871 return (key, position) => { 10872 evaluate3(expression, { scope: { 10873 $key: key, 10874 $item: key, 10875 $position: position 10876 }, params: [ 10877 key, 10878 position 10879 ] }); 10880 }; 10881 } 10882 function getConfigurationOverrides(el, modifiers, evaluate3) { 10883 if (el.hasAttribute("x-sort:config")) { 10884 return evaluate3(el.getAttribute("x-sort:config")); 10885 } 10886 if (el.hasAttribute("wire:sort:config")) { 10887 return evaluate3(el.getAttribute("wire:sort:config")); 10888 } 10889 return {}; 10890 } 10891 function initSortable(el, config, preferences, handle) { 10892 let ghostRef; 10893 let options = { 10894 animation: 150, 10895 handle: preferences.useHandles ? "[x-sort\\:handle],[wire\\:sort\\:handle]" : null, 10896 group: preferences.group, 10897 scroll: true, 10898 forceAutoScrollFallback: true, 10899 scrollSensitivity: 50, 10900 preventOnFilter: false, 10901 filter(e) { 10902 if (e.target.hasAttribute("x-sort:ignore") || e.target.hasAttribute("wire:sort:ignore")) 10903 return true; 10904 if (e.target.closest("[x-sort\\:ignore]") || e.target.closest("[wire\\:sort\\:ignore]")) 10905 return true; 10906 if (!el.querySelector("[x-sort\\:item],[wire\\:sort\\:item]")) 10907 return false; 10908 let itemHasAttribute = e.target.closest("[x-sort\\:item],[wire\\:sort\\:item]"); 10909 return itemHasAttribute ? false : true; 10910 }, 10911 onSort(e) { 10912 if (e.from !== e.to) { 10913 if (e.to !== e.target) { 10914 return; 10915 } 10916 } 10917 let key = void 0; 10918 walk2(e.item, (el2, skip) => { 10919 if (key !== void 0) 10920 return; 10921 if (el2._x_sort_key) { 10922 key = el2._x_sort_key; 10923 skip(); 10924 } 10925 }); 10926 let position = e.newIndex; 10927 if (key !== void 0 || key !== null) { 10928 handle(key, position); 10929 } 10930 }, 10931 onStart() { 10932 document.body.classList.add("sorting"); 10933 ghostRef = document.querySelector(".sortable-ghost"); 10934 if (preferences.hideGhost && ghostRef) 10935 ghostRef.style.opacity = "0"; 10936 }, 10937 onEnd() { 10938 document.body.classList.remove("sorting"); 10939 if (preferences.hideGhost && ghostRef) 10940 ghostRef.style.opacity = "1"; 10941 ghostRef = void 0; 10942 keepElementsWithinMorphMarkers(el); 10943 } 10944 }; 10945 return new sortable_esm_default(el, { ...options, ...config }); 10946 } 10947 function keepElementsWithinMorphMarkers(el) { 10948 let cursor = el.firstChild; 10949 while (cursor.nextSibling) { 10950 if (cursor.textContent.trim() === "[if ENDBLOCK]><![endif]") { 10951 el.append(cursor); 10952 break; 10953 } 10954 cursor = cursor.nextSibling; 10955 } 10956 } 10957 function getGroupName(el, modifiers) { 10958 if (el.hasAttribute("x-sort:group")) { 10959 return el.getAttribute("x-sort:group"); 10960 } 10961 if (el.hasAttribute("wire:sort:group")) { 10962 return el.getAttribute("wire:sort:group"); 10963 } 10964 return modifiers.indexOf("group") !== -1 ? modifiers[modifiers.indexOf("group") + 1] : null; 10965 } 10966 var module_default6 = src_default6; 10967 10968
vendor: 1,679 bytes, lines 10968-11013
10968// node_modules/@alpinejs/resize/dist/module.esm.js 10969 function src_default7(Alpine3) { 10970 Alpine3.directive("resize", Alpine3.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 10971 let evaluator = evaluateLater2(expression); 10972 let evaluate3 = (width, height) => { 10973 evaluator(() => { 10974 }, { scope: { "$width": width, "$height": height } }); 10975 }; 10976 let off2 = modifiers.includes("document") ? onDocumentResize(evaluate3) : onElResize(el, evaluate3); 10977 cleanup2(() => off2()); 10978 })); 10979 } 10980 function onElResize(el, callback) { 10981 let observer2 = new ResizeObserver((entries) => { 10982 let [width, height] = dimensions(entries); 10983 callback(width, height); 10984 }); 10985 observer2.observe(el); 10986 return () => observer2.disconnect(); 10987 } 10988 var documentResizeObserver; 10989 var documentResizeObserverCallbacks = /* @__PURE__ */ new Set(); 10990 function onDocumentResize(callback) { 10991 documentResizeObserverCallbacks.add(callback); 10992 if (!documentResizeObserver) { 10993 documentResizeObserver = new ResizeObserver((entries) => { 10994 let [width, height] = dimensions(entries); 10995 documentResizeObserverCallbacks.forEach((i) => i(width, height)); 10996 }); 10997 documentResizeObserver.observe(document.documentElement); 10998 } 10999 return () => { 11000 documentResizeObserverCallbacks.delete(callback); 11001 }; 11002 } 11003 function dimensions(entries) { 11004 let width, height; 11005 for (let entry of entries) { 11006 width = entry.borderBoxSize[0].inlineSize; 11007 height = entry.borderBoxSize[0].blockSize; 11008 } 11009 return [width, height]; 11010 } 11011 var module_default7 = src_default7; 11012 11013
vendor: 43,028 bytes, lines 11013-12265
11013// node_modules/@alpinejs/anchor/dist/module.esm.js 11014 var min = Math.min; 11015 var max = Math.max; 11016 var round = Math.round; 11017 var floor = Math.floor; 11018 var createCoords = (v) => ({ 11019 x: v, 11020 y: v 11021 }); 11022 var oppositeSideMap = { 11023 left: "right", 11024 right: "left", 11025 bottom: "top", 11026 top: "bottom" 11027 }; 11028 var oppositeAlignmentMap = { 11029 start: "end", 11030 end: "start" 11031 }; 11032 function clamp(start3, value, end) { 11033 return max(start3, min(value, end)); 11034 } 11035 function evaluate2(value, param) { 11036 return typeof value === "function" ? value(param) : value; 11037 } 11038 function getSide(placement) { 11039 return placement.split("-")[0]; 11040 } 11041 function getAlignment(placement) { 11042 return placement.split("-")[1]; 11043 } 11044 function getOppositeAxis(axis) { 11045 return axis === "x" ? "y" : "x"; 11046 } 11047 function getAxisLength(axis) { 11048 return axis === "y" ? "height" : "width"; 11049 } 11050 function getSideAxis(placement) { 11051 return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; 11052 } 11053 function getAlignmentAxis(placement) { 11054 return getOppositeAxis(getSideAxis(placement)); 11055 } 11056 function getAlignmentSides(placement, rects, rtl) { 11057 if (rtl === void 0) { 11058 rtl = false; 11059 } 11060 const alignment = getAlignment(placement); 11061 const alignmentAxis = getAlignmentAxis(placement); 11062 const length = getAxisLength(alignmentAxis); 11063 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 11064 if (rects.reference[length] > rects.floating[length]) { 11065 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 11066 } 11067 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 11068 } 11069 function getExpandedPlacements(placement) { 11070 const oppositePlacement = getOppositePlacement(placement); 11071 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 11072 } 11073 function getOppositeAlignmentPlacement(placement) { 11074 return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); 11075 } 11076 function getSideList(side, isStart, rtl) { 11077 const lr = ["left", "right"]; 11078 const rl = ["right", "left"]; 11079 const tb = ["top", "bottom"]; 11080 const bt = ["bottom", "top"]; 11081 switch (side) { 11082 case "top": 11083 case "bottom": 11084 if (rtl) 11085 return isStart ? rl : lr; 11086 return isStart ? lr : rl; 11087 case "left": 11088 case "right": 11089 return isStart ? tb : bt; 11090 default: 11091 return []; 11092 } 11093 } 11094 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 11095 const alignment = getAlignment(placement); 11096 let list = getSideList(getSide(placement), direction === "start", rtl); 11097 if (alignment) { 11098 list = list.map((side) => side + "-" + alignment); 11099 if (flipAlignment) { 11100 list = list.concat(list.map(getOppositeAlignmentPlacement)); 11101 } 11102 } 11103 return list; 11104 } 11105 function getOppositePlacement(placement) { 11106 return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); 11107 } 11108 function expandPaddingObject(padding) { 11109 return { 11110 top: 0, 11111 right: 0, 11112 bottom: 0, 11113 left: 0, 11114 ...padding 11115 }; 11116 } 11117 function getPaddingObject(padding) { 11118 return typeof padding !== "number" ? expandPaddingObject(padding) : { 11119 top: padding, 11120 right: padding, 11121 bottom: padding, 11122 left: padding 11123 }; 11124 } 11125 function rectToClientRect(rect) { 11126 return { 11127 ...rect, 11128 top: rect.y, 11129 left: rect.x, 11130 right: rect.x + rect.width, 11131 bottom: rect.y + rect.height 11132 }; 11133 } 11134 function computeCoordsFromPlacement(_ref, placement, rtl) { 11135 let { 11136 reference, 11137 floating 11138 } = _ref; 11139 const sideAxis = getSideAxis(placement); 11140 const alignmentAxis = getAlignmentAxis(placement); 11141 const alignLength = getAxisLength(alignmentAxis); 11142 const side = getSide(placement); 11143 const isVertical = sideAxis === "y"; 11144 const commonX = reference.x + reference.width / 2 - floating.width / 2; 11145 const commonY = reference.y + reference.height / 2 - floating.height / 2; 11146 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 11147 let coords; 11148 switch (side) { 11149 case "top": 11150 coords = { 11151 x: commonX, 11152 y: reference.y - floating.height 11153 }; 11154 break; 11155 case "bottom": 11156 coords = { 11157 x: commonX, 11158 y: reference.y + reference.height 11159 }; 11160 break; 11161 case "right": 11162 coords = { 11163 x: reference.x + reference.width, 11164 y: commonY 11165 }; 11166 break; 11167 case "left": 11168 coords = { 11169 x: reference.x - floating.width, 11170 y: commonY 11171 }; 11172 break; 11173 default: 11174 coords = { 11175 x: reference.x, 11176 y: reference.y 11177 }; 11178 } 11179 switch (getAlignment(placement)) { 11180 case "start": 11181 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 11182 break; 11183 case "end": 11184 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 11185 break; 11186 } 11187 return coords; 11188 } 11189 var computePosition = async (reference, floating, config) => { 11190 const { 11191 placement = "bottom", 11192 strategy = "absolute", 11193 middleware = [], 11194 platform: platform2 11195 } = config; 11196 const validMiddleware = middleware.filter(Boolean); 11197 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); 11198 let rects = await platform2.getElementRects({ 11199 reference, 11200 floating, 11201 strategy 11202 }); 11203 let { 11204 x, 11205 y 11206 } = computeCoordsFromPlacement(rects, placement, rtl); 11207 let statefulPlacement = placement; 11208 let middlewareData = {}; 11209 let resetCount = 0; 11210 for (let i = 0; i < validMiddleware.length; i++) { 11211 const { 11212 name, 11213 fn 11214 } = validMiddleware[i]; 11215 const { 11216 x: nextX, 11217 y: nextY, 11218 data: data2, 11219 reset 11220 } = await fn({ 11221 x, 11222 y, 11223 initialPlacement: placement, 11224 placement: statefulPlacement, 11225 strategy, 11226 middlewareData, 11227 rects, 11228 platform: platform2, 11229 elements: { 11230 reference, 11231 floating 11232 } 11233 }); 11234 x = nextX != null ? nextX : x; 11235 y = nextY != null ? nextY : y; 11236 middlewareData = { 11237 ...middlewareData, 11238 [name]: { 11239 ...middlewareData[name], 11240 ...data2 11241 } 11242 }; 11243 if (reset && resetCount <= 50) { 11244 resetCount++; 11245 if (typeof reset === "object") { 11246 if (reset.placement) { 11247 statefulPlacement = reset.placement; 11248 } 11249 if (reset.rects) { 11250 rects = reset.rects === true ? await platform2.getElementRects({ 11251 reference, 11252 floating, 11253 strategy 11254 }) : reset.rects; 11255 } 11256 ({ 11257 x, 11258 y 11259 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 11260 } 11261 i = -1; 11262 continue; 11263 } 11264 } 11265 return { 11266 x, 11267 y, 11268 placement: statefulPlacement, 11269 strategy, 11270 middlewareData 11271 }; 11272 }; 11273 async function detectOverflow(state, options) { 11274 var _await$platform$isEle; 11275 if (options === void 0) { 11276 options = {}; 11277 } 11278 const { 11279 x, 11280 y, 11281 platform: platform2, 11282 rects, 11283 elements, 11284 strategy 11285 } = state; 11286 const { 11287 boundary = "clippingAncestors", 11288 rootBoundary = "viewport", 11289 elementContext = "floating", 11290 altBoundary = false, 11291 padding = 0 11292 } = evaluate2(options, state); 11293 const paddingObject = getPaddingObject(padding); 11294 const altContext = elementContext === "floating" ? "reference" : "floating"; 11295 const element = elements[altBoundary ? altContext : elementContext]; 11296 const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ 11297 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)), 11298 boundary, 11299 rootBoundary, 11300 strategy 11301 })); 11302 const rect = elementContext === "floating" ? { 11303 ...rects.floating, 11304 x, 11305 y 11306 } : rects.reference; 11307 const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); 11308 const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { 11309 x: 1, 11310 y: 1 11311 } : { 11312 x: 1, 11313 y: 1 11314 }; 11315 const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ 11316 rect, 11317 offsetParent, 11318 strategy 11319 }) : rect); 11320 return { 11321 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 11322 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 11323 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 11324 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 11325 }; 11326 } 11327 var flip = function(options) { 11328 if (options === void 0) { 11329 options = {}; 11330 } 11331 return { 11332 name: "flip", 11333 options, 11334 async fn(state) { 11335 var _middlewareData$arrow, _middlewareData$flip; 11336 const { 11337 placement, 11338 middlewareData, 11339 rects, 11340 initialPlacement, 11341 platform: platform2, 11342 elements 11343 } = state; 11344 const { 11345 mainAxis: checkMainAxis = true, 11346 crossAxis: checkCrossAxis = true, 11347 fallbackPlacements: specifiedFallbackPlacements, 11348 fallbackStrategy = "bestFit", 11349 fallbackAxisSideDirection = "none", 11350 flipAlignment = true, 11351 ...detectOverflowOptions 11352 } = evaluate2(options, state); 11353 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 11354 return {}; 11355 } 11356 const side = getSide(placement); 11357 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 11358 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); 11359 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 11360 if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") { 11361 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 11362 } 11363 const placements2 = [initialPlacement, ...fallbackPlacements]; 11364 const overflow = await detectOverflow(state, detectOverflowOptions); 11365 const overflows = []; 11366 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 11367 if (checkMainAxis) { 11368 overflows.push(overflow[side]); 11369 } 11370 if (checkCrossAxis) { 11371 const sides2 = getAlignmentSides(placement, rects, rtl); 11372 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 11373 } 11374 overflowsData = [...overflowsData, { 11375 placement, 11376 overflows 11377 }]; 11378 if (!overflows.every((side2) => side2 <= 0)) { 11379 var _middlewareData$flip2, _overflowsData$filter; 11380 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 11381 const nextPlacement = placements2[nextIndex]; 11382 if (nextPlacement) { 11383 return { 11384 data: { 11385 index: nextIndex, 11386 overflows: overflowsData 11387 }, 11388 reset: { 11389 placement: nextPlacement 11390 } 11391 }; 11392 } 11393 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; 11394 if (!resetPlacement) { 11395 switch (fallbackStrategy) { 11396 case "bestFit": { 11397 var _overflowsData$map$so; 11398 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]; 11399 if (placement2) { 11400 resetPlacement = placement2; 11401 } 11402 break; 11403 } 11404 case "initialPlacement": 11405 resetPlacement = initialPlacement; 11406 break; 11407 } 11408 } 11409 if (placement !== resetPlacement) { 11410 return { 11411 reset: { 11412 placement: resetPlacement 11413 } 11414 }; 11415 } 11416 } 11417 return {}; 11418 } 11419 }; 11420 }; 11421 async function convertValueToCoords(state, options) { 11422 const { 11423 placement, 11424 platform: platform2, 11425 elements 11426 } = state; 11427 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); 11428 const side = getSide(placement); 11429 const alignment = getAlignment(placement); 11430 const isVertical = getSideAxis(placement) === "y"; 11431 const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1; 11432 const crossAxisMulti = rtl && isVertical ? -1 : 1; 11433 const rawValue = evaluate2(options, state); 11434 let { 11435 mainAxis, 11436 crossAxis, 11437 alignmentAxis 11438 } = typeof rawValue === "number" ? { 11439 mainAxis: rawValue, 11440 crossAxis: 0, 11441 alignmentAxis: null 11442 } : { 11443 mainAxis: 0, 11444 crossAxis: 0, 11445 alignmentAxis: null, 11446 ...rawValue 11447 }; 11448 if (alignment && typeof alignmentAxis === "number") { 11449 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 11450 } 11451 return isVertical ? { 11452 x: crossAxis * crossAxisMulti, 11453 y: mainAxis * mainAxisMulti 11454 } : { 11455 x: mainAxis * mainAxisMulti, 11456 y: crossAxis * crossAxisMulti 11457 }; 11458 } 11459 var offset = function(options) { 11460 if (options === void 0) { 11461 options = 0; 11462 } 11463 return { 11464 name: "offset", 11465 options, 11466 async fn(state) { 11467 const { 11468 x, 11469 y 11470 } = state; 11471 const diffCoords = await convertValueToCoords(state, options); 11472 return { 11473 x: x + diffCoords.x, 11474 y: y + diffCoords.y, 11475 data: diffCoords 11476 }; 11477 } 11478 }; 11479 }; 11480 var shift = function(options) { 11481 if (options === void 0) { 11482 options = {}; 11483 } 11484 return { 11485 name: "shift", 11486 options, 11487 async fn(state) { 11488 const { 11489 x, 11490 y, 11491 placement 11492 } = state; 11493 const { 11494 mainAxis: checkMainAxis = true, 11495 crossAxis: checkCrossAxis = false, 11496 limiter = { 11497 fn: (_ref) => { 11498 let { 11499 x: x2, 11500 y: y2 11501 } = _ref; 11502 return { 11503 x: x2, 11504 y: y2 11505 }; 11506 } 11507 }, 11508 ...detectOverflowOptions 11509 } = evaluate2(options, state); 11510 const coords = { 11511 x, 11512 y 11513 }; 11514 const overflow = await detectOverflow(state, detectOverflowOptions); 11515 const crossAxis = getSideAxis(getSide(placement)); 11516 const mainAxis = getOppositeAxis(crossAxis); 11517 let mainAxisCoord = coords[mainAxis]; 11518 let crossAxisCoord = coords[crossAxis]; 11519 if (checkMainAxis) { 11520 const minSide = mainAxis === "y" ? "top" : "left"; 11521 const maxSide = mainAxis === "y" ? "bottom" : "right"; 11522 const min2 = mainAxisCoord + overflow[minSide]; 11523 const max2 = mainAxisCoord - overflow[maxSide]; 11524 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 11525 } 11526 if (checkCrossAxis) { 11527 const minSide = crossAxis === "y" ? "top" : "left"; 11528 const maxSide = crossAxis === "y" ? "bottom" : "right"; 11529 const min2 = crossAxisCoord + overflow[minSide]; 11530 const max2 = crossAxisCoord - overflow[maxSide]; 11531 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 11532 } 11533 const limitedCoords = limiter.fn({ 11534 ...state, 11535 [mainAxis]: mainAxisCoord, 11536 [crossAxis]: crossAxisCoord 11537 }); 11538 return { 11539 ...limitedCoords, 11540 data: { 11541 x: limitedCoords.x - x, 11542 y: limitedCoords.y - y 11543 } 11544 }; 11545 } 11546 }; 11547 }; 11548 function getNodeName(node) { 11549 if (isNode(node)) { 11550 return (node.nodeName || "").toLowerCase(); 11551 } 11552 return "#document"; 11553 } 11554 function getWindow(node) { 11555 var _node$ownerDocument; 11556 return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 11557 } 11558 function getDocumentElement(node) { 11559 var _ref; 11560 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 11561 } 11562 function isNode(value) { 11563 return value instanceof Node || value instanceof getWindow(value).Node; 11564 } 11565 function isElement(value) { 11566 return value instanceof Element || value instanceof getWindow(value).Element; 11567 } 11568 function isHTMLElement(value) { 11569 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 11570 } 11571 function isShadowRoot(value) { 11572 if (typeof ShadowRoot === "undefined") { 11573 return false; 11574 } 11575 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 11576 } 11577 function isOverflowElement(element) { 11578 const { 11579 overflow, 11580 overflowX, 11581 overflowY, 11582 display 11583 } = getComputedStyle2(element); 11584 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); 11585 } 11586 function isTableElement(element) { 11587 return ["table", "td", "th"].includes(getNodeName(element)); 11588 } 11589 function isContainingBlock(element) { 11590 const webkit = isWebKit(); 11591 const css2 = getComputedStyle2(element); 11592 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)); 11593 } 11594 function getContainingBlock(element) { 11595 let currentNode = getParentNode(element); 11596 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 11597 if (isContainingBlock(currentNode)) { 11598 return currentNode; 11599 } else { 11600 currentNode = getParentNode(currentNode); 11601 } 11602 } 11603 return null; 11604 } 11605 function isWebKit() { 11606 if (typeof CSS === "undefined" || !CSS.supports) 11607 return false; 11608 return CSS.supports("-webkit-backdrop-filter", "none"); 11609 } 11610 function isLastTraversableNode(node) { 11611 return ["html", "body", "#document"].includes(getNodeName(node)); 11612 } 11613 function getComputedStyle2(element) { 11614 return getWindow(element).getComputedStyle(element); 11615 } 11616 function getNodeScroll(element) { 11617 if (isElement(element)) { 11618 return { 11619 scrollLeft: element.scrollLeft, 11620 scrollTop: element.scrollTop 11621 }; 11622 } 11623 return { 11624 scrollLeft: element.pageXOffset, 11625 scrollTop: element.pageYOffset 11626 }; 11627 } 11628 function getParentNode(node) { 11629 if (getNodeName(node) === "html") { 11630 return node; 11631 } 11632 const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node); 11633 return isShadowRoot(result) ? result.host : result; 11634 } 11635 function getNearestOverflowAncestor(node) { 11636 const parentNode = getParentNode(node); 11637 if (isLastTraversableNode(parentNode)) { 11638 return node.ownerDocument ? node.ownerDocument.body : node.body; 11639 } 11640 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 11641 return parentNode; 11642 } 11643 return getNearestOverflowAncestor(parentNode); 11644 } 11645 function getOverflowAncestors(node, list, traverseIframes) { 11646 var _node$ownerDocument2; 11647 if (list === void 0) { 11648 list = []; 11649 } 11650 if (traverseIframes === void 0) { 11651 traverseIframes = true; 11652 } 11653 const scrollableAncestor = getNearestOverflowAncestor(node); 11654 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 11655 const win = getWindow(scrollableAncestor); 11656 if (isBody) { 11657 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []); 11658 } 11659 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 11660 } 11661 function getCssDimensions(element) { 11662 const css2 = getComputedStyle2(element); 11663 let width = parseFloat(css2.width) || 0; 11664 let height = parseFloat(css2.height) || 0; 11665 const hasOffset = isHTMLElement(element); 11666 const offsetWidth = hasOffset ? element.offsetWidth : width; 11667 const offsetHeight = hasOffset ? element.offsetHeight : height; 11668 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 11669 if (shouldFallback) { 11670 width = offsetWidth; 11671 height = offsetHeight; 11672 } 11673 return { 11674 width, 11675 height, 11676 $: shouldFallback 11677 }; 11678 } 11679 function unwrapElement(element) { 11680 return !isElement(element) ? element.contextElement : element; 11681 } 11682 function getScale(element) { 11683 const domElement = unwrapElement(element); 11684 if (!isHTMLElement(domElement)) { 11685 return createCoords(1); 11686 } 11687 const rect = domElement.getBoundingClientRect(); 11688 const { 11689 width, 11690 height, 11691 $ 11692 } = getCssDimensions(domElement); 11693 let x = ($ ? round(rect.width) : rect.width) / width; 11694 let y = ($ ? round(rect.height) : rect.height) / height; 11695 if (!x || !Number.isFinite(x)) { 11696 x = 1; 11697 } 11698 if (!y || !Number.isFinite(y)) { 11699 y = 1; 11700 } 11701 return { 11702 x, 11703 y 11704 }; 11705 } 11706 var noOffsets = /* @__PURE__ */ createCoords(0); 11707 function getVisualOffsets(element) { 11708 const win = getWindow(element); 11709 if (!isWebKit() || !win.visualViewport) { 11710 return noOffsets; 11711 } 11712 return { 11713 x: win.visualViewport.offsetLeft, 11714 y: win.visualViewport.offsetTop 11715 }; 11716 } 11717 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 11718 if (isFixed === void 0) { 11719 isFixed = false; 11720 } 11721 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 11722 return false; 11723 } 11724 return isFixed; 11725 } 11726 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 11727 if (includeScale === void 0) { 11728 includeScale = false; 11729 } 11730 if (isFixedStrategy === void 0) { 11731 isFixedStrategy = false; 11732 } 11733 const clientRect = element.getBoundingClientRect(); 11734 const domElement = unwrapElement(element); 11735 let scale = createCoords(1); 11736 if (includeScale) { 11737 if (offsetParent) { 11738 if (isElement(offsetParent)) { 11739 scale = getScale(offsetParent); 11740 } 11741 } else { 11742 scale = getScale(element); 11743 } 11744 } 11745 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 11746 let x = (clientRect.left + visualOffsets.x) / scale.x; 11747 let y = (clientRect.top + visualOffsets.y) / scale.y; 11748 let width = clientRect.width / scale.x; 11749 let height = clientRect.height / scale.y; 11750 if (domElement) { 11751 const win = getWindow(domElement); 11752 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 11753 let currentIFrame = win.frameElement; 11754 while (currentIFrame && offsetParent && offsetWin !== win) { 11755 const iframeScale = getScale(currentIFrame); 11756 const iframeRect = currentIFrame.getBoundingClientRect(); 11757 const css2 = getComputedStyle2(currentIFrame); 11758 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css2.paddingLeft)) * iframeScale.x; 11759 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css2.paddingTop)) * iframeScale.y; 11760 x *= iframeScale.x; 11761 y *= iframeScale.y; 11762 width *= iframeScale.x; 11763 height *= iframeScale.y; 11764 x += left; 11765 y += top; 11766 currentIFrame = getWindow(currentIFrame).frameElement; 11767 } 11768 } 11769 return rectToClientRect({ 11770 width, 11771 height, 11772 x, 11773 y 11774 }); 11775 } 11776 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 11777 let { 11778 rect, 11779 offsetParent, 11780 strategy 11781 } = _ref; 11782 const isOffsetParentAnElement = isHTMLElement(offsetParent); 11783 const documentElement = getDocumentElement(offsetParent); 11784 if (offsetParent === documentElement) { 11785 return rect; 11786 } 11787 let scroll = { 11788 scrollLeft: 0, 11789 scrollTop: 0 11790 }; 11791 let scale = createCoords(1); 11792 const offsets = createCoords(0); 11793 if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") { 11794 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 11795 scroll = getNodeScroll(offsetParent); 11796 } 11797 if (isHTMLElement(offsetParent)) { 11798 const offsetRect = getBoundingClientRect(offsetParent); 11799 scale = getScale(offsetParent); 11800 offsets.x = offsetRect.x + offsetParent.clientLeft; 11801 offsets.y = offsetRect.y + offsetParent.clientTop; 11802 } 11803 } 11804 return { 11805 width: rect.width * scale.x, 11806 height: rect.height * scale.y, 11807 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, 11808 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y 11809 }; 11810 } 11811 function getClientRects(element) { 11812 return Array.from(element.getClientRects()); 11813 } 11814 function getWindowScrollBarX(element) { 11815 return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; 11816 } 11817 function getDocumentRect(element) { 11818 const html = getDocumentElement(element); 11819 const scroll = getNodeScroll(element); 11820 const body = element.ownerDocument.body; 11821 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 11822 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 11823 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 11824 const y = -scroll.scrollTop; 11825 if (getComputedStyle2(body).direction === "rtl") { 11826 x += max(html.clientWidth, body.clientWidth) - width; 11827 } 11828 return { 11829 width, 11830 height, 11831 x, 11832 y 11833 }; 11834 } 11835 function getViewportRect(element, strategy) { 11836 const win = getWindow(element); 11837 const html = getDocumentElement(element); 11838 const visualViewport = win.visualViewport; 11839 let width = html.clientWidth; 11840 let height = html.clientHeight; 11841 let x = 0; 11842 let y = 0; 11843 if (visualViewport) { 11844 width = visualViewport.width; 11845 height = visualViewport.height; 11846 const visualViewportBased = isWebKit(); 11847 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 11848 x = visualViewport.offsetLeft; 11849 y = visualViewport.offsetTop; 11850 } 11851 } 11852 return { 11853 width, 11854 height, 11855 x, 11856 y 11857 }; 11858 } 11859 function getInnerBoundingClientRect(element, strategy) { 11860 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 11861 const top = clientRect.top + element.clientTop; 11862 const left = clientRect.left + element.clientLeft; 11863 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 11864 const width = element.clientWidth * scale.x; 11865 const height = element.clientHeight * scale.y; 11866 const x = left * scale.x; 11867 const y = top * scale.y; 11868 return { 11869 width, 11870 height, 11871 x, 11872 y 11873 }; 11874 } 11875 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 11876 let rect; 11877 if (clippingAncestor === "viewport") { 11878 rect = getViewportRect(element, strategy); 11879 } else if (clippingAncestor === "document") { 11880 rect = getDocumentRect(getDocumentElement(element)); 11881 } else if (isElement(clippingAncestor)) { 11882 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 11883 } else { 11884 const visualOffsets = getVisualOffsets(element); 11885 rect = { 11886 ...clippingAncestor, 11887 x: clippingAncestor.x - visualOffsets.x, 11888 y: clippingAncestor.y - visualOffsets.y 11889 }; 11890 } 11891 return rectToClientRect(rect); 11892 } 11893 function hasFixedPositionAncestor(element, stopNode) { 11894 const parentNode = getParentNode(element); 11895 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 11896 return false; 11897 } 11898 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 11899 } 11900 function getClippingElementAncestors(element, cache) { 11901 const cachedResult = cache.get(element); 11902 if (cachedResult) { 11903 return cachedResult; 11904 } 11905 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 11906 let currentContainingBlockComputedStyle = null; 11907 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 11908 let currentNode = elementIsFixed ? getParentNode(element) : element; 11909 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 11910 const computedStyle = getComputedStyle2(currentNode); 11911 const currentNodeIsContaining = isContainingBlock(currentNode); 11912 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 11913 currentContainingBlockComputedStyle = null; 11914 } 11915 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 11916 if (shouldDropCurrentNode) { 11917 result = result.filter((ancestor) => ancestor !== currentNode); 11918 } else { 11919 currentContainingBlockComputedStyle = computedStyle; 11920 } 11921 currentNode = getParentNode(currentNode); 11922 } 11923 cache.set(element, result); 11924 return result; 11925 } 11926 function getClippingRect(_ref) { 11927 let { 11928 element, 11929 boundary, 11930 rootBoundary, 11931 strategy 11932 } = _ref; 11933 const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary); 11934 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 11935 const firstClippingAncestor = clippingAncestors[0]; 11936 const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { 11937 const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); 11938 accRect.top = max(rect.top, accRect.top); 11939 accRect.right = min(rect.right, accRect.right); 11940 accRect.bottom = min(rect.bottom, accRect.bottom); 11941 accRect.left = max(rect.left, accRect.left); 11942 return accRect; 11943 }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); 11944 return { 11945 width: clippingRect.right - clippingRect.left, 11946 height: clippingRect.bottom - clippingRect.top, 11947 x: clippingRect.left, 11948 y: clippingRect.top 11949 }; 11950 } 11951 function getDimensions(element) { 11952 return getCssDimensions(element); 11953 } 11954 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 11955 const isOffsetParentAnElement = isHTMLElement(offsetParent); 11956 const documentElement = getDocumentElement(offsetParent); 11957 const isFixed = strategy === "fixed"; 11958 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 11959 let scroll = { 11960 scrollLeft: 0, 11961 scrollTop: 0 11962 }; 11963 const offsets = createCoords(0); 11964 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 11965 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 11966 scroll = getNodeScroll(offsetParent); 11967 } 11968 if (isOffsetParentAnElement) { 11969 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 11970 offsets.x = offsetRect.x + offsetParent.clientLeft; 11971 offsets.y = offsetRect.y + offsetParent.clientTop; 11972 } else if (documentElement) { 11973 offsets.x = getWindowScrollBarX(documentElement); 11974 } 11975 } 11976 return { 11977 x: rect.left + scroll.scrollLeft - offsets.x, 11978 y: rect.top + scroll.scrollTop - offsets.y, 11979 width: rect.width, 11980 height: rect.height 11981 }; 11982 } 11983 function getTrueOffsetParent(element, polyfill) { 11984 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 11985 return null; 11986 } 11987 if (polyfill) { 11988 return polyfill(element); 11989 } 11990 return element.offsetParent; 11991 } 11992 function getOffsetParent(element, polyfill) { 11993 const window2 = getWindow(element); 11994 if (!isHTMLElement(element)) { 11995 return window2; 11996 } 11997 let offsetParent = getTrueOffsetParent(element, polyfill); 11998 while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") { 11999 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 12000 } 12001 if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static" && !isContainingBlock(offsetParent))) { 12002 return window2; 12003 } 12004 return offsetParent || getContainingBlock(element) || window2; 12005 } 12006 var getElementRects = async function(_ref) { 12007 let { 12008 reference, 12009 floating, 12010 strategy 12011 } = _ref; 12012 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 12013 const getDimensionsFn = this.getDimensions; 12014 return { 12015 reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy), 12016 floating: { 12017 x: 0, 12018 y: 0, 12019 ...await getDimensionsFn(floating) 12020 } 12021 }; 12022 }; 12023 function isRTL(element) { 12024 return getComputedStyle2(element).direction === "rtl"; 12025 } 12026 var platform = { 12027 convertOffsetParentRelativeRectToViewportRelativeRect, 12028 getDocumentElement, 12029 getClippingRect, 12030 getOffsetParent, 12031 getElementRects, 12032 getClientRects, 12033 getDimensions, 12034 getScale, 12035 isElement, 12036 isRTL 12037 }; 12038 function observeMove(element, onMove) { 12039 let io = null; 12040 let timeoutId; 12041 const root = getDocumentElement(element); 12042 function cleanup2() { 12043 clearTimeout(timeoutId); 12044 io && io.disconnect(); 12045 io = null; 12046 } 12047 function refresh(skip, threshold) { 12048 if (skip === void 0) { 12049 skip = false; 12050 } 12051 if (threshold === void 0) { 12052 threshold = 1; 12053 } 12054 cleanup2(); 12055 const { 12056 left, 12057 top, 12058 width, 12059 height 12060 } = element.getBoundingClientRect(); 12061 if (!skip) { 12062 onMove(); 12063 } 12064 if (!width || !height) { 12065 return; 12066 } 12067 const insetTop = floor(top); 12068 const insetRight = floor(root.clientWidth - (left + width)); 12069 const insetBottom = floor(root.clientHeight - (top + height)); 12070 const insetLeft = floor(left); 12071 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 12072 const options = { 12073 rootMargin, 12074 threshold: max(0, min(1, threshold)) || 1 12075 }; 12076 let isFirstUpdate = true; 12077 function handleObserve(entries) { 12078 const ratio = entries[0].intersectionRatio; 12079 if (ratio !== threshold) { 12080 if (!isFirstUpdate) { 12081 return refresh(); 12082 } 12083 if (!ratio) { 12084 timeoutId = setTimeout(() => { 12085 refresh(false, 1e-7); 12086 }, 100); 12087 } else { 12088 refresh(false, ratio); 12089 } 12090 } 12091 isFirstUpdate = false; 12092 } 12093 try { 12094 io = new IntersectionObserver(handleObserve, { 12095 ...options, 12096 root: root.ownerDocument 12097 }); 12098 } catch (e) { 12099 io = new IntersectionObserver(handleObserve, options); 12100 } 12101 io.observe(element); 12102 } 12103 refresh(true); 12104 return cleanup2; 12105 } 12106 function autoUpdate(reference, floating, update, options) { 12107 if (options === void 0) { 12108 options = {}; 12109 } 12110 const { 12111 ancestorScroll = true, 12112 ancestorResize = true, 12113 elementResize = typeof ResizeObserver === "function", 12114 layoutShift = typeof IntersectionObserver === "function", 12115 animationFrame = false 12116 } = options; 12117 const referenceEl = unwrapElement(reference); 12118 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : []; 12119 ancestors.forEach((ancestor) => { 12120 ancestorScroll && ancestor.addEventListener("scroll", update, { 12121 passive: true 12122 }); 12123 ancestorResize && ancestor.addEventListener("resize", update); 12124 }); 12125 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 12126 let reobserveFrame = -1; 12127 let resizeObserver = null; 12128 if (elementResize) { 12129 resizeObserver = new ResizeObserver((_ref) => { 12130 let [firstEntry] = _ref; 12131 if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { 12132 resizeObserver.unobserve(floating); 12133 cancelAnimationFrame(reobserveFrame); 12134 reobserveFrame = requestAnimationFrame(() => { 12135 resizeObserver && resizeObserver.observe(floating); 12136 }); 12137 } 12138 update(); 12139 }); 12140 if (referenceEl && !animationFrame) { 12141 resizeObserver.observe(referenceEl); 12142 } 12143 resizeObserver.observe(floating); 12144 } 12145 let frameId; 12146 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 12147 if (animationFrame) { 12148 frameLoop(); 12149 } 12150 function frameLoop() { 12151 const nextRefRect = getBoundingClientRect(reference); 12152 if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) { 12153 update(); 12154 } 12155 prevRefRect = nextRefRect; 12156 frameId = requestAnimationFrame(frameLoop); 12157 } 12158 update(); 12159 return () => { 12160 ancestors.forEach((ancestor) => { 12161 ancestorScroll && ancestor.removeEventListener("scroll", update); 12162 ancestorResize && ancestor.removeEventListener("resize", update); 12163 }); 12164 cleanupIo && cleanupIo(); 12165 resizeObserver && resizeObserver.disconnect(); 12166 resizeObserver = null; 12167 if (animationFrame) { 12168 cancelAnimationFrame(frameId); 12169 } 12170 }; 12171 } 12172 var computePosition2 = (reference, floating, options) => { 12173 const cache = /* @__PURE__ */ new Map(); 12174 const mergedOptions = { 12175 platform, 12176 ...options 12177 }; 12178 const platformWithCache = { 12179 ...mergedOptions.platform, 12180 _c: cache 12181 }; 12182 return computePosition(reference, floating, { 12183 ...mergedOptions, 12184 platform: platformWithCache 12185 }); 12186 }; 12187 function src_default8(Alpine3) { 12188 Alpine3.magic("anchor", (el) => { 12189 if (!el._x_anchor) 12190 throw "Alpine: No x-anchor directive found on element using $anchor..."; 12191 return el._x_anchor; 12192 }); 12193 Alpine3.interceptClone((from, to) => { 12194 if (from && from._x_anchor && !to._x_anchor) { 12195 to._x_anchor = from._x_anchor; 12196 } 12197 }); 12198 Alpine3.directive("anchor", Alpine3.skipDuringClone( 12199 (el, { expression, modifiers, value }, { evaluate: evaluate22, effect: effect3, cleanup: cleanup2 }) => { 12200 let { placement, offsetValue, unstyled, strategy, allowFlip } = getOptions(modifiers); 12201 el._x_anchor = Alpine3.reactive({ x: 0, y: 0 }); 12202 let previousReference = null; 12203 let release2 = null; 12204 effect3(() => { 12205 let reference = evaluate22(expression); 12206 if (!reference) 12207 return; 12208 if (previousReference !== reference) { 12209 if (release2) 12210 release2(); 12211 previousReference = reference; 12212 let compute = () => { 12213 let previousValue; 12214 computePosition2(reference, el, { 12215 placement, 12216 strategy, 12217 middleware: [allowFlip && flip(), shift({ padding: 5 }), offset(offsetValue)] 12218 }).then(({ x, y }) => { 12219 unstyled || setStyles2(el, x, y, strategy); 12220 if (JSON.stringify({ x, y }) !== previousValue) { 12221 el._x_anchor.x = x; 12222 el._x_anchor.y = y; 12223 } 12224 previousValue = JSON.stringify({ x, y }); 12225 }); 12226 }; 12227 release2 = autoUpdate(reference, el, () => compute()); 12228 } 12229 }); 12230 cleanup2(() => { 12231 if (release2) 12232 release2(); 12233 }); 12234 }, 12235 (el, { expression, modifiers, value }, { cleanup: cleanup2, evaluate: evaluate22 }) => { 12236 let { placement, offsetValue, unstyled, strategy } = getOptions(modifiers); 12237 if (el._x_anchor) { 12238 unstyled || setStyles2(el, el._x_anchor.x, el._x_anchor.y, strategy); 12239 } 12240 } 12241 )); 12242 } 12243 function setStyles2(el, x, y, strategy = "absolute") { 12244 Object.assign(el.style, { 12245 left: x + "px", 12246 top: y + "px", 12247 position: strategy 12248 }); 12249 } 12250 function getOptions(modifiers) { 12251 let positions = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"]; 12252 let placement = positions.find((i) => modifiers.includes(i)); 12253 let offsetValue = 0; 12254 if (modifiers.includes("offset")) { 12255 let idx = modifiers.findIndex((i) => i === "offset"); 12256 offsetValue = modifiers[idx + 1] !== void 0 ? Number(modifiers[idx + 1]) : offsetValue; 12257 } 12258 let unstyled = modifiers.includes("no-style"); 12259 let allowFlip = !modifiers.includes("noflip"); 12260 let strategy = modifiers.includes("fixed") ? "fixed" : "absolute"; 12261 return { placement, offsetValue, unstyled, strategy, allowFlip }; 12262 } 12263 var module_default8 = src_default8; 12264 12265
12265// js/plugins/history/utils.js 12266 function unwrap(object) { 12267 if (object === void 0) 12268 return void 0; 12269 return JSON.parse(JSON.stringify(object)); 12270 } 12271 function batch(callback) { 12272 let batch2 = { 12273 queued: false, 12274 updates: {}, 12275 add(updates) { 12276 Object.assign(batch2.updates, updates); 12277 if (batch2.queued) 12278 return; 12279 batch2.queued = true; 12280 queueMicrotask(batch2.flush); 12281 }, 12282 flush() { 12283 if (Object.keys(batch2.updates).length) { 12284 callback(batch2.updates); 12285 } 12286 batch2.queued = false; 12287 batch2.updates = {}; 12288 } 12289 }; 12290 return batch2; 12291 } 12292 12293
12293// js/plugins/history/coordinator.js 12294 var HistoryCoordinator = class { 12295 constructor() { 12296 this.url = null; 12297 this.errorHandlers = {}; 12298 this.batch = batch((updates) => { 12299 let url = this.getUrl(); 12300 this.writeToHistory("replaceState", url, (state) => { 12301 state.alpine = { ...state.alpine, ...unwrap(updates) }; 12302 return state; 12303 }); 12304 this.url = null; 12305 }); 12306 } 12307 addErrorHandler(key, callback) { 12308 this.errorHandlers[key] = callback; 12309 } 12310 getUrl() { 12311 if (this.url) { 12312 if (this.url instanceof URL) 12313 this.url.hash = window.location.hash; 12314 return this.url; 12315 } 12316 return new URL(window.location.href); 12317 } 12318 replaceState(url, updates) { 12319 this.url = url; 12320 this.batch.add(updates); 12321 } 12322 pushState(url, updates) { 12323 this.batch.flush(); 12324 this.writeToHistory("pushState", url, (state) => { 12325 state = { alpine: { ...state.alpine, ...unwrap(updates) } }; 12326 return state; 12327 }); 12328 } 12329 writeToHistory(method, url, callback) { 12330 let state = window.history.state || {}; 12331 if (!state.alpine) 12332 state.alpine = {}; 12333 state = callback(state);
12334 try { 12335 window.history[method](state, "", url.toString()); 12336 } catch (error2) { 12337 Object.values(this.errorHandlers).forEach( 12338 (handler4) => typeof handler4 === "function" && handler4(error2, url) 12339 ); 12340 this.errorHandlers = {}; 12341 console.error(error2); 12342 } 12343 } 12344 }; 12345 var historyCoordinator = new HistoryCoordinator(); 12346 var coordinator_default = historyCoordinator; 12347 12348
12348// js/plugins/navigate/history.js 12349 var Snapshot = class { 12350 constructor(url, html) { 12351 this.url = url; 12352 this.html = html; 12353 } 12354 }; 12355 var snapshotCache = { 12356 currentKey: null, 12357 currentUrl: null, 12358 keys: [], 12359 lookup: {}, 12360 limit: 10, 12361 has(location) { 12362 return this.lookup[location] !== void 0; 12363 }, 12364 retrieve(location) { 12365 let snapshot = this.lookup[location]; 12366 if (snapshot === void 0) 12367 throw "No back button cache found for current location: " + location; 12368 return snapshot; 12369 }, 12370 replace(key, snapshot) { 12371 if (this.has(key)) { 12372 this.lookup[key] = snapshot; 12373 } else { 12374 this.push(key, snapshot); 12375 } 12376 }, 12377 push(key, snapshot) { 12378 this.lookup[key] = snapshot; 12379 let index2 = this.keys.indexOf(key); 12380 if (index2 > -1) 12381 this.keys.splice(index2, 1); 12382 this.keys.unshift(key); 12383 this.trim(); 12384 }, 12385 trim() { 12386 for (let key of this.keys.splice(this.limit)) { 12387 delete this.lookup[key]; 12388 } 12389 } 12390 }; 12391 var currentPageStatus = null; 12392 function storeCurrentPageStatus(status) { 12393 currentPageStatus = status; 12394 } 12395 function updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks() { 12396 let url = coordinator_default.getUrl(); 12397 replaceUrl(url, document.documentElement.outerHTML); 12398 } 12399 function updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(key, url) { 12400 let html = document.documentElement.outerHTML; 12401 snapshotCache.replace(key, new Snapshot(url, html)); 12402 } 12403 function whenTheBackOrForwardButtonIsClicked(registerFallback, handleHtml) { 12404 let fallback2; 12405 registerFallback((i) => fallback2 = i); 12406 window.addEventListener("popstate", (e) => { 12407 let state = e.state || {}; 12408 let alpine = state.alpine || {}; 12409 if (currentPageStatus && (currentPageStatus < 200 || currentPageStatus >= 300)) { 12410 return window.location.href = alpine.url; 12411 } 12412 if (Object.keys(state).length === 0) 12413 return; 12414 if (!alpine.snapshotIdx) 12415 return; 12416 if (snapshotCache.has(alpine.snapshotIdx)) { 12417 let snapshot = snapshotCache.retrieve(alpine.snapshotIdx); 12418 handleHtml(snapshot.html, snapshot.url, snapshotCache.currentUrl, snapshotCache.currentKey); 12419 snapshotCache.currentKey = alpine.snapshotIdx; 12420 snapshotCache.currentUrl = snapshot.url; 12421 } else { 12422 snapshotCache.currentKey = null; 12423 snapshotCache.currentUrl = null; 12424 fallback2(alpine.url); 12425 } 12426 }); 12427 } 12428 function updateUrlAndStoreLatestHtmlForFutureBackButtons(html, destination) { 12429 pushUrl(destination, html); 12430 } 12431 function pushUrl(url, html) { 12432 updateUrl("pushState", url, html); 12433 } 12434 function replaceUrl(url, html) { 12435 updateUrl("replaceState", url, html); 12436 } 12437 function updateUrl(method, url, html) { 12438 let key = url.toString() + "-" + Math.random(); 12439 method === "pushState" ? snapshotCache.push(key, new Snapshot(url, html)) : snapshotCache.replace(key = snapshotCache.currentKey ?? key, new Snapshot(url, html)); 12440 coordinator_default.addErrorHandler("navigate", (error2) => { 12441 if (error2 instanceof DOMException && error2.name === "SecurityError") { 12442 console.error( 12443 "Livewire: You can't use wire:navigate with a link to a different root domain: " + url 12444 ); 12445 } 12446 }); 12447 coordinator_default[method](url, { snapshotIdx: key, url: url.toString() }); 12448 snapshotCache.currentKey = key; 12449 snapshotCache.currentUrl = url; 12450 } 12451 12452
12452// js/plugins/navigate/links.js 12453 function whenThisLinkIsPressed(el, callback) { 12454 let isProgrammaticClick = (e) => !e.isTrusted; 12455 let isNotPlainLeftClick = (e) => e.which > 1 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; 12456 let isNotPlainEnterKey = (e) => e.which !== 13 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; 12457 el.addEventListener("click", (e) => { 12458 if (isProgrammaticClick(e)) { 12459 if (linkShouldBeHandledNatively(el)) 12460 return; 12461 e.preventDefault(); 12462 callback((whenReleased) => whenReleased()); 12463 return; 12464 } 12465 if (isNotPlainLeftClick(e)) 12466 return; 12467 if (linkShouldBeHandledNatively(el)) 12468 return; 12469 e.preventDefault(); 12470 }); 12471 el.addEventListener("mousedown", (e) => { 12472 if (isNotPlainLeftClick(e)) 12473 return; 12474 if (linkShouldBeHandledNatively(el)) 12475 return; 12476 e.preventDefault(); 12477 callback((whenReleased) => { 12478 let handler4 = (e2) => { 12479 e2.preventDefault(); 12480 requestAnimationFrame(() => { 12481 whenReleased(); 12482 }); 12483 el.removeEventListener("mouseup", handler4); 12484 }; 12485 el.addEventListener("mouseup", handler4); 12486 }); 12487 }); 12488 el.addEventListener("keydown", (e) => { 12489 if (isNotPlainEnterKey(e)) 12490 return; 12491 if (linkShouldBeHandledNatively(el)) 12492 return; 12493 e.preventDefault(); 12494 callback((whenReleased) => whenReleased()); 12495 }); 12496 } 12497 function whenThisLinkIsHoveredFor(el, ms = 60, callback) { 12498 el.addEventListener("mouseenter", (e) => { 12499 let timeout = setTimeout(() => { 12500 callback(e); 12501 }, ms); 12502 let handler4 = () => { 12503 clearTimeout(timeout); 12504 el.removeEventListener("mouseleave", handler4); 12505 }; 12506 el.addEventListener("mouseleave", handler4); 12507 }); 12508 } 12509 function extractDestinationFromLink(linkEl) { 12510 return createUrlObjectFromString2(linkEl.getAttribute("href")); 12511 } 12512 function createUrlObjectFromString2(urlString) { 12513 return urlString !== null && new URL(urlString, document.baseURI); 12514 } 12515 function linkShouldBeHandledNatively(linkEl, destination = extractDestinationFromLink(linkEl)) { 12516 if (!destination) 12517 return true; 12518 if (!["http:", "https:"].includes(destination.protocol)) 12519 return true; 12520 if (destination.origin !== window.location.origin) 12521 return true; 12522 if (linkEl.hasAttribute("download")) 12523 return true; 12524 let target = linkEl.getAttribute("target")?.trim().toLowerCase(); 12525 if (target && target !== "_self") 12526 return true; 12527 return false; 12528 } 12529 function getUriStringFromUrlObject(urlObject) { 12530 return urlObject.pathname + urlObject.search + urlObject.hash; 12531 } 12532 12533
12533// js/plugins/navigate/fetch.js 12534 function fetchHtml(destination, callback, errorCallback) { 12535 let uri = getUriStringFromUrlObject(destination); 12536 performFetch(uri, (html, finalDestination, status) => { 12537 storeCurrentPageStatus(status); 12538 callback(html, finalDestination); 12539 }, errorCallback); 12540 } 12541 function performFetch(uri, callback, errorCallback) { 12542 sendNavigateRequest(uri, callback, errorCallback); 12543 } 12544 12545
12545// js/plugins/navigate/prefetch.js 12546 var prefetches = {}; 12547 var cacheDuration = 3e4; 12548 function prefetchHtml(destination, callback, errorCallback) { 12549 let uri = getUriStringFromUrlObject(destination); 12550 if (prefetches[uri]) 12551 return; 12552 prefetches[uri] = { finished: false, html: null, whenFinished: () => setTimeout(() => delete prefetches[uri], cacheDuration) }; 12553 performFetch(uri, (html, routedUri, status) => { 12554 storeCurrentPageStatus(status); 12555 callback(html, routedUri); 12556 }, () => { 12557 delete prefetches[uri]; 12558 errorCallback(); 12559 }); 12560 } 12561 function storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination) { 12562 let state = prefetches[getUriStringFromUrlObject(destination)]; 12563 state.html = html; 12564 state.finished = true; 12565 state.finalDestination = finalDestination; 12566 state.whenFinished(); 12567 } 12568 function getPretchedHtmlOr(destination, receive, ifNoPrefetchExists) { 12569 let uri = getUriStringFromUrlObject(destination); 12570 if (!prefetches[uri]) 12571 return ifNoPrefetchExists(); 12572 if (prefetches[uri].finished) { 12573 let html = prefetches[uri].html; 12574 let finalDestination = prefetches[uri].finalDestination; 12575 delete prefetches[uri]; 12576 return receive(html, finalDestination); 12577 } else { 12578 prefetches[uri].whenFinished = () => { 12579 let html = prefetches[uri].html; 12580 let finalDestination = prefetches[uri].finalDestination; 12581 delete prefetches[uri]; 12582 receive(html, finalDestination); 12583 }; 12584 } 12585 } 12586 12587
12587// js/plugins/navigate/teleport.js 12588 function packUpPersistedTeleports(persistedEl) { 12589 module_default.mutateDom(() => { 12590 persistedEl.querySelectorAll("[data-teleport-template]").forEach((i) => i._x_teleport.remove()); 12591 }); 12592 } 12593 function removeAnyLeftOverStaleTeleportTargets(body) { 12594 module_default.mutateDom(() => { 12595 body.querySelectorAll("[data-teleport-target]").forEach((i) => i.remove()); 12596 }); 12597 } 12598 function unPackPersistedTeleports(persistedEl) { 12599 module_default.walk(persistedEl, (el, skip) => { 12600 if (!el._x_teleport) 12601 return; 12602 el._x_teleportPutBack(); 12603 skip(); 12604 }); 12605 } 12606 function isTeleportTarget(el) { 12607 return el.hasAttribute("data-teleport-target"); 12608 } 12609 12610
12610// js/plugins/navigate/scroll.js 12611 function storeScrollInformationInHtmlBeforeNavigatingAway() { 12612 document.body.setAttribute("data-scroll-x", document.body.scrollLeft); 12613 document.body.setAttribute("data-scroll-y", document.body.scrollTop); 12614 document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:navigate\\:scroll]"]).forEach((el) => { 12615 el.setAttribute("data-scroll-x", el.scrollLeft); 12616 el.setAttribute("data-scroll-y", el.scrollTop); 12617 }); 12618 } 12619 function restoreScrollPositionOrScrollToTop() { 12620 let scroll = (el) => { 12621 if (!el.hasAttribute("data-scroll-x")) { 12622 window.scrollTo({ top: 0, left: 0, behavior: "instant" }); 12623 } else { 12624 el.scrollTo({ 12625 top: Number(el.getAttribute("data-scroll-y")), 12626 left: Number(el.getAttribute("data-scroll-x")), 12627 behavior: "instant" 12628 }); 12629 el.removeAttribute("data-scroll-x"); 12630 el.removeAttribute("data-scroll-y"); 12631 } 12632 }; 12633 queueMicrotask(() => { 12634 queueMicrotask(() => { 12635 scroll(document.body); 12636 document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:navigate\\:scroll]"]).forEach(scroll); 12637 }); 12638 }); 12639 } 12640 12641
12641// js/plugins/navigate/persist.js 12642 var els = {}; 12643 function storePersistantElementsForLater(callback) { 12644 els = {}; 12645 document.querySelectorAll("[x-persist]").forEach((i) => { 12646 els[i.getAttribute("x-persist")] = i; 12647 callback(i); 12648 module_default.mutateDom(() => { 12649 i.remove(); 12650 }); 12651 }); 12652 } 12653 function putPersistantElementsBack(callback) { 12654 let usedPersists = []; 12655 document.querySelectorAll("[x-persist]").forEach((i) => { 12656 let old = els[i.getAttribute("x-persist")]; 12657 if (!old) 12658 return; 12659 usedPersists.push(i.getAttribute("x-persist")); 12660 old._x_wasPersisted = true; 12661 callback(old, i); 12662 module_default.mutateDom(() => { 12663 i.replaceWith(old); 12664 }); 12665 }); 12666 Object.entries(els).forEach(([key, el]) => { 12667 if (usedPersists.includes(key)) 12668 return; 12669 module_default.destroyTree(el); 12670 }); 12671 els = {}; 12672 } 12673 function isPersistedElement(el) { 12674 return el.hasAttribute("x-persist"); 12675 } 12676 12677
12677// js/plugins/navigate/bar.js 12678 var import_nprogress = __toESM(require_nprogress()); 12679 import_nprogress.default.configure({ 12680 minimum: 0.1, 12681 trickleSpeed: 200, 12682 showSpinner: false, 12683 parent: "body" 12684 }); 12685 injectStyles(); 12686 var inProgress = false; 12687 function showAndStartProgressBar() { 12688 inProgress = true; 12689 setTimeout(() => { 12690 if (!inProgress) 12691 return; 12692 import_nprogress.default.start(); 12693 }, 150); 12694 } 12695 function finishAndHideProgressBar() { 12696 inProgress = false; 12697 import_nprogress.default.done(); 12698 } 12699 function removeAnyLeftOverStaleProgressBars() { 12700 import_nprogress.default.remove(); 12701 } 12702 function injectStyles() { 12703 let style = document.createElement("style"); 12704 style.innerHTML = `/* Make clicks pass-through */ 12705 12706 #nprogress { 12707 pointer-events: none; 12708 } 12709 12710 #nprogress .bar { 12711 background: var(--livewire-progress-bar-color, #29d); 12712 12713 position: fixed; 12714 z-index: 1031; 12715 top: 0; 12716 left: 0; 12717 12718 width: 100%; 12719 height: 2px; 12720 } 12721 12722 /* Fancy blur effect */ 12723 #nprogress .peg { 12724 display: block; 12725 position: absolute; 12726 right: 0px; 12727 width: 100px; 12728 height: 100%; 12729 box-shadow: 0 0 10px var(--livewire-progress-bar-color, #29d), 0 0 5px var(--livewire-progress-bar-color, #29d); 12730 opacity: 1.0; 12731 12732 -webkit-transform: rotate(3deg) translate(0px, -4px); 12733 -ms-transform: rotate(3deg) translate(0px, -4px); 12734 transform: rotate(3deg) translate(0px, -4px); 12735 } 12736 12737 /* Remove these to get rid of the spinner */ 12738 #nprogress .spinner { 12739 display: block; 12740 position: fixed; 12741 z-index: 1031; 12742 top: 15px; 12743 right: 15px; 12744 } 12745 12746 #nprogress .spinner-icon { 12747 width: 18px; 12748 height: 18px; 12749 box-sizing: border-box; 12750 12751 border: solid 2px transparent; 12752 border-top-color: var(--livewire-progress-bar-color, #29d); 12753 border-left-color: var(--livewire-progress-bar-color, #29d); 12754 border-radius: 50%; 12755 12756 -webkit-animation: nprogress-spinner 400ms linear infinite; 12757 animation: nprogress-spinner 400ms linear infinite; 12758 } 12759 12760 .nprogress-custom-parent { 12761 overflow: hidden; 12762 position: relative; 12763 } 12764 12765 .nprogress-custom-parent #nprogress .spinner, 12766 .nprogress-custom-parent #nprogress .bar { 12767 position: absolute; 12768 } 12769 12770 @-webkit-keyframes nprogress-spinner { 12771 0% { -webkit-transform: rotate(0deg); } 12772 100% { -webkit-transform: rotate(360deg); } 12773 } 12774 @keyframes nprogress-spinner { 12775 0% { transform: rotate(0deg); } 12776 100% { transform: rotate(360deg); } 12777 } 12778 `; 12779 let nonce2 = getNonce(); 12780 if (nonce2) 12781 style.nonce = nonce2; 12782 document.head.appendChild(style); 12783 } 12784 12785
12785// js/plugins/navigate/popover.js 12786 function packUpPersistedPopovers(persistedEl) { 12787 if (!isPopoverSupported()) 12788 return; 12789 persistedEl.querySelectorAll(":popover-open").forEach((el) => { 12790 el.setAttribute("data-navigate-popover-open", ""); 12791 let animations = el.getAnimations(); 12792 el._pausedAnimations = animations.map((animation) => ({ 12793 keyframes: animation.effect.getKeyframes(), 12794 options: { 12795 duration: animation.effect.getTiming().duration, 12796 easing: animation.effect.getTiming().easing, 12797 fill: animation.effect.getTiming().fill, 12798 iterations: animation.effect.getTiming().iterations 12799 }, 12800 currentTime: animation.currentTime, 12801 playState: animation.playState 12802 })); 12803 animations.forEach((i) => i.pause()); 12804 }); 12805 } 12806 function unPackPersistedPopovers(persistedEl) { 12807 if (!isPopoverSupported()) 12808 return; 12809 persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { 12810 el.removeAttribute("data-navigate-popover-open"); 12811 queueMicrotask(() => { 12812 if (!el.isConnected) 12813 return; 12814 el.showPopover(); 12815 el.getAnimations().forEach((i) => i.finish()); 12816 if (el._pausedAnimations) { 12817 el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { 12818 let animation = el.animate(keyframes, options); 12819 animation.currentTime = currentTime; 12820 }); 12821 delete el._pausedAnimations; 12822 } 12823 }); 12824 }); 12825 } 12826 function isPopoverSupported() { 12827 return typeof document.createElement("div").showPopover === "function"; 12828 } 12829 12830
12830// js/plugins/navigate/page.js 12831 var oldBodyScriptTagHashes = []; 12832 var attributesExemptFromScriptTagHashing = [ 12833 "data-csrf", 12834 "nonce", 12835 "aria-hidden" 12836 ]; 12837 function swapCurrentPageWithNewHtml(html, andThen) { 12838 html = replaceNoncesInHtml(html); 12839 let newDocument = new DOMParser().parseFromString(html, "text/html"); 12840 let newHtml = newDocument.documentElement; 12841 let newBody = document.adoptNode(newDocument.body); 12842 let newHead = document.adoptNode(newDocument.head); 12843 oldBodyScriptTagHashes = oldBodyScriptTagHashes.concat(Array.from(document.body.querySelectorAll("script")).map((i) => { 12844 return simpleHash(ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing)); 12845 })); 12846 let afterRemoteScriptsHaveLoaded = () => { 12847 }; 12848 replaceHtmlAttributes(newHtml); 12849 mergeNewHead(newHead).finally(() => { 12850 afterRemoteScriptsHaveLoaded(); 12851 }); 12852 prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes); 12853 let oldBody = document.body; 12854 document.body.replaceWith(newBody); 12855 Alpine.destroyTree(oldBody); 12856 andThen((i) => afterRemoteScriptsHaveLoaded = i); 12857 } 12858 function prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes2) { 12859 newBody.querySelectorAll("script").forEach((i) => { 12860 if (i.hasAttribute("data-navigate-once")) { 12861 let hash = simpleHash( 12862 ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing) 12863 ); 12864 if (oldBodyScriptTagHashes2.includes(hash)) 12865 return; 12866 } 12867 i.replaceWith(cloneScriptTag(i)); 12868 }); 12869 } 12870 function replaceHtmlAttributes(newHtmlElement) { 12871 let currentHtmlElement = document.documentElement; 12872 Array.from(newHtmlElement.attributes).forEach((attr) => { 12873 const name = attr.name; 12874 const value = attr.value; 12875 if (currentHtmlElement.getAttribute(name) !== value) { 12876 currentHtmlElement.setAttribute(name, value); 12877 } 12878 }); 12879 Array.from(currentHtmlElement.attributes).forEach((attr) => { 12880 if (!newHtmlElement.hasAttribute(attr.name)) { 12881 currentHtmlElement.removeAttribute(attr.name); 12882 } 12883 }); 12884 } 12885 function mergeNewHead(newHead) {
12886 let children = Array.from(document.head.children); 12887 let headChildrenHtmlLookup = children.map( 12888 (i) => ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing) 12889 ); 12890 let garbageCollector = document.createDocumentFragment(); 12891 let touchedHeadElements = []; 12892 let remoteScriptsPromises = []; 12893 for (let child of Array.from(newHead.children)) { 12894 if (isAsset(child)) { 12895 let childHtml = ignoreAttributes(child.outerHTML, attributesExemptFromScriptTagHashing); 12896 if (!headChildrenHtmlLookup.includes(childHtml)) { 12897 if (isTracked(child)) { 12898 if (ifTheQueryStringChangedSinceLastRequest(child, children)) { 12899 setTimeout(() => window.location.reload()); 12900 } 12901 } 12902 if (isScript(child)) { 12903 try { 12904 remoteScriptsPromises.push( 12905 injectScriptTagAndWaitForItToFullyLoad( 12906 cloneScriptTag(child) 12907 ) 12908 ); 12909 } catch (error2) { 12910 } 12911 } else { 12912 document.head.appendChild(child); 12913 } 12914 } else { 12915 garbageCollector.appendChild(child); 12916 } 12917 touchedHeadElements.push(child); 12918 } 12919 } 12920 for (let child of Array.from(document.head.children)) { 12921 if (!isAsset(child)) 12922 child.remove(); 12923 } 12924 for (let child of Array.from(newHead.children)) { 12925 if (child.tagName.toLowerCase() === "noscript") 12926 continue; 12927 document.head.appendChild(child); 12928 } 12929 return Promise.all(remoteScriptsPromises); 12930 } 12931 async function injectScriptTagAndWaitForItToFullyLoad(script) { 12932 return new Promise((resolve, reject) => { 12933 if (script.src) { 12934 script.onload = () => resolve(); 12935 script.onerror = () => reject(); 12936 } else { 12937 resolve(); 12938 } 12939 document.head.appendChild(script); 12940 }); 12941 } 12942 function isTracked(el) { 12943 return el.hasAttribute("data-navigate-track"); 12944 } 12945 function ifTheQueryStringChangedSinceLastRequest(el, currentHeadChildren) { 12946 let [uri, queryString] = extractUriAndQueryString(el); 12947 return currentHeadChildren.some((child) => { 12948 if (!isTracked(child)) 12949 return false; 12950 let [currentUri, currentQueryString] = extractUriAndQueryString(child); 12951 if (currentUri === uri && queryString !== currentQueryString) 12952 return true; 12953 }); 12954 } 12955 function extractUriAndQueryString(el) { 12956 let url = isScript(el) ? el.src : el.href; 12957 return url.split("?"); 12958 } 12959 function isAsset(el) { 12960 return el.tagName.toLowerCase() === "link" && el.getAttribute("rel").toLowerCase() === "stylesheet" || el.tagName.toLowerCase() === "style" || el.tagName.toLowerCase() === "script"; 12961 } 12962 function isScript(el) { 12963 return el.tagName.toLowerCase() === "script"; 12964 } 12965 function simpleHash(str) { 12966 return str.split("").reduce((a, b) => { 12967 a = (a << 5) - a + b.charCodeAt(0); 12968 return a & a; 12969 }, 0); 12970 } 12971 function ignoreAttributes(subject, attributesToRemove) { 12972 let result = subject; 12973 attributesToRemove.forEach((attr) => { 12974 const regex = new RegExp(`${attr}="[^"]*"|${attr}='[^']*'`, "g"); 12975 result = result.replace(regex, ""); 12976 }); 12977 result = result.replaceAll(" ", ""); 12978 return result.trim(); 12979 } 12980 12981
12981// js/plugins/navigate/index.js 12982 var enablePersist = true; 12983 var showProgressBar = true; 12984 var restoreScroll = true; 12985 function navigate_default(Alpine3) { 12986 Alpine3.navigate = (url, options = {}) => { 12987 let { preserveScroll = false } = options; 12988 let destination = createUrlObjectFromString2(url); 12989 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 12990 url: destination, 12991 history: false, 12992 cached: false 12993 }); 12994 if (prevented) 12995 return; 12996 navigateTo(destination, { preserveScroll }); 12997 }; 12998 Alpine3.navigate.disableProgressBar = () => { 12999 showProgressBar = false; 13000 }; 13001 Alpine3.addInitSelector(() => `[${Alpine3.prefixed("navigate")}]`); 13002 Alpine3.directive("navigate", (el, { modifiers }) => { 13003 let shouldPrefetchOnHover = modifiers.includes("hover"); 13004 let preserveScroll = modifiers.includes("preserve-scroll"); 13005 shouldPrefetchOnHover && whenThisLinkIsHoveredFor(el, 60, () => { 13006 let destination = extractDestinationFromLink(el); 13007 if (linkShouldBeHandledNatively(el, destination)) 13008 return; 13009 prefetchHtml(destination, (html, finalDestination) => { 13010 storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); 13011 }, () => { 13012 showProgressBar && finishAndHideProgressBar(); 13013 }); 13014 }); 13015 whenThisLinkIsPressed(el, (whenItIsReleased) => { 13016 let destination = extractDestinationFromLink(el); 13017 prefetchHtml(destination, (html, finalDestination) => { 13018 storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); 13019 }, () => { 13020 showProgressBar && finishAndHideProgressBar(); 13021 }); 13022 whenItIsReleased(() => { 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 }); 13033 }); 13034 function navigateTo(destination, { preserveScroll = false, shouldPushToHistoryState = true }) { 13035 showProgressBar && showAndStartProgressBar(); 13036 fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { 13037 let swapCallbacks = []; 13038 fireEventForOtherLibrariesToHookInto("alpine:navigating", { 13039 onSwap: (callback) => swapCallbacks.push(callback) 13040 }); 13041 restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); 13042 cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); 13043 shouldPushToHistoryState && updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks(); 13044 preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { 13045 enablePersist && storePersistantElementsForLater((persistedEl) => { 13046 packUpPersistedTeleports(persistedEl); 13047 packUpPersistedPopovers(persistedEl); 13048 }); 13049 if (shouldPushToHistoryState) { 13050 updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); 13051 } else { 13052 replaceUrl(finalDestination, html); 13053 } 13054 swapCurrentPageWithNewHtml(html, (afterNewScriptsAreDoneLoading) => { 13055 removeAnyLeftOverStaleTeleportTargets(document.body); 13056 enablePersist && putPersistantElementsBack((persistedEl, newStub) => { 13057 unPackPersistedTeleports(persistedEl); 13058 unPackPersistedPopovers(persistedEl); 13059 }); 13060 !preserveScroll && restoreScrollPositionOrScrollToTop(); 13061 swapCallbacks.forEach((callback) => callback()); 13062 afterNewScriptsAreDoneLoading(() => { 13063 andAfterAllThis(() => { 13064 nowInitializeAlpineOnTheNewPage(Alpine3); 13065 autofocusElementsWithTheAutofocusAttribute(); 13066 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 13067 showProgressBar && finishAndHideProgressBar(); 13068 }); 13069 }); 13070 }); 13071 }); 13072 }, () => { 13073 showProgressBar && finishAndHideProgressBar(); 13074 }); 13075 } 13076 whenTheBackOrForwardButtonIsClicked(
13077 (ifThePageBeingVisitedHasntBeenCached) => { 13078 ifThePageBeingVisitedHasntBeenCached((url) => { 13079 let destination = createUrlObjectFromString2(url); 13080 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 13081 url: destination, 13082 history: true, 13083 cached: false 13084 }); 13085 if (prevented) 13086 return; 13087 navigateTo(destination, { shouldPushToHistoryState: false }); 13088 }); 13089 }, 13090 (html, url, currentPageUrl, currentPageKey) => { 13091 let destination = createUrlObjectFromString2(url); 13092 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 13093 url: destination, 13094 history: true, 13095 cached: true 13096 }); 13097 if (prevented) 13098 return; 13099 storeScrollInformationInHtmlBeforeNavigatingAway(); 13100 let swapCallbacks = []; 13101 fireEventForOtherLibrariesToHookInto("alpine:navigating", { 13102 onSwap: (callback) => swapCallbacks.push(callback) 13103 }); 13104 cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); 13105 updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageKey, currentPageUrl); 13106 preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { 13107 enablePersist && storePersistantElementsForLater((persistedEl) => { 13108 packUpPersistedTeleports(persistedEl); 13109 packUpPersistedPopovers(persistedEl); 13110 }); 13111 swapCurrentPageWithNewHtml(html, () => { 13112 removeAnyLeftOverStaleProgressBars(); 13113 removeAnyLeftOverStaleTeleportTargets(document.body); 13114 enablePersist && putPersistantElementsBack((persistedEl, newStub) => { 13115 unPackPersistedTeleports(persistedEl); 13116 unPackPersistedPopovers(persistedEl); 13117 }); 13118 restoreScrollPositionOrScrollToTop(); 13119 swapCallbacks.forEach((callback) => callback()); 13120 andAfterAllThis(() => { 13121 nowInitializeAlpineOnTheNewPage(Alpine3); 13122 autofocusElementsWithTheAutofocusAttribute(); 13123 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 13124 }); 13125 }); 13126 }); 13127 } 13128 ); 13129 setTimeout(() => { 13130 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 13131 }); 13132 } 13133 function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback, errorCallback) { 13134 getPretchedHtmlOr(fromDestination, callback, () => { 13135 fetchHtml(fromDestination, callback, errorCallback); 13136 }); 13137 } 13138 function preventAlpineFromPickingUpDomChanges(Alpine3, callback) { 13139 Alpine3.stopObservingMutations(); 13140 callback((afterAllThis) => { 13141 Alpine3.startObservingMutations(); 13142 queueMicrotask(() => { 13143 afterAllThis(); 13144 }); 13145 }); 13146 } 13147 function fireEventForOtherLibrariesToHookInto(name, detail) { 13148 let event = new CustomEvent(name, { 13149 cancelable: true, 13150 bubbles: true, 13151 detail 13152 }); 13153 document.dispatchEvent(event); 13154 return event.defaultPrevented; 13155 } 13156 function nowInitializeAlpineOnTheNewPage(Alpine3) { 13157 Alpine3.initTree(document.body, void 0, (el, skip) => { 13158 if (el._x_wasPersisted) 13159 skip(); 13160 }); 13161 } 13162 function autofocusElementsWithTheAutofocusAttribute() { 13163 document.querySelector("[autofocus]") && document.querySelector("[autofocus]").focus(); 13164 } 13165 function cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement() { 13166 let walker = function(root, callback) { 13167 Alpine.walk(root, (el, skip) => { 13168 if (isPersistedElement(el)) 13169 skip(); 13170 if (isTeleportTarget(el)) 13171 skip(); 13172 else 13173 callback(el, skip); 13174 }); 13175 }; 13176 Alpine.destroyTree(document.body, walker); 13177 } 13178 13179
13179// js/plugins/history/index.js 13180 function history(Alpine3) { 13181 Alpine3.magic("queryString", (el, { interceptor: interceptor2 }) => { 13182 let alias; 13183 let alwaysShow = false; 13184 let usePush = false; 13185 return interceptor2((initialSeedValue, getter, setter, path, key) => { 13186 let queryKey = alias || path; 13187 let { initial, replace: replace2, push: push2, pop } = track2(queryKey, initialSeedValue, alwaysShow); 13188 setter(initial); 13189 if (!usePush) { 13190 Alpine3.effect(() => replace2(getter())); 13191 } else { 13192 Alpine3.effect(() => push2(getter())); 13193 pop(async (newValue) => { 13194 setter(newValue); 13195 let tillTheEndOfTheMicrotaskQueue = () => Promise.resolve(); 13196 await tillTheEndOfTheMicrotaskQueue(); 13197 }); 13198 } 13199 return initial; 13200 }, (func) => { 13201 func.alwaysShow = () => { 13202 alwaysShow = true; 13203 return func; 13204 }; 13205 func.usePush = () => { 13206 usePush = true; 13207 return func; 13208 }; 13209 func.as = (key) => { 13210 alias = key; 13211 return func; 13212 }; 13213 }); 13214 }); 13215 Alpine3.history = { track: track2 }; 13216 } 13217 function track2(name, initialSeedValue, alwaysShow = false, except = null) { 13218 let { has: has2, get: get3, set: set3, remove } = queryStringUtils(); 13219 let url = coordinator_default.getUrl(); 13220 let isInitiallyPresentInUrl = has2(url, name); 13221 let initialValue = isInitiallyPresentInUrl ? get3(url, name) : initialSeedValue; 13222 let initialValueMemo = JSON.stringify(initialValue); 13223 let exceptValueMemo = JSON.stringify(except); 13224 let hasReturnedToInitialValue = (newValue) => JSON.stringify(newValue) === initialValueMemo; 13225 let hasReturnedToExceptValue = (newValue) => JSON.stringify(newValue) === exceptValueMemo; 13226 if (alwaysShow) 13227 url = set3(url, name, initialValue); 13228 replace(url, name, { value: initialValue }); 13229 let lock = false; 13230 let update = (strategy, newValue) => { 13231 if (lock) 13232 return; 13233 let url2 = coordinator_default.getUrl(); 13234 if (!alwaysShow && !isInitiallyPresentInUrl && hasReturnedToInitialValue(newValue)) { 13235 url2 = remove(url2, name); 13236 } else if (newValue === void 0) { 13237 url2 = remove(url2, name); 13238 } else if (!alwaysShow && hasReturnedToExceptValue(newValue)) { 13239 url2 = remove(url2, name); 13240 } else { 13241 url2 = set3(url2, name, newValue); 13242 } 13243 strategy(url2, name, { value: newValue }); 13244 }; 13245 return { 13246 initial: initialValue, 13247 replace(newValue) { 13248 update(replace, newValue); 13249 }, 13250 push(newValue) { 13251 update(push, newValue); 13252 }, 13253 pop(receiver) { 13254 let handler4 = (e) => { 13255 if (!e.state || !e.state.alpine) 13256 return; 13257 Object.entries(e.state.alpine).forEach(([iName, { value: newValue }]) => { 13258 if (iName !== name) 13259 return; 13260 lock = true; 13261 let result = receiver(newValue); 13262 if (result instanceof Promise) { 13263 result.finally(() => lock = false); 13264 } else { 13265 lock = false; 13266 } 13267 }); 13268 }; 13269 window.addEventListener("popstate", handler4); 13270 return () => window.removeEventListener("popstate", handler4); 13271 } 13272 }; 13273 } 13274 function replace(url, key, object) { 13275 coordinator_default.replaceState(url, { [key]: object }); 13276 } 13277 function push(url, key, object) { 13278 coordinator_default.pushState(url, { [key]: object }); 13279 } 13280 function queryStringUtils() { 13281 return { 13282 has(url, key) { 13283 let search = url.search; 13284 if (!search) 13285 return false; 13286 let data2 = fromQueryString(search, key); 13287 return dataGet(data2, key) !== void 0; 13288 }, 13289 get(url, key) { 13290 let search = url.search; 13291 if (!search) 13292 return false; 13293 let data2 = fromQueryString(search, key); 13294 return dataGet(data2, key); 13295 }, 13296 set(url, key, value) { 13297 let data2 = fromQueryString(url.search, key); 13298 dataSet(data2, key, stripNulls(unwrap(value))); 13299 url.search = toQueryString(data2); 13300 return url; 13301 }, 13302 remove(url, key) { 13303 let data2 = fromQueryString(url.search, key); 13304 dataDelete(data2, key); 13305 url.search = toQueryString(data2); 13306 return url; 13307 } 13308 }; 13309 } 13310 function stripNulls(value) { 13311 if (!isObjecty(value)) 13312 return value; 13313 for (let key in value) { 13314 if (value[key] === null) 13315 delete value[key]; 13316 else 13317 value[key] = stripNulls(value[key]); 13318 } 13319 return value; 13320 } 13321 function toQueryString(data2) { 13322 let isObjecty2 = (subject) => typeof subject === "object" && subject !== null; 13323 let buildQueryStringEntries = (data3, entries2 = {}, baseKey = "") => { 13324 Object.entries(data3).forEach(([iKey, iValue]) => { 13325 let key = baseKey === "" ? iKey : `${baseKey}[${iKey}]`; 13326 if (iValue === null) {
13327 entries2[key] = ""; 13328 } else if (!isObjecty2(iValue)) { 13329 entries2[key] = encodeURIComponent(iValue).replaceAll("%20", "+").replaceAll("%2C", ","); 13330 } else { 13331 entries2 = { ...entries2, ...buildQueryStringEntries(iValue, entries2, key) }; 13332 } 13333 }); 13334 return entries2; 13335 }; 13336 let entries = buildQueryStringEntries(data2); 13337 return Object.entries(entries).map(([key, value]) => `${key}=${value}`).join("&"); 13338 } 13339 function fromQueryString(search, queryKey) { 13340 search = search.replace("?", ""); 13341 if (search === "") 13342 return {}; 13343 let insertDotNotatedValueIntoData = (key, value, data3) => { 13344 let [first2, second, ...rest] = key.split("."); 13345 if (!second) 13346 return data3[key] = value; 13347 if (data3[first2] === void 0) { 13348 data3[first2] = isNaN(second) ? {} : []; 13349 } 13350 insertDotNotatedValueIntoData([second, ...rest].join("."), value, data3[first2]); 13351 }; 13352 let entries = search.split("&").map((i) => i.split("=")); 13353 let data2 = /* @__PURE__ */ Object.create(null); 13354 entries.forEach(([key, value]) => { 13355 if (typeof value == "undefined") 13356 return; 13357 value = decodeURIComponent(value.replaceAll("+", "%20")); 13358 let decodedKey = decodeURIComponent(key); 13359 let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", ""); 13360 let shouldBeHandledAsArray = decodedKey.includes("[") && (dotNotatedKey === queryKey || dotNotatedKey.startsWith(`${queryKey}.`)); 13361 if (!shouldBeHandledAsArray) { 13362 data2[key] = value; 13363 } else { 13364 insertDotNotatedValueIntoData(dotNotatedKey, value, data2); 13365 } 13366 }); 13367 return data2; 13368 } 13369 13370
vendor: 13,840 bytes, lines 13370-13756
13370// node_modules/@alpinejs/morph/dist/module.esm.js 13371 function morph(from, toHtml, options) { 13372 monkeyPatchDomSetAttributeToAllowAtSymbols(); 13373 let context = createMorphContext(options); 13374 let toEl = typeof toHtml === "string" ? createElement(toHtml) : toHtml; 13375 if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) { 13376 toEl._x_dataStack = window.Alpine.closestDataStack(from); 13377 toEl._x_dataStack && window.Alpine.cloneNode(from, toEl); 13378 } 13379 context.patch(from, toEl); 13380 return from; 13381 } 13382 function morphBetween(startMarker, endMarker, toHtml, options = {}) { 13383 monkeyPatchDomSetAttributeToAllowAtSymbols(); 13384 let context = createMorphContext(options); 13385 let fromContainer = startMarker.parentNode; 13386 let fromBlock = new Block(startMarker, endMarker); 13387 let toContainer = typeof toHtml === "string" ? (() => { 13388 let container = document.createElement("div"); 13389 container.insertAdjacentHTML("beforeend", toHtml); 13390 return container; 13391 })() : toHtml; 13392 let toStartMarker = document.createComment("[morph-start]"); 13393 let toEndMarker = document.createComment("[morph-end]"); 13394 toContainer.insertBefore(toStartMarker, toContainer.firstChild); 13395 toContainer.appendChild(toEndMarker); 13396 let toBlock = new Block(toStartMarker, toEndMarker); 13397 if (window.Alpine && window.Alpine.closestDataStack) { 13398 toContainer._x_dataStack = window.Alpine.closestDataStack(fromContainer); 13399 toContainer._x_dataStack && window.Alpine.cloneNode(fromContainer, toContainer); 13400 } 13401 context.patchChildren(fromBlock, toBlock); 13402 } 13403 function createMorphContext(options = {}) { 13404 let defaultGetKey = (el) => el.getAttribute("key"); 13405 let noop = () => { 13406 }; 13407 let context = { 13408 key: options.key || defaultGetKey, 13409 lookahead: options.lookahead || false, 13410 updating: options.updating || noop, 13411 updated: options.updated || noop, 13412 removing: options.removing || noop, 13413 removed: options.removed || noop, 13414 adding: options.adding || noop, 13415 added: options.added || noop 13416 }; 13417 context.patch = function(from, to) { 13418 if (context.differentElementNamesTypesOrKeys(from, to)) { 13419 return context.swapElements(from, to); 13420 } 13421 let updateChildrenOnly = false; 13422 let skipChildren = false; 13423 let skipUntil = (predicate) => context.skipUntilCondition = predicate; 13424 if (shouldSkipChildren(context.updating, () => skipChildren = true, skipUntil, from, to, () => updateChildrenOnly = true)) 13425 return; 13426 if (from.nodeType === 1 && window.Alpine) { 13427 window.Alpine.cloneNode(from, to); 13428 if (from._x_teleport && to._x_teleport) { 13429 context.patch(from._x_teleport, to._x_teleport); 13430 } 13431 } 13432 if (textOrComment(to)) { 13433 context.patchNodeValue(from, to); 13434 context.updated(from, to); 13435 return; 13436 } 13437 if (!updateChildrenOnly) { 13438 context.patchAttributes(from, to); 13439 } 13440 context.updated(from, to); 13441 if (!skipChildren) { 13442 context.patchChildren(from, to); 13443 } 13444 }; 13445 context.differentElementNamesTypesOrKeys = function(from, to) { 13446 return from.nodeType != to.nodeType || from.nodeName != to.nodeName || context.getKey(from) != context.getKey(to); 13447 }; 13448 context.swapElements = function(from, to) { 13449 if (shouldSkip(context.removing, from)) 13450 return; 13451 let toCloned = to.cloneNode(true); 13452 if (shouldSkip(context.adding, toCloned)) 13453 return; 13454 from.replaceWith(toCloned); 13455 context.removed(from); 13456 context.added(toCloned); 13457 }; 13458 context.patchNodeValue = function(from, to) { 13459 let value = to.nodeValue; 13460 if (from.nodeValue !== value) { 13461 from.nodeValue = value; 13462 } 13463 }; 13464 context.patchAttributes = function(from, to) { 13465 if (from._x_transitioning) 13466 return; 13467 if (from._x_isShown && !to._x_isShown) { 13468 return; 13469 } 13470 if (!from._x_isShown && to._x_isShown) { 13471 return; 13472 } 13473 let domAttributes = Array.from(from.attributes); 13474 let toAttributes = Array.from(to.attributes); 13475 for (let i = domAttributes.length - 1; i >= 0; i--) { 13476 let name = domAttributes[i].name; 13477 if (!to.hasAttribute(name)) { 13478 if (name === "open" && from.nodeName === "DIALOG" && from.open) { 13479 from.close(); 13480 } else { 13481 from.removeAttribute(name); 13482 } 13483 } 13484 } 13485 for (let i = toAttributes.length - 1; i >= 0; i--) { 13486 let name = toAttributes[i].name; 13487 let value = toAttributes[i].value; 13488 if (from.getAttribute(name) !== value) { 13489 from.setAttribute(name, value); 13490 } 13491 } 13492 }; 13493 context.patchChildren = function(from, to) { 13494 let fromKeys = context.keyToMap(from.children); 13495 let fromKeyHoldovers = {}; 13496 let currentTo = getFirstNode(to); 13497 let currentFrom = getFirstNode(from); 13498 while (currentTo) { 13499 seedingMatchingId(currentTo, currentFrom); 13500 let toKey = context.getKey(currentTo); 13501 let fromKey = context.getKey(currentFrom); 13502 if (context.skipUntilCondition) { 13503 let fromDone = !currentFrom || context.skipUntilCondition(currentFrom); 13504 let toDone = !currentTo || context.skipUntilCondition(currentTo); 13505 if (fromDone && toDone) { 13506 context.skipUntilCondition = null; 13507 } else { 13508 if (!fromDone) 13509 currentFrom = currentFrom && getNextSibling(from, currentFrom); 13510 if (!toDone) 13511 currentTo = currentTo && getNextSibling(to, currentTo); 13512 continue; 13513 } 13514 } 13515 if (!currentFrom) { 13516 if (toKey && fromKeyHoldovers[toKey]) { 13517 let holdover = fromKeyHoldovers[toKey]; 13518 from.appendChild(holdover); 13519 currentFrom = holdover; 13520 fromKey = context.getKey(currentFrom); 13521 } else { 13522 if (!shouldSkip(context.adding, currentTo)) { 13523 let clone3 = currentTo.cloneNode(true); 13524 from.appendChild(clone3); 13525 context.added(clone3); 13526 } 13527 currentTo = getNextSibling(to, currentTo); 13528 continue; 13529 } 13530 } 13531 let isIf = (node) => node && node.nodeType === 8 && node.textContent === "[if BLOCK]><![endif]"; 13532 let isEnd = (node) => node && node.nodeType === 8 && node.textContent === "[if ENDBLOCK]><![endif]"; 13533 if (isIf(currentTo) && isIf(currentFrom)) { 13534 let nestedIfCount = 0; 13535 let fromBlockStart = currentFrom; 13536 while (currentFrom) { 13537 let next = getNextSibling(from, currentFrom); 13538 if (isIf(next)) { 13539 nestedIfCount++; 13540 } else if (isEnd(next) && nestedIfCount > 0) { 13541 nestedIfCount--; 13542 } else if (isEnd(next) && nestedIfCount === 0) { 13543 currentFrom = next; 13544 break; 13545 } 13546 currentFrom = next; 13547 } 13548 let fromBlockEnd = currentFrom; 13549 nestedIfCount = 0; 13550 let toBlockStart = currentTo; 13551 while (currentTo) { 13552 let next = getNextSibling(to, currentTo); 13553 if (isIf(next)) { 13554 nestedIfCount++; 13555 } else if (isEnd(next) && nestedIfCount > 0) { 13556 nestedIfCount--; 13557 } else if (isEnd(next) && nestedIfCount === 0) { 13558 currentTo = next; 13559 break; 13560 } 13561 currentTo = next; 13562 } 13563 let toBlockEnd = currentTo; 13564 let fromBlock = new Block(fromBlockStart, fromBlockEnd); 13565 let toBlock = new Block(toBlockStart, toBlockEnd); 13566 context.patchChildren(fromBlock, toBlock); 13567 continue; 13568 } 13569 if (currentFrom.nodeType === 1 && context.lookahead && !currentFrom.isEqualNode(currentTo)) { 13570 let nextToElementSibling = getNextSibling(to, currentTo); 13571 let found = false; 13572 while (!found && nextToElementSibling) { 13573 if (nextToElementSibling.nodeType === 1 && currentFrom.isEqualNode(nextToElementSibling)) { 13574 found = true; 13575 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 13576 fromKey = context.getKey(currentFrom); 13577 } 13578 nextToElementSibling = getNextSibling(to, nextToElementSibling); 13579 } 13580 } 13581 if (toKey !== fromKey) { 13582 if (!toKey && fromKey) { 13583 fromKeyHoldovers[fromKey] = currentFrom; 13584 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 13585 fromKeyHoldovers[fromKey].remove(); 13586 currentFrom = getNextSibling(from, currentFrom); 13587 currentTo = getNextSibling(to, currentTo); 13588 continue; 13589 } 13590 if (toKey && !fromKey) { 13591 if (fromKeys[toKey]) { 13592 currentFrom.replaceWith(fromKeys[toKey]); 13593 currentFrom = fromKeys[toKey]; 13594 fromKey = context.getKey(currentFrom); 13595 } 13596 } 13597 if (toKey && fromKey) { 13598 let fromKeyNode = fromKeys[toKey]; 13599 if (fromKeyNode) { 13600 fromKeyHoldovers[fromKey] = currentFrom; 13601 currentFrom.replaceWith(fromKeyNode); 13602 currentFrom = fromKeyNode; 13603 fromKey = context.getKey(currentFrom); 13604 } else { 13605 fromKeyHoldovers[fromKey] = currentFrom; 13606 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 13607 fromKeyHoldovers[fromKey].remove(); 13608 currentFrom = getNextSibling(from, currentFrom); 13609 currentTo = getNextSibling(to, currentTo); 13610 continue; 13611 } 13612 } 13613 } 13614 let currentFromNext = currentFrom && getNextSibling(from, currentFrom); 13615 context.patch(currentFrom, currentTo); 13616 currentTo = currentTo && getNextSibling(to, currentTo); 13617 currentFrom = currentFromNext; 13618 } 13619 let removals = []; 13620 while (currentFrom) { 13621 if (!shouldSkip(context.removing, currentFrom)) 13622 removals.push(currentFrom); 13623 currentFrom = getNextSibling(from, currentFrom); 13624 } 13625 while (removals.length) { 13626 let domForRemoval = removals.shift(); 13627 domForRemoval.remove(); 13628 context.removed(domForRemoval); 13629 } 13630 }; 13631 context.getKey = function(el) { 13632 return el && el.nodeType === 1 && context.key(el); 13633 }; 13634 context.keyToMap = function(els2) { 13635 let map = {}; 13636 for (let el of els2) { 13637 let theKey = context.getKey(el); 13638 if (theKey) { 13639 map[theKey] = el; 13640 } 13641 } 13642 return map; 13643 }; 13644 context.addNodeBefore = function(parent, node, beforeMe) { 13645 if (!shouldSkip(context.adding, node)) { 13646 let clone3 = node.cloneNode(true); 13647 parent.insertBefore(clone3, beforeMe); 13648 context.added(clone3); 13649 return clone3; 13650 } 13651 return node; 13652 }; 13653 return context; 13654 } 13655 morph.step = () => { 13656 }; 13657 morph.log = () => { 13658 }; 13659 function shouldSkip(hook, ...args) { 13660 let skip = false; 13661 hook(...args, () => skip = true); 13662 return skip; 13663 } 13664 function shouldSkipChildren(hook, skipChildren, skipUntil, ...args) { 13665 let skip = false; 13666 hook(...args, () => skip = true, skipChildren, skipUntil); 13667 return skip; 13668 } 13669 var patched = false; 13670 function createElement(html) { 13671 const template = document.createElement("template"); 13672 template.innerHTML = html; 13673 return template.content.firstElementChild; 13674 } 13675 function textOrComment(el) { 13676 return el.nodeType === 3 || el.nodeType === 8; 13677 } 13678 var Block = class { 13679 constructor(start3, end) { 13680 this.startComment = start3; 13681 this.endComment = end; 13682 } 13683 get children() { 13684 let children = []; 13685 let currentNode = this.startComment.nextSibling; 13686 while (currentNode && currentNode !== this.endComment) { 13687 children.push(currentNode); 13688 currentNode = currentNode.nextSibling; 13689 } 13690 return children; 13691 } 13692 appendChild(child) { 13693 this.endComment.before(child); 13694 } 13695 get firstChild() { 13696 let first2 = this.startComment.nextSibling; 13697 if (first2 === this.endComment) 13698 return; 13699 return first2; 13700 } 13701 nextNode(reference) { 13702 let next = reference.nextSibling; 13703 if (next === this.endComment) 13704 return; 13705 return next; 13706 } 13707 insertBefore(newNode, reference) { 13708 reference.before(newNode); 13709 return newNode; 13710 } 13711 }; 13712 function getFirstNode(parent) { 13713 return parent.firstChild; 13714 } 13715 function getNextSibling(parent, reference) { 13716 let next; 13717 if (parent instanceof Block) { 13718 next = parent.nextNode(reference); 13719 } else { 13720 next = reference.nextSibling; 13721 } 13722 return next; 13723 } 13724 function monkeyPatchDomSetAttributeToAllowAtSymbols() { 13725 if (patched) 13726 return; 13727 patched = true; 13728 let original = Element.prototype.setAttribute; 13729 let hostDiv = document.createElement("div"); 13730 Element.prototype.setAttribute = function newSetAttribute(name, value) { 13731 if (!name.includes("@")) { 13732 return original.call(this, name, value); 13733 } 13734 let escapedValue = value.replace(/&/g, "&").replace(/"/g, """); 13735 hostDiv.innerHTML = `<span ${name}="${escapedValue}"></span>`; 13736 let attr = hostDiv.firstElementChild.getAttributeNode(name); 13737 hostDiv.firstElementChild.removeAttributeNode(attr); 13738 this.setAttributeNode(attr); 13739 }; 13740 } 13741 function seedingMatchingId(to, from) { 13742 let fromId = from && from._x_bindings && from._x_bindings.id; 13743 if (!fromId) 13744 return; 13745 if (!to.setAttribute) 13746 return; 13747 to.setAttribute("id", fromId); 13748 to.id = fromId; 13749 } 13750 function src_default9(Alpine3) { 13751 Alpine3.morph = morph; 13752 Alpine3.morphBetween = morphBetween; 13753 } 13754 var module_default9 = src_default9; 13755 13756
vendor: 5,237 bytes, lines 13756-13910
13756// node_modules/@alpinejs/mask/dist/module.esm.js 13757 function src_default10(Alpine3) { 13758 Alpine3.directive("mask", (el, { value, expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 13759 let templateFn = () => expression; 13760 let lastInputValue = ""; 13761 queueMicrotask(() => { 13762 if (["function", "dynamic"].includes(value)) { 13763 let evaluator = evaluateLater2(expression); 13764 effect3(() => { 13765 templateFn = (input) => { 13766 let result; 13767 Alpine3.dontAutoEvaluateFunctions(() => { 13768 evaluator((value2) => { 13769 result = typeof value2 === "function" ? value2(input) : value2; 13770 }, { scope: { 13771 "$input": input, 13772 "$money": formatMoney.bind({ el }) 13773 } }); 13774 }); 13775 return result; 13776 }; 13777 processInputValue(el, false); 13778 }); 13779 } else { 13780 processInputValue(el, false); 13781 } 13782 if (el._x_model) { 13783 if (el._x_model.get() !== el.value) { 13784 if (!(el._x_model.get() === null && el.value === "")) { 13785 el._x_model.set(el.value); 13786 } 13787 } 13788 let updater = el._x_forceModelUpdate; 13789 el._x_forceModelUpdate = (value2) => { 13790 value2 = String(value2); 13791 let template = templateFn(value2); 13792 if (template && template !== "false") { 13793 value2 = formatInput(template, value2); 13794 } 13795 lastInputValue = value2; 13796 updater(value2); 13797 el._x_model.set(value2); 13798 }; 13799 } 13800 }); 13801 const controller = new AbortController(); 13802 cleanup2(() => { 13803 controller.abort(); 13804 }); 13805 el.addEventListener("input", () => processInputValue(el), { 13806 signal: controller.signal, 13807 capture: true 13808 }); 13809 el.addEventListener("blur", () => processInputValue(el, false), { signal: controller.signal }); 13810 function processInputValue(el2, shouldRestoreCursor = true) { 13811 let input = el2.value; 13812 let template = templateFn(input); 13813 if (!template || template === "false") 13814 return false; 13815 if (lastInputValue.length - el2.value.length === 1) { 13816 return lastInputValue = el2.value; 13817 } 13818 let setInput = () => { 13819 lastInputValue = el2.value = formatInput(template, input); 13820 }; 13821 if (shouldRestoreCursor) { 13822 restoreCursorPosition(el2, template, () => { 13823 setInput(); 13824 }); 13825 } else { 13826 setInput(); 13827 } 13828 } 13829 }).before("model"); 13830 } 13831 function restoreCursorPosition(el, template, callback) { 13832 let cursorPosition = el.selectionStart; 13833 let unformattedValue = el.value; 13834 callback(); 13835 let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition); 13836 let newPosition = formatInput( 13837 template, 13838 beforeLeftOfCursorBeforeFormatting 13839 ).length; 13840 el.setSelectionRange(newPosition, newPosition); 13841 } 13842 var regexes = { 13843 "9": /[0-9]/, 13844 "a": /[a-zA-Z]/, 13845 "*": /[a-zA-Z0-9]/ 13846 }; 13847 function formatInput(template, input) { 13848 let templateMark = 0; 13849 let inputMark = 0; 13850 let output = ""; 13851 while (templateMark < template.length && inputMark < input.length) { 13852 let templateChar = template[templateMark]; 13853 let inputChar = input[inputMark]; 13854 if (templateChar in regexes) { 13855 if (regexes[templateChar].test(inputChar)) { 13856 output += inputChar; 13857 templateMark++; 13858 } 13859 inputMark++; 13860 } else { 13861 output += templateChar; 13862 templateMark++; 13863 if (templateChar === input[inputMark]) 13864 inputMark++; 13865 } 13866 } 13867 return output; 13868 } 13869 function formatMoney(input, delimiter = ".", thousands, precision = 2) { 13870 if (input === "-") 13871 return "-"; 13872 if (/^\D+$/.test(input)) 13873 return "9"; 13874 if (thousands === null || thousands === void 0) { 13875 thousands = delimiter === "," ? "." : ","; 13876 } 13877 let addThousands = (input2, thousands2) => { 13878 let output = ""; 13879 let counter = 0; 13880 for (let i = input2.length - 1; i >= 0; i--) { 13881 if (input2[i] === thousands2) 13882 continue; 13883 if (counter === 3) { 13884 output = input2[i] + thousands2 + output; 13885 counter = 0; 13886 } else { 13887 output = input2[i] + output; 13888 } 13889 counter++; 13890 } 13891 return output; 13892 }; 13893 let minus = input.startsWith("-") ? "-" : ""; 13894 let strippedInput = input.replaceAll(new RegExp(`[^0-9\\${delimiter}]`, "g"), ""); 13895 let template = Array.from({ length: strippedInput.split(delimiter)[0].length }).fill("9").join(""); 13896 template = `${minus}${addThousands(template, thousands)}`; 13897 if (precision > 0 && input.includes(delimiter)) 13898 template += `${delimiter}` + "9".repeat(precision); 13899 queueMicrotask(() => { 13900 if (this.el.value.endsWith(delimiter)) 13901 return; 13902 if (this.el.value[this.el.selectionStart - 1] === delimiter) { 13903 this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1); 13904 } 13905 }); 13906 return template; 13907 } 13908 var module_default10 = src_default10; 13909 13910
13910// js/lifecycle.js 13911 function start2() { 13912 setTimeout(() => ensureLivewireScriptIsntMisplaced()); 13913 dispatch(document, "livewire:init"); 13914 dispatch(document, "livewire:initializing"); 13915 module_default.plugin(module_default9); 13916 module_default.plugin(history); 13917 module_default.plugin(module_default5); 13918 module_default.plugin(module_default6); 13919 module_default.plugin(module_default7); 13920 module_default.plugin(module_default2); 13921 module_default.plugin(module_default8); 13922 module_default.plugin(module_default3); 13923 module_default.plugin(module_default4); 13924 module_default.plugin(navigate_default); 13925 module_default.plugin(module_default10); 13926 module_default.addRootSelector(() => "[wire\\:id]"); 13927 module_default.onAttributesAdded((el, attributes) => { 13928 if (!Array.from(attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 13929 return; 13930 let component = findComponentByEl(el, false); 13931 if (!component) 13932 return; 13933 attributes.forEach((attribute) => { 13934 if (!matchesForLivewireDirective(attribute.name)) 13935 return; 13936 let directive3 = extractDirective(el, attribute.name); 13937 trigger2("directive.init", { el, component, directive: directive3, cleanup: (callback) => { 13938 module_default.onAttributeRemoved(el, directive3.raw, callback); 13939 } }); 13940 }); 13941 }); 13942 module_default.interceptInit( 13943 module_default.skipDuringClone( 13944 (el) => { 13945 if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 13946 return; 13947 if (el.hasAttribute("wire:id") && !el.__livewire && !hasComponent(el.getAttribute("wire:id"))) { 13948 let component2 = initComponent(el); 13949 module_default.onAttributeRemoved(el, "wire:id", () => { 13950 destroyComponent(component2.id); 13951 }); 13952 } 13953 let directives2 = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name)); 13954 directives2.forEach((directive3) => { 13955 trigger2("directive.global.init", { el, directive: directive3, cleanup: (callback) => { 13956 module_default.onAttributeRemoved(el, directive3.raw, callback); 13957 } }); 13958 }); 13959 let component = findComponentByEl(el, false); 13960 if (component) { 13961 trigger2("element.init", { el, component }); 13962 directives2.forEach((directive3) => { 13963 trigger2("directive.init", { el, component, directive: directive3, cleanup: (callback) => { 13964 module_default.onAttributeRemoved(el, directive3.raw, callback); 13965 } }); 13966 }); 13967 } 13968 }, 13969 (el) => { 13970 if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 13971 return; 13972 let directives2 = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name)); 13973 directives2.forEach((directive3) => { 13974 trigger2("directive.global.init", { el, directive: directive3, cleanup: (callback) => { 13975 module_default.onAttributeRemoved(el, directive3.raw, callback); 13976 } }); 13977 }); 13978 } 13979 ) 13980 ); 13981 module_default.start(); 13982 setTimeout(() => window.Livewire.initialRenderIsFinished = true); 13983 dispatch(document, "livewire:initialized"); 13984 } 13985 function ensureLivewireScriptIsntMisplaced() { 13986 let el = document.querySelector("script[data-update-uri][data-csrf]"); 13987 if (!el) 13988 return; 13989 let livewireEl = el.closest("[wire\\:id]"); 13990 if (livewireEl) { 13991 console.warn("Livewire: missing closing tags found. Ensure your template elements contain matching closing tags.", livewireEl); 13992 } 13993 } 13994 13995
13995// js/features/supportListeners.js 13996 on2("effect", ({ component, effects }) => { 13997 registerListeners(component, effects.listeners || []); 13998 }); 13999 function registerListeners(component, listeners2) { 14000 listeners2.forEach((name) => { 14001 let handler4 = (e) => { 14002 if (component.isLazy && !component.hasBeenLazyLoaded) 14003 return; 14004 if (e.__livewire) 14005 e.__livewire.receivedBy.push(component); 14006 component.$wire.call("__dispatch", name, e.detail || {}); 14007 }; 14008 window.addEventListener(name, handler4); 14009 component.addCleanup(() => window.removeEventListener(name, handler4)); 14010 component.el.addEventListener(name, (e) => { 14011 if (component.isLazy && !component.hasBeenLazyLoaded) 14012 return; 14013 if (!e.__livewire) 14014 return; 14015 if (e.bubbles) 14016 return; 14017 if (e.__livewire) 14018 e.__livewire.receivedBy.push(component.id); 14019 component.$wire.call("__dispatch", name, e.detail || {}); 14020 }); 14021 }); 14022 } 14023 14024
14024// js/evaluator.js 14025 function getAlpineScopeKeys(el) { 14026 let keys = []; 14027 let currentEl = el; 14028 while (currentEl) { 14029 if (currentEl._x_dataStack && currentEl._x_dataStack.length > 0) { 14030 let ownScope = currentEl._x_dataStack[0]; 14031 for (let key of Object.keys(ownScope)) { 14032 if (!keys.includes(key) && !key.startsWith("$")) 14033 keys.push(key); 14034 } 14035 } 14036 if (currentEl.hasAttribute && currentEl.hasAttribute("wire:id")) 14037 break; 14038 currentEl = currentEl.parentElement; 14039 } 14040 return keys; 14041 } 14042 function evaluateExpression(el, expression, options = {}) { 14043 if (!expression || expression.trim() === "") 14044 return; 14045 let result = module_default.evaluateRaw(el, expression, options); 14046 if (result instanceof Promise) { 14047 result.catch(() => { 14048 }); 14049 } 14050 return result; 14051 } 14052 function evaluateActionExpression(el, expression, options = {}) { 14053 if (!expression || expression.trim() === "") 14054 return; 14055 let contextualExpression = contextualizeExpression(expression, el); 14056 try { 14057 let result = module_default.evaluateRaw(el, contextualExpression, options); 14058 if (result instanceof Promise && result._livewireAction) { 14059 result.catch(() => { 14060 }); 14061 } 14062 return result; 14063 } catch (error2) { 14064 console.warn(`Livewire Expression Error: ${error2.message} 14065 14066${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); 14067 console.error(error2); 14068 } 14069 } 14070 function contextualizeExpression(expression, el) { 14071 let SKIP = ["JSON", "true", "false", "null", "undefined", "this", "$wire", "$event"]; 14072 if (el) { 14073 SKIP.push(...getAlpineScopeKeys(el)); 14074 } 14075 let strings = []; 14076 let result = expression.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*\1/g, (m) => { 14077 strings.push(m); 14078 return `___${strings.length - 1}___`; 14079 }); 14080 result = result.replace(/(^|[^.\w$])(\$?[a-zA-Z_]\w*)/g, (m, pre, ident, offset2) => { 14081 if (SKIP.includes(ident) || /^___\d+___$/.test(ident)) 14082 return pre + ident; 14083 if (result[offset2 + m.length] === ":") 14084 return pre + ident; 14085 return pre + "$wire." + ident; 14086 }); 14087 return result.replace(/___(\d+)___/g, (m, i) => strings[i]); 14088 } 14089 14090
14090// js/features/supportScriptsAndAssets.js 14091 var executedScripts = /* @__PURE__ */ new WeakMap(); 14092 var executedAssets = /* @__PURE__ */ new Set(); 14093 on2("payload.intercept", async ({ assets }) => { 14094 if (!assets) 14095 return; 14096 for (let [key, asset] of Object.entries(assets)) { 14097 await onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, async () => { 14098 await addAssetsToHeadTagOfPage(asset); 14099 }); 14100 } 14101 }); 14102 on2("component.init", ({ component }) => { 14103 let assets = component.snapshot.memo.assets; 14104 if (assets) { 14105 assets.forEach((key) => { 14106 if (executedAssets.has(key)) 14107 return; 14108 executedAssets.add(key); 14109 }); 14110 } 14111 }); 14112 on2("effect", ({ component, effects }) => { 14113 let scripts = effects.scripts; 14114 if (scripts) { 14115 Object.entries(scripts).forEach(([key, content]) => { 14116 onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, () => { 14117 let scriptContent = extractScriptTagContent(content); 14118 scriptContent = scriptContent.includes("await") ? `(async()=>{ ${scriptContent} })()` : `(()=>{ ${scriptContent} })()`; 14119 module_default.dontAutoEvaluateFunctions(() => { 14120 evaluateExpression(component.el, scriptContent, { 14121 context: component.$wire, 14122 scope: { 14123 "$wire": component.$wire, 14124 "$js": component.$wire.js 14125 } 14126 }); 14127 }); 14128 }); 14129 }); 14130 } 14131 }); 14132 function onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, callback) { 14133 if (executedScripts.has(component)) { 14134 let alreadyRunKeys2 = executedScripts.get(component); 14135 if (alreadyRunKeys2.includes(key)) 14136 return; 14137 } 14138 callback(); 14139 if (!executedScripts.has(component)) 14140 executedScripts.set(component, []); 14141 let alreadyRunKeys = executedScripts.get(component); 14142 alreadyRunKeys.push(key); 14143 executedScripts.set(component, alreadyRunKeys); 14144 } 14145 function extractScriptTagContent(rawHtml) { 14146 let scriptRegex = /<script\b[^>]*>([\s\S]*?)<\/script>/gm; 14147 let matches3 = scriptRegex.exec(rawHtml); 14148 let innards = matches3 && matches3[1] ? matches3[1].trim() : ""; 14149 return innards; 14150 } 14151 async function onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, callback) { 14152 if (executedAssets.has(key)) 14153 return; 14154 executedAssets.add(key); 14155 await callback(); 14156 } 14157 async function addAssetsToHeadTagOfPage(rawHtml) { 14158 rawHtml = replaceNoncesInHtml(rawHtml); 14159 let newDocument = new DOMParser().parseFromString(rawHtml, "text/html"); 14160 let newHead = document.adoptNode(newDocument.head); 14161 for (let child of newHead.children) { 14162 try { 14163 await runAssetSynchronously(child); 14164 } catch (error2) { 14165 } 14166 } 14167 } 14168 async function runAssetSynchronously(child) { 14169 return new Promise((resolve, reject) => { 14170 if (isScript2(child)) { 14171 let script = cloneScriptTag(child); 14172 if (script.src) { 14173 script.onload = () => resolve(); 14174 script.onerror = () => reject(); 14175 } else { 14176 resolve(); 14177 } 14178 document.head.appendChild(script); 14179 } else { 14180 document.head.appendChild(child); 14181 resolve(); 14182 } 14183 }); 14184 } 14185 function isScript2(el) { 14186 return el.tagName.toLowerCase() === "script"; 14187 } 14188 14189
14189// js/features/supportJsEvaluation.js 14190 module_default.magic("js", (el) => { 14191 let component = findComponentByEl(el); 14192 return component.$wire.js; 14193 }); 14194 on2("effect", ({ component, effects }) => { 14195 let js = effects.js; 14196 let xjs = effects.xjs; 14197 if (js) { 14198 Object.entries(js).forEach(([method, body]) => { 14199 overrideMethod(component, method, () => { 14200 evaluateExpression(component.el, body); 14201 }); 14202 }); 14203 } 14204 if (xjs) { 14205 xjs.forEach(({ expression, params }) => { 14206 params = Object.values(params); 14207 evaluateExpression(component.el, expression, { scope: component.getJsActions(), params }); 14208 }); 14209 } 14210 }); 14211 14212
14212// js/directives/wire-transition.js 14213 var defaultName = "match-element"; 14214 globalDirective("transition", ({ el, directive: directive3, cleanup: cleanup2 }) => { 14215 }); 14216 function setTransitionNames(root, options = {}) { 14217 root.querySelectorAll("[wire\\:transition]").forEach((el) => { 14218 if (el.style.viewTransitionName) 14219 return; 14220 let name = el.getAttribute("wire:transition"); 14221 if (!name && options.type) 14222 return; 14223 el.style.viewTransitionName = name || defaultName; 14224 }); 14225 } 14226 function clearTransitionNames(root) { 14227 root.querySelectorAll("[wire\\:transition]").forEach((el) => { 14228 el.style.viewTransitionName = ""; 14229 }); 14230 } 14231 async function transitionDomMutation(fromEl, toEl, callback, options = {}) { 14232 if (options.skip) 14233 return callback(); 14234 if (!fromEl.querySelector("[wire\\:transition]") && !toEl.querySelector("[wire\\:transition]")) 14235 return callback(); 14236 if (typeof document.startViewTransition !== "function") { 14237 return callback(); 14238 } 14239 if (document.querySelector("dialog:modal")) 14240 return callback(); 14241 setTransitionNames(fromEl, options); 14242 let style = document.createElement("style"); 14243 style.textContent = ` 14244 @media (prefers-reduced-motion: reduce) { 14245 ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { 14246 animation: none !important; 14247 } 14248 } 14249 14250 ::view-transition-old(root) { 14251 animation: none !important; 14252 opacity: 0 !important; 14253 } 14254 14255 ::view-transition-new(root) { 14256 animation: none !important; 14257 opacity: 1 !important; 14258 } 14259 `; 14260 document.head.appendChild(style); 14261 let update = () => { 14262 callback(); 14263 setTransitionNames(fromEl, options); 14264 }; 14265 let transitionConfig = { update }; 14266 if (options.type) { 14267 transitionConfig.types = [options.type]; 14268 } 14269 let cleanup2 = () => { 14270 style.remove(); 14271 clearTransitionNames(fromEl); 14272 }; 14273 let skipOnDialog = (transition2) => { 14274 let observer2 = new MutationObserver(() => { 14275 if (document.querySelector("dialog:modal")) { 14276 transition2.skipTransition(); 14277 observer2.disconnect(); 14278 } 14279 }); 14280 observer2.observe(document.documentElement, { 14281 attributes: true, 14282 attributeFilter: ["open"], 14283 subtree: true 14284 }); 14285 transition2.finished.finally(() => observer2.disconnect()); 14286 }; 14287 try { 14288 let transition2 = document.startViewTransition(transitionConfig); 14289 skipOnDialog(transition2); 14290 transition2.finished.finally(cleanup2); 14291 await transition2.updateCallbackDone; 14292 } catch (e) { 14293 let transition2 = document.startViewTransition(update); 14294 skipOnDialog(transition2); 14295 transition2.finished.finally(cleanup2); 14296 await transition2.updateCallbackDone; 14297 } 14298 } 14299 14300
14300// js/morph.js 14301 async function morph2(component, el, html) { 14302 let wrapperTag = getTagName(el.parentElement); 14303 let wrapper = document.createElement(wrapperTag); 14304 wrapper.innerHTML = html; 14305 let parentComponent; 14306 try { 14307 parentComponent = findComponentByEl(el.parentElement); 14308 } catch (e) { 14309 } 14310 parentComponent && (wrapper.__livewire = parentComponent); 14311 let to = wrapper.firstElementChild; 14312 to.setAttribute("wire:snapshot", component.snapshotEncoded); 14313 let effects = { ...component.effects }; 14314 delete effects.html; 14315 to.setAttribute("wire:effects", JSON.stringify(effects)); 14316 to.__livewire = component; 14317 trigger2("morph", { el, toEl: to, component }); 14318 let existingComponentsMap = {}; 14319 el.querySelectorAll("[wire\\:id]").forEach((component2) => { 14320 existingComponentsMap[component2.getAttribute("wire:id")] = component2; 14321 }); 14322 to.querySelectorAll("[wire\\:id]").forEach((child) => { 14323 if (child.hasAttribute("wire:snapshot")) 14324 return; 14325 let wireId = child.getAttribute("wire:id"); 14326 let existingComponent = existingComponentsMap[wireId]; 14327 if (existingComponent) { 14328 child.replaceWith(existingComponent.cloneNode(true)); 14329 } 14330 }); 14331 let transitionOptions = component.effects.transition || {}; 14332 await transitionDomMutation(el, to, () => { 14333 module_default.morph(el, to, getMorphConfig(component)); 14334 }, transitionOptions); 14335 trigger2("morphed", { el, component }); 14336 } 14337 async function morphFragment(component, startNode, endNode, toHTML) { 14338 let fromContainer = startNode.parentElement; 14339 let fromContainerTag = getTagName(fromContainer); 14340 let toContainer = document.createElement(fromContainerTag); 14341 toContainer.innerHTML = toHTML; 14342 toContainer.__livewire = component; 14343 let parentElement = component.el.parentElement; 14344 let parentElementTag = getTagName(parentElement); 14345 let parentComponent; 14346 try { 14347 parentComponent = parentElement ? findComponentByEl(parentElement) : null; 14348 } catch (e) { 14349 } 14350 if (parentComponent) { 14351 let parentProviderWrapper = document.createElement(parentElementTag); 14352 parentProviderWrapper.appendChild(toContainer); 14353 parentProviderWrapper.__livewire = parentComponent; 14354 } 14355 trigger2("island.morph", { startNode, endNode, component }); 14356 let transitionOptions = component.effects.transition || {}; 14357 let islandHasTransition = false; 14358 let node = startNode.nextSibling; 14359 while (node && node !== endNode) { 14360 if (node.nodeType === 1 && (node.hasAttribute?.("wire:transition") || node.querySelector?.("[wire\\:transition]"))) { 14361 islandHasTransition = true; 14362 break; 14363 } 14364 node = node.nextSibling; 14365 } 14366 let fromEl = islandHasTransition ? fromContainer : document.createElement("div"); 14367 await transitionDomMutation(fromEl, toContainer, () => { 14368 module_default.morphBetween(startNode, endNode, toContainer, getMorphConfig(component)); 14369 }, transitionOptions); 14370 trigger2("island.morphed", { startNode, endNode, component }); 14371 } 14372 function getMorphConfig(component) { 14373 return { 14374 updating: (el, toEl, childrenOnly, skip, skipChildren, skipUntil) => { 14375 if (isStartFragmentMarker(el) && isStartFragmentMarker(toEl)) { 14376 let metadata = extractFragmentMetadataFromMarkerNode(toEl); 14377 if (metadata.mode !== "morph") { 14378 skipUntil((node) => { 14379 if (isEndFragmentMarker(node)) { 14380 let endMarkerMetadata = extractFragmentMetadataFromMarkerNode(node); 14381 return endMarkerMetadata.token === metadata.token; 14382 } 14383 return false; 14384 }); 14385 } 14386 } 14387 if (isntElement(el)) 14388 return; 14389 trigger2("morph.updating", { el, toEl, component, skip, childrenOnly, skipChildren, skipUntil }); 14390 if (el.__livewire_replace === true) 14391 el.innerHTML = toEl.innerHTML; 14392 if (el.__livewire_replace_self === true) { 14393 el.outerHTML = toEl.outerHTML; 14394 return skip(); 14395 } 14396 if (el.__livewire_ignore === true) 14397 return skip(); 14398 if (el.__livewire_ignore_self === true) 14399 childrenOnly(); 14400 if (el.__livewire_ignore_children === true) 14401 return skipChildren(); 14402 if (isComponentRootEl(el) && el.getAttribute("wire:id") !== component.id) 14403 return skip(); 14404 if (isComponentRootEl(el)) 14405 toEl.__livewire = component; 14406 }, 14407 updated: (el) => { 14408 if (isntElement(el)) 14409 return; 14410 trigger2("morph.updated", { el, component }); 14411 }, 14412 removing: (el, skip) => { 14413 if (isntElement(el)) 14414 return; 14415 trigger2("morph.removing", { el, component, skip }); 14416 }, 14417 removed: (el) => { 14418 if (isntElement(el)) 14419 return; 14420 trigger2("morph.removed", { el, component }); 14421 }, 14422 adding: (el) => { 14423 trigger2("morph.adding", { el, component }); 14424 }, 14425 added: (el) => { 14426 if (isntElement(el)) 14427 return; 14428 trigger2("morph.added", { el }); 14429 }, 14430 key: (el) => { 14431 if (isntElement(el)) 14432 return; 14433 return el.hasAttribute(`wire:id`) ? el.getAttribute(`wire:id`) : el.hasAttribute(`wire:key`) ? el.getAttribute(`wire:key`) : el.id; 14434 }, 14435 lookahead: false 14436 }; 14437 } 14438 function isntElement(el) { 14439 return typeof el.hasAttribute !== "function"; 14440 } 14441 function isComponentRootEl(el) { 14442 return el.hasAttribute("wire:id"); 14443 } 14444 function getTagName(el) { 14445 let tag = el ? el.tagName.toLowerCase() : "div";
14446 let customElement = customElements.get(tag); 14447 return customElement ? customElement.name : tag; 14448 } 14449 14450
14450// js/features/supportMorphDom.js 14451 interceptMessage(({ message, onSuccess }) => { 14452 onSuccess(({ payload, onMorph }) => { 14453 onMorph(async () => { 14454 let html = payload.effects.html; 14455 if (!html) 14456 return; 14457 await morph2(message.component, message.component.el, html); 14458 }); 14459 }); 14460 }); 14461 14462
14462// js/features/supportDispatches.js 14463 on2("effect", ({ component, effects }) => { 14464 queueMicrotask(() => { 14465 queueMicrotask(() => { 14466 queueMicrotask(() => { 14467 dispatchEvents(component, effects.dispatches || []); 14468 }); 14469 }); 14470 }); 14471 }); 14472 function dispatchEvents(component, dispatches) { 14473 dispatches.forEach(({ name, params = {}, self = false, component: componentName, ref, el }) => { 14474 if (self) 14475 dispatchSelf(component, name, params); 14476 else if (componentName) 14477 dispatchTo(componentName, name, params); 14478 else if (ref) 14479 dispatchRef(component, ref, name, params); 14480 else if (el) 14481 dispatchEl(component, el, name, params); 14482 else 14483 dispatch3(component, name, params); 14484 }); 14485 } 14486 14487
14487// js/features/supportDisablingFormsDuringRequest.js 14488 var cleanups = new Bag(); 14489 on2("directive.init", ({ el, directive: directive3, cleanup: cleanup2, component }) => setTimeout(() => { 14490 if (directive3.value !== "submit") 14491 return; 14492 el.addEventListener("submit", () => { 14493 let componentId = directive3.expression.startsWith("$parent") ? component.parent.id : component.id; 14494 let cleanup3 = disableForm(el); 14495 cleanups.add(componentId, cleanup3); 14496 }); 14497 })); 14498 on2("commit", ({ component, respond }) => { 14499 respond(() => { 14500 cleanups.each(component.id, (i) => i()); 14501 cleanups.remove(component.id); 14502 }); 14503 }); 14504 function disableForm(formEl) { 14505 let undos = []; 14506 module_default.walk(formEl, (el, skip) => { 14507 if (!formEl.contains(el)) 14508 return; 14509 if (el.hasAttribute("wire:ignore")) 14510 return skip(); 14511 if (shouldMarkDisabled(el)) { 14512 undos.push(markDisabled(el)); 14513 } else if (shouldMarkReadOnly(el)) { 14514 undos.push(markReadOnly(el)); 14515 } 14516 }); 14517 return () => { 14518 while (undos.length > 0) 14519 undos.shift()(); 14520 }; 14521 } 14522 function shouldMarkDisabled(el) { 14523 let tag = el.tagName.toLowerCase(); 14524 let inputTypesThatDontSupportReadonly = [ 14525 "hidden", 14526 "range", 14527 "color", 14528 "checkbox", 14529 "radio", 14530 "file", 14531 "submit", 14532 "image", 14533 "reset", 14534 "button" 14535 ]; 14536 if (tag === "select") 14537 return true; 14538 if (tag === "button" && el.type === "submit") 14539 return true; 14540 if (tag === "input" && inputTypesThatDontSupportReadonly.includes(el.type)) 14541 return true; 14542 return false; 14543 } 14544 function shouldMarkReadOnly(el) { 14545 return ["input", "textarea"].includes(el.tagName.toLowerCase()); 14546 } 14547 function markDisabled(el) { 14548 let undo = el.disabled ? () => { 14549 } : () => el.disabled = false; 14550 el.disabled = true; 14551 return undo; 14552 } 14553 function markReadOnly(el) { 14554 let undo = el.readOnly ? () => { 14555 } : () => el.readOnly = false; 14556 el.readOnly = true; 14557 return undo; 14558 } 14559 14560
14560// js/features/supportFileDownloads.js 14561 on2("commit", ({ succeed }) => { 14562 succeed(({ effects }) => { 14563 let download = effects.download; 14564 if (!download) 14565 return; 14566 let urlObject = window.webkitURL || window.URL; 14567 let url = urlObject.createObjectURL( 14568 base64toBlob(download.content, download.contentType) 14569 ); 14570 let invisibleLink = document.createElement("a"); 14571 invisibleLink.style.display = "none"; 14572 invisibleLink.href = url; 14573 invisibleLink.download = download.name; 14574 document.body.appendChild(invisibleLink); 14575 invisibleLink.click(); 14576 setTimeout(function() { 14577 urlObject.revokeObjectURL(url); 14578 }, 0); 14579 }); 14580 }); 14581 function base64toBlob(b64Data, contentType = "", sliceSize = 512) { 14582 const byteCharacters = atob(b64Data); 14583 const byteArrays = []; 14584 if (contentType === null) 14585 contentType = ""; 14586 for (let offset2 = 0; offset2 < byteCharacters.length; offset2 += sliceSize) { 14587 let slice = byteCharacters.slice(offset2, offset2 + sliceSize); 14588 let byteNumbers = new Array(slice.length); 14589 for (let i = 0; i < slice.length; i++) { 14590 byteNumbers[i] = slice.charCodeAt(i); 14591 } 14592 let byteArray = new Uint8Array(byteNumbers); 14593 byteArrays.push(byteArray); 14594 } 14595 return new Blob(byteArrays, { type: contentType }); 14596 } 14597 14598
14598// js/features/supportQueryString.js 14599 on2("effect", ({ component, effects, cleanup: cleanup2 }) => { 14600 let queryString = effects["url"]; 14601 if (!queryString) 14602 return; 14603 Object.entries(queryString).forEach(([key, value]) => { 14604 let { name, as, use, alwaysShow, except } = normalizeQueryStringEntry(key, value); 14605 if (!as) 14606 as = name; 14607 let initialValue = [false, null, void 0].includes(except) ? dataGet(component.ephemeral, name) : except; 14608 let { replace: replace2, push: push2, pop } = track2(as, initialValue, alwaysShow, except); 14609 if (use === "replace") { 14610 let effectReference = module_default.effect(() => { 14611 replace2(dataGet(component.reactive, name)); 14612 }); 14613 cleanup2(() => module_default.release(effectReference)); 14614 } else if (use === "push") { 14615 let popNavigating = false; 14616 let forgetCommitHandler = on2("commit", ({ component: commitComponent, succeed }) => { 14617 if (component !== commitComponent) 14618 return; 14619 let beforeValue = dataGet(component.canonical, name); 14620 succeed(() => { 14621 let afterValue = dataGet(component.canonical, name); 14622 if (JSON.stringify(beforeValue) === JSON.stringify(afterValue)) 14623 return; 14624 if (popNavigating) { 14625 replace2(afterValue); 14626 } else { 14627 push2(afterValue); 14628 } 14629 }); 14630 }); 14631 let forgetPopHandler = pop(async (newValue) => { 14632 popNavigating = true; 14633 await component.$wire.set(name, newValue); 14634 document.querySelectorAll("input").forEach((el) => { 14635 el._x_forceModelUpdate && el._x_forceModelUpdate(el._x_model.get()); 14636 }); 14637 requestAnimationFrame(() => popNavigating = false); 14638 }); 14639 let currentValue = dataGet(component.ephemeral, name); 14640 if (JSON.stringify(currentValue) !== JSON.stringify(initialValue)) { 14641 replace2(currentValue); 14642 } 14643 cleanup2(() => { 14644 forgetCommitHandler(); 14645 forgetPopHandler(); 14646 }); 14647 } 14648 }); 14649 }); 14650 function normalizeQueryStringEntry(key, value) { 14651 let defaults2 = { use: "replace", alwaysShow: false }; 14652 if (typeof value === "string") { 14653 return { ...defaults2, name: value, as: value }; 14654 } else { 14655 let fullerDefaults = { ...defaults2, name: key, as: key }; 14656 return { ...fullerDefaults, ...value }; 14657 } 14658 } 14659 14660
14660// js/features/supportLaravelEcho.js 14661 on2("request", ({ options }) => { 14662 if (window.Echo) { 14663 options.headers["X-Socket-ID"] = window.Echo.socketId(); 14664 } 14665 }); 14666 on2("effect", ({ component, effects }) => { 14667 let listeners2 = effects.listeners || []; 14668 listeners2.forEach((event) => { 14669 if (event.startsWith("echo")) { 14670 if (typeof window.Echo === "undefined") { 14671 console.warn("Laravel Echo cannot be found"); 14672 return; 14673 } 14674 let event_parts = event.split(/(echo:|echo-)|:|,/); 14675 if (event_parts[1] == "echo:") { 14676 event_parts.splice(2, 0, "channel", void 0); 14677 } 14678 if (event_parts[2] == "notification") { 14679 event_parts.push(void 0, void 0); 14680 } 14681 let [ 14682 s1, 14683 signature, 14684 channel_type, 14685 s2, 14686 channel, 14687 s3, 14688 event_name 14689 ] = event_parts; 14690 if (["channel", "private", "encryptedPrivate"].includes(channel_type)) { 14691 let handler4 = (e) => dispatchSelf(component, event, [e]); 14692 window.Echo[channel_type](channel).listen(event_name, handler4); 14693 component.addCleanup(() => { 14694 window.Echo[channel_type](channel).stopListening(event_name, handler4); 14695 }); 14696 } else if (channel_type == "presence") { 14697 if (["here", "joining", "leaving"].includes(event_name)) { 14698 window.Echo.join(channel)[event_name]((e) => { 14699 dispatchSelf(component, event, [e]); 14700 }); 14701 component.addCleanup(() => { 14702 window.Echo.leave(channel); 14703 }); 14704 } else { 14705 let handler4 = (e) => dispatchSelf(component, event, [e]); 14706 window.Echo.join(channel).listen(event_name, handler4); 14707 component.addCleanup(() => { 14708 window.Echo.leave(channel); 14709 }); 14710 } 14711 } else if (channel_type == "notification") { 14712 window.Echo.private(channel).notification((notification) => { 14713 dispatchSelf(component, event, [notification]); 14714 }); 14715 component.addCleanup(() => { 14716 window.Echo.private(channel).stopListening(".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"); 14717 }); 14718 } else { 14719 console.warn("Echo channel type not yet supported"); 14720 } 14721 } 14722 }); 14723 }); 14724 14725
14725// js/features/supportStreaming.js 14726 interceptMessage(({ message, onStream }) => { 14727 onStream(({ json }) => { 14728 let { id, type, name, el, ref, content, mode } = json; 14729 if (type === "island") 14730 return; 14731 let component = findComponent(id); 14732 let targetEl = null; 14733 if (type === "directive") { 14734 const replaceEl = component.el.querySelector(`[wire\\:stream\\.replace="${name}"]`); 14735 if (replaceEl) { 14736 targetEl = replaceEl; 14737 mode = "replace"; 14738 } else { 14739 targetEl = component.el.querySelector(`[wire\\:stream="${name}"]`); 14740 } 14741 } else if (type === "ref") { 14742 targetEl = findRefEl(component, ref); 14743 } else if (type === "element") { 14744 targetEl = component.el.querySelector(el); 14745 } 14746 if (!targetEl) 14747 return; 14748 if (mode === "replace") { 14749 targetEl.innerHTML = content; 14750 } else { 14751 targetEl.insertAdjacentHTML("beforeend", content); 14752 } 14753 }); 14754 }); 14755 14756
14756// js/features/supportNavigate.js 14757 document.addEventListener("livewire:initialized", () => { 14758 shouldHideProgressBar() && Alpine.navigate.disableProgressBar(); 14759 }); 14760 document.addEventListener("alpine:navigate", (e) => forwardEvent("livewire:navigate", e)); 14761 document.addEventListener("alpine:navigating", (e) => forwardEvent("livewire:navigating", e)); 14762 document.addEventListener("alpine:navigated", (e) => forwardEvent("livewire:navigated", e)); 14763 function forwardEvent(name, original) { 14764 let event = new CustomEvent(name, { cancelable: true, bubbles: true, detail: original.detail }); 14765 document.dispatchEvent(event); 14766 if (event.defaultPrevented) { 14767 original.preventDefault(); 14768 } 14769 } 14770 function shouldRedirectUsingNavigateOr(effects, url, or) { 14771 let forceNavigate = effects.redirectUsingNavigate; 14772 if (forceNavigate) { 14773 Alpine.navigate(url); 14774 } else { 14775 or(); 14776 } 14777 } 14778 function shouldHideProgressBar() { 14779 if (!!document.querySelector("[data-no-progress-bar]")) 14780 return true; 14781 if (window.livewireScriptConfig && window.livewireScriptConfig.progressBar === "data-no-progress-bar") 14782 return true; 14783 return false; 14784 } 14785 14786
14786// js/features/supportRedirects.js 14787 on2("effect", ({ effects, request }) => { 14788 if (!effects["redirect"]) 14789 return; 14790 let preventDefault = false; 14791 request.invokeOnRedirect({ url: effects["redirect"], preventDefault: () => preventDefault = true }); 14792 if (preventDefault) 14793 return; 14794 let url = effects["redirect"]; 14795 shouldRedirectUsingNavigateOr(effects, url, () => { 14796 window.location.href = url; 14797 }); 14798 }); 14799 14800
14800// js/features/supportIslands.js 14801 interceptAction(({ action }) => { 14802 let origin = action.origin; 14803 if (!origin) 14804 return; 14805 let { el, directive: directive3 } = origin; 14806 let islandAttr = Array.from(el.attributes).find((attr) => attr.name.startsWith("wire:island")); 14807 if (islandAttr) { 14808 let islandName = islandAttr.value; 14809 let attrParts = islandAttr.name.split("."); 14810 let isPrepend = attrParts.includes("prepend"); 14811 let isAppend = attrParts.includes("append"); 14812 let mode = isPrepend ? "prepend" : isAppend ? "append" : "morph"; 14813 action.mergeMetadata({ 14814 island: { 14815 name: islandName, 14816 mode 14817 } 14818 }); 14819 return; 14820 } 14821 let fragment = closestIsland(origin.el); 14822 if (!fragment) 14823 return; 14824 action.mergeMetadata({ 14825 island: { 14826 name: fragment.metadata.name, 14827 mode: "morph" 14828 } 14829 }); 14830 }); 14831 interceptMessage(({ message, onSuccess, onStream }) => { 14832 onStream(({ json }) => { 14833 let { type, islandFragment } = json; 14834 if (type !== "island") 14835 return; 14836 renderIsland(message.component, islandFragment); 14837 }); 14838 onSuccess(({ payload, onMorph }) => { 14839 onMorph(async () => { 14840 let fragments = payload.effects.islandFragments || []; 14841 fragments.forEach(async (fragmentHtml) => { 14842 await renderIsland(message.component, fragmentHtml); 14843 }); 14844 }); 14845 }); 14846 }); 14847 function closestIsland(el) { 14848 return closestFragment(el, { 14849 isMatch: ({ type }) => { 14850 return type === "island"; 14851 } 14852 }); 14853 } 14854 async function renderIsland(component, islandHtml) { 14855 let metadata = extractFragmentMetadataFromHtml(islandHtml); 14856 let fragment = findFragment(component.el, { 14857 isMatch: ({ type, token }) => { 14858 return type === metadata.type && token === metadata.token; 14859 } 14860 }); 14861 if (!fragment) 14862 return; 14863 let incomingMetadata = extractFragmentMetadataFromHtml(islandHtml); 14864 let strippedContent = extractInnerHtmlFromFragmentHtml(islandHtml); 14865 let parentElementTag = getTagName(fragment.startMarkerNode.parentElement); 14866 let mode = incomingMetadata.mode || "morph"; 14867 if (mode === "morph") { 14868 await morphFragment(component, fragment.startMarkerNode, fragment.endMarkerNode, strippedContent); 14869 } else if (mode === "append") { 14870 fragment.append(parentElementTag, strippedContent); 14871 } else if (mode === "prepend") { 14872 fragment.prepend(parentElementTag, strippedContent); 14873 } 14874 } 14875 14876
14876// js/features/supportSlots.js 14877 interceptMessage(({ message, onSuccess, onStream }) => { 14878 onSuccess(({ payload, onMorph }) => { 14879 onMorph(async () => { 14880 let fragments = payload.effects.slotFragments || []; 14881 fragments.forEach(async (fragmentHtml) => { 14882 await renderSlot(message.component, fragmentHtml); 14883 }); 14884 }); 14885 }); 14886 }); 14887 async function renderSlot(component, fragmentHtml) { 14888 let metadata = extractFragmentMetadataFromHtml(fragmentHtml); 14889 let targetComponent = findComponent(metadata.id); 14890 let fragment = findFragment(targetComponent.el, { 14891 isMatch: ({ name, token }) => { 14892 return name === metadata.name && token === metadata.token; 14893 } 14894 }); 14895 if (!fragment) 14896 return; 14897 let strippedContent = extractInnerHtmlFromFragmentHtml(fragmentHtml); 14898 await morphFragment(targetComponent, fragment.startMarkerNode, fragment.endMarkerNode, strippedContent); 14899 } 14900 14901
14901// js/features/supportDataLoading.js 14902 interceptMessage(({ message, onSend, onFinish }) => { 14903 let undos = []; 14904 onSend(() => { 14905 message.actions.forEach((action) => { 14906 let origin = action.origin; 14907 if (!origin) 14908 return; 14909 let el = origin.hasOwnProperty("targetEl") ? origin.targetEl : origin.el; 14910 if (!el) 14911 return; 14912 el.setAttribute("data-loading", "true"); 14913 undos.push(() => { 14914 el.removeAttribute("data-loading"); 14915 }); 14916 }); 14917 }); 14918 onFinish(() => undos.forEach((undo) => undo())); 14919 }); 14920 14921
14921// js/directives/wire-current.js 14922 module_default.addInitSelector(() => `[wire\\:current]`); 14923 var onPageChanges = /* @__PURE__ */ new Map(); 14924 document.addEventListener("livewire:navigated", () => { 14925 onPageChanges.forEach((i) => i(new URL(window.location.href))); 14926 }); 14927 globalDirective("current", ({ el, directive: directive3, cleanup: cleanup2 }) => { 14928 let expression = directive3.expression; 14929 let options = { 14930 exact: directive3.modifiers.includes("exact"), 14931 strict: directive3.modifiers.includes("strict"), 14932 ignore: directive3.modifiers.includes("ignore") 14933 }; 14934 if (options.ignore) 14935 return; 14936 if (expression.startsWith("#")) 14937 return; 14938 if (!el.hasAttribute("href")) 14939 return; 14940 let href = el.getAttribute("href"); 14941 let hrefUrl = new URL(href, window.location.href); 14942 let classes = expression.split(" ").filter(String); 14943 let refreshCurrent = (url) => { 14944 if (pathMatches(hrefUrl, url, options)) { 14945 el.classList.add(...classes); 14946 el.setAttribute("data-current", ""); 14947 } else { 14948 el.classList.remove(...classes); 14949 el.removeAttribute("data-current"); 14950 } 14951 };
14952 refreshCurrent(new URL(window.location.href)); 14953 onPageChanges.set(el, refreshCurrent); 14954 cleanup2(() => onPageChanges.delete(el)); 14955 }); 14956 function pathMatches(hrefUrl, actualUrl, options = {}) { 14957 if (hrefUrl.hostname !== actualUrl.hostname) 14958 return false; 14959 let hrefPath = options.strict ? hrefUrl.pathname : hrefUrl.pathname.replace(/\/+$/, ""); 14960 let actualPath = options.strict ? actualUrl.pathname : actualUrl.pathname.replace(/\/+$/, ""); 14961 if (options.exact) { 14962 return hrefPath === actualPath; 14963 } 14964 let hrefPathSegments = hrefPath.split("/"); 14965 let actualPathSegments = actualPath.split("/"); 14966 for (let i = 0; i < hrefPathSegments.length; i++) { 14967 if (hrefPathSegments[i] !== actualPathSegments[i]) 14968 return false; 14969 } 14970 return true; 14971 } 14972 14973
14973// js/directives/wire-navigate.js 14974 var wireNavigateSelectors = [ 14975 "[wire\\:navigate]", 14976 "[wire\\:navigate\\.hover]", 14977 "[wire\\:navigate\\.preserve-scroll]", 14978 "[wire\\:navigate\\.preserve-scroll\\.hover]", 14979 "[wire\\:navigate\\.hover\\.preserve-scroll]" 14980 ]; 14981 var wireNavigateSelector = wireNavigateSelectors.join(", "); 14982 var attributeMap = { 14983 "wire:navigate": "x-navigate", 14984 "wire:navigate.hover": "x-navigate.hover", 14985 "wire:navigate.preserve-scroll": "x-navigate.preserve-scroll", 14986 "wire:navigate.preserve-scroll.hover": "x-navigate.preserve-scroll.hover", 14987 "wire:navigate.hover.preserve-scroll": "x-navigate.hover.preserve-scroll" 14988 }; 14989 wireNavigateSelectors.forEach((selector) => { 14990 module_default.addInitSelector(() => selector); 14991 }); 14992 module_default.interceptInit( 14993 module_default.skipDuringClone((el) => { 14994 for (let [wireAttr, alpineDirective] of Object.entries(attributeMap)) { 14995 if (el.hasAttribute(wireAttr)) { 14996 module_default.bind(el, { [alpineDirective]: true }); 14997 break; 14998 } 14999 } 15000 }) 15001 ); 15002 document.addEventListener("alpine:navigating", () => { 15003 Livewire.all().forEach((component) => { 15004 component.inscribeSnapshotAndEffectsOnElement(); 15005 }); 15006 }); 15007 15008
15008// js/features/supportDataCurrent.js 15009 document.addEventListener("livewire:navigated", () => { 15010 updateNavigateLinks(); 15011 }); 15012 document.addEventListener("DOMContentLoaded", () => { 15013 updateNavigateLinks(); 15014 }); 15015 function updateNavigateLinks() { 15016 let currentUrl = new URL(window.location.href); 15017 let options = { 15018 exact: true 15019 }; 15020 document.querySelectorAll(wireNavigateSelector).forEach((el) => { 15021 if (Array.from(el.attributes).some((attr) => attr.name.startsWith("wire:current"))) 15022 return; 15023 let href = el.getAttribute("href"); 15024 if (!href || href.startsWith("#")) 15025 return; 15026 try { 15027 let hrefUrl = new URL(href, window.location.href); 15028 if (pathMatches(hrefUrl, currentUrl, options)) { 15029 el.setAttribute("data-current", ""); 15030 } else { 15031 el.removeAttribute("data-current"); 15032 } 15033 } catch (e) { 15034 } 15035 }); 15036 } 15037 15038
15038// js/features/supportPreserveScroll.js 15039 interceptMessage(({ message, onSuccess }) => { 15040 onSuccess(({ onSync, onMorph, onRender }) => { 15041 message.actions.forEach((action) => { 15042 let origin = action.origin; 15043 if (!origin || !origin.directive) 15044 return; 15045 let directive3 = origin.directive; 15046 if (!directive3.modifiers.includes("preserve-scroll")) 15047 return; 15048 let oldHeight; 15049 let oldScroll; 15050 onSync(() => { 15051 oldHeight = document.body.scrollHeight; 15052 oldScroll = window.scrollY; 15053 }); 15054 onMorph(async () => { 15055 let heightDiff = document.body.scrollHeight - oldHeight; 15056 window.scrollTo(0, oldScroll + heightDiff); 15057 oldHeight = null; 15058 oldScroll = null; 15059 }); 15060 }); 15061 }); 15062 }); 15063 15064
15064// js/features/supportWireIntersect.js 15065 module_default.interceptInit((el) => { 15066 for (let i = 0; i < el.attributes.length; i++) { 15067 if (el.attributes[i].name.startsWith("wire:intersect")) { 15068 let { name, value } = el.attributes[i]; 15069 let directive3 = extractDirective(el, name); 15070 let modifierString = name.split("wire:intersect")[1]; 15071 let expression = value.trim(); 15072 module_default.bind(el, { 15073 ["x-intersect" + modifierString](e) { 15074 directive3.eventContext = e; 15075 let component = findComponentByEl(el, false); 15076 if (!component) 15077 return; 15078 component.addActionContext({ 15079 el, 15080 directive: directive3 15081 }); 15082 evaluateActionExpression(el, expression); 15083 } 15084 }); 15085 } 15086 } 15087 }); 15088 15089
15089// js/features/supportWireSort.js 15090 module_default.interceptInit((el) => { 15091 for (let i = 0; i < el.attributes.length; i++) { 15092 if (el.attributes[i].name.startsWith("wire:sort:item")) { 15093 let directive3 = extractDirective(el, el.attributes[i].name); 15094 let modifierString = directive3.modifiers.join("."); 15095 let expression = directive3.expression; 15096 module_default.bind(el, { 15097 ["x-sort:item" + modifierString]() { 15098 return expression; 15099 } 15100 }); 15101 } else if (el.attributes[i].name.startsWith("wire:sort:group-id")) { 15102 continue; 15103 } else if (el.attributes[i].name.startsWith("wire:sort:group")) { 15104 return; 15105 } else if (el.attributes[i].name.startsWith("wire:sort")) { 15106 let directive3 = extractDirective(el, el.attributes[i].name); 15107 let attribute = directive3.rawName.replace("wire:", "x-"); 15108 if (directive3.modifiers.includes("async")) { 15109 attribute = attribute.replace(".async", ""); 15110 } 15111 if (directive3.modifiers.includes("renderless")) { 15112 attribute = attribute.replace(".renderless", ""); 15113 } 15114 if (directive3.modifiers.includes("prepend")) { 15115 attribute = attribute.replace(".prepend", ""); 15116 } 15117 if (directive3.modifiers.includes("append")) { 15118 attribute = attribute.replace(".append", ""); 15119 } 15120 let expression = directive3.expression; 15121 module_default.bind(el, { 15122 [attribute]() { 15123 setNextActionOrigin({ el, directive: directive3 }); 15124 let sortableChildren = Array.from(el.children).filter( 15125 (child) => child.hasAttribute("x-sort:item") || child.hasAttribute("wire:sort:item") 15126 ); 15127 let itemPosition = sortableChildren.findIndex((child) => child._x_sort_key === this.$item); 15128 let position = itemPosition !== -1 ? itemPosition : this.$position; 15129 let params = [this.$item, position]; 15130 let scope2 = { $item: this.$item, $position: position }; 15131 let sortId = el.getAttribute("wire:sort:group-id"); 15132 if (sortId !== null) { 15133 params.push(sortId); 15134 scope2.$id = sortId; 15135 } 15136 evaluateActionExpression(el, expression, { scope: scope2, params }); 15137 } 15138 }); 15139 } 15140 } 15141 }); 15142 15143
15143// js/features/supportCssModules.js 15144 var loadedStyles = /* @__PURE__ */ new Set(); 15145 on2("effect", ({ component, effects }) => { 15146 if (effects.styleModule) { 15147 let encodedName = component.name.replace(/\./g, "--").replace(/::/g, "---").replace(/:/g, "----"); 15148 let path = `${getModuleUrl()}/css/${encodedName}.css?v=${effects.styleModule}`; 15149 if (!loadedStyles.has(path)) { 15150 loadedStyles.add(path); 15151 injectStylesheet(path); 15152 } 15153 } 15154 if (effects.globalStyleModule) { 15155 let encodedName = component.name.replace(/\./g, "--").replace(/::/g, "---").replace(/:/g, "----"); 15156 let path = `${getModuleUrl()}/css/${encodedName}.global.css?v=${effects.globalStyleModule}`; 15157 if (!loadedStyles.has(path)) { 15158 loadedStyles.add(path); 15159 injectStylesheet(path); 15160 } 15161 } 15162 }); 15163 function injectStylesheet(href) { 15164 let link = document.createElement("link"); 15165 link.rel = "stylesheet"; 15166 link.href = href; 15167 let nonce2 = getNonce(); 15168 if (nonce2) 15169 link.nonce = nonce2; 15170 document.head.appendChild(link); 15171 } 15172 15173
15173// js/debounce.js 15174 var callbacksByComponent = new WeakBag(); 15175 function callAndClearComponentDebounces(component, callback) { 15176 callbacksByComponent.each(component, (callbackRegister) => { 15177 callbackRegister.callback(); 15178 callbackRegister.callback = () => { 15179 }; 15180 }); 15181 callback(); 15182 } 15183 15184
15184// js/directives/wire-wildcard.js 15185 on2("directive.init", ({ el, directive: directive3, cleanup: cleanup2, component }) => { 15186 if (["snapshot", "effects", "model", "init", "loading", "poll", "ignore", "id", "data", "key", "target", "dirty", "sort"].includes(directive3.value)) 15187 return; 15188 if (customDirectiveHasBeenRegistered(directive3.value)) 15189 return; 15190 let attribute = directive3.rawName.replace("wire:", "x-on:"); 15191 if (directive3.value === "submit" && !directive3.modifiers.includes("prevent")) { 15192 attribute = attribute + ".prevent"; 15193 } 15194 if (directive3.modifiers.includes("async")) { 15195 attribute = attribute.replace(".async", ""); 15196 } 15197 if (directive3.modifiers.includes("renderless")) { 15198 attribute = attribute.replace(".renderless", ""); 15199 } 15200 if (directive3.modifiers.includes("prepend")) { 15201 attribute = attribute.replace(".prepend", ""); 15202 } 15203 if (directive3.modifiers.includes("append")) { 15204 attribute = attribute.replace(".append", ""); 15205 } 15206 let cleanupBinding = module_default.bind(el, { 15207 [attribute](e) { 15208 directive3.eventContext = e; 15209 directive3.wire = component.$wire; 15210 let execute = () => { 15211 callAndClearComponentDebounces(component, () => { 15212 if (directive3.value === "submit") { 15213 let submitButton = e.submitter || el.querySelector('button[type="submit"], input[type="submit"]'); 15214 setNextActionOrigin({ el, directive: directive3, targetEl: submitButton }); 15215 } else { 15216 setNextActionOrigin({ el, directive: directive3 }); 15217 } 15218 let livewireOptions = e.detail?.livewire; 15219 if (livewireOptions?.interceptAction) { 15220 setNextActionInterceptor(livewireOptions.interceptAction); 15221 } 15222 let expression = directive3.expression; 15223 if (livewireOptions?.defaultParams !== void 0 && !expression.includes("(")) { 15224 let params = Array.isArray(livewireOptions.defaultParams) ? livewireOptions.defaultParams : [livewireOptions.defaultParams]; 15225 expression = expression + "(" + params.map((p) => JSON.stringify(p)).join(", ") + ")"; 15226 } 15227 evaluateActionExpression(el, expression, { scope: { $event: e } }); 15228 }); 15229 }; 15230 if (el.__livewire_confirm) { 15231 el.__livewire_confirm(() => { 15232 execute(); 15233 }, () => { 15234 e.stopImmediatePropagation(); 15235 }); 15236 } else { 15237 execute(); 15238 } 15239 } 15240 }); 15241 cleanup2(cleanupBinding); 15242 }); 15243 15244
15244// js/directives/wire-confirm.js 15245 directive2("confirm", ({ el, directive: directive3 }) => { 15246 let message = directive3.expression; 15247 let shouldPrompt = directive3.modifiers.includes("prompt"); 15248 message = message.replaceAll("\\n", "\n"); 15249 if (message === "") 15250 message = "Are you sure?"; 15251 el.__livewire_confirm = (action, instead) => { 15252 if (shouldPrompt) { 15253 let [question, expected] = message.split("|"); 15254 if (!expected) { 15255 console.warn("Livewire: Must provide expectation with wire:confirm.prompt"); 15256 } else { 15257 let input = prompt(question); 15258 if (input === expected) { 15259 action(); 15260 } else { 15261 instead(); 15262 } 15263 } 15264 } else { 15265 if (confirm(message)) 15266 action(); 15267 else 15268 instead(); 15269 } 15270 }; 15271 }); 15272 15273
15273// js/directives/wire-offline.js 15274 var offlineHandlers = /* @__PURE__ */ new Set(); 15275 var onlineHandlers = /* @__PURE__ */ new Set(); 15276 window.addEventListener("offline", () => offlineHandlers.forEach((i) => i())); 15277 window.addEventListener("online", () => onlineHandlers.forEach((i) => i())); 15278 directive2("offline", ({ el, directive: directive3, cleanup: cleanup2 }) => { 15279 let setOffline = () => toggleBooleanStateDirective(el, directive3, true); 15280 let setOnline = () => toggleBooleanStateDirective(el, directive3, false); 15281 offlineHandlers.add(setOffline); 15282 onlineHandlers.add(setOnline); 15283 cleanup2(() => { 15284 offlineHandlers.delete(setOffline); 15285 onlineHandlers.delete(setOnline); 15286 }); 15287 }); 15288 15289
15289// js/directives/wire-loading.js 15290 directive2("loading", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 15291 let { targets, inverted } = getTargets(el); 15292 let [delay3, abortDelay] = applyDelay(directive3); 15293 let cleanupA = whenTargetsArePartOfRequest(component, el, targets, inverted, [ 15294 () => delay3(() => toggleBooleanStateDirective(el, directive3, true)), 15295 () => abortDelay(() => toggleBooleanStateDirective(el, directive3, false)) 15296 ]); 15297 let cleanupB = whenTargetsArePartOfFileUpload(component, targets, [ 15298 () => delay3(() => toggleBooleanStateDirective(el, directive3, true)), 15299 () => abortDelay(() => toggleBooleanStateDirective(el, directive3, false)) 15300 ]); 15301 cleanup2(() => { 15302 cleanupA(); 15303 cleanupB(); 15304 }); 15305 }); 15306 function applyDelay(directive3) { 15307 if (!directive3.modifiers.includes("delay") || directive3.modifiers.includes("none")) 15308 return [(i) => i(), (i) => i()]; 15309 let duration = 200; 15310 let delayModifiers = { 15311 "shortest": 50, 15312 "shorter": 100, 15313 "short": 150, 15314 "default": 200, 15315 "long": 300, 15316 "longer": 500, 15317 "longest": 1e3 15318 }; 15319 Object.keys(delayModifiers).some((key) => { 15320 if (directive3.modifiers.includes(key)) { 15321 duration = delayModifiers[key]; 15322 return true; 15323 } 15324 }); 15325 let timeout; 15326 let started2 = false; 15327 return [ 15328 (callback) => { 15329 timeout = setTimeout(() => { 15330 callback(); 15331 started2 = true; 15332 }, duration); 15333 }, 15334 async (callback) => { 15335 if (started2) { 15336 await callback(); 15337 started2 = false; 15338 } else { 15339 clearTimeout(timeout); 15340 } 15341 } 15342 ]; 15343 } 15344 function whenTargetsArePartOfRequest(component, el, targets, inverted, [startLoading, endLoading]) { 15345 return interceptMessage(({ message, onSend, onSuccess, onFinish }) => { 15346 if (component !== message.component) 15347 return; 15348 if (targets.length === 0) { 15349 let island = closestIsland(el); 15350 if (island && !message.hasActionForIsland(island)) { 15351 return; 15352 } 15353 if (!island && !message.hasActionForComponent()) { 15354 return; 15355 } 15356 } 15357 let matches3 = true; 15358 let cleared = false; 15359 onSend(({ payload }) => { 15360 if (targets.length > 0 && containsTargets(payload, targets) === inverted) { 15361 matches3 = false; 15362 } 15363 matches3 && startLoading(); 15364 }); 15365 onSuccess(({ onEffect }) => { 15366 onEffect(() => { 15367 if (matches3 && !cleared) { 15368 endLoading(); 15369 cleared = true; 15370 } 15371 }); 15372 }); 15373 onFinish(() => { 15374 if (matches3 && !cleared) { 15375 endLoading(); 15376 cleared = true; 15377 } 15378 }); 15379 }); 15380 } 15381 function whenTargetsArePartOfFileUpload(component, targets, [startLoading, endLoading]) { 15382 let eventMismatch = (e) => { 15383 let { id, property } = e.detail; 15384 if (id !== component.id) 15385 return true; 15386 if (targets.length > 0 && !targets.map((i) => i.target).includes(property)) 15387 return true; 15388 return false; 15389 }; 15390 let cleanupA = listen(window, "livewire-upload-start", (e) => { 15391 if (eventMismatch(e)) 15392 return; 15393 startLoading(); 15394 }); 15395 let cleanupB = listen(window, "livewire-upload-finish", (e) => { 15396 if (eventMismatch(e)) 15397 return; 15398 endLoading(); 15399 }); 15400 let cleanupC = listen(window, "livewire-upload-error", (e) => { 15401 if (eventMismatch(e)) 15402 return; 15403 endLoading(); 15404 }); 15405 return () => { 15406 cleanupA(); 15407 cleanupB(); 15408 cleanupC(); 15409 }; 15410 } 15411 function containsTargets(payload, targets) { 15412 let { updates, calls } = payload; 15413 return targets.some(({ target, params }) => { 15414 if (params) { 15415 return calls.some(({ method, params: methodParams }) => { 15416 return target === method && params === quickHash(JSON.stringify(methodParams)); 15417 }); 15418 } 15419 let hasMatchingUpdate = Object.keys(updates).some((property) => { 15420 if (property.includes(".")) { 15421 let propertyRoot = property.split(".")[0]; 15422 if (propertyRoot === target) 15423 return true; 15424 } 15425 return property === target; 15426 }); 15427 if (hasMatchingUpdate) 15428 return true; 15429 if (calls.map((i) => i.method).includes(target)) 15430 return true; 15431 }); 15432 } 15433 function getTargets(el) { 15434 let directives2 = getDirectives(el); 15435 let targets = []; 15436 let inverted = false;
15437 if (directives2.has("target")) { 15438 let directive3 = directives2.get("target"); 15439 if (directive3.modifiers.includes("except")) 15440 inverted = true; 15441 directive3.methods.forEach(({ method, params }) => { 15442 targets.push({ 15443 target: method, 15444 params: params && params.length > 0 ? quickHash(JSON.stringify(params)) : void 0 15445 }); 15446 }); 15447 } else { 15448 let nonActionOrModelLivewireDirectives = ["init", "dirty", "offline", "navigate", "target", "loading", "poll", "ignore", "key", "id"]; 15449 directives2.all().filter((i) => !nonActionOrModelLivewireDirectives.includes(i.value)).map((i) => i.expression.split("(")[0]).forEach((target) => targets.push({ target })); 15450 } 15451 return { targets, inverted }; 15452 } 15453 function quickHash(subject) { 15454 return btoa(encodeURIComponent(subject)); 15455 } 15456 15457
15457// js/directives/wire-replace.js 15458 directive2("replace", ({ el, directive: directive3 }) => { 15459 if (directive3.modifiers.includes("self")) { 15460 el.__livewire_replace_self = true; 15461 } else { 15462 el.__livewire_replace = true; 15463 } 15464 }); 15465 15466
15466// js/directives/wire-ignore.js 15467 directive2("ignore", ({ el, directive: directive3 }) => { 15468 if (directive3.modifiers.includes("self")) { 15469 el.__livewire_ignore_self = true; 15470 } else if (directive3.modifiers.includes("children")) { 15471 el.__livewire_ignore_children = true; 15472 } else { 15473 el.__livewire_ignore = true; 15474 } 15475 }); 15476 15477
15477// js/directives/wire-cloak.js 15478 module_default.interceptInit((el) => { 15479 if (el.hasAttribute("wire:cloak")) { 15480 module_default.mutateDom(() => el.removeAttribute("wire:cloak")); 15481 } 15482 }); 15483 15484
15484// js/directives/wire-model.js 15485 directive2("model", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 15486 component = findComponentByEl(el); 15487 let { expression, modifiers } = directive3; 15488 if (!expression) { 15489 return console.warn("Livewire: [wire:model] is missing a value.", el); 15490 } 15491 if (componentIsMissingProperty(component, expression)) { 15492 return console.warn('Livewire: [wire:model="' + expression + '"] property does not exist on component: [' + component.name + "]", el); 15493 } 15494 if (el.type && el.type.toLowerCase() === "file") { 15495 return handleFileUpload(el, expression, component, cleanup2); 15496 } 15497 let liveIndex = modifiers.indexOf("live"); 15498 let isLive = liveIndex !== -1; 15499 let hasLazyWithoutLive = modifiers.includes("lazy") && !isLive; 15500 let shouldSendNetwork = isLive || hasLazyWithoutLive; 15501 let ephemeralModifiers = isLive && !hasLazyWithoutLive ? modifiers.slice(0, liveIndex) : modifiers.slice(); 15502 let networkModifiers = isLive && !hasLazyWithoutLive ? modifiers.slice(liveIndex + 1) : []; 15503 if (hasLazyWithoutLive) { 15504 ephemeralModifiers = ephemeralModifiers.filter((m) => m !== "lazy"); 15505 networkModifiers.push("change"); 15506 } 15507 if (!(ephemeralModifiers.includes("deep") || networkModifiers.includes("deep"))) { 15508 if (!ephemeralModifiers.includes("self")) { 15509 ephemeralModifiers.push("self"); 15510 } 15511 } 15512 let ephemeralOnBlur = ephemeralModifiers.includes("blur"); 15513 let ephemeralOnChange = ephemeralModifiers.includes("change") || ephemeralModifiers.includes("lazy"); 15514 let ephemeralOnEnter = ephemeralModifiers.includes("enter"); 15515 let hasEphemeralTriggers = ephemeralOnBlur || ephemeralOnChange || ephemeralOnEnter; 15516 let networkOnBlur = networkModifiers.includes("blur"); 15517 let networkOnChange = networkModifiers.includes("change") || networkModifiers.includes("lazy"); 15518 let networkOnEnter = networkModifiers.includes("enter"); 15519 let hasNetworkTriggers = networkOnBlur || networkOnChange || networkOnEnter; 15520 let isDebounced = networkModifiers.includes("debounce"); 15521 let isThrottled = networkModifiers.includes("throttle"); 15522 let update = () => { 15523 setNextActionOrigin({ el, directive: directive3 }); 15524 if (isLive || isDebounced) { 15525 setNextActionMetadata({ type: "model.live" }); 15526 } 15527 expression.startsWith("$parent") ? component.$wire.$parent.$commit() : component.$wire.$commit(); 15528 }; 15529 let debouncedUpdate = update; 15530 if (shouldSendNetwork && !hasNetworkTriggers && isRealtimeInput(el) || isDebounced) { 15531 debouncedUpdate = debounce2(debouncedUpdate, parseModifierDuration(networkModifiers, "debounce") || 150); 15532 } 15533 if (isThrottled) { 15534 debouncedUpdate = throttle3(debouncedUpdate, parseModifierDuration(networkModifiers, "throttle") || 150); 15535 } 15536 let bindings = {}; 15537 if (shouldSendNetwork && networkOnBlur) { 15538 bindings["@blur"] = () => update(); 15539 } 15540 if (shouldSendNetwork && networkOnChange) { 15541 bindings["@change"] = () => update(); 15542 } 15543 if (shouldSendNetwork && networkOnEnter) { 15544 bindings["@keydown.enter"] = () => update(); 15545 } 15546 let xModelTail = getModifierTail(ephemeralModifiers); 15547 bindings["x-model" + xModelTail] = () => { 15548 return { 15549 get() { 15550 return dataGet(component.$wire, expression); 15551 }, 15552 set(value) { 15553 dataSet(component.$wire, expression, value); 15554 if (shouldSendNetwork && !hasNetworkTriggers) { 15555 debouncedUpdate(); 15556 } 15557 } 15558 }; 15559 }; 15560 module_default.bind(el, bindings); 15561 }); 15562 function getModifierTail(modifiers) { 15563 modifiers = modifiers.filter((i) => ![ 15564 "defer", 15565 "live" 15566 ].includes(i)); 15567 if (modifiers.includes("debounce")) { 15568 let index2 = modifiers.indexOf("debounce"); 15569 let hasDuration = parseModifierDuration(modifiers, "debounce") !== void 0; 15570 modifiers.splice(index2, hasDuration ? 2 : 1); 15571 } 15572 if (modifiers.includes("throttle")) { 15573 let index2 = modifiers.indexOf("throttle"); 15574 let hasDuration = parseModifierDuration(modifiers, "throttle") !== void 0; 15575 modifiers.splice(index2, hasDuration ? 2 : 1); 15576 } 15577 if (modifiers.length === 0) 15578 return ""; 15579 return "." + modifiers.join("."); 15580 } 15581 function isRealtimeInput(el) { 15582 return ["INPUT", "TEXTAREA"].includes(el.tagName.toUpperCase()) && !["checkbox", "radio"].includes(el.type) || el.tagName.toUpperCase() === "UI-SLIDER" || el.tagName.toUpperCase() === "UI-COMPOSER"; 15583 } 15584 function componentIsMissingProperty(component, property) { 15585 if (property.startsWith("$parent")) { 15586 let parent = findComponentByEl(component.el.parentElement, false); 15587 if (!parent) 15588 return true; 15589 return componentIsMissingProperty(parent, property.slice(7).replace(/^\./, "")); 15590 } 15591 let match = property.match(/^\[['"]?([^\]'"]+)['"]?\]/) || property.match(/^([^.\[]+)/); 15592 let baseProperty = match[1]; 15593 return !Object.keys(component.canonical).includes(baseProperty); 15594 } 15595 function debounce2(func, wait) { 15596 var timeout; 15597 return function() { 15598 var context = this, args = arguments; 15599 var later = function() { 15600 timeout = null;
15601 func.apply(context, args); 15602 }; 15603 clearTimeout(timeout); 15604 timeout = setTimeout(later, wait); 15605 }; 15606 } 15607 function throttle3(func, limit) { 15608 let inThrottle; 15609 return function() { 15610 let context = this, args = arguments; 15611 if (!inThrottle) { 15612 func.apply(context, args); 15613 inThrottle = true; 15614 setTimeout(() => inThrottle = false, limit); 15615 } 15616 }; 15617 } 15618 function parseModifierDuration(modifiers, key) { 15619 let index2 = modifiers.indexOf(key); 15620 if (index2 === -1) 15621 return void 0; 15622 let nextModifier = modifiers[modifiers.indexOf(key) + 1] || "invalid-wait"; 15623 let duration = nextModifier.split("ms")[0]; 15624 return !isNaN(duration) ? duration : void 0; 15625 } 15626 15627
15627// js/directives/wire-init.js 15628 directive2("init", ({ component, el, directive: directive3 }) => { 15629 let fullMethod = directive3.expression ? directive3.expression : "$refresh"; 15630 setNextActionOrigin({ el, directive: directive3 }); 15631 evaluateActionExpression(el, fullMethod); 15632 }); 15633 15634
15634// js/directives/wire-poll.js 15635 directive2("poll", ({ el, directive: directive3, component }) => { 15636 let interval = extractDurationFrom(directive3.modifiers, 2e3); 15637 let { start: start3, pauseWhile, throttleWhile, stopWhen } = poll(() => { 15638 triggerComponentRequest(el, directive3, component); 15639 }, interval); 15640 start3(); 15641 throttleWhile(() => theTabIsInTheBackground() && theDirectiveIsMissingKeepAlive(directive3)); 15642 pauseWhile(() => theDirectiveHasVisible(directive3) && theElementIsNotInTheViewport(el)); 15643 pauseWhile(() => theDirectiveIsOffTheElement(el)); 15644 pauseWhile(() => livewireIsOffline()); 15645 pauseWhile(() => sessionIsExpired()); 15646 stopWhen(() => theElementIsDisconnected(el)); 15647 }); 15648 function triggerComponentRequest(el, directive3, component) { 15649 setNextActionOrigin({ el, directive: directive3, targetEl: null }); 15650 setNextActionMetadata({ type: "poll" }); 15651 let fullMethod = directive3.expression ? directive3.expression : "$refresh"; 15652 evaluateActionExpression(el, fullMethod); 15653 } 15654 function poll(callback, interval = 2e3) { 15655 let pauseConditions = []; 15656 let throttleConditions = []; 15657 let stopConditions = []; 15658 return { 15659 start() { 15660 let clear2 = syncronizedInterval(interval, () => { 15661 if (stopConditions.some((i) => i())) 15662 return clear2(); 15663 if (pauseConditions.some((i) => i())) 15664 return; 15665 if (throttleConditions.some((i) => i()) && Math.random() < 0.95) 15666 return; 15667 callback(); 15668 }); 15669 }, 15670 pauseWhile(condition) { 15671 pauseConditions.push(condition); 15672 }, 15673 throttleWhile(condition) { 15674 throttleConditions.push(condition); 15675 }, 15676 stopWhen(condition) { 15677 stopConditions.push(condition); 15678 } 15679 }; 15680 } 15681 var clocks = []; 15682 function syncronizedInterval(ms, callback) { 15683 if (!clocks[ms]) { 15684 let clock = { 15685 timer: setInterval(() => clock.callbacks.forEach((i) => i()), ms), 15686 callbacks: /* @__PURE__ */ new Set() 15687 }; 15688 clocks[ms] = clock; 15689 } 15690 clocks[ms].callbacks.add(callback); 15691 return () => { 15692 clocks[ms].callbacks.delete(callback); 15693 if (clocks[ms].callbacks.size === 0) { 15694 clearInterval(clocks[ms].timer); 15695 delete clocks[ms]; 15696 } 15697 }; 15698 } 15699 var isOffline = false; 15700 window.addEventListener("offline", () => isOffline = true); 15701 window.addEventListener("online", () => isOffline = false); 15702 function livewireIsOffline() { 15703 return isOffline; 15704 } 15705 var inBackground = false; 15706 document.addEventListener("visibilitychange", () => { 15707 inBackground = document.hidden; 15708 }, false); 15709 function theTabIsInTheBackground() { 15710 return inBackground; 15711 } 15712 function theDirectiveIsOffTheElement(el) { 15713 return !getDirectives(el).has("poll"); 15714 } 15715 function theDirectiveIsMissingKeepAlive(directive3) { 15716 return !directive3.modifiers.includes("keep-alive"); 15717 } 15718 function theDirectiveHasVisible(directive3) { 15719 return directive3.modifiers.includes("visible"); 15720 } 15721 function theElementIsNotInTheViewport(el) { 15722 let bounding = el.getBoundingClientRect(); 15723 return !(bounding.top < (window.innerHeight || document.documentElement.clientHeight) && bounding.left < (window.innerWidth || document.documentElement.clientWidth) && bounding.bottom > 0 && bounding.right > 0); 15724 } 15725 function theElementIsDisconnected(el) { 15726 return el.isConnected === false; 15727 } 15728 function extractDurationFrom(modifiers, defaultDuration) { 15729 let durationInMilliSeconds; 15730 let durationInMilliSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)ms/)); 15731 let durationInSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)s/)); 15732 if (durationInMilliSecondsString) { 15733 durationInMilliSeconds = Number(durationInMilliSecondsString.replace("ms", "")); 15734 } else if (durationInSecondsString) { 15735 durationInMilliSeconds = Number(durationInSecondsString.replace("s", "")) * 1e3; 15736 } 15737 return durationInMilliSeconds || defaultDuration; 15738 } 15739 15740
15740// js/directives/wire-show.js 15741 module_default.interceptInit((el) => { 15742 for (let i = 0; i < el.attributes.length; i++) { 15743 if (el.attributes[i].name.startsWith("wire:show")) { 15744 let { name, value } = el.attributes[i]; 15745 let modifierString = name.split("wire:show")[1]; 15746 let expression = value.trim(); 15747 module_default.bind(el, { 15748 ["x-show" + modifierString]() { 15749 return evaluateActionExpression(el, expression); 15750 } 15751 }); 15752 } 15753 } 15754 }); 15755 15756
15756// js/directives/wire-text.js 15757 module_default.interceptInit((el) => { 15758 for (let i = 0; i < el.attributes.length; i++) { 15759 if (el.attributes[i].name.startsWith("wire:text")) { 15760 let { name, value } = el.attributes[i]; 15761 let modifierString = name.split("wire:text")[1]; 15762 let expression = value.trim(); 15763 module_default.bind(el, { 15764 ["x-text" + modifierString]() { 15765 return evaluateActionExpression(el, expression); 15766 } 15767 }); 15768 } 15769 } 15770 }); 15771 15772
15772// js/directives/wire-bind.js 15773 module_default.interceptInit((el) => { 15774 for (let i = 0; i < el.attributes.length; i++) { 15775 if (el.attributes[i].name.startsWith("wire:bind:")) { 15776 let { name, value } = el.attributes[i]; 15777 let remainder = name.split("wire:bind")[1]; 15778 let expression = value.trim(); 15779 module_default.bind(el, { 15780 ["x-bind" + remainder]() { 15781 return evaluateActionExpression(el, expression); 15782 } 15783 }); 15784 } 15785 } 15786 }); 15787 15788
15788// js/index.js 15789 var Livewire2 = { 15790 directive: directive2, 15791 dispatchTo, 15792 interceptAction: (callback) => interceptAction(callback), 15793 interceptMessage: (callback) => interceptMessage(callback), 15794 interceptRequest: (callback) => interceptRequest(callback), 15795 fireAction: (component, method, params = [], metadata = {}) => fireAction(component, method, params, metadata), 15796 start: start2, 15797 first, 15798 find, 15799 getByName, 15800 all, 15801 hook: on2, 15802 trigger: trigger2, 15803 triggerAsync, 15804 dispatch: dispatchGlobal, 15805 on: on3, 15806 get navigate() { 15807 return module_default.navigate; 15808 } 15809 }; 15810 var warnAboutMultipleInstancesOf = (entity) => console.warn(`Detected multiple instances of ${entity} running`); 15811 if (window.Livewire) 15812 warnAboutMultipleInstancesOf("Livewire"); 15813 if (window.Alpine) 15814 warnAboutMultipleInstancesOf("Alpine"); 15815 window.Livewire = Livewire2; 15816 window.Alpine = module_default; 15817 if (window.livewireScriptConfig === void 0) { 15818 window.Alpine.__fromLivewire = true; 15819 document.addEventListener("DOMContentLoaded", () => { 15820 if (window.Alpine.__fromLivewire === void 0) { 15821 warnAboutMultipleInstancesOf("Alpine"); 15822 } 15823 Livewire2.start(); 15824 }); 15825 } 15826})(); 15827/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress 15828 * @license MIT */ 15829/*! Bundled license information: 15830 15831sortablejs/modular/sortable.esm.js: 15832 (**! 15833 * Sortable 1.15.2 15834 * @author RubaXa <[email protected]> 15835 * @author owenm <[email protected]> 15836 * @license MIT 15837 *) 15838*/ 15839/*! Bundled license information: 15840 15841tabbable/dist/index.esm.js: 15842 (*! 15843 * tabbable 6.4.0 15844 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE 15845 *) 15846 15847focus-trap/dist/focus-trap.esm.js: 15848 (*! 15849 * focus-trap 8.0.0 15850 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE 15851 *) 15852 (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *) 15853*/
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.