Kontaktdaten
diff --git a/hifi/api/database/migration_custom_fonts.sql b/hifi/api/database/migration_custom_fonts.sql
new file mode 100644
index 0000000..d828246
--- /dev/null
+++ b/hifi/api/database/migration_custom_fonts.sql
@@ -0,0 +1,16 @@
+USE hifi_shop;
+
+-- Vom Admin selbst hochgeladene Schriftart-Dateien (WOFF2/WOFF/TTF/OTF), stehen danach neben
+-- der festen System-Schriftartenliste in jeder Schriftart-Auswahl zur Verfuegung. font_family
+-- ist ein serverseitig erzeugter, kollisionsfreier CSS-Bezeichner, nicht der Anzeigename.
+-- Additiv, nichts wird geloescht.
+-- Hinweis: Auf der Live-Seite reicht stattdessen ein Klick auf "Datenbankstruktur aktualisieren"
+-- unter Admin-Panel -> Einstellungen -> Datenbank.
+
+CREATE TABLE IF NOT EXISTS custom_fonts (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ name VARCHAR(100) NOT NULL,
+ font_family VARCHAR(50) NOT NULL UNIQUE,
+ file_path VARCHAR(255) NOT NULL,
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
+) ENGINE=InnoDB;
diff --git a/hifi/api/database/schema.sql b/hifi/api/database/schema.sql
index 78877f5..e5bfcce 100644
--- a/hifi/api/database/schema.sql
+++ b/hifi/api/database/schema.sql
@@ -152,6 +152,14 @@ CREATE TABLE text_styles (
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB;
+CREATE TABLE custom_fonts (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ name VARCHAR(100) NOT NULL,
+ font_family VARCHAR(50) NOT NULL UNIQUE,
+ file_path VARCHAR(255) NOT NULL,
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
+) ENGINE=InnoDB;
+
CREATE TABLE car_models (
id INT AUTO_INCREMENT PRIMARY KEY,
brand_id INT NOT NULL,
diff --git a/hifi/api/public/index.php b/hifi/api/public/index.php
index 0562718..2801d0d 100644
--- a/hifi/api/public/index.php
+++ b/hifi/api/public/index.php
@@ -13,6 +13,7 @@ use App\Controllers\AnalyticsController;
use App\Controllers\AuthController;
use App\Controllers\BrandController;
use App\Controllers\ContactController;
+use App\Controllers\CustomFontController;
use App\Controllers\DatabaseConfigController;
use App\Controllers\FaqController;
use App\Controllers\GalleryBrandController;
@@ -181,6 +182,10 @@ $router->get('/text-styles', fn($p) => TextStyleController::index());
$router->get('/text-styles/one', fn($p) => TextStyleController::show());
$router->put('/text-styles', $admin(fn($p) => TextStyleController::update()));
+$router->get('/custom-fonts', fn($p) => CustomFontController::index());
+$router->post('/custom-fonts', $perm('settings.manage', fn($p) => CustomFontController::store()));
+$router->delete('/custom-fonts/{id}', $perm('settings.manage', fn($p) => CustomFontController::destroy($p)));
+
// Nur der zuletzt gecachte Stand - kein Live-Aufruf bei Google pro Seitenbesuch
// (Aktualisierung laeuft ausschliesslich ueber refresh_google_reviews.php).
$router->get('/google-reviews', fn($p) => GoogleReviewsController::publicReviews());
diff --git a/hifi/api/src/Controllers/CustomFontController.php b/hifi/api/src/Controllers/CustomFontController.php
new file mode 100644
index 0000000..4e5d64e
--- /dev/null
+++ b/hifi/api/src/Controllers/CustomFontController.php
@@ -0,0 +1,85 @@
+query(
+ 'SELECT id, name, font_family, file_path FROM custom_fonts ORDER BY name'
+ );
+ Http::send($stmt->fetchAll());
+ }
+
+ public static function store(): void
+ {
+ $name = trim($_POST['name'] ?? '');
+ if ($name === '') {
+ Http::error('Name erforderlich', 422);
+ }
+ if (empty($_FILES['file']) || $_FILES['file']['error'] !== UPLOAD_ERR_OK) {
+ Http::error('Keine Datei übermittelt', 422);
+ }
+
+ $file = $_FILES['file'];
+ if ($file['size'] > self::MAX_BYTES) {
+ Http::error('Datei zu groß (max. 2 MB)', 422);
+ }
+
+ $extension = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
+ if (!in_array($extension, self::ALLOWED_EXTENSIONS, true)) {
+ Http::error('Nur WOFF2, WOFF, TTF oder OTF erlaubt', 422);
+ }
+
+ $filename = bin2hex(random_bytes(16)) . '.' . $extension;
+ $destination = __DIR__ . '/../../uploads/' . $filename;
+ if (!move_uploaded_file($file['tmp_name'], $destination)) {
+ Http::error('Datei konnte nicht gespeichert werden', 500);
+ }
+
+ $config = require __DIR__ . '/../../config/config.php';
+ $prefix = rtrim($config['app']['base_path'], '/') . '/api/uploads/';
+ $filePath = $prefix . $filename;
+
+ // Kollisionsfreier CSS-Bezeichner, unabhaengig vom (nicht garantiert eindeutigen)
+ // Anzeigenamen - wird direkt als font-family-Wert verwendet, muss also ohne
+ // Escaping/Anfuehrungszeichen sicher in CSS einsetzbar sein.
+ $fontFamily = 'custom-font-' . bin2hex(random_bytes(4));
+
+ $db = Database::connection();
+ $stmt = $db->prepare('INSERT INTO custom_fonts (name, font_family, file_path) VALUES (?, ?, ?)');
+ $stmt->execute([$name, $fontFamily, $filePath]);
+
+ Http::send(['id' => (int) $db->lastInsertId(), 'name' => $name, 'font_family' => $fontFamily, 'file_path' => $filePath], 201);
+ }
+
+ public static function destroy(array $params): void
+ {
+ $id = (int) $params['id'];
+ $db = Database::connection();
+
+ $stmt = $db->prepare('SELECT file_path FROM custom_fonts WHERE id = ?');
+ $stmt->execute([$id]);
+ $filePath = $stmt->fetchColumn();
+
+ $db->prepare('DELETE FROM custom_fonts WHERE id = ?')->execute([$id]);
+
+ Uploads::deleteIfOrphaned($filePath ?: null, null);
+
+ Http::send(['ok' => true]);
+ }
+}
diff --git a/hifi/api/src/Controllers/HomeSectionController.php b/hifi/api/src/Controllers/HomeSectionController.php
index 0263dbe..d280176 100644
--- a/hifi/api/src/Controllers/HomeSectionController.php
+++ b/hifi/api/src/Controllers/HomeSectionController.php
@@ -125,7 +125,7 @@ class HomeSectionController
// Schriftart-Override dieser Sektion - leer/ungueltig = "Standard" (faellt in Home.jsx
// auf die globale Website-Schriftart zurueck, siehe app_settings.site_font).
$fontFamily = (string) ($body['font_family'] ?? '');
- if (!in_array($fontFamily, Fonts::VALUES, true)) {
+ if (!Fonts::isValid($fontFamily)) {
$fontFamily = '';
}
diff --git a/hifi/api/src/Controllers/SiteSettingsController.php b/hifi/api/src/Controllers/SiteSettingsController.php
index 9757080..d4e2f7a 100644
--- a/hifi/api/src/Controllers/SiteSettingsController.php
+++ b/hifi/api/src/Controllers/SiteSettingsController.php
@@ -104,7 +104,7 @@ class SiteSettingsController
// Globale Standard-Schriftart der Website - faellt auf Systemschrift (leerer String)
// zurueck, wenn ein unbekannter Wert ankommt, statt ihn ungeprueft zu speichern.
$siteFont = (string) ($body['site_font'] ?? '');
- if (!in_array($siteFont, Fonts::VALUES, true)) {
+ if (!Fonts::isValid($siteFont)) {
$siteFont = '';
}
diff --git a/hifi/api/src/Controllers/TextStyleController.php b/hifi/api/src/Controllers/TextStyleController.php
index 389722a..3423a74 100644
--- a/hifi/api/src/Controllers/TextStyleController.php
+++ b/hifi/api/src/Controllers/TextStyleController.php
@@ -79,7 +79,7 @@ class TextStyleController
AuthMiddleware::requirePermission($entry['permission']);
$fontFamily = (string) ($body['font_family'] ?? '');
- if (!in_array($fontFamily, Fonts::VALUES, true)) {
+ if (!Fonts::isValid($fontFamily)) {
$fontFamily = '';
}
$fontSize = (string) ($body['font_size'] ?? '');
diff --git a/hifi/api/src/Support/Fonts.php b/hifi/api/src/Support/Fonts.php
index ef7910c..f75e628 100644
--- a/hifi/api/src/Support/Fonts.php
+++ b/hifi/api/src/Support/Fonts.php
@@ -2,6 +2,8 @@
namespace App\Support;
+use App\Config\Database;
+
/**
* Muss zu hifi-src/src/utils/fontOptions.js (FONT_OPTIONS) passen - dieselbe Liste wird dort
* vom Rich-Text-Editor (Mail-Vorlagen/Rechtstexte), der globalen Website-Schriftart und der
@@ -14,4 +16,22 @@ class Fonts
'"Times New Roman", Times, serif', 'Verdana, Geneva, sans-serif',
'"Courier New", Courier, monospace',
];
+
+ /**
+ * Gueltig ist entweder einer der festen Werte oben, oder der font_family-Bezeichner einer
+ * selbst hochgeladenen Schriftart (siehe CustomFontController) - jede Stelle, die bisher
+ * gegen VALUES geprueft hat, prueft stattdessen hierueber.
+ */
+ public static function isValid(string $value): bool
+ {
+ if (in_array($value, self::VALUES, true)) {
+ return true;
+ }
+ if ($value === '') {
+ return true;
+ }
+ $stmt = Database::connection()->prepare('SELECT 1 FROM custom_fonts WHERE font_family = ?');
+ $stmt->execute([$value]);
+ return (bool) $stmt->fetchColumn();
+ }
}
diff --git a/hifi/api/src/Support/Schema.php b/hifi/api/src/Support/Schema.php
index 45e669c..4b9a53d 100644
--- a/hifi/api/src/Support/Schema.php
+++ b/hifi/api/src/Support/Schema.php
@@ -183,6 +183,18 @@ class Schema
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB",
+ // Vom Admin selbst hochgeladene Schriftart-Dateien (WOFF2/WOFF/TTF/OTF), stehen danach
+ // neben der festen Fonts::VALUES-Liste in jeder Schriftart-Auswahl zur Verfuegung.
+ // font_family ist ein serverseitig erzeugter, kollisionsfreier CSS-Bezeichner
+ // (z.B. "custom-font-a1b2c3d4"), NICHT der vom Admin eingegebene Anzeigename.
+ 'custom_fonts' => "CREATE TABLE custom_fonts (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ name VARCHAR(100) NOT NULL,
+ font_family VARCHAR(50) NOT NULL UNIQUE,
+ file_path VARCHAR(255) NOT NULL,
+ created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ) ENGINE=InnoDB",
+
'car_models' => "CREATE TABLE car_models (
id INT AUTO_INCREMENT PRIMARY KEY,
brand_id INT NOT NULL,
@@ -471,6 +483,13 @@ class Schema
'color' => 'VARCHAR(20) NULL',
'updated_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
],
+ 'custom_fonts' => [
+ 'id' => 'INT AUTO_INCREMENT PRIMARY KEY',
+ 'name' => 'VARCHAR(100) NOT NULL',
+ 'font_family' => 'VARCHAR(50) NOT NULL',
+ 'file_path' => 'VARCHAR(255) NOT NULL',
+ 'created_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
+ ],
'car_models' => [
'id' => 'INT AUTO_INCREMENT PRIMARY KEY',
'brand_id' => 'INT NOT NULL',
diff --git a/hifi/assets/index-BVDYjPgo.js b/hifi/assets/index-BVDYjPgo.js
new file mode 100644
index 0000000..bcf7390
--- /dev/null
+++ b/hifi/assets/index-BVDYjPgo.js
@@ -0,0 +1,326 @@
+import{r as v,g as n1,R as dM,D as hM,C as fM,M as pM,a as mM,P as gM,U as xM,b as $x,c as Hx,d as yM,S as bM,e as vM,E as kM,i as wM,f as ts}from"./lucide-icons-Cg2IxtAO.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var r1={exports:{}},Od={};/**
+ * @license React
+ * react-jsx-runtime.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var SM=v,NM=Symbol.for("react.element"),CM=Symbol.for("react.fragment"),jM=Object.prototype.hasOwnProperty,EM=SM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,TM={key:!0,ref:!0,__self:!0,__source:!0};function s1(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)jM.call(e,r)&&!TM.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:NM,type:t,key:i,ref:o,props:s,_owner:EM.current}}Od.Fragment=CM;Od.jsx=s1;Od.jsxs=s1;r1.exports=Od;var c=r1.exports,ap={},i1={exports:{}},Ut={},o1={exports:{}},a1={};/**
+ * @license React
+ * scheduler.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */(function(t){function e(R,_){var $=R.length;R.push(_);e:for(;0<$;){var ee=$-1>>>1,te=R[ee];if(0>>1;ees(ae,$))ues(Ge,ae)?(R[ee]=Ge,R[ue]=$,ee=ue):(R[ee]=ae,R[X]=$,ee=X);else if(ues(Ge,$))R[ee]=Ge,R[ue]=$,ee=ue;else break e}}return _}function s(R,_){var $=R.sortIndex-_.sortIndex;return $!==0?$:R.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],u=[],d=1,h=null,p=3,f=!1,m=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(R){for(var _=n(u);_!==null;){if(_.callback===null)r(u);else if(_.startTime<=R)r(u),_.sortIndex=_.expirationTime,e(l,_);else break;_=n(u)}}function w(R){if(x=!1,k(R),!m)if(n(l)!==null)m=!0,z(C);else{var _=n(u);_!==null&&q(w,_.startTime-R)}}function C(R,_){m=!1,x&&(x=!1,b(N),N=-1),f=!0;var $=p;try{for(k(_),h=n(l);h!==null&&(!(h.expirationTime>_)||R&&!D());){var ee=h.callback;if(typeof ee=="function"){h.callback=null,p=h.priorityLevel;var te=ee(h.expirationTime<=_);_=t.unstable_now(),typeof te=="function"?h.callback=te:h===n(l)&&r(l),k(_)}else r(l);h=n(l)}if(h!==null)var K=!0;else{var X=n(u);X!==null&&q(w,X.startTime-_),K=!1}return K}finally{h=null,p=$,f=!1}}var j=!1,S=null,N=-1,T=5,E=-1;function D(){return!(t.unstable_now()-ER||125ee?(R.sortIndex=$,e(u,R),n(l)===null&&R===n(u)&&(x?(b(N),N=-1):x=!0,q(w,$-ee))):(R.sortIndex=te,e(l,R),m||f||(m=!0,z(C))),R},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(R){var _=p;return function(){var $=p;p=_;try{return R.apply(this,arguments)}finally{p=$}}}})(a1);o1.exports=a1;var MM=o1.exports;/**
+ * @license React
+ * react-dom.production.min.js
+ *
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var PM=v,Wt=MM;function F(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lp=Object.prototype.hasOwnProperty,AM=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Wx={},Ux={};function DM(t){return lp.call(Ux,t)?!0:lp.call(Wx,t)?!1:AM.test(t)?Ux[t]=!0:(Wx[t]=!0,!1)}function LM(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function RM(t,e,n,r){if(e===null||typeof e>"u"||LM(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Et(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lt[t]=new Et(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lt[e]=new Et(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lt[t]=new Et(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lt[t]=new Et(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lt[t]=new Et(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lt[t]=new Et(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lt[t]=new Et(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lt[t]=new Et(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lt[t]=new Et(t,5,!1,t.toLowerCase(),null,!1,!1)});var Ng=/[\-:]([a-z])/g;function Cg(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Ng,Cg);lt[e]=new Et(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Ng,Cg);lt[e]=new Et(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Ng,Cg);lt[e]=new Et(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lt[t]=new Et(t,1,!1,t.toLowerCase(),null,!1,!1)});lt.xlinkHref=new Et("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lt[t]=new Et(t,1,!1,t.toLowerCase(),null,!0,!0)});function jg(t,e,n,r){var s=lt.hasOwnProperty(e)?lt[e]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var l=`
+`+s[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Rh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Go(t):""}function _M(t){switch(t.tag){case 5:return Go(t.type);case 16:return Go("Lazy");case 13:return Go("Suspense");case 19:return Go("SuspenseList");case 0:case 2:case 15:return t=_h(t.type,!1),t;case 11:return t=_h(t.type.render,!1),t;case 1:return t=_h(t.type,!0),t;default:return""}}function hp(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Si:return"Fragment";case wi:return"Portal";case cp:return"Profiler";case Eg:return"StrictMode";case up:return"Suspense";case dp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case u1:return(t.displayName||"Context")+".Consumer";case c1:return(t._context.displayName||"Context")+".Provider";case Tg:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Mg:return e=t.displayName||null,e!==null?e:hp(t.type)||"Memo";case Cr:e=t._payload,t=t._init;try{return hp(t(e))}catch{}}return null}function IM(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return hp(e);case 8:return e===Eg?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function ns(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function h1(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function OM(t){var e=h1(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Wl(t){t._valueTracker||(t._valueTracker=OM(t))}function f1(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=h1(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function au(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function fp(t,e){var n=e.checked;return Ee({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Gx(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=ns(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function p1(t,e){e=e.checked,e!=null&&jg(t,"checked",e,!1)}function pp(t,e){p1(t,e);var n=ns(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?mp(t,e.type,n):e.hasOwnProperty("defaultValue")&&mp(t,e.type,ns(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function qx(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function mp(t,e,n){(e!=="number"||au(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var qo=Array.isArray;function Bi(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=Ul.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ra(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var sa={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},BM=["Webkit","ms","Moz","O"];Object.keys(sa).forEach(function(t){BM.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),sa[e]=sa[t]})});function y1(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||sa.hasOwnProperty(t)&&sa[t]?(""+e).trim():e+"px"}function b1(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=y1(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var zM=Ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yp(t,e){if(e){if(zM[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(F(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(F(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(F(61))}if(e.style!=null&&typeof e.style!="object")throw Error(F(62))}}function bp(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vp=null;function Pg(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var kp=null,zi=null,Fi=null;function Xx(t){if(t=bl(t)){if(typeof kp!="function")throw Error(F(280));var e=t.stateNode;e&&(e=$d(e),kp(t.stateNode,t.type,e))}}function v1(t){zi?Fi?Fi.push(t):Fi=[t]:zi=t}function k1(){if(zi){var t=zi,e=Fi;if(Fi=zi=null,Xx(t),e)for(t=0;t>>=0,t===0?32:31-(YM(t)/XM|0)|0}var Kl=64,Gl=4194304;function Jo(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function du(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Jo(a):(i&=o,i!==0&&(r=Jo(i)))}else o=n&~s,o!==0?r=Jo(o):i!==0&&(r=Jo(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function xl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-En(e),t[e]=n}function tP(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=oa),oy=" ",ay=!1;function V1(t,e){switch(t){case"keyup":return MP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $1(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ni=!1;function AP(t,e){switch(t){case"compositionend":return $1(e);case"keypress":return e.which!==32?null:(ay=!0,oy);case"textInput":return t=e.data,t===oy&&ay?null:t;default:return null}}function DP(t,e){if(Ni)return t==="compositionend"||!Bg&&V1(t,e)?(t=z1(),_c=_g=Rr=null,Ni=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=dy(n)}}function K1(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?K1(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function G1(){for(var t=window,e=au();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=au(t.document)}return e}function zg(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function VP(t){var e=G1(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&K1(n.ownerDocument.documentElement,n)){if(r!==null&&zg(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=hy(n,i);var o=hy(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ci=null,Ep=null,la=null,Tp=!1;function fy(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Tp||Ci==null||Ci!==au(r)||(r=Ci,"selectionStart"in r&&zg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),la&&Fa(la,r)||(la=r,r=pu(Ep,"onSelect"),0Ti||(t.current=Rp[Ti],Rp[Ti]=null,Ti--)}function ye(t,e){Ti++,Rp[Ti]=t.current,t.current=e}var rs={},gt=us(rs),Dt=us(!1),qs=rs;function Gi(t,e){var n=t.type.contextTypes;if(!n)return rs;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Lt(t){return t=t.childContextTypes,t!=null}function gu(){ke(Dt),ke(gt)}function vy(t,e,n){if(gt.current!==rs)throw Error(F(168));ye(gt,e),ye(Dt,n)}function nS(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(F(108,IM(t)||"Unknown",s));return Ee({},n,r)}function xu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||rs,qs=gt.current,ye(gt,t),ye(Dt,Dt.current),!0}function ky(t,e,n){var r=t.stateNode;if(!r)throw Error(F(169));n?(t=nS(t,e,qs),r.__reactInternalMemoizedMergedChildContext=t,ke(Dt),ke(gt),ye(gt,t)):ke(Dt),ye(Dt,n)}var nr=null,Hd=!1,Jh=!1;function rS(t){nr===null?nr=[t]:nr.push(t)}function QP(t){Hd=!0,rS(t)}function ds(){if(!Jh&&nr!==null){Jh=!0;var t=0,e=pe;try{var n=nr;for(pe=1;t>=o,s-=o,rr=1<<32-En(e)+s|n<N?(T=S,S=null):T=S.sibling;var E=p(b,S,k[N],w);if(E===null){S===null&&(S=T);break}t&&S&&E.alternate===null&&e(b,S),g=i(E,g,N),j===null?C=E:j.sibling=E,j=E,S=T}if(N===k.length)return n(b,S),Se&&ks(b,N),C;if(S===null){for(;NN?(T=S,S=null):T=S.sibling;var D=p(b,S,E.value,w);if(D===null){S===null&&(S=T);break}t&&S&&D.alternate===null&&e(b,S),g=i(D,g,N),j===null?C=D:j.sibling=D,j=D,S=T}if(E.done)return n(b,S),Se&&ks(b,N),C;if(S===null){for(;!E.done;N++,E=k.next())E=h(b,E.value,w),E!==null&&(g=i(E,g,N),j===null?C=E:j.sibling=E,j=E);return Se&&ks(b,N),C}for(S=r(b,S);!E.done;N++,E=k.next())E=f(S,b,N,E.value,w),E!==null&&(t&&E.alternate!==null&&S.delete(E.key===null?N:E.key),g=i(E,g,N),j===null?C=E:j.sibling=E,j=E);return t&&S.forEach(function(P){return e(b,P)}),Se&&ks(b,N),C}function y(b,g,k,w){if(typeof k=="object"&&k!==null&&k.type===Si&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Hl:e:{for(var C=k.key,j=g;j!==null;){if(j.key===C){if(C=k.type,C===Si){if(j.tag===7){n(b,j.sibling),g=s(j,k.props.children),g.return=b,b=g;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Cr&&Ny(C)===j.type){n(b,j.sibling),g=s(j,k.props),g.ref=Ro(b,j,k),g.return=b,b=g;break e}n(b,j);break}else e(b,j);j=j.sibling}k.type===Si?(g=Bs(k.props.children,b.mode,w,k.key),g.return=b,b=g):(w=Hc(k.type,k.key,k.props,null,b.mode,w),w.ref=Ro(b,g,k),w.return=b,b=w)}return o(b);case wi:e:{for(j=k.key;g!==null;){if(g.key===j)if(g.tag===4&&g.stateNode.containerInfo===k.containerInfo&&g.stateNode.implementation===k.implementation){n(b,g.sibling),g=s(g,k.children||[]),g.return=b,b=g;break e}else{n(b,g);break}else e(b,g);g=g.sibling}g=rf(k,b.mode,w),g.return=b,b=g}return o(b);case Cr:return j=k._init,y(b,g,j(k._payload),w)}if(qo(k))return m(b,g,k,w);if(Mo(k))return x(b,g,k,w);ec(b,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,g!==null&&g.tag===6?(n(b,g.sibling),g=s(g,k),g.return=b,b=g):(n(b,g),g=nf(k,b.mode,w),g.return=b,b=g),o(b)):n(b,g)}return y}var Ji=aS(!0),lS=aS(!1),vu=us(null),ku=null,Ai=null,Hg=null;function Wg(){Hg=Ai=ku=null}function Ug(t){var e=vu.current;ke(vu),t._currentValue=e}function Op(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function $i(t,e){ku=t,Hg=Ai=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(At=!0),t.firstContext=null)}function cn(t){var e=t._currentValue;if(Hg!==t)if(t={context:t,memoizedValue:e,next:null},Ai===null){if(ku===null)throw Error(F(308));Ai=t,ku.dependencies={lanes:0,firstContext:t}}else Ai=Ai.next=t;return e}var Es=null;function Kg(t){Es===null?Es=[t]:Es.push(t)}function cS(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,Kg(e)):(n.next=s.next,s.next=n),e.interleaved=n,pr(t,r)}function pr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var jr=!1;function Gg(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uS(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function lr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ur(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ce&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,pr(t,n)}return s=r.interleaved,s===null?(e.next=e,Kg(r)):(e.next=s.next,s.next=e),r.interleaved=e,pr(t,n)}function Oc(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Dg(t,n)}}function Cy(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function wu(t,e,n,r){var s=t.updateQueue;jr=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(i!==null){var h=s.baseState;o=0,d=u=l=null,a=i;do{var p=a.lane,f=a.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var m=t,x=a;switch(p=e,f=n,x.tag){case 1:if(m=x.payload,typeof m=="function"){h=m.call(f,h,p);break e}h=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=x.payload,p=typeof m=="function"?m.call(f,h,p):m,p==null)break e;h=Ee({},h,p);break e;case 2:jr=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=s.effects,p===null?s.effects=[a]:p.push(a))}else f={eventTime:f,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=f,l=h):d=d.next=f,o|=p;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;p=a,a=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Xs|=o,t.lanes=o,t.memoizedState=h}}function jy(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Xh.transition;Xh.transition={};try{t(!1),e()}finally{pe=n,Xh.transition=r}}function ES(){return un().memoizedState}function rA(t,e,n){var r=Gr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},TS(t))MS(e,n);else if(n=cS(t,e,n,r),n!==null){var s=Nt();Tn(n,t,r,s),PS(n,e,r)}}function sA(t,e,n){var r=Gr(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(TS(t))MS(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,An(a,o)){var l=e.interleaved;l===null?(s.next=s,Kg(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}n=cS(t,e,s,r),n!==null&&(s=Nt(),Tn(n,t,r,s),PS(n,e,r))}}function TS(t){var e=t.alternate;return t===Ce||e!==null&&e===Ce}function MS(t,e){ca=Nu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function PS(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Dg(t,n)}}var Cu={readContext:cn,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useInsertionEffect:dt,useLayoutEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useMutableSource:dt,useSyncExternalStore:dt,useId:dt,unstable_isNewReconciler:!1},iA={readContext:cn,useCallback:function(t,e){return _n().memoizedState=[t,e===void 0?null:e],t},useContext:cn,useEffect:Ty,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,zc(4194308,4,wS.bind(null,e,t),n)},useLayoutEffect:function(t,e){return zc(4194308,4,t,e)},useInsertionEffect:function(t,e){return zc(4,2,t,e)},useMemo:function(t,e){var n=_n();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=_n();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=rA.bind(null,Ce,t),[r.memoizedState,t]},useRef:function(t){var e=_n();return t={current:t},e.memoizedState=t},useState:Ey,useDebugValue:t0,useDeferredValue:function(t){return _n().memoizedState=t},useTransition:function(){var t=Ey(!1),e=t[0];return t=nA.bind(null,t[1]),_n().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Ce,s=_n();if(Se){if(n===void 0)throw Error(F(407));n=n()}else{if(n=e(),Xe===null)throw Error(F(349));Ys&30||pS(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,Ty(gS.bind(null,r,i,t),[t]),r.flags|=2048,qa(9,mS.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=_n(),e=Xe.identifierPrefix;if(Se){var n=sr,r=rr;n=(r&~(1<<32-En(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ka++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Vn]=e,t[Ha]=r,FS(t,e,!1,!1),e.stateNode=t;e:{switch(o=bp(n,r),n){case"dialog":be("cancel",t),be("close",t),s=r;break;case"iframe":case"object":case"embed":be("load",t),s=r;break;case"video":case"audio":for(s=0;sZi&&(e.flags|=128,r=!0,_o(i,!1),e.lanes=4194304)}else{if(!r)if(t=Su(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),_o(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Se)return ht(e),null}else 2*Re()-i.renderingStartTime>Zi&&n!==1073741824&&(e.flags|=128,r=!0,_o(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Re(),e.sibling=null,n=Ne.current,ye(Ne,r?n&1|2:n&1),e):(ht(e),null);case 22:case 23:return a0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Bt&1073741824&&(ht(e),e.subtreeFlags&6&&(e.flags|=8192)):ht(e),null;case 24:return null;case 25:return null}throw Error(F(156,e.tag))}function fA(t,e){switch(Vg(e),e.tag){case 1:return Lt(e.type)&&gu(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Yi(),ke(Dt),ke(gt),Yg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Jg(e),null;case 13:if(ke(Ne),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(F(340));qi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ke(Ne),null;case 4:return Yi(),null;case 10:return Ug(e.type._context),null;case 22:case 23:return a0(),null;case 24:return null;default:return null}}var nc=!1,mt=!1,pA=typeof WeakSet=="function"?WeakSet:Set,U=null;function Di(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(t,e,r)}else n.current=null}function Kp(t,e,n){try{n()}catch(r){Pe(t,e,r)}}var zy=!1;function mA(t,e){if(Mp=hu,t=G1(),zg(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,d=0,h=t,p=null;t:for(;;){for(var f;h!==n||s!==0&&h.nodeType!==3||(a=o+s),h!==i||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)p=h,h=f;for(;;){if(h===t)break t;if(p===n&&++u===s&&(a=o),p===i&&++d===r&&(l=o),(f=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pp={focusedElem:t,selectionRange:n},hu=!1,U=e;U!==null;)if(e=U,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,U=t;else for(;U!==null;){e=U;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var x=m.memoizedProps,y=m.memoizedState,b=e.stateNode,g=b.getSnapshotBeforeUpdate(e.elementType===e.type?x:kn(e.type,x),y);b.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(w){Pe(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,U=t;break}U=e.return}return m=zy,zy=!1,m}function ua(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Kp(e,n,i)}s=s.next}while(s!==r)}}function Kd(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Gp(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function HS(t){var e=t.alternate;e!==null&&(t.alternate=null,HS(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Vn],delete e[Ha],delete e[Lp],delete e[XP],delete e[ZP])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function WS(t){return t.tag===5||t.tag===3||t.tag===4}function Fy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||WS(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function qp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=mu));else if(r!==4&&(t=t.child,t!==null))for(qp(t,e,n),t=t.sibling;t!==null;)qp(t,e,n),t=t.sibling}function Jp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Jp(t,e,n),t=t.sibling;t!==null;)Jp(t,e,n),t=t.sibling}var nt=null,wn=!1;function vr(t,e,n){for(n=n.child;n!==null;)US(t,e,n),n=n.sibling}function US(t,e,n){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(Bd,n)}catch{}switch(n.tag){case 5:mt||Di(n,e);case 6:var r=nt,s=wn;nt=null,vr(t,e,n),nt=r,wn=s,nt!==null&&(wn?(t=nt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):nt.removeChild(n.stateNode));break;case 18:nt!==null&&(wn?(t=nt,n=n.stateNode,t.nodeType===8?qh(t.parentNode,n):t.nodeType===1&&qh(t,n),Ba(t)):qh(nt,n.stateNode));break;case 4:r=nt,s=wn,nt=n.stateNode.containerInfo,wn=!0,vr(t,e,n),nt=r,wn=s;break;case 0:case 11:case 14:case 15:if(!mt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Kp(n,e,o),s=s.next}while(s!==r)}vr(t,e,n);break;case 1:if(!mt&&(Di(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Pe(n,e,a)}vr(t,e,n);break;case 21:vr(t,e,n);break;case 22:n.mode&1?(mt=(r=mt)||n.memoizedState!==null,vr(t,e,n),mt=r):vr(t,e,n);break;default:vr(t,e,n)}}function Vy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new pA),e.forEach(function(r){var s=NA.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function xn(t,e){var n=e.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=Re()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*xA(r/1960))-r,10t?16:t,_r===null)var r=!1;else{if(t=_r,_r=null,Tu=0,ce&6)throw Error(F(331));var s=ce;for(ce|=4,U=t.current;U!==null;){var i=U,o=i.child;if(U.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lRe()-i0?Os(t,0):s0|=n),Rt(t,e)}function QS(t,e){e===0&&(t.mode&1?(e=Gl,Gl<<=1,!(Gl&130023424)&&(Gl=4194304)):e=1);var n=Nt();t=pr(t,e),t!==null&&(xl(t,e,n),Rt(t,n))}function SA(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),QS(t,n)}function NA(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(F(314))}r!==null&&r.delete(e),QS(t,n)}var eN;eN=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Dt.current)At=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return At=!1,dA(t,e,n);At=!!(t.flags&131072)}else At=!1,Se&&e.flags&1048576&&sS(e,bu,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Fc(t,e),t=e.pendingProps;var s=Gi(e,gt.current);$i(e,n),s=Zg(null,e,r,t,s,n);var i=Qg();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Lt(r)?(i=!0,xu(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Gg(e),s.updater=Ud,e.stateNode=s,s._reactInternals=e,zp(e,r,t,n),e=$p(null,e,r,!0,i,n)):(e.tag=0,Se&&i&&Fg(e),bt(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Fc(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=jA(r),t=kn(r,t),s){case 0:e=Vp(null,e,r,t,n);break e;case 1:e=Iy(null,e,r,t,n);break e;case 11:e=Ry(null,e,r,t,n);break e;case 14:e=_y(null,e,r,kn(r.type,t),n);break e}throw Error(F(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:kn(r,s),Vp(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:kn(r,s),Iy(t,e,r,s,n);case 3:e:{if(OS(e),t===null)throw Error(F(387));r=e.pendingProps,i=e.memoizedState,s=i.element,uS(t,e),wu(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Xi(Error(F(423)),e),e=Oy(t,e,r,n,s);break e}else if(r!==s){s=Xi(Error(F(424)),e),e=Oy(t,e,r,n,s);break e}else for(Ft=Wr(e.stateNode.containerInfo.firstChild),Vt=e,Se=!0,Sn=null,n=lS(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(qi(),r===s){e=mr(t,e,n);break e}bt(t,e,r,n)}e=e.child}return e;case 5:return dS(e),t===null&&Ip(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Ap(r,s)?o=null:i!==null&&Ap(r,i)&&(e.flags|=32),IS(t,e),bt(t,e,o,n),e.child;case 6:return t===null&&Ip(e),null;case 13:return BS(t,e,n);case 4:return qg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ji(e,null,r,n):bt(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:kn(r,s),Ry(t,e,r,s,n);case 7:return bt(t,e,e.pendingProps,n),e.child;case 8:return bt(t,e,e.pendingProps.children,n),e.child;case 12:return bt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,ye(vu,r._currentValue),r._currentValue=o,i!==null)if(An(i.value,o)){if(i.children===s.children&&!Dt.current){e=mr(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=lr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Op(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(F(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Op(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}bt(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,$i(e,n),s=cn(s),r=r(s),e.flags|=1,bt(t,e,r,n),e.child;case 14:return r=e.type,s=kn(r,e.pendingProps),s=kn(r.type,s),_y(t,e,r,s,n);case 15:return RS(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:kn(r,s),Fc(t,e),e.tag=1,Lt(r)?(t=!0,xu(e)):t=!1,$i(e,n),AS(e,r,s),zp(e,r,s,n),$p(null,e,r,!0,t,n);case 19:return zS(t,e,n);case 22:return _S(t,e,n)}throw Error(F(156,e.tag))};function tN(t,e){return T1(t,e)}function CA(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(t,e,n,r){return new CA(t,e,n,r)}function c0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function jA(t){if(typeof t=="function")return c0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Tg)return 11;if(t===Mg)return 14}return 2}function qr(t,e){var n=t.alternate;return n===null?(n=rn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Hc(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")c0(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Si:return Bs(n.children,s,i,e);case Eg:o=8,s|=8;break;case cp:return t=rn(12,n,e,s|2),t.elementType=cp,t.lanes=i,t;case up:return t=rn(13,n,e,s),t.elementType=up,t.lanes=i,t;case dp:return t=rn(19,n,e,s),t.elementType=dp,t.lanes=i,t;case d1:return qd(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case c1:o=10;break e;case u1:o=9;break e;case Tg:o=11;break e;case Mg:o=14;break e;case Cr:o=16,r=null;break e}throw Error(F(130,t==null?t:typeof t,""))}return e=rn(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Bs(t,e,n,r){return t=rn(7,t,r,e),t.lanes=n,t}function qd(t,e,n,r){return t=rn(22,t,r,e),t.elementType=d1,t.lanes=n,t.stateNode={isHidden:!1},t}function nf(t,e,n){return t=rn(6,t,null,e),t.lanes=n,t}function rf(t,e,n){return e=rn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function EA(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Oh(0),this.expirationTimes=Oh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Oh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function u0(t,e,n,r,s,i,o,a,l){return t=new EA(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=rn(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gg(i),t}function TA(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iN)}catch(t){console.error(t)}}iN(),i1.exports=Ut;var Qd=i1.exports;const LA=n1(Qd);var Jy=Qd;ap.createRoot=Jy.createRoot,ap.hydrateRoot=Jy.hydrateRoot;/**
+ * @remix-run/router v1.23.3
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function Ya(){return Ya=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function p0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function _A(){return Math.random().toString(36).substr(2,8)}function Xy(t,e){return{usr:t.state,key:t.key,idx:e}}function em(t,e,n,r){return n===void 0&&(n=null),Ya({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?vo(e):e,{state:n,key:e&&e.key||r||_A()})}function Au(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function vo(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function IA(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,a=Ir.Pop,l=null,u=d();u==null&&(u=0,o.replaceState(Ya({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){a=Ir.Pop;let y=d(),b=y==null?null:y-u;u=y,l&&l({action:a,location:x.location,delta:b})}function p(y,b){a=Ir.Push;let g=em(x.location,y,b);u=d()+1;let k=Xy(g,u),w=x.createHref(g);try{o.pushState(k,"",w)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;s.location.assign(w)}i&&l&&l({action:a,location:x.location,delta:1})}function f(y,b){a=Ir.Replace;let g=em(x.location,y,b);u=d();let k=Xy(g,u),w=x.createHref(g);o.replaceState(k,"",w),i&&l&&l({action:a,location:x.location,delta:0})}function m(y){let b=s.location.origin!=="null"?s.location.origin:s.location.href,g=typeof y=="string"?y:Au(y);return g=g.replace(/ $/,"%20"),je(b,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,b)}let x={get action(){return a},get location(){return t(s,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return s.addEventListener(Yy,h),l=y,()=>{s.removeEventListener(Yy,h),l=null}},createHref(y){return e(s,y)},createURL:m,encodeLocation(y){let b=m(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:p,replace:f,go(y){return o.go(y)}};return x}var Zy;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Zy||(Zy={}));function OA(t,e,n){return n===void 0&&(n="/"),BA(t,e,n)}function BA(t,e,n,r){let s=typeof e=="string"?vo(e):e,i=Qi(s.pathname||"/",n);if(i==null)return null;let o=oN(t);zA(o);let a=null,l=YA(i);for(let u=0;a==null&&u{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(je(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Jr([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(je(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),oN(i.children,e,d,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:KA(u,i.index),routesMeta:d})};return t.forEach((i,o)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))s(i,o);else for(let l of aN(i.path))s(i,o,l)}),e}function aN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=aN(r.join("/")),a=[];return a.push(...o.map(l=>l===""?i:[i,l].join("/"))),s&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function zA(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:GA(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const FA=/^:[\w-]+$/,VA=3,$A=2,HA=1,WA=10,UA=-2,Qy=t=>t==="*";function KA(t,e){let n=t.split("/"),r=n.length;return n.some(Qy)&&(r+=UA),e&&(r+=$A),n.filter(s=>!Qy(s)).reduce((s,i)=>s+(FA.test(i)?VA:i===""?HA:WA),r)}function GA(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function qA(t,e,n){let{routesMeta:r}=t,s={},i="/",o=[];for(let a=0;a{let{paramName:p,isOptional:f}=d;if(p==="*"){let x=a[h]||"";o=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const m=a[h];return f&&!m?u[p]=void 0:u[p]=(m||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function JA(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),p0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function YA(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return p0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function Qi(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const XA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ZA=t=>XA.test(t);function QA(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?vo(t):t,i;if(n)if(ZA(n))i=n;else{if(n.includes("//")){let o=n;n=lN(n),p0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=eb(n.substring(1),"/"):i=eb(n,e)}else i=e;return{pathname:i,search:nD(r),hash:rD(s)}}function eb(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function sf(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function eD(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function m0(t,e){let n=eD(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function g0(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=vo(t):(s=Ya({},t),je(!s.pathname||!s.pathname.includes("?"),sf("?","pathname","search",s)),je(!s.pathname||!s.pathname.includes("#"),sf("#","pathname","hash",s)),je(!s.search||!s.search.includes("#"),sf("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),h-=1;s.pathname=p.join("/")}a=h>=0?e[h]:"/"}let l=QA(s,a),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const lN=t=>t.replace(/\/\/+/g,"/"),Jr=t=>lN(t.join("/")),tD=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),nD=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function sD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const cN=["post","put","patch","delete"];new Set(cN);const iD=["get",...cN];new Set(iD);/**
+ * React Router v6.30.4
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function Xa(){return Xa=Object.assign?Object.assign.bind():function(t){for(var e=1;e{a.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let h=g0(u,JSON.parse(o),i,d.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Jr([e,h.pathname])),(d.replace?r.replace:r.push)(h,d.state,d)},[e,r,o,i,t])}const lD=v.createContext(null);function cD(t){let e=v.useContext(Kn).outlet;return e&&v.createElement(lD.Provider,{value:t},e)}function ii(){let{matches:t}=v.useContext(Kn),e=t[t.length-1];return e?e.params:{}}function nh(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=v.useContext(yr),{matches:s}=v.useContext(Kn),{pathname:i}=hn(),o=JSON.stringify(m0(s,r.v7_relativeSplatPath));return v.useMemo(()=>g0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function uD(t,e){return dD(t,e)}function dD(t,e,n,r){ko()||je(!1);let{navigator:s}=v.useContext(yr),{matches:i}=v.useContext(Kn),o=i[i.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=hn(),d;if(e){var h;let y=typeof e=="string"?vo(e):e;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||je(!1),d=y}else d=u;let p=d.pathname||"/",f=p;if(l!=="/"){let y=l.replace(/^\//,"").split("/");f="/"+p.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=OA(t,{pathname:f}),x=gD(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:Jr([l,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Jr([l,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r);return e&&x?v.createElement(th.Provider,{value:{location:Xa({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ir.Pop}},x):x}function hD(){let t=vD(),e=sD(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:s},n):null,null)}const fD=v.createElement(hD,null);class pD extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(Kn.Provider,{value:this.props.routeContext},v.createElement(dN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function mD(t){let{routeContext:e,match:n,children:r}=t,s=v.useContext(eh);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Kn.Provider,{value:e},r)}function gD(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,a=(s=n)==null?void 0:s.errors;if(a!=null){let d=o.findIndex(h=>h.route.id&&(a==null?void 0:a[h.route.id])!==void 0);d>=0||je(!1),o=o.slice(0,Math.min(o.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,p)=>{let f,m=!1,x=null,y=null;n&&(f=a&&h.route.id?a[h.route.id]:void 0,x=h.route.errorElement||fD,l&&(u<0&&p===0?(wD("route-fallback"),m=!0,y=null):u===p&&(m=!0,y=h.route.hydrateFallbackElement||null)));let b=e.concat(o.slice(0,p+1)),g=()=>{let k;return f?k=x:m?k=y:h.route.Component?k=v.createElement(h.route.Component,null):h.route.element?k=h.route.element:k=d,v.createElement(mD,{match:h,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:k})};return n&&(h.route.ErrorBoundary||h.route.errorElement||p===0)?v.createElement(pD,{location:n.location,revalidation:n.revalidation,component:x,error:f,children:g(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):g()},null)}var fN=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(fN||{}),pN=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(pN||{});function xD(t){let e=v.useContext(eh);return e||je(!1),e}function yD(t){let e=v.useContext(uN);return e||je(!1),e}function bD(t){let e=v.useContext(Kn);return e||je(!1),e}function mN(t){let e=bD(),n=e.matches[e.matches.length-1];return n.route.id||je(!1),n.route.id}function vD(){var t;let e=v.useContext(dN),n=yD(),r=mN();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function kD(){let{router:t}=xD(fN.UseNavigateStable),e=mN(pN.UseNavigateStable),n=v.useRef(!1);return hN(()=>{n.current=!0}),v.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Xa({fromRouteId:e},i)))},[t,e])}const tb={};function wD(t,e,n){tb[t]||(tb[t]=!0)}function SD(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Za(t){let{to:e,replace:n,state:r,relative:s}=t;ko()||je(!1);let{future:i,static:o}=v.useContext(yr),{matches:a}=v.useContext(Kn),{pathname:l}=hn(),u=kl(),d=g0(e,m0(a,i.v7_relativeSplatPath),l,s==="path"),h=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(h),{replace:n,state:r,relative:s}),[u,h,s,n,r]),null}function rh(t){return cD(t.context)}function se(t){je(!1)}function ND(t){let{basename:e="/",children:n=null,location:r,navigationType:s=Ir.Pop,navigator:i,static:o=!1,future:a}=t;ko()&&je(!1);let l=e.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:l,navigator:i,static:o,future:Xa({v7_relativeSplatPath:!1},a)}),[l,a,i,o]);typeof r=="string"&&(r=vo(r));let{pathname:d="/",search:h="",hash:p="",state:f=null,key:m="default"}=r,x=v.useMemo(()=>{let y=Qi(d,l);return y==null?null:{location:{pathname:y,search:h,hash:p,state:f,key:m},navigationType:s}},[l,d,h,p,f,m,s]);return x==null?null:v.createElement(yr.Provider,{value:u},v.createElement(th.Provider,{children:n,value:x}))}function CD(t){let{children:e,location:n}=t;return uD(nm(e),n)}new Promise(()=>{});function nm(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,s)=>{if(!v.isValidElement(r))return;let i=[...e,s];if(r.type===v.Fragment){n.push.apply(n,nm(r.props.children,i));return}r.type!==se&&je(!1),!r.props.index||!r.props.children||je(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=nm(r.props.children,i)),n.push(o)}),n}/**
+ * React Router DOM v6.30.4
+ *
+ * Copyright (c) Remix Software Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ *
+ * @license MIT
+ */function Du(){return Du=Object.assign?Object.assign.bind():function(t){for(var e=1;e{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function TD(t,e){let n=rm(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}const MD=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],PD=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],AD="6";try{window.__reactRouterVersion=AD}catch{}const DD=v.createContext({isTransitioning:!1}),LD="startTransition",nb=dM[LD];function RD(t){let{basename:e,children:n,future:r,window:s}=t,i=v.useRef();i.current==null&&(i.current=RA({window:s,v5Compat:!0}));let o=i.current,[a,l]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=v.useCallback(h=>{u&&nb?nb(()=>l(h)):l(h)},[l,u]);return v.useLayoutEffect(()=>o.listen(d),[o,d]),v.useEffect(()=>SD(r),[r]),v.createElement(ND,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const _D=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ID=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ne=v.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:a,target:l,to:u,preventScrollReset:d,viewTransition:h}=e,p=gN(e,MD),{basename:f}=v.useContext(yr),m,x=!1;if(typeof u=="string"&&ID.test(u)&&(m=u,_D))try{let k=new URL(window.location.href),w=u.startsWith("//")?new URL(k.protocol+u):new URL(u),C=Qi(w.pathname,f);w.origin===k.origin&&C!=null?u=C+w.search+w.hash:x=!0}catch{}let y=oD(u,{relative:s}),b=BD(u,{replace:o,state:a,target:l,preventScrollReset:d,relative:s,viewTransition:h});function g(k){r&&r(k),k.defaultPrevented||b(k)}return v.createElement("a",Du({},p,{href:m||y,onClick:x||i?r:g,ref:n,target:l}))}),xN=v.forwardRef(function(e,n){let{"aria-current":r="page",caseSensitive:s=!1,className:i="",end:o=!1,style:a,to:l,viewTransition:u,children:d}=e,h=gN(e,PD),p=nh(l,{relative:h.relative}),f=hn(),m=v.useContext(uN),{navigator:x,basename:y}=v.useContext(yr),b=m!=null&&FD(p)&&u===!0,g=x.encodeLocation?x.encodeLocation(p).pathname:p.pathname,k=f.pathname,w=m&&m.navigation&&m.navigation.location?m.navigation.location.pathname:null;s||(k=k.toLowerCase(),w=w?w.toLowerCase():null,g=g.toLowerCase()),w&&y&&(w=Qi(w,y)||w);const C=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let j=k===g||!o&&k.startsWith(g)&&k.charAt(C)==="/",S=w!=null&&(w===g||!o&&w.startsWith(g)&&w.charAt(g.length)==="/"),N={isActive:j,isPending:S,isTransitioning:b},T=j?r:void 0,E;typeof i=="function"?E=i(N):E=[i,j?"active":null,S?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let D=typeof a=="function"?a(N):a;return v.createElement(ne,Du({},h,{"aria-current":T,className:E,ref:n,style:D,to:l,viewTransition:u}),typeof d=="function"?d(N):d)});var sm;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(sm||(sm={}));var rb;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(rb||(rb={}));function OD(t){let e=v.useContext(eh);return e||je(!1),e}function BD(t,e){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:a}=e===void 0?{}:e,l=kl(),u=hn(),d=nh(t,{relative:o});return v.useCallback(h=>{if(ED(h,n)){h.preventDefault();let p=r!==void 0?r:Au(u)===Au(d);l(t,{replace:p,state:s,preventScrollReset:i,relative:o,viewTransition:a})}},[u,l,d,r,s,n,t,i,o,a])}function zD(t){let e=v.useRef(rm(t)),n=v.useRef(!1),r=hn(),s=v.useMemo(()=>TD(r.search,n.current?null:e.current),[r.search]),i=kl(),o=v.useCallback((a,l)=>{const u=rm(typeof a=="function"?a(s):a);n.current=!0,i("?"+u,l)},[i,s]);return[s,o]}function FD(t,e){e===void 0&&(e={});let n=v.useContext(DD);n==null&&je(!1);let{basename:r}=OD(sm.useViewTransitionState),s=nh(t,{relative:e.relative});if(!n.isTransitioning)return!1;let i=Qi(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Qi(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tm(s.pathname,o)!=null||tm(s.pathname,i)!=null}function VD(){const{pathname:t}=hn();return v.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})},[t]),null}const $D='a, button, [role="button"], label, select, summary, [data-cursor="hover"], .cursor-pointer',HD='input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="file"]), textarea, [contenteditable="true"]';function WD(){const t=v.useRef(null),e=v.useRef(null),n=v.useRef(null),r=v.useRef(null),s=v.useRef(null);return v.useEffect(()=>{const i=window.matchMedia("(pointer: fine)"),o=window.matchMedia("(prefers-reduced-motion: reduce)");if(!i.matches||o.matches)return;const a=t.current,l=e.current,u=n.current,d=r.current,h=s.current;if(!a||!l||!u||!d||!h)return;document.documentElement.classList.add("hifi-cursor-on");const p=-24*Math.PI/180,f=Math.cos(p),m=Math.sin(p);let x=-100,y=-100,b=0,g=2.4,k=2.4,w=16,C=6.5,j=16,S=6.5,N=!1,T,E=performance.now();const D=R=>{const _=Math.min((R-E)/1e3,.05);E=R,g+=(k-g)*Math.min(1,_*8),w+=(j-w)*Math.min(1,_*10),C+=(S-C)*Math.min(1,_*10),b+=g*_,l.style.transform=`translate3d(${x}px, ${y}px, 0)`,u.style.transform=`translate3d(${x}px, ${y}px, 0)`;const $=Math.cos(b)*w,ee=Math.sin(b)*C;d.style.transform=`translate(${$*f-ee*m}px, ${$*m+ee*f}px)`,T=requestAnimationFrame(D)},P=R=>{a.dataset.state=R;const _=R==="hover";k=_?7:2.4,j=_?23:16,S=_?9.5:6.5},O=R=>{x=R.clientX,y=R.clientY,N||(N=!0,a.dataset.hidden="false")},W=R=>{const _=R.target;_ instanceof Element&&(_.closest(HD)?P("text"):_.closest($D)?P("hover"):P("default"))},I=()=>{a.dataset.down="true",h.style.left=`${x}px`,h.style.top=`${y}px`,h.classList.remove("is-live"),h.offsetWidth,h.classList.add("is-live")},z=()=>{a.dataset.down="false"},q=()=>{N=!1,a.dataset.hidden="true"};return document.addEventListener("mousemove",O,{passive:!0}),document.addEventListener("mouseover",W,{passive:!0}),document.addEventListener("mousedown",I,{passive:!0}),document.addEventListener("mouseup",z,{passive:!0}),document.documentElement.addEventListener("mouseleave",q),window.addEventListener("blur",q),T=requestAnimationFrame(D),()=>{cancelAnimationFrame(T),document.removeEventListener("mousemove",O),document.removeEventListener("mouseover",W),document.removeEventListener("mousedown",I),document.removeEventListener("mouseup",z),document.documentElement.removeEventListener("mouseleave",q),window.removeEventListener("blur",q),document.documentElement.classList.remove("hifi-cursor-on")}},[]),c.jsxs("div",{ref:t,className:"hifi-cursor","data-state":"default","data-hidden":"true","data-down":"false","aria-hidden":"true",children:[c.jsxs("div",{ref:n,className:"hifi-cursor__orbit",children:[c.jsx("div",{className:"hifi-cursor__ring"}),c.jsx("div",{ref:r,className:"hifi-cursor__sat"})]}),c.jsx("div",{ref:e,className:"hifi-cursor__core"}),c.jsx("div",{ref:s,className:"hifi-cursor__pulse"})]})}const yN=`${"/".replace(/\/$/,"")}/api`;async function Oo(t,e={}){const n=await fetch(`${yN}${t}`,{credentials:"include",headers:e.body instanceof FormData?{}:{"Content-Type":"application/json"},...e}),r=await n.text();let s=null;if(r)try{s=JSON.parse(r)}catch{}if(!n.ok)throw new Error((s==null?void 0:s.error)||`Fehler ${n.status}`);if(s===null&&r)throw new Error("Unerwartete Server-Antwort (kein gültiges JSON)");return s}const A={get:t=>Oo(t),post:(t,e)=>Oo(t,{method:"POST",body:e instanceof FormData?e:JSON.stringify(e)}),put:(t,e)=>Oo(t,{method:"PUT",body:JSON.stringify(e)}),patch:(t,e)=>Oo(t,{method:"PATCH",body:JSON.stringify(e)}),delete:t=>Oo(t,{method:"DELETE"})};function UD({children:t}){const[e,n]=v.useState({pathname:null,needsSetup:null}),r=hn();return v.useEffect(()=>{let s=!1;return A.get("/setup/status").then(i=>{s||n({pathname:r.pathname,needsSetup:i.needs_setup})}).catch(()=>{s||n({pathname:r.pathname,needsSetup:!1})}),()=>{s=!0}},[r.pathname]),e.pathname!==r.pathname||e.needsSetup===null?c.jsx("div",{className:"min-h-screen bg-white dark:bg-neutral-950"}):e.needsSetup&&r.pathname!=="/setup"?c.jsx(Za,{to:"/setup",replace:!0}):!e.needsSetup&&r.pathname==="/setup"?c.jsx(Za,{to:"/",replace:!0}):t}const bN=v.createContext(null);function KD(){const t=new Date,e=t.getHours()+t.getMinutes()/60;return e>=6.5&&e<21?"light":"dark"}function GD({children:t}){const[e,n]=v.useState(()=>{const s=localStorage.getItem("hifi-theme");return s==="light"||s==="dark"?s:KD()});v.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),localStorage.setItem("hifi-theme",e)},[e]);const r=()=>n(s=>s==="dark"?"light":"dark");return c.jsx(bN.Provider,{value:{theme:e,toggleTheme:r},children:t})}function qD(){return v.useContext(bN)}const JD={nav:{openMenu:"Menü öffnen",closeMenu:"Menü schließen",close:"Schließen",adminPanel:"Zum Admin-Panel",vehicles:"Fahrzeuge",services:"Leistungen",gallery:"Galerie",contact:"Kontakt",whatsapp:"WhatsApp",shop:"Zum Shop"},themeToggle:{label:"Theme umschalten"},languageToggle:{label:"Sprache auswählen"},footer:{routePlan:"Route planen",contactHeading:"Kontakt",contactForm:"Kontaktformular",hoursHeading:"Öffnungszeiten",open:"Geöffnet",closed:"Geschlossen",days:{monFri:"Montag – Freitag",sat:"Samstag",sun:"Sonntag"},copyright:t=>`© ${t} HifiPlanet. Alle Angaben ohne Gewähr.`,imprint:"Impressum",privacy:"Datenschutz",terms:"AGB",cookieSettings:"Cookie-Einstellungen"},cookieConsent:{bannerText:"Wir verwenden nur technisch notwendige Cookies. Für Google Maps, YouTube-Videos und Statistik-Cookies benötigen wir zusätzlich deine Zustimmung, da dabei Daten an Google übertragen werden.",moreInfo:"Mehr dazu in unserer",privacyPolicy:"Datenschutzerklärung",settings:"Einstellungen",onlyNecessary:"Nur notwendige",acceptAll:"Alle akzeptieren",modalTitle:"Cookie-Einstellungen",modalIntro:"Lege fest, welche Kategorien du zulassen möchtest. Mehr dazu in unserer",necessaryTitle:"Notwendig",necessaryDesc:"Für den Betrieb der Website erforderlich (z. B. Login-Session, Theme- und Cookie-Einstellung). Kann nicht deaktiviert werden.",externalTitle:"Externe Medien",externalDesc:"Google Maps und YouTube-Videos. Beim Laden werden Daten (u. a. deine IP-Adresse) an Google übertragen.",analyticsTitle:"Statistik",analyticsDesc:"Google Analytics hilft uns zu verstehen, wie die Website genutzt wird. Dabei werden Daten an Google übertragen.",cancel:"Abbrechen",saveSelection:"Auswahl speichern"},maintenance:{title:"Wartungsarbeiten",defaultMessage:"Dieser Bereich wird gerade aktualisiert. Bitte schau in Kürze wieder vorbei.",login:"Anmelden"},lightbox:{close:"Schließen",previous:"Vorheriges Bild",next:"Nächstes Bild"},home:{metaTitle:"Car-Hifi Umbauten nach Maß",metaDescription:"HifiPlanet – dein Car-Hifi Spezialist in Amorbach. Marke und Modell wählen, passende Sound-Pakete entdecken und unverbindlich anfragen.",stickyCta:"Bereit für deinen Sound-Umbau?",selectVehicle:"Fahrzeug auswählen",getInTouch:"Kontakt aufnehmen",welcome:"Willkommen bei HifiPlanet",heroTitle:"Home of pure Sound",heroSubtitle:"Dein Car-Hifi Spezialist für individuelle Sound-Umbauten. Wähle dein Fahrzeug, entdecke passende Pakete und frag unverbindlich an – wir kümmern uns um den Rest.",stats:[{value:"20+",label:"Jahre Erfahrung"},{value:"Riesige",label:"3D-Druckfarm im eigenen Haus"},{value:"Eigene",label:"CNC- & Laserwerkstatt"},{value:"International",label:"anerkannter Car-Hifi-Spezialist"}],brandsHeading:"Marken, mit denen wir arbeiten",youtubeBadge:"HifiPlanet präsentiert",youtubeTitle:"Das Handwerk hinter deinem Sound",youtubeText:"Entdecke die Handwerkskunst hinter unserer Arbeit",youtubeCta:"Jetzt ansehen",heroImageAlt:"Ground Zero Subwoofer und Endstufen mit violetter Ambiente-Beleuchtung",craftImageAlt:"Individueller Subwoofer-Bau",adviceImageAlt:"Endstufen-Einbau mit Ambiente-Beleuchtung",moreImageAlt:"Hochwertige Endstufe und Subwoofer, Studioaufnahme",craftEyebrow:"Handwerk",craftTitle:"Präzisionsarbeit in jedem Detail",craftText:"Ob eigens gefertigte Subwoofer-Gehäuse, integrierte Beleuchtung oder unsichtbar verlegte Kabelwege – dank eigener CNC-, Laser- und 3D-Druck-Fertigung entstehen bei uns Lösungen, die es von der Stange nicht gibt.",adviceEyebrow:"Beratung",adviceTitle:"Von der ersten Idee bis zum letzten Schliff",adviceText:"Jedes Fahrzeug und jeder Anspruch ist anders. Deshalb beraten wir dich persönlich und unverbindlich – vom dezenten Upgrade bis zum kompromisslosen High-End-System.",insightsTitle:"Einblicke in unsere Umbauten",insightsText:"Vom unauffälligen Sound-Upgrade bis zum aufwendigen Komplettumbau – Handarbeit aus unserer Werkstatt in Amorbach.",galleryAlts:["Individueller Subwoofer-Bau mit Ground Zero Bässen","Endstufen-Einbau mit violetter Ambiente-Beleuchtung","Hochtöner- und Mitteltöner-Einbau von Focal Utopia","Sony Navigationssystem mit Apple CarPlay im Cockpit","Verbauter Hochtöner im Kofferraum","Individueller Subwoofer-Einbau mit LED-Beleuchtung im Kofferraum"],reviewsRating:"5,0 von 181 Kunden bewertet",reviewsRatingDynamic:(t,e)=>`${t.toFixed(1).replace(".",",")} von ${e} Kunden bewertet`,reviewsText:"Das sagen unsere Kunden über uns.",reviewsLink:"Alle Bewertungen auf Google ansehen →",testimonials:[{name:"Thomas K.",text:"Über YouTube auf dieses Klang-Juwel gestoßen. Beratung und Empfehlungen sind erstklassig – der Tesla-Vorführwagen hat meine Leidenschaft für guten Sound neu entfacht."},{name:"Andreas I.",text:"Sehr professionelle Beratung und Service. Obwohl ich von VAG zu Mercedes gewechselt bin, wurde alles reibungslos angepasst. Die 3-Wege-Lautsprecher und zwei Subwoofer liefern außergewöhnliche Leistung."},{name:"Thomas F.",text:"Kompletter Audi A4 B9 Umbau hat meine Erwartungen übertroffen. Von Anfang bis Ende professionell, mit tadelloser Verarbeitung und Klangqualität."},{name:"Drago G.",text:"Beeindruckt von der CNC-Arbeit, die auf YouTube gezeigt wird. Angefangen mit 3D-gedruckten Lautsprecherringen für meinen Ford Mustang – daraus wurde ein viel größeres Projekt."},{name:"Leonardo B.",text:"Toller Service und meisterhafte Handwerkskunst. Saubere Installation, Leidenschaft in jedem Detail erkennbar."},{name:"Marcel S.",text:"Unschlagbares Preis-Leistungs-Verhältnis. Das Team hat sich viel Zeit genommen, um genau die Lösung für mein Budget zu finden."},{name:"Julia W.",text:"Endlich ein Betrieb, der auch Wohnmobile ernst nimmt. Die Soundanlage in unserem Camper klingt jetzt wie im Wohnzimmer."},{name:"Kevin R.",text:"Dashcam und Alarmanlage in einem Termin sauber verbaut, keine sichtbaren Kabel. Absolute Empfehlung für alle, die Wert auf Verarbeitung legen."},{name:"Sabrina H.",text:"Mein Oldtimer hat jetzt modernen Sound, ohne dass es dem Original-Look geschadet hätte. Genau das habe ich gesucht."},{name:"Niklas P.",text:"Von der ersten Anfrage bis zum fertigen Umbau lief alles reibungslos. Ehrliche Beratung ohne Verkaufsdruck."}],moreTitle:"Mehr als nur Car-Hifi",moreText:"Neben individuellen Sound-Umbauten bieten wir CNC-Zerspanung, Lasertechnik, 3D-Druck und mehr – alles aus einer Hand in unserer eigenen Werkstatt.",moreCta:"Alle Leistungen entdecken",faqHeading:"Häufig gestellte Fragen"},vehicleSelect:{metaTitle:"Fahrzeug auswählen",metaDescription:"Wähle deine Fahrzeugmarke und dein Modell und entdecke passende Car-Hifi Sound-Pakete von HifiPlanet.",title:"Fahrzeug auswählen",intro:"Wähle zuerst deine Marke, dann dein Modell – wir zeigen dir direkt die passenden Sound-Pakete.",empty:"Es sind noch keine Marken hinterlegt."},brandPage:{metaTitleFallback:"Modell auswählen",metaDescription:t=>`Wähle dein ${t} Modell und entdecke passende Car-Hifi Sound-Pakete von HifiPlanet.`,loading:"Lädt…",breadcrumbVehicles:"Fahrzeuge",titleSuffix:"Modell wählen",empty:"Für diese Marke sind noch keine Modelle hinterlegt."},modelPage:{metaTitleFallback:"Sound-Pakete",metaTitle:(t,e)=>`${t} ${e} Sound-Pakete`,metaDescription:(t,e)=>`Car-Hifi Sound-Pakete für ${t} ${e} inkl. aktueller Preise – von HifiPlanet unverbindlich anfragen.`,loading:"Lädt…",breadcrumbVehicles:"Fahrzeuge",titleSuffix:"Sound-Pakete",empty:"Für dieses Modell sind noch keine Pakete hinterlegt.",totalPrice:"ab ca.",productLoading:"Produkt wird geladen…",requestContact:"Kontakt anfragen",featuredBadge:"Empfohlen",moreBullets:t=>t===1?"+ 1 weitere Leistung":`+ ${t} weitere Leistungen`,lessBullets:"Weniger anzeigen",wheelHint:"Mit dem Mausrad blättern"},leistungen:{metaTitle:"Leistungen",metaDescription:"Car-Hifi, Wohnmobil & Caravan, Oldtimer, CNC-Zerspanung, Lasertechnik, 3D-Druck, Alarmanlagen und Dash Cams – alles aus einer Hand bei HifiPlanet in Amorbach.",title:"Unsere Leistungen",intro:"Von individuellen Sound-Umbauten bis zur eigenen CNC- und 3D-Druck-Fertigung – alles aus einer Hand in unserer Werkstatt in Amorbach.",notListedTitle:"Dein Projekt ist nicht dabei?",notListedText:"Sprich uns einfach an – wir finden gemeinsam die passende Lösung.",contact:"Kontakt aufnehmen"},contactPage:{metaTitle:"Kontakt",metaDescription:"Kontaktiere HifiPlanet in Amorbach für dein individuelles Car-Hifi Projekt – wir beraten dich gerne unverbindlich.",title:"Kontakt aufnehmen",heroEyebrow:"Kontakt",heroTitlePre:"Sprich",heroTitleAccent:"mit",heroTitlePost:"uns.",heroSubtitle:"Ob Anlage, Einbau oder Klang-Tuning für dein Fahrzeug — schreib uns, wir melden uns schnellstmöglich zurück.",packageBoxTitle:"Deine Anfrage bezieht sich auf",formTitle:"Anfrage senden",sentTitle:"Anfrage gesendet ✓",sentText:"Danke! Wir melden uns innerhalb eines Werktags bei dir.",contextIntro:"Deine Anfrage bezieht sich auf:",contextBrand:"Marke",contextModel:"Modell",contextPackage:"Paket",contextProduct:"Produkt",packagePrice:"Paketpreis",upgrades:"Upgrades",optionalUpgrades:"Optionale Upgrades",totalWithUpgrades:"Gesamt inkl. Upgrades",nameLabel:"Name *",namePlaceholder:"Max Mustermann",emailLabel:"E-Mail *",emailPlaceholder:"max@mail.de",phoneLabel:"Telefon",phonePlaceholder:"Optional",vinLabel:"Fahrgestellnummer (FIN)",vinPlaceholder:"Optional – hilft bei der Einschätzung",messageLabel:"Nachricht",messagePlaceholder:"Erzähl uns von deinem Projekt – Fahrzeug, Wunschklang, Budget …",requiredHint:"* Pflichtfelder",sending:"Wird gesendet…",submit:"Anfrage senden",cardTitle:"HiFi Planet Amorbach",address:"Adresse",phone:"Telefon",email:"E-Mail",hours:"Öffnungszeiten",hoursWeek:"Mo–Fr: 9:00–18:00 Uhr",hoursSat:"Sa: 10:00–13:00 Uhr",hoursWeekDays:"Mo–Fr",hoursWeekTime:"9:00 – 18:00 Uhr",hoursSatDay:"Sa",hoursSatTime:"10:00 – 13:00 Uhr",directionsTitle:"Anfahrt",mapEmbedName:"Die Google-Maps-Karte",mapOpenChip:"In Maps öffnen",routePlan:"Route planen",featurePremiumTitle:"Premium Klang",featurePremiumSub:"Höchste Qualität",featureGermanyTitle:"Made in Germany",featureGermanySub:"Präzise Handarbeit",featureIndividualTitle:"Individuell",featureIndividualSub:"Maßgeschneiderte Lösungen",featureExpertsTitle:"Experten Team",featureExpertsSub:"Leidenschaft & Know-how"},galleryOverview:{metaTitle:"Bildergalerie",metaDescription:"Einblicke in unsere Car-Hifi Umbauten – nach Marke sortiert. Wähle eine Marke und entdecke die Projekte.",title:"Bildergalerie",intro:"Wähle eine Marke und entdecke unsere Umbauten im Detail.",loading:"Lädt…",empty:"Es sind noch keine Galerie-Marken hinterlegt."},galleryBrandPage:{metaTitleFallback:"Bildergalerie",metaTitle:t=>`${t} Umbauten`,metaDescription:t=>`Einblicke in unsere ${t} Car-Hifi Umbauten.`,loading:"Lädt…",breadcrumbGallery:"Galerie",titleSuffix:"Projekt wählen",empty:"Für diese Marke sind noch keine Projekte hinterlegt."},galleryProjectPage:{metaTitleFallback:"Bildergalerie",metaDescription:t=>`Fotos unseres ${t} Umbaus.`,loading:"Lädt…",breadcrumbGallery:"Galerie",empty:"Für dieses Projekt sind noch keine Fotos hinterlegt.",enlargeImage:"Bild vergrößern"}},YD={nav:{openMenu:"Open menu",closeMenu:"Close menu",close:"Close",adminPanel:"Go to admin panel",vehicles:"Vehicles",services:"Services",gallery:"Gallery",contact:"Contact",whatsapp:"WhatsApp",shop:"Visit shop"},themeToggle:{label:"Toggle theme"},languageToggle:{label:"Select language"},footer:{routePlan:"Get directions",contactHeading:"Contact",contactForm:"Contact form",hoursHeading:"Opening hours",open:"Open",closed:"Closed",days:{monFri:"Monday – Friday",sat:"Saturday",sun:"Sunday"},copyright:t=>`© ${t} HifiPlanet. All information without guarantee.`,imprint:"Legal notice",privacy:"Privacy",terms:"Terms",cookieSettings:"Cookie settings"},cookieConsent:{bannerText:"We only use technically necessary cookies. For Google Maps, YouTube videos and analytics cookies we need your additional consent, since data is transferred to Google in that case.",moreInfo:"More details in our",privacyPolicy:"privacy policy",settings:"Settings",onlyNecessary:"Necessary only",acceptAll:"Accept all",modalTitle:"Cookie settings",modalIntro:"Choose which categories you want to allow. More details in our",necessaryTitle:"Necessary",necessaryDesc:"Required to operate the website (e.g. login session, theme and cookie preference). Cannot be disabled.",externalTitle:"External media",externalDesc:"Google Maps and YouTube videos. Loading them transfers data (including your IP address) to Google.",analyticsTitle:"Analytics",analyticsDesc:"Google Analytics helps us understand how the website is used. This transfers data to Google.",cancel:"Cancel",saveSelection:"Save selection"},maintenance:{title:"Under maintenance",defaultMessage:"This area is currently being updated. Please check back shortly.",login:"Log in"},lightbox:{close:"Close",previous:"Previous image",next:"Next image"},home:{metaTitle:"Custom Car-Hifi Installations",metaDescription:"HifiPlanet – your car-hifi specialist in Amorbach, Germany. Choose your make and model, discover matching sound packages and get in touch, no obligation.",stickyCta:"Ready for your sound upgrade?",selectVehicle:"Select vehicle",getInTouch:"Get in touch",welcome:"Welcome to HifiPlanet",heroTitle:"Home of pure Sound",heroSubtitle:"Your car-hifi specialist for custom sound installations. Choose your vehicle, discover the right package and get in touch, no obligation – we take care of the rest.",stats:[{value:"20+",label:"years of experience"},{value:"Huge",label:"in-house 3D print farm"},{value:"In-house",label:"CNC & laser workshop"},{value:"International",label:"recognized car-hifi specialist"}],brandsHeading:"Brands we work with",youtubeBadge:"HifiPlanet presents",youtubeTitle:"The craft behind your sound",youtubeText:"Discover the artistry behind our work",youtubeCta:"Watch now",heroImageAlt:"Ground Zero subwoofer and amplifiers with purple ambient lighting",craftImageAlt:"Custom subwoofer build",adviceImageAlt:"Amplifier installation with ambient lighting",moreImageAlt:"High-end amplifier and subwoofer, studio shot",craftEyebrow:"Craftsmanship",craftTitle:"Precision work in every detail",craftText:"Whether custom-built subwoofer enclosures, integrated lighting or invisibly routed cabling – our own CNC, laser and 3D-printing production means we can build solutions you simply can't buy off the shelf.",adviceEyebrow:"Consultation",adviceTitle:"From the first idea to the final touch",adviceText:"Every vehicle and every requirement is different. That's why we advise you personally and without obligation – from a subtle upgrade to an uncompromising high-end system.",insightsTitle:"A look at our installations",insightsText:"From subtle sound upgrades to elaborate full installations – handcrafted in our workshop in Amorbach.",galleryAlts:["Custom subwoofer build with Ground Zero bass drivers","Amplifier installation with purple ambient lighting","Tweeter and midrange installation by Focal Utopia","Sony navigation system with Apple CarPlay in the cockpit","Installed tweeter in the trunk","Custom subwoofer installation with LED lighting in the trunk"],reviewsRating:"Rated 5.0 by 181 customers",reviewsRatingDynamic:(t,e)=>`Rated ${t.toFixed(1)} by ${e} customers`,reviewsText:"Here's what our customers say about us.",reviewsLink:"See all reviews on Google →",testimonials:[{name:"Thomas K.",text:"Found this gem through YouTube. Advice and recommendations are top-notch – the Tesla demo car reignited my passion for great sound."},{name:"Andreas I.",text:"Very professional advice and service. Even though I switched from VAG to Mercedes, everything was adapted smoothly. The 3-way speakers and two subwoofers deliver outstanding performance."},{name:"Thomas F.",text:"The complete Audi A4 B9 build exceeded my expectations. Professional from start to finish, with flawless workmanship and sound quality."},{name:"Drago G.",text:"Impressed by the CNC work shown on YouTube. Started with 3D-printed speaker rings for my Ford Mustang – it turned into a much bigger project."},{name:"Leonardo B.",text:"Great service and masterful craftsmanship. Clean installation, passion visible in every detail."},{name:"Marcel S.",text:"Unbeatable value for money. The team took a lot of time to find the exact solution for my budget."},{name:"Julia W.",text:"Finally a shop that takes motorhomes seriously too. The sound system in our camper now sounds like a living room."},{name:"Kevin R.",text:"Dash cam and alarm system installed cleanly in a single appointment, no visible cables. Highly recommended for anyone who values quality workmanship."},{name:"Sabrina H.",text:"My classic car now has modern sound without compromising the original look. Exactly what I was looking for."},{name:"Niklas P.",text:"From the first inquiry to the finished build, everything went smoothly. Honest advice with no sales pressure."}],moreTitle:"More than just car-hifi",moreText:"Besides custom sound installations, we also offer CNC machining, laser technology, 3D printing and more – all from a single source in our own workshop.",moreCta:"Discover all our services",faqHeading:"Frequently asked questions"},vehicleSelect:{metaTitle:"Select your vehicle",metaDescription:"Choose your vehicle make and model and discover matching car-hifi sound packages from HifiPlanet.",title:"Select your vehicle",intro:"Choose your make first, then your model – we'll show you the matching sound packages right away.",empty:"No brands have been added yet."},brandPage:{metaTitleFallback:"Select a model",metaDescription:t=>`Choose your ${t} model and discover matching car-hifi sound packages from HifiPlanet.`,loading:"Loading…",breadcrumbVehicles:"Vehicles",titleSuffix:"Select a model",empty:"No models have been added for this brand yet."},modelPage:{metaTitleFallback:"Sound packages",metaTitle:(t,e)=>`${t} ${e} sound packages`,metaDescription:(t,e)=>`Car-hifi sound packages for the ${t} ${e} including current prices – get in touch with HifiPlanet, no obligation.`,loading:"Loading…",breadcrumbVehicles:"Vehicles",titleSuffix:"Sound packages",empty:"No packages have been added for this model yet.",totalPrice:"from approx.",productLoading:"Loading product…",requestContact:"Request contact",featuredBadge:"Recommended",moreBullets:t=>t===1?"+ 1 more feature":`+ ${t} more features`,lessBullets:"Show less",wheelHint:"Scroll to browse"},leistungen:{metaTitle:"Services",metaDescription:"Car-hifi, motorhomes & caravans, classic cars, CNC machining, laser technology, 3D printing, alarm systems and dash cams – all from a single source at HifiPlanet in Amorbach.",title:"Our services",intro:"From custom sound installations to our own CNC and 3D-printing production – all from a single source in our workshop in Amorbach.",notListedTitle:"Don't see your project?",notListedText:"Just get in touch – we'll find the right solution together.",contact:"Get in touch"},contactPage:{metaTitle:"Contact",metaDescription:"Get in touch with HifiPlanet in Amorbach for your custom car-hifi project – we're happy to advise you, no obligation.",title:"Get in touch",heroEyebrow:"Contact",heroTitlePre:"Talk",heroTitleAccent:"to",heroTitlePost:"us.",heroSubtitle:"Whether it's a system, installation, or sound tuning for your car — write to us, we'll get back to you as soon as possible.",packageBoxTitle:"Your inquiry relates to",formTitle:"Send inquiry",sentTitle:"Inquiry sent ✓",sentText:"Thanks! We'll get back to you within one business day.",contextIntro:"Your inquiry relates to:",contextBrand:"Brand",contextModel:"Model",contextPackage:"Package",contextProduct:"Product",packagePrice:"Package price",upgrades:"Upgrades",optionalUpgrades:"Optional upgrades",totalWithUpgrades:"Total incl. upgrades",nameLabel:"Name *",namePlaceholder:"Max Mustermann",emailLabel:"Email *",emailPlaceholder:"max@mail.de",phoneLabel:"Phone",phonePlaceholder:"Optional",vinLabel:"Vehicle identification number (VIN)",vinPlaceholder:"Optional – helps us assess your vehicle",messageLabel:"Message",messagePlaceholder:"Tell us about your project – vehicle, desired sound, budget …",requiredHint:"* Required fields",sending:"Sending…",submit:"Send inquiry",cardTitle:"HiFi Planet Amorbach",address:"Address",phone:"Phone",email:"Email",hours:"Opening hours",hoursWeek:"Mon–Fri: 9:00 AM–6:00 PM",hoursSat:"Sat: 10:00 AM–1:00 PM",hoursWeekDays:"Mon–Fri",hoursWeekTime:"9:00 AM – 6:00 PM",hoursSatDay:"Sat",hoursSatTime:"10:00 AM – 1:00 PM",directionsTitle:"Directions",mapEmbedName:"The Google Maps map",mapOpenChip:"Open in Maps",routePlan:"Get directions",featurePremiumTitle:"Premium Sound",featurePremiumSub:"Highest quality",featureGermanyTitle:"Made in Germany",featureGermanySub:"Precision craftsmanship",featureIndividualTitle:"Custom-built",featureIndividualSub:"Tailored solutions",featureExpertsTitle:"Expert Team",featureExpertsSub:"Passion & know-how"},galleryOverview:{metaTitle:"Photo gallery",metaDescription:"A look at our car-hifi installations – sorted by brand. Choose a brand and explore the projects.",title:"Photo gallery",intro:"Choose a brand and explore our installations in detail.",loading:"Loading…",empty:"No gallery brands have been added yet."},galleryBrandPage:{metaTitleFallback:"Photo gallery",metaTitle:t=>`${t} installations`,metaDescription:t=>`A look at our ${t} car-hifi installations.`,loading:"Loading…",breadcrumbGallery:"Gallery",titleSuffix:"Select a project",empty:"No projects have been added for this brand yet."},galleryProjectPage:{metaTitleFallback:"Photo gallery",metaDescription:t=>`Photos of our ${t} installation.`,loading:"Loading…",breadcrumbGallery:"Gallery",empty:"No photos have been added for this project yet.",enlargeImage:"Enlarge image"}},Wc={de:JD,en:YD};function XD(){const t=localStorage.getItem("hifi-lang");return t==="de"||t==="en"?t:(navigator.language||"de").toLowerCase().startsWith("de")?"de":"en"}function im(t,e){return e.split(".").reduce((n,r)=>n==null?void 0:n[r],t)}const vN=v.createContext({language:"de",setLanguage:()=>{},toggleLanguage:()=>{},t:t=>{const e=im(Wc.de,t);return e!==void 0?e:t}});function sb({children:t}){const[e,n]=v.useState(XD);v.useEffect(()=>{document.documentElement.setAttribute("lang",e),localStorage.setItem("hifi-lang",e)},[e]);const r=()=>n(i=>i==="de"?"en":"de"),s=i=>{const o=Wc[e]||Wc.de,a=im(o,i);if(a!==void 0)return a;const l=im(Wc.de,i);return l!==void 0?l:i};return c.jsx(vN.Provider,{value:{language:e,setLanguage:n,toggleLanguage:r,t:s},children:t})}function ct(){return v.useContext(vN)}function kN({overHero:t=!1,forceDark:e=!1}){const{theme:n,toggleTheme:r}=qD(),{t:s}=ct();return c.jsx("button",{onClick:r,"aria-label":s("themeToggle.label"),className:`rounded-full p-2 transition ${t?"text-white hover:bg-white/10":e?"text-neutral-300 hover:bg-neutral-800":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:n==="dark"?c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:c.jsx("path",{d:"M12 3a1 1 0 011 1v1a1 1 0 11-2 0V4a1 1 0 011-1zm0 15a5 5 0 100-10 5 5 0 000 10zm9-6a1 1 0 010 2h-1a1 1 0 110-2h1zM4 12a1 1 0 010 2H3a1 1 0 110-2h1zm14.36-7.36a1 1 0 011.42 1.42l-.71.7a1 1 0 11-1.41-1.4l.7-.72zM5.64 18.36a1 1 0 011.41 1.41l-.7.71a1 1 0 11-1.42-1.41l.71-.71zm12.72 0l.71.7a1 1 0 11-1.41 1.42l-.71-.71a1 1 0 011.41-1.41zM6.34 5.64l-.7-.7A1 1 0 117.05 3.5l.7.71A1 1 0 016.34 5.64zM12 6a1 1 0 011-1v0a1 1 0 01-1 1zm0 12a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1z"})}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:c.jsx("path",{fillRule:"evenodd",d:"M9.53 2.25a.75.75 0 01.19.82 8.25 8.25 0 0011.03 11.03.75.75 0 011.01.99A10.5 10.5 0 1112.9 2.1a.75.75 0 011.63-.85z",clipRule:"evenodd"})})})}function vt({name:t,className:e="h-6 w-6",...n}){return t?c.jsx(hM,{name:t,className:e,...n}):null}const wN=v.createContext(null);function ZD({children:t}){const[e,n]=v.useState(null),[r,s]=v.useState(!0);v.useEffect(()=>{A.get("/auth/me").then(d=>n(d.authenticated===!1?null:d)).catch(()=>n(null)).finally(()=>s(!1))},[]);const i=async(d,h)=>{const p=await A.post("/auth/login",{username:d,password:h});return p.requires_2fa?{requires2fa:!0}:(n(p),{requires2fa:!1})},o=async d=>{const h=await A.post("/auth/verify-2fa",{code:d});n(h)},a=async()=>{await A.post("/auth/logout",{}),n(null)},l=async()=>{const d=await A.get("/auth/me");n(d.authenticated===!1?null:d)},u=d=>{var h;return!!e&&(e.is_super_admin||((h=e.permissions)==null?void 0:h.includes(d)))};return c.jsx(wN.Provider,{value:{user:e,loading:r,login:i,verifyTwoFactor:o,logout:a,refreshUser:l,hasPermission:u},children:t})}function Ln(){return v.useContext(wN)}const SN=v.createContext({phone:"09373 20 62 390",whatsapp:null,contact_email:"info@hifi-planet-amorbach.de",address_street:"Boxbrunner Str. 20a",address_zip:"63916",address_city:"Amorbach",logo_path:null,logo_dark_path:null,business_hours:null,hero_image_path:null,ga_measurement_id:null,gallery_card_text_x:0,gallery_card_text_y:100,site_font:null}),QD=SN.Provider;function hs(){return v.useContext(SN)}const Lu="/assets/logo-dark-R-ckaBhx.png",e3="https://www.audio4cars.de/",ib=t=>(t||"").replace(/[^\d+]/g,""),ob=70,t3=500;function n3({className:t}){return c.jsxs("svg",{viewBox:"0 0 3 2",className:t,"aria-hidden":"true",children:[c.jsx("rect",{width:"3",height:"0.667",y:"0",fill:"#000"}),c.jsx("rect",{width:"3",height:"0.667",y:"0.667",fill:"#D00"}),c.jsx("rect",{width:"3",height:"0.666",y:"1.334",fill:"#FFCE00"})]})}function r3({className:t}){return c.jsxs("svg",{viewBox:"0 0 60 30",className:t,"aria-hidden":"true",children:[c.jsx("clipPath",{id:"fgb-t",children:c.jsx("path",{d:"M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"})}),c.jsx("path",{d:"M0,0 v30 h60 v-30 z",fill:"#00247d"}),c.jsx("path",{d:"M0,0 L60,30 M60,0 L0,30",stroke:"#fff",strokeWidth:"6"}),c.jsx("path",{d:"M0,0 L60,30 M60,0 L0,30",clipPath:"url(#fgb-t)",stroke:"#cf142b",strokeWidth:"4"}),c.jsx("path",{d:"M30,0 v30 M0,15 h60",stroke:"#fff",strokeWidth:"10"}),c.jsx("path",{d:"M30,0 v30 M0,15 h60",stroke:"#cf142b",strokeWidth:"6"})]})}const of=[{code:"de",label:"Deutsch",Flag:n3},{code:"en",label:"English",Flag:r3}];function s3({overHero:t=!1}){const{language:e,setLanguage:n,t:r}=ct(),[s,i]=v.useState(!1),o=v.useRef(null),a=of.find(l=>l.code===e)||of[0];return v.useEffect(()=>{if(!s)return;const l=d=>{o.current&&!o.current.contains(d.target)&&i(!1)},u=d=>{d.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",l),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",u)}},[s]),c.jsxs("div",{className:"relative",ref:o,children:[c.jsxs("button",{type:"button",onClick:()=>i(l=>!l),"aria-haspopup":"listbox","aria-expanded":s,"aria-label":r("languageToggle.label"),className:`flex items-center gap-1 rounded-full p-1.5 transition ${t?"hover:bg-white/10":"hover:bg-neutral-800"}`,children:[c.jsx("span",{className:`block h-4 w-6 shrink-0 overflow-hidden rounded-[3px] ring-1 ${t?"ring-white/50":"ring-neutral-600"}`,children:c.jsx(a.Flag,{className:"h-full w-full"})}),c.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:`h-3 w-3 transition-transform ${t?"text-white/70":"text-neutral-400"} ${s?"rotate-180":""}`,children:c.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"})})]}),s&&c.jsx("div",{role:"listbox",className:"absolute right-0 z-50 mt-2 min-w-[9rem] overflow-hidden rounded-lg border border-neutral-700 bg-neutral-900 py-1 shadow-lg",children:of.map(l=>c.jsxs("button",{type:"button",role:"option","aria-selected":l.code===e,onClick:()=>{n(l.code),i(!1)},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition hover:bg-neutral-800 ${l.code===e?"font-semibold text-brand-400":"text-neutral-200"}`,children:[c.jsx("span",{className:"block h-4 w-6 shrink-0 overflow-hidden rounded-[3px] ring-1 ring-neutral-600",children:c.jsx(l.Flag,{className:"h-full w-full"})}),l.label]},l.code))})]})}function i3(){const[t,e]=v.useState(!1),[n,r]=v.useState(!1),[s,i]=v.useState(!1),{user:o}=Ln(),{phone:a,whatsapp:l,logo_dark_path:u}=hs(),{t:d}=ct(),h=l?8:7,f=hn().pathname==="/",[m,x]=v.useState(!f);v.useEffect(()=>{if(!f){x(!0);return}const w=()=>x(window.scrollY>24);return w(),window.addEventListener("scroll",w,{passive:!0}),()=>window.removeEventListener("scroll",w)},[f]);const y=f&&!m;v.useEffect(()=>{if(t){r(!0);let j;const S=requestAnimationFrame(()=>{j=requestAnimationFrame(()=>i(!0))});return()=>{cancelAnimationFrame(S),j&&cancelAnimationFrame(j)}}i(!1);const w=t3+(h-1)*ob,C=setTimeout(()=>r(!1),w);return()=>clearTimeout(C)},[t,h]);const b=()=>`transition-all duration-500 ease-out ${s?"opacity-100":"opacity-0"}`,g=w=>({transitionDelay:`${(s?w:h-1-w)*ob}ms`,transform:s?"translateY(0)":"translateY(-140px)"}),k=o&&c.jsx(ne,{to:"/admin","aria-label":d("nav.adminPanel"),title:d("nav.adminPanel"),className:`rounded-full p-2 transition ${y?"text-white hover:bg-white/10":"text-neutral-300 hover:bg-neutral-800"}`,children:c.jsx(vt,{name:"layout-dashboard",className:"h-5 w-5"})});return c.jsxs("header",{className:`sticky top-0 z-30 border-b transition-colors duration-300 ${y?"border-transparent bg-transparent":"border-neutral-800 bg-neutral-950/90 backdrop-blur"}`,children:[c.jsxs("div",{className:"mx-auto grid max-w-6xl grid-cols-[1fr_auto_1fr] items-center gap-3 px-4 py-3 sm:px-6",children:[c.jsx("div",{className:"flex items-center justify-self-start",children:c.jsx("button",{onClick:()=>e(!0),"aria-label":d("nav.openMenu"),className:`rounded-md p-2 transition ${y?"text-white hover:bg-white/10":"text-neutral-300 hover:bg-neutral-800"}`,children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-6 w-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),c.jsx(ne,{to:"/",className:"flex items-center justify-self-center rounded-lg px-2 py-1",children:c.jsx("img",{src:u||Lu,alt:"HifiPlanet",className:"h-14 w-auto sm:h-16"})}),c.jsxs("div",{className:"flex items-center justify-self-end gap-1",children:[k,!t&&c.jsx(s3,{overHero:y}),c.jsx(kN,{overHero:y,forceDark:!0})]})]}),n&&Qd.createPortal(c.jsx("div",{className:"fixed inset-0 z-[100] overflow-y-auto text-left backdrop-blur-xl",style:{background:"linear-gradient(135deg, rgba(241,245,249,0.55) 0%, rgba(227,240,207,0.55) 50%, rgba(248,250,252,0.55) 100%)"},children:c.jsxs("div",{className:"relative mx-auto flex min-h-full max-w-6xl flex-col items-start justify-center gap-5 py-24 pl-6 pr-8 sm:pl-8",children:[c.jsxs("button",{onClick:()=>e(!1),"aria-label":d("nav.closeMenu"),className:"absolute left-6 top-8 flex items-center gap-2 text-neutral-600 hover:text-brand-600 sm:left-8 sm:top-[65px]",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-6 w-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6l12 12M18 6 6 18"})}),c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:d("nav.close")})]}),c.jsx(ne,{to:"/fahrzeuge",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${b()}`,style:g(0),children:d("nav.vehicles")}),c.jsx(ne,{to:"/leistungen",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${b()}`,style:g(1),children:d("nav.services")}),c.jsx(ne,{to:"/galerie",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${b()}`,style:g(2),children:d("nav.gallery")}),c.jsx(ne,{to:"/kontakt",onClick:()=>e(!1),className:`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${b()}`,style:g(3),children:d("nav.contact")}),c.jsx("div",{className:`h-px w-16 bg-brand-500/60 ${b()}`,style:g(4)}),a&&c.jsxs("a",{href:`tel:${ib(a)}`,className:`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${b()}`,style:g(5),children:[c.jsx(vt,{name:"phone",className:"h-4 w-4"}),a]}),l&&c.jsxs("a",{href:`https://wa.me/${ib(l).replace(/^0/,"49").replace("+","")}`,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${b()}`,style:g(6),children:[c.jsx(vt,{name:"message-circle",className:"h-4 w-4"}),d("nav.whatsapp")]}),c.jsxs("a",{href:e3,target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${b()}`,style:g(l?7:6),children:[c.jsx(vt,{name:"shopping-bag",className:"h-4 w-4"}),d("nav.shop")]})]})}),document.body)]})}const ab="hifiplanet-cookie-consent",NN={necessary:!0,external:!1,analytics:!1},CN=v.createContext({consent:NN,decided:!1,settingsOpen:!1,acceptAll:()=>{},rejectNonEssential:()=>{},saveCustom:()=>{},openSettings:()=>{},closeSettings:()=>{}});function o3({children:t}){const[e,n]=v.useState(NN),[r,s]=v.useState(!1),[i,o]=v.useState(!1);v.useEffect(()=>{try{const f=localStorage.getItem(ab);if(f){const m=JSON.parse(f);n({necessary:!0,external:!!m.external,analytics:!!m.analytics}),s(!0)}}catch{}},[]);const a=v.useCallback(f=>{n(f),s(!0),o(!1),localStorage.setItem(ab,JSON.stringify({...f,decidedAt:new Date().toISOString()}))},[]),l=v.useCallback(()=>a({necessary:!0,external:!0,analytics:!0}),[a]),u=v.useCallback(()=>a({necessary:!0,external:!1,analytics:!1}),[a]),d=v.useCallback(f=>a({necessary:!0,external:!!f.external,analytics:!!f.analytics}),[a]),h=v.useCallback(()=>o(!0),[]),p=v.useCallback(()=>o(!1),[]);return c.jsx(CN.Provider,{value:{consent:e,decided:r,settingsOpen:i,acceptAll:l,rejectNonEssential:u,saveCustom:d,openSettings:h,closeSettings:p},children:t})}function wo(){return v.useContext(CN)}const a3=["mon","tue","wed","thu","fri","sat","sun"],l3=["sun","mon","tue","wed","thu","fri","sat"],af={mon:"Mo",tue:"Di",wed:"Mi",thu:"Do",fri:"Fr",sat:"Sa",sun:"So"};function c3(t){const e=new Date,n=t==null?void 0:t[l3[e.getDay()]];if(!n||n.closed||!n.open||!n.close)return!1;const r=e.getHours()*60+e.getMinutes(),[s,i]=n.open.split(":").map(Number),[o,a]=n.close.split(":").map(Number);return r>=s*60+i&&r{const s=u3(t==null?void 0:t[r])||e,i=n[n.length-1];i&&i.label===s?i.days=`${i.firstLabel}-${af[r]}`:n.push({key:r,days:af[r],firstLabel:af[r],label:s})}),n}const d3=t=>(t||"").replace(/[^\d+]/g,"");function h3(){const{phone:t,contact_email:e,address_street:n,address_zip:r,address_city:s,business_hours:i}=hs(),o=c3(i),{openSettings:a}=wo(),{pathname:l}=hn(),u=l==="/",{t:d}=ct(),h=[n,[r,s].filter(Boolean).join(" ")].filter(Boolean).join(", "),p=`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(h)}`,f=jN(i,d("footer.closed"));return c.jsxs("footer",{className:`border-t border-neutral-200 bg-neutral-50 py-10 text-sm text-neutral-600 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-300 ${u?"pb-24":""}`,children:[c.jsxs("div",{className:"mx-auto grid max-w-6xl gap-4 px-4 sm:grid-cols-3 sm:px-6",children:[c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(vt,{name:"map-pin",className:"h-4 w-4 text-brand-500"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:"HifiPlanet"})]}),n&&c.jsx("p",{children:n}),(r||s)&&c.jsx("p",{children:[r,s].filter(Boolean).join(" ")}),c.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"mt-4 flex items-center justify-center gap-1.5 rounded-md bg-brand-500 px-3 py-2 text-xs font-semibold text-white hover:bg-brand-600",children:[c.jsx(vt,{name:"navigation",className:"h-3.5 w-3.5"}),d("footer.routePlan")]})]}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[c.jsx(vt,{name:"phone",className:"h-4 w-4 text-brand-500"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:d("footer.contactHeading")})]}),c.jsx("p",{children:c.jsx("a",{href:`tel:${d3(t)}`,className:"inline-block py-1 hover:text-brand-500",children:t})}),c.jsx("p",{children:c.jsx("a",{href:`mailto:${e}`,className:"inline-block py-1 hover:text-brand-500",children:e})}),c.jsx(ne,{to:"/kontakt",className:"mt-4 flex items-center justify-center gap-1.5 rounded-md border border-neutral-300 px-3 py-2 text-xs font-semibold text-neutral-700 hover:border-brand-500 hover:text-brand-600 dark:border-neutral-700 dark:text-neutral-200",children:d("footer.contactForm")})]}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(vt,{name:"clock",className:"h-4 w-4 text-brand-500"}),c.jsx("p",{className:"font-semibold text-neutral-900 dark:text-white",children:d("footer.hoursHeading")})]}),c.jsxs("span",{className:`flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-semibold ${o?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"}`,children:[c.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${o?"bg-green-500":"bg-neutral-400"}`}),d(o?"footer.open":"footer.closed")]})]}),c.jsx("dl",{className:"space-y-1.5",children:f.map(m=>c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("dt",{className:"text-neutral-500 dark:text-neutral-400",children:m.days}),c.jsx("dd",{className:"font-medium text-neutral-700 dark:text-neutral-200",children:m.label})]},m.key))})]})]}),c.jsx("div",{className:"mx-auto mt-8 max-w-6xl border-t border-neutral-200 px-4 pt-6 text-center text-xs text-neutral-500 dark:border-neutral-800 dark:text-neutral-400 sm:px-6",children:c.jsxs("p",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[c.jsx("span",{children:d("footer.copyright")(new Date().getFullYear())}),c.jsx("span",{children:"·"}),c.jsx(ne,{to:"/impressum",className:"hover:text-brand-500",children:d("footer.imprint")}),c.jsx("span",{children:"·"}),c.jsx(ne,{to:"/datenschutz",className:"hover:text-brand-500",children:d("footer.privacy")}),c.jsx("span",{children:"·"}),c.jsx(ne,{to:"/agb",className:"hover:text-brand-500",children:d("footer.terms")}),c.jsx("span",{children:"·"}),c.jsx("button",{type:"button",onClick:a,className:"hover:text-brand-500",children:d("footer.cookieSettings")})]})})]})}const x0=v.createContext({});function ss(t){const e=v.useRef(null);return e.current===null&&(e.current=t()),e.current}const f3=typeof window<"u",wl=f3?v.useLayoutEffect:v.useEffect,sh=v.createContext(null);function y0(t,e){t.indexOf(e)===-1&&t.push(e)}function Ru(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Dn=(t,e,n)=>n>e?e:n{};const is={},EN=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),TN=t=>typeof t=="object"&&t!==null,MN=t=>/^0[^.\s]+$/u.test(t);function PN(t){let e;return()=>(e===void 0&&(e=t()),e)}const _t=t=>t,Sl=(...t)=>t.reduce((e,n)=>r=>n(e(r))),eo=(t,e,n)=>{const r=e-t;return r?(n-t)/r:1};class v0{constructor(){this.subscriptions=[]}add(e){return y0(this.subscriptions,e),()=>Ru(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;it*1e3,sn=t=>t/1e3,k0=(t,e)=>e?t*(1e3/e):0,AN=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,p3=1e-7,m3=12;function g3(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=AN(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>p3&&++ag3(i,0,1,t,n);return i=>i===0||i===1?i:AN(s(i),e,r)}const DN=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,LN=t=>e=>1-t(1-e),RN=Nl(.33,1.53,.69,.99),w0=LN(RN),_N=DN(w0),IN=t=>t>=1?1:(t*=2)<1?.5*w0(t):.5*(2-Math.pow(2,-10*(t-1))),S0=t=>1-Math.sin(Math.acos(t)),ON=LN(S0),BN=DN(S0),x3=Nl(.42,0,1,1),y3=Nl(0,0,.58,1),zN=Nl(.42,0,.58,1),b3=t=>Array.isArray(t)&&typeof t[0]!="number",FN=t=>Array.isArray(t)&&typeof t[0]=="number",v3={linear:_t,easeIn:x3,easeInOut:zN,easeOut:y3,circIn:S0,circInOut:BN,circOut:ON,backIn:w0,backInOut:_N,backOut:RN,anticipate:IN},k3=t=>typeof t=="string",lb=t=>{if(FN(t)){b0(t.length===4);const[e,n,r,s]=t;return Nl(e,n,r,s)}else if(k3(t))return v3[t];return t},ic=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function w3(t){let e=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){i.has(u)&&(l.schedule(u),t()),u(o)}const l={schedule:(u,d=!1,h=!1)=>{const f=h&&r?e:n;return d&&i.add(u),f.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(o=u,r){s=!0;return}r=!0;const d=e;e=n,n=d,e.forEach(a),e.clear(),r=!1,s&&(s=!1,l.process(u))}};return l}const S3=40;function VN(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=ic.reduce((k,w)=>(k[w]=w3(i),k),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:d,update:h,preRender:p,render:f,postRender:m}=o,x=()=>{const k=is.useManualTiming,w=k?s.timestamp:performance.now();n=!1,k||(s.delta=r?1e3/60:Math.max(Math.min(w-s.timestamp,S3),1)),s.timestamp=w,s.isProcessing=!0,a.process(s),l.process(s),u.process(s),d.process(s),h.process(s),p.process(s),f.process(s),m.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(x))},y=()=>{n=!0,r=!0,s.isProcessing||t(x)};return{schedule:ic.reduce((k,w)=>{const C=o[w];return k[w]=(j,S=!1,N=!1)=>(n||y(),C.schedule(j,S,N)),k},{}),cancel:k=>{for(let w=0;w(Uc===void 0&&kt.set(Je.isProcessing||is.useManualTiming?Je.timestamp:performance.now()),Uc),set:t=>{Uc=t,queueMicrotask(N3)}},$N=t=>e=>typeof e=="string"&&e.startsWith(t),HN=$N("--"),C3=$N("var(--"),N0=t=>C3(t)?j3.test(t.split("/*")[0].trim()):!1,j3=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function cb(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const So={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Qa={...So,transform:t=>Dn(0,1,t)},oc={...So,default:1},fa=t=>Math.round(t*1e5)/1e5,C0=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function E3(t){return t==null}const T3=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,j0=(t,e)=>n=>!!(typeof n=="string"&&T3.test(n)&&n.startsWith(t)||e&&!E3(n)&&Object.prototype.hasOwnProperty.call(n,e)),WN=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(C0);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},M3=t=>Dn(0,255,t),cf={...So,transform:t=>Math.round(M3(t))},Ms={test:j0("rgb","red"),parse:WN("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+cf.transform(t)+", "+cf.transform(e)+", "+cf.transform(n)+", "+fa(Qa.transform(r))+")"};function P3(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const om={test:j0("#"),parse:P3,transform:Ms.transform},Cl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Zn=Cl("deg"),Wn=Cl("%"),G=Cl("px"),A3=Cl("vh"),D3=Cl("vw"),ub={...Wn,parse:t=>Wn.parse(t)/100,transform:t=>Wn.transform(t*100)},Ri={test:j0("hsl","hue"),parse:WN("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Wn.transform(fa(e))+", "+Wn.transform(fa(n))+", "+fa(Qa.transform(r))+")"},Oe={test:t=>Ms.test(t)||om.test(t)||Ri.test(t),parse:t=>Ms.test(t)?Ms.parse(t):Ri.test(t)?Ri.parse(t):om.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ms.transform(t):Ri.transform(t),getAnimatableNone:t=>{const e=Oe.parse(t);return e.alpha=0,Oe.transform(e)}},L3=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function R3(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(C0))==null?void 0:e.length)||0)+(((n=t.match(L3))==null?void 0:n.length)||0)>0}const UN="number",KN="color",_3="var",I3="var(",db="${}",O3=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function to(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(O3,l=>(Oe.test(l)?(r.color.push(i),s.push(KN),n.push(Oe.parse(l))):l.startsWith(I3)?(r.var.push(i),s.push(_3),n.push(l)):(r.number.push(i),s.push(UN),n.push(parseFloat(l))),++i,db)).split(db);return{values:n,split:a,indexes:r,types:s}}function B3(t){return to(t).values}function GN({split:t,types:e}){const n=t.length;return r=>{let s="";for(let i=0;itypeof t=="number"?0:Oe.test(t)?Oe.getAnimatableNone(t):t,V3=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:F3(t);function $3(t){const e=to(t);return GN(e)(e.values.map((r,s)=>V3(r,e.split[s])))}const Mn={test:R3,parse:B3,createTransformer:z3,getAnimatableNone:$3};function uf(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function H3({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=uf(l,a,t+1/3),i=uf(l,a,t),o=uf(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function _u(t,e){return n=>n>0?e:t}const ge=(t,e,n)=>t+(e-t)*n,df=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},W3=[om,Ms,Ri],U3=t=>W3.find(e=>e.test(t));function hb(t){const e=U3(t);if(!e)return!1;let n=e.parse(t);return e===Ri&&(n=H3(n)),n}const fb=(t,e)=>{const n=hb(t),r=hb(e);if(!n||!r)return _u(t,e);const s={...n};return i=>(s.red=df(n.red,r.red,i),s.green=df(n.green,r.green,i),s.blue=df(n.blue,r.blue,i),s.alpha=ge(n.alpha,r.alpha,i),Ms.transform(s))},am=new Set(["none","hidden"]);function K3(t,e){return am.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function G3(t,e){return n=>ge(t,e,n)}function E0(t){return typeof t=="number"?G3:typeof t=="string"?N0(t)?_u:Oe.test(t)?fb:Y3:Array.isArray(t)?qN:typeof t=="object"?Oe.test(t)?fb:q3:_u}function qN(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>E0(i)(i,e[o]));return i=>{for(let o=0;o{for(const i in r)n[i]=r[i](s);return n}}function J3(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s{const n=Mn.createTransformer(e),r=to(t),s=to(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?am.has(t)&&!s.values.length||am.has(e)&&!r.values.length?K3(t,e):Sl(qN(J3(r,s),s.values),n):_u(t,e)};function JN(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ge(t,e,n):E0(t)(t,e)}const X3=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>le.update(e,n),stop:()=>dn(e),now:()=>Je.isProcessing?Je.timestamp:kt.now()}},YN=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i=Iu?1/0:e}function Z3(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(T0(r),Iu);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:sn(s)}}const Me={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function lm(t,e){return t*Math.sqrt(1-e*e)}const Q3=12;function e4(t,e,n){let r=n;for(let s=1;s{const d=u*o,h=d*t,p=d-n,f=lm(u,o),m=Math.exp(-h);return hf-p/f*m},i=u=>{const h=u*o*t,p=h*n+n,f=Math.pow(o,2)*Math.pow(u,2)*t,m=Math.exp(-h),x=lm(Math.pow(u,2),o);return(-s(u)+hf>0?-1:1)*((p-f)*m)/x}):(s=u=>{const d=Math.exp(-u*t),h=(u-n)*t+1;return-hf+d*h},i=u=>{const d=Math.exp(-u*t),h=(n-u)*(t*t);return d*h});const a=5/t,l=e4(s,i,a);if(t=$t(t),isNaN(l))return{stiffness:Me.stiffness,damping:Me.damping,duration:t};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:t}}}const n4=["duration","bounce"],r4=["stiffness","damping","mass"];function pb(t,e){return e.some(n=>t[n]!==void 0)}function s4(t){let e={velocity:Me.velocity,stiffness:Me.stiffness,damping:Me.damping,mass:Me.mass,isResolvedFromDuration:!1,...t};if(!pb(t,r4)&&pb(t,n4))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Dn(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Me.mass,stiffness:s,damping:i}}else{const n=t4({...t,velocity:0});e={...e,...n,mass:Me.mass},e.isResolvedFromDuration=!0}return e}function Ou(t=Me.visualDuration,e=Me.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:u,mass:d,duration:h,velocity:p,isResolvedFromDuration:f}=s4({...n,velocity:-sn(n.velocity||0)}),m=p||0,x=u/(2*Math.sqrt(l*d)),y=o-i,b=sn(Math.sqrt(l/d)),g=Math.abs(y)<5;r||(r=g?Me.restSpeed.granular:Me.restSpeed.default),s||(s=g?Me.restDelta.granular:Me.restDelta.default);let k,w,C,j,S,N;if(x<1)C=lm(b,x),j=(m+x*b*y)/C,k=E=>{const D=Math.exp(-x*b*E);return o-D*(j*Math.sin(C*E)+y*Math.cos(C*E))},S=x*b*j+y*C,N=x*b*y-j*C,w=E=>Math.exp(-x*b*E)*(S*Math.sin(C*E)+N*Math.cos(C*E));else if(x===1){k=D=>o-Math.exp(-b*D)*(y+(m+b*y)*D);const E=m+b*y;w=D=>Math.exp(-b*D)*(b*E*D-m)}else{const E=b*Math.sqrt(x*x-1);k=W=>{const I=Math.exp(-x*b*W),z=Math.min(E*W,300);return o-I*((m+x*b*y)*Math.sinh(z)+E*y*Math.cosh(z))/E};const D=(m+x*b*y)/E,P=x*b*D-y*E,O=x*b*y-D*E;w=W=>{const I=Math.exp(-x*b*W),z=Math.min(E*W,300);return I*(P*Math.sinh(z)+O*Math.cosh(z))}}const T={calculatedDuration:f&&h||null,velocity:E=>$t(w(E)),next:E=>{if(!f&&x<1){const P=Math.exp(-x*b*E),O=Math.sin(C*E),W=Math.cos(C*E),I=o-P*(j*O+y*W),z=$t(P*(S*O+N*W));return a.done=Math.abs(z)<=r&&Math.abs(o-I)<=s,a.value=a.done?o:I,a}const D=k(E);if(f)a.done=E>=h;else{const P=$t(w(E));a.done=Math.abs(P)<=r&&Math.abs(o-D)<=s}return a.value=a.done?o:D,a},toString:()=>{const E=Math.min(T0(T),Iu),D=YN(P=>T.next(E*P).value,E,30);return E+"ms "+D},toTransition:()=>{}};return T}Ou.applyToOptions=t=>{const e=Z3(t,100,Ou);return t.ease=e.ease,t.duration=$t(e.duration),t.type="keyframes",t};const i4=5;function XN(t,e,n){const r=Math.max(e-i4,0);return k0(n-t(r),e-r)}function cm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:d}){const h=t[0],p={done:!1,value:h},f=N=>a!==void 0&&Nl,m=N=>a===void 0?l:l===void 0||Math.abs(a-N)-x*Math.exp(-N/r),k=N=>b+g(N),w=N=>{const T=g(N),E=k(N);p.done=Math.abs(T)<=u,p.value=p.done?b:E};let C,j;const S=N=>{f(p.value)&&(C=N,j=Ou({keyframes:[p.value,m(p.value)],velocity:XN(k,N,p.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return S(0),{calculatedDuration:null,next:N=>{let T=!1;return!j&&C===void 0&&(T=!0,w(N),S(N)),C!==void 0&&N>=C?j.next(N-C):(!T&&w(N),p)}}}function o4(t,e,n){const r=[],s=n||is.mix||JN,i=t.length-1;for(let o=0;oe[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=o4(e,r,s),l=a.length,u=d=>{if(o&&d1)for(;hu(Dn(t[0],t[i-1],d)):u}function a4(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=eo(0,e,r);t.push(ge(n,1,s))}}function ZN(t){const e=[0];return a4(e,t.length-1),e}function l4(t,e){return t.map(n=>n*e)}function c4(t,e){return t.map(()=>e||zN).splice(0,t.length-1)}function pa({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=b3(r)?r.map(lb):lb(r),i={done:!1,value:e[0]},o=l4(n&&n.length===e.length?n:ZN(e),t),a=M0(o,e,{ease:Array.isArray(s)?s:c4(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const u4=t=>t!==null;function ih(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(u4),a=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!a||r===void 0?i[a]:r}const d4={decay:cm,inertia:cm,tween:pa,keyframes:pa,spring:Ou};function QN(t){typeof t.type=="string"&&(t.type=d4[t.type])}class P0{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const h4=t=>t/100;class el extends P0{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==kt.now()&&this.tick(kt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;QN(e);const{type:n=pa,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:a}=e;const l=n||pa;l!==pa&&typeof a[0]!="number"&&(this.mixKeyframes=Sl(h4,JN(a[0],a[1])),a=[0,100]);const u=l({...e,keyframes:a});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=T0(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:d,repeat:h,repeatType:p,repeatDelay:f,type:m,onUpdate:x,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-u*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?b<0:b>s;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let k=this.currentTime,w=r;if(h){const N=Math.min(this.currentTime,s)/a;let T=Math.floor(N),E=N%1;!E&&N>=1&&(E=1),E===1&&T--,T=Math.min(T,h+1),!!(T%2)&&(p==="reverse"?(E=1-E,f&&(E-=f/a)):p==="mirror"&&(w=o)),k=Dn(0,1,E)*a}let C;g?(this.delayState.value=d[0],C=this.delayState):C=w.next(k),i&&!g&&(C.value=i(C.value));let{done:j}=C;!g&&l!==null&&(j=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&j);return S&&m!==cm&&(C.value=ih(d,this.options,y,this.speed)),x&&x(C.value),S&&this.finish(),C}then(e,n){return this.finished.then(e,n)}get duration(){return sn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+sn(e)}get time(){return sn(this.currentTime)}set time(e){e=$t(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return XN(r=>this.generator.next(r).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(kt.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=sn(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=X3,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(kt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function f4(t){for(let e=1;et*180/Math.PI,um=t=>{const e=Ps(Math.atan2(t[1],t[0]));return dm(e)},p4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:um,rotateZ:um,skewX:t=>Ps(Math.atan(t[1])),skewY:t=>Ps(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},dm=t=>(t=t%360,t<0&&(t+=360),t),mb=um,gb=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),xb=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),m4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:gb,scaleY:xb,scale:t=>(gb(t)+xb(t))/2,rotateX:t=>dm(Ps(Math.atan2(t[6],t[5]))),rotateY:t=>dm(Ps(Math.atan2(-t[2],t[0]))),rotateZ:mb,rotate:mb,skewX:t=>Ps(Math.atan(t[4])),skewY:t=>Ps(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function hm(t){return t.includes("scale")?1:0}function fm(t,e){if(!t||t==="none")return hm(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=m4,s=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=p4,s=a}if(!s)return hm(e);const i=r[e],o=s[1].split(",").map(x4);return typeof i=="function"?i(o):o[i]}const g4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return fm(n,e)};function x4(t){return parseFloat(t.trim())}const No=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Co=new Set([...No,"pathRotation"]),yb=t=>t===So||t===G,y4=new Set(["x","y","z"]),b4=No.filter(t=>!y4.has(t));function v4(t){const e=[];return b4.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Or={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:r})=>{const s=t.max-t.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:r})=>{const s=t.max-t.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>fm(e,"x"),y:(t,{transform:e})=>fm(e,"y")};Or.translateX=Or.x;Or.translateY=Or.y;const zs=new Set;let pm=!1,mm=!1,gm=!1;function eC(){if(mm){const t=Array.from(zs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=v4(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))==null||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}mm=!1,pm=!1,zs.forEach(t=>t.complete(gm)),zs.clear()}function tC(){zs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(mm=!0)})}function k4(){gm=!0,tC(),eC(),gm=!1}class A0{constructor(e,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(zs.add(this),pm||(pm=!0,le.read(tC),le.resolveKeyframes(eC))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const a=r.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}f4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),zs.delete(this)}cancel(){this.state==="scheduled"&&(zs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const w4=t=>t.startsWith("--");function nC(t,e,n){w4(e)?t.style.setProperty(e,n):t.style[e]=n}const S4={};function D0(t,e){const n=PN(t);return()=>S4[e]??n()}const L0=D0(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),rC=D0(()=>window.ViewTimeline!==void 0,"viewTimeline"),sC=D0(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Xo=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,bb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Xo([0,.65,.55,1]),circOut:Xo([.55,0,1,.45]),backIn:Xo([.31,.01,.66,-.59]),backOut:Xo([.33,1.53,.69,.99])};function iC(t,e){if(t)return typeof t=="function"?sC()?YN(t,e):"ease-out":FN(t)?Xo(t):Array.isArray(t)?t.map(n=>iC(n,e)||bb.easeOut):bb[t]}function N4(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},u=void 0){const d={[e]:n};l&&(d.offset=l);const h=iC(a,s);Array.isArray(h)&&(d.easing=h);const p={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),t.animate(d,p)}function oC(t){return typeof t=="function"&&"applyToOptions"in t}function C4({type:t,...e}){return oC(t)&&sC()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class aC extends P0{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,b0(typeof e.type!="string");const u=C4(e);this.animation=N4(n,r,s,u,i),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=ih(s,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(d),nC(n,r,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const e=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return sn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+sn(e)}get time(){return sn(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=$t(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:r,observe:s}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&L0()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),_t):s(this)}}const lC={anticipate:IN,backInOut:_N,circInOut:BN};function j4(t){return t in lC}function E4(t){typeof t.ease=="string"&&j4(t.ease)&&(t.ease=lC[t.ease])}const ff=10;class T4 extends aC{constructor(e){E4(e),QN(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new el({...o,autoplay:!1}),l=Math.max(ff,kt.now()-this.startTime),u=Dn(0,ff,l-ff),d=a.sample(l).value,{name:h}=this.options;i&&h&&nC(i,h,d),n.setWithVelocity(a.sample(Math.max(0,l-u)).value,d,u),a.stop()}}const vb=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Mn.test(t)||t==="0")&&!t.startsWith("url("));function M4(t){const e=t[0];if(t.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function _4(t){var h;const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:o,keyframes:a}=t;if(!(((h=e==null?void 0:e.owner)==null?void 0:h.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=e.owner.getProps();return R4()&&n&&(cC.has(n)||L4.has(n)&&D4(a))&&(n!=="transform"||!d)&&!u&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const I4=40;class O4 extends P0{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:a,name:l,motionValue:u,element:d,...h}){var m;super(),this.stop=()=>{var x,y;this._animation&&(this._animation.stop(),(x=this.stopTimeline)==null||x.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=kt.now();const p={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:l,motionValue:u,element:d,...h},f=(d==null?void 0:d.KeyframeResolver)||A0;this.keyframeResolver=new f(a,(x,y,b)=>this.onKeyframesResolved(x,y,p,!b),l,u,d),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(e,n,r,s){var b,g;this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:l,isHandoff:u,onUpdate:d}=r;this.resolvedAt=kt.now();let h=!0;P4(e,i,o,a)||(h=!1,(is.instantAnimations||!l)&&(d==null||d(ih(e,r,n))),e[0]=e[e.length-1],xm(r),r.repeat=0);const f={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>I4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},m=h&&!u&&_4(f),x=(g=(b=f.motionValue)==null?void 0:b.owner)==null?void 0:g.current;let y;if(m)try{y=new T4({...f,element:x})}catch{y=new el(f)}else y=new el(f);y.finished.then(()=>{this.notifyFinished()}).catch(_t),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),k4()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function uC(t,e,n,r=0,s=1){const i=Array.from(t).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=t.size,a=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:a-i*r}const kb=30,B4=t=>!isNaN(parseFloat(t)),ma={current:void 0};class z4{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=kt.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=kt.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=B4(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new v0);const r=this.events[e].add(n);return e==="change"?()=>{r(),le.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return ma.current&&ma.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=kt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>kb)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,kb);return k0(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Cn(t,e){return new z4(t,e)}function dC(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function R0(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?dC(n,t):n}const F4={type:"spring",stiffness:500,damping:25,restSpeed:10},V4=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),$4={type:"keyframes",duration:.8},H4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},W4=(t,{keyframes:e})=>e.length>2?$4:Co.has(t)?t.startsWith("scale")?V4(e[1]):F4:H4,U4=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function K4(t){for(const e in t)if(!U4.has(e))return!0;return!1}const _0=(t,e,n,r={},s,i)=>o=>{const a=R0(r,t)||{},l=a.delay||r.delay||0;let{elapsed:u=0}=r;u=u-$t(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:p=>{e.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};K4(a)||Object.assign(d,W4(t,d)),d.duration&&(d.duration=$t(d.duration)),d.repeatDelay&&(d.repeatDelay=$t(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(xm(d),d.delay===0&&(h=!0)),(is.instantAnimations||is.skipAnimations||s!=null&&s.shouldSkipAnimations||a.skipAnimations)&&(h=!0,xm(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,h&&!i&&e.get()!==void 0){const p=ih(d.keyframes,a);if(p!==void 0){le.update(()=>{d.onUpdate(p),d.onComplete()});return}}return a.isSync?new el(d):new O4(d)},G4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function q4(t){const e=G4.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function hC(t,e,n=1){const[r,s]=q4(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return EN(o)?parseFloat(o):o}return N0(s)?hC(s,e,n+1):s}function wb(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function I0(t,e,n,r){if(typeof e=="function"){const[s,i]=wb(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=wb(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function Fs(t,e,n){const r=t.getProps();return I0(r,e,n!==void 0?n:r.custom,t)}const fC=new Set(["width","height","top","left","right","bottom",...No]),ym=t=>Array.isArray(t);function J4(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Cn(n))}function Y4(t){return ym(t)?t[t.length-1]||0:t}function X4(t,e){const n=Fs(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=Y4(i[o]);J4(t,o,a)}}const Ue=t=>!!(t&&t.getVelocity);function Z4(t){return!!(Ue(t)&&t.add)}function bm(t,e){const n=t.getValue("willChange");if(Z4(n))return n.add(e);if(!n&&is.WillChange){const r=new is.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function O0(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const Q4="framerAppearId",pC="data-"+O0(Q4);function mC(t){return t.props[pC]}function eL({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function gC(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...a}=e;const l=t.getDefaultTransition();i=i?dC(i,l):l;const u=i==null?void 0:i.reduceMotion,d=i==null?void 0:i.skipAnimations;r&&(i=r);const h=[],p=s&&t.animationState&&t.animationState.getState()[s],f=i==null?void 0:i.path;f&&f.animateVisualElement(t,a,i,n,h);for(const m in a){const x=t.getValue(m,t.latestValues[m]??null),y=a[m];if(y===void 0||p&&eL(p,m))continue;const b={delay:n,...R0(i||{},m)};d&&(b.skipAnimations=!0);const g=x.get();if(g!==void 0&&!x.isAnimating()&&!Array.isArray(y)&&y===g&&!b.velocity){le.update(()=>x.set(y));continue}let k=!1;if(window.MotionHandoffAnimation){const j=mC(t);if(j){const S=window.MotionHandoffAnimation(j,m,le);S!==null&&(b.startTime=S,k=!0)}}bm(t,m);const w=u??t.shouldReduceMotion;x.start(_0(m,x,y,w&&fC.has(m)?{type:!1}:b,t,k));const C=x.animation;C&&h.push(C)}if(o){const m=()=>le.update(()=>{o&&X4(t,o)});h.length?Promise.all(h).then(m):m()}return h}function vm(t,e,n={}){var l;const r=Fs(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(gC(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=s;return tL(t,e,u,d,h,p,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[u,d]=a==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function tL(t,e,n=0,r=0,s=0,i=1,o){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(vm(l,e,{...o,delay:n+(typeof r=="function"?0:r)+uC(t.variantChildren,l,r,s,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function nL(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>vm(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=vm(t,e,n);else{const s=typeof e=="function"?Fs(t,e,n.custom):e;r=Promise.all(gC(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const rL={test:t=>t==="auto",parse:t=>t},xC=t=>e=>e.test(t),yC=[So,G,Wn,Zn,D3,A3,rL],Sb=t=>yC.find(xC(t));function sL(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||MN(t):!0}const iL=new Set(["brightness","contrast","saturate","opacity"]);function oL(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(C0)||[];if(!r)return t;const s=n.replace(r,"");let i=iL.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const aL=/\b([a-z-]*)\(.*?\)/gu,km={...Mn,getAnimatableNone:t=>{const e=t.match(aL);return e?e.map(oL).join(" "):t}},wm={...Mn,getAnimatableNone:t=>{const e=Mn.parse(t);return Mn.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Nb={...So,transform:Math.round},lL={rotate:Zn,pathRotation:Zn,rotateX:Zn,rotateY:Zn,rotateZ:Zn,scale:oc,scaleX:oc,scaleY:oc,scaleZ:oc,skew:Zn,skewX:Zn,skewY:Zn,distance:G,translateX:G,translateY:G,translateZ:G,x:G,y:G,z:G,perspective:G,transformPerspective:G,opacity:Qa,originX:ub,originY:ub,originZ:G},Bu={borderWidth:G,borderTopWidth:G,borderRightWidth:G,borderBottomWidth:G,borderLeftWidth:G,borderRadius:G,borderTopLeftRadius:G,borderTopRightRadius:G,borderBottomRightRadius:G,borderBottomLeftRadius:G,width:G,maxWidth:G,height:G,maxHeight:G,top:G,right:G,bottom:G,left:G,inset:G,insetBlock:G,insetBlockStart:G,insetBlockEnd:G,insetInline:G,insetInlineStart:G,insetInlineEnd:G,padding:G,paddingTop:G,paddingRight:G,paddingBottom:G,paddingLeft:G,paddingBlock:G,paddingBlockStart:G,paddingBlockEnd:G,paddingInline:G,paddingInlineStart:G,paddingInlineEnd:G,margin:G,marginTop:G,marginRight:G,marginBottom:G,marginLeft:G,marginBlock:G,marginBlockStart:G,marginBlockEnd:G,marginInline:G,marginInlineStart:G,marginInlineEnd:G,fontSize:G,backgroundPositionX:G,backgroundPositionY:G,...lL,zIndex:Nb,fillOpacity:Qa,strokeOpacity:Qa,numOctaves:Nb},cL={...Bu,color:Oe,backgroundColor:Oe,outlineColor:Oe,fill:Oe,stroke:Oe,borderColor:Oe,borderTopColor:Oe,borderRightColor:Oe,borderBottomColor:Oe,borderLeftColor:Oe,filter:km,WebkitFilter:km,mask:wm,WebkitMask:wm},bC=t=>cL[t],uL=new Set([km,wm]);function vC(t,e){let n=bC(t);return uL.has(n)||(n=Mn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const dL=new Set(["auto","none","0"]);function hL(t,e,n){let r=0,s;for(;r{e.getValue(l).set(u)}),this.resolveNoneKeyframes()}}const B0=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function kC(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(r=>r!=null)}const Sm=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function ga(t){return TN(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:no,cancel:wC}=VN(queueMicrotask,!1),vn={x:!1,y:!1};function SC(){return vn.x||vn.y}function pL(t){return t==="x"||t==="y"?vn[t]?null:(vn[t]=!0,()=>{vn[t]=!1}):vn.x||vn.y?null:(vn.x=vn.y=!0,()=>{vn.x=vn.y=!1})}function NC(t,e){const n=kC(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function mL(t){return!(t.pointerType==="touch"||SC())}function gL(t,e,n={}){const[r,s,i]=NC(t,n);return r.forEach(o=>{let a=!1,l=!1,u;const d=()=>{o.removeEventListener("pointerleave",m)},h=y=>{u&&(u(y),u=void 0),d()},p=y=>{a=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),l&&(l=!1,h(y))},f=()=>{a=!0,window.addEventListener("pointerup",p,s),window.addEventListener("pointercancel",p,s)},m=y=>{if(y.pointerType!=="touch"){if(a){l=!0;return}h(y)}},x=y=>{if(!mL(y))return;l=!1;const b=e(o,y);typeof b=="function"&&(u=b,o.addEventListener("pointerleave",m,s))};o.addEventListener("pointerenter",x,s),o.addEventListener("pointerdown",f,s)}),i}const CC=(t,e)=>e?t===e?!0:CC(t,e.parentElement):!1,z0=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,xL=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function yL(t){return xL.has(t.tagName)||t.isContentEditable===!0}const bL=new Set(["INPUT","SELECT","TEXTAREA"]);function vL(t){return bL.has(t.tagName)||t.isContentEditable===!0}const Kc=new WeakSet;function Cb(t){return e=>{e.key==="Enter"&&t(e)}}function pf(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const kL=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Cb(()=>{if(Kc.has(n))return;pf(n,"down");const s=Cb(()=>{pf(n,"up")}),i=()=>pf(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function jb(t){return z0(t)&&!SC()}const Eb=new WeakSet;function wL(t,e,n={}){const[r,s,i]=NC(t,n),o=a=>{const l=a.currentTarget;if(!jb(a)||Eb.has(a))return;Kc.add(l),n.stopPropagation&&Eb.add(a);const u=e(l,a),d={...s,capture:!0},h=(m,x)=>{window.removeEventListener("pointerup",p,d),window.removeEventListener("pointercancel",f,d),Kc.has(l)&&Kc.delete(l),jb(m)&&typeof u=="function"&&u(m,{success:x})},p=m=>{h(m,l===window||l===document||n.useGlobalTarget||CC(l,m.target))},f=m=>{h(m,!1)};window.addEventListener("pointerup",p,d),window.addEventListener("pointercancel",f,d)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),ga(a)&&(a.addEventListener("focus",u=>kL(u,s)),!yL(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}function F0(t){return TN(t)&&"ownerSVGElement"in t}const Gc=new WeakMap;let Sr;const jC=(t,e,n)=>(r,s)=>s&&s[0]?s[0][t+"Size"]:F0(r)&&"getBBox"in r?r.getBBox()[e]:r[n],SL=jC("inline","width","offsetWidth"),NL=jC("block","height","offsetHeight");function CL({target:t,borderBoxSize:e}){var n;(n=Gc.get(t))==null||n.forEach(r=>{r(t,{get width(){return SL(t,e)},get height(){return NL(t,e)}})})}function jL(t){t.forEach(CL)}function EL(){typeof ResizeObserver>"u"||(Sr=new ResizeObserver(jL))}function TL(t,e){Sr||EL();const n=kC(t);return n.forEach(r=>{let s=Gc.get(r);s||(s=new Set,Gc.set(r,s)),s.add(e),Sr==null||Sr.observe(r)}),()=>{n.forEach(r=>{const s=Gc.get(r);s==null||s.delete(e),s!=null&&s.size||Sr==null||Sr.unobserve(r)})}}const qc=new Set;let _i;function ML(){_i=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};qc.forEach(e=>e(t))},window.addEventListener("resize",_i)}function PL(t){return qc.add(t),_i||ML(),()=>{qc.delete(t),!qc.size&&typeof _i=="function"&&(window.removeEventListener("resize",_i),_i=void 0)}}function Nm(t,e){return typeof t=="function"?PL(t):TL(t,e)}function EC(t,e){let n;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;n!==o&&t(o),n=o};return le.preUpdate(r,!0),()=>dn(r)}function AL(t){return F0(t)&&t.tagName==="svg"}function DL(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],s=t[1+n],i=t[2+n],o=t[3+n],a=M0(s,i,o);return e?a(r):a}function LL(t,e,n={}){const r=t.get();let s=null,i=r,o;const a=typeof r=="string"?r.replace(/[\d.-]/g,""):void 0,l=()=>{s&&(s.stop(),s=null),t.animation=void 0},u=()=>{const h=Tb(t.get()),p=Tb(i);if(h===p){l();return}const f=s?s.getGeneratorVelocity():t.getVelocity();l(),s=new el({keyframes:[h,p],velocity:f,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:o})},d=()=>{var h;u(),t.animation=s??void 0,(h=t.events.animationStart)==null||h.notify(),s==null||s.then(()=>{var p;t.animation=void 0,(p=t.events.animationComplete)==null||p.notify()})};if(t.attach((h,p)=>{i=h,o=f=>p(mf(f,a)),le.postRender(d)},l),Ue(e)){let h=n.skipInitialAnimation===!0;const p=e.on("change",m=>{h?(h=!1,t.jump(mf(m,a),!1)):t.set(mf(m,a))}),f=t.on("destroy",p);return()=>{p(),f()}}return l}function mf(t,e){return e?t+e:t}function Tb(t){return typeof t=="number"?t:parseFloat(t)}const RL=[...yC,Oe,Mn],_L=t=>RL.find(xC(t)),Mb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ii=()=>({x:Mb(),y:Mb()}),Pb=()=>({min:0,max:0}),$e=()=>({x:Pb(),y:Pb()}),IL=new WeakMap;function oh(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function tl(t){return typeof t=="string"||Array.isArray(t)}const V0=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$0=["initial",...V0];function ah(t){return oh(t.animate)||$0.some(e=>tl(t[e]))}function TC(t){return!!(ah(t)||t.variants)}function OL(t,e,n){for(const r in e){const s=e[r],i=n[r];if(Ue(s))t.addValue(r,s);else if(Ue(i))t.addValue(r,Cn(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,Cn(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Cm={current:null},MC={current:!1},BL=typeof window<"u";function zL(){if(MC.current=!0,!!BL)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Cm.current=t.matches;t.addEventListener("change",e),e()}else Cm.current=!1}const Ab=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let zu={};function PC(t){zu=t}function FL(){return zu}class VL{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=A0,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=kt.now();this.renderScheduledAtthis.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(MC.current||zL(),this.shouldReduceMotion=Cm.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),dn(this.notifyUpdate),dn(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&cC.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:u,duration:d}=n.accelerate,h=new aC({element:this.current,name:e,keyframes:a,times:l,ease:u,duration:$t(d)}),p=o(h);this.valueSubscriptions.set(e,()=>{p(),h.cancel()});return}const r=Co.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&le.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in zu){const n=zu[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):$e()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Cn(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(EN(r)||MN(r))?r=parseFloat(r):!_L(r)&&Mn.test(n)&&(r=vC(e,n)),this.setBaseTarget(e,Ue(r)?r.get():r)),Ue(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=I0(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Ue(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new v0),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){no.render(this.render)}}class AC extends VL{constructor(){super(...arguments),this.KeyframeResolver=fL}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ue(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class fs{constructor(e){this.isMounted=!1,this.node=e}update(){}}function DC({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function $L({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function HL(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function gf(t){return t===void 0||t===1}function jm({scale:t,scaleX:e,scaleY:n}){return!gf(t)||!gf(e)||!gf(n)}function Ss(t){return jm(t)||LC(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function LC(t){return Db(t.x)||Db(t.y)}function Db(t){return t&&t!=="0%"}function Fu(t,e,n){const r=t-n,s=e*r;return n+s}function Lb(t,e,n,r,s){return s!==void 0&&(t=Fu(t,s,r)),Fu(t,n,r)+e}function Em(t,e=0,n=1,r,s){t.min=Lb(t.min,e,n,r,s),t.max=Lb(t.max,e,n,r,s)}function RC(t,{x:e,y:n}){Em(t.x,e.translate,e.scale,e.originPoint),Em(t.y,n.translate,n.scale,n.originPoint)}const Rb=.999999999999,_b=1.0000000000001;function WL(t,e,n,r=!1){var a;const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;lRb&&(e.x=1),e.y<_b&&e.y>Rb&&(e.y=1)}function Fn(t,e){t.min+=e,t.max+=e}function Ib(t,e,n,r,s=.5){const i=ge(t.min,t.max,s);Em(t,e,n,i,r)}function Ob(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function Jc(t,e,n){const r=n??t;Ib(t.x,Ob(e.x,r.x),e.scaleX,e.scale,e.originX),Ib(t.y,Ob(e.y,r.y),e.scaleY,e.scale,e.originY)}function _C(t,e){return DC(HL(t.getBoundingClientRect(),e))}function UL(t,e,n){const r=_C(t,n),{scroll:s}=e;return s&&(Fn(r.x,s.offset.x),Fn(r.y,s.offset.y)),r}const KL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},GL=No.length;function qL(t,e,n){let r="",s=!0;for(let o=0;o{if(!e.target)return t;if(typeof t=="string")if(G.test(t))t=parseFloat(t);else return t;const n=Bb(t,e.target.x),r=Bb(t,e.target.y);return`${n}% ${r}%`}},JL={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Mn.parse(t);if(s.length>5)return r;const i=Mn.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const u=ge(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=u),typeof s[3+o]=="number"&&(s[3+o]/=u),i(s)}},Tm={borderRadius:{...Bo,applyTo:[...B0]},borderTopLeftRadius:Bo,borderTopRightRadius:Bo,borderBottomLeftRadius:Bo,borderBottomRightRadius:Bo,boxShadow:JL};function OC(t,{layout:e,layoutId:n}){return Co.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Tm[t]||t==="opacity")}function W0(t,e,n){var o;const r=t.style,s=e==null?void 0:e.style,i={};if(!r)return i;for(const a in r)(Ue(r[a])||s&&Ue(s[a])||OC(a,t)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(i[a]=r[a]);return i}function YL(t){return window.getComputedStyle(t)}class XL extends AC{constructor(){super(...arguments),this.type="html",this.renderInstance=IC}readValueFromInstance(e,n){var r;if(Co.has(n))return(r=this.projection)!=null&&r.isProjecting?hm(n):g4(e,n);{const s=YL(e),i=(HN(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return _C(e,n)}build(e,n,r){H0(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return W0(e,n,r)}}const ZL={offset:"stroke-dashoffset",array:"stroke-dasharray"},QL={offset:"strokeDashoffset",array:"strokeDasharray"};function eR(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?ZL:QL;t[i.offset]=`${-r}`,t[i.array]=`${e} ${n}`}const tR=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function BC(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...a},l,u,d){if(H0(t,a,u),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p}=t;h.transform&&(p.transform=h.transform,delete h.transform),(p.transform||h.transformOrigin)&&(p.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),p.transform&&(p.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox);for(const f of tR)h[f]!==void 0&&(p[f]=h[f],delete h[f]);e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&eR(h,s,i,o,!1)}const zC=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),FC=t=>typeof t=="string"&&t.toLowerCase()==="svg";function nR(t,e,n,r){IC(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(zC.has(s)?s:O0(s),e.attrs[s])}function VC(t,e,n){const r=W0(t,e,n);for(const s in t)if(Ue(t[s])||Ue(e[s])){const i=No.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}class rR extends AC{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=$e}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Co.has(n)){const r=bC(n);return r&&r.default||0}return n=zC.has(n)?n:O0(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return VC(e,n,r)}build(e,n,r){BC(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){nR(e,n,r,s)}mount(e){this.isSVGTag=FC(e.tagName),super.mount(e)}}const sR=$0.length;function $C(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?$C(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;nPromise.all(e.map(({animation:n,options:r})=>nL(t,n,r)))}function lR(t){let e=aR(t),n=zb(),r=!0,s=!1;const i=u=>(d,h)=>{var f;const p=Fs(t,h,u==="exit"?(f=t.presenceContext)==null?void 0:f.custom:void 0);if(p){const{transition:m,transitionEnd:x,...y}=p;d={...d,...y,...x}}return d};function o(u){e=u(t)}function a(u){const{props:d}=t,h=$C(t.parent)||{},p=[],f=new Set;let m={},x=1/0;for(let b=0;bx&&C,E=!1;const D=Array.isArray(w)?w:[w];let P=D.reduce(i(g),{});j===!1&&(P={});const{prevResolvedValues:O={}}=k,W={...O,...P},I=R=>{T=!0,f.has(R)&&(E=!0,f.delete(R)),k.needsAnimating[R]=!0;const _=t.getValue(R);_&&(_.liveStyle=!1)};for(const R in W){const _=P[R],$=O[R];if(m.hasOwnProperty(R))continue;let ee=!1;ym(_)&&ym($)?ee=!HC(_,$)||N:ee=_!==$,ee?_!=null?I(R):f.add(R):_!==void 0&&f.has(R)?I(R):k.protectedKeys[R]=!0}k.prevProp=w,k.prevResolvedValues=P,k.isActive&&(m={...m,...P}),(r||s)&&t.blockInitialAnimation&&(T=!1);const z=S&&N;T&&(!z||E)&&p.push(...D.map(R=>{const _={type:g};if(typeof R=="string"&&(r||s)&&!z&&t.manuallyAnimateOnMount&&t.parent){const{parent:$}=t,ee=Fs($,R);if($.enteringChildren&&ee){const{delayChildren:te}=ee.transition||{};_.delay=uC($.enteringChildren,t,te)}}return{animation:R,options:_}}))}if(f.size){const b={};if(typeof d.initial!="boolean"){const g=Fs(t,Array.isArray(d.initial)?d.initial[0]:d.initial);g&&g.transition&&(b.transition=g.transition)}f.forEach(g=>{const k=t.getBaseTarget(g),w=t.getValue(g);w&&(w.liveStyle=!0),b[g]=k??null}),p.push({animation:b})}let y=!!p.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(y=!1),r=!1,s=!1,y?e(p):Promise.resolve()}function l(u,d){var p;if(n[u].isActive===d)return Promise.resolve();(p=t.variantChildren)==null||p.forEach(f=>{var m;return(m=f.animationState)==null?void 0:m.setActive(u,d)}),n[u].isActive=d;const h=a(u);for(const f in n)n[f].protectedKeys={};return h}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=zb(),s=!0}}}function cR(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!HC(e,t):!1}function bs(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function zb(){return{animate:bs(!0),whileInView:bs(),whileHover:bs(),whileTap:bs(),whileDrag:bs(),whileFocus:bs(),exit:bs()}}function Mm(t,e){t.min=e.min,t.max=e.max}function yn(t,e){Mm(t.x,e.x),Mm(t.y,e.y)}function Fb(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const WC=1e-4,uR=1-WC,dR=1+WC,UC=.01,hR=0-UC,fR=0+UC;function wt(t){return t.max-t.min}function pR(t,e,n){return Math.abs(t-e)<=n}function Vb(t,e,n,r=.5){t.origin=r,t.originPoint=ge(e.min,e.max,t.origin),t.scale=wt(n)/wt(e),t.translate=ge(n.min,n.max,t.origin)-t.originPoint,(t.scale>=uR&&t.scale<=dR||isNaN(t.scale))&&(t.scale=1),(t.translate>=hR&&t.translate<=fR||isNaN(t.translate))&&(t.translate=0)}function xa(t,e,n,r){Vb(t.x,e.x,n.x,r?r.originX:void 0),Vb(t.y,e.y,n.y,r?r.originY:void 0)}function $b(t,e,n,r=0){const s=r?ge(n.min,n.max,r):n.min;t.min=s+e.min,t.max=t.min+wt(e)}function mR(t,e,n,r){$b(t.x,e.x,n.x,r==null?void 0:r.x),$b(t.y,e.y,n.y,r==null?void 0:r.y)}function Hb(t,e,n,r=0){const s=r?ge(n.min,n.max,r):n.min;t.min=e.min-s,t.max=t.min+wt(e)}function Vu(t,e,n,r){Hb(t.x,e.x,n.x,r==null?void 0:r.x),Hb(t.y,e.y,n.y,r==null?void 0:r.y)}function Wb(t,e,n,r,s){return t-=e,t=Fu(t,1/n,r),s!==void 0&&(t=Fu(t,1/s,r)),t}function gR(t,e=0,n=1,r=.5,s,i=t,o=t){if(Wn.test(e)&&(e=parseFloat(e),e=ge(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=ge(i.min,i.max,r);t===i&&(a-=e),t.min=Wb(t.min,e,n,a,s),t.max=Wb(t.max,e,n,a,s)}function Ub(t,e,[n,r,s],i,o){gR(t,e[n],e[r],e[s],e.scale,i,o)}const xR=["x","scaleX","originX"],yR=["y","scaleY","originY"];function Kb(t,e,n,r){Ub(t.x,e,xR,n?n.x:void 0,r?r.x:void 0),Ub(t.y,e,yR,n?n.y:void 0,r?r.y:void 0)}function Gb(t){return t.translate===0&&t.scale===1}function KC(t){return Gb(t.x)&&Gb(t.y)}function qb(t,e){return t.min===e.min&&t.max===e.max}function bR(t,e){return qb(t.x,e.x)&&qb(t.y,e.y)}function Jb(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function GC(t,e){return Jb(t.x,e.x)&&Jb(t.y,e.y)}function Yb(t){return wt(t.x)/wt(t.y)}function Xb(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function In(t){return[t("x"),t("y")]}function vR(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:d,pathRotation:h,rotateX:p,rotateY:f,skewX:m,skewY:x}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotate(${h}deg) `),p&&(r+=`rotateX(${p}deg) `),f&&(r+=`rotateY(${f}deg) `),m&&(r+=`skewX(${m}deg) `),x&&(r+=`skewY(${x}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const kR=B0.length,Zb=t=>typeof t=="string"?parseFloat(t):t,Qb=t=>typeof t=="number"||G.test(t);function wR(t,e,n,r,s,i){s?(t.opacity=ge(0,n.opacity??1,SR(r)),t.opacityExit=ge(e.opacity??1,0,NR(r))):i&&(t.opacity=ge(e.opacity??1,n.opacity??1,r));for(let o=0;ore?1:n(eo(t,e,r))}function CR(t,e,n){const r=Ue(t)?t:Cn(t);return r.start(_0("",r,e,n)),r.animation}function nl(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}const jR=(t,e)=>t.depth-e.depth;class ER{constructor(){this.children=[],this.isDirty=!1}add(e){y0(this.children,e),this.isDirty=!0}remove(e){Ru(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(jR),this.isDirty=!1,this.children.forEach(e)}}function TR(t,e){const n=kt.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(dn(r),t(i-e))};return le.setup(r,!0),()=>dn(r)}function Yc(t){return Ue(t)?t.get():t}class MR{constructor(){this.members=[]}add(e){y0(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(Ru(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Ru(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){var n;for(let r=this.members.indexOf(e)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(e,n){var s;const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:o}=e.options;(i===void 0||i!==o)&&(e.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),(s=e.root)!=null&&s.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var n,r,s,i,o;(r=(n=e.options).onExitComplete)==null||r.call(n),(o=(s=e.resumingFrom)==null?void 0:(i=s.options).onExitComplete)==null||o.call(i)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const Xc={hasAnimatedSinceResize:!0,hasEverUpdated:!1},xf=["","X","Y","Z"],PR=1e3;let AR=0;function yf(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function JC(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=mC(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",le,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&JC(r)}function YC({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=AR++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(RR),this.nodes.forEach(FR),this.nodes.forEach(VR),this.nodes.forEach(_R)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;le.read(()=>{h=window.innerWidth}),t(o,()=>{const f=window.innerWidth;f!==h&&(h=f,this.root.updateBlockedByResize=!0,d&&d(),d=TR(p,250),Xc.hasAnimatedSinceResize&&(Xc.hasAnimatedSinceResize=!1,this.nodes.forEach(rv)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:p,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||KR,{onLayoutAnimationStart:x,onLayoutAnimationComplete:y}=u.getProps(),b=!this.targetLayout||!GC(this.targetLayout,f),g=!h&&p;if(this.options.layoutRoot||this.resumeFrom||g||h&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...R0(m,"layout"),onPlay:x,onComplete:y};(u.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(d,g,k.path)}else h||rv(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),dn(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach($R),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&JC(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!wt(this.snapshot.measuredBox.x)&&!wt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=j/1e3,N=C==null?void 0:C(S);N?(p.x.translate=N.x,p.x.scale=ge(o.x.scale,1,S),p.x.origin=o.x.origin,p.x.originPoint=o.x.originPoint,p.y.translate=N.y,p.y.scale=ge(o.y.scale,1,S),p.y.origin=o.y.origin,p.y.originPoint=o.y.originPoint):(sv(p.x,o.x,S),sv(p.y,o.y,S)),this.setTargetDelta(p),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vu(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),WR(this.relativeTarget,this.relativeTargetOrigin,f,S),w&&bR(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=$e()),yn(w,this.relativeTarget)),y&&(this.animationValues=h,wR(h,d,this.latestValues,S,k,g)),N&&N.rotate!==void 0&&(this.animationValues||(this.animationValues=h),this.animationValues.pathRotation=N.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,u;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(u=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||u.stop(),this.pendingAnimation&&(dn(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=le.update(()=>{Xc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Cn(0)),this.motionValue.jump(0,!1),this.currentAnimation=CR(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(PR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:d}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&XC(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||$e();const h=wt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const p=wt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+p}yn(a,l),Jc(a,d),xa(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new MR),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&yf("z",o,u,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(tv),this.root.sharedNodes.clear()}}}function DR(t){t.updateLayout()}function LR(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;if(i==="size")In(h=>{const p=o?e.measuredBox[h]:e.layoutBox[h],f=wt(p);p.min=r[h].min,p.max=p.min+f});else if(i==="x"||i==="y"){const h=i==="x"?"y":"x";Mm(o?e.measuredBox[h]:e.layoutBox[h],r[h])}else XC(i,e.layoutBox,r)&&In(h=>{const p=o?e.measuredBox[h]:e.layoutBox[h],f=wt(r[h]);p.max=p.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+f)});const a=Ii();xa(a,r,e.layoutBox);const l=Ii();o?xa(l,t.applyTransform(s,!0),e.measuredBox):xa(l,r,e.layoutBox);const u=!KC(a);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:f}=h;if(p&&f){const m=t.options.layoutAnchor||void 0,x=$e();Vu(x,e.layoutBox,p.layoutBox,m);const y=$e();Vu(y,r,f.layoutBox,m),GC(x,y)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=y,t.relativeTargetOrigin=x,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function RR(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function _R(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function IR(t){t.clearSnapshot()}function tv(t){t.clearMeasurements()}function OR(t){t.isLayoutDirty=!0,t.updateLayout()}function nv(t){t.isLayoutDirty=!1}function BR(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function zR(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function rv(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function FR(t){t.resolveTargetDelta()}function VR(t){t.calcProjection()}function $R(t){t.resetSkewAndRotation()}function HR(t){t.removeLeadSnapshot()}function sv(t,e,n){t.translate=ge(e.translate,0,n),t.scale=ge(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function iv(t,e,n,r){t.min=ge(e.min,n.min,r),t.max=ge(e.max,n.max,r)}function WR(t,e,n,r){iv(t.x,e.x,n.x,r),iv(t.y,e.y,n.y,r)}function UR(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const KR={duration:.45,ease:[.4,0,.1,1]},ov=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),av=ov("applewebkit/")&&!ov("chrome/")?Math.round:_t;function lv(t){t.min=av(t.min),t.max=av(t.max)}function GR(t){lv(t.x),lv(t.y)}function XC(t,e,n){return t==="position"||t==="preserve-aspect"&&!pR(Yb(e),Yb(n),.2)}function qR(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const JR=YC({attachResizeListener:(t,e)=>nl(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),bf={current:void 0},ZC=YC({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!bf.current){const t=new JR({});t.mount(window),t.setOptions({layoutScroll:!0}),bf.current=t}return bf.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),jl=v.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function cv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function YR(...t){return e=>{let n=!1;const r=t.map(s=>{const i=cv(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s{const{width:f,height:m,top:x,left:y,right:b,bottom:g,direction:k}=l.current;if(e||i===!1||!a.current||!f||!m)return;const w=k==="rtl",C=n==="left"?w?`right: ${b}`:`left: ${y}`:w?`left: ${y}`:`right: ${b}`,j=r==="bottom"?`bottom: ${g}`:`top: ${x}`;a.current.dataset.motionPopId=o;const S=document.createElement("style");u&&(S.nonce=u);const N=s??document.head;return N.appendChild(S),S.sheet&&S.sheet.insertRule(`
+ [data-motion-pop-id="${o}"] {
+ position: absolute !important;
+ width: ${f}px !important;
+ height: ${m}px !important;
+ ${C}px !important;
+ ${j}px !important;
+ }
+ `),()=>{var T;(T=a.current)==null||T.removeAttribute("data-motion-pop-id"),N.contains(S)&&N.removeChild(S)}},[e]),c.jsx(ZR,{isPresent:e,childRef:a,sizeRef:l,pop:i,children:i===!1?t:v.cloneElement(t,{ref:h})})}const e_=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:a,anchorY:l,root:u})=>{const d=ss(t_),h=v.useId(),p=v.useRef(n),f=v.useRef(r);wl(()=>{p.current=n,f.current=r});let m=!0,x=v.useMemo(()=>(m=!1,{id:h,initial:e,isPresent:n,custom:s,onExitComplete:y=>{d.set(y,!0);for(const b of d.values())if(!b)return;r&&r()},register:y=>(d.set(y,!1),()=>{var b;d.delete(y),!p.current&&!d.size&&((b=f.current)==null||b.call(f))})}),[n,d,r]);return i&&m&&(x={...x}),v.useMemo(()=>{d.forEach((y,b)=>d.set(b,!1))},[n]),v.useEffect(()=>{!n&&!d.size&&r&&r()},[n]),t=c.jsx(QR,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:u,children:t}),c.jsx(sh.Provider,{value:x,children:t})};function t_(){return new Map}function QC(t=!0){const e=v.useContext(sh);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=v.useId();v.useEffect(()=>{if(t)return s(i)},[t]);const o=v.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const ac=t=>t.key||"";function uv(t){const e=[];return v.Children.forEach(t,n=>{v.isValidElement(n)&&e.push(n)}),e}const n_=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:u})=>{const[d,h]=QC(o),p=v.useMemo(()=>uv(t),[t]),f=o&&!d?[]:p.map(ac),m=v.useRef(!0),x=v.useRef(p),y=ss(()=>new Map),b=v.useRef(new Set),[g,k]=v.useState(p),[w,C]=v.useState(p);wl(()=>{m.current=!1,x.current=p;for(let N=0;N{const T=ac(N),E=o&&!d?!1:p===w||f.includes(T),D=()=>{if(b.current.has(T))return;if(y.has(T))b.current.add(T),y.set(T,!0);else return;let P=!0;y.forEach(O=>{O||(P=!1)}),P&&(S==null||S(),C(x.current),o&&(h==null||h()),r&&r())};return c.jsx(e_,{isPresent:E,initial:!m.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:u,onExitComplete:E?void 0:D,anchorX:a,anchorY:l,children:N},T)})})},ej=v.createContext({strict:!1}),dv={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let hv=!1;function r_(){if(hv)return;const t={};for(const e in dv)t[e]={isEnabled:n=>dv[e].some(r=>!!n[r])};PC(t),hv=!0}function tj(){return r_(),FL()}function s_(t){const e=tj();for(const n in t)e[n]={...e[n],...t[n]};PC(e)}const i_=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function $u(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||i_.has(t)}let nj=t=>!$u(t);function o_(t){typeof t=="function"&&(nj=e=>e.startsWith("on")?!$u(e):t(e))}try{o_(require("@emotion/is-prop-valid").default)}catch{}function a_(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||Ue(t[s])||(nj(s)||n===!0&&$u(s)||!e&&!$u(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const lh=v.createContext({});function l_(t,e){if(ah(t)){const{initial:n,animate:r}=t;return{initial:n===!1||tl(n)?n:void 0,animate:tl(r)?r:void 0}}return t.inherit!==!1?e:{}}function c_(t){const{initial:e,animate:n}=l_(t,v.useContext(lh));return v.useMemo(()=>({initial:e,animate:n}),[fv(e),fv(n)])}function fv(t){return Array.isArray(t)?t.join(" "):t}const U0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function rj(t,e,n){for(const r in e)!Ue(e[r])&&!OC(r,n)&&(t[r]=e[r])}function u_({transformTemplate:t},e){return v.useMemo(()=>{const n=U0();return H0(n,e,t),Object.assign({},n.vars,n.style)},[e])}function d_(t,e){const n=t.style||{},r={};return rj(r,n,t),Object.assign(r,u_(t,e)),r}function h_(t,e){const n={},r=d_(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const sj=()=>({...U0(),attrs:{}});function f_(t,e,n,r){const s=v.useMemo(()=>{const i=sj();return BC(i,e,FC(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};rj(i,t.style,t),s.style={...i,...s.style}}return s}const p_=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function K0(t){return typeof t!="string"||t.includes("-")?!1:!!(p_.indexOf(t)>-1||/[A-Z]/u.test(t))}function m_(t,e,n,{latestValues:r},s,i=!1,o){const l=(o??K0(t)?f_:h_)(e,r,s,t),u=a_(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...l,ref:n}:{},{children:h}=e,p=v.useMemo(()=>Ue(h)?h.get():h,[h]);return v.createElement(t,{...d,children:p})}function g_({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:x_(n,r,s,t),renderState:e()}}function x_(t,e,n,r){const s={},i=r(t,{});for(const p in i)s[p]=Yc(i[p]);let{initial:o,animate:a}=t;const l=ah(t),u=TC(t);e&&u&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?a:o;if(h&&typeof h!="boolean"&&!oh(h)){const p=Array.isArray(h)?h:[h];for(let f=0;f(e,n)=>{const r=v.useContext(lh),s=v.useContext(sh),i=()=>g_(t,e,r,s);return n?i():ss(i)},y_=ij({scrapeMotionValuesFromProps:W0,createRenderState:U0}),b_=ij({scrapeMotionValuesFromProps:VC,createRenderState:sj}),v_=Symbol.for("motionComponentSymbol");function k_(t,e,n){const r=v.useRef(n);v.useInsertionEffect(()=>{r.current=n});const s=v.useRef(null);return v.useCallback(i=>{var a;i&&((a=t.onMount)==null||a.call(t,i)),e&&(i?e.mount(i):e.unmount());const o=r.current;if(typeof o=="function")if(i){const l=o(i);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i)},[e])}const oj=v.createContext({});function gi(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function w_(t,e,n,r,s,i){var k,w;const{visualElement:o}=v.useContext(lh),a=v.useContext(ej),l=v.useContext(sh),u=v.useContext(jl),d=u.reducedMotion,h=u.skipAnimations,p=v.useRef(null),f=v.useRef(!1);r=r||a.renderer,!p.current&&r&&(p.current=r(t,{visualState:e,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d,skipAnimations:h,isSVG:i}),f.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const m=p.current,x=v.useContext(oj);m&&!m.projection&&s&&(m.type==="html"||m.type==="svg")&&S_(p.current,n,s,x);const y=v.useRef(!1);v.useInsertionEffect(()=>{m&&y.current&&m.update(n,l)});const b=n[pC],g=v.useRef(!!b&&typeof window<"u"&&!((k=window.MotionHandoffIsComplete)!=null&&k.call(window,b))&&((w=window.MotionHasOptimisedAnimation)==null?void 0:w.call(window,b)));return wl(()=>{f.current=!0,m&&(y.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),g.current&&m.animationState&&m.animationState.animateChanges())}),v.useEffect(()=>{m&&(!g.current&&m.animationState&&m.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var C;(C=window.MotionHandoffMarkAsComplete)==null||C.call(window,b)}),g.current=!1),m.enteringChildren=void 0)}),m}function S_(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u,layoutAnchor:d,layoutCrossfade:h}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:aj(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&gi(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:u,layoutAnchor:d})}function aj(t){if(t)return t.options.allowProjection!==!1?t.projection:aj(t.parent)}function vf(t,{forwardMotionProps:e=!1,type:n}={},r,s){r&&s_(r);const i=n?n==="svg":K0(t),o=i?b_:y_;function a(u,d){let h;const p={...v.useContext(jl),...u,layoutId:N_(u)},{isStatic:f}=p,m=c_(u),x=o(u,f);if(!f&&typeof window<"u"){C_();const y=j_(p);h=y.MeasureLayout,m.visualElement=w_(t,x,p,s,y.ProjectionNode,i)}return c.jsxs(lh.Provider,{value:m,children:[h&&m.visualElement?c.jsx(h,{visualElement:m.visualElement,...p}):null,m_(t,u,k_(x,m.visualElement,d),x,f,e,i)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=v.forwardRef(a);return l[v_]=t,l}function N_({layoutId:t}){const e=v.useContext(x0).id;return e&&t!==void 0?e+"-"+t:t}function C_(t,e){v.useContext(ej).strict}function j_(t){const e=tj(),{drag:n,layout:r}=e;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(t)||r!=null&&r.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function E_(t,e){if(typeof Proxy>"u")return vf;const n=new Map,r=(i,o)=>vf(i,o,t,e),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,vf(o,void 0,t,e)),n.get(o))})}const T_=(t,e)=>e.isSVG??K0(t)?new rR(e):new XL(e,{allowProjection:t!==v.Fragment});class M_ extends fs{constructor(e){super(e),e.animationState||(e.animationState=lR(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();oh(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let P_=0;class A_ extends fs{constructor(){super(...arguments),this.id=P_++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:o,custom:a}=this.node.getProps();if(typeof o=="string"||typeof o=="object"&&o!==null&&!Array.isArray(o)){const l=Fs(this.node,o,a);if(l){const{transition:u,transitionEnd:d,...h}=l;for(const p in h)(i=this.node.getValue(p))==null||i.jump(h[p])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const D_={animation:{Feature:M_},exit:{Feature:A_}};function El(t){return{point:{x:t.pageX,y:t.pageY}}}const L_=t=>e=>z0(e)&&t(e,El(e));function ya(t,e,n,r){return nl(t,e,L_(n),r)}const lj=({current:t})=>t?t.ownerDocument.defaultView:null,pv=(t,e)=>Math.abs(t-e);function R_(t,e){const n=pv(t.x,e.x),r=pv(t.y,e.y);return Math.sqrt(n**2+r**2)}const mv=new Set(["auto","scroll"]);class cj{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=m=>{this.handleScroll(m.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=lc(this.lastRawMoveEventInfo,this.transformPagePoint));const m=kf(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,y=R_(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!y)return;const{point:b}=m,{timestamp:g}=Je;this.history.push({...b,timestamp:g});const{onStart:k,onMove:w}=this.handlers;x||(k&&k(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,m)},this.handlePointerMove=(m,x)=>{this.lastMoveEvent=m,this.lastRawMoveEventInfo=x,this.lastMoveEventInfo=lc(x,this.transformPagePoint),le.update(this.updatePoint,!0)},this.handlePointerUp=(m,x)=>{this.end();const{onEnd:y,onSessionEnd:b,resumeAnimation:g}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=kf(m.type==="pointercancel"?this.lastMoveEventInfo:lc(x,this.transformPagePoint),this.history);this.startEvent&&y&&y(m,k),b&&b(m,k)},!z0(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=El(e),u=lc(l,this.transformPagePoint),{point:d}=u,{timestamp:h}=Je;this.history=[{...d,timestamp:h}];const{onSessionStart:p}=n;p&&p(e,kf(u,this.history));const f={passive:!0,capture:!0};this.removeListeners=Sl(ya(this.contextWindow,"pointermove",this.handlePointerMove,f),ya(this.contextWindow,"pointerup",this.handlePointerUp,f),ya(this.contextWindow,"pointercancel",this.handlePointerUp,f)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(mv.has(r.overflowX)||mv.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,s),le.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),dn(this.updatePoint)}}function lc(t,e){return e?{point:e(t.point)}:t}function gv(t,e){return{x:t.x-e.x,y:t.y-e.y}}function kf({point:t},e){return{point:t,delta:gv(t,uj(e)),offset:gv(t,__(e)),velocity:I_(e,.1)}}function __(t){return t[0]}function uj(t){return t[t.length-1]}function I_(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=uj(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>$t(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&s.timestamp-r.timestamp>$t(e)*2&&(r=t[1]);const i=sn(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function O_(t,{min:e,max:n},r){return e!==void 0&&tn&&(t=r?ge(n,t,r.max):Math.min(t,n)),t}function xv(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function B_(t,{top:e,left:n,bottom:r,right:s}){return{x:xv(t.x,n,s),y:xv(t.y,e,r)}}function yv(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.minr?n=eo(e.min,e.max-r,t.min):r>s&&(n=eo(t.min,t.max-s,e.min)),Dn(0,1,n)}function V_(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Pm=.35;function $_(t=Pm){return t===!1?t=0:t===!0&&(t=Pm),{x:bv(t,"left","right"),y:bv(t,"top","bottom")}}function bv(t,e,n){return{min:vv(t,e),max:vv(t,n)}}function vv(t,e){return typeof t=="number"?t:t[e]||0}const H_=new WeakMap;class W_{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=$e(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{n&&this.snapToCursor(El(h).point),this.stopAnimation()},o=(h,p)=>{const{drag:f,dragPropagation:m,onDragStart:x}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=pL(f),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),In(b=>{let g=this.getAxisMotionValue(b).get()||0;if(Wn.test(g)){const{projection:k}=this.visualElement;if(k&&k.layout){const w=k.layout.layoutBox[b];w&&(g=wt(w)*(parseFloat(g)/100))}}this.originPoint[b]=g}),x&&le.update(()=>x(h,p),!1,!0),bm(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p;const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:x,onDrag:y}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:b}=p;if(m&&this.currentDirection===null){this.currentDirection=K_(b),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",p.point,b),this.updateAxis("y",p.point,b),this.visualElement.render(),y&&le.update(()=>y(h,p),!1,!0)},l=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p,this.stop(h,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new cj(e,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:lj(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&le.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!cc(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=O_(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;e&&gi(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=B_(r.layoutBox,e):this.constraints=!1,this.elastic=$_(n),s!==this.constraints&&!gi(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&In(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=V_(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!gi(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;s.root&&(s.root.scroll=void 0,s.root.updateScroll());const i=UL(r,s.root,this.visualElement.getTransformPagePoint());let o=z_(s.layout.layoutBox,i);if(n){const a=n($L(o));this.hasMutatedConstraints=!!a,a&&(o=DC(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=In(d=>{if(!cc(d,n,this.currentDirection))return;let h=l&&l[d]||{};(o===!0||o===d)&&(h={min:0,max:0});const p=s?200:1e6,f=s?40:1e7,m={type:"inertia",velocity:r?e[d]:0,bounceStiffness:p,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return bm(this.visualElement,e),r.start(_0(e,r,0,n,this.visualElement,!1))}stopAnimation(){In(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps()[n];return s||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){In(n=>{const{drag:r}=this.getProps();if(!cc(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n],l=i.get()||0;i.set(e[n]-ge(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!gi(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};In(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=F_({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),In(o=>{if(!cc(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(ge(l,u,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;H_.set(this.visualElement,this);const e=this.visualElement.current,n=ya(e,"pointerdown",u=>{const{drag:d,dragListener:h=!0}=this.getProps(),p=u.target,f=p!==e&&vL(p);d&&h&&!f&&this.start(u)});let r;const s=()=>{const{dragConstraints:u}=this.getProps();gi(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=U_(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),le.read(s);const a=nl(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(In(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=u[h].translate,p.set(p.get()+u[h].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),l&&l(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Pm,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function kv(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function U_(t,e,n){const r=Nm(t,kv(n)),s=Nm(e,kv(n));return()=>{r(),s()}}function cc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function K_(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class G_ extends fs{constructor(e){super(e),this.removeGroupControls=_t,this.removeListeners=_t,this.controls=new W_(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||_t}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const wf=t=>(e,n)=>{t&&le.update(()=>t(e,n),!1,!0)};class q_ extends fs{constructor(){super(...arguments),this.removePointerDownListener=_t}onPointerDown(e){this.session=new cj(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lj(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:wf(e),onStart:wf(n),onMove:wf(r),onEnd:(i,o)=>{delete this.session,s&&le.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=ya(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Sf=!1;class J_ extends v.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),Sf&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Xc.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),Sf=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||le.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),no.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;Sf=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function dj(t){const[e,n]=QC(),r=v.useContext(x0);return c.jsx(J_,{...t,layoutGroup:r,switchLayoutGroup:v.useContext(oj),isPresent:e,safeToRemove:n})}const Y_={pan:{Feature:q_},drag:{Feature:G_,ProjectionNode:ZC,MeasureLayout:dj}};function wv(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&le.postRender(()=>i(e,El(e)))}class X_ extends fs{mount(){const{current:e}=this.node;e&&(this.unmount=gL(e,(n,r)=>(wv(this.node,r,"Start"),s=>wv(this.node,s,"End"))))}unmount(){}}class Z_ extends fs{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Sl(nl(this.node.current,"focus",()=>this.onFocus()),nl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Sv(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&le.postRender(()=>i(e,El(e)))}class Q_ extends fs{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=wL(e,(s,i)=>(Sv(this.node,i,"Start"),(o,{success:a})=>Sv(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Am=new WeakMap,Nf=new WeakMap,eI=t=>{const e=Am.get(t.target);e&&e(t)},tI=t=>{t.forEach(eI)};function nI({root:t,...e}){const n=t||document;Nf.has(n)||Nf.set(n,{});const r=Nf.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(tI,{root:t,...e})),r[s]}function rI(t,e,n){const r=nI(e);return Am.set(t,n),r.observe(t),()=>{Am.delete(t),r.unobserve(t)}}const sI={some:0,all:1};class iI extends fs{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:sI[s]},a=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:p}=this.node.getProps(),f=d?h:p;f&&f(u)};this.stopObserver=rI(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(oI(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function oI({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const aI={inView:{Feature:iI},tap:{Feature:Q_},focus:{Feature:Z_},hover:{Feature:X_}},lI={layout:{ProjectionNode:ZC,MeasureLayout:dj}},cI={...D_,...aI,...Y_,...lI},ir=E_(cI,T_);function Hu(t){return typeof window>"u"?!1:t?rC():L0()}const uI=50,Nv=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),dI=()=>({time:0,x:Nv(),y:Nv()}),hI={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Cv(t,e,n,r){const s=n[e],{length:i,position:o}=hI[e],a=s.current,l=n.time;s.current=Math.abs(t[`scroll${o}`]),s.scrollLength=t[`scroll${i}`]-t[`client${i}`],s.offset.length=0,s.offset[0]=0,s.offset[1]=s.scrollLength,s.progress=eo(0,s.scrollLength,s.current);const u=r-l;s.velocity=u>uI?0:k0(s.current-a,u)}function fI(t,e,n){Cv(t,"x",e,n),Cv(t,"y",e,n),e.time=n}function pI(t,e){const n={x:0,y:0};let r=t;for(;r&&r!==e;)if(ga(r))n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if(r.tagName==="svg"){const s=r.getBoundingClientRect();r=r.parentElement;const i=r.getBoundingClientRect();n.x+=s.left-i.left,n.y+=s.top-i.top}else if(r instanceof SVGGraphicsElement){const{x:s,y:i}=r.getBBox();n.x+=s,n.y+=i;let o=null,a=r.parentNode;for(;!o;)a.tagName==="svg"&&(o=a),a=r.parentNode;r=o}else break;return n}const Dm={start:0,center:.5,end:1};function jv(t,e,n=0){let r=0;if(t in Dm&&(t=Dm[t]),typeof t=="string"){const s=parseFloat(t);t.endsWith("px")?r=s:t.endsWith("%")?t=s/100:t.endsWith("vw")?r=s/100*document.documentElement.clientWidth:t.endsWith("vh")?r=s/100*document.documentElement.clientHeight:t=s}return typeof t=="number"&&(r=e*t),n+r}const mI=[0,0];function gI(t,e,n,r){let s=Array.isArray(t)?t:mI,i=0,o=0;return typeof t=="number"?s=[t,t]:typeof t=="string"&&(t=t.trim(),t.includes(" ")?s=t.split(" "):s=[t,Dm[t]?t:"0"]),i=jv(s[0],n,r),o=jv(s[1],e),i-o}const Zo={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},xI={x:0,y:0};function yI(t){return"getBBox"in t&&t.tagName!=="svg"?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}function bI(t,e,n){const{offset:r=Zo.All}=n,{target:s=t,axis:i="y"}=n,o=i==="y"?"height":"width",a=s!==t?pI(s,t):xI,l=s===t?{width:t.scrollWidth,height:t.scrollHeight}:yI(s),u={width:t.clientWidth,height:t.clientHeight};e[i].offset.length=0;let d=!e[i].interpolate;const h=r.length;for(let p=0;p{vI(t,r.target,n),fI(t,n,s),(r.offset||r.target)&&bI(t,n,r)},notify:()=>e(n)}}const di=new WeakMap,Ev=new WeakMap,Cf=new WeakMap,Tv=new WeakMap,uc=new WeakMap,Mv=t=>t===document.scrollingElement?window:t;function hj(t,{container:e=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!e)return _t;let s=Cf.get(e);s||(s=new Set,Cf.set(e,s));const i=dI(),o=kI(e,t,i,r);if(s.add(o),!di.has(e)){const l=()=>{for(const p of s)p.measure(Je.timestamp);le.preUpdate(u)},u=()=>{for(const p of s)p.notify()},d=()=>le.read(l);di.set(e,d);const h=Mv(e);window.addEventListener("resize",d),e!==document.documentElement&&Ev.set(e,Nm(e,d)),h.addEventListener("scroll",d),d()}if(n&&!uc.has(e)){const l=di.get(e),u={width:e.scrollWidth,height:e.scrollHeight};Tv.set(e,u);const d=()=>{const p=e.scrollWidth,f=e.scrollHeight;(u.width!==p||u.height!==f)&&(l(),u.width=p,u.height=f)},h=le.read(d,!0);uc.set(e,h)}const a=di.get(e);return le.read(a,!1,!0),()=>{var h;dn(a);const l=Cf.get(e);if(!l||(l.delete(o),l.size))return;const u=di.get(e);di.delete(e),u&&(Mv(e).removeEventListener("scroll",u),(h=Ev.get(e))==null||h(),window.removeEventListener("resize",u));const d=uc.get(e);d&&(dn(d),uc.delete(e)),Tv.delete(e)}}const wI=[[Zo.Enter,"entry"],[Zo.Exit,"exit"],[Zo.Any,"cover"],[Zo.All,"contain"]],Pv={start:0,end:1};function SI(t){const e=t.trim().split(/\s+/);if(e.length!==2)return;const n=Pv[e[0]],r=Pv[e[1]];if(!(n===void 0||r===void 0))return[n,r]}function NI(t){if(t.length!==2)return;const e=[];for(const n of t)if(Array.isArray(n))e.push(n);else if(typeof n=="string"){const r=SI(n);if(!r)return;e.push(r)}else return;return e}function CI(t,e){const n=NI(t);if(!n)return!1;for(let r=0;r<2;r++){const s=n[r],i=e[r];if(s[0]!==i[0]||s[1]!==i[1])return!1}return!0}function G0(t){if(!t)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[e,n]of wI)if(CI(t,e))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const Av=new Map;function Dv(t){const e={value:0},n=hj(r=>{e.value=r[t.axis].progress*100},t);return{currentTime:e,cancel:n}}function fj({source:t,container:e,...n}){const{axis:r}=n;t&&(e=t);let s=Av.get(e);s||(s=new Map,Av.set(e,s));const i=n.target??"self";let o=s.get(i);o||(o={},s.set(i,o));const a=r+(n.offset??[]).join(",");return o[a]||(n.target&&Hu(n.target)?G0(n.offset)?o[a]=new ViewTimeline({subject:n.target,axis:r}):o[a]=Dv({container:e,...n}):Hu()?o[a]=new ScrollTimeline({source:e,axis:r}):o[a]=Dv({container:e,...n})),o[a]}function jI(t,e){const n=fj(e),r=e.target?G0(e.offset):void 0,s=e.target?Hu(e.target)&&!!r:Hu();return t.attachTimeline({timeline:s?n:void 0,...r&&s&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:i=>(i.pause(),EC(o=>{i.time=i.iterationDuration*o},n))})}function EI(t){return t&&(t.target||t.offset)}function TI(t){return t.length===2}function MI(t,e){return TI(t)||EI(e)?hj(n=>{t(n[e.axis].progress,n)},e):EC(t,fj(e))}function pj(t,{axis:e="y",container:n=document.scrollingElement,...r}={}){if(!n)return _t;const s={axis:e,container:n,...r};return typeof t=="function"?MI(t,s):jI(t,s)}const PI=()=>({scrollX:Cn(0),scrollY:Cn(0),scrollXProgress:Cn(0),scrollYProgress:Cn(0)}),Oi=t=>t?!t.current:!1;function Lv(t,e,n,r){return{factory:s=>{let i;const o=()=>{if(Oi(n)||Oi(r)){no.read(o);return}i=pj(s,{...e,axis:t,container:(n==null?void 0:n.current)||void 0,target:(r==null?void 0:r.current)||void 0})};return no.read(o),()=>{wC(o),i==null||i()}},times:[0,1],keyframes:[0,1],ease:s=>s,duration:1}}function AI(t,e){return typeof window>"u"?!1:t?rC()&&!!G0(e):L0()}function mj({container:t,target:e,...n}={}){const r=ss(PI);AI(e,n.offset)&&(r.scrollXProgress.accelerate=Lv("x",n,t,e),r.scrollYProgress.accelerate=Lv("y",n,t,e));const s=v.useRef(null),i=v.useRef(!1),o=v.useCallback(()=>(s.current=pj((a,{x:l,y:u})=>{r.scrollX.set(l.current),r.scrollXProgress.set(l.progress),r.scrollY.set(u.current),r.scrollYProgress.set(u.progress)},{...n,container:(t==null?void 0:t.current)||void 0,target:(e==null?void 0:e.current)||void 0}),()=>{var a;(a=s.current)==null||a.call(s)}),[t,e,JSON.stringify(n.offset)]);return wl(()=>{if(i.current=!1,Oi(t)||Oi(e)){i.current=!0;return}else return o()},[o]),v.useEffect(()=>{if(!i.current)return;let a;const l=()=>{const u=Oi(t),d=Oi(e);!u&&!d&&(a=o())};return no.read(l),()=>{wC(l),a==null||a()}},[o]),r}function gj(t){const e=ss(()=>Cn(t)),{isStatic:n}=v.useContext(jl);if(n){const[,r]=v.useState(t);v.useEffect(()=>e.on("change",r),[])}return e}function xj(t,e){const n=gj(e()),r=()=>n.set(e());return r(),wl(()=>{const s=()=>le.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>{i.forEach(o=>o()),dn(r)}}),n}function DI(t){ma.current=[],t();const e=xj(ma.current,t);return ma.current=void 0,e}function Er(t,e,n,r){if(typeof t=="function")return DI(t);if(n!==void 0&&!Array.isArray(n)&&typeof e!="function")return LI(t,e,n,r);const o=typeof e=="function"?e:DL(e,n,r),a=Array.isArray(t)?Rv(t,o):Rv([t],([u])=>o(u)),l=Array.isArray(t)?void 0:t.accelerate;return l&&!l.isTransformed&&typeof e!="function"&&Array.isArray(n)&&(r==null?void 0:r.clamp)!==!1&&(a.accelerate={...l,times:e,keyframes:n,isTransformed:!0}),a}function Rv(t,e){const n=ss(()=>[]);return xj(t,()=>{n.length=0;const r=t.length;for(let s=0;sObject.keys(n)),i=ss(()=>({}));for(const o of s)i[o]=Er(t,e,n[o],r);return i}function RI(t,e={}){const{isStatic:n}=v.useContext(jl),r=()=>Ue(t)?t.get():t;if(n)return Er(r);const s=gj(r());return v.useInsertionEffect(()=>LL(s,t,e),[s,JSON.stringify(e)]),s}function _I(t,e={}){return RI(t,{type:"spring",...e})}function II(){const{scrollYProgress:t}=mj(),e=_I(t,{stiffness:200,damping:30,restDelta:.001});return c.jsx(ir.div,{style:{scaleX:e},className:"fixed left-0 top-0 z-40 h-0.5 w-full origin-left bg-brand-500"})}const OI=()=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"h-10 w-10",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.7 6.3a4 4 0 0 0-5.5 4.5L3 17l2 2 6.2-6.2a4 4 0 0 0 4.5-5.5l-2.6 2.6-2-2 2.6-2.6Z"})});function Tl({message:t,fullScreen:e=!1}){const{t:n}=ct(),r=c.jsxs("div",{className:"mx-auto max-w-md text-center",children:[c.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:c.jsx(OI,{})}),c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:n("maintenance.title")}),c.jsx("p",{className:"text-neutral-600 dark:text-neutral-300",children:t||n("maintenance.defaultMessage")})]});return e?c.jsxs("div",{className:"relative flex min-h-screen items-center justify-center bg-white px-4 dark:bg-neutral-950",children:[r,c.jsxs(ne,{to:"/admin/login","aria-label":n("maintenance.login"),title:n("maintenance.login"),className:"fixed bottom-4 right-4 flex items-center gap-2 rounded-full border border-neutral-200 bg-white px-3 py-2 text-sm font-medium text-neutral-600 shadow-sm transition hover:border-brand-500 hover:text-brand-600 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-300 dark:hover:text-brand-400",children:[c.jsx(vt,{name:"log-in",className:"h-4 w-4"}),n("maintenance.login")]})]}):c.jsx("div",{className:"mx-auto max-w-6xl px-4 py-20 sm:px-6",children:r})}const _v=c.jsx(c.Fragment,{children:'Wartungsmodus aktiv – Besucher sehen aktuell eine Wartungsmeldung. Du siehst diese Seite nur, weil du die Berechtigung "Wartungsmodus umgehen" hast.'});function Ml({inline:t=!1}){return t?c.jsx("div",{className:"mb-8 rounded-lg bg-amber-500 px-4 py-2 text-center text-xs font-semibold text-white",children:_v}):c.jsx("div",{className:"bg-amber-500 px-4 py-2 text-center text-xs font-semibold text-white",children:_v})}function BI({onClose:t}){const{consent:e,saveCustom:n}=wo(),[r,s]=v.useState(e.external),[i,o]=v.useState(e.analytics),{t:a}=ct();return c.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/50 p-4",onClick:t,children:c.jsxs("div",{className:"w-full max-w-md rounded-xl bg-white p-6 dark:bg-neutral-900",onClick:l=>l.stopPropagation(),children:[c.jsx("h2",{className:"mb-1 text-lg font-bold text-neutral-900 dark:text-white",children:a("cookieConsent.modalTitle")}),c.jsxs("p",{className:"mb-4 text-sm text-neutral-600 dark:text-neutral-300",children:[a("cookieConsent.modalIntro")," ",c.jsx(ne,{to:"/datenschutz",className:"underline hover:text-brand-500",onClick:t,children:a("cookieConsent.privacyPolicy")}),"."]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-neutral-200 p-3 dark:border-neutral-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-neutral-800 dark:text-neutral-100",children:a("cookieConsent.necessaryTitle")}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a("cookieConsent.necessaryDesc")})]}),c.jsx("input",{type:"checkbox",checked:!0,disabled:!0,className:"mt-1 h-4 w-4 shrink-0"})]}),c.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-neutral-200 p-3 dark:border-neutral-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-neutral-800 dark:text-neutral-100",children:a("cookieConsent.externalTitle")}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a("cookieConsent.externalDesc")})]}),c.jsx("input",{type:"checkbox",checked:r,onChange:l=>s(l.target.checked),className:"mt-1 h-4 w-4 shrink-0"})]}),c.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-lg border border-neutral-200 p-3 dark:border-neutral-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold text-neutral-800 dark:text-neutral-100",children:a("cookieConsent.analyticsTitle")}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:a("cookieConsent.analyticsDesc")})]}),c.jsx("input",{type:"checkbox",checked:i,onChange:l=>o(l.target.checked),className:"mt-1 h-4 w-4 shrink-0"})]})]}),c.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:t,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:a("cookieConsent.cancel")}),c.jsx("button",{type:"button",onClick:()=>n({external:r,analytics:i}),className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:a("cookieConsent.saveSelection")})]})]})})}function zI(){const{decided:t,settingsOpen:e,acceptAll:n,rejectNonEssential:r,openSettings:s,closeSettings:i}=wo(),{t:o}=ct();return c.jsxs(c.Fragment,{children:[!t&&c.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t border-neutral-200 bg-white/95 p-4 shadow-lg backdrop-blur dark:border-neutral-800 dark:bg-neutral-900/95 sm:p-5",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:[o("cookieConsent.bannerText")," ",o("cookieConsent.moreInfo")," ",c.jsx(ne,{to:"/datenschutz",className:"underline hover:text-brand-500",children:o("cookieConsent.privacyPolicy")}),"."]}),c.jsxs("div",{className:"flex flex-wrap gap-2 sm:shrink-0",children:[c.jsx("button",{type:"button",onClick:s,className:"rounded-md border border-neutral-300 px-3 py-2 text-sm dark:border-neutral-700",children:o("cookieConsent.settings")}),c.jsx("button",{type:"button",onClick:r,className:"rounded-md border border-neutral-300 px-3 py-2 text-sm dark:border-neutral-700",children:o("cookieConsent.onlyNecessary")}),c.jsx("button",{type:"button",onClick:n,className:"rounded-md bg-brand-500 px-3 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o("cookieConsent.acceptAll")})]})]})}),e&&c.jsx(BI,{onClose:i})]})}function FI(){const{consent:t}=wo(),{ga_measurement_id:e}=hs(),n=v.useRef(!1);return v.useEffect(()=>{if(!e||!t.analytics||n.current)return;n.current=!0;const r=document.createElement("script");r.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,r.async=!0,document.head.appendChild(r),window.dataLayer=window.dataLayer||[];function s(...i){window.dataLayer.push(i)}window.gtag=s,s("js",new Date),s("config",e,{anonymize_ip:!0})},[e,t.analytics]),null}const yj=v.createContext({global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null},bypass:!1}),VI=yj.Provider;function ch(){return v.useContext(yj)}const q0=v.createContext({}),$I=q0.Provider;function rl(t,e){const n=t[e];if(!n)return{};const r={};return n.font_family&&(r.fontFamily=n.font_family),n.font_size&&(r.fontSize=n.font_size),n.color&&(r.color=n.color),r}function ft(t){const e=v.useContext(q0);return rl(e,t)}function J0(){return v.useContext(q0)}const HI=[{label:"Systemschrift",value:""},{label:"Serifenlos (Arial)",value:"Arial, Helvetica, sans-serif"},{label:"Serif (Georgia)",value:'Georgia, "Times New Roman", serif'},{label:"Klassisch (Times New Roman)",value:'"Times New Roman", Times, serif'},{label:"Modern (Verdana)",value:"Verdana, Geneva, sans-serif"},{label:"Schreibmaschine (Courier New)",value:'"Courier New", Courier, monospace'}],Y0=v.createContext({fonts:[],refresh:()=>{}}),bj=Y0.Provider;function X0(){return v.useContext(Y0).fonts}function WI(){return v.useContext(Y0).refresh}function uh(){const t=X0();return[...HI,...t.map(e=>({label:e.name,value:e.font_family}))]}function UI(t){const e=/\.([a-z0-9]+)$/i.exec(t||"");return e?e[1].toLowerCase():""}const KI={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype"};function vj(){const t=X0();if(t.length===0)return null;const e=t.map(n=>{const r=KI[UI(n.file_path)]||"woff2";return`@font-face { font-family: "${n.font_family}"; src: url("${n.file_path}") format("${r}"); font-display: swap; }`}).join(`
+`);return c.jsx("style",{children:e})}const GI={global:{enabled:!1,message:null},services:{enabled:!1,message:null},vehicles:{enabled:!1,message:null}},qI={mon:{open:"09:00",close:"18:00",closed:!1},tue:{open:"09:00",close:"18:00",closed:!1},wed:{open:"09:00",close:"18:00",closed:!1},thu:{open:"09:00",close:"18:00",closed:!1},fri:{open:"09:00",close:"18:00",closed:!1},sat:{open:"10:00",close:"13:00",closed:!1},sun:{open:"",close:"",closed:!0}},JI={phone:"09373 20 62 390",whatsapp:null,contact_email:"info@hifi-planet-amorbach.de",address_street:"Boxbrunner Str. 20a",address_zip:"63916",address_city:"Amorbach",logo_path:null,logo_dark_path:null,business_hours:qI,hero_image_path:null,ga_measurement_id:null,package_card_theme:"graphite",package_card_layout:"strip",package_wheel_hint_interval:8,gallery_card_text_x:0,gallery_card_text_y:100,site_font:null},YI=["/impressum","/datenschutz","/agb"];function XI(){const[t,e]=v.useState(null),[n,r]=v.useState(JI),[s,i]=v.useState({}),[o,a]=v.useState([]),{loading:l,hasPermission:u}=Ln(),d=hn();if(v.useEffect(()=>{A.get("/maintenance").then(e).catch(()=>e(GI)),A.get("/site-settings").then(r).catch(()=>{}),A.get("/text-styles").then(i).catch(()=>{}),A.get("/custom-fonts").then(a).catch(()=>{})},[]),v.useEffect(()=>{n.site_font?document.documentElement.style.setProperty("--site-font",n.site_font):document.documentElement.style.removeProperty("--site-font")},[n.site_font]),t===null||l)return c.jsx("div",{className:"min-h-screen bg-white dark:bg-neutral-950"});const h=u("maintenance.bypass"),p=YI.includes(d.pathname);return t.global.enabled&&!h&&!p?c.jsx(sb,{children:c.jsx(Tl,{message:t.global.message,fullScreen:!0})}):c.jsx(sb,{children:c.jsx(VI,{value:{...t,bypass:h},children:c.jsx(QD,{value:n,children:c.jsx($I,{value:s,children:c.jsx(bj,{value:{fonts:o,refresh:()=>{}},children:c.jsxs("div",{className:"page-texture flex min-h-screen flex-col text-neutral-900 dark:text-neutral-100",children:[c.jsx(vj,{}),h&&t.global.enabled&&c.jsx(Ml,{}),c.jsx(II,{}),c.jsx(i3,{}),c.jsx("main",{className:"flex-1",children:c.jsx(rh,{})}),c.jsx(h3,{}),c.jsx(zI,{}),c.jsx(FI,{})]})})})})})})}const Wu="/assets/logo-BNfZDkmN.png",ZI={home:"M3 11.5 12 4l9 7.5M5 10v9a1 1 0 0 0 1 1h4v-6h4v6h4a1 1 0 0 0 1-1v-9",tag:"M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01",car:"M3 13.5 4.5 9A2 2 0 0 1 6.4 7.5h11.2A2 2 0 0 1 19.5 9L21 13.5M3 13.5v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-4M3 13.5h18M6.5 16.5h.01M17.5 16.5h.01",box:"M12 3 4 7.5v9L12 21l8-4.5v-9L12 3Zm0 9 8-4.5M12 12v9M12 12 4 7.5",mail:"M4 6h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm0 0 8 7 8-7",users:"M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-4 6c-4 0-7 2-7 4.5V19h14v-1.5C19 15 16 13 12 13Z",shield:"M12 3 4 6v6c0 4.5 3.4 7.7 8 9 4.6-1.3 8-4.5 8-9V6l-8-3Zm-1.5 9.5 4-4 1 1-5 5-2.5-2.5 1-1 1.5 1.5Z",lock:"M6 10V8a6 6 0 1 1 12 0v2m-13 0h14a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1Zm7 5v2",briefcase:"M4 7h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1Zm4 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M3 12h18",sliders:"M4 6h16M4 6a2 2 0 1 0 4 0 2 2 0 0 0-4 0Zm16 6H4m10 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0ZM4 18h16m-12 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0Z",image:"M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Zm2 12 4.5-5.5L14 16l2.5-3L20 17H6ZM8 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z",help:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-5.5v.01M9.5 9.25a2.5 2.5 0 1 1 3.5 2.29c-.7.32-1 .77-1 1.46v.3"},QI=({path:t})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"h-5 w-5 shrink-0",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:t})});function eO(){const{logout:t,user:e,hasPermission:n}=Ln(),r=kl(),[s,i]=v.useState(!1),[o,a]=v.useState(0),[l,u]=v.useState([]);v.useEffect(()=>{n("contact.manage")&&A.get("/contact").then(x=>a(x.filter(y=>y.status==="new").length)).catch(()=>{})},[]);const d=()=>A.get("/custom-fonts").then(u).catch(()=>{});v.useEffect(()=>{d()},[]);const h=[{title:null,links:[{to:"/admin",label:"Dashboard",icon:"home",end:!0},{to:"/admin/account",label:"Mein Konto",icon:"lock"}]},{title:"Fahrzeug-Katalog",links:[{to:"/admin/brands",label:"Marken",icon:"tag",permission:"brands.manage"},{to:"/admin/models",label:"Modelle",icon:"car",permission:"models.manage"},{to:"/admin/packages",label:"Pakete",icon:"box",permission:"packages.manage"}]},{title:"Website",links:[{to:"/admin/home-sections",label:"Startseite",icon:"home",permission:"content.manage"},{to:"/admin/services",label:"Leistungen",icon:"briefcase",permission:"services.manage"},{to:"/admin/faqs",label:"FAQ",icon:"help",permission:"content.manage"},{to:"/admin/partners",label:"Partner",icon:"tag",permission:"content.manage"}]},{title:"Bildergalerie",links:[{to:"/admin/gallery-brands",label:"Marken",icon:"tag",permission:"gallery.manage"},{to:"/admin/gallery-projects",label:"Projekte",icon:"image",permission:"gallery.manage"}]},{title:"Kunden",links:[{to:"/admin/contact-requests",label:"Kontaktanfragen",icon:"mail",permission:"contact.manage",badge:o}]},{title:"Verwaltung",links:[{to:"/admin/users",label:"Benutzer",icon:"users",permission:"users.manage"},{to:"/admin/permission-groups",label:"Berechtigungsgruppen",icon:"shield",permission:"permission_groups.manage"},{to:"/admin/settings",label:"Einstellungen",icon:"sliders",permission:"settings.manage"}]}].map(x=>({...x,links:x.links.filter(y=>!y.permission||n(y.permission))})).filter(x=>x.links.length>0),p=async()=>{await t(),r("/admin/login")},f=({isActive:x})=>`flex items-center justify-between gap-2 rounded-md px-3 py-2 text-sm font-medium transition ${x?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,m=({onNavigate:x})=>c.jsx("nav",{className:"space-y-5",children:h.map((y,b)=>c.jsxs("div",{children:[y.title&&c.jsx("p",{className:"mb-1.5 px-3 text-xs font-semibold uppercase tracking-wide text-neutral-400 dark:text-neutral-500",children:y.title}),c.jsx("div",{className:"space-y-1",children:y.links.map(g=>c.jsxs(xN,{to:g.to,end:g.end,className:f,onClick:x,children:[c.jsxs("span",{className:"flex items-center gap-2.5",children:[c.jsx(QI,{path:ZI[g.icon]}),g.label]}),!!g.badge&&c.jsx("span",{className:"rounded-full bg-red-500 px-2 py-0.5 text-xs font-bold text-white",children:g.badge})]},g.to))})]},b))});return c.jsx(bj,{value:{fonts:l,refresh:d},children:c.jsxs("div",{className:"flex min-h-screen bg-neutral-50 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100",children:[c.jsx(vj,{}),c.jsxs("aside",{className:"hidden w-60 shrink-0 border-r border-neutral-200 p-4 dark:border-neutral-800 sm:block",children:[c.jsxs("div",{className:"mb-6 flex items-center gap-2 px-3",children:[c.jsxs(ne,{to:"/",className:"rounded-lg px-2 py-1",children:[c.jsx("img",{src:Wu,alt:"HifiPlanet",className:"h-7 w-auto dark:hidden"}),c.jsx("img",{src:Lu,alt:"HifiPlanet",className:"hidden h-7 w-auto dark:block"})]}),c.jsx("span",{className:"text-sm font-semibold text-neutral-500 dark:text-neutral-400",children:"Admin"})]}),c.jsx(m,{})]}),c.jsxs("div",{className:"flex-1",children:[c.jsxs("header",{className:"border-b border-neutral-200 dark:border-neutral-800",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 sm:px-6",children:[c.jsxs("div",{className:"flex items-center gap-2 sm:hidden",children:[c.jsx("button",{onClick:()=>i(x=>!x),"aria-label":"Menü öffnen",className:"rounded-md p-2 text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-6 w-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})}),c.jsxs(ne,{to:"/",className:"rounded-lg px-1.5 py-0.5",children:[c.jsx("img",{src:Wu,alt:"HifiPlanet",className:"h-6 w-auto dark:hidden"}),c.jsx("img",{src:Lu,alt:"HifiPlanet",className:"hidden h-6 w-auto dark:block"})]})]}),c.jsxs("p",{className:"hidden text-sm text-neutral-500 dark:text-neutral-400 sm:block",children:["Angemeldet als ",e==null?void 0:e.username,e!=null&&e.is_super_admin?" · Super-Admin":""]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(kN,{}),c.jsx("button",{onClick:p,className:"rounded-md border border-neutral-300 px-3 py-1.5 text-sm font-medium text-neutral-700 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800",children:"Abmelden"})]})]}),s&&c.jsx("div",{className:"border-t border-neutral-200 px-4 py-3 dark:border-neutral-800 sm:hidden",children:c.jsx(m,{onNavigate:()=>i(!1)})})]}),c.jsx("main",{className:"p-4 sm:p-6",children:c.jsx(rh,{})})]})]})})}function tO(){const{user:t,loading:e}=Ln();return e?c.jsx("div",{className:"flex min-h-screen items-center justify-center text-neutral-500",children:"Lädt…"}):t?c.jsx(rh,{}):c.jsx(Za,{to:"/admin/login",replace:!0})}function et({permission:t,children:e}){const{hasPermission:n}=Ln();return(Array.isArray(t)?t:[t]).some(i=>n(i))?e:c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-8 text-center dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h1",{className:"mb-2 text-lg font-bold text-neutral-900 dark:text-white",children:"Keine Berechtigung"}),c.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"Du hast keinen Zugriff auf diesen Bereich. Bitte wende dich an einen Administrator, falls du hier Zugriff brauchst."})]})}function jf(t,e,n="name"){if(!e)return;let r=document.head.querySelector(`meta[${n}="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute(n,t),document.head.appendChild(r)),r.setAttribute("content",e)}function nO(t){let e=document.head.querySelector('link[rel="canonical"]');e||(e=document.createElement("link"),e.setAttribute("rel","canonical"),document.head.appendChild(e)),e.setAttribute("href",`https://hifi-planet.de${t}`)}function Gt({title:t,description:e,path:n}){v.useEffect(()=>{t&&(document.title=`${t} | HifiPlanet`,jf("og:title",`${t} | HifiPlanet`,"property")),e&&(jf("description",e),jf("og:description",e,"property")),n&&nO(n)},[t,e,n])}const rO=[.16,1,.3,1],Iv={up:{y:40},left:{x:-56},right:{x:56}};function sO(t){return{hidden:{opacity:0,scale:.96,filter:"blur(8px)",...Iv[t]||Iv.up},visible:{opacity:1,scale:1,x:0,y:0,filter:"blur(0px)"}}}const iO={hidden:{x:"-130%"},visible:{x:"230%",transition:{duration:1.1,ease:"easeInOut",delay:.4}}};function tt({children:t,direction:e="up",className:n="",index:r=0,shine:s=!1,style:i}){const o=Math.min(r*.09,.45);return c.jsxs(ir.div,{className:n,style:{position:"relative",overflow:"hidden",...i},initial:"hidden",whileInView:"visible",viewport:{once:!0,amount:.25,margin:"-100px"},variants:sO(e),transition:{duration:.75,ease:rO,delay:o},children:[t,s&&c.jsx(ir.div,{"aria-hidden":!0,variants:iO,className:"pointer-events-none absolute inset-y-0 -left-1/3 w-1/3 rotate-12 bg-gradient-to-r from-transparent via-white/40 to-transparent"})]})}function oO({items:t}){const[e,n]=v.useState(null);return c.jsx("div",{className:"divide-y divide-neutral-200 rounded-xl border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900",children:t.map((r,s)=>{const i=e===s;return c.jsxs("div",{children:[c.jsxs("button",{onClick:()=>n(i?null:s),className:"flex w-full items-center justify-between gap-4 px-5 py-4 text-left","aria-expanded":i,children:[c.jsx("span",{className:"font-medium text-neutral-900 dark:text-white",children:r.question}),c.jsx(ir.svg,{animate:{rotate:i?180:0},transition:{duration:.2},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-5 w-5 shrink-0 text-neutral-500",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6 9 6 6 6-6"})})]}),c.jsx(n_,{initial:!1,children:i&&c.jsx(ir.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:c.jsx("p",{className:"px-5 pb-4 text-sm text-neutral-600 dark:text-neutral-300",children:r.answer})})})]},r.question)})})}function kj({count:t=5,className:e="h-4 w-4"}){return c.jsx("div",{className:"flex gap-0.5 text-amber-400",children:Array.from({length:t}).map((n,r)=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:e,children:c.jsx("path",{d:"M10 1.5l2.6 5.6 6.1.6-4.6 4.1 1.3 6-5.4-3.1-5.4 3.1 1.3-6-4.6-4.1 6.1-.6L10 1.5z"})},r))})}const aO=70;function lO({testimonials:t}){const e=v.useRef(null),n=v.useRef(null),r=v.useRef({pos:0,half:0,hovering:!1,dragging:!1,dragStartX:0,dragStartPos:0,lastTime:null,rafId:null}).current;v.useLayoutEffect(()=>{const i=n.current,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,a=()=>{i.style.transform=`translateX(${r.pos}px)`},l=g=>{if(r.half<=0)return g;for(;g>0;)g-=r.half;for(;g<=-r.half;)g+=r.half;return g},u=()=>{r.half=i.scrollWidth/2,r.pos===0?r.pos=-r.half:r.pos=l(r.pos),a()};u();const d=new ResizeObserver(u);d.observe(i);const h=g=>{r.lastTime===null&&(r.lastTime=g);const k=(g-r.lastTime)/1e3;r.lastTime=g,!r.dragging&&!r.hovering&&!o&&(r.pos=l(r.pos+aO*k),a()),r.rafId=requestAnimationFrame(h)};r.rafId=requestAnimationFrame(h);const p=e.current,f=()=>{r.hovering=!0},m=()=>{r.hovering=!1},x=g=>{r.dragging=!0,r.dragStartX=g.clientX,r.dragStartPos=r.pos,p.setPointerCapture(g.pointerId),p.classList.add("cursor-grabbing"),p.classList.remove("cursor-grab")},y=g=>{r.dragging&&(r.pos=l(r.dragStartPos+(g.clientX-r.dragStartX)),a())},b=g=>{r.dragging&&(r.dragging=!1,p.hasPointerCapture(g.pointerId)&&p.releasePointerCapture(g.pointerId),p.classList.remove("cursor-grabbing"),p.classList.add("cursor-grab"))};return p.addEventListener("pointerenter",f),p.addEventListener("pointerleave",m),p.addEventListener("pointerdown",x),p.addEventListener("pointermove",y),p.addEventListener("pointerup",b),p.addEventListener("pointercancel",b),()=>{cancelAnimationFrame(r.rafId),d.disconnect(),p.removeEventListener("pointerenter",f),p.removeEventListener("pointerleave",m),p.removeEventListener("pointerdown",x),p.removeEventListener("pointermove",y),p.removeEventListener("pointerup",b),p.removeEventListener("pointercancel",b)}},[t.length]);const s=[...t,...t];return c.jsx("div",{ref:e,className:"marquee-viewport cursor-grab touch-pan-y select-none overflow-hidden",children:c.jsx("div",{ref:n,className:"marquee-track flex w-max gap-5",children:s.map((i,o)=>c.jsx("div",{className:"w-64 shrink-0 sm:w-72 lg:w-80",children:c.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden rounded-xl border border-neutral-200 bg-white p-6 shadow-sm transition-shadow duration-300 hover:shadow-lg dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 32 24",className:"absolute -right-1 -top-1 h-16 w-16 text-brand-500/10 dark:text-brand-400/10",children:c.jsx("path",{fill:"currentColor",d:"M9.4 0C4.4 3.5 1 9.1 1 15.3 1 20.6 4.3 24 8.4 24c3.8 0 6.6-3 6.6-6.6 0-3.4-2.4-5.9-5.4-5.9-.6 0-1.4.1-1.6.2C8.5 8.5 11.6 4.6 14.6 2.6L9.4 0zm16.5 0c-4.8 3.5-8.3 9.1-8.3 15.3 0 5.3 3.3 8.6 7.5 8.6 3.7 0 6.6-3 6.6-6.6 0-3.4-2.5-5.9-5.4-5.9-.6 0-1.4.1-1.6.2.5-3.3 3.6-7.1 6.7-9.1L25.9 0z"})}),c.jsx(kj,{className:"relative z-10 mb-3 h-4 w-4",count:i.rating||5}),c.jsxs("p",{className:"relative z-10 mb-4 line-clamp-6 flex-1 text-sm leading-relaxed text-neutral-600 dark:text-neutral-300",children:["„",i.text,'"']}),c.jsxs("div",{className:"relative z-10 mt-auto flex items-center gap-3",children:[i.photo?c.jsx("img",{src:i.photo,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded-full object-cover"}):c.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-brand-100 text-sm font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",children:i.name.charAt(0).toUpperCase()}),c.jsx("p",{className:"text-sm font-semibold text-neutral-900 dark:text-white",children:i.name})]})]})},`${i.name}-${o}`))})})}function ro(t,e,n={x:0,y:0}){const r=Math.max(0,Math.min(100,t==null?n.x:Number(t)||0)),s=Math.max(0,Math.min(100,e==null?n.y:Number(e)||0));return{left:`${r}%`,top:`${s}%`,transform:`translate(-${r}%, -${s}%)`}}const cO="/assets/gallery-dash2-CEVCErVK.webp",wj="/assets/gallery-amp-purple-CESAKuOf.webp",uO="/assets/gallery-speaker-CUXQZ49Q.webp",Sj="/assets/gallery-subs-COSd4seJ.webp",Nj="/assets/gallery-dash-Cg-7v9qo.webp",dO="/assets/hero-trunk-Dp4_JHDh.webp",hO="/assets/gallery-rear-8cIXPC7T.webp",fO="/assets/hero-highlight-Co4f1Kj5.webp",pO="/assets/youtube-hintergrund-C0osNxn7.mp4",dc={left:"text-left",center:"text-center",right:"text-right"},mO={left:"",center:"mx-auto",right:"ml-auto"},gO={eyebrow_de:"",eyebrow_en:"",title_de:"",title_en:"",body_html_de:"",body_html_en:"",text_align:"center",text_align_x:50,text_align_y:50,button_label_de:"",button_label_en:"",button_url:"",font_family:null};function Ov({label:t,url:e,className:n,style:r}){return!t||!e?null:e.startsWith("/")?c.jsx(ne,{to:e,className:n,style:r,children:t}):c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:n,style:r,children:t})}const xO=[{src:Sj,width:900,height:600},{src:wj,width:900,height:600},{src:uO,width:900,height:1200},{src:Nj,width:900,height:814},{src:hO,width:900,height:1200},{src:dO,width:1920,height:1280}];function yO(){const{hero_image_path:t}=hs(),e=t||cO,{t:n,language:r}=ct(),s=n("home.stats"),i=n("home.galleryAlts"),o=xO.map((K,X)=>({...K,alt:i[X]})),[a,l]=v.useState([]),[u,d]=v.useState({}),[h,p]=v.useState([]),f=K=>{const X=u[K]||gO;return{eyebrow:X[`eyebrow_${r}`]||"",title:X[`title_${r}`]||"",bodyHtml:X[`body_html_${r}`]||"",align:X.text_align||"center",alignX:X.text_align_x,alignY:X.text_align_y,buttonLabel:X[`button_label_${r}`]||"",buttonUrl:X.button_url||"",fontFamily:X.font_family||void 0}},m=ft("home_sections.hero.eyebrow"),x=ft("home_sections.hero.title"),y=ft("home_sections.youtube.eyebrow"),b=ft("home_sections.youtube.title"),g=ft("home_sections.youtube.button_label"),k=ft("home_sections.craft.eyebrow"),w=ft("home_sections.craft.title"),C=ft("home_sections.advice.eyebrow"),j=ft("home_sections.advice.title"),S=ft("home_sections.insights.eyebrow"),N=ft("home_sections.insights.title"),T=ft("home_sections.more.eyebrow"),E=ft("home_sections.more.title"),D=ft("home_sections.more.button_label");v.useEffect(()=>{A.get("/home-sections").then(d).catch(()=>{})},[]),v.useEffect(()=>{A.get("/partners").then(p).catch(()=>{})},[]);const[P,O]=v.useState(null),W=P?P.reviews.filter(K=>K.review_text).map(K=>({name:K.author_name,text:K.review_text,rating:K.rating,photo:K.profile_photo_url})):n("home.testimonials");v.useEffect(()=>{A.get("/faqs").then(K=>{l(K.map(X=>({question:r==="de"?X.question_de:X.question_en,answer:r==="de"?X.answer_de:X.answer_en})))}).catch(()=>{})},[r]),v.useEffect(()=>{A.get("/google-reviews").then(K=>{K.rating!=null&&K.reviews.some(X=>X.review_text)&&O(K)}).catch(()=>{})},[]),Gt({title:n("home.metaTitle"),description:n("home.metaDescription"),path:"/"}),v.useEffect(()=>{if(a.length===0)return;const K=document.createElement("script");return K.type="application/ld+json",K.text=JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:a.map(X=>({"@type":"Question",name:X.question,acceptedAnswer:{"@type":"Answer",text:X.answer}}))}),document.head.appendChild(K),()=>document.head.removeChild(K)},[a]);const I=v.useRef(null),{scrollYProgress:z}=mj({target:I,offset:["start start","end start"]}),q=Er(z,[0,1],["-6%","6%"]),R=Er(z,[0,1],["0%","60%"]),_=Er(z,[0,.8],[1,0]),$=Er(z,[.5,1],[0,1]),ee=Er($,K=>K>.05?"auto":"none"),te=Er(z,[.5,1],[16,0]);return c.jsxs("div",{children:[c.jsx(ir.div,{style:{opacity:$,pointerEvents:ee,y:te},className:"fixed inset-x-0 bottom-0 z-20 border-t border-neutral-200 bg-white/95 px-4 py-3 shadow-[0_-8px_24px_rgba(0,0,0,0.08)] backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/95 sm:px-6",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between gap-3",children:[c.jsx("p",{className:"hidden text-sm font-medium text-neutral-600 dark:text-neutral-300 sm:block",children:n("home.stickyCta")}),c.jsxs("div",{className:"flex w-full gap-3 sm:w-auto",children:[c.jsx(ne,{to:"/fahrzeuge",className:"flex-1 rounded-md bg-brand-500 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 sm:flex-none",children:n("home.selectVehicle")}),c.jsx(ne,{to:"/kontakt",className:"flex-1 rounded-md border border-neutral-300 px-5 py-2.5 text-center text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800 sm:flex-none",children:n("home.getInTouch")})]})]})}),c.jsxs("section",{ref:I,className:"relative -mt-[89px] h-dvh min-h-[560px] overflow-hidden sm:-mt-[97px]",children:[c.jsx(ir.img,{style:{y:q,scale:1.15},src:e,alt:n("home.heroImageAlt"),className:"absolute inset-0 h-full w-full object-cover"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-neutral-950 via-neutral-950/80 to-neutral-950/40"}),c.jsx(ir.div,{style:{y:R,opacity:_},className:"absolute inset-0",children:c.jsx("div",{className:"absolute w-full max-w-2xl px-4 text-center sm:px-6",style:{...ro(f("hero").alignX,f("hero").alignY,{x:50,y:50}),fontFamily:f("hero").fontFamily},children:c.jsxs(ir.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.7,ease:"easeOut"},children:[f("hero").eyebrow&&c.jsx("p",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-brand-400",style:m,children:f("hero").eyebrow}),c.jsx("h1",{className:"text-3xl font-extrabold tracking-tight text-white sm:text-5xl",style:x,children:f("hero").title}),c.jsx("div",{className:"legal-content mx-auto mt-4 max-w-2xl text-base text-neutral-200 sm:text-lg",dangerouslySetInnerHTML:{__html:f("hero").bodyHtml}}),c.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-3",children:[c.jsx(ne,{to:"/fahrzeuge",className:"rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 hover:shadow-lg",children:n("home.selectVehicle")}),c.jsx(ne,{to:"/kontakt",className:"rounded-md border border-white/30 bg-white/10 px-6 py-3 text-sm font-semibold text-white backdrop-blur transition hover:-translate-y-0.5 hover:bg-white/20",children:n("home.getInTouch")})]})]})})})]}),c.jsx("section",{className:"border-b border-neutral-200 bg-neutral-950 py-8 dark:border-neutral-800",children:c.jsx("div",{className:"mx-auto grid max-w-6xl grid-cols-2 gap-6 px-4 text-center sm:grid-cols-4 sm:px-6",children:s.map((K,X)=>c.jsxs(tt,{index:X,children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-400 sm:text-3xl",children:K.value}),c.jsx("p",{className:"text-sm text-neutral-400",children:K.label})]},K.label))})}),c.jsx("section",{className:"border-b border-neutral-200 py-8 dark:border-neutral-800",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsx("p",{className:"mb-4 text-center text-xs font-semibold uppercase tracking-wide text-neutral-400",children:n("home.brandsHeading")}),c.jsx("div",{className:"flex flex-wrap items-center justify-center gap-x-8 gap-y-3",children:h.map((K,X)=>c.jsx(tt,{index:X,children:K.logo_path?c.jsx("img",{src:K.logo_path,alt:K.name,className:"h-8 max-w-[8rem] object-contain opacity-70 grayscale transition hover:opacity-100 hover:grayscale-0"}):c.jsx("span",{className:"text-lg font-bold text-neutral-400 dark:text-neutral-600",children:K.name})},K.id))})]})}),c.jsxs("section",{className:"relative min-h-[70vh] overflow-hidden sm:min-h-[85vh]",children:[c.jsx("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,poster:Nj,className:"absolute inset-0 h-full w-full object-cover",children:c.jsx("source",{src:pO,type:"video/mp4"})}),c.jsx("div",{className:"absolute inset-0 bg-black/55"}),c.jsx("div",{className:"absolute w-full max-w-3xl px-4 text-center sm:px-6",style:{...ro(f("youtube").alignX,f("youtube").alignY,{x:50,y:50}),fontFamily:f("youtube").fontFamily},children:c.jsxs(tt,{children:[f("youtube").eyebrow&&c.jsx("p",{className:"mb-4 text-xs font-semibold uppercase tracking-[0.2em] text-neutral-200 sm:text-sm",style:y,children:f("youtube").eyebrow}),c.jsx("h2",{className:"text-3xl font-bold uppercase tracking-wide text-white sm:text-5xl",style:b,children:f("youtube").title}),c.jsx("div",{className:"legal-content mt-4 text-xs font-semibold uppercase tracking-wide text-neutral-200 sm:text-sm",dangerouslySetInnerHTML:{__html:f("youtube").bodyHtml}}),c.jsx(Ov,{label:f("youtube").buttonLabel,url:f("youtube").buttonUrl,className:"mt-8 inline-flex items-center justify-center rounded-full bg-white px-8 py-3 text-xs font-bold uppercase tracking-wide text-neutral-900 transition hover:-translate-y-0.5 hover:bg-neutral-100",style:g})]})})]}),c.jsx("section",{className:"grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40",children:c.jsxs("div",{className:"mx-auto max-w-6xl space-y-16 overflow-hidden px-4 sm:px-6",children:[c.jsxs("div",{className:"grid items-center gap-8 md:grid-cols-2",children:[c.jsx(tt,{direction:"left",shine:!0,className:"rounded-xl shadow-lg",children:c.jsx("img",{src:Sj,alt:n("home.craftImageAlt"),width:900,height:600,className:"w-full rounded-xl object-cover",style:{maxHeight:380}})}),c.jsxs(tt,{direction:"right",index:1,className:dc[f("craft").align],style:{fontFamily:f("craft").fontFamily},children:[f("craft").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:k,children:f("craft").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",style:w,children:f("craft").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:f("craft").bodyHtml}})]})]}),c.jsxs("div",{className:"grid items-center gap-8 md:grid-cols-2",children:[c.jsxs(tt,{direction:"left",className:`order-2 md:order-1 ${dc[f("advice").align]}`,style:{fontFamily:f("advice").fontFamily},children:[f("advice").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:C,children:f("advice").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",style:j,children:f("advice").title}),c.jsx("div",{className:"legal-content text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:f("advice").bodyHtml}})]}),c.jsx(tt,{direction:"right",index:1,shine:!0,className:"order-1 md:order-2 rounded-xl shadow-lg",children:c.jsx("img",{src:wj,alt:n("home.adviceImageAlt"),width:900,height:600,className:"w-full rounded-xl object-cover",style:{maxHeight:380}})})]})]})}),c.jsxs("section",{className:"mx-auto max-w-6xl px-4 py-16 sm:px-6",children:[c.jsxs(tt,{className:`mb-8 ${dc[f("insights").align]}`,style:{fontFamily:f("insights").fontFamily},children:[f("insights").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:S,children:f("insights").eyebrow}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",style:N,children:f("insights").title}),c.jsx("div",{className:"legal-content mt-2 text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:f("insights").bodyHtml}})]}),c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:o.map((K,X)=>c.jsx(tt,{index:X%3,shine:!0,className:"aspect-square overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsx("img",{src:K.src,alt:K.alt,width:K.width,height:K.height,loading:"lazy",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})},K.src))})]}),c.jsx("section",{className:"grain-band border-y border-neutral-200 bg-neutral-50 py-16 dark:border-neutral-800 dark:bg-neutral-900/40",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsxs(tt,{className:"mb-10 text-center",children:[c.jsx("div",{className:"mb-2 flex items-center justify-center gap-2",children:c.jsx(kj,{className:"h-6 w-6",count:P?Math.round(P.rating):5})}),c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:P?n("home.reviewsRatingDynamic")(P.rating,P.rating_count):n("home.reviewsRating")}),c.jsx("p",{className:"mt-1 text-neutral-600 dark:text-neutral-300",children:n("home.reviewsText")}),c.jsx("a",{href:"https://www.google.com/maps/search/?api=1&query=Hifi+Planet+Amorbach+Boxbrunner+Stra%C3%9Fe+20a",target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-block text-sm font-medium text-brand-600 hover:underline dark:text-brand-400",children:n("home.reviewsLink")})]}),c.jsx(tt,{children:c.jsx(lO,{testimonials:W})})]})}),c.jsx("section",{className:"mx-auto max-w-6xl overflow-hidden px-4 py-16 sm:px-6",children:c.jsxs("div",{className:"grid items-center gap-10 md:grid-cols-2",children:[c.jsx(tt,{direction:"left",shine:!0,className:"overflow-hidden rounded-xl shadow-lg",children:c.jsx("img",{src:fO,alt:n("home.moreImageAlt"),width:1600,height:905,className:"h-full w-full object-cover",loading:"lazy"})}),c.jsxs(tt,{direction:"right",index:1,className:`rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 ${dc[f("more").align]}`,style:{fontFamily:f("more").fontFamily},children:[f("more").eyebrow&&c.jsx("p",{className:"mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400",style:T,children:f("more").eyebrow}),c.jsx("h2",{className:"mb-3 text-2xl font-bold text-neutral-900 dark:text-white",style:E,children:f("more").title}),c.jsx("div",{className:`legal-content mb-8 max-w-2xl text-neutral-600 dark:text-neutral-300 ${mO[f("more").align]}`,dangerouslySetInnerHTML:{__html:f("more").bodyHtml}}),c.jsx(Ov,{label:f("more").buttonLabel,url:f("more").buttonUrl,className:"inline-block rounded-md border border-neutral-300 px-6 py-3 text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800",style:D})]})]})}),c.jsx("section",{className:"border-t border-neutral-300 py-16 dark:border-neutral-700",children:c.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[c.jsx(tt,{className:"mb-8 text-center",children:c.jsx("h2",{className:"text-2xl font-bold text-neutral-900 dark:text-white",children:n("home.faqHeading")})}),c.jsx(tt,{index:1,children:c.jsx(oO,{items:a})})]})})]})}function bO(){const[t,e]=v.useState([]),[n,r]=v.useState(""),s=ch(),{t:i}=ct(),o=J0();return Gt({title:i("vehicleSelect.metaTitle"),description:i("vehicleSelect.metaDescription"),path:"/fahrzeuge"}),v.useEffect(()=>{s.vehicles.enabled&&!s.bypass||A.get("/brands").then(e).catch(a=>r(a.message))},[s.vehicles.enabled,s.bypass]),s.vehicles.enabled&&!s.bypass?c.jsx(Tl,{message:s.vehicles.message}):c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[s.vehicles.enabled&&s.bypass&&c.jsx(Ml,{inline:!0}),c.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:i("vehicleSelect.title")}),c.jsx("p",{className:"mb-8 text-neutral-600 dark:text-neutral-300",children:i("vehicleSelect.intro")}),n&&c.jsx("p",{className:"text-red-600",children:n}),t.length===0&&!n&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:i("vehicleSelect.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:t.map(a=>c.jsxs(ne,{to:`/fahrzeuge/${a.slug}`,className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 py-8 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100",children:[a.image_path&&c.jsx("img",{src:a.image_path,alt:"",className:"h-16 w-full object-contain"}),c.jsx("span",{style:rl(o,`brands.${a.id}.name`),children:a.name})]},a.id))})]})}function vO(){const{brandSlug:t}=ii(),[e,n]=v.useState(null),[r,s]=v.useState(""),i=ch(),{t:o}=ct(),a=J0(),l=ft(e?`brands.${e.brand.id}.name`:"");return v.useEffect(()=>{i.vehicles.enabled&&!i.bypass||A.get(`/brands/${t}/models`).then(n).catch(u=>s(u.message))},[t,i.vehicles.enabled,i.bypass]),Gt({title:e?`${e.brand.name} ${o("brandPage.titleSuffix")}`:o("brandPage.metaTitleFallback"),description:e?o("brandPage.metaDescription")(e.brand.name):void 0,path:`/fahrzeuge/${t}`}),i.vehicles.enabled&&!i.bypass?c.jsx(Tl,{message:i.vehicles.message}):r?c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:r}):e?c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[i.vehicles.enabled&&i.bypass&&c.jsx(Ml,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/fahrzeuge",className:"hover:text-brand-500",children:o("brandPage.breadcrumbVehicles")})," / ",c.jsx("span",{style:l,children:e.brand.name})]}),c.jsxs("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:[c.jsx("span",{style:l,children:e.brand.name})," – ",o("brandPage.titleSuffix")]}),e.models.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:o("brandPage.empty")}),c.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3",children:e.models.map(u=>c.jsxs(ne,{to:`/fahrzeuge/${t}/${u.slug}`,className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 py-8 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100",children:[u.image_path&&c.jsx("img",{src:u.image_path,alt:"",className:"h-16 w-full object-contain"}),c.jsx("span",{style:rl(a,`car_models.${u.id}.name`),children:u.name})]},u.id))})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:o("brandPage.loading")})}function kO({text:t}){return t?t.split(/(\*\*[^*]+\*\*)/g).map((n,r)=>{const s=n.match(/^\*\*([^*]+)\*\*$/);return s?c.jsx("strong",{children:s[1]},r):c.jsx("span",{children:n},r)}):null}const Bv="data:image/webp;base64,UklGRmoNAABXRUJQVlA4IF4NAAAQjACdASrgAVYDPlEok0ajoqGhIRK4IHAKCWlu/F+5xDCoDux8VXNtc99B5Uf715Q+k/+V6E/yD7bfvf7tYI7QKys1Pu/n/K9wD+L/0L/aeqHflfZf937AH81/p//N/yXr9f9f+M/yf7c+4D6R/7n+O+BL9d+rb+0f//9yX9VQU+fHDhw4cN7KTkCBAgQIECBAgQIEB8GtgzU5WrVq1atWrVq1atTTWWxGRvDLM5r169evXr169evVcNgPhleRXp06dOnTp06dOnTpUIn65+OKaJVsmzZs2bNmzZs2bNmSyYC6ipEunTp06dOnTp06dOlydZVuN901q1atWrVq1atWrVXZqLYS16JYyeHDhw4cOHDhw4cN4wtQeDaQLgECBAgQIECBAgQIDddB6sEmQB2atWrVq1atWrVq1aq1iYS5JU9iBlzXr169evXr169evXeEPp+8N6OklatWrVq1atWrVq1V3IfqDdZ8CK1AgQIECBAgQIECBBQFoI3bXHSzdGb8+OHDhw4cOHDhw4ZwLNj/Gx48ePHjx48ePHjx5HaZ5q8hFQPLVq1atWrVq1atWrVWlrSSS1atWrVq1atWrVq1VouJ4vs1atWrVq1atWrVqzMNN6naRaj4OHDhw4cOHDhwzggYy8goXr169evXr169evXbAmy3nWg79+/fv379+/fv377Aw+GV3JG24BIkSJEiRIkSJEiRH091sORb3KZK2rVq1atWrVq1atWZgOgxn2g3CECBAgQIECBAgQHwEh4tRYq5WHRSJEiRIkSJEiRIkRmQ4gXd9q0Xa9evXr169evXr169SUP3aSDmqBOfHDhw4cOHDhw4cN/rYXzoW6jx48ePHjx48ePHjwyNgV/F/hRIkSJEiRIkSJEiRGcgeccx2x48ePHjx48ePHjx5+h2DL7y1q1atWrVq1atWrVqrLjxn1+UevXr169evXr169epWz/ixb7G7Fx48ePHjx48ePHjx64Dpo0+TFzjw4cOHDhw4cOHDhwr64/FOVqj1ftlBYsWLFixYsWLFixsB93m6MKtrfi/YePHjx48ePHjx48eGCFP4MdBX+BXbQiRIkSJEiRIkSJEiA+X4/Ne4l0FixYsWLFixYsWLTKZjxkHLs7TTrVq1atWrVq1atWrSGY83Cktx0PPjhw4cOHDhw4cN/7Xmd/H4DxEePHjx48ePHjx48ct7KWpas7p5jy5cuXLly5cuXLlyM+h2/gRIkSJEiRIkSJEiRAPRMs9EnbFixYsWLFixYsWLBwJstxClHwcOHDhw4cOHDhw3+o6GvCGxY8ePHjx48ePHjx45aAayr3BCnnxw4cOHDhw4cOG/2HuJWxIvK1JLZs2bNmzZs2bNmyAMNnZLnTo6dOnTp06dOnTp06Vd0rFPQfnwwCPHjx48ePHjx48eOU7jRhCFUn5bFixYsWLFixYsWKZRr/1LzwcOHDhw4cOHDhw4ZshIGgexQoECBAgQIECBAgQH+hD+jvXr169eu0AAP7/2BA2pStbx3f0LK6/mZcFuZpv73FLTm7GUv07j8lFLoOGX1EwKUHfPc4FImBkAvjxF1E2TgBogJKpQ2lbMv5bOqPckB4PELJo9ZXlMwGup4PkMOtTZPmrbNoaCJqn0H4Bx7A0xA439P5hkMGBnAEfInQIN5UeUIDb3y6tLej2gR8HhJ5XmTsxvmM15ltL5ZwdGmoNeW8NevUVUKqJ8mNngu7ocCsyGYaeYOGGZBBt6rj6bPVKVbxvb8onw6mljAaaxGTz0W+aNPv06kK3qhDe6/uHi8kg2qvjF3njhRMyOJKZzg12h4qOtVgTuKPAMRWYDkgwiRs9iYqcumonNNXvXk3FAk2LO5XnyjtD5sHSUO3pIrztpBvqq+UJzKeIwGBlPwA2NP46tOJxLzbrKeH4SQjt2HAsbrVcQ/b/TgKZGPwaqfGDN+OjqJK3Z9dyCkGGfGKeG1w9+HSZTm/qh052lQEJAcdUX6vm/+sDBxtrfl4Sg8iMcVnDsfTKJpsTYF/vzJ1oQ6/VPyIX1HpDwnPXsptu9rKDFazlkwc3ofi8uKJmycgPiG9xOLlzn4Af8Dm+LcjJUMAtA7XeZPLlW1bwogbRthU8oA4LcURuku6eXDJ1eb1IKUU7k/UK0cBeK+R5YVcmrOnZIyHzcIaClYnrIwerP535fHv4VXjURTO6/85BvSeTNWvQGqkW5v1hG6AEMrxBryfat3kmr+SNEz5wC2f54z1O7C2KsRpt3maISh9PhMg7jDIxmVe07eHtkLtz6v3yQUJQV95yazDYpH5JfpuYSb8dtmB1cKjeoDTPvik9dCA1UFCTZBfojpIOwXdwAR7JEdZkEi/24hMNKJJlB6udZZKqNJB1hNl24Z++z6lAGSAuRgSwDZGdbqxs+0iL6wmRHilqPOiYB6hQiPZ7cfpMZxesqRwyhcf1O29w4ORG/7BlerR8hYvY4B1XsPYbDORvPk6FHIDXwTXGpuDIta7G4F6RNDdOvCFkAl53GZo5h/p2QkWUry5YuyegnPlKjT3He6ewYypA9YOvMhaqip7kr9sF4TU2bX9foKZ+FFZNzhyySS+13+g4BdJo9YF3bw5b6eSxUfTWiDLNh50VjuqRQWHUEkiA8zJqnqkKCwuDy6iY2oF20FJQlGIPpCDKPBzdXSb/n9NDltaoUlbam7cDAU7CwNdaWFXTABRk0S0e49iF4tO106Uwul7DGYpq0Eu71TnKUjCtEBc83QH8skvRzHniEne3AtJLYRH0cMNSSzeCJ1g+Nfc8RaZkhLhCaZGZdYe5j0LGmQnVFt2iapZvGBi7Sw0X56zdziC9Foq0OPsqKFetZdICc2eUV5Vu1+nvisSzn8wlSDUt3OmRkt/gJxfJQfWxcu5HZ26qqNpA4ablWrX4E9DEmvXzpFGYCnYJMheN2BlWwBVLh1cyQ8INngXaoB8I5Pj9oYyuz/W+jvJQ6G074luX9D3pLkuc88D0Hae3ZqXrRYRzGF1vD8pHsk9Co8B6rpE/4GEwW/zsCtnjz5G8m4KFwf2qW1k0HkNv7Nlg38bcz6TdTzuw/jega5XZQQhflLu4I6l+s90BHFIR+JEXTBBqJwT+IgTnpHNc+h5Ek74HiKqXuGUNGIKIozHkiFxMlnrsklrpweBzYY6ype9CzepAuQF63xC/eIJw1pMZEC1pPgq/r+1gWx5M6g8fpu2O12sb6pLeqT+G4mK3yHMZTojfp1xwQedRmwZnWQ8SCh4XV2a/+3OTz4D4pmmumyBV7V2VW3he8y6usinSjfYPxLyTng27fgw6jQhHl2mVhxBBjiwr5ljvJV7L+MJYDiZjGWfBCsTmehk6rbNt7ahTJpHu4B9ctRqiZXjx0zGpTF91OKifmy4nTq31p1XaIsZAHCWvItXKeke06KKKRTIm6mCT9yBJVwG1sqQhjrkP77q0/JGYgOwgdCQCstsAZQ0FlOrGYXYTIQK/krLyCAZjg8vP/Ers/KVN8F88OsyU5/T1e5ba8A2F63qgwhtkWoVIEZErOVL8sM/DtpWTlcBNsvVOFl4tT+Sk6a2ScCptFL5F6cZXTIw8JmgoCbyqB6xyU+uPP5y09s5T8MDC7Em7NpxCjgD39eed40gHQrBm6CtAbS9JOCVPkPxbpcGDj/LoAGbnyYzMpOmTi28LJ9FTIqyGuAI0jxY/QpNelOOEvNK3io1HeYkK3AprImDk99tlUjgt9bc3ejCOFDXt9LqGHjFssGrhVHyJBmWjwHQipcIMHxF2jfP5jfAGuHtJRRncHIFgLWmJ1XmzJ0LLqWCJShdJSJLc7L6YeVcgKfzOZCwhtzJ7VeI3uBhPXQNOqCf5tlQ32HApAMvCIiBwhYrpfFo/kvjfTMB/NJ0w2Lk8GAFfFQY+U6uX1oB0hztGmA5HggJTwgLo8exG64m3Xu4fg2g4MmQol7z6xNwwubABnpoS3Og85giFkaarUP2ovQyixFpXki8Xf5a5NwjUGCPbx+LD3WKJiBtkiHsYMMV/VAZVNvdg/Ph/V4ZYOr+hw7g9mOJXi+oVZxG9pqJC9w8nRkegsnQ2lpRHn22lTsIa9aOkR0X8zp/IajQxUzv057a3WptBst0EZbZtfmWp6h2K0sDQS9oQT1PqOkGDJlz6ZHZzDMShDTcwJfIZMdnjpeHdPoYoqlcn3M8daRuMeTSP3mabP1/pdQrs6Wl7ToKog2Au/gv46pUMgVcKmdWNJdDF8RplMMXJpU2tZMdkTWq4ofSypsCfuWfeHOpFQGJdFF6OoH2pDJXvkqpj1a832g3uYtVQg1TGyqYqI7UBZQy4NEZbdj6O/s6MNEnfujUDQ8QZj7rSE2RI77egKDWzM708AsvlMFoeX4CVP09rMzXNP2aOZwY7zOBTvBgEEqCWlXAFlY8pW0zIm16gqSPiwRUgH41i1PuJx382C0zTWGT243ZhLnyOIlreUrMQAfwR/oYt+ljnDFKqa5PEczDPa+u/vWmR6UM+Q/lLFiIlgBJTfaekWoeLpPd9FPN4gIHzK1ZS8kDHyq3lh/e6FQ84a4Zg6JlfQC/qhAAAAA==",wO="/assets/base-BKOm0Bib.webp",SO="/assets/clear-DZZMSrMX.webp",NO="/assets/drive-BE2W1yna.webp",CO="/assets/prime-BTVNe2Gb.webp",jO="/assets/elite_r-BRvz_pyr.webp",EO="/assets/apex-CFy2qup8.webp",TO="/assets/statement-pTO-wTPx.webp",MO="/assets/limitless-DDs0S_PU.webp",PO=(t,e,n)=>{e/=100,n/=100;const r=o=>(o+t/30)%12,s=e*Math.min(n,1-n),i=o=>n-s*Math.max(-1,Math.min(r(o)-3,Math.min(9-r(o),1)));return[Math.round(i(0)*255),Math.round(i(8)*255),Math.round(i(4)*255)]},Ef=(t,e,n)=>`rgb(${PO(t,e,n).join(", ")})`,zv=t=>t.map(([e,n,r,s,i,o])=>({bgTop:Ef(e,n,r),border:Ef(e,n,r+8),accent:Ef(s,i,o),img:null})),Fv={graphite:[{accent:"#b6b6b6",border:"#2a2a2a",bgTop:"#1c1c1c",img:wO},{accent:"#d3d3d3",border:"#2e2e2e",bgTop:"#212121",img:SO},{accent:"#8fb8bd",border:"#26383b",bgTop:"#16282b",img:NO},{accent:"#6fbf73",border:"#1f3a24",bgTop:"#122916",img:CO},{accent:"#63d34f",border:"#204a1c",bgTop:"#123312",img:jO},{accent:"#8bea3c",border:"#2b5518",bgTop:"#173a0f",img:EO},{accent:"#d9a83c",border:"#4a3a16",bgTop:"#33270d",img:TO},{accent:"#f2c14e",border:"#5a4718",bgTop:"#3d2f0c",img:MO}],"deep-blue":zv([[215,18,11,210,15,60],[212,25,11,208,32,60],[210,38,12,206,46,60],[212,46,12,205,56,61],[214,52,12,205,63,62],[216,58,12,205,68,63],[220,62,12,212,73,65],[226,66,12,216,78,68]]),"warm-bronze":zv([[30,15,11,34,22,60],[34,32,11,34,46,60],[32,46,12,30,58,60],[26,52,12,24,65,60],[20,55,12,18,68,60],[14,55,12,12,68,61],[8,52,12,6,64,62],[2,50,12,358,60,63]])},AO="#f2f2f2",DO="#8a8a8a",LO="#c4c4c4",Vv=5;function RO({pkg:t,tier:e,tierT:n,layout:r,bullets:s,formatPrice:i,contactUrl:o,t:a}){const[l,u]=v.useState(!1),d=s.length-Vv,h=l?s:s.slice(0,Vv),p=J0(),f=rl(p,`packages.${t.id}.description`),m=rl(p,`packages.${t.id}.price_text`),x=e.img?null:{backgroundColor:e.accent,WebkitMaskImage:`url(${Bv})`,maskImage:`url(${Bv})`,maskMode:"luminance",WebkitMaskSize:"cover",maskSize:"cover",WebkitMaskPosition:"center",maskPosition:"center",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat"};return c.jsxs("div",{style:{borderColor:e.border,background:`linear-gradient(180deg, ${e.bgTop} 0%, #0b0b0b 55%, #080808 100%)`},className:r==="strip"?"relative flex min-h-[420px] grow shrink basis-[190px] min-w-[190px] max-w-[240px] snap-start flex-col overflow-hidden rounded-[18px] border shadow-xl shadow-neutral-900/20 dark:shadow-black/40 sm:min-h-[640px] sm:basis-[210px]":r==="coverflow"?"relative flex min-h-[420px] w-[230px] shrink-0 snap-center flex-col overflow-hidden rounded-[18px] border shadow-xl shadow-neutral-900/20 will-change-transform dark:shadow-black/40 sm:min-h-[640px]":"relative flex min-h-[420px] flex-col overflow-hidden rounded-[18px] border shadow-xl shadow-neutral-900/20 dark:shadow-black/40 sm:min-h-[640px]",children:[e.img?c.jsx("img",{src:e.img,alt:"","aria-hidden":"true",className:"pointer-events-none absolute inset-0 h-full w-full object-cover"}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"pointer-events-none absolute inset-0",style:{...x,opacity:.2+n*.45,filter:"blur(18px)"},"aria-hidden":"true"}),c.jsx("div",{className:"pointer-events-none absolute inset-0",style:{...x,opacity:.55+n*.45},"aria-hidden":"true"})]}),t.is_featured&&c.jsx("span",{className:"absolute top-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-brand-500 px-3 py-1 text-xs font-bold text-white shadow",children:a("modelPage.featuredBadge")}),c.jsxs("div",{className:"relative z-10 text-center",style:{padding:"34px 20px 0"},children:[c.jsx("div",{style:{fontFamily:"'Barlow Condensed', sans-serif",fontSize:"30px",letterSpacing:"3px",fontWeight:600,color:e.accent,textTransform:"uppercase",lineHeight:1.1},children:t.name}),c.jsx("div",{style:{width:"44px",height:"2px",margin:"14px auto 0",background:`linear-gradient(90deg, rgba(255,255,255,0) 0%, ${e.accent} 50%, rgba(255,255,255,0) 100%)`}})]}),s.length>0&&c.jsxs("div",{className:"relative z-10",style:{padding:"18px 20px 14px",background:l?"linear-gradient(180deg, rgba(8,8,8,0.7) 0%, rgba(8,8,8,0.62) 94%, rgba(8,8,8,0) 100%)":"linear-gradient(180deg, rgba(8,8,8,0.55) 0%, rgba(8,8,8,0.48) 92%, rgba(8,8,8,0) 100%)"},children:[c.jsx("ul",{className:"space-y-1.5 text-left",children:h.map((y,b)=>c.jsxs("li",{className:"flex items-start gap-2",style:{fontSize:"13px",color:LO,...y.fromDescription?f:null},children:[c.jsx(vt,{name:"check",className:"mt-0.5 h-3.5 w-3.5 shrink-0",style:{color:e.accent}}),c.jsx("span",{className:"leading-snug",children:y.fromDescription?c.jsx(kO,{text:y.text}):y.text})]},b))}),d>0&&c.jsxs("button",{type:"button",onClick:()=>u(y=>!y),className:"mt-2.5 flex items-center gap-1 hover:opacity-80",style:{fontSize:"13px",color:e.accent},children:[l?a("modelPage.lessBullets"):a("modelPage.moreBullets")(d),c.jsx(vt,{name:l?"chevron-up":"chevron-down",className:"h-3.5 w-3.5"})]})]}),c.jsx("div",{className:"relative z-10 flex-1"}),c.jsx("div",{className:"relative z-10",style:{padding:"20px 20px 28px",background:"linear-gradient(180deg, rgba(8,8,8,0) 0%, rgba(8,8,8,0.85) 45%, rgba(8,8,8,0.95) 100%)"},children:c.jsxs("div",{className:"text-center",children:[!t.price_text&&c.jsx("div",{style:{fontSize:"13px",color:DO},children:a("modelPage.totalPrice")}),c.jsx("div",{style:{marginTop:"4px",fontFamily:"'Barlow Condensed', sans-serif",fontSize:"30px",fontWeight:600,letterSpacing:"1px",color:AO,...t.price_text?m:null},children:t.price_text||i(t.total_price)}),c.jsx(ne,{to:o(t),className:"mt-4 inline-block rounded-md bg-brand-500 px-4 py-2 text-center text-sm font-semibold text-white shadow-lg shadow-brand-500/30 hover:bg-brand-400",children:a("modelPage.requestContact")})]})})]})}function _O(){const{brandSlug:t,modelSlug:e}=ii(),[n,r]=v.useState(null),[s,i]=v.useState(""),o=ch(),{t:a,language:l}=ct(),{package_card_theme:u,package_card_layout:d,package_wheel_hint_interval:h}=hs(),p=Fv[u]||Fv.graphite,f=["grid","strip","coverflow"].includes(d)?d:"strip",m=Math.max(2,Number(h)||8)*1e3,x=v.useRef(null),y=v.useRef(null),b=v.useRef(null),[g,k]=v.useState(!1),w=P=>new Intl.NumberFormat(l==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(P);v.useEffect(()=>{o.vehicles.enabled&&!o.bypass||A.get(`/models/${t}/${e}/packages`).then(r).catch(P=>i(P.message))},[t,e,o.vehicles.enabled,o.bypass]),v.useEffect(()=>{const P=x.current;if(f!=="coverflow"||!P)return;let O=0;const W=()=>{O=0;const q=P.scrollLeft+P.clientWidth/2;for(const R of P.children){const _=R.offsetLeft+R.offsetWidth/2,$=Math.max(-1,Math.min(1,(_-q)/(R.offsetWidth*1.4))),ee=Math.abs($);R.style.transform=`rotateY(${(-$*35).toFixed(2)}deg) scale(${(1-ee*.13).toFixed(3)}) translateZ(${(-ee*60).toFixed(1)}px)`,R.style.zIndex=String(100-Math.round(ee*50))}},I=()=>{O||(O=requestAnimationFrame(W))};W(),P.addEventListener("scroll",I,{passive:!0});const z=new ResizeObserver(I);return z.observe(P),()=>{P.removeEventListener("scroll",I),z.disconnect(),cancelAnimationFrame(O)}},[f,n]),v.useEffect(()=>{const P=x.current;if(f==="grid"||!P)return;const O=window.matchMedia("(pointer: coarse)").matches;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let I=[],z=0;const q=()=>{const _=Math.min(P.clientWidth*.4,160);I.push(setTimeout(()=>P.scrollTo({left:_,behavior:"smooth"}),500)),I.push(setTimeout(()=>P.scrollTo({left:0,behavior:"smooth"}),1250)),O||(I.push(setTimeout(()=>k(!0),450)),I.push(setTimeout(()=>k(!1),1700)))},R=new IntersectionObserver(([_])=>{_.isIntersecting&&(R.disconnect(),q(),z=setInterval(()=>{P.scrollLeft<=1&&q()},m))},{threshold:.35});return R.observe(P),()=>{R.disconnect(),clearInterval(z),I.forEach(clearTimeout)}},[f,n,m]),v.useEffect(()=>{const P=x.current;if(f==="grid"||!P)return;let O=0,W=0,I=!1,z=0,q=0;const R=()=>[...P.children].map(te=>te.offsetLeft+te.offsetWidth/2),_=(te,K)=>{let X=0,ae=1/0;return te.forEach((ue,Ge)=>{const fn=Math.abs(ue-K);fn{I=!1;const te=R();if(!te.length)return;const K=P.scrollLeft+P.clientWidth/2,X=_(te,K);let ae=X;X===z&&Math.abs(q)>4&&(ae=q>0?Math.min(z+1,te.length-1):Math.max(z-1,0));const ue=P.scrollWidth-P.clientWidth,Ge=Math.max(0,Math.min(te[ae]-P.clientWidth/2,ue));P.scrollTo({left:Ge,behavior:"smooth"}),clearTimeout(W),W=setTimeout(()=>{P.style.scrollSnapType=""},450)},ee=te=>{if(Math.abs(te.deltaX)>Math.abs(te.deltaY))return;const K=P.scrollWidth-P.clientWidth;if(K<=1)return;const X=P.scrollLeft<=1,ae=P.scrollLeft>=K-1;te.deltaY<0&&X||te.deltaY>0&&ae||(te.preventDefault(),I||(I=!0,q=0,z=_(R(),P.scrollLeft+P.clientWidth/2)),q+=te.deltaY,P.style.scrollSnapType="none",P.scrollLeft+=te.deltaY,clearTimeout(O),O=setTimeout($,150))};return P.addEventListener("wheel",ee,{passive:!1}),()=>{P.removeEventListener("wheel",ee),clearTimeout(O),clearTimeout(W)}},[f,n]),v.useEffect(()=>{const P=x.current,O=y.current,W=b.current;if(f==="grid"||!P||!O||!W)return;let I=0;const z=()=>{I=0;const ae=P.scrollWidth-P.clientWidth;if(ae<=1){O.style.opacity="0",O.style.pointerEvents="none";return}O.style.opacity="1",O.style.pointerEvents="auto";const ue=O.clientWidth,Ge=Math.max(32,P.clientWidth/P.scrollWidth*ue);W.style.width=`${Ge}px`,W.style.transform=`translateX(${(P.scrollLeft/ae*(ue-Ge)).toFixed(1)}px)`},q=()=>{I||(I=requestAnimationFrame(z))};z(),P.addEventListener("scroll",q,{passive:!0});const R=new ResizeObserver(q);R.observe(P);let _=!1,$=0;const ee=ae=>{const ue=O.getBoundingClientRect(),Ge=W.clientWidth,fn=Math.min(Math.max(ae-ue.left-$,0),ue.width-Ge);P.scrollLeft=fn/(ue.width-Ge)*(P.scrollWidth-P.clientWidth)},te=ae=>{_=!0,O.setPointerCapture(ae.pointerId),P.style.scrollSnapType="none";const ue=W.getBoundingClientRect();$=ae.clientX>=ue.left&&ae.clientX<=ue.right?ae.clientX-ue.left:W.clientWidth/2,ae.clientX>=ue.left&&ae.clientX<=ue.right||ee(ae.clientX)},K=ae=>{_&&ee(ae.clientX)},X=ae=>{var ue;_&&(_=!1,(ue=O.hasPointerCapture)!=null&&ue.call(O,ae.pointerId)&&O.releasePointerCapture(ae.pointerId),P.style.scrollSnapType="")};return O.addEventListener("pointerdown",te),O.addEventListener("pointermove",K),O.addEventListener("pointerup",X),O.addEventListener("pointercancel",X),()=>{P.removeEventListener("scroll",q),R.disconnect(),cancelAnimationFrame(I),O.removeEventListener("pointerdown",te),O.removeEventListener("pointermove",K),O.removeEventListener("pointerup",X),O.removeEventListener("pointercancel",X)}},[f,n]),Gt({title:n?a("modelPage.metaTitle")(n.model.brand_name,n.model.name):a("modelPage.metaTitleFallback"),description:n?a("modelPage.metaDescription")(n.model.brand_name,n.model.name):void 0,path:`/fahrzeuge/${t}/${e}`});const C=ft(n?`car_models.${n.model.id}.name`:"");if(o.vehicles.enabled&&!o.bypass)return c.jsx(Tl,{message:o.vehicles.message});if(s)return c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:s});if(!n)return c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:a("modelPage.loading")});const{model:j,packages:S}=n,N=new Map([...S].sort((P,O)=>P.total_price-O.total_price).map((P,O)=>[P.id,O])),T=P=>{const O=S.length,W=N.get(P.id)??0,I=O<=1?0:W/(O-1),z=Math.round(I*(p.length-1));return{tier:p[z],tierT:I}},E=P=>[...P.products.map(O=>({text:O.name_override||O.scraped_name||a("modelPage.productLoading"),fromDescription:!1})),...(P.description||"").split(`
+`).map(O=>O.trim()).filter(Boolean).map(O=>({text:O,fromDescription:!0}))],D=P=>`/kontakt?${new URLSearchParams({brand:j.brand_name,model:j.name,package:P.name,packageId:P.id,total:P.total_price}).toString()}`;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mx-auto max-w-6xl px-4 pt-12 sm:px-6",children:[o.vehicles.enabled&&o.bypass&&c.jsx(Ml,{inline:!0}),c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/fahrzeuge",className:"hover:text-brand-500",children:a("modelPage.breadcrumbVehicles")})," /"," ",c.jsx(ne,{to:`/fahrzeuge/${t}`,className:"hover:text-brand-500",children:j.brand_name})," / ",c.jsx("span",{style:C,children:j.name})]}),c.jsxs("h1",{className:`text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl ${S.length?"mb-2":"mb-8"}`,children:[j.brand_name," ",c.jsx("span",{style:C,children:j.name})," – ",a("modelPage.titleSuffix")]}),S.length===0&&c.jsx("p",{className:"pb-12 text-neutral-500 dark:text-neutral-400",children:a("modelPage.empty")})]}),S.length>0&&c.jsx("section",{className:"py-10 sm:py-14",style:{fontFamily:"'Barlow', sans-serif"},children:c.jsxs("div",{className:f==="grid"?"mx-auto max-w-6xl px-4 sm:px-6":"relative mx-auto max-w-[1880px] px-4 sm:px-6",children:[c.jsx("div",{ref:f==="grid"?void 0:x,className:f==="grid"?"grid items-start gap-[18px] sm:grid-cols-2 xl:grid-cols-3":"flex select-none items-start gap-[18px] overflow-x-auto pb-3 snap-x snap-mandatory [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:f==="coverflow"?{perspective:"1200px",paddingLeft:"calc(50% - 115px)",paddingRight:"calc(50% - 115px)",paddingTop:"10px"}:void 0,children:S.map(P=>{const{tier:O,tierT:W}=T(P);return c.jsx(RO,{pkg:P,tier:O,tierT:W,layout:f,bullets:E(P),formatPrice:w,contactUrl:D,t:a},P.id)})}),f!=="grid"&&c.jsx("div",{className:`pointer-events-none absolute inset-x-0 top-1/2 z-[200] flex -translate-y-1/2 justify-center transition-opacity duration-300 ${g?"opacity-100":"opacity-0"}`,"aria-hidden":"true",children:c.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-white/10 bg-neutral-900/85 px-4 py-2 text-xs font-medium text-white shadow-lg backdrop-blur-sm",children:[c.jsx(fM,{className:"h-3.5 w-3.5 text-brand-400"}),c.jsx(pM,{className:"h-4 w-4 text-brand-400"}),c.jsx(mM,{className:"h-3.5 w-3.5 text-brand-400"}),c.jsx("span",{children:a("modelPage.wheelHint")})]})}),f!=="grid"&&c.jsx("div",{ref:y,className:"relative mx-auto mt-5 h-2 w-56 max-w-full cursor-pointer rounded-full bg-neutral-900/10 transition-opacity duration-200 dark:bg-white/10",style:{touchAction:"none"},"aria-hidden":"true",children:c.jsx("div",{ref:b,className:"absolute left-0 top-0 h-full rounded-full bg-brand-500 shadow-[0_0_10px_rgba(107,166,38,0.7)]",style:{width:"48px"}})})]})})]})}function IO(){const[t,e]=v.useState(null),[n,r]=v.useState(""),{t:s}=ct(),{gallery_card_text_x:i,gallery_card_text_y:o}=hs();return Gt({title:s("galleryOverview.metaTitle"),description:s("galleryOverview.metaDescription"),path:"/galerie"}),v.useEffect(()=>{A.get("/gallery-brands").then(e).catch(a=>r(a.message))},[]),c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:s("galleryOverview.title")}),c.jsx("p",{className:"mb-8 text-neutral-600 dark:text-neutral-300",children:s("galleryOverview.intro")}),n&&c.jsx("p",{className:"text-red-600",children:n}),!t&&!n&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("galleryOverview.loading")}),t&&t.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("galleryOverview.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:t==null?void 0:t.map(a=>c.jsxs(ne,{to:`/galerie/${a.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[a.cover_image_path?c.jsx("img",{src:a.cover_image_path,alt:a.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):c.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),c.jsx("span",{className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:ro(i,o,{x:0,y:100}),children:a.name})]},a.id))})]})}function OO(){const{brandSlug:t}=ii(),[e,n]=v.useState(null),[r,s]=v.useState(""),{t:i}=ct(),{gallery_card_text_x:o,gallery_card_text_y:a}=hs();return v.useEffect(()=>{A.get(`/gallery-brands/${t}/projects`).then(n).catch(l=>s(l.message))},[t]),Gt({title:e?i("galleryBrandPage.metaTitle")(e.brand.name):i("galleryBrandPage.metaTitleFallback"),description:e?i("galleryBrandPage.metaDescription")(e.brand.name):void 0,path:`/galerie/${t}`}),r?c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:r}):e?c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/galerie",className:"hover:text-brand-500",children:i("galleryBrandPage.breadcrumbGallery")})," / ",e.brand.name]}),c.jsxs("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:[e.brand.name," – ",i("galleryBrandPage.titleSuffix")]}),e.projects.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:i("galleryBrandPage.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:e.projects.map(l=>c.jsxs(ne,{to:`/galerie/${t}/${l.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[l.cover_image_path?c.jsx("img",{src:l.cover_image_path,alt:l.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):c.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),c.jsx("span",{className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:ro(o,a,{x:0,y:100}),children:l.name})]},l.id))})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:i("galleryBrandPage.loading")})}function BO({photos:t,index:e,onClose:n,onNavigate:r}){const{t:s}=ct();if(v.useEffect(()=>{if(e==null)return;const a=l=>{l.key==="Escape"&&n(),l.key==="ArrowRight"&&r(1),l.key==="ArrowLeft"&&r(-1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,n,r]),e==null)return null;const i=t[e],o=a=>a.stopPropagation();return Qd.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/90 p-4",onClick:n,children:[c.jsx("button",{onClick:a=>{o(a),n()},"aria-label":s("lightbox.close"),className:"absolute right-4 top-4 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-7 w-7",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6l12 12M18 6 6 18"})})}),t.length>1&&c.jsx("button",{onClick:a=>{o(a),r(-1)},"aria-label":s("lightbox.previous"),className:"absolute left-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:left-4",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m15 18-6-6 6-6"})})}),c.jsx("img",{src:i.image_path,alt:i.caption||"",onClick:o,className:"max-h-[85vh] max-w-full rounded-lg object-contain"}),t.length>1&&c.jsx("button",{onClick:a=>{o(a),r(1)},"aria-label":s("lightbox.next"),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:right-4",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9 18 6-6-6-6"})})}),i.caption&&c.jsx("p",{onClick:o,className:"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-black/60 px-4 py-1.5 text-sm text-white",children:i.caption})]}),document.body)}function zO(){const{brandSlug:t,projectSlug:e}=ii(),[n,r]=v.useState(null),[s,i]=v.useState(""),[o,a]=v.useState(null),{t:l}=ct();v.useEffect(()=>{A.get(`/gallery-brands/${t}/${e}/photos`).then(r).catch(d=>i(d.message))},[t,e]),Gt({title:n?`${n.project.name} – ${n.project.brand_name}`:l("galleryProjectPage.metaTitleFallback"),description:n?l("galleryProjectPage.metaDescription")(n.project.name):void 0,path:`/galerie/${t}/${e}`});const u=d=>{a(h=>{const p=n.photos.length;return(h+d+p)%p})};return s?c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:s}):n?c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[c.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[c.jsx(ne,{to:"/galerie",className:"hover:text-brand-500",children:l("galleryProjectPage.breadcrumbGallery")})," /"," ",c.jsx(ne,{to:`/galerie/${t}`,className:"hover:text-brand-500",children:n.project.brand_name})," / ",n.project.name]}),c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:n.project.name}),n.photos.length===0&&c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:l("galleryProjectPage.empty")}),c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:n.photos.map((d,h)=>c.jsx(tt,{index:h%6,shine:!0,className:"aspect-square overflow-hidden rounded-xl",children:c.jsx("button",{onClick:()=>a(h),className:"block h-full w-full","aria-label":d.caption||l("galleryProjectPage.enlargeImage"),children:c.jsx("img",{src:d.image_path,alt:d.caption||"",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})})},d.id))}),c.jsx(BO,{photos:n.photos,index:o,onClose:()=>a(null),onNavigate:u})]}):c.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:l("galleryProjectPage.loading")})}function FO(){const[t,e]=v.useState([]),n=ch(),{t:r}=ct();return v.useEffect(()=>{A.get("/services").then(e).catch(()=>e([]))},[]),Gt({title:r("leistungen.metaTitle"),description:r("leistungen.metaDescription"),path:"/leistungen"}),n.services.enabled&&!n.bypass?c.jsx(Tl,{message:n.services.message}):c.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[n.services.enabled&&n.bypass&&c.jsx(Ml,{inline:!0}),c.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:r("leistungen.title")}),c.jsx("p",{className:"mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300",children:r("leistungen.intro")}),c.jsx("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:t.map((s,i)=>c.jsxs(tt,{index:i%3,shine:!0,className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"relative aspect-[4/3]",children:[s.image_path&&c.jsx("img",{src:s.image_path,alt:s.title,className:"h-full w-full object-cover",loading:"lazy"}),c.jsx("div",{className:"absolute -bottom-5 left-5 flex h-12 w-12 items-center justify-center rounded-full bg-brand-500 text-white shadow-lg ring-4 ring-white dark:ring-neutral-900",children:c.jsx(vt,{name:s.icon_name,className:"h-6 w-6"})})]}),c.jsxs("div",{className:"p-6 pt-8",children:[c.jsx("h2",{className:"mb-2 font-semibold text-neutral-900 dark:text-white",children:s.title}),c.jsx("p",{className:"mb-3 text-sm text-neutral-600 dark:text-neutral-300",children:s.description}),c.jsxs(ne,{to:s.cta_url||"/kontakt",className:"text-sm font-semibold text-brand-600 hover:underline dark:text-brand-400",children:[s.cta_label||r("leistungen.contact")," →"]})]})]},s.id))}),c.jsxs("div",{className:"mt-12 rounded-xl border border-neutral-200 bg-neutral-50 p-8 text-center dark:border-neutral-800 dark:bg-neutral-900/40",children:[c.jsx("h2",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:r("leistungen.notListedTitle")}),c.jsx("p",{className:"mb-5 text-neutral-600 dark:text-neutral-300",children:r("leistungen.notListedText")}),c.jsx(ne,{to:"/kontakt",className:"inline-block rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white hover:bg-brand-600",children:r("leistungen.contact")})]})]})}function VO({name:t,description:e,className:n="",children:r}){const{consent:s,acceptAll:i,openSettings:o}=wo();return s.external?r:c.jsxs("div",{className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-neutral-50 p-6 text-center dark:border-neutral-800 dark:bg-neutral-900/40 ${n}`,children:[c.jsx("p",{className:"text-sm text-neutral-600 dark:text-neutral-300",children:e||`${t} wird erst nach deiner Zustimmung geladen, da dabei Daten an Google übertragen werden.`}),c.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[c.jsx("button",{type:"button",onClick:i,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:"Laden erlauben"}),c.jsx("button",{type:"button",onClick:o,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Cookie-Einstellungen"})]})]})}const Cj=t=>(t||"").replace(/[^\d+]/g,""),$O=t=>`https://wa.me/${Cj(t).replace(/^0/,"49").replace("+","")}`,Zc={fontFamily:"'Michroma', sans-serif"};function HO({className:t}){return c.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:c.jsx("path",{d:"M12 2a10 10 0 0 0-8.6 15l-1.3 4.8 5-1.3A10 10 0 1 0 12 2zm0 2a8 8 0 1 1-4.2 14.8l-.3-.2-2.6.7.7-2.5-.2-.3A8 8 0 0 1 12 4zm4.3 9.9c-.2-.1-1.4-.7-1.6-.8s-.4-.1-.5.1l-.7.9c-.1.1-.3.2-.5.1a6.5 6.5 0 0 1-3.2-2.8c-.1-.2 0-.4.1-.5l.4-.5.2-.4v-.4l-.7-1.7c-.2-.4-.4-.4-.5-.4h-.5c-.2 0-.4.1-.6.3-.7.7-.9 1.6-.6 2.7.5 1.7 1.6 3.1 3.4 4.2 1.7 1 2.5 1 3.4.9.5-.1 1.4-.6 1.6-1.1.2-.5.2-1 .1-1.1z"})})}function WO({path:t,className:e}){return c.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:t})})}const UO={premium:"M4 12v3M8 8v11M12 4v16M16 8v11M20 12v3",germany:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0 M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5 19 19M19 5l-1.5 1.5M6.5 17.5 5 19",individual:"M6 3h12l4 6-10 12L2 9z M11 3 8 9l4 12 4-12-3-6M2 9h20",experts:"M20 6 9 17l-5-5"};function $v({formatted:t,color:e}){const[n,r]=t.split("€");return c.jsxs("span",{style:{...Zc,color:e},children:[n,c.jsx("span",{style:{fontFamily:"'Barlow', sans-serif"},children:"€"}),r]})}function hc({icon:t,label:e,name:n,type:r="text",required:s,value:i,onChange:o,placeholder:a}){return c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("label",{htmlFor:`kf-${n}`,className:"text-xs font-semibold uppercase tracking-[2px]",style:{color:"var(--kf-label)"},children:e}),c.jsxs("div",{className:"relative flex items-center",children:[c.jsx(t,{className:"pointer-events-none absolute left-[14px] h-[17px] w-[17px]",style:{color:"var(--kf-fieldicon)"}}),c.jsx("input",{id:`kf-${n}`,name:n,type:r,required:s,value:i,onChange:o,placeholder:a,className:"w-full rounded-lg border py-3.5 pl-[42px] pr-4 text-[15px] outline-none transition-colors",style:{background:"var(--kf-field)",borderColor:"var(--kf-fieldbrd)",color:"var(--kf-text2)"}})]})]})}function KO(){const[t]=zD(),{phone:e,whatsapp:n,contact_email:r,address_street:s,address_zip:i,address_city:o,business_hours:a}=hs(),{t:l,language:u}=ct(),{consent:d}=wo(),h=[s,[i,o].filter(Boolean).join(" ")].filter(Boolean).join(", "),p=encodeURIComponent(h),f=`https://www.google.com/maps/dir/?api=1&destination=${p}`,m=jN(a,l("footer.closed")),x=_=>new Intl.NumberFormat(u==="de"?"de-DE":"en-US",{style:"currency",currency:"EUR"}).format(_),[y,b]=v.useState({name:"",email:"",phone:"",vin:"",message:""}),[g,k]=v.useState("idle"),[w,C]=v.useState(""),[j,S]=v.useState([]),[N,T]=v.useState([]),E=t.get("packageId"),D=t.get("total")?Number(t.get("total")):null;v.useEffect(()=>{if(!E){S([]);return}A.get(`/packages/${E}/upgrades`).then(S).catch(()=>S([]))},[E]);const P=_=>{T($=>$.includes(_)?$.filter(ee=>ee!==_):[...$,_])},O=j.filter(_=>N.includes(_.id)).reduce((_,$)=>_+Number($.price),0);Gt({title:l("contactPage.metaTitle"),description:l("contactPage.metaDescription"),path:"/kontakt"});const W={brand:t.get("brand")||"",model:t.get("model")||"",package:t.get("package")||""},I=!!(W.brand&&W.model&&W.package),z=_=>b($=>({...$,[_.target.name]:_.target.value})),q=async _=>{_.preventDefault(),k("sending"),C("");try{await A.post("/contact",{...y,brand_name:W.brand||null,model_name:W.model||null,package_name:W.package||null,product_name:t.get("product")||null,package_id:E||null,package_product_id:t.get("productId")||null,upgrade_ids:N}),k("sent"),b({name:"",email:"",phone:"",vin:"",message:""})}catch($){C($.message),k("idle")}},R=[{key:"premium",title:l("contactPage.featurePremiumTitle"),sub:l("contactPage.featurePremiumSub")},{key:"germany",title:l("contactPage.featureGermanyTitle"),sub:l("contactPage.featureGermanySub")},{key:"individual",title:l("contactPage.featureIndividualTitle"),sub:l("contactPage.featureIndividualSub")},{key:"experts",title:l("contactPage.featureExpertsTitle"),sub:l("contactPage.featureExpertsSub")}];return c.jsx("div",{className:"kf-page kontakt-sektion relative w-full overflow-hidden px-4 pb-10 sm:px-10",style:{color:"var(--kf-text2)",fontFamily:"'Barlow', sans-serif"},children:c.jsxs("div",{className:"relative z-10 mx-auto max-w-[1280px] pt-10 sm:pt-14",children:[c.jsx("div",{className:"mb-3 text-[13px] font-semibold uppercase tracking-[6px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.heroEyebrow")}),c.jsxs("h1",{className:"text-[34px] leading-[1.08] sm:text-[46px] lg:text-[60px]",style:{...Zc,color:"var(--kf-text)"},children:[l("contactPage.heroTitlePre")," ",c.jsx("span",{style:{color:"var(--kf-accent2)"},children:l("contactPage.heroTitleAccent")})," ",l("contactPage.heroTitlePost")]}),c.jsx("p",{className:"mb-10 mt-5 max-w-[520px] text-lg leading-[1.55]",style:{color:"var(--kf-muted)"},children:l("contactPage.heroSubtitle")}),c.jsxs("div",{className:"grid grid-cols-1 items-start gap-10 min-[981px]:grid-cols-[minmax(0,1.35fr)_minmax(320px,1fr)]",children:[c.jsx("div",{children:c.jsxs("div",{className:"rounded-2xl border p-[22px] sm:p-10",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow)"},children:[I&&c.jsxs("div",{className:"mb-8 rounded-xl border px-6 py-[22px]",style:{background:"var(--kf-pkgbg)",borderColor:"var(--kf-pkgbrd)"},children:[c.jsxs("div",{className:"mb-3.5 flex items-center gap-2.5 text-xs font-bold uppercase tracking-[2px]",style:{color:"var(--kf-accent2)"},children:[c.jsx(gM,{className:"h-4 w-4"}),l("contactPage.packageBoxTitle")]}),c.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-5 gap-y-2 text-[15px]",children:[c.jsx("span",{style:{color:"var(--kf-label)"},children:l("contactPage.contextBrand")}),c.jsx("span",{className:"font-semibold",style:{color:"var(--kf-text2)"},children:W.brand}),c.jsx("span",{style:{color:"var(--kf-label)"},children:l("contactPage.contextModel")}),c.jsx("span",{className:"font-semibold",style:{color:"var(--kf-text2)"},children:W.model}),c.jsx("span",{style:{color:"var(--kf-label)"},children:l("contactPage.contextPackage")}),c.jsx("span",{className:"font-semibold",style:{color:"var(--kf-text2)"},children:W.package})]}),c.jsxs("div",{className:"mt-3.5 flex items-baseline justify-between border-t pt-3.5",style:{borderColor:"var(--kf-pkgbrd)"},children:[c.jsx("span",{className:"text-[13px] font-semibold uppercase tracking-wide",style:{color:"var(--kf-muted)"},children:l("contactPage.packagePrice")}),c.jsx("span",{className:"text-xl",children:D!=null?c.jsx($v,{formatted:x(D),color:"var(--kf-text)"}):"—"})]})]}),j.length>0&&c.jsxs("div",{className:"mb-8 rounded-xl border p-5",style:{background:"var(--kf-field)",borderColor:"var(--kf-fieldbrd)"},children:[c.jsx("div",{className:"mb-3 text-xs font-bold uppercase tracking-[2px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.optionalUpgrades")}),c.jsx("div",{className:"space-y-2",children:j.map(_=>c.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-lg border p-3 text-sm",style:{borderColor:"var(--kf-fieldbrd)"},children:[c.jsx("input",{type:"checkbox",checked:N.includes(_.id),onChange:()=>P(_.id),className:"mt-0.5 h-4 w-4 rounded",style:{accentColor:"var(--kf-accent)"}}),c.jsxs("span",{className:"flex-1",children:[c.jsx("span",{className:"block font-semibold",style:{color:"var(--kf-text2)"},children:_.name}),_.description&&c.jsx("span",{className:"block text-xs",style:{color:"var(--kf-muted)"},children:_.description})]}),c.jsxs("span",{className:"font-semibold",style:{color:"var(--kf-accent2)"},children:["+",x(_.price)]})]},_.id))}),N.length>0&&D!=null&&c.jsxs("div",{className:"mt-3 flex items-baseline justify-between border-t pt-3 text-sm",style:{borderColor:"var(--kf-pkgbrd)"},children:[c.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--kf-muted)"},children:l("contactPage.totalWithUpgrades")}),c.jsx($v,{formatted:x(D+O),color:"var(--kf-text)"})]})]}),c.jsx("h2",{className:"mb-8 text-xl",style:{...Zc,color:"var(--kf-text)"},children:l("contactPage.formTitle")}),g==="sent"&&c.jsxs("div",{className:"mb-6 rounded-[10px] border p-5",style:{borderColor:"var(--kf-accent)",background:"var(--kf-accentsoft)"},children:[c.jsx("div",{className:"text-base font-bold",style:{color:"var(--kf-accent2)"},children:l("contactPage.sentTitle")}),c.jsx("div",{className:"mt-1 text-sm",style:{color:"var(--kf-muted)"},children:l("contactPage.sentText")})]}),c.jsxs("form",{onSubmit:q,children:[c.jsxs("div",{className:"grid grid-cols-1 gap-6 min-[641px]:grid-cols-2",children:[c.jsx(hc,{icon:xM,label:l("contactPage.nameLabel"),name:"name",required:!0,value:y.name,onChange:z,placeholder:l("contactPage.namePlaceholder")}),c.jsx(hc,{icon:$x,label:l("contactPage.emailLabel"),name:"email",type:"email",required:!0,value:y.email,onChange:z,placeholder:l("contactPage.emailPlaceholder")}),c.jsx(hc,{icon:Hx,label:l("contactPage.phoneLabel"),name:"phone",value:y.phone,onChange:z,placeholder:l("contactPage.phonePlaceholder")}),c.jsx(hc,{icon:yM,label:l("contactPage.vinLabel"),name:"vin",value:y.vin,onChange:z,placeholder:l("contactPage.vinPlaceholder")})]}),c.jsxs("div",{className:"mt-6 flex flex-col gap-2",children:[c.jsx("label",{htmlFor:"kf-message",className:"text-xs font-semibold uppercase tracking-[2px]",style:{color:"var(--kf-label)"},children:l("contactPage.messageLabel")}),c.jsx("textarea",{id:"kf-message",name:"message",rows:5,value:y.message,onChange:z,placeholder:l("contactPage.messagePlaceholder"),className:"w-full resize-y rounded-lg border px-4 py-3.5 text-[15px] outline-none",style:{background:"var(--kf-field)",borderColor:"var(--kf-fieldbrd)",color:"var(--kf-text2)"}})]}),w&&c.jsx("p",{className:"mt-4 text-sm text-red-600 dark:text-red-400",children:w}),c.jsxs("div",{className:"mt-8 flex flex-wrap items-center gap-5",children:[c.jsxs("button",{type:"submit",disabled:g==="sending",className:"inline-flex items-center gap-3 rounded-lg px-8 py-4 text-sm font-bold uppercase tracking-[3px] transition-[filter,box-shadow] hover:brightness-110 disabled:opacity-60",style:{background:"var(--kf-accent)",color:"var(--kf-btntext)",boxShadow:"0 10px 24px rgba(150,200,20,0.32)"},children:[c.jsx(bM,{className:"h-[18px] w-[18px]"}),l(g==="sending"?"contactPage.sending":"contactPage.submit")]}),c.jsx("div",{className:"text-[13px]",style:{color:"var(--kf-label)"},children:l("contactPage.requiredHint")})]})]})]})}),c.jsxs("div",{className:"flex flex-col gap-6",children:[c.jsxs("div",{className:"relative overflow-hidden rounded-2xl border px-[22px] py-[26px] sm:px-8 sm:py-[34px]",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow)"},children:[c.jsx("div",{className:"pointer-events-none absolute -right-[60px] -top-[60px] h-[190px] w-[190px] rounded-full border border-dashed",style:{borderColor:"var(--kf-pkgbrd)"}}),c.jsx("h2",{className:"mb-7 text-[17px]",style:{...Zc,color:"var(--kf-text)"},children:l("contactPage.cardTitle")}),c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(Hx,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.phone")}),c.jsx("a",{href:`tel:${Cj(e)}`,className:"text-base font-semibold",style:{color:"var(--kf-text2)"},children:e})]})]}),c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx($x,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.email")}),c.jsx("a",{href:`mailto:${r}`,className:"text-base font-semibold",style:{color:"var(--kf-text2)"},children:r})]})]}),c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(vM,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.address")}),c.jsxs("div",{className:"text-base font-semibold leading-[1.4]",style:{color:"var(--kf-text2)"},children:[s,c.jsx("br",{}),[i,o].filter(Boolean).join(" ")]})]})]}),n&&c.jsxs("div",{className:"flex items-start gap-4",children:[c.jsx("div",{className:"flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"var(--kf-accentsoft)"},children:c.jsx(HO,{className:"h-[18px] w-[18px]",style:{color:"var(--kf-accent2)"}})}),c.jsxs("div",{children:[c.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("nav.whatsapp")}),c.jsx("a",{href:$O(n),className:"text-base font-semibold",style:{color:"var(--kf-text2)"},children:n})]})]})]}),c.jsxs("div",{className:"mt-7 border-t pt-6",style:{borderColor:"var(--kf-divider)"},children:[c.jsx("div",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[3px]",style:{color:"var(--kf-accent2)"},children:l("contactPage.hours")}),c.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-[15px]",children:m.map(_=>c.jsxs("span",{style:{display:"contents"},children:[c.jsx("span",{style:{color:"var(--kf-label)"},children:_.days}),c.jsx("span",{children:_.label})]},_.key))})]})]}),c.jsxs("div",{className:"relative overflow-hidden rounded-2xl border",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow)"},children:[d.external&&c.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"absolute left-3.5 top-3.5 z-10 inline-flex items-center gap-2 rounded-lg border px-3.5 py-2 text-[13px] font-semibold hover:border-[var(--kf-accent)]",style:{background:"var(--kf-pill)",borderColor:"var(--kf-pillbrd)",color:"var(--kf-text2)",boxShadow:"var(--kf-shadow2)"},children:[l("contactPage.mapOpenChip"),c.jsx(kM,{className:"h-3.5 w-3.5",style:{color:"var(--kf-accent2)"}})]}),c.jsx(VO,{name:l("contactPage.mapEmbedName"),className:"h-[210px] w-full",children:c.jsx("div",{className:"h-[210px] overflow-hidden",children:c.jsx("iframe",{title:"HifiPlanet Amorbach – Standort",src:`https://www.google.com/maps?q=${p}&output=embed`,width:"100%",height:"290",style:{border:0,display:"block",marginTop:"-60px"},loading:"lazy",referrerPolicy:"no-referrer-when-downgrade"})})}),c.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2.5 border-t px-4 py-4 text-[13px] font-bold uppercase tracking-[3px] hover:bg-[var(--kf-accentsoft)]",style:{borderColor:"var(--kf-divider)",color:"var(--kf-accent2)"},children:[l("contactPage.routePlan")," →"]})]})]})]}),c.jsx("div",{className:"mt-10 grid grid-cols-1 overflow-hidden rounded-2xl border min-[641px]:grid-cols-2 min-[901px]:grid-cols-4",style:{background:"var(--kf-card)",borderColor:"var(--kf-cardbrd)",boxShadow:"var(--kf-shadow2)"},children:R.map(_=>c.jsxs("div",{className:"flex items-center gap-4 border-b p-6 last:border-b-0 min-[641px]:border-b-0 min-[641px]:border-r min-[641px]:last:border-r-0",style:{borderColor:"var(--kf-divider)"},children:[c.jsx("div",{className:"flex h-[46px] w-[46px] flex-shrink-0 items-center justify-center rounded-full border-[1.5px]",style:{borderColor:"var(--kf-pkgbrd)",color:"var(--kf-accent2)"},children:c.jsx(WO,{path:UO[_.key],className:"h-[22px] w-[22px]"})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-[15px] font-bold",style:{color:"var(--kf-text)"},children:_.title}),c.jsx("div",{className:"mt-0.5 text-[13px]",style:{color:"var(--kf-muted)"},children:_.sub})]})]},_.key))})]})})}function GO(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/impressum").then(e).catch(()=>{})},[]),Gt({title:(t==null?void 0:t.title)||"Impressum",description:"Impressum von HifiPlanet Amorbach gemäß § 5 DDG.",path:"/impressum"}),t?c.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),c.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}function qO(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/datenschutz").then(e).catch(()=>{})},[]),Gt({title:(t==null?void 0:t.title)||"Datenschutzerklärung",description:"Datenschutzerklärung von HifiPlanet Amorbach gemäß Art. 13 DSGVO.",path:"/datenschutz"}),t?c.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),c.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}function JO(){const[t,e]=v.useState(null);return v.useEffect(()=>{A.get("/legal-pages/agb").then(e).catch(()=>{})},[]),Gt({title:(t==null?void 0:t.title)||"AGB",description:"Allgemeine Geschäftsbedingungen von HifiPlanet Amorbach.",path:"/agb"}),t?c.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[c.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),c.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}const YO={host:"",name:"",user:"",password:"",charset:"utf8mb4"},XO={username:"",password:"",password_confirmation:""};function ZO(){Gt({title:"Ersteinrichtung",path:"/setup"});const[t,e]=v.useState("loading"),[n,r]=v.useState(""),[s,i]=v.useState(!1),[o,a]=v.useState(""),[l,u]=v.useState(YO),[d,h]=v.useState(XO),[p,f]=v.useState(null),m=()=>A.get("/setup/status").then(S=>(S.needs_setup?S.steps.admin.ok?e("done"):S.steps.schema.ok?e("admin"):e(S.steps.database.ok?"schema":"database"):e("locked"),S));v.useEffect(()=>{A.get("/setup/status").then(S=>e(S.needs_setup?"password":"locked")).catch(()=>e("locked"))},[]);const x=async S=>{S.preventDefault(),r(""),i(!0);try{await A.post("/setup/verify-password",{password:o}),await m()}catch(N){r(N.message)}finally{i(!1)}},y=async S=>{S.preventDefault(),r(""),i(!0);try{await A.post("/setup/database",l),await m()}catch(N){r(N.message)}finally{i(!1)}},b=async()=>{r(""),i(!0);try{const S=await A.post("/setup/migrate",{});f(S.actions),S.status.steps.schema.ok&&e("admin")}catch(S){r(S.message)}finally{i(!1)}},g=async S=>{if(S.preventDefault(),r(""),d.password!==d.password_confirmation){r("Die Passwörter stimmen nicht überein");return}i(!0);try{await A.post("/setup/admin",d),e("done")}catch(N){r(N.message)}finally{i(!1)}},k="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900",w="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",C=[{key:"database",label:"Datenbank"},{key:"schema",label:"Struktur"},{key:"admin",label:"Admin-Account"}],j=C.findIndex(S=>S.key===t);return c.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 py-12 dark:bg-neutral-950",children:[c.jsx("img",{src:Wu,alt:"HifiPlanet",className:"h-16 w-auto sm:h-20"}),c.jsxs("div",{className:"w-full max-w-md rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[t==="loading"&&c.jsx("p",{className:"text-center text-sm text-neutral-400",children:"Lädt…"}),t==="locked"&&c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bereits eingerichtet"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Seite wurde bereits vollständig eingerichtet. Der Assistent ist deshalb gesperrt."}),c.jsx(ne,{to:"/admin/login",className:"text-sm font-medium text-brand-600 hover:underline dark:text-brand-400",children:"Zum Login"})]}),["database","schema","admin"].includes(t)&&c.jsx("div",{className:"mb-6 flex items-center justify-center gap-2",children:C.map((S,N)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:`flex h-6 w-6 items-center justify-center rounded-full text-xs font-semibold ${Na(S.target.value),required:!0,autoFocus:!0,className:k})]}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Prüfe…":"Weiter"})]}),t==="database"&&c.jsxs("form",{onSubmit:y,children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Datenbank-Zugangsdaten"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Trage die Zugangsdaten der Datenbank auf diesem Server ein. Die Verbindung wird vor dem Speichern getestet."}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Host *"}),c.jsx("input",{required:!0,value:l.host,onChange:S=>u({...l,host:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Datenbankname *"}),c.jsx("input",{required:!0,value:l.name,onChange:S=>u({...l,name:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Benutzer *"}),c.jsx("input",{required:!0,value:l.user,onChange:S=>u({...l,user:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Passwort"}),c.jsx("input",{type:"password",value:l.password,onChange:S=>u({...l,password:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:w,children:"Zeichensatz"}),c.jsx("input",{value:l.charset,onChange:S=>u({...l,charset:S.target.value}),className:k})]}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Teste Verbindung…":"Verbindung testen & speichern"})]}),t==="schema"&&c.jsxs("div",{children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Datenbankstruktur"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Datenbankverbindung funktioniert. Jetzt legen wir die benötigten Tabellen an."}),p&&c.jsx("ul",{className:"mb-4 space-y-1 rounded-md bg-neutral-50 p-3 text-sm text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300",children:p.map((S,N)=>c.jsx("li",{children:S},N))}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"button",onClick:b,disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Richte ein…":"Datenbankstruktur einrichten"})]}),t==="admin"&&c.jsxs("form",{onSubmit:g,children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Erster Admin-Account"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Lege den ersten Super-Admin-Account an, mit dem du dich anschließend einloggen kannst."}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Benutzername"}),c.jsx("input",{required:!0,autoFocus:!0,value:d.username,onChange:S=>h({...d,username:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-3",children:[c.jsx("label",{className:w,children:"Passwort"}),c.jsx("input",{type:"password",required:!0,minLength:8,value:d.password,onChange:S=>h({...d,password:S.target.value}),className:k})]}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:w,children:"Passwort wiederholen"}),c.jsx("input",{type:"password",required:!0,minLength:8,value:d.password_confirmation,onChange:S=>h({...d,password_confirmation:S.target.value}),className:k})]}),n&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:n}),c.jsx("button",{type:"submit",disabled:s,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:s?"Lege an…":"Admin-Account anlegen"})]}),t==="done"&&c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Fertig!"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Ersteinrichtung ist abgeschlossen. Du kannst dich jetzt mit deinem neuen Admin-Account anmelden."}),c.jsx(ne,{to:"/admin/login",className:"inline-block w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600",children:"Zum Login"})]})]})]})}function QO(){const{user:t,login:e,verifyTwoFactor:n}=Ln(),r=kl(),[s,i]=v.useState("credentials"),[o,a]=v.useState(""),[l,u]=v.useState(""),[d,h]=v.useState(""),[p,f]=v.useState(""),[m,x]=v.useState(!1);if(t)return c.jsx(Za,{to:"/admin",replace:!0});const y=async g=>{g.preventDefault(),x(!0),f("");try{(await e(o,l)).requires2fa?i("code"):r("/admin")}catch(k){f(k.message)}finally{x(!1)}},b=async g=>{g.preventDefault(),x(!0),f("");try{await n(d),r("/admin")}catch(k){f(k.message)}finally{x(!1)}};return c.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 dark:bg-neutral-950",children:[c.jsx("img",{src:Wu,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),c.jsx("img",{src:Lu,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),s==="credentials"?c.jsxs("form",{onSubmit:y,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h1",{className:"mb-6 text-xl font-bold text-neutral-900 dark:text-white",children:"Admin-Login"}),c.jsxs("div",{className:"mb-4",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),c.jsx("input",{value:o,onChange:g=>a(g.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort"}),c.jsx("input",{type:"password",value:l,onChange:g=>u(g.target.value),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),p&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:p}),c.jsx("button",{type:"submit",disabled:m,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:m?"Anmelden…":"Anmelden"})]}):c.jsxs("form",{onSubmit:b,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bestätigungscode"}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Öffne die Google Authenticator App und gib den 6-stelligen Code ein. Alternativ kannst du auch einen deiner Wiederherstellungscodes verwenden."}),c.jsxs("div",{className:"mb-6",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Code"}),c.jsx("input",{value:d,onChange:g=>h(g.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),p&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:p}),c.jsx("button",{type:"submit",disabled:m,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:m?"Prüfe…":"Bestätigen"}),c.jsx("button",{type:"button",onClick:()=>{i("credentials"),h(""),f("")},className:"mt-3 w-full text-sm text-neutral-500 hover:underline dark:text-neutral-400",children:"Zurück zum Login"})]})]})}const e5={tag:"M4 4h7l9 9-7 7-9-9V4Zm3.5 3.5h.01",car:"M3 13.5 4.5 9A2 2 0 0 1 6.4 7.5h11.2A2 2 0 0 1 19.5 9L21 13.5M3 13.5v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-4M3 13.5h18M6.5 16.5h.01M17.5 16.5h.01",box:"M12 3 4 7.5v9L12 21l8-4.5v-9L12 3Zm0 9 8-4.5M12 12v9M12 12 4 7.5",mail:"M4 6h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm0 0 8 7 8-7"},t5=({path:t,className:e="h-6 w-6"})=>c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:e,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:t})});function n5(){const[t,e]=v.useState(null),[n,r]=v.useState("");if(v.useEffect(()=>{A.get("/analytics/report").then(e).catch(i=>r(i.message))},[]),n)return c.jsxs("section",{className:"mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"text-sm text-red-600",children:n})]});if(!t)return null;if(!t.configured)return c.jsxs("section",{className:"mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsxs("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:["Noch nicht eingerichtet. Unter"," ",c.jsx(ne,{to:"/admin/settings/website",className:"text-brand-600 hover:underline dark:text-brand-400",children:"Einstellungen → Website"})," ","kannst du die Dashboard-Anbindung konfigurieren, um hier Besucherzahlen zu sehen."]})]});const s=Math.max(1,...t.daily.map(i=>i.pageviews));return c.jsxs("section",{className:"mt-8 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Google Analytics"}),c.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Letzte 7 Tage."}),c.jsxs("div",{className:"mb-6 grid grid-cols-3 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:t.totals.users}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Nutzer"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:t.totals.sessions}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Sitzungen"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-2xl font-extrabold text-brand-600 dark:text-brand-400",children:t.totals.pageviews}),c.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Seitenaufrufe"})]})]}),t.daily.length>0&&c.jsx("div",{className:"mb-6 flex h-24 items-end gap-1.5",children:t.daily.map(i=>c.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[c.jsx("div",{className:"w-full rounded-t bg-brand-400 dark:bg-brand-500",style:{height:`${Math.max(4,i.pageviews/s*80)}px`},title:`${i.date}: ${i.pageviews} Seitenaufrufe`}),c.jsxs("span",{className:"text-[10px] text-neutral-400",children:[i.date.slice(6,8),".",i.date.slice(4,6),"."]})]},i.date))}),t.top_pages.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-neutral-400",children:"Meistbesuchte Seiten"}),c.jsx("ul",{className:"space-y-1 text-sm",children:t.top_pages.map(i=>c.jsxs("li",{className:"flex items-center justify-between gap-3 text-neutral-700 dark:text-neutral-300",children:[c.jsx("span",{className:"truncate font-mono text-xs",children:i.path}),c.jsx("span",{className:"shrink-0 font-semibold",children:i.pageviews})]},i.path))})]})]})}function r5(){const{user:t,hasPermission:e}=Ln(),[n,r]=v.useState({});v.useEffect(()=>{e("brands.manage")&&A.get("/brands").then(i=>r(o=>({...o,brands:i.length}))),(e("models.manage")||e("packages.manage"))&&A.get("/models").then(i=>r(o=>({...o,models:i.length}))),e("packages.manage")&&A.get("/packages").then(i=>r(o=>({...o,packages:i.length}))),e("contact.manage")&&A.get("/contact").then(i=>r(o=>({...o,newContacts:i.filter(a=>a.status==="new").length})))},[]);const s=[{key:"brands",label:"Marken",icon:"tag",hint:"Die Hersteller, z. B. Audi oder BMW.",value:n.brands,to:"/admin/brands",show:e("brands.manage")},{key:"models",label:"Modelle",icon:"car",hint:"Die Fahrzeuge einer Marke, z. B. A4.",value:n.models,to:"/admin/models",show:e("models.manage")},{key:"packages",label:"Pakete",icon:"box",hint:"Die Sound-Pakete für ein Modell.",value:n.packages,to:"/admin/packages",show:e("packages.manage")},{key:"contacts",label:"Neue Anfragen",icon:"mail",hint:"Kunden, die noch auf Antwort warten.",value:n.newContacts,to:"/admin/contact-requests",show:e("contact.manage"),highlight:!0}].filter(i=>i.show);return c.jsxs("div",{children:[c.jsxs("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:["Willkommen, ",t==null?void 0:t.username,"!"]}),c.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Hier siehst du auf einen Blick, wie viel in deinem Shop hinterlegt ist. Klicke auf eine Kachel, um dorthin zu gelangen."}),s.length===0?c.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:"Für deinen Account sind noch keine Bereiche freigeschaltet. Bitte wende dich an einen Administrator."}):c.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:s.map(i=>c.jsxs(ne,{to:i.to,className:`rounded-xl border p-5 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md ${i.highlight&&i.value>0?"border-brand-300 bg-brand-50 dark:border-brand-900 dark:bg-brand-900/20":"border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900"}`,children:[c.jsx("div",{className:"mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:c.jsx(t5,{path:e5[i.icon]})}),c.jsx("p",{className:"text-sm font-semibold text-neutral-700 dark:text-neutral-200",children:i.label}),c.jsx("p",{className:"mt-1 text-3xl font-extrabold text-brand-600 dark:text-brand-400",children:i.value??"…"}),c.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-400",children:i.hint})]},i.key))}),e("settings.manage")&&c.jsx(n5,{})]})}var Hv=!1,Ns,Lm,Rm,Qc,eu,jj,tu,_m,Im,Om,Ej,Bm,zm,Tj,Mj;function Tt(){if(!Hv){Hv=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),n=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(Bm=/\b(iPhone|iP[ao]d)/.exec(t),zm=/\b(iP[ao]d)/.exec(t),Om=/Android/i.exec(t),Tj=/FBAN\/\w+;/i.exec(t),Mj=/Mobile/i.exec(t),Ej=!!/Win64/.exec(t),e){Ns=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN,Ns&&document&&document.documentMode&&(Ns=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(t);jj=r?parseFloat(r[1])+4:Ns,Lm=e[2]?parseFloat(e[2]):NaN,Rm=e[3]?parseFloat(e[3]):NaN,Qc=e[4]?parseFloat(e[4]):NaN,Qc?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),eu=e&&e[1]?parseFloat(e[1]):NaN):eu=NaN}else Ns=Lm=Rm=eu=Qc=NaN;if(n){if(n[1]){var s=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);tu=s?parseFloat(s[1].replace("_",".")):!0}else tu=!1;_m=!!n[2],Im=!!n[3]}else tu=_m=Im=!1}}var Fm={ie:function(){return Tt()||Ns},ieCompatibilityMode:function(){return Tt()||jj>Ns},ie64:function(){return Fm.ie()&&Ej},firefox:function(){return Tt()||Lm},opera:function(){return Tt()||Rm},webkit:function(){return Tt()||Qc},safari:function(){return Fm.webkit()},chrome:function(){return Tt()||eu},windows:function(){return Tt()||_m},osx:function(){return Tt()||tu},linux:function(){return Tt()||Im},iphone:function(){return Tt()||Bm},mobile:function(){return Tt()||Bm||zm||Om||Mj},nativeApp:function(){return Tt()||Tj},android:function(){return Tt()||Om},ipad:function(){return Tt()||zm}},s5=Fm,i5=!!(typeof window<"u"&&window.document&&window.document.createElement),o5={canUseDOM:i5},a5=o5,Pj=a5,Aj;Pj.canUseDOM&&(Aj=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
+ * Checks if an event is supported in the current execution environment.
+ *
+ * NOTE: This will not work correctly for non-generic events such as `change`,
+ * `reset`, `load`, `error`, and `select`.
+ *
+ * Borrows from Modernizr.
+ *
+ * @param {string} eventNameSuffix Event name, e.g. "click".
+ * @param {?boolean} capture Check if the capture phase is supported.
+ * @return {boolean} True if the event is supported.
+ * @internal
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
+ */function l5(t,e){if(!Pj.canUseDOM||e&&!("addEventListener"in document))return!1;var n="on"+t,r=n in document;if(!r){var s=document.createElement("div");s.setAttribute(n,"return;"),r=typeof s[n]=="function"}return!r&&Aj&&t==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var c5=l5,u5=s5,d5=c5,Wv=10,Uv=40,Kv=800;function Dj(t){var e=0,n=0,r=0,s=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=n,n=0),r=e*Wv,s=n*Wv,"deltaY"in t&&(s=t.deltaY),"deltaX"in t&&(r=t.deltaX),(r||s)&&t.deltaMode&&(t.deltaMode==1?(r*=Uv,s*=Uv):(r*=Kv,s*=Kv)),r&&!e&&(e=r<1?-1:1),s&&!n&&(n=s<1?-1:1),{spinX:e,spinY:n,pixelX:r,pixelY:s}}Dj.getEventType=function(){return u5.firefox()?"DOMMouseScroll":d5("wheel")?"wheel":"mousewheel"};var h5=Dj,f5=h5;const p5=n1(f5);function sl(t){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sl(t)}function m5(t,e){if(sl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(sl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function g5(t){var e=m5(t,"string");return sl(e)=="symbol"?e:e+""}function x5(t,e,n){return(e=g5(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Gv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function qe(t){for(var e=1;eu*s?{width:u*s,height:u}:{width:l,height:l/s}}function b5(t){return t.width>t.height?t.width/t.naturalWidth:t.height/t.naturalHeight}function zo(t,e,n,r,s=0){const{width:i,height:o}=so(e.width,e.height,s);return{x:qv(t.x,i,n.width,r),y:qv(t.y,o,n.height,r)}}function qv(t,e,n,r){const s=Math.abs(e*r/2-n/2);return dh(t,-s,s)}function Jv(t,e){return Math.sqrt(Math.pow(t.y-e.y,2)+Math.pow(t.x-e.x,2))}function Yv(t,e){return Math.atan2(e.y-t.y,e.x-t.x)*180/Math.PI}function v5(t,e,n,r,s,i=0,o=!0){const a=o?k5:w5,l=so(e.width,e.height,i),u=so(e.naturalWidth,e.naturalHeight,i),d={x:a(100,((l.width-n.width/s)/2-t.x/s)/l.width*100),y:a(100,((l.height-n.height/s)/2-t.y/s)/l.height*100),width:a(100,n.width/l.width*100/s),height:a(100,n.height/l.height*100/s)},h=Math.round(a(u.width,d.width*u.width/100)),p=Math.round(a(u.height,d.height*u.height/100)),f=u.width>=u.height*r?{width:Math.round(p*r),height:p}:{width:h,height:Math.round(h/r)};return{croppedAreaPercentages:d,croppedAreaPixels:qe(qe({},f),{},{x:Math.round(a(u.width-f.width,d.x*u.width/100)),y:Math.round(a(u.height-f.height,d.y*u.height/100))})}}function k5(t,e){return Math.min(t,Math.max(0,e))}function w5(t,e){return e}function S5(t,e,n,r,s,i){const o=so(e.width,e.height,n),a=dh(r.width/o.width*(100/t.width),s,i);return{crop:{x:a*o.width/2-r.width/2-o.width*a*(t.x/100),y:a*o.height/2-r.height/2-o.height*a*(t.y/100)},zoom:a}}function N5(t,e,n){const r=b5(e);return n.height>n.width?n.height/(t.height*r):n.width/(t.width*r)}function C5(t,e,n=0,r,s,i){const o=so(e.naturalWidth,e.naturalHeight,n),a=dh(N5(t,e,r),s,i),l=r.height>r.width?r.height/t.height:r.width/t.width;return{crop:{x:((o.width-t.width)/2-t.x)*l,y:((o.height-t.height)/2-t.y)*l},zoom:a}}function Xv(t,e){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function j5(t){return t*Math.PI/180}function so(t,e,n){const r=j5(n);return{width:Math.abs(Math.cos(r)*t)+Math.abs(Math.sin(r)*e),height:Math.abs(Math.sin(r)*t)+Math.abs(Math.cos(r)*e)}}function dh(t,e,n){return Math.min(Math.max(t,e),n)}function fc(...t){return t.filter(e=>typeof e=="string"&&e.length>0).join(" ").trim()}var E5=`.reactEasyCrop_Container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ overflow: hidden;
+ user-select: none;
+ touch-action: none;
+ cursor: move;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.reactEasyCrop_Image,
+.reactEasyCrop_Video {
+ will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
+ max-width: unset; /* prevent global img/video reset rules from constraining the cropper media */
+}
+
+.reactEasyCrop_Contain {
+ max-width: 100%;
+ max-height: 100%;
+ margin: auto;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+}
+.reactEasyCrop_Cover_Horizontal {
+ width: 100%;
+ height: auto;
+}
+.reactEasyCrop_Cover_Vertical {
+ width: auto;
+ height: 100%;
+}
+
+.reactEasyCrop_CropArea {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ border: 1px solid rgba(255, 255, 255, 0.5);
+ box-sizing: border-box;
+ box-shadow: 0 0 0 9999em;
+ color: rgba(0, 0, 0, 0.5);
+ overflow: hidden;
+}
+
+.reactEasyCrop_CropAreaRound {
+ border-radius: 50%;
+}
+
+.reactEasyCrop_CropAreaGrid::before {
+ content: ' ';
+ box-sizing: border-box;
+ position: absolute;
+ border: 1px solid rgba(255, 255, 255, 0.5);
+ top: 0;
+ bottom: 0;
+ left: 33.33%;
+ right: 33.33%;
+ border-top: 0;
+ border-bottom: 0;
+}
+
+.reactEasyCrop_CropAreaGrid::after {
+ content: ' ';
+ box-sizing: border-box;
+ position: absolute;
+ border: 1px solid rgba(255, 255, 255, 0.5);
+ top: 33.33%;
+ bottom: 33.33%;
+ left: 0;
+ right: 0;
+ border-left: 0;
+ border-right: 0;
+}
+`;const T5=250,M5=1,P5=3,A5=1;var hh=class bn extends v.Component{constructor(...e){super(...e),this.cropperRef=v.createRef(),this.imageRef=v.createRef(),this.videoRef=v.createRef(),this.containerPosition={x:0,y:0},this.containerRef=null,this.styleRef=null,this.containerRect=null,this.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},this.dragStartPosition={x:0,y:0},this.dragStartCrop={x:0,y:0},this.gestureZoomStart=0,this.gestureRotationStart=0,this.isTouching=!1,this.lastPinchDistance=0,this.lastPinchRotation=0,this.rafDragTimeout=null,this.rafPinchTimeout=null,this.wheelTimer=null,this.resizeEmitTimer=null,this.currentDoc=typeof document<"u"?document:null,this.currentWindow=typeof window<"u"?window:null,this.resizeObserver=null,this.previousCropSize=null,this.isInitialized=!1,this.dragInteractionSource=null,this.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},this.initResizeObserver=()=>{if(typeof window.ResizeObserver>"u"||!this.containerRef)return;let n=!0;this.resizeObserver=new window.ResizeObserver(r=>{if(n){n=!1;return}this.computeSizes({isResizeTriggered:!0})}),this.resizeObserver.observe(this.containerRef)},this.onWindowResize=()=>{this.computeSizes({isResizeTriggered:!0})},this.preventZoomSafari=n=>n.preventDefault(),this.cleanEvents=()=>{this.currentDoc&&(this.currentDoc.removeEventListener("mousemove",this.onMouseMove),this.currentDoc.removeEventListener("mouseup",this.onDragStopped),this.currentDoc.removeEventListener("touchmove",this.onTouchMove),this.currentDoc.removeEventListener("touchend",this.onDragStopped),this.currentDoc.removeEventListener("gesturechange",this.onGestureChange),this.currentDoc.removeEventListener("gestureend",this.onGestureEnd),this.currentDoc.removeEventListener("scroll",this.onScroll))},this.clearScrollEvent=()=>{this.containerRef&&this.containerRef.removeEventListener("wheel",this.onWheel),this.wheelTimer&&clearTimeout(this.wheelTimer)},this.onMediaLoad=()=>{const n=this.computeSizes();n&&(this.previousCropSize=n,this.emitCropData(),this.setInitialCrop(n),this.isInitialized=!0),this.props.onMediaLoaded&&this.props.onMediaLoaded(this.mediaSize)},this.setInitialCrop=n=>{if(this.props.initialCroppedAreaPercentages){const{crop:r,zoom:s}=S5(this.props.initialCroppedAreaPercentages,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(s)}else if(this.props.initialCroppedAreaPixels){const{crop:r,zoom:s}=C5(this.props.initialCroppedAreaPixels,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(s)}},this.computeSizes=({isResizeTriggered:n=!1}={})=>{const r=this.imageRef.current||this.videoRef.current;if(r&&this.containerRef){var s,i,o,a,l,u;this.containerRect=this.containerRef.getBoundingClientRect(),this.saveContainerPosition();const d=this.containerRect.width/this.containerRect.height,h=((s=this.imageRef.current)===null||s===void 0?void 0:s.naturalWidth)||((i=this.videoRef.current)===null||i===void 0?void 0:i.videoWidth)||0,p=((o=this.imageRef.current)===null||o===void 0?void 0:o.naturalHeight)||((a=this.videoRef.current)===null||a===void 0?void 0:a.videoHeight)||0,f=r.offsetWidthm?{width:this.containerRect.height*m,height:this.containerRect.height}:{width:this.containerRect.width,height:this.containerRect.width/m};break;case"horizontal-cover":x={width:this.containerRect.width,height:this.containerRect.width/m};break;case"vertical-cover":x={width:this.containerRect.height*m,height:this.containerRect.height};break}else x={width:r.offsetWidth,height:r.offsetHeight};this.mediaSize=qe(qe({},x),{},{naturalWidth:h,naturalHeight:p}),this.props.setMediaSize&&this.props.setMediaSize(this.mediaSize);const y=this.props.cropSize?this.props.cropSize:y5(this.mediaSize.width,this.mediaSize.height,this.containerRect.width,this.containerRect.height,this.props.aspect,this.props.rotation);return(((l=this.state.cropSize)===null||l===void 0?void 0:l.height)!==y.height||((u=this.state.cropSize)===null||u===void 0?void 0:u.width)!==y.width)&&this.props.onCropSizeChange&&this.props.onCropSizeChange(y),this.setState({cropSize:y},()=>this.recomputeCropPosition({isResizeTriggered:n})),this.props.setCropSize&&this.props.setCropSize(y),y}},this.saveContainerPosition=()=>{if(this.containerRef){const n=this.containerRef.getBoundingClientRect();this.containerPosition={x:n.left,y:n.top}}},this.onMouseDown=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("mousemove",this.onMouseMove),this.currentDoc.addEventListener("mouseup",this.onDragStopped),this.saveContainerPosition(),this.onDragStart(bn.getMousePoint(n),"mouse"))},this.onMouseMove=n=>this.onDrag(bn.getMousePoint(n)),this.onScroll=n=>{this.currentDoc&&(n.preventDefault(),this.saveContainerPosition())},this.onTouchStart=n=>{this.currentDoc&&(this.isTouching=!0,!(this.props.onTouchRequest&&!this.props.onTouchRequest(n))&&(this.currentDoc.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.currentDoc.addEventListener("touchend",this.onDragStopped),this.saveContainerPosition(),n.touches.length===2?this.onPinchStart(n):n.touches.length===1&&this.onDragStart(bn.getTouchPoint(n.touches[0]),"touch")))},this.onTouchMove=n=>{n.preventDefault(),n.touches.length===2?this.onPinchMove(n):n.touches.length===1&&this.onDrag(bn.getTouchPoint(n.touches[0]))},this.onGestureStart=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("gesturechange",this.onGestureChange),this.currentDoc.addEventListener("gestureend",this.onGestureEnd),this.gestureZoomStart=this.props.zoom,this.gestureRotationStart=this.props.rotation)},this.onGestureChange=n=>{if(n.preventDefault(),this.isTouching)return;const r=bn.getMousePoint(n),s=this.gestureZoomStart-1+n.scale;if(this.setNewZoom(s,r,{shouldUpdatePosition:!0}),this.props.onRotationChange){const i=this.gestureRotationStart+n.rotation;this.props.onRotationChange(i)}},this.onGestureEnd=n=>{this.cleanEvents()},this.onDragStart=({x:n,y:r},s)=>{var i,o;this.dragStartPosition={x:n,y:r},this.dragStartCrop=qe({},this.props.crop),this.dragInteractionSource=s,(i=(o=this.props).onInteractionStart)===null||i===void 0||i.call(o,{source:s})},this.onDrag=({x:n,y:r})=>{this.currentWindow&&(this.rafDragTimeout&&this.currentWindow.cancelAnimationFrame(this.rafDragTimeout),this.rafDragTimeout=this.currentWindow.requestAnimationFrame(()=>{if(!this.state.cropSize||n===void 0||r===void 0)return;const s=n-this.dragStartPosition.x,i=r-this.dragStartPosition.y,o={x:this.dragStartCrop.x+s,y:this.dragStartCrop.y+i},a=this.props.restrictPosition?zo(o,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):o;this.props.onCropChange(a)}))},this.onDragStopped=()=>{var n,r,s;this.isTouching=!1,this.cleanEvents(),this.emitCropData(),(n=(r=this.props).onInteractionEnd)===null||n===void 0||n.call(r,{source:(s=this.dragInteractionSource)!==null&&s!==void 0?s:"mouse"}),this.dragInteractionSource=null},this.onWheel=n=>{if(!this.currentWindow||this.props.onWheelRequest&&!this.props.onWheelRequest(n))return;n.preventDefault();const r=bn.getMousePoint(n),{pixelY:s}=p5(n),i=this.props.zoom-s*this.props.zoomSpeed/200;this.setNewZoom(i,r,{shouldUpdatePosition:!0}),this.state.hasWheelJustStarted||this.setState({hasWheelJustStarted:!0},()=>{var o,a;return(o=(a=this.props).onInteractionStart)===null||o===void 0?void 0:o.call(a,{source:"wheel"})}),this.wheelTimer&&clearTimeout(this.wheelTimer),this.wheelTimer=this.currentWindow.setTimeout(()=>this.setState({hasWheelJustStarted:!1},()=>{var o,a;return(o=(a=this.props).onInteractionEnd)===null||o===void 0?void 0:o.call(a,{source:"wheel"})}),250)},this.getPointOnContainer=({x:n,y:r},s)=>{if(!this.containerRect)throw new Error("The Cropper is not mounted");return{x:this.containerRect.width/2-(n-s.x),y:this.containerRect.height/2-(r-s.y)}},this.getPointOnMedia=({x:n,y:r})=>{const{crop:s,zoom:i}=this.props;return{x:(n+s.x)/i,y:(r+s.y)/i}},this.setNewZoom=(n,r,{shouldUpdatePosition:s=!0}={})=>{if(!this.state.cropSize||!this.props.onZoomChange)return;const i=dh(n,this.props.minZoom,this.props.maxZoom);if(s){const o=this.getPointOnContainer(r,this.containerPosition),a=this.getPointOnMedia(o),l={x:a.x*i-o.x,y:a.y*i-o.y},u=this.props.restrictPosition?zo(l,this.mediaSize,this.state.cropSize,i,this.props.rotation):l;this.props.onCropChange(u)}this.props.onZoomChange(i)},this.getCropData=()=>this.state.cropSize?v5(this.props.restrictPosition?zo(this.props.crop,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):this.props.crop,this.mediaSize,this.state.cropSize,this.getAspect(),this.props.zoom,this.props.rotation,this.props.restrictPosition):null,this.emitCropData=()=>{this.resizeEmitTimer&&(clearTimeout(this.resizeEmitTimer),this.resizeEmitTimer=null);const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:s}=n;this.props.onCropComplete&&this.props.onCropComplete(r,s),this.props.onCropAreaChange&&this.props.onCropAreaChange(r,s)},this.emitCropAreaChange=()=>{const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:s}=n;this.props.onCropAreaChange&&this.props.onCropAreaChange(r,s)},this.recomputeCropPosition=({isResizeTriggered:n=!1}={})=>{var r,s;if(!this.state.cropSize)return;let i=this.props.crop;if(this.isInitialized&&(!((r=this.previousCropSize)===null||r===void 0)&&r.width)&&(!((s=this.previousCropSize)===null||s===void 0)&&s.height)&&(Math.abs(this.previousCropSize.width-this.state.cropSize.width)>1e-6||Math.abs(this.previousCropSize.height-this.state.cropSize.height)>1e-6)){const a=this.state.cropSize.width/this.previousCropSize.width,l=this.state.cropSize.height/this.previousCropSize.height;i={x:this.props.crop.x*a,y:this.props.crop.y*l}}const o=this.props.restrictPosition?zo(i,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):i;this.previousCropSize=this.state.cropSize,this.props.onCropChange(o),n?this.debouncedEmitCropData():this.emitCropData()},this.debouncedEmitCropData=()=>{this.currentWindow&&(this.resizeEmitTimer&&clearTimeout(this.resizeEmitTimer),this.resizeEmitTimer=this.currentWindow.setTimeout(()=>{this.emitCropData()},T5))},this.onKeyDown=n=>{const{crop:r,onCropChange:s,keyboardStep:i,zoom:o,rotation:a}=this.props;let l=i;if(!this.state.cropSize)return;n.shiftKey&&(l*=.2);let u=qe({},r);switch(n.key){case"ArrowUp":u.y-=l,n.preventDefault();break;case"ArrowDown":u.y+=l,n.preventDefault();break;case"ArrowLeft":u.x-=l,n.preventDefault();break;case"ArrowRight":u.x+=l,n.preventDefault();break;default:return}if(this.props.restrictPosition&&(u=zo(u,this.mediaSize,this.state.cropSize,o,a)),!n.repeat){var d,h;(d=(h=this.props).onInteractionStart)===null||d===void 0||d.call(h,{source:"keyboard"})}s(u)},this.onKeyUp=n=>{var r,s;switch(n.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":n.preventDefault();break;default:return}this.emitCropData(),(r=(s=this.props).onInteractionEnd)===null||r===void 0||r.call(s,{source:"keyboard"})}}componentDidMount(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.onWindowResize),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=E5,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))}componentWillUnmount(){var e;if(!(!this.currentDoc||!this.currentWindow)){if(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.onWindowResize),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.resizeEmitTimer&&clearTimeout(this.resizeEmitTimer),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef){var n;(n=this.styleRef.parentNode)===null||n===void 0||n.removeChild(this.styleRef)}this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()}}componentDidUpdate(e){var n,r,s,i,o,a,l,u;if(e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((n=e.cropSize)===null||n===void 0?void 0:n.height)!==((r=this.props.cropSize)===null||r===void 0?void 0:r.height)||((s=e.cropSize)===null||s===void 0?void 0:s.width)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.width)?this.computeSizes():(((o=e.crop)===null||o===void 0?void 0:o.x)!==((a=this.props.crop)===null||a===void 0?void 0:a.x)||((l=e.crop)===null||l===void 0?void 0:l.y)!==((u=this.props.crop)===null||u===void 0?void 0:u.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video){var d;(d=this.videoRef.current)===null||d===void 0||d.load()}const h=this.getObjectFit();h!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:h},this.computeSizes)}getAspect(){const{cropSize:e,aspect:n}=this.props;return e?e.width/e.height:n}getObjectFit(){if(this.props.objectFit==="cover"){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){var e,n,r,s;this.containerRect=this.containerRef.getBoundingClientRect();const i=this.containerRect.width/this.containerRect.height;return(((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((n=this.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0)/(((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalHeight)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0){const i=Jv(n,r),o=this.props.zoom*(i/this.lastPinchDistance);this.setNewZoom(o,s,{shouldUpdatePosition:!1}),this.lastPinchDistance=i;const a=Yv(n,r),l=this.props.rotation+(a-this.lastPinchRotation);this.props.onRotationChange&&this.props.onRotationChange(l),this.lastPinchRotation=a})}render(){var e;const{image:n,video:r,mediaProps:s,cropperProps:i,transform:o,crop:{x:a,y:l},rotation:u,zoom:d,cropShape:h,showGrid:p,roundCropAreaPixels:f,style:{containerStyle:m,cropAreaStyle:x,mediaStyle:y},classes:{containerClassName:b,cropAreaClassName:g,mediaClassName:k}}=this.props,w=(e=this.state.mediaObjectFit)!==null&&e!==void 0?e:this.getObjectFit();return v.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:C=>this.containerRef=C,"data-testid":"container",style:m,className:fc("reactEasyCrop_Container",b)},n?v.createElement("img",qe(qe({alt:"",className:fc("reactEasyCrop_Image",w==="contain"&&"reactEasyCrop_Contain",w==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",w==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",k)},s),{},{src:n,ref:this.imageRef,style:qe(qe({},y),{},{transform:o||`translate(${a}px, ${l}px) rotate(${u}deg) scale(${d})`}),onLoad:this.onMediaLoad})):r&&v.createElement("video",qe(qe({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:fc("reactEasyCrop_Video",w==="contain"&&"reactEasyCrop_Contain",w==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",w==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",k)},s),{},{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:qe(qe({},y),{},{transform:o||`translate(${a}px, ${l}px) rotate(${u}deg) scale(${d})`}),controls:!1}),(Array.isArray(r)?r:[{src:r}]).map(C=>v.createElement("source",qe({key:C.src},C)))),this.state.cropSize&&v.createElement("div",qe({ref:this.cropperRef,style:qe(qe({},x),{},{width:f?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:f?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:fc("reactEasyCrop_CropArea",h==="round"&&"reactEasyCrop_CropAreaRound",p&&"reactEasyCrop_CropAreaGrid",g)},i)))}};hh.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:P5,minZoom:M5,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:A5};hh.getMousePoint=t=>({x:Number(t.clientX),y:Number(t.clientY)});hh.getTouchPoint=t=>({x:Number(t.clientX),y:Number(t.clientY)});var D5=hh;function L5(t){return new Promise((e,n)=>{const r=new Image;r.addEventListener("load",()=>e(r)),r.addEventListener("error",s=>n(s)),r.crossOrigin="anonymous",r.src=t})}async function R5(t,e,n="image/png"){const r=await L5(t),s=document.createElement("canvas");return s.width=Math.round(e.width),s.height=Math.round(e.height),s.getContext("2d").drawImage(r,e.x,e.y,e.width,e.height,0,0,s.width,s.height),new Promise((o,a)=>{s.toBlob(l=>{if(!l){a(new Error("Zuschneiden fehlgeschlagen"));return}o(l)},n)})}function _5(t){return t==="image/jpeg"?"jpg":t==="image/webp"?"webp":"png"}function cr({value:t,onChange:e,label:n="Bild",aspect:r}){const[s,i]=v.useState(!1),[o,a]=v.useState(""),[l,u]=v.useState(null),[d,h]=v.useState("image/png"),[p,f]=v.useState({x:0,y:0}),[m,x]=v.useState(1),[y,b]=v.useState(null),[g,k]=v.useState(r||1),w=E=>{h(E.type||"image/png"),f({x:0,y:0}),x(1),b(null),k(r||1),u(URL.createObjectURL(E))},C=E=>{var P;const D=(P=E.target.files)==null?void 0:P[0];E.target.value="",D&&(a(""),w(D))},j=async()=>{if(t){a("");try{const D=await(await fetch(t)).blob();w(D)}catch{a("Bild konnte nicht zum Zuschneiden geladen werden.")}}},S=({width:E,height:D})=>{!r&&E&&D&&k(E/D)},N=()=>{l&&URL.revokeObjectURL(l),u(null)},T=async()=>{if(!(!l||!y)){i(!0),a("");try{const E=await R5(l,y,d),D=new FormData;D.append("file",E,`zugeschnitten.${_5(d)}`);const P=await A.post("/uploads",D);e(P.path),N()}catch(E){a(E.message)}finally{i(!1)}}};return c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:n}),c.jsxs("div",{className:"flex items-center gap-3",children:[t&&c.jsxs("div",{className:"relative",children:[c.jsx("img",{src:t,alt:"",className:"h-12 w-12 rounded-md object-cover"}),c.jsx("button",{type:"button",onClick:()=>e(null),title:"Bild entfernen","aria-label":"Bild entfernen",className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-red-600 text-xs font-bold leading-none text-white shadow hover:bg-red-700",children:"×"})]}),c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",onChange:C,className:"text-sm"}),t&&c.jsx("button",{type:"button",onClick:j,className:"rounded-md border border-neutral-300 px-2 py-1 text-xs font-medium text-neutral-600 hover:bg-neutral-50 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Zuschneiden"}),s&&c.jsx("span",{className:"text-sm text-neutral-500",children:"Lädt hoch…"})]}),o&&c.jsx("p",{className:"mt-1 text-sm text-red-600",children:o}),l&&c.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",children:c.jsxs("div",{className:"w-full max-w-lg rounded-xl bg-white p-4 dark:bg-neutral-900",children:[c.jsx("p",{className:"mb-3 text-sm font-semibold text-neutral-900 dark:text-white",children:"Bild zuschneiden"}),c.jsx("div",{className:"relative h-80 w-full overflow-hidden rounded-md bg-neutral-800 sm:h-96",children:c.jsx(D5,{image:l,crop:p,zoom:m,aspect:g,onCropChange:f,onZoomChange:x,onCropComplete:(E,D)=>b(D),onMediaLoaded:S})}),c.jsx("input",{type:"range",min:1,max:3,step:.01,value:m,onChange:E=>x(Number(E.target.value)),className:"mt-4 w-full"}),o&&c.jsx("p",{className:"mt-2 text-sm text-red-600",children:o}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",onClick:N,disabled:s,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"}),c.jsx("button",{type:"button",onClick:T,disabled:s||!y,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s?"Lädt hoch…":"Übernehmen"})]})]})})]})}const I5=[{label:"Standard",value:""},{label:"S (14px)",value:"14px"},{label:"M (16px)",value:"16px"},{label:"L (18px)",value:"18px"},{label:"XL (20px)",value:"20px"},{label:"XXL (24px)",value:"24px"},{label:"XXXL (28px)",value:"28px"},{label:"Groß (36px)",value:"36px"},{label:"Riesig (48px)",value:"48px"}],Tf={font_family:"",font_size:"",color:""};function Vs({fieldKey:t,previewText:e="Beispieltext",label:n="Stil"}){const r=uh(),[s,i]=v.useState(Tf),[o,a]=v.useState(!0),[l,u]=v.useState("");v.useEffect(()=>{a(!0),A.get(`/text-styles/one?key=${encodeURIComponent(t)}`).then(p=>i({font_family:p.font_family||"",font_size:p.font_size||"",color:p.color||""})).catch(()=>i(Tf)).finally(()=>a(!1))},[t]);const d=async p=>{i(p),u("");try{await A.put("/text-styles",{field_key:t,...p})}catch(f){u(f.message)}};if(o)return null;const h={fontFamily:s.font_family||void 0,fontSize:s.font_size||void 0,color:s.color||void 0};return c.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-700 dark:bg-neutral-800/50",children:[c.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral-400",children:n}),c.jsx("select",{value:s.font_family,onChange:p=>d({...s,font_family:p.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:r.map(p=>c.jsx("option",{value:p.value,children:p.label},p.label))}),c.jsx("select",{value:s.font_size,onChange:p=>d({...s,font_size:p.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:I5.map(p=>c.jsx("option",{value:p.value,children:p.label},p.label))}),c.jsx("input",{type:"color",value:s.color||"#000000",onChange:p=>d({...s,color:p.target.value}),className:"h-7 w-9 cursor-pointer rounded border border-neutral-300 bg-white p-0.5 dark:border-neutral-700 dark:bg-neutral-900",title:"Textfarbe"}),c.jsx("button",{type:"button",onClick:()=>d(Tf),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700",children:"Zurücksetzen"}),c.jsx("span",{className:"ml-1 rounded px-2 py-1 text-sm",style:h,children:e}),l&&c.jsx("span",{className:"text-xs text-red-600",children:l})]})}const Zv={name:"",image_path:"",sort_order:0};function O5(){const[t,e]=v.useState([]),[n,r]=v.useState(Zv),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/brands").then(e);v.useEffect(()=>{l()},[]);const u=f=>{i(f.id),r({name:f.name,image_path:f.image_path||"",sort_order:f.sort_order})},d=()=>{i(null),r(Zv)},h=async f=>{f.preventDefault(),a("");try{s?await A.put(`/brands/${s}`,n):await A.post("/brands",n),d(),l()}catch(m){a(m.message)}},p=async f=>{confirm("Marke inkl. aller Modelle/Pakete/Produkte wirklich löschen?")&&(await A.delete(`/brands/${f}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Marken"}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Bild"}),c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(f=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:f.image_path?c.jsx("img",{src:f.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:c.jsx(ne,{to:`/marken/${f.slug}`,target:"_blank",className:"hover:text-brand-500",children:f.name})}),c.jsx("td",{className:"px-4 py-2",children:f.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(f),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>p(f.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},f.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Marken angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.name,onChange:f=>r({...n,name:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),s&&c.jsx(Vs,{fieldKey:`brands.${s}.name`,previewText:n.name||"Beispieltext"})]}),c.jsx(cr,{value:n.image_path,onChange:f=>r({...n,image_path:f}),label:"Bild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:f=>r({...n,sort_order:Number(f.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const Qv={name:"",brand_id:"",image_path:"",sort_order:0};function B5(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(Qv),[o,a]=v.useState(null),[l,u]=v.useState(""),[d,h]=v.useState("all"),p=v.useMemo(()=>d==="all"?t:t.filter(g=>String(g.brand_id)===d),[t,d]),f=()=>{A.get("/models").then(e),A.get("/brands").then(r)};v.useEffect(f,[]);const m=g=>{a(g.id),i({name:g.name,brand_id:g.brand_id,image_path:g.image_path||"",sort_order:g.sort_order})},x=()=>{a(null),i(Qv)},y=async g=>{g.preventDefault(),u("");const k={...s,brand_id:Number(s.brand_id)};try{o?await A.put(`/models/${o}`,k):await A.post("/models",k),x(),f()}catch(w){u(w.message)}},b=async g=>{confirm("Modell inkl. aller Pakete/Produkte wirklich löschen?")&&(await A.delete(`/models/${g}`),f())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Modelle"}),c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Nach Marke filtern:"}),c.jsxs("select",{value:d,onChange:g=>h(g.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Marken"}),n.map(g=>c.jsx("option",{value:String(g.id),children:g.name},g.id))]}),d!=="all"&&c.jsx("button",{onClick:()=>h("all"),className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[p.length," von ",t.length]})]}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Bild"}),c.jsx("th",{className:"px-4 py-2",children:"Marke"}),c.jsx("th",{className:"px-4 py-2",children:"Modell"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[p.map(g=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:g.image_path?c.jsx("img",{src:g.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2",children:g.brand_name}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:g.name}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>m(g),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>b(g.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},g.id)),p.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:t.length===0?"Noch keine Modelle angelegt.":"Keine Modelle für diese Marke."})})]})]})})]}),c.jsxs("form",{onSubmit:y,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:o?"Modell bearbeiten":"Neues Modell"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Marke *"}),c.jsxs("select",{required:!0,value:s.brand_id,onChange:g=>i({...s,brand_id:g.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Bitte wählen…"}),n.map(g=>c.jsx("option",{value:g.id,children:g.name},g.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Modellname *"}),c.jsx("input",{required:!0,value:s.name,onChange:g=>i({...s,name:g.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),o&&c.jsx(Vs,{fieldKey:`car_models.${o}.name`,previewText:s.name||"Beispieltext"})]}),c.jsx(cr,{value:s.image_path,onChange:g=>i({...s,image_path:g}),label:"Bild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:s.sort_order,onChange:g=>i({...s,sort_order:Number(g.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o?"Speichern":"Anlegen"}),o&&c.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const ek={name:"",cover_image_path:"",sort_order:0};function z5(){const[t,e]=v.useState([]),[n,r]=v.useState(ek),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/gallery-brands").then(e);v.useEffect(()=>{l()},[]);const u=f=>{i(f.id),r({name:f.name,cover_image_path:f.cover_image_path||"",sort_order:f.sort_order})},d=()=>{i(null),r(ek)},h=async f=>{f.preventDefault(),a("");try{s?await A.put(`/gallery-brands/${s}`,n):await A.post("/gallery-brands",n),d(),l()}catch(m){a(m.message)}},p=async f=>{confirm("Marke inkl. aller Projekte/Fotos wirklich löschen?")&&(await A.delete(`/gallery-brands/${f}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Marken"}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Bild"}),c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(f=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:f.cover_image_path?c.jsx("img",{src:f.cover_image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:c.jsx(ne,{to:`/galerie/${f.slug}`,target:"_blank",className:"hover:text-brand-500",children:f.name})}),c.jsx("td",{className:"px-4 py-2",children:f.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(f),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>p(f.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},f.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Galerie-Marken angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Marke bearbeiten":"Neue Marke"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.name,onChange:f=>r({...n,name:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(cr,{value:n.cover_image_path,onChange:f=>r({...n,cover_image_path:f}),aspect:4/3,label:"Titelbild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:f=>r({...n,sort_order:Number(f.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const tk={name:"",gallery_brand_id:"",cover_image_path:"",sort_order:0};function F5(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(tk),[o,a]=v.useState(null),[l,u]=v.useState(""),[d,h]=v.useState("all"),p=v.useMemo(()=>d==="all"?t:t.filter(g=>String(g.gallery_brand_id)===d),[t,d]),f=()=>{A.get("/gallery-projects").then(e),A.get("/gallery-brands").then(r)};v.useEffect(f,[]);const m=g=>{a(g.id),i({name:g.name,gallery_brand_id:g.gallery_brand_id,cover_image_path:g.cover_image_path||"",sort_order:g.sort_order})},x=()=>{a(null),i(tk)},y=async g=>{g.preventDefault(),u("");const k={...s,gallery_brand_id:Number(s.gallery_brand_id)};try{o?await A.put(`/gallery-projects/${o}`,k):await A.post("/gallery-projects",k),x(),f()}catch(w){u(w.message)}},b=async g=>{confirm("Projekt inkl. aller Fotos wirklich löschen?")&&(await A.delete(`/gallery-projects/${g}`),f())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Projekte"}),c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Nach Marke filtern:"}),c.jsxs("select",{value:d,onChange:g=>h(g.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Marken"}),n.map(g=>c.jsx("option",{value:String(g.id),children:g.name},g.id))]}),d!=="all"&&c.jsx("button",{onClick:()=>h("all"),className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[p.length," von ",t.length]})]}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Marke"}),c.jsx("th",{className:"px-4 py-2",children:"Projekt"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[p.map(g=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:g.brand_name}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:g.name}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx(ne,{to:`/admin/gallery-projects/${g.id}/photos`,className:"mr-3 text-brand-600 hover:underline",children:"Fotos"}),c.jsx("button",{onClick:()=>m(g),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>b(g.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},g.id)),p.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:t.length===0?"Noch keine Projekte angelegt.":"Keine Projekte für diese Marke."})})]})]})})]}),c.jsxs("form",{onSubmit:y,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:o?"Projekt bearbeiten":"Neues Projekt"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Marke *"}),c.jsxs("select",{required:!0,value:s.gallery_brand_id,onChange:g=>i({...s,gallery_brand_id:g.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Bitte wählen…"}),n.map(g=>c.jsx("option",{value:g.id,children:g.name},g.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Projektname *"}),c.jsx("input",{required:!0,placeholder:"z. B. Audi TT",value:s.name,onChange:g=>i({...s,name:g.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(cr,{value:s.cover_image_path,onChange:g=>i({...s,cover_image_path:g}),aspect:4/3,label:"Titelbild (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:s.sort_order,onChange:g=>i({...s,sort_order:Number(g.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),l&&c.jsx("p",{className:"text-sm text-red-600",children:l}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:o?"Speichern":"Anlegen"}),o&&c.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}function V5(){const{projectId:t}=ii(),[e,n]=v.useState([]),[r,s]=v.useState(""),[i,o]=v.useState(!1),[a,l]=v.useState(""),u=v.useRef(null),d=()=>A.get(`/gallery-projects/${t}/photos`).then(n);v.useEffect(()=>{d()},[t]);const h=async y=>{const b=Array.from(y.target.files||[]);if(b.length!==0){s(""),o(!0);try{for(let g=0;g{n(g=>g.map(k=>k.id===y.id?{...k,caption:b}:k))},f=(y,b)=>{n(g=>g.map(k=>k.id===y.id?{...k,sort_order:b}:k))},m=async y=>{await A.put(`/gallery-photos/${y.id}`,{caption:y.caption,sort_order:y.sort_order}),d()},x=async y=>{confirm("Foto wirklich entfernen?")&&(await A.delete(`/gallery-photos/${y}`),d())};return c.jsxs("div",{children:[c.jsx("p",{className:"mb-2 text-sm",children:c.jsx(ne,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Fotos im Projekt"}),c.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Fotos hinzufügen (Mehrfachauswahl möglich)"}),c.jsx("input",{ref:u,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:h,disabled:i,className:"text-sm"}),i&&c.jsx("p",{className:"mt-2 text-sm text-neutral-500",children:a})]}),r&&c.jsx("p",{className:"mb-4 text-sm text-red-600",children:r}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:[e.map(y=>c.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("img",{src:y.image_path,alt:y.caption||"",className:"aspect-square w-full object-cover"}),c.jsxs("div",{className:"space-y-2 p-3",children:[c.jsx("input",{value:y.caption||"",onChange:b=>p(y,b.target.value),onBlur:()=>m(y),placeholder:"Bildunterschrift (optional)",className:"w-full rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"number",value:y.sort_order,onChange:b=>f(y,Number(b.target.value)),onBlur:()=>m(y),className:"w-16 rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),c.jsx("button",{onClick:()=>x(y.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]},y.id)),e.length===0&&c.jsx("p",{className:"col-span-full py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})]})}const $5=["Base","Clear","Drive","Prime","Elite","Apex","The Statement","Limitless"],H5=t=>(t+1)*10,pc="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",Vm=t=>({description:t.description||"",markup_type:t.markup_type||"none",markup_value:t.markup_value||0,icon_name:t.icon_name||"",tagline:t.tagline||"",price_text:t.price_text||"",is_featured:!!t.is_featured,sort_order:t.sort_order??0}),W5=t=>({description:"",markup_type:"none",markup_value:0,icon_name:"",tagline:"",price_text:"",is_featured:!1,sort_order:H5(t)}),U5=["description","markup_type","markup_value","icon_name","tagline","price_text","is_featured","sort_order"],Mf=t=>{if(!t.existing)return t.checked;const e=Vm(t.existing);return U5.some(n=>n==="is_featured"?!!e[n]!=!!t.form[n]:String(e[n])!==String(t.form[n]))},Fo=(t,e)=>{const n=e.filter(o=>o.car_model_id===t).slice().sort((o,a)=>o.sort_order-a.sort_order||o.name.localeCompare(a.name)),r=new Set,s=$5.map((o,a)=>{const l=n.find(u=>!r.has(u.id)&&u.name.trim().toLowerCase()===o.toLowerCase());return l&&r.add(l.id),{key:`tier-${a}`,tierName:o,existing:l||null,checked:!!l,form:l?Vm(l):W5(a)}}),i=n.filter(o=>!r.has(o.id)).map(o=>({key:`legacy-${o.id}`,tierName:null,existing:o,checked:!0,form:Vm(o)}));return[...s,...i]},K5=t=>{t.target.style.height="auto",t.target.style.height=`${t.target.scrollHeight}px`};function G5(){const[t,e]=v.useState([]),[n,r]=v.useState([]),[s,i]=v.useState(""),[o,a]=v.useState(""),[l,u]=v.useState([]),[d,h]=v.useState({}),[p,f]=v.useState(!1),[m,x]=v.useState(null),[y,b]=v.useState(""),[g,k]=v.useState(!1),[w,C]=v.useState(null),[j,S]=v.useState("all"),[N,T]=v.useState("all"),E=v.useRef(new Map),D=M=>{const Y=E.current.get(M);if(!Y)return;const{selectionStart:re,selectionEnd:De,value:pn}=Y;if(re===De)return;const Yt=pn.slice(re,De),Ot=Yt.startsWith("**")&&Yt.endsWith("**")&&Yt.length>=4?Yt.slice(2,-2):`**${Yt}**`,_e=pn.slice(0,re)+Ot+pn.slice(De);K(M,{description:_e}),requestAnimationFrame(()=>{Y.focus();const gn=re+Ot.length;Y.setSelectionRange(gn,gn)})},P=async()=>{const[M,Y]=await Promise.all([A.get("/packages"),A.get("/models")]);return e(M),r(Y),M};v.useEffect(()=>{P()},[]);const O=v.useMemo(()=>new Map(n.map(M=>[M.id,M])),[n]),W=v.useMemo(()=>{const M=new Map;return n.forEach(Y=>{M.has(Y.brand_id)||M.set(Y.brand_id,Y.brand_name)}),Array.from(M,([Y,re])=>({id:Y,name:re})).sort((Y,re)=>Y.name.localeCompare(re.name))},[n]),I=v.useMemo(()=>n.filter(M=>!s||String(M.brand_id)===s).sort((M,Y)=>M.name.localeCompare(Y.name)),[n,s]),z=o?O.get(Number(o)):null,q=v.useMemo(()=>l.some(Mf),[l]),R=()=>!q||confirm("Ungespeicherte Änderungen verwerfen?"),_=(M,Y,re=t)=>{i(String(M)),a(String(Y)),u(Fo(Number(Y),re)),h({}),x(null),b(""),C(null)},$=M=>{R()&&(i(M),a(""),u([]),h({}),x(null),C(null))},ee=M=>{if(!R())return;if(!M){a(""),u([]);return}const Y=O.get(Number(M));_(Y?Y.brand_id:s,M)},te=(M,Y)=>u(re=>re.map(De=>De.key===M?{...De,checked:Y}:De)),K=(M,Y)=>u(re=>re.map(De=>De.key===M?{...De,form:{...De.form,...Y}}:De)),X=M=>({name:M.tierName??M.existing.name,car_model_id:Number(o),...M.form,markup_value:Number(M.form.markup_value),sort_order:Number(M.form.sort_order)}),ae=async()=>{f(!0),x(null);const M={},Y=l;let re=0,De=0;for(const _e of l)try{_e.existing?Mf(_e)&&(await A.put(`/packages/${_e.existing.id}`,X(_e)),De+=1):_e.checked&&(await A.post("/packages",X(_e)),re+=1)}catch(gn){M[_e.key]=gn.message}const pn=await P(),Yt=Fo(Number(o),pn).map(_e=>{if(!M[_e.key])return _e;const gn=Y.find($l=>$l.key===_e.key);return gn?{..._e,checked:gn.checked,form:gn.form}:_e});u(Yt),h(M);const mn=Object.keys(M).length,Ot=[];re&&Ot.push(`${re} neu angelegt`),De&&Ot.push(`${De} aktualisiert`),!Ot.length&&!mn&&Ot.push("Keine Änderungen"),x(mn?{kind:"error",text:`${Ot.join(", ")||"Nichts gespeichert"} – ${mn} Paket(e) fehlgeschlagen (Details an der Zeile).`}:{kind:"ok",text:`${Ot.join(", ")}.`}),f(!1)},ue=async M=>{if(!confirm(`Paket "${M.tierName??M.existing.name}" inkl. aller Produkte wirklich löschen?`))return;await A.delete(`/packages/${M.existing.id}`);const Y=await P();u(Fo(Number(o),Y)),x(null)},Ge=async M=>{if(!confirm("Paket inkl. aller Produkte wirklich löschen?"))return;await A.delete(`/packages/${M.id}`);const Y=await P();o&&u(Fo(Number(o),Y))},fn=async()=>{if(!y||!R())return;const M=O.get(Number(y)),Y=O.get(Number(o));if(confirm(`Alle Pakete von "${M.brand_name} ${M.name}" inkl. verknüpfter Produkte nach "${Y.brand_name} ${Y.name}" kopieren?
+
+Bereits vorhandene Paketstufen werden übersprungen. Upgrades werden nicht mitkopiert.`)){k(!0),C(null);try{const re=await A.post(`/models/${o}/copy-packages`,{source_model_id:Number(y)}),De=re.copied.reduce((mn,Ot)=>mn+Ot.products,0),pn=[`${re.copied.length} Paket(e) kopiert (${De} Produkte)`];re.skipped.length&&pn.push(`übersprungen: ${re.skipped.join(", ")}`),C({text:`${pn.join(" – ")}.`});const Yt=await P();u(Fo(Number(o),Yt)),h({})}catch(re){C({error:re.message})}k(!1)}},Eo=l.filter(M=>!M.existing&&M.checked).length,Fl=l.filter(M=>M.existing&&Mf(M)).length,Vl=v.useMemo(()=>n.filter(M=>j==="all"||String(M.brand_id)===j).sort((M,Y)=>M.name.localeCompare(Y.name)),[n,j]),li=v.useMemo(()=>t.filter(M=>{const Y=O.get(M.car_model_id);return!(j!=="all"&&String(Y==null?void 0:Y.brand_id)!==j||N!=="all"&&String(M.car_model_id)!==N)}),[t,O,j,N]),ci=c.jsxs("div",{children:[c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Filtern:"}),c.jsxs("select",{value:j,onChange:M=>{S(M.target.value),T("all")},className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Marken"}),W.map(M=>c.jsx("option",{value:String(M.id),children:M.name},M.id))]}),c.jsxs("select",{value:N,onChange:M=>T(M.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"all",children:"Alle Modelle"}),Vl.map(M=>c.jsxs("option",{value:String(M.id),children:[M.brand_name," ",M.name]},M.id))]}),(j!=="all"||N!=="all")&&c.jsx("button",{onClick:()=>{S("all"),T("all")},className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),c.jsxs("span",{className:"text-sm text-neutral-400",children:[li.length," von ",t.length]})]}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Marke / Modell"}),c.jsx("th",{className:"px-4 py-2",children:"Paket"}),c.jsx("th",{className:"px-4 py-2",children:"Aufschlag"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[li.map(M=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsxs("td",{className:"px-4 py-2",children:[M.brand_name," ",M.model_name]}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:c.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[M.name,M.is_featured&&c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400",children:"Empfohlen"})]})}),c.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[M.markup_type==="fixed"&&`+${M.markup_value} €`,M.markup_type==="percent"&&`+${M.markup_value} %`,(!M.markup_type||M.markup_type==="none")&&"–"]}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx(ne,{to:`/admin/packages/${M.id}/products`,className:"mr-3 text-brand-600 hover:underline",children:"Produkte"}),c.jsx(ne,{to:`/admin/packages/${M.id}/upgrades`,className:"mr-3 text-brand-600 hover:underline",children:"Upgrades"}),c.jsx("button",{onClick:()=>{if(!R())return;const Y=O.get(M.car_model_id);_(Y.brand_id,M.car_model_id),window.scrollTo({top:0,behavior:"smooth"})},className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>Ge(M),className:"text-red-600 hover:underline",children:"Löschen"})]})]},M.id)),li.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:t.length===0?"Noch keine Pakete angelegt.":"Keine Pakete für diesen Filter."})})]})]})})]});return c.jsxs("div",{className:"space-y-6",children:[c.jsx("h1",{className:"text-xl font-bold text-neutral-900 dark:text-white",children:"Pakete"}),c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"mb-3 font-bold text-neutral-900 dark:text-white",children:"Modell wählen"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs("select",{value:s,onChange:M=>$(M.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Marke wählen…"}),W.map(M=>c.jsx("option",{value:String(M.id),children:M.name},M.id))]}),c.jsxs("select",{value:o,onChange:M=>ee(M.target.value),className:"min-w-[220px] rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Modell wählen…"}),I.map(M=>c.jsxs("option",{value:String(M.id),children:[M.brand_name," ",M.name]},M.id))]})]}),!o&&c.jsx("p",{className:"mt-2 text-sm text-neutral-500 dark:text-neutral-400",children:"Modell auswählen, um dessen Pakete anzulegen oder zu bearbeiten – die Standard-Paketstufen stehen dann als Checkliste bereit."})]}),z&&c.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsxs("div",{className:"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800",children:[c.jsxs("h2",{className:"font-bold text-neutral-900 dark:text-white",children:["Pakete für ",z.brand_name," ",z.name]}),c.jsx("p",{className:"mt-1 text-sm text-neutral-500 dark:text-neutral-400",children:"Paketstufen anhaken, Beschreibung und Aufschlag ausfüllen, unten alles auf einmal speichern."}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-2.5 dark:border-neutral-800 dark:bg-neutral-950",children:[c.jsx("span",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Pakete von anderem Modell kopieren:"}),c.jsxs("select",{value:y,onChange:M=>b(M.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"",children:"Quellmodell wählen…"}),n.filter(M=>String(M.id)!==o).sort((M,Y)=>`${M.brand_name} ${M.name}`.localeCompare(`${Y.brand_name} ${Y.name}`)).map(M=>c.jsxs("option",{value:String(M.id),children:[M.brand_name," ",M.name]},M.id))]}),c.jsx("button",{type:"button",onClick:fn,disabled:!y||g,className:"rounded-md border border-brand-500 px-3 py-1.5 text-sm font-semibold text-brand-600 hover:bg-brand-50 disabled:opacity-50 dark:hover:bg-brand-900/20",children:g?"Kopiert…":"Kopieren"}),c.jsx("span",{className:"text-xs text-neutral-400",children:"inkl. Produkte, ohne Upgrades"}),w&&c.jsx("span",{className:`w-full text-sm ${w.error?"text-red-600":"text-brand-600 dark:text-brand-400"}`,children:w.error||w.text})]})]}),c.jsx("div",{children:l.map((M,Y)=>c.jsxs("div",{children:[M.tierName===null&&Y>0&&l[Y-1].tierName!==null&&c.jsx("div",{className:"border-t border-neutral-200 bg-neutral-50 px-5 py-2 text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-400",children:"Weitere Pakete (alte Namen)"}),c.jsxs("div",{className:`border-t border-neutral-100 dark:border-neutral-800 ${M.checked?"":"opacity-70"}`,children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-5 py-3",children:[c.jsxs("label",{className:"flex cursor-pointer items-center gap-3",children:[c.jsx("input",{type:"checkbox",checked:M.checked,disabled:!!M.existing||p,onChange:re=>te(M.key,re.target.checked),className:"h-5 w-5 rounded border-neutral-300 text-brand-600 focus:ring-brand-500 disabled:opacity-60"}),c.jsx("span",{className:"font-semibold text-neutral-900 dark:text-white",children:M.tierName??M.existing.name})]}),M.tierName===null&&c.jsx("span",{className:"text-xs text-neutral-400",children:"(alter Name)"}),M.existing?c.jsx("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-xs font-semibold text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",children:"Vorhanden"}):M.checked&&c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400",children:"Neu"}),M.form.is_featured&&c.jsx("span",{className:"rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400",children:"Empfohlen"}),M.existing&&c.jsxs("span",{className:"ml-auto flex items-center gap-3 text-sm",children:[c.jsx(ne,{to:`/admin/packages/${M.existing.id}/products`,className:"text-brand-600 hover:underline",children:"Produkte"}),c.jsx(ne,{to:`/admin/packages/${M.existing.id}/upgrades`,className:"text-brand-600 hover:underline",children:"Upgrades"}),c.jsx("button",{type:"button",onClick:()=>ue(M),className:"text-red-600 hover:underline",children:"Löschen"})]})]}),M.checked&&c.jsxs("div",{className:"space-y-4 px-5 pb-5 sm:pl-[52px]",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),c.jsx("p",{className:"mb-1 text-xs text-neutral-500 dark:text-neutral-400",children:'Jede Zeile erscheint als eigener Stichpunkt zusammen mit den Bauteilen. Text markieren und "Fett" klicken, um nur diese Stelle hervorzuheben.'}),c.jsx("div",{className:"mb-1",children:c.jsx("button",{type:"button",onClick:()=>D(M.key),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs font-bold text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800",children:"Fett"})}),c.jsx("textarea",{ref:re=>E.current.set(M.key,re),rows:10,value:M.form.description,onChange:re=>K(M.key,{description:re.target.value}),onInput:K5,className:pc}),M.existing&&c.jsx(Vs,{fieldKey:`packages.${M.existing.id}.description`,previewText:"Beispieltext"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Aufschlag"}),c.jsxs("div",{className:"flex max-w-md gap-2",children:[c.jsxs("select",{value:M.form.markup_type,onChange:re=>K(M.key,{markup_type:re.target.value}),className:"w-40 rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[c.jsx("option",{value:"none",children:"Kein Aufschlag"}),c.jsx("option",{value:"fixed",children:"Fester Betrag (€)"}),c.jsx("option",{value:"percent",children:"Prozent (%)"})]}),c.jsx("input",{type:"number",step:"0.01",min:"0",disabled:M.form.markup_type==="none",value:M.form.markup_value,onChange:re=>K(M.key,{markup_value:re.target.value}),className:`${pc} disabled:opacity-50`})]}),c.jsx("p",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"Wird auf die Summe der Bauteilpreise aufgeschlagen und ergibt den Gesamtpreis für den Kunden."})]}),c.jsxs("details",{className:"rounded-lg border border-neutral-200 dark:border-neutral-800",children:[c.jsx("summary",{className:"cursor-pointer select-none px-3 py-2 text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Weitere Optionen (Preis-Text, Empfohlen, Sortierung)"}),c.jsxs("div",{className:"space-y-4 border-t border-neutral-200 p-3 dark:border-neutral-800",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Preis-Text (optional)"}),c.jsx("input",{value:M.form.price_text,onChange:re=>K(M.key,{price_text:re.target.value}),placeholder:'z. B. "Coming soon" oder "Preis auf Anfrage"',className:pc}),c.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"Ersetzt auf der Kachel den berechneten Preis, solange ausgefüllt."}),M.existing&&c.jsx(Vs,{fieldKey:`packages.${M.existing.id}.price_text`,previewText:"Beispieltext"})]}),c.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[c.jsx("input",{type:"checkbox",checked:M.form.is_featured,onChange:re=>K(M.key,{is_featured:re.target.checked}),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),"Als empfohlen hervorheben"]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:M.form.sort_order,onChange:re=>K(M.key,{sort_order:re.target.value}),className:`${pc} max-w-[160px]`})]})]})]}),d[M.key]&&c.jsx("p",{className:"text-sm text-red-600",children:d[M.key]})]})]})]},M.key))}),c.jsxs("div",{className:"sticky bottom-0 flex flex-wrap items-center gap-3 rounded-b-xl border-t border-neutral-200 bg-white px-5 py-3 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("button",{type:"button",onClick:ae,disabled:p||!q,className:"rounded-md bg-brand-500 px-5 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:p?"Speichert…":"Alle speichern"}),c.jsxs("span",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:[Eo," neu, ",Fl," geändert"]}),m&&c.jsx("span",{className:`text-sm ${m.kind==="error"?"text-red-600":"text-brand-600 dark:text-brand-400"}`,children:m.text})]})]}),z?c.jsxs("details",{className:"rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("summary",{className:"cursor-pointer select-none px-5 py-3 font-bold text-neutral-900 dark:text-white",children:"Alle Pakete (Übersicht)"}),c.jsx("div",{className:"border-t border-neutral-200 p-5 dark:border-neutral-800",children:ci})]}):ci]})}const mc=[...wM].sort(),q5=120,J5=200;function Y5({value:t,onChange:e}){const[n,r]=v.useState(""),s=v.useMemo(()=>{const i=n.trim().toLowerCase();return i?mc.filter(o=>o.includes(i)).slice(0,J5):mc.slice(0,q5)},[n]);return c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 flex items-center gap-3 rounded-md border border-neutral-300 p-2 dark:border-neutral-700",children:[c.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:t?c.jsx(vt,{name:t,className:"h-6 w-6"}):c.jsx("span",{className:"text-xs text-neutral-400",children:"?"})}),c.jsxs("div",{className:"text-sm",children:[c.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:t||"Kein Icon gewählt"}),c.jsxs("p",{className:"text-xs text-neutral-400",children:[mc.length," Icons verfügbar"]})]})]}),c.jsx("input",{value:n,onChange:i=>r(i.target.value),placeholder:"Icon suchen (z. B. car, shield, zap)…",className:"mb-2 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"}),c.jsxs("div",{className:"grid max-h-64 grid-cols-6 gap-1 overflow-y-auto rounded-md border border-neutral-200 p-2 sm:grid-cols-8 dark:border-neutral-700",children:[s.map(i=>c.jsx("button",{type:"button",title:i,onClick:()=>e(i),className:`flex h-10 w-10 items-center justify-center rounded-md transition ${t===i?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:c.jsx(vt,{name:i,className:"h-5 w-5"})},i)),s.length===0&&c.jsx("p",{className:"col-span-full py-4 text-center text-sm text-neutral-400",children:"Keine Icons gefunden."})]}),!n&&c.jsxs("p",{className:"mt-1 text-xs text-neutral-400",children:["Tipp: Tippe einen Suchbegriff ein, um alle ",mc.length," Icons zu durchsuchen."]})]})}const nk={icon_name:"",title:"",description:"",image_path:"",cta_label:"",cta_url:"",sort_order:0};function X5(){const[t,e]=v.useState([]),[n,r]=v.useState(nk),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/services").then(e);v.useEffect(l,[]);const u=f=>{i(f.id),r({icon_name:f.icon_name,title:f.title,description:f.description,image_path:f.image_path||"",cta_label:f.cta_label||"",cta_url:f.cta_url||"",sort_order:f.sort_order})},d=()=>{i(null),r(nk)},h=async f=>{if(f.preventDefault(),a(""),!n.icon_name){a("Bitte ein Icon auswählen");return}const m={...n,sort_order:Number(n.sort_order)};try{s?await A.put(`/services/${s}`,m):await A.post("/services",m),d(),l()}catch(x){a(x.message)}},p=async f=>{confirm("Diese Leistung wirklich löschen?")&&(await A.delete(`/services/${f}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Leistungen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Karten erscheinen auf der öffentlichen Leistungen-Seite. Die 8 mitgelieferten Einträge sind die Standard-Einstellung – du kannst sie bearbeiten, löschen und beliebig neue hinzufügen."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Icon"}),c.jsx("th",{className:"px-4 py-2",children:"Titel"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(f=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:c.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400",children:c.jsx(vt,{name:f.icon_name,className:"h-5 w-5"})})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:f.title}),c.jsx("td",{className:"px-4 py-2",children:f.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(f),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>p(f.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},f.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Leistungen angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Leistung bearbeiten":"Neue Leistung"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Icon *"}),c.jsx(Y5,{value:n.icon_name,onChange:f=>r({...n,icon_name:f})})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.title,onChange:f=>r({...n,title:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung *"}),c.jsx("textarea",{required:!0,rows:4,value:n.description,onChange:f=>r({...n,description:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(cr,{value:n.image_path,onChange:f=>r({...n,image_path:f}),aspect:4/3,label:"Bild"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Button-Text (optional)"}),c.jsx("input",{value:n.cta_label,onChange:f=>r({...n,cta_label:f.target.value}),placeholder:"z. B. Fahrzeug konfigurieren",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Button-Link (optional)"}),c.jsx("input",{value:n.cta_url,onChange:f=>r({...n,cta_url:f.target.value}),placeholder:"z. B. /fahrzeuge",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:f=>r({...n,sort_order:Number(f.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const rk={question_de:"",answer_de:"",question_en:"",answer_en:"",sort_order:0};function Z5(){const[t,e]=v.useState([]),[n,r]=v.useState(rk),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/faqs").then(e);v.useEffect(l,[]);const u=f=>{i(f.id),r({question_de:f.question_de,answer_de:f.answer_de,question_en:f.question_en,answer_en:f.answer_en,sort_order:f.sort_order})},d=()=>{i(null),r(rk)},h=async f=>{f.preventDefault(),a("");const m={...n,sort_order:Number(n.sort_order)};try{s?await A.put(`/faqs/${s}`,m):await A.post("/faqs",m),d(),l()}catch(x){a(x.message)}},p=async f=>{confirm("Diese Frage wirklich löschen?")&&(await A.delete(`/faqs/${f}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Häufig gestellte Fragen"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Diese Fragen erscheinen im FAQ-Bereich der Startseite, jeweils in der aktuell gewählten Sprache. Die 6 mitgelieferten Einträge sind die Standard-Einstellung – du kannst sie bearbeiten, löschen und beliebig neue hinzufügen."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Frage (DE)"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(f=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:f.question_de}),c.jsx("td",{className:"px-4 py-2",children:f.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(f),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>p(f.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},f.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Fragen angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Frage bearbeiten":"Neue Frage"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Frage (Deutsch) *"}),c.jsx("input",{required:!0,value:n.question_de,onChange:f=>r({...n,question_de:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Antwort (Deutsch) *"}),c.jsx("textarea",{required:!0,rows:3,value:n.answer_de,onChange:f=>r({...n,answer_de:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Frage (Englisch) *"}),c.jsx("input",{required:!0,value:n.question_en,onChange:f=>r({...n,question_en:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Antwort (Englisch) *"}),c.jsx("textarea",{required:!0,rows:3,value:n.answer_en,onChange:f=>r({...n,answer_en:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:f=>r({...n,sort_order:Number(f.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}const sk={name:"",logo_path:"",sort_order:0};function Q5(){const[t,e]=v.useState([]),[n,r]=v.useState(sk),[s,i]=v.useState(null),[o,a]=v.useState(""),l=()=>A.get("/partners").then(e);v.useEffect(()=>{l()},[]);const u=f=>{i(f.id),r({name:f.name,logo_path:f.logo_path||"",sort_order:f.sort_order})},d=()=>{i(null),r(sk)},h=async f=>{f.preventDefault(),a("");try{s?await A.put(`/partners/${s}`,n):await A.post("/partners",n),d(),l()}catch(m){a(m.message)}},p=async f=>{confirm("Partner wirklich löschen?")&&(await A.delete(`/partners/${f}`),l())};return c.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[c.jsxs("div",{className:"lg:col-span-2",children:[c.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Partner"}),c.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Marken-Logozeile auf der Startseite. Ohne Logo wird der Name als Text angezeigt."}),c.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:c.jsxs("table",{className:"w-full text-left text-sm",children:[c.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-4 py-2",children:"Logo"}),c.jsx("th",{className:"px-4 py-2",children:"Name"}),c.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),c.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),c.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[t.map(f=>c.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[c.jsx("td",{className:"px-4 py-2",children:f.logo_path?c.jsx("img",{src:f.logo_path,alt:"",className:"h-10 w-10 rounded-md object-contain"}):c.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),c.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:f.name}),c.jsx("td",{className:"px-4 py-2",children:f.sort_order}),c.jsxs("td",{className:"px-4 py-2 text-right",children:[c.jsx("button",{onClick:()=>u(f),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),c.jsx("button",{onClick:()=>p(f.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},f.id)),t.length===0&&c.jsx("tr",{children:c.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Partner angelegt."})})]})]})})]}),c.jsxs("form",{onSubmit:h,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[c.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Partner bearbeiten":"Neuer Partner"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),c.jsx("input",{required:!0,value:n.name,onChange:f=>r({...n,name:f.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),c.jsx(cr,{value:n.logo_path,onChange:f=>r({...n,logo_path:f}),label:"Logo (optional)"}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),c.jsx("input",{type:"number",value:n.sort_order,onChange:f=>r({...n,sort_order:Number(f.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),o&&c.jsx("p",{className:"text-sm text-red-600",children:o}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&c.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}var Lj={exports:{}},Rj={};/**
+ * @license React
+ * use-sync-external-store-shim.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var io=v;function eB(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var tB=typeof Object.is=="function"?Object.is:eB,nB=io.useState,rB=io.useEffect,sB=io.useLayoutEffect,iB=io.useDebugValue;function oB(t,e){var n=e(),r=nB({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return sB(function(){s.value=n,s.getSnapshot=e,Pf(s)&&i({inst:s})},[t,n,e]),rB(function(){return Pf(s)&&i({inst:s}),t(function(){Pf(s)&&i({inst:s})})},[t]),iB(n),n}function Pf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!tB(t,n)}catch{return!0}}function aB(t,e){return e()}var lB=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?aB:oB;Rj.useSyncExternalStore=io.useSyncExternalStore!==void 0?io.useSyncExternalStore:lB;Lj.exports=Rj;var Z0=Lj.exports,ik=Object.defineProperty,cB=(t,e)=>{let n={};for(var r in t)ik(n,r,{get:t[r],enumerable:!0});return ik(n,Symbol.toStringTag,{value:"Module"}),n};function rt(t){this.content=t}rt.prototype={constructor:rt,find:function(t){for(var e=0;e>1}};rt.from=function(t){if(t instanceof rt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new rt(e)};function _j(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){let o=s.text,a=i.text,l=0;for(;o[l]==a[l];l++)n++;return l&&l0&&p>0&&u[h-1]==d[p-1];)h--,p--,n--,r--;return h&&p&&h=56320&&t<57344}function Bj(t){return t>=55296&&t<56320}class B{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;re&&r(l,s+a,i||null,o)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,e-d),Math.min(l.content.size,n-d),r,s+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new B(r,s)}cutByIndex(e,n){return e==n?B.empty:e==0&&n==this.content.length?this:new B(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new B(s,i)}addToStart(e){return new B([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new B(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?gc(n+1,i):gc(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return B.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return B.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return B.empty;let n,r=0;for(let s=0;sthis.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-s.type.rank),n}};xe.none=[];class il extends Error{}class H{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Fj(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new H(r,this.openStart,this.openEnd)}removeBetween(e,n){return new H(zj(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return H.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(B.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new H(e,r,s)}}H.empty=new H(B.empty,0,0);function zj(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(zj(i.content,e-s-1,n-s-1)))}function Fj(t,e,n,r,s,i){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return i&&r<=0&&s<=0&&!i.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=Fj(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?s-1:0,l);return u&&t.replaceChild(o,l.copy(u))}function uB(t,e,n){if(n.openStart>t.depth)throw new il("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new il("Inconsistent open depths");return Vj(t,e,n,0)}function Vj(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ba(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&($s(t.nodeAfter,r),i++));for(let a=i;as&&Hm(t,e,s+1),o=r.depth>s&&Hm(n,r,s+1),a=[];return ba(null,t,s,a),i&&o&&e.index(s)==n.index(s)?($j(i,o),$s(Hs(i,Hj(t,e,n,r,s+1)),a)):(i&&$s(Hs(i,Ku(t,e,s+1)),a),ba(e,n,s,a),o&&$s(Hs(o,Ku(n,r,s+1)),a)),ba(r,null,s,a),new B(a)}function Ku(t,e,n){let r=[];if(ba(null,t,n,r),t.depth>n){let s=Hm(t,e,n+1);$s(Hs(s,Ku(t,e,n+1)),r)}return ba(e,null,n,r),new B(r)}function dB(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(B.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class ol{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(n);return r?e.child(n).cut(r):s}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Gu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),u=i-l;if(r.push(o,a,s+l),!u||(o=o.child(a),o.isText))break;i=u-1,s+=l+1}return new ol(n,r,i)}static resolveCached(e,n){let r=ok.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Wj(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=B.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let s=B.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Ws.prototype.text=void 0;class qu extends Ws{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Wj(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new qu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new qu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Wj(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Qs{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new mB(e,n);if(r.next==null)return Qs.empty;let s=Uj(r);r.next&&r.err("Unexpected trailing text");let i=wB(kB(s));return SB(i,r),i}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let s=0;s{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(`
+`)}}Qs.empty=new Qs(!0);class mB{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Uj(t){let e=[];do e.push(gB(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function gB(t){let e=[];do e.push(xB(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function xB(t){let e=vB(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=yB(t,e);else break;return e}function ak(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function yB(t,e){let n=ak(t),r=n;return t.eat(",")&&(t.next!="}"?r=ak(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function bB(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function vB(t){if(t.eat("(")){let e=Uj(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=bB(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function kB(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(i(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=i(o.exprs[l],a);if(l==o.exprs.length-1)return u;s(u,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u{t[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let d=0;d{u||s.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[r.join(",")]=new Qs(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:qj(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ws(this,this.computeAttrs(e),B.from(n),xe.setFrom(r))}createChecked(e=null,n,r){return n=B.from(n),this.checkContent(n),new Ws(this,this.computeAttrs(e),n,xe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=B.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(B.empty,!0);return i?new Ws(this,e,n.append(i),xe.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new Xj(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function NB(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class CB{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?NB(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class fh{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=Yj(e,s.attrs),this.excluded=null;let i=Gj(this.attrs);this.instance=i?new xe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new xe(this,qj(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new fh(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class Zj{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=rt.from(e.nodes),n.marks=rt.from(e.marks||{}),this.nodes=ck.compile(this.spec.nodes,this),this.marks=fh.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Qs.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?uk(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:uk(this,o.split(" "))}this.nodeFromJSON=s=>Ws.fromJSON(this,s),this.markFromJSON=s=>xe.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ck){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,s)}text(e,n){let r=this.nodes.text;return new qu(r,r.defaultAttrs,e,xe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function uk(t,e){let n=[];for(let r=0;r-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function jB(t){return t.tag!=null}function EB(t){return t.style!=null}class Yr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(jB(s))this.tags.push(s);else if(EB(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new hk(this,n,!1);return r.addAll(e,xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new hk(this,n,!0);return r.addAll(e,xe.none,n.from,n.to),H.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;se.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o{r(o=fk(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=fk(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Yr(e,Yr.schemaRules(e)))}}const Qj={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},TB={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},eE={ol:!0,ul:!0},al=1,Um=2,va=4;function dk(t,e,n){return e!=null?(e?al:0)|(e==="full"?Um:0):t&&t.whitespace=="pre"?al|Um:n&~va}class xc{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=xe.none,this.match=i||(o&va?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(B.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&al)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=B.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(B.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Qj.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class hk{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=dk(null,n.preserveWhitespace,0)|(r?va:0);s?i=new xc(s.type,s.attrs,xe.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new xc(null,null,xe.none,!0,null,o):i=new xc(e.schema.topNodeType,null,xe.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,s=this.top,i=s.options&Um?"full":this.localPreserveWS||(s.options&al)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
+`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!s||s.length>u.length+a)&&(s=u,i=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(u.type):pk(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new xc(e,n,l,s,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=al)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let d=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function MB(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&eE.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function PB(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function fk(t){let e={};for(let n in t)e[n]=t[n];return e}function pk(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l{if(i.length||o.marks.length){let a=0,l=0;for(;a=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&nu(yc(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return typeof n=="string"?{dom:e.createTextNode(n)}:nu(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new oi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=mk(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return mk(e.marks)}}function mk(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function yc(t){return t.document||window.document}const gk=new WeakMap;function AB(t){let e=gk.get(t);return e===void 0&&gk.set(t,e=DB(t)),e}function DB(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let h in u)if(u[h]!=null){let p=h.indexOf(" ");p>0?l.setAttributeNS(h.slice(0,p),h.slice(p+1),u[h]):h=="style"&&l.style?l.style.cssText=u[h]:l.setAttribute(h,u[h])}}for(let h=d;hd)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof p=="string")l.appendChild(t.createTextNode(p));else{let{dom:f,contentDOM:m}=nu(t,p,n,r);if(l.appendChild(f),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const tE=65535,nE=Math.pow(2,16);function LB(t,e){return t+e*nE}function xk(t){return t&tE}function RB(t){return(t-(t&tE))/nE}const rE=1,sE=2,ru=4,iE=8;class Km{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&iE)>0}get deletedBefore(){return(this.delInfo&(rE|ru))>0}get deletedAfter(){return(this.delInfo&(sE|ru))>0}get deletedAcross(){return(this.delInfo&ru)>0}}class zt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&zt.empty)return zt.empty}recover(e){let n=0,r=xk(e);if(!this.inverted)for(let s=0;se)break;let u=this.ranges[a+i],d=this.ranges[a+o],h=l+u;if(e<=h){let p=u?e==l?-1:e==h?1:n:n,f=l+s+(p<0?0:d);if(r)return f;let m=e==(n<0?l:h)?null:LB(a/3,e-l),x=e==l?sE:e==h?rE:ru;return(n<0?e!=l:e!=h)&&(x|=iE),new Km(f,x,m)}s+=d-u}return r?e+s:new Km(e+s,0,null)}touches(e,n){let r=0,s=xk(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;ae)break;let u=this.ranges[a+i],d=l+u;if(e<=d&&a==s*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s=0;n--){let s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new ll;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&l!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return ze.fromReplace(e,this.from,this.to,i)}invert(){return new jn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Br(n.pos,r.pos,this.mark)}merge(e){return e instanceof Br&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Br(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Br(n.from,n.to,e.markFromJSON(n.mark))}}yt.jsonID("addMark",Br);class jn extends yt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new H(Q0(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return ze.fromReplace(e,this.from,this.to,r)}invert(){return new Br(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new jn(n.pos,r.pos,this.mark)}merge(e){return e instanceof jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new jn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new jn(n.from,n.to,e.markFromJSON(n.mark))}}yt.jsonID("removeMark",jn);class zr extends yt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return ze.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return ze.fromReplace(e,this.pos,this.pos+1,new H(B.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;sr.pos?null:new Ze(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ze(n.from,n.to,n.gapFrom,n.gapTo,H.fromJSON(e,n.slice),n.insert,!!n.structure)}}yt.jsonID("replaceAround",Ze);function Gm(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function _B(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,u,d)=>{if(!l.isInline)return;let h=l.marks;if(!r.isInSet(h)&&d.type.allowsMarkType(r.type)){let p=Math.max(u,e),f=Math.min(u+l.nodeSize,n),m=r.addToSet(h);for(let x=0;xt.step(l)),i.forEach(l=>t.step(l))}function IB(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof fh){let u=o.marks,d;for(;d=r.isInSet(u);)(l||(l=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,n);for(let d=0;dt.step(new jn(o.from,o.to,o.style)))}function ex(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l=0;l--)t.step(o[l])}function OB(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function jo(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-i;if(rn;m--)x||r.index(m)>0?(x=!0,d=B.from(r.node(m).copy(d)),h++):l--;let p=B.empty,f=0;for(let m=i,x=!1;m>n;m--)x||s.after(m+1)=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=B.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new Ze(s,i,s,i,new H(r,0,0),n.length,!0))}function $B(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&HB(t.doc,t.mapping.slice(i).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!m?u=!1:!f&&m&&(u=!0)}u===!1&&aE(t,o,a,i),ex(t,t.mapping.slice(i).map(a,1),r,void 0,u===null);let d=t.mapping.slice(i),h=d.map(a,1),p=d.map(a+o.nodeSize,1);return t.step(new Ze(h,p,h+1,p-1,new H(B.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&oE(t,o,a,i),!1}})}function oE(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function aE(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
+`))}})}function HB(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function WB(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ze(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new H(B.from(o),0,0),1,!0))}function ur(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,d=n-2;u>i;u--,d--){let h=s.node(u),p=s.index(u);if(h.type.spec.isolating)return!1;let f=h.content.cutByIndex(p,h.childCount),m=r&&r[d+1];m&&(f=f.replaceChild(0,m.type.create(m.attrs)));let x=r&&r[d]||h;if(!h.canReplace(p+1,h.childCount)||!x.type.validContent(f))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function UB(t,e,n=1,r){let s=t.doc.resolve(e),i=B.empty,o=B.empty;for(let a=s.depth,l=s.depth-n,u=n-1;a>l;a--,u--){i=B.from(s.node(a).copy(i));let d=r&&r[u];o=B.from(d?d.type.create(d.attrs,o):s.node(a).copy(o))}t.step(new Le(e,e,new H(i.append(o),n,n),!0))}function ps(t,e){let n=t.resolve(e),r=n.index();return lE(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function KB(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&lE(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function GB(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let d=o.whitespace=="pre",h=!!o.contentMatch.matchType(s);d&&!h?r=!1:!d&&h&&(r=!0)}let a=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);aE(t,d.node(),d.before(),a)}o.inlineContent&&ex(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new Le(u,l.map(e+n,-1),H.empty,!0)),r===!0){let d=t.doc.resolve(u);oE(t,d.node(),d.before(),t.steps.length)}return t}function qB(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),d=!1;if(i==1)d=u.canReplace(l,l,s);else{let h=u.contentMatchAt(l).findWrapping(s.firstChild.type);d=h&&u.canReplaceWith(l,l,h[0])}if(d)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function mh(t,e,n=e,r=H.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return uE(s,i,r)?new Le(e,n,r):new JB(s,i,r).fit()}function uE(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class JB{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=B.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=B.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new H(i,o,a);return e>-1?new Ze(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Le(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=bk(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],d,h=null;if(n==1&&(o?u.matchType(o.type)||(h=u.fillBefore(B.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:h};if(n==2&&o&&(d=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return vk(e,-1)<=n?!1:(this.unplaced.size>1&&vk(e,1)>r&&r++,this.unplaced=new H(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=bk(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new H(Qo(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new H(Qo(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let x=0;x1||l==0||x.content.size)&&(h=y,d.push(dE(x.mark(p.allowedMarks(x.marks)),u==1?l:0,u==a.childCount?f:-1)))}let m=u==a.childCount;m||(f=-1),this.placed=ea(this.placed,n,B.from(d)),this.frontier[n].match=h,m&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,y=a;x1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n=0;a--){let{match:l,type:u}=this.frontier[a],d=Lf(e,a,u,l,!0);if(!d||d.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ea(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=ea(this.placed,this.depth,B.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(B.empty,!0);n.childCount&&(this.placed=ea(this.placed,this.frontier.length,n))}}function Qo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Qo(t.firstChild.content,e-1,n)))}function ea(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(ea(t.lastChild.content,e-1,n)))}function bk(t,e){for(let n=0;n1&&(r=r.replaceChild(0,dE(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(B.empty,!0)))),t.copy(r)}function Lf(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!YB(n,i.content,o)?a:null}function YB(t,e,n){for(let r=n;r0;p--,f--){let m=s.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(p)>-1?a=p:s.before(p)==f&&o.splice(1,0,-p)}let l=o.indexOf(a),u=[],d=r.openStart;for(let p=r.content,f=0;;f++){let m=p.firstChild;if(u.push(m),f==r.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let f=u[p],m=XB(f.type);if(m&&!f.sameMarkup(s.node(Math.abs(a)-1)))d=p;else if(m||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+d+1)%(r.openStart+1),m=u[f];if(m)for(let x=0;x=0&&(t.replace(e,n,r),!(t.steps.length>h));p--){let f=o[p];f<0||(e=s.before(f),n=i.after(f))}}function hE(t,e,n,r,s){if(er){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(B.empty,!0))}return t}function QB(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=qB(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new H(B.from(r),0,0))}function e6(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=s.depth;l>o;l--)s.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=s.depth;l>0&&n==s.start(l);l--)n=s.before(l);r=t.doc.resolve(e),s=t.doc.resolve(n)}}let i=fE(r,s);for(let o=0;o0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function fE(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(ie.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Wi extends yt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return ze.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return ze.fromReplace(e,this.pos,this.pos+1,new H(B.from(s),0,n.isLeaf?0:1))}getMap(){return zt.empty}invert(e){return new Wi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wi(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wi(n.pos,n.attr,n.value)}}yt.jsonID("attr",Wi);class cl extends yt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return ze.ok(r)}getMap(){return zt.empty}invert(e){return new cl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new cl(n.attr,n.value)}}yt.jsonID("docAttr",cl);let oo=class extends Error{};oo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};oo.prototype=Object.create(Error.prototype);oo.prototype.constructor=oo;oo.prototype.name="TransformError";class pE{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ll}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new oo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=H.empty){let s=mh(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new H(B.from(r),0,0))}delete(e,n){return this.replace(e,n,H.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return ZB(this,e,n,r),this}replaceRangeWith(e,n,r){return QB(this,e,n,r),this}deleteRange(e,n){return e6(this,e,n),this}lift(e,n){return BB(this,e,n),this}join(e,n=1){return GB(this,e,n),this}wrap(e,n){return VB(this,e,n),this}setBlockType(e,n=e,r,s=null){return $B(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return WB(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Wi(e,n,r)),this}setDocAttribute(e,n){return this.step(new cl(e,n)),this}addNodeMark(e,n){return this.step(new zr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof xe)n.isInSet(r.marks)&&this.step(new ei(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new ei(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return UB(this,e,n,r),this}addMark(e,n,r){return _B(this,e,n,r),this}removeMark(e,n,r){return IB(this,e,n,r),this}clearIncompatible(e,n,r){return ex(this,e,n,r),this}}const Rf=Object.create(null);class ie{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new t6(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;i--){let o=n<0?xi(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):xi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Ht(e.node(0))}static atStart(e){return xi(e,e,0,0,1)||new Ht(e)}static atEnd(e){return xi(e,e,e.content.size,e.childCount,-1)||new Ht(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Rf[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Rf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Rf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Q.between(this.$anchor,this.$head).getBookmark()}}ie.prototype.visible=!0;class t6{constructor(e,n){this.$from=e,this.$to=n}}let kk=!1;function wk(t){!kk&&!t.parent.inlineContent&&(kk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Q extends ie{constructor(e,n=e){wk(e),wk(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ie.near(r);let s=e.resolve(n.map(this.anchor));return new Q(s.parent.inlineContent?s:r,r)}replace(e,n=H.empty){if(super.replace(e,n),n==H.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Q&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gh(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Q(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=ie.findFrom(n,r,!0)||ie.findFrom(n,-r,!0);if(i)n=i.$head;else return ie.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(ie.findFrom(e,-r,!0)||ie.findFrom(e,r,!0)).$anchor,e.pos0?0:1);s>0?o=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&Z.isSelectable(a))return Z.create(t,n-(s<0?a.nodeSize:0))}else{let l=xi(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function Sk(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=d)}),t.setSelection(ie.near(t.doc.resolve(o),n))}const Nk=1,bc=2,Ck=4;class r6 extends pE{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=bc,this}ensureMarks(e){return xe.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&bc)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~bc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||xe.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ie.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ck,this}get scrolledIntoView(){return(this.updated&Ck)>0}}function jk(t,e){return!e||!t?t:t.bind(e)}class ta{constructor(e,n,r){this.name=e,this.init=jk(n.init,r),this.apply=jk(n.apply,r)}}const s6=[new ta("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ta("selection",{init(t,e){return t.selection||ie.atStart(e.doc)},apply(t){return t.selection}}),new ta("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ta("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _f{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=s6.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ta(r.key,r.spec.state,r))})}}class As{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new _f(e.schema,e.plugins),i=new As(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Ws.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ie.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=u.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function mE(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=mE(s,e,{})),n[r]=s}return n}class we{constructor(e){this.spec=e,this.props={},e.props&&mE(e.props,this,this.props),this.key=e.key?e.key.key:gE("plugin")}getState(e){return e[this.key]}}const If=Object.create(null);function gE(t){return t in If?t+"$"+ ++If[t]:(If[t]=0,t+"$")}class Ve{constructor(e="key"){this.key=gE(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const xE=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function yE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const bE=(t,e,n)=>{let r=yE(t,n);if(!r)return!1;let s=rx(r);if(!s){let o=r.blockRange(),a=o&&jo(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(TE(t,s,e,-1))return!0;if(r.parent.content.size==0&&(ao(i,"end")||Z.isSelectable(i)))for(let o=r.depth;;o--){let a=mh(t.doc,r.before(o),r.after(o),H.empty);if(a&&a.slice.size1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},i6=(t,e,n)=>{let r=yE(t,n);if(!r)return!1;let s=rx(r);return s?vE(t,s,e):!1},o6=(t,e,n)=>{let r=wE(t,n);if(!r)return!1;let s=sx(r);return s?vE(t,s,e):!1};function vE(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let d=s.lastChild;if(!d)return!1;s=d}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let u=mh(t.doc,i,l,H.empty);if(!u||u.from!=i||u instanceof Le&&u.slice.size>=l-i)return!1;if(n){let d=t.tr.step(u);d.setSelection(Q.create(d.doc,i)),n(d.scrollIntoView())}return!0}function ao(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const kE=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=rx(r)}let o=i&&i.nodeBefore;return!o||!Z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Z.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function rx(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function wE(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=wE(t,n);if(!r)return!1;let s=sx(r);if(!s)return!1;let i=s.nodeAfter;if(TE(t,s,e,1))return!0;if(r.parent.content.size==0&&(ao(i,"start")||Z.isSelectable(i))){let o=mh(t.doc,r.before(),r.after(),H.empty);if(o&&o.slice.size{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Z,s;if(r){if(n.node.isTextblock||!ps(t.doc,n.from))return!1;s=n.from}else if(s=ph(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(Z.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},l6=(t,e)=>{let n=t.selection,r;if(n instanceof Z){if(n.node.isTextblock||!ps(t.doc,n.to))return!1;r=n.to}else if(r=ph(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},c6=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&jo(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},CE=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
+`).scrollIntoView()),!0)};function ix(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=ix(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(ie.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},jE=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof Ht||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=ix(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(ur(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&jo(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function d6(t){return(e,n)=>{if(e.selection instanceof Z&&e.selection.node.isBlock){let{$from:f}=e.selection;return!f.parentOffset||!ur(e.doc,f.pos)?!1:(n&&n(e.tr.split(f.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof Q||e.selection instanceof Ht)&&r.deleteSelection();let{$from:s}=r.selection,i=r.steps.length,o=[],a,l,u=!1,d=!1;for(let f=s.depth;;f--)if(s.node(f).isBlock){u=s.end(f)==s.pos+(s.depth-f),d=s.start(f)==s.pos-(s.depth-f),l=ix(s.node(f-1).contentMatchAt(s.indexAfter(f-1))),o.unshift(u&&l?{type:l}:null),a=f;break}else{if(f==1)return!1;o.unshift(null)}let h=s.pos,p=ur(r.doc,h,o.length,o);if(p||(o[0]=l?{type:l}:null,p=ur(r.doc,h,o.length,o)),!p)return!1;if(r.split(h,o.length,o),!u&&d&&s.node(a).type!=l){let f=r.mapping.slice(i),m=f.map(s.before(a)),x=r.doc.resolve(m);l&&s.node(a-1).canReplaceWith(x.index(),x.index()+1,l)&&r.setNodeMarkup(f.map(s.before(a)),l)}return n&&n(r.scrollIntoView()),!0}}const h6=d6(),f6=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(Z.create(t.doc,s))),!0)};function p6(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||ps(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function TE(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&p6(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let f=e.pos+i.nodeSize,m=B.empty;for(let b=o.length-1;b>=0;b--)m=B.from(o[b].create(null,m));m=B.from(s.copy(m));let x=t.tr.step(new Ze(e.pos-1,f,e.pos,f,new H(m,1,0),o.length,!0)),y=x.doc.resolve(f+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&ps(x.doc,y.pos)&&x.join(y.pos),n(x.scrollIntoView())}return!0}let d=i.type.spec.isolating||r>0&&l?null:ie.findFrom(e,1),h=d&&d.$from.blockRange(d.$to),p=h&&jo(h);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(h,p).scrollIntoView()),!0;if(u&&ao(i,"start",!0)&&ao(s,"end")){let f=s,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let x=i,y=1;for(;!x.isTextblock;x=x.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,x.content)){if(n){let b=B.empty;for(let k=m.length-1;k>=0;k--)b=B.from(m[k].copy(b));let g=t.tr.step(new Ze(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new H(b,m.length,0),0,!0));n(g.scrollIntoView())}return!0}}return!1}function ME(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(Q.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const m6=ME(-1),g6=ME(1);function x6(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&tx(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Ek(t,e=null){return function(n,r){let s=!1;for(let i=0;i{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let d=n.doc.resolve(u),h=d.index();s=d.parent.canReplaceWith(h,h+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);i=new Gu(l,l,e.depth),e.endIndex=0;d--)i=B.from(n[d].type.create(n[d].attrs,i));t.step(new Ze(e.start-(r?2:0),e.end,e.start,e.end,new H(i,0,0),n.length,!0));let o=0;for(let d=0;do.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?w6(e,n,t,i):S6(e,n,i):!0:!1}}function w6(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);ix;m--)f-=s.child(m).nodeSize,r.delete(f-1,f+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(a?0:1),d+1,o.content.append(l?B.empty:B.from(s))))return!1;let h=i.pos,p=h+o.nodeSize;return r.step(new Ze(h-(a?1:0),p+(l?1:0),h+1,p-1,new H((a?B.empty:B.from(s.copy(B.empty))).append(l?B.empty:B.from(s.copy(B.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function N6(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,d=B.from(u?t.create():null),h=new H(B.from(t.create(null,B.from(a.type.create(null,d)))),u?3:1,0),p=i.start,f=i.end;n(e.tr.step(new Ze(p-(u?3:1),f,p,f,h,1,!0)).scrollIntoView())}return!0}}const st=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},lo=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let qm=null;const tr=function(t,e,n){let r=qm||(qm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},C6=function(){qm=null},ti=function(t,e,n,r){return n&&(Tk(t,e,n,r,-1)||Tk(t,e,n,r,1))},j6=/^(img|br|input|textarea|hr)$/i;function Tk(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:nn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Pl(t)||j6.test(t.nodeName)||t.contentEditable=="false")return!1;e=st(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?nn(t):0}else return!1}}function nn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function E6(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=nn(t)}else if(t.parentNode&&!Pl(t))e=st(t),t=t.parentNode;else return null}}function T6(t,e){for(;;){if(t.nodeType==3&&e2),Qt=co||(Un?/Mac/.test(Un.platform):!1),DE=Un?/Win/.test(Un.platform):!1,or=/Android \d/.test(ms),Al=!!Mk&&"webkitFontSmoothing"in Mk.documentElement.style,D6=Al?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L6(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function qn(t,e){return typeof t=="number"?t:t[e]}function R6(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Pk(t,e,n){if(!Zm(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=lo(o);continue}let a=o,l=a==i.body,u=l?L6(i):R6(a),d=0,h=0;if(e.topu.bottom-qn(r,"bottom")&&(h=e.bottom-e.top>u.bottom-u.top?e.top+qn(s,"top")-u.top:e.bottom-u.bottom+qn(s,"bottom")),e.leftu.right-qn(r,"right")&&(d=e.right-u.right+qn(s,"right")),d||h)if(l)i.defaultView.scrollBy(d,h);else{let f=a.scrollLeft,m=a.scrollTop;h&&(a.scrollTop+=h),d&&(a.scrollLeft+=d);let x=a.scrollLeft-f,y=a.scrollTop-m;e={left:e.left-x,top:e.top-y,right:e.right-x,bottom:e.bottom-y}}let p=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(p))break;o=p=="absolute"?o.offsetParent:lo(o)}}function _6(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:LE(t.dom)}}function LE(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=lo(r));return e}function I6({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;RE(n,r==0?0:r-e)}function RE(t,e){for(let n=0;n=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let x=m.left>e.left?m.left-e.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=h+1)}}return!n&&l&&(n=l,s=u,r=0),n&&n.nodeType==3?B6(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:_E(n,s)}function B6(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function ax(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function z6(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function V6(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right-1?s:t.docView.posFromDOM(e,n,-1)}function IE(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&s++}let u;Al&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=V6(t,r,s,e))}a==null&&(a=F6(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Zm(t){return t.top=0&&s==r.nodeValue.length?(l--,d=1):n<0?l--:u++,Vo(Nr(tr(r,l,u),d),d<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==nn(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return Of(l.getBoundingClientRect(),!1)}if(i==null&&s=0)}if(i==null&&s&&(n<0||s==nn(r))){let l=r.childNodes[s-1],u=l.nodeType==3?tr(l,nn(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Vo(Nr(u,1),!1)}if(i==null&&s=0)}function Vo(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Of(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function BE(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function W6(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return BE(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=OE(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=tr(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;ud.top+1&&(n=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const U6=/[\u0590-\u08ac]/;function K6(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!U6.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:BE(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:d,anchorOffset:h}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:x}=t.domSelectionRange(),y=m&&!f.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==x;try{a.collapse(d,h),l&&(l!=d||u!=h)&&a.extend&&a.extend(l,u)}catch{}return p!=null&&(a.caretBidiLevel=p),y}):r.pos==r.start()||r.pos==r.end()}let Ak=null,Dk=null,Lk=!1;function G6(t,e,n){return Ak==e&&Dk==n?Lk:(Ak=e,Dk=n,Lk=n=="up"||n=="down"?W6(t,e,n):K6(t,e,n))}const ln=0,Rk=1,Ds=2,Pn=3;class Dl{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=ln,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nst(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof FE){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof zE&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?st(i.dom)+1:0}}else{let i,o=!0;for(;i=r=d&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,d);e=o;for(let h=a;h>0;h--){let p=this.children[h-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){s=st(p.dom)+1;break}e-=p.size}s==-1&&(s=0)}if(s>-1&&(u>n||a==this.children.length-1)){n=u;for(let d=a+1;dm&&on){let m=a;a=l,l=m}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s=r:er){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Ds:Rk,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Pn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ds:Pn}r=o}this.dirty=Ds}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ds:Rk;n.dirty{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==ln&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class q6 extends Dl{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Zr extends Dl{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=oi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Zr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Pn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Pn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ln){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=eg(i,0,e,r));for(let a=0;a{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),d=u&&u.dom,h=u&&u.contentDOM;if(n.isText){if(!d)d=document.createTextNode(n.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:h}=oi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!h&&!n.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),n.type.spec.draggable&&(d.draggable=!0));let p=d;return d=HE(d,r,n),u?l=new J6(e,n,r,s,d,h||null,p,u):n.isText?new yh(e,n,r,s,d,p):new Qr(e,n,r,s,d,h||null,p)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(s=>s.nodeType==1&&e.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>B.empty}}return n}matchesNode(e,n,r){return this.dirty==ln&&e.eq(this.node)&&Ju(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new X6(this,o&&o.node,e);ez(this.node,this.innerDeco,(u,d,h)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e,d):u.type.side>=0&&!h&&l.syncToMarks(d==this.node.childCount?xe.none:this.node.child(d).marks,r,e,d),l.placeWidget(u,e,s)},(u,d,h,p)=>{l.syncToMarks(u.marks,r,e,p);let f;l.findNodeMatch(u,d,h,p)||a&&e.state.selection.from>s&&e.state.selection.to-1&&l.updateNodeAt(u,d,h,f,e)||l.updateNextNode(u,d,h,e,p,s)||l.addNode(u,d,h,e,s),s+=u.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ds)&&(o&&this.protectLocalComposition(e,o),VE(this.contentDOM,this.children,e),co&&tz(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Q)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=nz(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new q6(this,i,n,s);e.input.compositionNodes.push(o),this.children=eg(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Pn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=ln}updateOuterDeco(e){if(Ju(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$E(this.dom,this.nodeDOM,Qm(this.outerDeco,this.node,n),Qm(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function _k(t,e,n,r,s){HE(r,e,t);let i=new Qr(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(s,0),i}class yh extends Qr{constructor(e,n,r,s,i,o){super(e,n,r,s,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,s){return this.dirty==Pn||this.dirty!=ln&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ln||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=ln,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let s=this.node.cut(e,n),i=document.createTextNode(s.text);return new yh(this.parent,s,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Pn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class FE extends Dl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ln&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class J6 extends Qr{constructor(e,n,r,s,i,o,a,l){super(e,n,r,s,i,o,a),this.spec=l}update(e,n,r,s){if(this.dirty==Pn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function VE(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i>1,a=Math.min(o,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let d=Zr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof Zr)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function Q6(t,e){return t.type.side-e.type.side}function ez(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let u=0;ui;)a.push(s[o++]);let m=i+p.nodeSize;if(p.isText){let y=m;o!y.inline):a.slice();r(p,x,e.forChild(i,p),f),i=m}}function tz(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function nz(t,e,n,r){for(let s=0,i=0;s=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function eg(t,e,n,r,s){let i=[];for(let o=0,a=0;o=n||d<=e?i.push(l):(un&&i.push(l.slice(n-u,l.size,r)))}return i}function lx(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(xh(n)){for(l=o;s&&!s.node;)s=s.parent;let h=s.node;if(s&&h.isAtom&&Z.isSelectable(h)&&s.parent&&!(h.isInline&&M6(n.focusNode,n.focusOffset,s.dom))){let p=s.posBefore;u=new Z(o==p?a:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let h=o,p=o;for(let f=0;f{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!WE(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function sz(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,st(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&It&&Xr<=11&&(n.disabled=!0,n.disabled=!1)}function UE(t,e){if(e instanceof Z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Fk(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Fk(t)}function Fk(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function cx(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||Q.between(e,n,r)}function Vk(t){return t.editable&&!t.hasFocus()?!1:KE(t)}function KE(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function iz(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ti(e.node,e.offset,n.anchorNode,n.anchorOffset)}function tg(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&ie.findFrom(i,e)}function Tr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function $k(t,e,n){let r=t.state.selection;if(r instanceof Q)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Tr(t,new Q(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=tg(t.state,e);return s&&s instanceof Z?Tr(t,s):!1}else if(!(Qt&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?Z.isSelectable(i)?Tr(t,new Z(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Al?Tr(t,new Q(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Z&&r.node.isInline)return Tr(t,new Q(e>0?r.$to:r.$from));{let s=tg(t.state,e);return s?Tr(t,s):!1}}}function Yu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function wa(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function fi(t,e){return e<0?oz(t):az(t)}function oz(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(an&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(wa(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(GE(n))break;{let a=n.previousSibling;for(;a&&wa(a,-1);)s=n.parentNode,i=st(a),a=a.previousSibling;if(a)n=a,r=Yu(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ng(t,n,r):s&&ng(t,s,i)}function az(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=Yu(n),i,o;for(;;)if(r{t.state==s&&dr(t)},50)}function Hk(t,e){let n=t.state.doc.resolve(e);if(!(ot||DE)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o1)return i.lefts.top&&o1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Wk(t,e,n){let r=t.state.selection;if(r instanceof Q&&!r.empty||n.indexOf("s")>-1||Qt&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=tg(t.state,e);if(o&&o instanceof Z)return Tr(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof Ht?ie.near(o,e):ie.findFrom(o,e);return a?Tr(t,a):!1}return!1}function Uk(t,e){if(!(t.state.selection instanceof Q))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Kk(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function uz(t){if(!xt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Kk(t,r,"true"),setTimeout(()=>Kk(t,r,"false"),20)}return!1}function dz(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function hz(t,e){let n=e.keyCode,r=dz(e);if(n==8||Qt&&n==72&&r=="c")return Uk(t,-1)||fi(t,-1);if(n==46&&!e.shiftKey||Qt&&n==68&&r=="c")return Uk(t,1)||fi(t,1);if(n==13||n==27)return!0;if(n==37||Qt&&n==66&&r=="c"){let s=n==37?Hk(t,t.state.selection.from)=="ltr"?-1:1:-1;return $k(t,s,r)||fi(t,s)}else if(n==39||Qt&&n==70&&r=="c"){let s=n==39?Hk(t,t.state.selection.from)=="ltr"?1:-1:1;return $k(t,s,r)||fi(t,s)}else{if(n==38||Qt&&n==80&&r=="c")return Wk(t,-1,r)||fi(t,-1);if(n==40||Qt&&n==78&&r=="c")return uz(t)||Wk(t,1,r)||fi(t,1);if(r==(Qt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ux(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||oi.fromSchema(t.state.schema),a=QE(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,d,h=0;for(;u&&u.nodeType==1&&(d=ZE[u.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let m=a.createElement(d[f]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),h++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
+
+`);return{dom:l,text:p,slice:e}}function qE(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",p=>{e=p(e,i||r,t)}),i)return a=new H(B.from(t.state.schema.text(e.replace(/\r\n?/g,`
+`))),0,0),t.someProp("transformPasted",p=>{a=p(a,t,!0)}),a;let h=t.someProp("clipboardTextParser",p=>p(e,s,r,t));if(h)a=h;else{let p=s.marks(),{schema:f}=t.state,m=oi.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let y=o.appendChild(document.createElement("p"));x&&y.appendChild(m.serializeNode(f.text(x,p)))})}}else t.someProp("transformPastedHTML",h=>{n=h(n,t)}),o=gz(n),Al&&xz(o);let u=o&&o.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let p=o.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;o=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Yr.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||d),context:s,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!fz.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)a=yz(Gk(a,+d[1],+d[2]),d[4]);else if(a=H.maxOpen(pz(a.content,s),!0),a.openStart||a.openEnd){let h=0,p=0;for(let f=a.content.firstChild;h{a=h(a,t,l)}),a}const fz=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function pz(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&i.length&&YE(l,i,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=XE(o[o.length-1],i.length));let d=JE(a,l);o.push(d),s=s.matchType(d.type),i=l}}),o)return B.from(o)}return t}function JE(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,B.from(t));return t}function YE(t,e,n,r,s){if(s1&&(i=0),s=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(B.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Gk(t,e,n){return en})}return $o.createHTML(t)}function gz(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=QE(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(t),i;if((i=s&&ZE[s[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>""+o+">").reverse().join("")),r.innerHTML=mz(t),i)for(let o=0;o=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;try{l.checkAttrs(r[a+1])}catch{break}s=B.from(l.create(r[a+1],s)),i++,o++}return new H(s,i,o)}const Ct={},jt={},bz={touchstart:!0,touchmove:!0};class vz{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function kz(t){for(let e in Ct){let n=Ct[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Sz(t,r)&&!dx(t,r)&&(t.editable||!(r.type in jt))&&n(t,r)},bz[e]?{passive:!0}:void 0)}xt&&t.dom.addEventListener("input",()=>null),sg(t)}function ar(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function wz(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function sg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>dx(t,r))})}function dx(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Sz(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Nz(t,e){!dx(t,e)&&Ct[e.type]&&(t.editable||!(e.type in jt))&&Ct[e.type](t,e)}jt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!rT(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(or&&ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),co&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",s=>s(t,Cs(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||hz(t,n)?n.preventDefault():ar(t,"key")};jt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};jt.keypress=(t,e)=>{let n=e;if(rT(t)||!n.charCode||n.ctrlKey&&!n.altKey||Qt&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Q)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Ll(t){return{left:t.clientX,top:t.clientY}}function Cz(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function hx(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Rl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function jz(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Z.isSelectable(r)?(Rl(t,new Z(n)),!0):!1}function Ez(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Z&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(Z.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Rl(t,Z.create(t.state.doc,s)),!0):!1}function Tz(t,e,n,r,s){return hx(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?Ez(t,n):jz(t,n))}function Mz(t,e,n,r){return hx(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function Pz(t,e,n,r){return hx(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||Az(t,n,r)}function Az(t,e,n){if(n.button!=0)return!1;let r=eT(t,e,!0),s=t.state.doc;return r?(Rl(t,r),r instanceof Q&&s.eq(t.state.doc)&&(t.input.mouseDown=new Lz(t,r)),!0):!1}function eT(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?Q.create(r,0,r.content.size):null;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)return Q.create(r,a+1,a+1+o.content.size);if(n&&Z.isSelectable(o))return Z.create(r,a)}return null}function fx(t){return Xu(t)}const tT=Qt?"metaKey":"ctrlKey";Ct.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=fx(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&Cz(n,t.input.lastClick)&&!n[tT]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(Ll(n));o&&(i=="singleClick"?t.input.mouseDown=new Dz(t,o,n,!!r):(i=="doubleClick"?Mz:Pz)(t,o.pos,o.inside,n)?n.preventDefault():ar(t,"pointer"))};class nT{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class Dz extends nT{constructor(e,n,r,s){super(e),this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[tT],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let d=e.state.doc.resolve(n.pos);i=d.parent,o=d.depth?d.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Z&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&an&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),ar(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||dr(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ll(e))),this.updateAllowDefault(e),this.allowDefault||!n?ar(this.view,"pointer"):Tz(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||xt&&this.mightDrag&&!this.mightDrag.node.isAtom||ot&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Rl(this.view,ie.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ar(this.view,"pointer")}move(e){this.updateAllowDefault(e),ar(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class Lz extends nT{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),ar(this.view,"pointer");let n=this.view.posAtCoords(Ll(e)),r=n&&eT(this.view,n.inside,!1);if(!r)return;let{doc:s}=this.view.state,i=this.startSelection,[o,a]=r.from{t.input.lastTouch=Date.now(),fx(t),ar(t,"pointer")};Ct.touchmove=t=>{t.input.lastTouch=Date.now(),ar(t,"pointer")};Ct.contextmenu=t=>fx(t);function rT(t,e){return t.composing?!0:xt&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Rz=or?5e3:-1;jt.compositionstart=jt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Q&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ot&&DE&&_z(t)))t.markCursor=t.state.storedMarks||n.marks(),Xu(t,!0),t.markCursor=null;else if(Xu(t,!e.selection.empty),an&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}sT(t,Rz)};function _z(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}jt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,sT(t,20))};function sT(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Xu(t),e))}function iT(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Iz(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=E6(e.focusNode,e.focusOffset),r=T6(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Xu(t,e=!1){if(!(or&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),iT(t),e||t.docView&&t.docView.dirty){let n=lx(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function Oz(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ul=It&&Xr<15||co&&D6<604;Ct.copy=jt.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=ul?null:n.clipboardData,o=r.content(),{dom:a,text:l}=ux(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):Oz(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Bz(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function zz(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?dl(t,r.value,null,s,e):dl(t,r.textContent,r.innerHTML,s,e)},50)}function dl(t,e,n,r,s){let i=qE(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||H.empty)))return!0;if(!i)return!1;let o=Bz(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function oT(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}jt.paste=(t,e)=>{let n=e;if(t.composing&&!or)return;let r=ul?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&dl(t,oT(r),r.getData("text/html"),s,n)?n.preventDefault():zz(t,n)};class aT{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Fz=Qt?"altKey":"ctrlKey";function lT(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Fz]}Ct.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Ll(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Z?s.to-1:s.to))){if(r&&r.mightDrag)o=Z.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let h=t.docView.nearestDesc(n.target,!0);h&&h.node.type.spec.draggable&&h!=t.docView&&(o=Z.create(t.state.doc,h.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:u,slice:d}=ux(t,a);(!n.dataTransfer.files.length||!ot||AE>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ul?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ul||n.dataTransfer.setData("text/plain",u),t.dragging=new aT(d,lT(t,n),o)};Ct.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};jt.dragover=jt.dragenter=(t,e)=>e.preventDefault();jt.drop=(t,e)=>{try{Vz(t,e,t.dragging)}finally{t.dragging=null}};function Vz(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Ll(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",f=>{i=f(i,t,!1)}):i=qE(t,oT(e.dataTransfer),ul?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&lT(t,e));if(t.someProp("handleDrop",f=>f(t,e,i||H.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let a=i?cE(t.state.doc,s.pos,i):s.pos;a==null&&(a=s.pos);let l=t.state.tr;if(o){let{node:f}=n;f?f.replace(l):l.deleteSelection()}let u=l.mapping.map(a),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,h=l.doc;if(d?l.replaceRangeWith(u,u,i.content.firstChild):l.replaceRange(u,u,i),l.doc.eq(h))return;let p=l.doc.resolve(u);if(d&&Z.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new Z(p));else{let f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((m,x,y,b)=>f=b),l.setSelection(cx(t,p,l.doc.resolve(f)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}Ct.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&dr(t)},20))};Ct.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ct.beforeinput=(t,e)=>{if(or&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,Cs(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in jt)Ct[t]=jt[t];function hl(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Zu{constructor(e,n){this.toDOM=e,this.spec=n||Us,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new St(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Zu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&hl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class es{constructor(e,n){this.attrs=e,this.spec=n||Us}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new St(i,o,this)}valid(e,n){return n.from=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;oe){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==pt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Us)}mapInner(e,n,r,s,i){let o;for(let a=0;a{let u=l+r,d;if(d=uT(n,a,u)){for(s||(s=this.children.slice());ia&&h.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,o=i+n.content.size;for(let a=0;ai&&l.type instanceof es){let u=Math.max(i,l.from)-i,d=Math.min(o,l.to)-i;us.map(e,n,Us));return Lr.from(r)}forChild(e,n){if(n.isLeaf)return de.empty;let r=[];for(let s=0;sn instanceof de)?e:e.reduce((n,r)=>n.concat(r instanceof de?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let y=x-m-(f-p);for(let b=0;bg+d-h)continue;let k=a[b]+d-h;f>=k?a[b+1]=p<=k?-2:-1:p>=d&&y&&(a[b]+=y,a[b+1]+=y)}h+=y}),d=n.maps[u].map(d,-1)}let l=!1;for(let u=0;u=r.content.size){l=!0;continue}let p=n.map(t[u+1]+i,-1),f=p-s,{index:m,offset:x}=r.content.findIndex(h),y=r.maybeChild(m);if(y&&x==h&&x+y.nodeSize==f){let b=a[u+2].mapInner(n,y,d+1,t[u]+i+1,o);b!=pt?(a[u]=h,a[u+1]=f,a[u+2]=b):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=Hz(a,t,e,n,s,i,o),d=Qu(u,r,0,o);e=d.local;for(let h=0;hn&&o.to{let u=uT(t,a,l+n);if(u){i=!0;let d=Qu(u,a,n+l+1,r);d!=pt&&s.push(l,l+a.nodeSize,d)}});let o=cT(i?dT(t):t,-n).sort(Ks);for(let a=0;a0;)e++;t.splice(e,0,n)}function zf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=pt&&e.push(r)}),t.cursorWrapper&&e.push(de.create(t.state.doc,[t.cursorWrapper.deco])),Lr.from(e)}const Wz={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Uz=It&&Xr<=11;class Kz{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Gz{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Kz,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;ss.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():xt&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Uz&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Wz)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Vk(this.view)){if(this.suppressingSelectionUpdates)return dr(this.view);if(It&&Xr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ti(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=lo(i))n.add(i);for(let i=e.anchorNode;i;i=lo(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Vk(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let d=0;dd.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||ot&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(d=>d.type=="childList"&&d.removedNodes.length))){for(let d of l)if(d.nodeName=="BR"&&d.parentNode){let h=d.nextSibling;for(;h&&h.nodeType==1;){if(h.contentEditable=="false"){d.parentNode.removeChild(d);break}h=h.firstChild}}}else if(an&&l.length){let d=l.filter(h=>h.nodeName=="BR");if(d.length==2){let[h,p]=d;h.parentNode&&h.parentNode.parentNode==p.parentNode?p.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let p of d){let f=p.parentNode;f&&f.nodeName=="LI"&&(!h||Yz(e,h)!=f)&&p.remove()}}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||s)&&(i>-1&&(e.docView.markDirty(i,o),qz(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Xz(e,l)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||dr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;di;b--){let g=s.childNodes[b-1],k=g.pmViewDesc;if(g.nodeName=="BR"&&!k){o=b;break}if(!k||k.size)break}let p=t.state.doc,f=t.someProp("domParser")||Yr.fromSchema(t.state.schema),m=p.resolve(a),x=null,y=f.parse(s,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:i,to:o,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:Qz(r),context:m});if(d&&d[0].pos!=null){let b=d[0].pos,g=d[1]&&d[1].pos;g==null&&(g=b),x={anchor:b+a,head:g+a}}return{doc:y,sel:x,from:a,to:l}}const Qz=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(xt&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||xt&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},eF=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function tF(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let S=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,N=lx(t,S);if(N&&!t.state.selection.eq(N)){if(ot&&or&&t.input.lastKeyCode===13&&Date.now()-100E(t,Cs(13,"Enter"))))return;let T=t.state.tr.setSelection(N);S=="pointer"?T.setMeta("pointer",!0):S=="key"&&T.scrollIntoView(),i&&T.setMeta("composition",i),t.dispatch(T)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=Zz(t,e,n,s),d=t.state.doc,h=d.slice(u.from,u.to),p,f;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||or)&&s.some(S=>S.nodeType==1&&!eF.test(S.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",S=>S(t,Cs(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Q&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let S=Zk(t,t.state.doc,u.sel);if(S&&!S.eq(t.state.selection)){let N=t.state.tr.setSelection(S);i&&N.setMeta("composition",i),t.dispatch(N)}}return}t.state.selection.fromt.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),It&&Xr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" "&&(m.start--,m.endA--,m.endB--);let x=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),b=d.resolve(m.start),g=x.sameParent(y)&&x.parent.inlineContent&&b.end()>=m.endA;if((co&&t.input.lastIOSEnter>Date.now()-225&&(!g||s.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!g&&x.posS(t,Cs(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&rF(d,m.start,m.endA,x,y)&&t.someProp("handleKeyDown",S=>S(t,Cs(8,"Backspace")))){or&&ot&&t.domObserver.suppressSelectionUpdates();return}ot&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),or&&!g&&x.start()!=y.start()&&y.parentOffset==0&&x.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(S){return S(t,Cs(13,"Enter"))})},20));let k=m.start,w=m.endA,C=S=>{let N=S||t.state.tr.replace(k,w,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let T=Zk(t,N.doc,u.sel);T&&!(ot&&t.composing&&T.empty&&(m.start!=m.endB||t.input.lastChromeDeletedr(t),20));let S=C(t.state.tr.delete(k,w)),N=d.resolve(m.start).marksAcross(d.resolve(m.endA));N&&S.ensureMarks(N),t.dispatch(S)}else if(m.endA==m.endB&&(j=nF(x.parent.content.cut(x.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let S=C(t.state.tr);j.type=="add"?S.addMark(k,w,j.mark):S.removeMark(k,w,j.mark),t.dispatch(S)}else if(x.parent.child(x.index()).isText&&x.index()==y.index()-(y.textOffset?0:1)){let S=x.parent.textBetween(x.parentOffset,y.parentOffset),N=()=>C(t.state.tr.insertText(S,k,w));t.someProp("handleTextInput",T=>T(t,k,w,S,N))||t.dispatch(N())}else t.dispatch(C());else t.dispatch(C())}function Zk(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:cx(t,e.resolve(n.anchor),e.resolve(n.head))}function nF(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let d=0;dd.mark(a.addToSet(d.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let u=[];for(let d=0;dn||Ff(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function sF(t,e,n,r,s){let i=t.findDiffStart(e,n),o=n+t.size,a=n+e.size;if(i==null)return null;let{a:l,b:u}=t.findDiffEnd(e,o,a);if(s=="end"){let d=Math.max(0,i-Math.min(l,u));r-=l+d-i}if(l=l?i-r:0;i-=d,u=i+(u-l),l=i}else if(u=u?i-r:0;i-=d,l=i+(l-u),u=i}return{start:i,endA:l,endB:u}}class hT{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new vz,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rw),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=tw(this),ew(this),this.nodeViews=nw(this),this.docView=_k(this.state.doc,Qk(this),zf(this),this.dom,this),this.domObserver=new Gz(this,(r,s,i,o)=>tF(this,r,s,i,o)),this.domObserver.start(),kz(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&sg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rw),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(iT(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=nw(this);oF(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&sg(this),this.editable=tw(this),ew(this);let l=zf(this),u=Qk(this),d=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",h=i||!this.docView.matchesNode(e.doc,u,l);(h||!e.selection.eq(s.selection))&&(o=!0);let p=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&_6(this);if(o){this.domObserver.stop();let f=h&&(It||ot)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&iF(s.selection,e.selection);if(h){let x=ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Iz(this)),(i||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=_k(e.doc,u,l,this.dom,this)),x&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}let m=this.input.mouseDown;f||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&iz(this)&&m.delaySelUpdate())?dr(this,f):(UE(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&I6(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Pk(this,n.getBoundingClientRect(),e)}else Pk(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&in.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return $6(this,e)}coordsAtPos(e,n=1){return OE(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return G6(this,n||this.state,e)}pasteHTML(e,n){return dl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return dl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ux(this,e)}destroy(){this.docView&&(wz(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,C6())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Nz(this,e)}domSelectionRange(){let e=this.domSelection();return e?xt&&this.root.nodeType===11&&P6(this.dom.ownerDocument)==this.dom&&Jz(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}hT.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Qk(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[St.node(0,t.state.doc.content.size,e)]}function ew(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:St.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function tw(t){return!t.someProp("editable",e=>e(t.state)===!1)}function iF(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function nw(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function oF(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function rw(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var as={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ed={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},aF=typeof navigator<"u"&&/Mac/.test(navigator.platform),lF=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var it=0;it<10;it++)as[48+it]=as[96+it]=String(it);for(var it=1;it<=24;it++)as[it+111]="F"+it;for(var it=65;it<=90;it++)as[it]=String.fromCharCode(it+32),ed[it]=String.fromCharCode(it);for(var Vf in as)ed.hasOwnProperty(Vf)||(ed[Vf]=as[Vf]);function cF(t){var e=aF&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lF&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ed:as)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const uF=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),dF=typeof navigator<"u"&&/Win/.test(navigator.platform);function hF(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a[a,(...d)=>{const h=l(...d)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(i),h}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a=[],l=!!e,u=e||i.tr,d=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(p=>p===!0)),h={...Object.fromEntries(Object.entries(r).map(([p,f])=>[p,(...x)=>{const y=this.buildProps(u,n),b=f(...x)(y);return a.push(b),h}])),run:d};return h}static createFakeChain(){const e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:n,state:r}=this,s=!1,i=e||r.tr,o=this.buildProps(i,s);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,s)}}static createFallbackCan(){const e=pT.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){const{rawCommands:r,editor:s,state:i}=this,{view:o}=s,a={tr:e,editor:s,view:o,state:bh({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...d)=>u(...d)(a)]))}};return a}};const mF=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),gF=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),xF=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:d}=e,h=u.resolve(d.map(l)),p=u.resolve(d.map(l+a.nodeSize)),f=h.blockRange(p);if(!f)return;const m=jo(f);if(a.type.isTextblock){const{defaultType:x}=h.parent.contentMatchAt(h.index());e.setNodeMarkup(f.start,x)}(m||m===0)&&e.lift(f,m)})}),!0},yF=t=>e=>t(e),bF=()=>({state:t,dispatch:e})=>jE(t,e),vF=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Q(r.doc.resolve(Math.max(o-1,0)))),!0},kF=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const o=s.before(i),a=s.after(i);t.delete(o,a).scrollIntoView()}return!0}return!1};function Ke(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}const wF=t=>({tr:e,state:n,dispatch:r})=>{const s=Ke(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),l=i.after(o);e.delete(a,l).scrollIntoView()}return!0}return!1},SF=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},NF=t=>t.content?/^text(\*|\+)/.test(t.content):!1,sw=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos({from:sw(t,n,"left"),to:sw(e,n,"right")}),jF=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,s=n.steps.length;r.forEach(i=>{const o=n.mapping.slice(s),a=n.doc.resolve(o.map(i.$from.pos)),l=n.doc.resolve(o.map(i.$to.pos)),{from:u,to:d}=CF(a,l,t.schema);n.deleteRange(u,d)}),n.selection.empty||n.setSelection(Q.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},EF=()=>({commands:t})=>t.keyboardShortcut("Enter"),TF=()=>({state:t,dispatch:e})=>u6(t,e);function gx(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function td(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:gx(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function mT(t,e,n={}){return t.find(r=>r.type===e&&td(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function iw(t,e,n={}){return!!mT(t,e,n)}function xx(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(l=>l.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(l=>l.type===e))return;if(!n){const l=r.node.marks.find(u=>u.type===e);l&&(n=l.attrs)}if(!mT([...r.node.marks],e,n))return;let s=r.index,i=t.start()+r.offset,o=s+1,a=i+r.node.nodeSize;for(;s>0&&iw([...t.parent.child(s-1).marks],e,n);)s-=1,i-=t.parent.child(s).nodeSize;for(;o({tr:n,state:r,dispatch:s})=>{const i=br(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:u,to:d}=a;if(s){const h=xx(l,i,e);if(h&&h.from<=u&&h.to>=d){const p=Q.create(o,h.from,h.to);n.setSelection(p)}}return!0},PF=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(nd()||ow())&&r.dom.focus(),AF()&&!nd()&&!ow()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!gT(n.state.selection))return o(),!0;const a=ig(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},LF=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),RF=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),xT=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&xT(r)}return t};function vc(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return xT(n)}function yT(t){return typeof(t==null?void 0:t.nodesBetween)=="function"}function uo(t,e,n){if(yT(t))return t;const r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};const s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return B.fromArray(t.map(o=>e.nodeFromJSON(o)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),uo("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new Zj({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?Yr.fromSchema(l).parseSlice(vc(t),n.parseOptions):Yr.fromSchema(l).parse(vc(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Yr.fromSchema(e);return n.slice?i.parseSlice(vc(t),n.parseOptions).content:i.parse(vc(t),n.parseOptions)}return uo("",e,n)}function bT(t){return!("type"in t)}function vT(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=d)}),t.setSelection(ie.near(t.doc.resolve(o),n))}const _F=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{uo(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){l(y)}try{var o;a=uo(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:i.options.enableContentCheck})}catch(y){return l(y),!1}let{from:d,to:h}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,f=!0;const m=bT(a)?a.content:[a];if(m.forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,f=f?y.isBlock:!1}),d===h&&f){const{parent:y}=r.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,h+=1)}let x;if(p)Array.isArray(e)?x=e.map(y=>y.text||"").join(""):yT(e)?x=m.map(y=>{var b;return(b=y.text)!==null&&b!==void 0?b:""}).join(""):typeof e=="object"&&e&&e.text?x=e.text:x=e,r.insertText(x,d,h);else{x=B.from(m);const y=r.doc.resolve(d),b=y.node(),g=y.parentOffset===0,k=b.isText||b.isTextblock,w=b.content.size>0;g&&k&&w&&f&&(d=Math.max(0,d-1)),r.replaceWith(d,h,m)}n.updateSelection&&vT(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:x}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:x})}return!0};function kT(t){for(let e=0;e({tr:e,dispatch:n,editor:r})=>{const{pos:s,attrs:i,content:o,updateSelection:a=!0}=t;let l;typeof s=="number"?l=e.doc.resolve(s):s?l=s:l=e.selection.$from;const u=kT(l.parent.contentMatchAt(l.index()));if(!u)return!1;const d=Object.keys(u.spec.attrs||{}),h=i?Object.fromEntries(Object.entries(i).filter(([f])=>d.includes(f))):{};let p;if(o){const f=uo(o,r.schema);p=u.createAndFill(h,f)}else p=u.createAndFill(h);return p?(n&&(e.insert(l.pos,p),a&&vT(e,e.steps.length-1,-1)),!0):!1},OF=()=>({state:t,dispatch:e})=>a6(t,e),BF=()=>({state:t,dispatch:e})=>l6(t,e),zF=()=>({state:t,dispatch:e})=>bE(t,e),FF=()=>({state:t,dispatch:e})=>SE(t,e),VF=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ph(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$F=()=>({state:t,dispatch:e,tr:n})=>{try{const r=ph(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},HF=()=>({state:t,dispatch:e})=>i6(t,e),WF=()=>({state:t,dispatch:e})=>o6(t,e);function wT(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function UF(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a({editor:e,view:n,tr:r,dispatch:s})=>{const i=UF(t).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l==null||l.steps.forEach(u=>{const d=u.map(r.mapping);d&&s&&r.maybeStep(d)}),!0};function gr(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Ke(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(d,h)=>{if(d.isText)return;const p=Math.max(r,h),f=Math.min(s,h+d.nodeSize);a.push({node:d,from:p,to:f})});const l=s-r,u=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>td(d.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((d,h)=>d+h.to-h.from,0)>=l}const GF=(t,e={})=>({state:n,dispatch:r})=>gr(n,Ke(t,n.schema),e)?c6(n,r):!1,qF=()=>({state:t,dispatch:e})=>EE(t,e),JF=t=>({state:e,dispatch:n})=>{const r=Ke(t,e.schema);return k6(r)(e,n)},YF=()=>({state:t,dispatch:e})=>CE(t,e);function vh(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function aw(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}const XF=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=vh(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Ke(t,r.schema)),a==="mark"&&(o=br(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,h)=>{i&&i===d.type&&(l=!0,s&&n.setNodeMarkup(h,void 0,aw(d.attrs,e))),o&&d.marks.length&&d.marks.forEach(p=>{o===p.type&&(l=!0,s&&n.addMark(h,h+d.nodeSize,o.create(aw(p.attrs,e))))})})}),l},ZF=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),QF=()=>({tr:t,dispatch:e})=>{if(e){const n=new Ht(t.doc);t.setSelection(n)}return!0},eV=()=>({state:t,dispatch:e})=>kE(t,e),tV=()=>({state:t,dispatch:e})=>NE(t,e),nV=()=>({state:t,dispatch:e})=>f6(t,e),rV=()=>({state:t,dispatch:e})=>g6(t,e),sV=()=>({state:t,dispatch:e})=>m6(t,e);function og(t,e,n={},r={}){return uo(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const iV=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const u=og(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});if(o){const d=bT(u)?u.content:[u];i.replaceWith(0,l.content.size,d).setMeta("preventUpdate",!n)}return!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function ST(t,e){const n=br(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function NT(t,e){const n=new pE(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function oV(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function aV(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function kh(t){return e=>aV(e.$from,t)}function J(t,e,n){return t.config[e]===void 0&&t.parent?J(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?J(t.parent,e,n):null}):t.config[e]}function yx(t){return t.map(e=>{const n=J(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...yx(n())]:e}).flat(10)}function bx(t,e){const n=oi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function CT(t){return typeof t=="function"}function he(t,e=void 0,...n){return CT(t)?e?t.bind(e)(...n):t(...n):t}function lV(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ho(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function jT(t){const e=[],{nodeExtensions:n,markExtensions:r}=ho(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),l=[...o,...a];return t.forEach(u=>{const d=J(u,"addGlobalAttributes",{name:u.name,options:u.options,storage:u.storage,extensions:s});d&&d().forEach(h=>{let p;Array.isArray(h.types)?p=h.types:h.types==="*"?p=l:h.types==="nodes"?p=o:h.types==="marks"?p=a:p=[],p.forEach(f=>{Object.entries(h.attributes).forEach(([m,x])=>{e.push({type:f,name:m,attribute:{...i,...x}})})})})}),s.forEach(u=>{const d=J(u,"addAttributes",{name:u.name,options:u.options,storage:u.storage});if(!d)return;const h=d();Object.entries(h).forEach(([p,f])=>{const m={...i,...f};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:u.name,name:p,attribute:m})})}),e}function cV(t){const e=[];let n="",r=!1,s=!1,i=0;const o=t.length;for(let a=0;a0){i-=1,n+=l;continue}if(l===";"&&i===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function lw(t){const e=[],n=cV(t||""),r=n.length;for(let s=0;s!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(s==="__proto__"){Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[s]){r[s]=i;return}if(s==="class"){const o=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],l=o.filter(u=>!a.includes(u));r[s]=[...a,...l].join(" ")}else if(s==="style"){const o=new Map([...lw(r[s]),...lw(i)]);r[s]=Array.from(o.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}else r[s]=i}),r},{})}function fl(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Fe(n,r),{})}function uV(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function cw(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):uV(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function uw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&lV(n)?!1:n!=null))}function dw(t){var e,n;const r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function dV(t,e){var n;const r=jT(t),{nodeExtensions:s,markExtensions:i}=ho(t),o=(n=s.find(u=>J(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(s.map(u=>{const d=r.filter(y=>y.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},p=uw({...t.reduce((y,b)=>{const g=J(b,"extendNodeSchema",h);return{...y,...g?g(u):{}}},{}),content:he(J(u,"content",h)),marks:he(J(u,"marks",h)),group:he(J(u,"group",h)),inline:he(J(u,"inline",h)),atom:he(J(u,"atom",h)),selectable:he(J(u,"selectable",h)),draggable:he(J(u,"draggable",h)),code:he(J(u,"code",h)),whitespace:he(J(u,"whitespace",h)),linebreakReplacement:he(J(u,"linebreakReplacement",h)),defining:he(J(u,"defining",h)),isolating:he(J(u,"isolating",h)),attrs:Object.fromEntries(d.map(dw))}),f=he(J(u,"parseHTML",h));f&&(p.parseDOM=f.map(y=>cw(y,d)));const m=J(u,"renderHTML",h);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:fl(y,d)}));const x=J(u,"renderText",h);return x&&(p.toText=x),[u.name,p]})),l=Object.fromEntries(i.map(u=>{const d=r.filter(x=>x.type===u.name),h={name:u.name,options:u.options,storage:u.storage,editor:e},p=uw({...t.reduce((x,y)=>{const b=J(y,"extendMarkSchema",h);return{...x,...b?b(u):{}}},{}),inclusive:he(J(u,"inclusive",h)),excludes:he(J(u,"excludes",h)),group:he(J(u,"group",h)),spanning:he(J(u,"spanning",h)),code:he(J(u,"code",h)),attrs:Object.fromEntries(d.map(dw))}),f=he(J(u,"parseHTML",h));f&&(p.parseDOM=f.map(x=>cw(x,d)));const m=J(u,"renderHTML",h);return m&&(p.toDOM=x=>m({mark:x,HTMLAttributes:fl(x,d)})),[u.name,p]}));return new Zj({topNode:o,nodes:a,marks:l})}function hV(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Sa(t){return t.sort((n,r)=>{const s=J(n,"priority")||100,i=J(r,"priority")||100;return s>i?-1:sr.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function TT(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
+
+`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,u,d,h)=>{l.isBlock&&u>r&&(a+=i);const p=o==null?void 0:o[l.type.name];if(p)return d&&(a+=p({node:l,pos:u,parent:d,index:h,range:e})),!1;if(l.isText){var f;a+=l==null||(f=l.text)===null||f===void 0?void 0:f.slice(Math.max(r,u)-u,s-u)}}),a}function fV(t,e){return TT(t,{from:0,to:t.content.size},e)}function MT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function pV(t,e){const n=Ke(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function PT(t,e){const n=vh(typeof e=="string"?e:e.name,t.schema);return n==="node"?pV(t,e):n==="mark"?ST(t,e):{}}function mV(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function gV(t){const e=mV(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,i)=>i!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function wh(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(i).map(a,-1),d=e.slice(i).map(l),h=e.invert().map(u,-1),p=e.invert().map(d);r.push({oldRange:{from:h,to:p},newRange:{from:u,to:d}})})}),gV(r)}function vx(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=xx(n.resolve(t),s.type);i&&r.push({mark:s,...i})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}const xV=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]},yV=t=>{const e=t.depth-1;if(e<0)return null;const n=t.index(e);return n===0?null:t.node(e).child(n-1)};function pi(t,e){return e.nodes[t]||e.marks[t]||null}function su(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}const bV=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,u;const d=((l=(u=s.type.spec).toText)===null||l===void 0?void 0:l.call(u,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?d:d.slice(0,Math.max(0,r-i))}),n};function ag(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?br(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>td(d.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:h})=>{const p=d.pos,f=h.pos;t.doc.nodesBetween(p,f,(m,x)=>{if(i&&m.inlineContent&&!m.type.allowsMarkType(i))return!1;if(!m.isText&&!m.marks.length)return;const y=Math.max(p,x),b=Math.min(f,x+m.nodeSize),g=b-y;o+=g,a.push(...m.marks.map(k=>({mark:k,from:y,to:b})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>td(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),u=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+u:l)>=o}function vV(t,e,n={}){if(!e)return gr(t,null,n)||ag(t,null,n);const r=vh(e,t.schema);return r==="node"?gr(t,e,n):r==="mark"?ag(t,e,n):!1}const kV=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=kh(a=>a.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function hw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Hf(t,e){const{nodeExtensions:n}=ho(e),r=n.find(i=>i.name===t);if(!r)return!1;const s=he(J(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof s!="string"?!1:s.split(" ").includes("list")}function _l(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(_l(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function AT(t){return t instanceof Z}var DT=class LT{constructor(e){this.position=e}static fromJSON(e){return new LT(e.position)}toJSON(){return{position:this.position}}};function SV(t,e){const n=e.mapping.mapResult(t.position);return{position:new DT(n.pos),mapResult:n}}function NV(t){return new DT(t)}function CV(t,e,n){const{selection:r}=e;let s=null;if(gT(r)&&(s=r.$cursor),s){var i;const a=(i=t.storedMarks)!==null&&i!==void 0?i:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(l=>l.type.excludes(n)))}const{ranges:o}=r;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(d,h,p)=>{if(u)return!1;if(d.isInline){const f=!p||p.type.allowsMarkType(n),m=!!n.isInSet(d.marks)||!d.marks.some(x=>x.type.excludes(n));u=f&&m}return!u}),u})}const jV=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=br(t,r.schema);if(s)if(o){const u=ST(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;r.doc.nodesBetween(d,h,(p,f)=>{const m=Math.max(f,d),x=Math.min(f+p.nodeSize,h);p.marks.find(y=>y.type===l)?p.marks.forEach(y=>{l===y.type&&n.addMark(m,x,l.create({...y.attrs,...e}))}):n.addMark(m,x,l.create(e))})});return CV(r,n,l)},EV=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),TV=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Ke(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>Ek(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Ek(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},MV=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Rs(t,0,r.content.size),i=Z.create(r,s);e.setSelection(i)}return!0},PV=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=i.from,a=i.to),s&&n.doc.nodesBetween(o,a,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},AV=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Q.atStart(r).from,a=Q.atEnd(r).to,l=Rs(s,o,a),u=Rs(i,o,a),d=Q.create(r,l,u);e.setSelection(d)}return!0},DV=t=>({state:e,dispatch:n})=>{const r=Ke(t,e.schema);return N6(r)(e,n)};function fw(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}const LV=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,u=s.extensionManager.attributes,d=su(u,a.node().type.name,a.node().attrs);if(i instanceof Z&&i.node.isBlock)return!a.parentOffset||!ur(o,a.pos)?!1:(r&&(t&&fw(n,s.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const h=l.parentOffset===l.parent.content.size,p=a.depth===0?void 0:kT(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=h&&p?[{type:p,attrs:d}]:void 0,m=ur(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!m&&ur(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(m=!0,f=p?[{type:p,attrs:d}]:void 0),r){if(m&&(i instanceof Q&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),p&&!h&&!a.parentOffset&&a.parent.type!==p)){const x=e.mapping.map(a.before()),y=e.doc.resolve(x);a.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}t&&fw(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},RV=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{const o=Ke(t,r.schema),{$from:a,$to:l}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const d=a.node(-1);if(d.type!==o)return!1;const h=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){var p;let b=B.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let N=a.depth-g;N>=a.depth-3;N-=1)b=B.from(a.node(N).copy(b));const k=a.indexAfter(-1){if(S>-1)return!1;N.isTextblock&&N.content.size===0&&(S=T+1)}),S>-1&&n.setSelection(Q.near(n.doc.resolve(S))),n.scrollIntoView()}return!0}const f=l.pos===a.end()?d.contentMatchAt(0).defaultType:null,m={...su(h,d.type.name,d.attrs),...e},x={...su(h,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,l.pos);const y=f?[{type:o,attrs:m},{type:f,attrs:x}]:[{type:o,attrs:m}];if(!ur(n.doc,a.pos,2))return!1;if(s){const{selection:b,storedMarks:g}=r,{splittableMarks:k}=i.extensionManager,w=g||b.$to.parentOffset&&b.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!w||!s)return!0;const C=w.filter(j=>k.includes(j.type.name));n.ensureMarks(C)}return!0};function pw(t){return!t||t==="1"?null:t}function RT(t,e){return pw(t)===pw(e)}const Wf=(t,e)=>{const n=kh(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&ps(t.doc,n.pos))||!RT(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(n.pos),!0},Uf=(t,e)=>{const n=kh(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return!(n.node.type===(s==null?void 0:s.type)&&ps(t.doc,r))||!RT(n.node.attrs.type,s==null?void 0:s.attrs.type)||t.join(r),!0};function _V(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),s=e.resolve(n.nodeSize-1);return Q.between(r,s)}const IV=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:u,can:d})=>{const{extensions:h,splittableMarks:p}=s.extensionManager,f=Ke(t,o.schema),m=Ke(e,o.schema),{selection:x,storedMarks:y}=o,{$from:b,$to:g}=x,k=b.blockRange(g),w=y||x.$to.parentOffset&&x.$from.marks();if(!k)return!1;const C=kh(O=>Hf(O.type.name,h))(x),j=x.from===0&&x.to===o.doc.content.size,S=o.doc.content.content,N=S.length===1?S[0]:null,T=j&&N&&Hf(N.type.name,h)?{node:N,pos:0}:null,E=C??T,D=!!C&&k.depth>=1&&k.depth-C.depth<=1,P=!!T;if((D||P)&&E){if(E.node.type===f)return j&&P?l().command(({tr:O,dispatch:W})=>{const I=_V(O);return I?(O.setSelection(I),W&&W(O),!0):!1}).liftListItem(m).run():u.liftListItem(m);if(Hf(E.node.type.name,h)&&f.validContent(E.node.content))return l().command(()=>(i.setNodeMarkup(E.pos,f),!0)).command(()=>Wf(i,f)).command(()=>Uf(i,f)).run()}return!n||!w||!a?l().command(()=>d().wrapInList(f,r)?!0:u.clearNodes()).wrapInList(f,r).command(()=>Wf(i,f)).command(()=>Uf(i,f)).run():l().command(()=>{const O=d().wrapInList(f,r),W=w.filter(I=>p.includes(I.type.name));return i.ensureMarks(W),O?!0:u.clearNodes()}).wrapInList(f,r).command(()=>Wf(i,f)).command(()=>Uf(i,f)).run()},OV=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=br(t,r.schema);return ag(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},BV=(t,e,n={})=>({state:r,commands:s})=>{const i=Ke(t,r.schema),o=Ke(e,r.schema),a=gr(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},zV=(t,e={})=>({state:n,commands:r})=>{const s=Ke(t,n.schema);return gr(n,s,e)?r.lift(s):r.wrapIn(s,e)},FV=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},VV=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:s=!1}=t,{selection:i}=e,{empty:o,ranges:a}=i;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const u=Object.values(r.schema.marks).filter(d=>s||!l.includes(d.name));a.forEach(d=>{for(const h of u)e.removeMark(d.$from.pos,d.$to.pos,h)})}return!0},$V=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:o}=n,a=br(t,r.schema),{$from:l,empty:u,ranges:d}=o;if(!s)return!0;if(u&&i){var h;let{from:p,to:f}=o;const m=xx(l,a,(h=l.marks().find(x=>x.type===a))===null||h===void 0?void 0:h.attrs);m&&(p=m.from,f=m.to),n.removeMark(p,f,a)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,a)});return n.removeStoredMark(a),!0},HV=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(a,l)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},WV=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=vh(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(i=Ke(t,r.schema)),a==="mark"&&(o=br(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const d=u.$from.pos,h=u.$to.pos;let p,f,m,x;n.selection.empty?r.doc.nodesBetween(d,h,(y,b)=>{i&&i===y.type&&(l=!0,m=Math.max(b,d),x=Math.min(b+y.nodeSize,h),p=b,f=y)}):r.doc.nodesBetween(d,h,(y,b)=>{b=d&&b<=h&&(i&&i===y.type&&(l=!0,s&&n.setNodeMarkup(b,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(g=>{if(o===g.type&&(l=!0,s)){const k=Math.max(b,d),w=Math.min(b+y.nodeSize,h);n.addMark(k,w,o.create({...g.attrs,...e}))}}))}),f&&(p!==void 0&&s&&n.setNodeMarkup(p,void 0,{...f.attrs,...e}),o&&f.marks.length&&f.marks.forEach(y=>{o===y.type&&s&&n.addMark(m,x,o.create({...y.attrs,...e}))}))}),l},bi=new Ve("__tiptap_decorations__"),UV=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(bi,{type:"force",name:t}),!0),KV=(t,e={})=>({state:n,dispatch:r})=>{const s=Ke(t,n.schema);return x6(s,e)(n,r)},GV=(t,e={})=>({state:n,dispatch:r})=>{const s=Ke(t,n.schema);return y6(s,e)(n,r)};var qV=cB({blur:()=>mF,clearContent:()=>gF,clearNodes:()=>xF,command:()=>yF,createParagraphNear:()=>bF,cut:()=>vF,deleteCurrentNode:()=>kF,deleteNode:()=>wF,deleteRange:()=>SF,deleteSelection:()=>jF,enter:()=>EF,exitCode:()=>TF,extendMarkRange:()=>MF,first:()=>PF,focus:()=>DF,forEach:()=>LF,insertContent:()=>RF,insertContentAt:()=>_F,insertDefaultBlock:()=>IF,joinBackward:()=>zF,joinDown:()=>BF,joinForward:()=>FF,joinItemBackward:()=>VF,joinItemForward:()=>$F,joinTextblockBackward:()=>HF,joinTextblockForward:()=>WF,joinUp:()=>OF,keyboardShortcut:()=>KF,lift:()=>GF,liftEmptyBlock:()=>qF,liftListItem:()=>JF,newlineInCode:()=>YF,resetAttributes:()=>XF,scrollIntoView:()=>ZF,selectAll:()=>QF,selectNodeBackward:()=>eV,selectNodeForward:()=>tV,selectParentNode:()=>nV,selectTextblockEnd:()=>rV,selectTextblockStart:()=>sV,setContent:()=>iV,setMark:()=>jV,setMeta:()=>EV,setNode:()=>TV,setNodeSelection:()=>MV,setTextDirection:()=>PV,setTextSelection:()=>AV,sinkListItem:()=>DV,splitBlock:()=>LV,splitListItem:()=>RV,toggleList:()=>IV,toggleMark:()=>OV,toggleNode:()=>BV,toggleWrap:()=>zV,undoInputRule:()=>FV,unsetAllMarks:()=>VV,unsetMark:()=>$V,unsetTextDirection:()=>HV,updateAttributes:()=>WV,updateDecorations:()=>UV,wrapIn:()=>KV,wrapInList:()=>GV});const Ho=new WeakMap;function JV(t,e){var n;Ho.set(t,((n=Ho.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;const s=((r=Ho.get(t))!==null&&r!==void 0?r:1)-1;s>0?Ho.set(t,s):Ho.delete(t)}}var YV=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function XV(t){return t.kind==="widget"}function _T(t,e){const n=[],r=new Set;for(const s of t)s.kind==="widget"&&XV(s)&&r.add(s.key),n.push(s.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function ZV(t,e,n){const{decorations:r,widgetKeys:s}=_T(e,n);return{set:de.create(t,r),widgetKeys:s}}function IT({position:t,from:e,to:n,docSize:r}){return tIT({position:o.anchor,from:e,to:n,docSize:r})?!0:(o.anchor===n||i.has(s)||(i.add(s),console.warn(`[tiptap warn]: Extension "${s}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function e8(t){var e;const n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function OT(t){return t.jsonID==="attr"}function t8(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||OT(t))return!0;const n=t;return typeof n.from=="number"&&typeof n.to=="number"}function n8(t,e){let n=null,r=0,s=0;for(let i=0;ie.to);i+=1){const o=s+t.child(i).nodeSize;o>=e.from&&(n===null&&(n=s),r=o),s=o}return n===null?null:{from:n,to:r}}function r8(t,e){if(t.steps.some(i=>!t8(i)))return{type:"full"};const n=wh(t).map(({newRange:i})=>i);t.steps.forEach((i,o)=>{if(!OT(i))return;const a=t.mapping.slice(o);n.push({from:a.map(i.pos,-1),to:a.map(i.pos+1)})});const r=[];for(const i of n){const o=n8(e,i);o&&r.push(o)}r.sort((i,o)=>i.from-o.from);const s=[];for(const i of r){const o=s[s.length-1];o&&i.from<=o.to?o.to=Math.max(o.to,i.to):s.push({...i})}return{type:"ranges",ranges:s}}function BT(t,e,n,r){return t.map(e,n,{onRemove:s=>{const i=s==null?void 0:s.key;typeof i=="string"&&r.delete(i)}})}function s8(t,e,n){var r,s;const i=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:de.empty,o=new Set((s=e.widgetKeysByExtension[t])!==null&&s!==void 0?s:[]);return{set:BT(i,n.mapping,n.doc,o),widgetKeys:o}}function mw(t,e){const n=Object.values(e).flatMap(r=>r.find());return de.create(t,n)}function gw(t){const e=new Set;for(const n of Object.values(t))for(const r of n)e.add(r);return e}function i8(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function o8(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}const a8=new Set;var l8=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const n=bi.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>i8(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=bi.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:a8}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const s=r();s&&e.push({name:n,spec:s})}return e}createPlugin(){const{editor:t,entries:e}=this;return new we({key:bi,state:{init:(n,r)=>{const s={},i={};for(const{name:a,spec:l}of e){const{set:u,widgetKeys:d}=this.buildFullSet(a,l,r);s[a]=u,i[a]=d}const o={decorationSetsByExtension:s,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,s),widgetKeys:gw(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(n,r,s,i)=>{const o=n.getMeta(bi),a=(o==null?void 0:o.type)==="force"&&!o.name,l=(o==null?void 0:o.type)==="force"?o.name:void 0,u={},d={},h=new Set;return JV(t,()=>{for(const{name:p,spec:f}of e){const m=a||l===p;if(o8(f,{editor:t,tr:n,oldState:s,newState:i},m))if(f.update==="changedRanges"&&n.docChanged&&!m){const x=this.applyChangedRangesRecompute(p,f,r,n,i);u[p]=x.set,d[p]=x.widgetKeys,h.add(p)}else{const{set:x,widgetKeys:y}=this.buildFullSet(p,f,i);u[p]=x,d[p]=y,h.add(p)}else{const x=s8(p,r,n);u[p]=x.set,d[p]=x.widgetKeys}}}),h.size===0&&!n.docChanged?r:{decorationSetsByExtension:u,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:u,recomputedNames:h}),widgetKeys:gw(d)}}},props:{decorations(n){var r,s;return(r=(s=bi.getState(n))===null||s===void 0?void 0:s.mergedDecorationSet)!==null&&r!==void 0?r:de.empty}}})}applyChangedRangesRecompute(t,e,n,r,s){const i=r8(r,s.doc);return i.type==="full"?this.buildFullSet(t,e,s):this.rebuildRanges(t,e,n,r,s,i.ranges)}rebuildRanges(t,e,n,r,s,i){var o,a;const l=(o=n.decorationSetsByExtension[t])!==null&&o!==void 0?o:de.empty,u=new Set((a=n.widgetKeysByExtension[t])!==null&&a!==void 0?a:[]);let d=BT(l,r.mapping,r.doc,u);const h=s.doc.content.size;for(const{from:p,to:f}of i){const m=d.find(p,f).filter(b=>IT({position:b.from,from:p,to:f,docSize:h}));for(const b of m){const g=e8(b);g&&u.delete(g)}d=d.remove(m);const{decorations:x,widgetKeys:y}=_T(QV({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:s,view:this.mountedView,from:p,to:f})),from:p,to:f,docSize:h,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);d=d.add(s.doc,x);for(const b of y)u.add(b)}return{set:d,widgetKeys:u}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return ZV(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){}buildMergedSet(t,e){const n=Object.keys(e);return n.length===1?e[n[0]]:mw(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:s}){return t.length===1?r[t[0].name]:s.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):mw(n.doc,r)}};function c8(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Z){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}function u8(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}function Il(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(i=>i.trim()).filter(Boolean),s=e.toLowerCase();for(let i=r.length-1;i>=0;i-=1){const o=r[i],a=o.indexOf(":");if(a!==-1&&o.slice(0,a).trim().toLowerCase()===s)return o.slice(a+1).trim()}return null}function d8(t){return typeof t=="number"}function h8(t){return Object.prototype.toString.call(t).slice(8,-1)}function kc(t){return h8(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function xw(t,e,n){const r=t.split(`
+`),s=[];let i="",o=0;const a=e.baseIndentSize||2;for(;o0)break;if(d.trim()===""){o+=1,i=`${i}${d}
+`;continue}else return}const p=e.extractItemData(h),{indentLevel:f,mainContent:m}=p;i=`${i}${d}
+`;const x=[m];for(o+=1;oC.trim()!=="");if(w===-1)break;if((((u=r[o+1+w].match(/^(\s*)/))===null||u===void 0||(u=u[1])===null||u===void 0?void 0:u.length)||0)>f){x.push(k),i=`${i}${k}
+`,o+=1;continue}else break}if((((l=k.match(/^(\s*)/))===null||l===void 0||(l=l[1])===null||l===void 0?void 0:l.length)||0)>f)x.push(k),i=`${i}${k}
+`,o+=1;else break}let y;const b=x.slice(1);if(b.length>0){const k=b.map(w=>w.slice(f+a)).join(`
+`);k.trim()&&(e.customNestedParser?y=e.customNestedParser(k):y=n.blockTokens(k))}const g=e.createToken(p,y);s.push(g)}if(s.length!==0)return{items:s,raw:i}}const yw=4;function bw(t){let e=0;for(const n of t)e=n===" "?e+yw-e%yw:e+1;return e}function zT(t,e,n,r,s){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[o,...a]=t.content;let l=`${i}${e.renderChildren([o])}`;return a&&a.length>0&&a.forEach((u,d)=>{var h,p;const f=(h=(p=e.renderChild)===null||p===void 0?void 0:p.call(e,u,d+1))!==null&&h!==void 0?h:e.renderChildren([u]);if(f!=null){const m=y=>{if(!(s!=null&&s.alignNestedToPrefix))return e.indent(y);const b=e.indent(""),g=bw(i);return(bw(b)>=g?b:" ".repeat(g))+y},x=f.split(`
+`).map(y=>m(y||"")).join(`
+`);l+=u.type==="paragraph"?`
+
+${x}`:`
+${x}`}}),l}function FT(t,e){const n={...t};return kc(t)&&kc(e)&&Object.keys(e).forEach(r=>{kc(e[r])&&kc(t[r])?n[r]=FT(t[r],e[r]):n[r]=e[r]}),n}function f8(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const u=i.mapping.map(l),d=i.mapping.map(l)+a.nodeSize;let h=null;if(a.marks.forEach(f=>{if(f!==o)return!1;h=f}),!h)return;let p=!1;if(Object.keys(n).forEach(f=>{n[f]!==h.attrs[f]&&(p=!0)}),p){const f=t.type.create({...t.attrs,...n});i.removeMark(u,d,t.type),i.addMark(u,d,f)}}),i.docChanged&&e.view.dispatch(i)}var Ol=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}};const p8=(t,e)=>{if(gx(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function wc(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(p=>p.type.spec.code))return!1;let d=!1;const h=bV(u)+i;return o.forEach(p=>{if(d)return;const f=p8(h,p.find);if(!f)return;const m=f[0].length-i.length;if(m>0){const C=u.parentOffset-m;if(C<0||u.parent.textBetween(C,u.parentOffset)!==f[0].slice(0,m))return}const x=l.state.tr,y=bh({state:l.state,transaction:x}),b={from:r-(f[0].length-i.length),to:s},{commands:g,chain:k,can:w}=new Ui({editor:n,state:y});p.handler({state:y,range:b,match:f,commands:g,chain:k,can:w})===null||!x.steps.length||(p.undoable&&x.setMeta(a,{transform:x,from:r,to:s,text:i}),l.dispatch(x),d=!0)}),d}function m8(t){const{editor:e,rules:n}=t,r=new we({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=bx(B.from(u),o.schema);const{from:d}=l,h=d+u.length;wc({editor:e,from:d,to:h,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return wc({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&wc({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?wc({editor:e,from:o.pos,to:o.pos,text:`
+`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var kx=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...he(J(this,"addOptions",{name:this.name}))}}get storage(){return{...he(J(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>FT(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},gs=class VT extends kx{constructor(...e){super(...e),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new VT(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!i.find(a=>(a==null?void 0:a.type.name)===n.name))return!1;const o=i.find(a=>(a==null?void 0:a.type.name)===n.name);return o&&r.removeStoredMark(o),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},$T=class{constructor(t){this.find=t.find,this.handler=t.handler}};const g8=(t,e,n)=>{if(gx(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function x8(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:u,can:d}=new Ui({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,s,(p,f)=>{var m,x,y,b;if(!((m=p.type)===null||m===void 0||(m=m.spec)===null||m===void 0)&&m.code||!(p.isText||p.isTextblock||p.isInline))return;const g=(x=(y=(b=p.content)===null||b===void 0?void 0:b.size)!==null&&y!==void 0?y:p.nodeSize)!==null&&x!==void 0?x:0,k=Math.max(r,f),w=Math.min(s,f+g);if(k>=w)return;const C=p.isText?p.text||"":p.textBetween(k-f,w-f,void 0,"");g8(C,i.find,o).forEach(j=>{if(j.index===void 0)return;const S=k+j.index+1,N=S+j[0].length,T={from:n.tr.mapping.map(S),to:n.tr.mapping.map(N)},E=i.handler({state:n,range:T,match:j,commands:l,chain:u,can:d,pasteEvent:o,dropEvent:a});h.push(E)})}),h.every(p=>p!==null)}let Sc=null;const y8=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function b8(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:p,pasteEvt:f})=>{const m=u.tr,x=bh({state:u,transaction:m});if(!(!x8({editor:e,state:x,from:Math.max(d-1,0),to:h.b-1,rule:p,pasteEvent:f,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(u=>new we({view(d){const h=f=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(f.target)?d.dom.parentElement:null,r&&(Sc=e)},p=()=>{Sc&&(Sc=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(i=r===d.dom.parentElement,a=h,!i){const p=Sc;p!=null&&p.isEditable&&setTimeout(()=>{const f=p.state.selection;f&&p.commands.deleteRange({from:f.from,to:f.to})},10)}return!1},paste:(d,h)=>{var p;const f=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=h,s=!!(f!=null&&f.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,p)=>{const f=d[0],m=f.getMeta("uiEvent")==="paste"&&!s,x=f.getMeta("uiEvent")==="drop"&&!i,y=f.getMeta("applyPasteRules"),b=!!y;if(!m&&!x&&!b)return;if(b){let{text:w}=y;typeof w=="string"?w=w:w=bx(B.from(w),p.schema);const{from:C}=y,j=C+w.length,S=y8(w);return l({rule:u,state:p,from:C,to:{b:j},pasteEvt:S})}const g=h.doc.content.findDiffStart(p.doc.content),k=h.doc.content.findDiffEnd(p.doc.content);if(!(!d8(g)||!k||g===k.b))return l({rule:u,state:p,from:g,to:k,pasteEvt:o})}}))}var Sh=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=ET(t),this.schema=dV(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=J(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:pi(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=Sa([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:pi(r.name,this.schema)},i=[],o=J(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&J(r,"exitable",s)&&(a.ArrowRight=()=>gs.handleExit({editor:t,mark:r})),o){const p=Object.fromEntries(Object.entries(o()).map(([f,m])=>[f,()=>m({editor:t})]));a={...a,...p}}const l=pF(a);i.push(l);const u=J(r,"addInputRules",s);if(hw(r,t.options.enableInputRules)&&u){const p=u();if(p&&p.length){const f=m8({editor:t,rules:p}),m=Array.isArray(f)?f:[f];i.push(...m)}}const d=J(r,"addPasteRules",s);if(hw(r,t.options.enablePasteRules)&&d){const p=d();if(p&&p.length){const f=b8({editor:t,rules:p});i.push(...f)}}const h=J(r,"addProseMirrorPlugins",s);if(h){const p=h();i.push(...p)}return i}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();const n=[];return this.extensions.forEach(r=>{const s=J(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:pi(r.name,this.schema)});s&&n.push({name:r.name,addDecorations:s})}),this.decorationManager=new l8({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return jT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ho(this.extensions);return Object.fromEntries(e.filter(n=>!!J(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s=J(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ke(n.name,this.schema)});if(!s)return[];const i=s();if(!i)return[];const o=(a,l,u,d,h)=>{const p=fl(a,r);return i({node:a,view:l,getPos:u,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:p})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return Sa([...this.extensions].reverse()).reduceRight((n,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:pi(r.name,this.schema)},i=J(r,"dispatchTransaction",s);return i?o=>{i.call(s,{transaction:o,next:n})}:n},t)}transformPastedHTML(t){const{editor:e}=this;return Sa([...this.extensions]).reduce((n,r)=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:pi(r.name,this.schema)},i=J(r,"transformPastedHTML",s);return i?(o,a)=>{const l=n(o,a);return i.call(s,l)}:n},t||(n=>n))}get markViews(){const{editor:t}=this,{markExtensions:e}=ho(this.extensions);return Object.fromEntries(e.filter(n=>!!J(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),s=J(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:br(n.name,this.schema)});if(!s)return[];const i=(o,a,l)=>{const u=fl(o,r);return s()({mark:o,view:a,inline:l,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{f8(o,t,d)}})};return[n.name,i]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:pi(e.name,this.schema)};if(e.type==="mark"){var r,s;(!((r=he(J(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((s=he(J(e,"clearable",n)))!==null&&s!==void 0)||s||this.nonClearableMarks.push(e.name)}const i=J(e,"onBeforeCreate",n),o=J(e,"onCreate",n),a=J(e,"onUpdate",n),l=J(e,"onSelectionUpdate",n),u=J(e,"onTransaction",n),d=J(e,"onFocus",n),h=J(e,"onBlur",n),p=J(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),d&&this.editor.on("focus",d),h&&this.editor.on("blur",h),p&&this.editor.on("destroy",p)})}};Sh.resolve=ET;Sh.sort=Sa;Sh.flatten=yx;var me=class HT extends kx{constructor(...e){super(...e),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new HT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};const v8=me.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new we({key:new Ve("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,i=MT(n),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:i};return[...s.ranges].sort((l,u)=>l.$from.pos-u.$from.pos).map(({$from:l,$to:u})=>TT(r,{from:l.pos,to:u.pos},a)).join(o??`
+
+`)}}})]}}),k8=me.create({name:"commands",addCommands(){return{...qV}}}),w8=me.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const s=()=>{var i,o,a;if((i=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(a=o.filterTransaction)===null||a===void 0?void 0:a.call(o,t))!==null&&i!==void 0?i:t.getMeta("y-sync$"))return;const l=NT(t.before,[t,...e]);wh(l).forEach(d=>{l.mapping.mapResult(d.oldRange.from).deletedAfter&&l.mapping.mapResult(d.oldRange.to).deletedBefore&&l.before.nodesBetween(d.oldRange.from,d.oldRange.to,(h,p)=>{const f=p+h.nodeSize-2,m=d.oldRange.from<=p&&f<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:p,to:f,newFrom:l.mapping.map(p),newTo:l.mapping.map(f),deletedRange:d.oldRange,newRange:d.newRange,partial:!m,editor:this.editor,transaction:t,combinedTransform:l})})});const u=l.mapping;l.steps.forEach((d,h)=>{if(d instanceof jn){var p,f;const m=u.slice(h).map(d.from,-1),x=u.slice(h).map(d.to),y=u.invert().map(m,-1),b=u.invert().map(x),g=m>0?(p=l.doc.nodeAt(m-1))===null||p===void 0?void 0:p.marks.some(w=>w.eq(d.mark)):!1,k=(f=l.doc.nodeAt(x))===null||f===void 0?void 0:f.marks.some(w=>w.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:y,to:b},newRange:{from:m,to:x},partial:!!(k||g),editor:this.editor,transaction:t,combinedTransform:l})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(s,0):s()}}),S8=me.create({name:"drop",addProseMirrorPlugins(){return[new we({key:new Ve("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),N8=me.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Ve("editable"),props:{editable:()=>this.editor.options.editable}})]}}),C8=new Ve("focusEvents"),j8=me.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new we({key:C8,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),E8=me.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:d,$anchor:h}=l,{pos:p,parent:f}=h,m=h.parent.isTextblock&&p>0?a.doc.resolve(p-1):h,x=m.parent.type.spec.isolating,y=h.pos-h.parentOffset,b=x&&m.parent.childCount===1?y===h.pos:ie.atStart(u).from===p;return!d||!f.type.isTextblock||f.textContent.length||!b||b&&h.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return nd()||wT()?i:s},addProseMirrorPlugins(){return[new we({key:new Ve("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(f=>f.getMeta("composition")))return;const r=t.some(f=>f.docChanged)&&!e.doc.eq(n.doc),s=t.some(f=>f.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=ie.atStart(e.doc).from,u=ie.atEnd(e.doc).to;if(i||!(o===l&&a===u)||!_l(n.doc))return;const d=n.tr,h=bh({state:n,transaction:d}),{commands:p}=new Ui({editor:this.editor,state:h});if(p.clearNodes(),!!d.steps.length)return d}})]}}),T8=me.create({name:"paste",addProseMirrorPlugins(){return[new we({key:new Ve("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),M8=me.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new we({key:new Ve("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),P8=me.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ho(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new we({key:new Ve("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});let vw=!1;function A8(t){if(vw)return;vw=!0;let e;try{e=Le.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof B||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var D8=class na{get name(){return this.node.type.name}constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new na(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new na(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new na(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!s&&!o&&l.depth<=this.depth)return;const u=new na(l,this.editor,s,s||o?n:null);s&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a