limbo-component 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/limbo.es.js CHANGED
@@ -1,42 +1,42 @@
1
- import e,{useState as t,useEffect as n,useCallback as r,useRef as a,useMemo as i}from"react";import o from"react-dom";import{jsx as l,jsxs as s,Fragment as c}from"react/jsx-runtime";const u={es:{"button.select":"Seleccionar","button.upload":"Subir imagen","button.cancel":"Cancelar","button.close":"Cerrar","button.save":"Guardar","button.delete":"Eliminar","button.download":"Descargar","button.copy":"Copiar URL","button.crop":"Recortar","button.apply":"Aplicar","button.reset":"Reiniciar","button.back":"Volver","button.next":"Siguiente","button.previous":"Anterior","tab.gallery":"Galería","tab.upload":"Subir","tab.ia":"IA","tab.stock":"Stock","tab.cropper":"Recortar","message.loading":"Cargando...","message.uploading":"Subiendo imagen...","message.processing":"Procesando...","message.no_images":"No hay imágenes disponibles","message.upload_success":"Imagen subida correctamente","message.upload_error":"Error al subir la imagen","message.delete_confirm":"¿Estás seguro de que deseas eliminar esta imagen? Esta acción también eliminará todos sus recortes.","message.copy_success":"URL copiada al portapapeles","message.copy_error":"Error al copiar URL","error.file_too_large":"El archivo es demasiado grande","error.invalid_format":"Formato de archivo no válido","error.upload_failed":"Error al subir el archivo","error.network":"Error de conexión","error.unknown":"Error desconocido","error.api_key_missing":"API Key no proporcionada","placeholder.search":"Buscar imágenes...","placeholder.prompt":"Describe la imagen que quieres generar...","label.file_name":"Nombre del archivo","label.file_size":"Tamaño","label.dimensions":"Dimensiones","label.format":"Formato","label.uploaded_by":"Subido por","label.uploaded_at":"Fecha de subida","preset.square":"Cuadrado","preset.landscape":"Paisaje","preset.portrait":"Retrato","preset.thumbnail":"Miniatura","preset.medium":"Medio","preset.large":"Grande","preset.custom":"Personalizado"},en:{"button.select":"Select","button.upload":"Upload image","button.cancel":"Cancel","button.close":"Close","button.save":"Save","button.delete":"Delete","button.download":"Download","button.copy":"Copy URL","button.crop":"Crop","button.apply":"Apply","button.reset":"Reset","button.back":"Back","button.next":"Next","button.previous":"Previous","tab.gallery":"Gallery","tab.upload":"Upload","tab.ia":"AI","tab.stock":"Stock","tab.cropper":"Crop","message.loading":"Loading...","message.uploading":"Uploading image...","message.processing":"Processing...","message.no_images":"No images available","message.upload_success":"Image uploaded successfully","message.upload_error":"Error uploading image","message.delete_confirm":"Are you sure you want to delete this image?","message.copy_success":"URL copied to clipboard","message.copy_error":"Error copying URL","error.file_too_large":"File is too large","error.invalid_format":"Invalid file format","error.upload_failed":"Upload failed","error.network":"Network error","error.unknown":"Unknown error","error.api_key_missing":"API Key not provided","placeholder.search":"Search images...","placeholder.prompt":"Describe the image you want to generate...","label.file_name":"File name","label.file_size":"Size","label.dimensions":"Dimensions","label.format":"Format","label.uploaded_by":"Uploaded by","label.uploaded_at":"Upload date","preset.square":"Square","preset.landscape":"Landscape","preset.portrait":"Portrait","preset.thumbnail":"Thumbnail","preset.medium":"Medium","preset.large":"Large","preset.custom":"Custom"}};class d{constructor(e="es",t={}){this.locale=e,this.messages=this._mergeMessages(t)}_mergeMessages(e){const t={...u};return Object.keys(e).forEach(n=>{t[n]={...t[n]||{},...e[n]}}),t}t(e,t={}){let n=(this.messages[this.locale]||this.messages.es)[e]||e;return Object.keys(t).forEach(e=>{n=n.replace(`{${e}}`,t[e])}),n}setLocale(e){this.messages[e]?this.locale=e:console.warn(`Locale ${e} not available, keeping ${this.locale}`)}getLocale(){return this.locale}getAvailableLocales(){return Object.keys(this.messages)}addMessages(e,t){this.messages[e]={...this.messages[e]||{},...t}}hasKey(e){return e in(this.messages[this.locale]||this.messages.es)}}new d;class m{constructor(){this.globalConfig={},this.defaults={container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0,showPreview:!0},cropper:{quality:.9,format:"webp",aspectRatio:null,lockAspectRatio:!1,showFreeAspectRatio:!0,showDimensionInputs:!1,enableEditMode:!0,showDownloadInCropper:!1,showCropName:!1,mandatoryCrops:[],allowCustomCrops:!0},gallery:{filters:{showNameFilter:!0,showUploadedByFilter:!1,showDateFilter:!0,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{maxSize:"10MB",formats:["jpg","jpeg","png","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null},downloadFormat:"webp",return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar imagen",buttonStyle:"primary",buttonClass:"limbo-auto-button",scanOnLoad:!0,observeChanges:!0},presets:{aspects:[{name:"square",ratio:"1:1",label:"Cuadrado"},{name:"landscape",ratio:"16:9",label:"Paisaje"},{name:"portrait",ratio:"9:16",label:"Retrato"}],sizes:[{name:"thumbnail",width:300,height:300,fit:"cover",label:"Miniatura"},{name:"medium",width:800,height:600,fit:"cover",label:"Medio"},{name:"large",width:1920,height:1080,fit:"cover",label:"Grande"}],required:[],lockUserCrop:!1,allowArbitrary:!0,defaultAspect:"square",defaultSize:"medium"},modal:{size:"medium",title:"Limbo Image Manager",backdrop:!0,closeOnEscape:!0,closeOnBackdrop:!0,showCloseButton:!0},callbacks:{onUpload:null,onSelect:null,onDelete:null,onCropsSaved:null,onCropperComplete:null,onCropperCancelled:null,onCropperError:null},autoDestroy:!1,autoHideOnComplete:!1,debug:!1,apiEndpoint:null,auth:{apiKey:null,publicKey:null,portal:null,authMode:"jwt",tokenStorage:"memory",autoRefresh:!0,refreshBuffer:30},apiKey:null}}setGlobal(e){return this.globalConfig={...this.globalConfig,...e},this}getGlobal(){return{...this.globalConfig}}merge(e={}){return this._deepMerge(this.defaults,this.globalConfig,e)}_deepMerge(...e){const t={};return e.forEach(e=>{e&&"object"==typeof e&&Object.keys(e).forEach(n=>{e[n]&&"object"==typeof e[n]&&!Array.isArray(e[n])?t[n]=this._deepMerge(t[n]||{},e[n]):t[n]=e[n]})}),t}setDefaults(e){return this.defaults=this._deepMerge(this.defaults,e),this}getDefaults(){return JSON.parse(JSON.stringify(this.defaults))}resetDefaults(){return this.defaults=this._getOriginalDefaults(),this}get(e,t=null){const n=t||this.merge();return this._getValueByPath(n,e)}set(e,t){return this._setValueByPath(this.globalConfig,e,t),this}_getValueByPath(e,t){return t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e)}_setValueByPath(e,t,n){const r=t.split("."),a=r.pop();r.reduce((e,t)=>(e[t]&&"object"==typeof e[t]||(e[t]={}),e[t]),e)[a]=n}_getOriginalDefaults(){return{container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0,showPreview:!0},interaction:{allowSelection:!1,allowCropping:!0,requiresCropping:!1,selectionMode:"direct"},cropper:{quality:.9,format:"webp",aspectRatio:null,lockAspectRatio:!1,showFreeAspectRatio:!0,showDimensionInputs:!1,enableEditMode:!0,showDownloadInCropper:!1,showCropName:!1,mandatoryCrops:[],allowCustomCrops:!0},gallery:{filters:{showNameFilter:!0,showUploadedByFilter:!1,showDateFilter:!0,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{maxSize:"10MB",formats:["jpg","jpeg","png","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null},return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar imagen",buttonStyle:"primary",buttonClass:"limbo-auto-button",scanOnLoad:!0,observeChanges:!0},modal:{size:"medium",title:"Limbo Image Manager",backdrop:!0,closeOnEscape:!0,closeOnBackdrop:!0,showCloseButton:!0},i18n:{locale:"es",messages:{},autoDetect:!0},theme:{colors:{},spacing:{},typography:{},borderRadius:{},shadows:{},customProperties:{}},callbacks:{onUpload:null,onSelect:null,onDelete:null,onCropsSaved:null,onCropperComplete:null,onCropperCancelled:null,onCropperError:null},autoDestroy:!1,autoHideOnComplete:!1,debug:!1,apiEndpoint:null,auth:{apiKey:null,publicKey:null,portal:null,authMode:"jwt",tokenStorage:"memory",autoRefresh:!0,refreshBuffer:30},apiKey:null}}_validatePresets(e){const t=[];if(e.aspects&&e.aspects.forEach((e,n)=>{e.name&&e.ratio||t.push(`Aspect preset ${n}: name and ratio are required`),e.ratio&&!/^\d+:\d+$/.test(e.ratio)&&t.push(`Aspect preset ${e.name}: ratio must be in format "w:h"`)}),e.sizes&&e.sizes.forEach((e,n)=>{e.name&&e.width||t.push(`Size preset ${n}: name and width are required`),e.width&&e.width<=0&&t.push(`Size preset ${e.name}: width must be positive`),e.height&&e.height<=0&&t.push(`Size preset ${e.name}: height must be positive`)}),e.required&&Array.isArray(e.required)){const n=[...e.aspects?.map(e=>e.name)||[],...e.sizes?.map(e=>e.name)||[]];e.required.forEach(e=>{n.includes(e)||t.push(`Required preset "${e}" not found in available presets`)})}return t}getPreset(e,t,n="aspect"){const r=e.presets||this.defaults.presets;return"aspect"===n?r.aspects?.find(e=>e.name===t):"size"===n?r.sizes?.find(e=>e.name===t):null}isPresetRequired(e,t){const n=e.presets||this.defaults.presets;return n.required?.includes(t)||!1}getAvailableAspects(e){return(e.presets||this.defaults.presets).aspects||[]}getAvailableSizes(e){return(e.presets||this.defaults.presets).sizes||[]}createI18n(e){const t=e.i18n||this.defaults.i18n;let n=t.locale;if(t.autoDetect&&"auto"===n){const e=(navigator.language||navigator.userLanguage).split("-")[0];n=["es","en"].includes(e)?e:"es"}else t.autoDetect&&!n&&(n="es");return new d(n,t.messages)}validate(e){const t=[],n=this._deepMerge(this.globalConfig.auth||{},e.auth||{}),r=e.apiKey||this.globalConfig.apiKey;if("jwt"!==n.authMode&&r||n.apiKey||t.push("auth.apiKey es requerido para autenticación JWT"),"legacy"!==n.authMode||r||t.push("apiKey es requerido para modo legacy"),n.apiKey||r||t.push("Se requiere configuración de autenticación (auth.apiKey o apiKey legacy)"),e.mode&&!["embed","modal","button"].includes(e.mode)&&t.push("mode debe ser: embed, modal o button"),e.features&&!Array.isArray(e.features)&&t.push("features debe ser un array"),e.presets){const n=this._validatePresets(e.presets);t.push(...n)}return{isValid:0===t.length,errors:t}}setJWTAuth(e,t=null,n={}){const r={apiKey:e,publicKey:t,authMode:"jwt",tokenStorage:n.tokenStorage||"memory",autoRefresh:!1!==n.autoRefresh,refreshBuffer:n.refreshBuffer||30,portal:n.portal||null,...n};return this.set("auth",r),this}getAuthConfig(e=null){const t=e||this.merge();return{authMode:t.auth?.authMode||(t.apiKey?"legacy":"jwt"),apiKey:t.auth?.apiKey||t.apiKey,publicKey:t.auth?.publicKey,portal:t.auth?.portal,tokenStorage:t.auth?.tokenStorage||"memory",autoRefresh:!1!==t.auth?.autoRefresh,refreshBuffer:t.auth?.refreshBuffer||30}}isJWTMode(e=null){return"jwt"===this.getAuthConfig(e).authMode}isLegacyMode(e=null){return"legacy"===this.getAuthConfig(e).authMode}migrateToJWT(e=null){const t=e||this.globalConfig.apiKey;if(!t)throw new Error("No hay apiKey para migrar a JWT");return this.setJWTAuth(t),this}getMandatoryCrops(e=null){const t=e||this.merge();return t.cropper?.mandatoryCrops||[]}hasMandatoryCrops(e=null){return this.getMandatoryCrops(e).length>0}isEditModeEnabled(e=null){const t=e||this.merge();return!1!==t.cropper?.enableEditMode}showDimensionInputs(e=null){const t=e||this.merge();return!0===t.cropper?.showDimensionInputs}showDownloadInCropper(e=null){const t=e||this.merge();return!0===t.cropper?.showDownloadInCropper}showCropName(e=null){const t=e||this.merge();return!0===t.cropper?.showCropName}allowCustomCrops(e=null){const t=e||this.merge();return!1!==t.cropper?.allowCustomCrops}getGalleryFilters(e=null){const t=e||this.merge();return t.gallery?.filters||this.defaults.gallery.filters}isGalleryFilterEnabled(e,t=null){const n=this.getGalleryFilters(t);return n.enabledFilters?.includes(e)||!1}getCustomGalleryFilters(e=null){return this.getGalleryFilters(e).customFilters||[]}getGalleryLoadingConfig(e=null){const t=e||this.merge();return t.gallery?.loading||this.defaults.gallery.loading}showGalleryPlaceholders(e=null){return!1!==this.getGalleryLoadingConfig(e).showPlaceholders}getPlaceholderCount(e=null){return this.getGalleryLoadingConfig(e).placeholderCount||10}showGallerySpinner(e=null){return!1!==this.getGalleryLoadingConfig(e).showSpinner}getGalleryPagination(e=null){const t=e||this.merge();return t.gallery?.pagination||this.defaults.gallery.pagination}getItemsPerPage(e=null){return this.getGalleryPagination(e).itemsPerPage||20}}var h,p,f,g,b={exports:{}},y={},v={exports:{}},w={};function x(){return p||(p=1,v.exports=(h||(h=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,i=e[r];if(!(0<a(i,t)))break e;e[r]=t,e[n]=i,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length,o=i>>>1;r<o;){var l=2*(r+1)-1,s=e[l],c=l+1,u=e[c];if(0>a(s,n))c<i&&0>a(u,s)?(e[r]=u,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<i&&0>a(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var s=[],c=[],u=1,d=null,m=3,h=!1,p=!1,f=!1,g=!1,b="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var a=n(c);null!==a;){if(null===a.callback)r(c);else{if(!(a.startTime<=e))break;r(c),a.sortIndex=a.expirationTime,t(s,a)}a=n(c)}}function x(e){if(f=!1,w(e),!p)if(null!==n(s))p=!0,C||(C=!0,k());else{var t=n(c);null!==t&&A(x,t.startTime-e)}}var k,C=!1,S=-1,N=5,E=-1;function $(){return!(!g&&e.unstable_now()-E<N)}function _(){if(g=!1,C){var t=e.unstable_now();E=t;var a=!0;try{e:{p=!1,f&&(f=!1,y(S),S=-1),h=!0;var i=m;try{t:{for(w(t),d=n(s);null!==d&&!(d.expirationTime>t&&$());){var o=d.callback;if("function"==typeof o){d.callback=null,m=d.priorityLevel;var l=o(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){d.callback=l,w(t),a=!0;break t}d===n(s)&&r(s),w(t)}else r(s);d=n(s)}if(null!==d)a=!0;else{var u=n(c);null!==u&&A(x,u.startTime-t),a=!1}}break e}finally{d=null,m=i,h=!1}a=void 0}}finally{a?k():C=!1}}}if("function"==typeof v)k=function(){v(_)};else if("undefined"!=typeof MessageChannel){var z=new MessageChannel,T=z.port2;z.port1.onmessage=_,k=function(){T.postMessage(null)}}else k=function(){b(_,0)};function A(t,n){S=b(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},e.unstable_scheduleCallback=function(r,a,i){var o=e.unstable_now();switch(i="object"==typeof i&&null!==i&&"number"==typeof(i=i.delay)&&0<i?o+i:o,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:u++,callback:a,priorityLevel:r,startTime:i,expirationTime:l=i+l,sortIndex:-1},i>o?(r.sortIndex=i,t(c,r),null===n(s)&&r===n(c)&&(f?(y(S),S=-1):f=!0,A(x,i-o))):(r.sortIndex=l,t(s,r),p||h||(p=!0,C||(C=!0,k()))),r},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}}(w)),w)),v.exports}function k(){if(f)return y;f=1;var t=x(),n=e,r=o;function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function s(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function c(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function u(e){if(l(e)!==e)throw Error(a(188))}function d(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=d(e)))return t;e=e.sibling}return null}var m=Object.assign,h=/* @__PURE__ */Symbol.for("react.element"),p=/* @__PURE__ */Symbol.for("react.transitional.element"),g=/* @__PURE__ */Symbol.for("react.portal"),b=/* @__PURE__ */Symbol.for("react.fragment"),v=/* @__PURE__ */Symbol.for("react.strict_mode"),w=/* @__PURE__ */Symbol.for("react.profiler"),k=/* @__PURE__ */Symbol.for("react.consumer"),C=/* @__PURE__ */Symbol.for("react.context"),S=/* @__PURE__ */Symbol.for("react.forward_ref"),N=/* @__PURE__ */Symbol.for("react.suspense"),E=/* @__PURE__ */Symbol.for("react.suspense_list"),$=/* @__PURE__ */Symbol.for("react.memo"),_=/* @__PURE__ */Symbol.for("react.lazy"),z=/* @__PURE__ */Symbol.for("react.activity"),T=/* @__PURE__ */Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function M(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=A&&e[A]||e["@@iterator"])?e:null}var P=/* @__PURE__ */Symbol.for("react.client.reference");function I(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===P?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case b:return"Fragment";case w:return"Profiler";case v:return"StrictMode";case N:return"Suspense";case E:return"SuspenseList";case z:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case g:return"Portal";case C:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case S:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case $:return null!==(t=e.displayName||null)?t:I(e.type)||"Memo";case _:t=e._payload,e=e._init;try{return I(e(t))}catch(n){}}return null}var L=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},j=[],F=-1;function U(e){return{current:e}}function q(e){0>F||(e.current=j[F],j[F]=null,F--)}function B(e,t){F++,j[F]=e.current,e.current=t}var W,V,H=U(null),K=U(null),G=U(null),Q=U(null);function Y(e,t){switch(B(G,t),B(K,e),B(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=wd(t=vd(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}q(H),B(H,e)}function X(){q(H),q(K),q(G)}function J(e){null!==e.memoizedState&&B(Q,e);var t=H.current,n=wd(t,e.type);t!==n&&(B(K,e),B(H,n))}function Z(e){K.current===e&&(q(H),q(K)),Q.current===e&&(q(Q),mm._currentValue=R)}function ee(e){if(void 0===W)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);W=t&&t[1]||"",V=-1<n.stack.indexOf("\n at")?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+W+e+V}var te=!1;function ne(e,t){if(!e||te)return"";te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(a){var r=a}Reflect.construct(e,[],n)}else{try{n.call()}catch(i){r=i}e.call(n.prototype)}}else{try{throw Error()}catch(o){r=o}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(l){if(l&&r&&"string"==typeof l.stack)return[l.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],l=i[1];if(o&&l){var s=o.split("\n"),c=l.split("\n");for(a=r=0;r<s.length&&!s[r].includes("DetermineComponentFrameRoot");)r++;for(;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;if(r===s.length||a===c.length)for(r=s.length-1,a=c.length-1;1<=r&&0<=a&&s[r]!==c[a];)a--;for(;1<=r&&0<=a;r--,a--)if(s[r]!==c[a]){if(1!==r||1!==a)do{if(r--,0>--a||s[r]!==c[a]){var u="\n"+s[r].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}}while(1<=r&&0<=a);break}}}finally{te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ee(n):""}function re(e,t){switch(e.tag){case 26:case 27:case 5:return ee(e.type);case 16:return ee("Lazy");case 13:return e.child!==t&&null!==t?ee("Suspense Fallback"):ee("Suspense");case 19:return ee("SuspenseList");case 0:case 15:return ne(e.type,!1);case 11:return ne(e.type.render,!1);case 1:return ne(e.type,!0);case 31:return ee("Activity");default:return""}}function ae(e){try{var t="",n=null;do{t+=re(e,n),n=e,e=e.return}while(e);return t}catch(r){return"\nError generating stack: "+r.message+"\n"+r.stack}}var ie=Object.prototype.hasOwnProperty,oe=t.unstable_scheduleCallback,le=t.unstable_cancelCallback,se=t.unstable_shouldYield,ce=t.unstable_requestPaint,ue=t.unstable_now,de=t.unstable_getCurrentPriorityLevel,me=t.unstable_ImmediatePriority,he=t.unstable_UserBlockingPriority,pe=t.unstable_NormalPriority,fe=t.unstable_LowPriority,ge=t.unstable_IdlePriority,be=t.log,ye=t.unstable_setDisableYieldValue,ve=null,we=null;function xe(e){if("function"==typeof be&&ye(e),we&&"function"==typeof we.setStrictMode)try{we.setStrictMode(ve,e)}catch(t){}}var ke=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(Ce(e)/Se|0)|0},Ce=Math.log,Se=Math.LN2;var Ne=256,Ee=262144,$e=4194304;function _e(e){var t=42&e;if(0!==t)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!==(r=l&~i)?a=_e(r):0!==(o&=l)?a=_e(o):n||0!==(n=l&~e)&&(a=_e(n)):0!==(l=r&~i)?a=_e(l):0!==o?a=_e(o):n||0!==(n=r&~e)&&(a=_e(n)),0===a?0:0!==t&&t!==a&&0===(t&i)&&((i=a&-a)>=(n=t&-t)||32===i&&4194048&n)?t:a}function Te(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Ae(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;default:return-1}}function Me(){var e=$e;return!(62914560&($e<<=1))&&($e=4194304),e}function Pe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ie(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Le(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ke(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|261930&n}function De(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ke(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function Oe(e,t){var n=t&-t;return 0!==((n=42&n?1:Re(n))&(e.suspendedLanes|t))?0:n}function Re(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function je(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function Fe(){var e=O.p;return 0!==e?e:void 0===(e=window.event)?32:_m(e.type)}function Ue(e,t){var n=O.p;try{return O.p=e,t()}finally{O.p=n}}var qe=Math.random().toString(36).slice(2),Be="__reactFiber$"+qe,We="__reactProps$"+qe,Ve="__reactContainer$"+qe,He="__reactEvents$"+qe,Ke="__reactListeners$"+qe,Ge="__reactHandles$"+qe,Qe="__reactResources$"+qe,Ye="__reactMarker$"+qe;function Xe(e){delete e[Be],delete e[We],delete e[He],delete e[Ke],delete e[Ge]}function Je(e){var t=e[Be];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ve]||n[Be]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Rd(e);null!==e;){if(n=e[Be])return n;e=Rd(e)}return t}n=(e=n).parentNode}return null}function Ze(e){if(e=e[Be]||e[Ve]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function et(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(a(33))}function tt(e){var t=e[Qe];return t||(t=e[Qe]={hoistableStyles:/* @__PURE__ */new Map,hoistableScripts:/* @__PURE__ */new Map}),t}function nt(e){e[Ye]=!0}var rt=/* @__PURE__ */new Set,at={};function it(e,t){ot(e,t),ot(e+"Capture",t)}function ot(e,t){for(at[e]=t,e=0;e<t.length;e++)rt.add(t[e])}var lt=RegExp("^[: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]*$"),st={},ct={};function ut(e,t,n){if(a=t,ie.call(ct,a)||!ie.call(st,a)&&(lt.test(a)?ct[a]=!0:(st[a]=!0,0)))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}var a}function dt(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function mt(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function ht(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function pt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ft(e){if(!e._valueTracker){var t=pt(e)?"checked":"value";e._valueTracker=function(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==r&&"function"==typeof r.get&&"function"==typeof r.set){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){n=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function gt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=pt(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function bt(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var yt=/[\n"\\]/g;function vt(e){return e.replace(yt,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function wt(e,t,n,r,a,i,o,l){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ht(t)):e.value!==""+ht(t)&&(e.value=""+ht(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?kt(e,o,ht(t)):null!=n?kt(e,o,ht(n)):null!=r&&e.removeAttribute("value"),null==a&&null!=i&&(e.defaultChecked=!!i),null!=a&&(e.checked=a&&"function"!=typeof a&&"symbol"!=typeof a),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ht(l):e.removeAttribute("name")}function xt(e,t,n,r,a,i,o,l){if(null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.type=i),null!=t||null!=n){if(("submit"===i||"reset"===i)&&null==t)return void ft(e);n=null!=n?""+ht(n):"",t=null!=t?""+ht(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:a)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o),ft(e)}function kt(e,t,n){"number"===t&&bt(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ct(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ht(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function St(e,t,n){null==t||((t=""+ht(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+ht(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function Nt(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(a(92));if(L(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=ht(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r),ft(e)}function Et(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var $t=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _t(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||$t.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function zt(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(a(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&_t(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&_t(e,o,t[o])}function Tt(e){if(-1===e.indexOf("-"))return!1;switch(e){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 At=/* @__PURE__ */new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Pt(e){return Mt.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function It(){}var Lt=null;function Dt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ot=null,Rt=null;function jt(e){var t=Ze(e);if(t&&(e=t.stateNode)){var n=e[We]||null;e:switch(e=t.stateNode,t.type){case"input":if(wt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+vt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[We]||null;if(!i)throw Error(a(90));wt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&gt(r)}break e;case"textarea":St(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&Ct(e,!!n.multiple,t,!1)}}}var Ft=!1;function Ut(e,t,n){if(Ft)return e(t,n);Ft=!0;try{return e(t)}finally{if(Ft=!1,(null!==Ot||null!==Rt)&&(tu(),Ot&&(t=Ot,e=Rt,Rt=Ot=null,jt(t),e)))for(t=0;t<e.length;t++)jt(e[t])}}function qt(e,t){var n=e.stateNode;if(null===n)return null;var r=n[We]||null;if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(a(231,t,typeof n));return n}var Bt=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Wt=!1;if(Bt)try{var Vt={};Object.defineProperty(Vt,"passive",{get:function(){Wt=!0}}),window.addEventListener("test",Vt,Vt),window.removeEventListener("test",Vt,Vt)}catch(Zm){Wt=!1}var Ht=null,Kt=null,Gt=null;function Qt(){if(Gt)return Gt;var e,t,n=Kt,r=n.length,a="value"in Ht?Ht.value:Ht.textContent,i=a.length;for(e=0;e<r&&n[e]===a[e];e++);var o=r-e;for(t=1;t<=o&&n[r-t]===a[i-t];t++);return Gt=a.slice(e,1<t?1-t:void 0)}function Yt(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Xt(){return!0}function Jt(){return!1}function Zt(e){function t(t,n,r,a,i){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=i,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(a):a[o]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?Xt:Jt,this.isPropagationStopped=Jt,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Xt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Xt)},persist:function(){},isPersistent:Xt}),t}var en,tn,nn,rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},an=Zt(rn),on=m({},rn,{view:0,detail:0}),ln=Zt(on),sn=m({},on,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nn&&(nn&&"mousemove"===e.type?(en=e.screenX-nn.screenX,tn=e.screenY-nn.screenY):tn=en=0,nn=e),en)},movementY:function(e){return"movementY"in e?e.movementY:tn}}),cn=Zt(sn),un=Zt(m({},sn,{dataTransfer:0})),dn=Zt(m({},on,{relatedTarget:0})),mn=Zt(m({},rn,{animationName:0,elapsedTime:0,pseudoElement:0})),hn=Zt(m({},rn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),pn=Zt(m({},rn,{data:0})),fn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},bn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=bn[e])&&!!t[e]}function vn(){return yn}var wn=Zt(m({},on,{key:function(e){if(e.key){var t=fn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Yt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?gn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vn,charCode:function(e){return"keypress"===e.type?Yt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Yt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),xn=Zt(m({},sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=Zt(m({},on,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vn})),Cn=Zt(m({},rn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Sn=Zt(m({},sn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Nn=Zt(m({},rn,{newState:0,oldState:0})),En=[9,13,27,32],$n=Bt&&"CompositionEvent"in window,_n=null;Bt&&"documentMode"in document&&(_n=document.documentMode);var zn=Bt&&"TextEvent"in window&&!_n,Tn=Bt&&(!$n||_n&&8<_n&&11>=_n),An=String.fromCharCode(32),Mn=!1;function Pn(e,t){switch(e){case"keyup":return-1!==En.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function In(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ln=!1;var Dn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function On(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Dn[e.type]:"textarea"===t}function Rn(e,t,n,r){Ot?Rt?Rt.push(r):Rt=[r]:Ot=r,0<(t=id(t,"onChange")).length&&(n=new an("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var jn=null,Fn=null;function Un(e){Xu(e,0)}function qn(e){if(gt(et(e)))return e}function Bn(e,t){if("change"===e)return t}var Wn=!1;if(Bt){var Vn;if(Bt){var Hn="oninput"in document;if(!Hn){var Kn=document.createElement("div");Kn.setAttribute("oninput","return;"),Hn="function"==typeof Kn.oninput}Vn=Hn}else Vn=!1;Wn=Vn&&(!document.documentMode||9<document.documentMode)}function Gn(){jn&&(jn.detachEvent("onpropertychange",Qn),Fn=jn=null)}function Qn(e){if("value"===e.propertyName&&qn(Fn)){var t=[];Rn(t,Fn,e,Dt(e)),Ut(Un,t)}}function Yn(e,t,n){"focusin"===e?(Gn(),Fn=n,(jn=t).attachEvent("onpropertychange",Qn)):"focusout"===e&&Gn()}function Xn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return qn(Fn)}function Jn(e,t){if("click"===e)return qn(t)}function Zn(e,t){if("input"===e||"change"===e)return qn(t)}var er="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function tr(e,t){if(er(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!ie.call(t,a)||!er(e[a],t[a]))return!1}return!0}function nr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function rr(e,t){var n,r=nr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=nr(r)}}function ar(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ar(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ir(e){for(var t=bt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=bt((e=t.contentWindow).document)}return t}function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var lr=Bt&&"documentMode"in document&&11>=document.documentMode,sr=null,cr=null,ur=null,dr=!1;function mr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;dr||null==sr||sr!==bt(r)||("selectionStart"in(r=sr)&&or(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ur&&tr(ur,r)||(ur=r,0<(r=id(cr,"onSelect")).length&&(t=new an("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=sr)))}function hr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pr={animationend:hr("Animation","AnimationEnd"),animationiteration:hr("Animation","AnimationIteration"),animationstart:hr("Animation","AnimationStart"),transitionrun:hr("Transition","TransitionRun"),transitionstart:hr("Transition","TransitionStart"),transitioncancel:hr("Transition","TransitionCancel"),transitionend:hr("Transition","TransitionEnd")},fr={},gr={};function br(e){if(fr[e])return fr[e];if(!pr[e])return e;var t,n=pr[e];for(t in n)if(n.hasOwnProperty(t)&&t in gr)return fr[e]=n[t];return e}Bt&&(gr=document.createElement("div").style,"AnimationEvent"in window||(delete pr.animationend.animation,delete pr.animationiteration.animation,delete pr.animationstart.animation),"TransitionEvent"in window||delete pr.transitionend.transition);var yr=br("animationend"),vr=br("animationiteration"),wr=br("animationstart"),xr=br("transitionrun"),kr=br("transitionstart"),Cr=br("transitioncancel"),Sr=br("transitionend"),Nr=/* @__PURE__ */new Map,Er="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function $r(e,t){Nr.set(e,t),it(t,[e])}Er.push("scrollEnd");var _r="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},zr=[],Tr=0,Ar=0;function Mr(){for(var e=Tr,t=Ar=Tr=0;t<e;){var n=zr[t];zr[t++]=null;var r=zr[t];zr[t++]=null;var a=zr[t];zr[t++]=null;var i=zr[t];if(zr[t++]=null,null!==r&&null!==a){var o=r.pending;null===o?a.next=a:(a.next=o.next,o.next=a),r.pending=a}0!==i&&Dr(n,a,i)}}function Pr(e,t,n,r){zr[Tr++]=e,zr[Tr++]=t,zr[Tr++]=n,zr[Tr++]=r,Ar|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Ir(e,t,n,r){return Pr(e,t,n,r),Or(e)}function Lr(e,t){return Pr(e,null,null,t),Or(e)}function Dr(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var a=!1,i=e.return;null!==i;)i.childLanes|=n,null!==(r=i.alternate)&&(r.childLanes|=n),22===i.tag&&(null===(e=i.stateNode)||1&e._visibility||(a=!0)),e=i,i=i.return;return 3===e.tag?(i=e.stateNode,a&&null!==t&&(a=31-ke(n),null===(r=(e=i.hiddenUpdates)[a])?e[a]=[t]:r.push(t),t.lane=536870912|n),i):null}function Or(e){if(50<Hc)throw Hc=0,Kc=null,Error(a(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Rr={};function jr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,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 Fr(e,t,n,r){return new jr(e,t,n,r)}function Ur(e){return!(!(e=e.prototype)||!e.isReactComponent)}function qr(e,t){var n=e.alternate;return null===n?((n=Fr(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=65011712&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Br(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Wr(e,t,n,r,i,o){var l=0;if(r=e,"function"==typeof e)Ur(e)&&(l=1);else if("string"==typeof e)l=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,H.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case z:return(e=Fr(31,n,t,i)).elementType=z,e.lanes=o,e;case b:return Vr(n.children,i,o,t);case v:l=8,i|=24;break;case w:return(e=Fr(12,n,t,2|i)).elementType=w,e.lanes=o,e;case N:return(e=Fr(13,n,t,i)).elementType=N,e.lanes=o,e;case E:return(e=Fr(19,n,t,i)).elementType=E,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case C:l=10;break e;case k:l=9;break e;case S:l=11;break e;case $:l=14;break e;case _:l=16,r=null;break e}l=29,n=Error(a(130,null===e?"null":typeof e,"")),r=null}return(t=Fr(l,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Vr(e,t,n,r){return(e=Fr(7,e,r,t)).lanes=n,e}function Hr(e,t,n){return(e=Fr(6,e,null,t)).lanes=n,e}function Kr(e){var t=Fr(18,null,null,0);return t.stateNode=e,t}function Gr(e,t,n){return(t=Fr(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Qr=/* @__PURE__ */new WeakMap;function Yr(e,t){if("object"==typeof e&&null!==e){var n=Qr.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ae(t)},Qr.set(e,t),t)}return{value:e,source:t,stack:ae(t)}}var Xr=[],Jr=0,Zr=null,ea=0,ta=[],na=0,ra=null,aa=1,ia="";function oa(e,t){Xr[Jr++]=ea,Xr[Jr++]=Zr,Zr=e,ea=t}function la(e,t,n){ta[na++]=aa,ta[na++]=ia,ta[na++]=ra,ra=e;var r=aa;e=ia;var a=32-ke(r)-1;r&=~(1<<a),n+=1;var i=32-ke(t)+a;if(30<i){var o=a-a%5;i=(r&(1<<o)-1).toString(32),r>>=o,a-=o,aa=1<<32-ke(t)+a|n<<a|r,ia=i+e}else aa=1<<i|n<<a|r,ia=e}function sa(e){null!==e.return&&(oa(e,1),la(e,1,0))}function ca(e){for(;e===Zr;)Zr=Xr[--Jr],Xr[Jr]=null,ea=Xr[--Jr],Xr[Jr]=null;for(;e===ra;)ra=ta[--na],ta[na]=null,ia=ta[--na],ta[na]=null,aa=ta[--na],ta[na]=null}function ua(e,t){ta[na++]=aa,ta[na++]=ia,ta[na++]=ra,aa=t.id,ia=t.overflow,ra=e}var da=null,ma=null,ha=!1,pa=null,fa=!1,ga=Error(a(519));function ba(e){throw Ca(Yr(Error(a(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),ga}function ya(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Be]=e,t[We]=r,n){case"dialog":Ju("cancel",t),Ju("close",t);break;case"iframe":case"object":case"embed":Ju("load",t);break;case"video":case"audio":for(n=0;n<Qu.length;n++)Ju(Qu[n],t);break;case"source":Ju("error",t);break;case"img":case"image":case"link":Ju("error",t),Ju("load",t);break;case"details":Ju("toggle",t);break;case"input":Ju("invalid",t),xt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ju("invalid",t);break;case"textarea":Ju("invalid",t),Nt(t,r.value,r.defaultValue,r.children)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||dd(t.textContent,n)?(null!=r.popover&&(Ju("beforetoggle",t),Ju("toggle",t)),null!=r.onScroll&&Ju("scroll",t),null!=r.onScrollEnd&&Ju("scrollend",t),null!=r.onClick&&(t.onclick=It),t=!0):t=!1,t||ba(e,!0)}function va(e){for(da=e.return;da;)switch(da.tag){case 5:case 31:case 13:return void(fa=!1);case 27:case 3:return void(fa=!0);default:da=da.return}}function wa(e){if(e!==da)return!1;if(!ha)return va(e),ha=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||xd(e.type,e.memoizedProps)),t=!t),t&&ma&&ba(e),va(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));ma=Od(e)}else if(31===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));ma=Od(e)}else 27===n?(n=ma,_d(e.type)?(e=Dd,Dd=null,ma=e):ma=n):ma=da?Ld(e.stateNode.nextSibling):null;return!0}function xa(){ma=da=null,ha=!1}function ka(){var e=pa;return null!==e&&(null===Mc?Mc=e:Mc.push.apply(Mc,e),pa=null),e}function Ca(e){null===pa?pa=[e]:pa.push(e)}var Sa=U(null),Na=null,Ea=null;function $a(e,t,n){B(Sa,t._currentValue),t._currentValue=n}function _a(e){e._currentValue=Sa.current,q(Sa)}function za(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ta(e,t,n,r){var i=e.child;for(null!==i&&(i.return=e);null!==i;){var o=i.dependencies;if(null!==o){var l=i.child;o=o.firstContext;e:for(;null!==o;){var s=o;o=i;for(var c=0;c<t.length;c++)if(s.context===t[c]){o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),za(o.return,n,e),r||(l=null);break e}o=s.next}}else if(18===i.tag){if(null===(l=i.return))throw Error(a(341));l.lanes|=n,null!==(o=l.alternate)&&(o.lanes|=n),za(l,n,e),l=null}else l=i.child;if(null!==l)l.return=i;else for(l=i;null!==l;){if(l===e){l=null;break}if(null!==(i=l.sibling)){i.return=l.return,l=i;break}l=l.return}i=l}}function Aa(e,t,n,r){e=null;for(var i=t,o=!1;null!==i;){if(!o)if(524288&i.flags)o=!0;else if(262144&i.flags)break;if(10===i.tag){var l=i.alternate;if(null===l)throw Error(a(387));if(null!==(l=l.memoizedProps)){var s=i.type;er(i.pendingProps.value,l.value)||(null!==e?e.push(s):e=[s])}}else if(i===Q.current){if(null===(l=i.alternate))throw Error(a(387));l.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(null!==e?e.push(mm):e=[mm])}i=i.return}null!==e&&Ta(t,e,n,r),t.flags|=262144}function Ma(e){for(e=e.firstContext;null!==e;){if(!er(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Pa(e){Na=e,Ea=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Ia(e){return Da(Na,e)}function La(e,t){return null===Na&&Pa(e),Da(e,t)}function Da(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===Ea){if(null===e)throw Error(a(308));Ea=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ea=Ea.next=t;return n}var Oa="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Ra=t.unstable_scheduleCallback,ja=t.unstable_NormalPriority,Fa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ua(){return{controller:new Oa,data:/* @__PURE__ */new Map,refCount:0}}function qa(e){e.refCount--,0===e.refCount&&Ra(ja,function(){e.controller.abort()})}var Ba=null,Wa=0,Va=0,Ha=null;function Ka(){if(0===--Wa&&null!==Ba){null!==Ha&&(Ha.status="fulfilled");var e=Ba;Ba=null,Va=0,Ha=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Ga=D.S;D.S=function(e,t){Lc=ue(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===Ba){var n=Ba=[];Wa=0,Va=Wu(),Ha={status:"pending",value:void 0,then:function(e){n.push(e)}}}Wa++,t.then(Ka,Ka)}(0,t),null!==Ga&&Ga(e,t)};var Qa=U(null);function Ya(){var e=Qa.current;return null!==e?e:gc.pooledCache}function Xa(e,t){B(Qa,null===t?Qa.current:t.pool)}function Ja(){var e=Ya();return null===e?null:{parent:Fa._currentValue,pool:e}}var Za=Error(a(460)),ei=Error(a(474)),ti=Error(a(542)),ni={then:function(){}};function ri(e){return"fulfilled"===(e=e.status)||"rejected"===e}function ai(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(It,It),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw si(e=t.reason),e;default:if("string"==typeof t.status)t.then(It,It);else{if(null!==(e=gc)&&100<e.shellSuspendCounter)throw Error(a(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw si(e=t.reason),e}throw oi=t,Za}}function ii(e){try{return(0,e._init)(e._payload)}catch(t){if(null!==t&&"object"==typeof t&&"function"==typeof t.then)throw oi=t,Za;throw t}}var oi=null;function li(){if(null===oi)throw Error(a(459));var e=oi;return oi=null,e}function si(e){if(e===Za||e===ti)throw Error(a(483))}var ci=null,ui=0;function di(e){var t=ui;return ui+=1,null===ci&&(ci=[]),ai(ci,e,t)}function mi(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function hi(e,t){if(t.$$typeof===h)throw Error(a(525));throw e=Object.prototype.toString.call(t),Error(a(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function pi(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=/* @__PURE__ */new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(e,t){return(e=qr(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function l(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Hr(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function c(e,t,n,r){var a=n.type;return a===b?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===_&&ii(a)===t.type)?(mi(t=i(t,n.props),n),t.return=e,t):(mi(t=Wr(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Gr(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function d(e,t,n,r,a){return null===t||7!==t.tag?((t=Vr(n,e.mode,r,a)).return=e,t):((t=i(t,n)).return=e,t)}function m(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Hr(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case p:return mi(n=Wr(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case g:return(t=Gr(t,e.mode,n)).return=e,t;case _:return m(e,t=ii(t),n)}if(L(t)||M(t))return(t=Vr(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return m(e,di(t),n);if(t.$$typeof===C)return m(e,La(e,t),n);hi(e,t)}return null}function h(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case p:return n.key===a?c(e,t,n,r):null;case g:return n.key===a?u(e,t,n,r):null;case _:return h(e,t,n=ii(n),r)}if(L(n)||M(n))return null!==a?null:d(e,t,n,r,null);if("function"==typeof n.then)return h(e,t,di(n),r);if(n.$$typeof===C)return h(e,t,La(e,n),r);hi(e,n)}return null}function f(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case p:return c(t,e=e.get(null===r.key?n:r.key)||null,r,a);case g:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a);case _:return f(e,t,n,r=ii(r),a)}if(L(r)||M(r))return d(t,e=e.get(n)||null,r,a,null);if("function"==typeof r.then)return f(e,t,n,di(r),a);if(r.$$typeof===C)return f(e,t,n,La(t,r),a);hi(t,r)}return null}function y(s,c,u,d){if("object"==typeof u&&null!==u&&u.type===b&&null===u.key&&(u=u.props.children),"object"==typeof u&&null!==u){switch(u.$$typeof){case p:e:{for(var v=u.key;null!==c;){if(c.key===v){if((v=u.type)===b){if(7===c.tag){n(s,c.sibling),(d=i(c,u.props.children)).return=s,s=d;break e}}else if(c.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===_&&ii(v)===c.type){n(s,c.sibling),mi(d=i(c,u.props),u),d.return=s,s=d;break e}n(s,c);break}t(s,c),c=c.sibling}u.type===b?((d=Vr(u.props.children,s.mode,d,u.key)).return=s,s=d):(mi(d=Wr(u.type,u.key,u.props,null,s.mode,d),u),d.return=s,s=d)}return l(s);case g:e:{for(v=u.key;null!==c;){if(c.key===v){if(4===c.tag&&c.stateNode.containerInfo===u.containerInfo&&c.stateNode.implementation===u.implementation){n(s,c.sibling),(d=i(c,u.children||[])).return=s,s=d;break e}n(s,c);break}t(s,c),c=c.sibling}(d=Gr(u,s.mode,d)).return=s,s=d}return l(s);case _:return y(s,c,u=ii(u),d)}if(L(u))return function(a,i,l,s){for(var c=null,u=null,d=i,p=i=0,g=null;null!==d&&p<l.length;p++){d.index>p?(g=d,d=null):g=d.sibling;var b=h(a,d,l[p],s);if(null===b){null===d&&(d=g);break}e&&d&&null===b.alternate&&t(a,d),i=o(b,i,p),null===u?c=b:u.sibling=b,u=b,d=g}if(p===l.length)return n(a,d),ha&&oa(a,p),c;if(null===d){for(;p<l.length;p++)null!==(d=m(a,l[p],s))&&(i=o(d,i,p),null===u?c=d:u.sibling=d,u=d);return ha&&oa(a,p),c}for(d=r(d);p<l.length;p++)null!==(g=f(d,a,p,l[p],s))&&(e&&null!==g.alternate&&d.delete(null===g.key?p:g.key),i=o(g,i,p),null===u?c=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(a,e)}),ha&&oa(a,p),c}(s,c,u,d);if(M(u)){if("function"!=typeof(v=M(u)))throw Error(a(150));return function(i,l,s,c){if(null==s)throw Error(a(151));for(var u=null,d=null,p=l,g=l=0,b=null,y=s.next();null!==p&&!y.done;g++,y=s.next()){p.index>g?(b=p,p=null):b=p.sibling;var v=h(i,p,y.value,c);if(null===v){null===p&&(p=b);break}e&&p&&null===v.alternate&&t(i,p),l=o(v,l,g),null===d?u=v:d.sibling=v,d=v,p=b}if(y.done)return n(i,p),ha&&oa(i,g),u;if(null===p){for(;!y.done;g++,y=s.next())null!==(y=m(i,y.value,c))&&(l=o(y,l,g),null===d?u=y:d.sibling=y,d=y);return ha&&oa(i,g),u}for(p=r(p);!y.done;g++,y=s.next())null!==(y=f(p,i,g,y.value,c))&&(e&&null!==y.alternate&&p.delete(null===y.key?g:y.key),l=o(y,l,g),null===d?u=y:d.sibling=y,d=y);return e&&p.forEach(function(e){return t(i,e)}),ha&&oa(i,g),u}(s,c,u=v.call(u),d)}if("function"==typeof u.then)return y(s,c,di(u),d);if(u.$$typeof===C)return y(s,c,La(s,u),d);hi(s,u)}return"string"==typeof u&&""!==u||"number"==typeof u||"bigint"==typeof u?(u=""+u,null!==c&&6===c.tag?(n(s,c.sibling),(d=i(c,u)).return=s,s=d):(n(s,c),(d=Hr(u,s.mode,d)).return=s,s=d),l(s)):n(s,c)}return function(e,t,n,r){try{ui=0;var a=y(e,t,n,r);return ci=null,a}catch(o){if(o===Za||o===ti)throw o;var i=Fr(29,o,null,e.mode);return i.lanes=r,i.return=e,i}}}var fi=pi(!0),gi=pi(!1),bi=!1;function yi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function wi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xi(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&fc){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=Or(e),Dr(e,null,n),t}return Pr(e,r,t,n),Or(e)}function ki(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,De(e,n)}}function Ci(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,i=null;if(null!==(n=n.firstBaseUpdate)){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===i?a=i=o:i=i.next=o,n=n.next}while(null!==n);null===i?a=i=t:i=i.next=t}else a=i=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Si=!1;function Ni(){if(Si){if(null!==Ha)throw Ha}}function Ei(e,t,n,r){Si=!1;var a=e.updateQueue;bi=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(null!==l){a.shared.pending=null;var s=l,c=s.next;s.next=null,null===o?i=c:o.next=c,o=s;var u=e.alternate;null!==u&&((l=(u=u.updateQueue).lastBaseUpdate)!==o&&(null===l?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=s))}if(null!==i){var d=a.baseState;for(o=0,u=c=s=null,l=i;;){var h=-536870913&l.lane,p=h!==l.lane;if(p?(yc&h)===h:(r&h)===h){0!==h&&h===Va&&(Si=!0),null!==u&&(u=u.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var f=e,g=l;h=t;var b=n;switch(g.tag){case 1:if("function"==typeof(f=g.payload)){d=f.call(b,d,h);break e}d=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(h="function"==typeof(f=g.payload)?f.call(b,d,h):f))break e;d=m({},d,h);break e;case 2:bi=!0}}null!==(h=l.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=a.callbacks)?a.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===u?(c=u=p,s=d):u=u.next=p,o|=h;if(null===(l=l.next)){if(null===(l=a.shared.pending))break;l=(p=l).next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}null===u&&(s=d),a.baseState=s,a.firstBaseUpdate=c,a.lastBaseUpdate=u,null===i&&(a.shared.lanes=0),Ec|=o,e.lanes=o,e.memoizedState=d}}function $i(e,t){if("function"!=typeof e)throw Error(a(191,e));e.call(t)}function _i(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)$i(n[e],t)}var zi=U(null),Ti=U(0);function Ai(e,t){B(Ti,e=Sc),B(zi,t),Sc=e|t.baseLanes}function Mi(){B(Ti,Sc),B(zi,zi.current)}function Pi(){Sc=Ti.current,q(zi),q(Ti)}var Ii=U(null),Li=null;function Di(e){var t=e.alternate;B(Ui,1&Ui.current),B(Ii,e),null===Li&&(null===t||null!==zi.current||null!==t.memoizedState)&&(Li=e)}function Oi(e){B(Ui,Ui.current),B(Ii,e),null===Li&&(Li=e)}function Ri(e){22===e.tag?(B(Ui,Ui.current),B(Ii,e),null===Li&&(Li=e)):ji()}function ji(){B(Ui,Ui.current),B(Ii,Ii.current)}function Fi(e){q(Ii),Li===e&&(Li=null),q(Ui)}var Ui=U(0);function qi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Pd(n)||Id(n)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(128&t.flags)return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Bi=0,Wi=null,Vi=null,Hi=null,Ki=!1,Gi=!1,Qi=!1,Yi=0,Xi=0,Ji=null,Zi=0;function eo(){throw Error(a(321))}function to(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!er(e[n],t[n]))return!1;return!0}function no(e,t,n,r,a,i){return Bi=i,Wi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=null===e||null===e.memoizedState?yl:vl,Qi=!1,i=n(r,a),Qi=!1,Gi&&(i=ao(t,n,r,a)),ro(e),i}function ro(e){D.H=bl;var t=null!==Vi&&null!==Vi.next;if(Bi=0,Hi=Vi=Wi=null,Ki=!1,Xi=0,Ji=null,t)throw Error(a(300));null===e||Ll||null!==(e=e.dependencies)&&Ma(e)&&(Ll=!0)}function ao(e,t,n,r){Wi=e;var i=0;do{if(Gi&&(Ji=null),Xi=0,Gi=!1,25<=i)throw Error(a(301));if(i+=1,Hi=Vi=null,null!=e.updateQueue){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,null!=o.memoCache&&(o.memoCache.index=0)}D.H=wl,o=t(n,r)}while(Gi);return o}function io(){var e=D.H,t=e.useState()[0];return t="function"==typeof t.then?mo(t):t,e=e.useState()[0],(null!==Vi?Vi.memoizedState:null)!==e&&(Wi.flags|=1024),t}function oo(){var e=0!==Yi;return Yi=0,e}function lo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function so(e){if(Ki){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Ki=!1}Bi=0,Hi=Vi=Wi=null,Gi=!1,Xi=Yi=0,Ji=null}function co(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Hi?Wi.memoizedState=Hi=e:Hi=Hi.next=e,Hi}function uo(){if(null===Vi){var e=Wi.alternate;e=null!==e?e.memoizedState:null}else e=Vi.next;var t=null===Hi?Wi.memoizedState:Hi.next;if(null!==t)Hi=t,Vi=e;else{if(null===e){if(null===Wi.alternate)throw Error(a(467));throw Error(a(310))}e={memoizedState:(Vi=e).memoizedState,baseState:Vi.baseState,baseQueue:Vi.baseQueue,queue:Vi.queue,next:null},null===Hi?Wi.memoizedState=Hi=e:Hi=Hi.next=e}return Hi}function mo(e){var t=Xi;return Xi+=1,null===Ji&&(Ji=[]),e=ai(Ji,e,t),t=Wi,null===(null===Hi?t.memoizedState:Hi.next)&&(t=t.alternate,D.H=null===t||null===t.memoizedState?yl:vl),e}function ho(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return mo(e);if(e.$$typeof===C)return Ia(e)}throw Error(a(438,String(e)))}function po(e){var t=null,n=Wi.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=Wi.alternate;null!==r&&(null!==(r=r.updateQueue)&&(null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=T;return t.index++,n}function fo(e,t){return"function"==typeof t?t(e):t}function go(e){return bo(uo(),Vi,e)}function bo(e,t,n){var r=e.queue;if(null===r)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(null!==o){if(null!==i){var l=i.next;i.next=o.next,o.next=l}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,null===i)e.memoizedState=o;else{var s=l=null,c=null,u=t=i.next,d=!1;do{var m=-536870913&u.lane;if(m!==u.lane?(yc&m)===m:(Bi&m)===m){var h=u.revertLane;if(0===h)null!==c&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),m===Va&&(d=!0);else{if((Bi&h)===h){u=u.next,h===Va&&(d=!0);continue}m={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=m,l=o):c=c.next=m,Wi.lanes|=h,Ec|=h}m=u.action,Qi&&n(o,m),o=u.hasEagerState?u.eagerState:n(o,m)}else h={lane:m,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=h,l=o):c=c.next=h,Wi.lanes|=m,Ec|=m;u=u.next}while(null!==u&&u!==t);if(null===c?l=o:c.next=s,!er(o,e.memoizedState)&&(Ll=!0,d&&null!==(n=Ha)))throw n;e.memoizedState=o,e.baseState=l,e.baseQueue=c,r.lastRenderedState=o}return null===i&&(r.lanes=0),[e.memoizedState,r.dispatch]}function yo(e){var t=uo(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var l=i=i.next;do{o=e(o,l.action),l=l.next}while(l!==i);er(o,t.memoizedState)||(Ll=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vo(e,t,n){var r=Wi,i=uo(),o=ha;if(o){if(void 0===n)throw Error(a(407));n=n()}else n=t();var l=!er((Vi||i).memoizedState,n);if(l&&(i.memoizedState=n,Ll=!0),i=i.queue,Wo(ko.bind(null,r,i,e),[e]),i.getSnapshot!==t||l||null!==Hi&&1&Hi.memoizedState.tag){if(r.flags|=2048,jo(9,{destroy:void 0},xo.bind(null,r,i,n,t),null),null===gc)throw Error(a(349));o||127&Bi||wo(r,t,n)}return n}function wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Wi.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function xo(e,t,n,r){t.value=n,t.getSnapshot=r,Co(t)&&So(e)}function ko(e,t,n){return n(function(){Co(t)&&So(e)})}function Co(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!er(e,n)}catch(r){return!0}}function So(e){var t=Lr(e,2);null!==t&&Yc(t,e,2)}function No(e){var t=co();if("function"==typeof e){var n=e;if(e=n(),Qi){xe(!0);try{n()}finally{xe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:e},t}function Eo(e,t,n,r){return e.baseState=n,bo(e,Vi,"function"==typeof r?r:fo)}function $o(e,t,n,r,i){if(pl(e))throw Error(a(485));if(null!==(e=t.action)){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};null!==D.T?n(!0):o.isTransition=!1,r(o),null===(n=t.pending)?(o.next=t.pending=o,_o(t,o)):(o.next=n.next,t.pending=n.next=o)}}function _o(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var i=D.T,o={};D.T=o;try{var l=n(a,r),s=D.S;null!==s&&s(o,l),zo(e,t,l)}catch(c){Ao(e,t,c)}finally{null!==i&&null!==o.types&&(i.types=o.types),D.T=i}}else try{zo(e,t,i=n(a,r))}catch(u){Ao(e,t,u)}}function zo(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){To(e,t,n)},function(n){return Ao(e,t,n)}):To(e,t,n)}function To(e,t,n){t.status="fulfilled",t.value=n,Mo(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,_o(e,n)))}function Ao(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,Mo(t),t=t.next}while(t!==r)}e.action=null}function Mo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Po(e,t){return t}function Io(e,t){if(ha){var n=gc.formState;if(null!==n){e:{var r=Wi;if(ha){if(ma){t:{for(var a=ma,i=fa;8!==a.nodeType;){if(!i){a=null;break t}if(null===(a=Ld(a.nextSibling))){a=null;break t}}a="F!"===(i=a.data)||"F"===i?a:null}if(a){ma=Ld(a.nextSibling),r="F!"===a.data;break e}}ba(r)}r=!1}r&&(t=n[0])}}return(n=co()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:t},n.queue=r,n=dl.bind(null,Wi,r),r.dispatch=n,r=No(!1),i=hl.bind(null,Wi,!1,r.queue),a={state:t,dispatch:null,action:e,pending:null},(r=co()).queue=a,n=$o.bind(null,Wi,a,i,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function Lo(e){return Do(uo(),Vi,e)}function Do(e,t,n){if(t=bo(e,t,Po)[0],e=go(fo)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=mo(t)}catch(o){if(o===Za)throw ti;throw o}else r=t;var a=(t=uo()).queue,i=a.dispatch;return n!==t.memoizedState&&(Wi.flags|=2048,jo(9,{destroy:void 0},Oo.bind(null,a,n),null)),[r,i,e]}function Oo(e,t){e.action=t}function Ro(e){var t=uo(),n=Vi;if(null!==n)return Do(t,n,e);uo(),t=t.memoizedState;var r=(n=uo()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function jo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=Wi.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Fo(){return uo().memoizedState}function Uo(e,t,n,r){var a=co();Wi.flags|=e,a.memoizedState=jo(1|t,{destroy:void 0},n,void 0===r?null:r)}function qo(e,t,n,r){var a=uo();r=void 0===r?null:r;var i=a.memoizedState.inst;null!==Vi&&null!==r&&to(r,Vi.memoizedState.deps)?a.memoizedState=jo(t,i,n,r):(Wi.flags|=e,a.memoizedState=jo(1|t,i,n,r))}function Bo(e,t){Uo(8390656,8,e,t)}function Wo(e,t){qo(2048,8,e,t)}function Vo(e){var t=uo().memoizedState;return function(e){Wi.flags|=4;var t=Wi.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if(2&fc)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Ho(e,t){return qo(4,2,e,t)}function Ko(e,t){return qo(4,4,e,t)}function Go(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function Qo(e,t,n){n=null!=n?n.concat([e]):null,qo(4,4,Go.bind(null,t,e),n)}function Yo(){}function Xo(e,t){var n=uo();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&to(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Jo(e,t){var n=uo();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&to(t,r[1]))return r[0];if(r=e(),Qi){xe(!0);try{e()}finally{xe(!1)}}return n.memoizedState=[r,t],r}function Zo(e,t,n){return void 0===n||1073741824&Bi&&!(261930&yc)?e.memoizedState=t:(e.memoizedState=n,e=Qc(),Wi.lanes|=e,Ec|=e,n)}function el(e,t,n,r){return er(n,t)?n:null!==zi.current?(e=Zo(e,n,r),er(e,t)||(Ll=!0),e):42&Bi&&(!(1073741824&Bi)||261930&yc)?(e=Qc(),Wi.lanes|=e,Ec|=e,t):(Ll=!0,e.memoizedState=n)}function tl(e,t,n,r,a){var i=O.p;O.p=0!==i&&8>i?i:8;var o,l,s,c=D.T,u={};D.T=u,hl(e,!1,t,n);try{var d=a(),m=D.S;if(null!==m&&m(u,d),null!==d&&"object"==typeof d&&"function"==typeof d.then)ml(e,t,(o=r,l=[],s={status:"pending",value:null,reason:null,then:function(e){l.push(e)}},d.then(function(){s.status="fulfilled",s.value=o;for(var e=0;e<l.length;e++)(0,l[e])(o)},function(e){for(s.status="rejected",s.reason=e,e=0;e<l.length;e++)(0,l[e])(void 0)}),s),Gc());else ml(e,t,r,Gc())}catch(h){ml(e,t,{then:function(){},status:"rejected",reason:h},Gc())}finally{O.p=i,null!==c&&null!==u.types&&(c.types=u.types),D.T=c}}function nl(){}function rl(e,t,n,r){if(5!==e.tag)throw Error(a(476));var i=al(e).queue;tl(e,i,t,R,null===n?nl:function(){return il(e),n(r)})}function al(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:R},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function il(e){var t=al(e);null===t.next&&(t=e.alternate.memoizedState),ml(e,t.next.queue,{},Gc())}function ol(){return Ia(mm)}function ll(){return uo().memoizedState}function sl(){return uo().memoizedState}function cl(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=Gc(),r=xi(t,e=wi(n),n);return null!==r&&(Yc(r,t,n),ki(r,t,n)),t={cache:Ua()},void(e.payload=t)}t=t.return}}function ul(e,t,n){var r=Gc();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pl(e)?fl(t,n):null!==(n=Ir(e,t,n,r))&&(Yc(n,e,r),gl(n,t,r))}function dl(e,t,n){ml(e,t,n,Gc())}function ml(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pl(e))fl(t,a);else{var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var o=t.lastRenderedState,l=i(o,n);if(a.hasEagerState=!0,a.eagerState=l,er(l,o))return Pr(e,t,a,0),null===gc&&Mr(),!1}catch(s){}if(null!==(n=Ir(e,t,a,r)))return Yc(n,e,r),gl(n,t,r),!0}return!1}function hl(e,t,n,r){if(r={lane:2,revertLane:Wu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pl(e)){if(t)throw Error(a(479))}else null!==(t=Ir(e,n,r,2))&&Yc(t,e,2)}function pl(e){var t=e.alternate;return e===Wi||null!==t&&t===Wi}function fl(e,t){Gi=Ki=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gl(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,De(e,n)}}var bl={readContext:Ia,use:ho,useCallback:eo,useContext:eo,useEffect:eo,useImperativeHandle:eo,useLayoutEffect:eo,useInsertionEffect:eo,useMemo:eo,useReducer:eo,useRef:eo,useState:eo,useDebugValue:eo,useDeferredValue:eo,useTransition:eo,useSyncExternalStore:eo,useId:eo,useHostTransitionStatus:eo,useFormState:eo,useActionState:eo,useOptimistic:eo,useMemoCache:eo,useCacheRefresh:eo};bl.useEffectEvent=eo;var yl={readContext:Ia,use:ho,useCallback:function(e,t){return co().memoizedState=[e,void 0===t?null:t],e},useContext:Ia,useEffect:Bo,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,Uo(4194308,4,Go.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Uo(4194308,4,e,t)},useInsertionEffect:function(e,t){Uo(4,2,e,t)},useMemo:function(e,t){var n=co();t=void 0===t?null:t;var r=e();if(Qi){xe(!0);try{e()}finally{xe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=co();if(void 0!==n){var a=n(t);if(Qi){xe(!0);try{n(t)}finally{xe(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=ul.bind(null,Wi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},co().memoizedState=e},useState:function(e){var t=(e=No(e)).queue,n=dl.bind(null,Wi,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Yo,useDeferredValue:function(e,t){return Zo(co(),e,t)},useTransition:function(){var e=No(!1);return e=tl.bind(null,Wi,e.queue,!0,!1),co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Wi,i=co();if(ha){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===gc)throw Error(a(349));127&yc||wo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Bo(ko.bind(null,r,o,e),[e]),r.flags|=2048,jo(9,{destroy:void 0},xo.bind(null,r,o,n,t),null),n},useId:function(){var e=co(),t=gc.identifierPrefix;if(ha){var n=ia;t="_"+t+"R_"+(n=(aa&~(1<<32-ke(aa)-1)).toString(32)+n),0<(n=Yi++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=Zi++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ol,useFormState:Io,useActionState:Io,useOptimistic:function(e){var t=co();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=hl.bind(null,Wi,!0,n),n.dispatch=t,[e,t]},useMemoCache:po,useCacheRefresh:function(){return co().memoizedState=cl.bind(null,Wi)},useEffectEvent:function(e){var t=co(),n={impl:e};return t.memoizedState=n,function(){if(2&fc)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},vl={readContext:Ia,use:ho,useCallback:Xo,useContext:Ia,useEffect:Wo,useImperativeHandle:Qo,useInsertionEffect:Ho,useLayoutEffect:Ko,useMemo:Jo,useReducer:go,useRef:Fo,useState:function(){return go(fo)},useDebugValue:Yo,useDeferredValue:function(e,t){return el(uo(),Vi.memoizedState,e,t)},useTransition:function(){var e=go(fo)[0],t=uo().memoizedState;return["boolean"==typeof e?e:mo(e),t]},useSyncExternalStore:vo,useId:ll,useHostTransitionStatus:ol,useFormState:Lo,useActionState:Lo,useOptimistic:function(e,t){return Eo(uo(),0,e,t)},useMemoCache:po,useCacheRefresh:sl};vl.useEffectEvent=Vo;var wl={readContext:Ia,use:ho,useCallback:Xo,useContext:Ia,useEffect:Wo,useImperativeHandle:Qo,useInsertionEffect:Ho,useLayoutEffect:Ko,useMemo:Jo,useReducer:yo,useRef:Fo,useState:function(){return yo(fo)},useDebugValue:Yo,useDeferredValue:function(e,t){var n=uo();return null===Vi?Zo(n,e,t):el(n,Vi.memoizedState,e,t)},useTransition:function(){var e=yo(fo)[0],t=uo().memoizedState;return["boolean"==typeof e?e:mo(e),t]},useSyncExternalStore:vo,useId:ll,useHostTransitionStatus:ol,useFormState:Ro,useActionState:Ro,useOptimistic:function(e,t){var n=uo();return null!==Vi?Eo(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:po,useCacheRefresh:sl};function xl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:m({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}wl.useEffectEvent=Vo;var kl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Gc(),a=wi(r);a.payload=t,null!=n&&(a.callback=n),null!==(t=xi(e,a,r))&&(Yc(t,e,r),ki(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Gc(),a=wi(r);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=xi(e,a,r))&&(Yc(t,e,r),ki(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gc(),r=wi(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=xi(e,r,n))&&(Yc(t,e,n),ki(t,e,n))}};function Cl(e,t,n,r,a,i,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,o):!t.prototype||!t.prototype.isPureReactComponent||(!tr(n,r)||!tr(a,i))}function Sl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&kl.enqueueReplaceState(t,t.state,null)}function Nl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=m({},n)),e)void 0===n[a]&&(n[a]=e[a]);return n}function El(e){_r(e)}function $l(e){console.error(e)}function _l(e){_r(e)}function zl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Tl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Al(e,t,n){return(n=wi(n)).tag=3,n.payload={element:null},n.callback=function(){zl(e,t)},n}function Ml(e){return(e=wi(e)).tag=3,e}function Pl(e,t,n,r){var a=n.type.getDerivedStateFromError;if("function"==typeof a){var i=r.value;e.payload=function(){return a(i)},e.callback=function(){Tl(t,n,r)}}var o=n.stateNode;null!==o&&"function"==typeof o.componentDidCatch&&(e.callback=function(){Tl(t,n,r),"function"!=typeof a&&(null===Rc?Rc=/* @__PURE__ */new Set([this]):Rc.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Il=Error(a(461)),Ll=!1;function Dl(e,t,n,r){t.child=null===e?gi(t,null,n,r):fi(t,e.child,n,r)}function Ol(e,t,n,r,a){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)"ref"!==l&&(o[l]=r[l])}else o=r;return Pa(t),r=no(e,t,n,o,i,a),l=oo(),null===e||Ll?(ha&&l&&sa(t),t.flags|=1,Dl(e,t,r,a),t.child):(lo(e,t,a),os(e,t,a))}function Rl(e,t,n,r,a){if(null===e){var i=n.type;return"function"!=typeof i||Ur(i)||void 0!==i.defaultProps||null!==n.compare?((e=Wr(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,jl(e,t,i,r,a))}if(i=e.child,!ls(e,a)){var o=i.memoizedProps;if((n=null!==(n=n.compare)?n:tr)(o,r)&&e.ref===t.ref)return os(e,t,a)}return t.flags|=1,(e=qr(i,r)).ref=t.ref,e.return=t,t.child=e}function jl(e,t,n,r,a){if(null!==e){var i=e.memoizedProps;if(tr(i,r)&&e.ref===t.ref){if(Ll=!1,t.pendingProps=r=i,!ls(e,a))return t.lanes=e.lanes,os(e,t,a);131072&e.flags&&(Ll=!0)}}return Hl(e,t,n,r,a)}function Fl(e,t,n,r){var a=r.children,i=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===r.mode){if(128&t.flags){if(i=null!==i?i.baseLanes|n:n,null!==e){for(r=t.child=e.child,a=0;null!==r;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~i}else r=0,t.child=null;return ql(e,t,i,n,r)}if(!(536870912&n))return r=t.lanes=536870912,ql(e,t,null!==i?i.baseLanes|n:n,n,r);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Xa(0,null!==i?i.cachePool:null),null!==i?Ai(t,i):Mi(),Ri(t)}else null!==i?(Xa(0,i.cachePool),Ai(t,i),ji(),t.memoizedState=null):(null!==e&&Xa(0,null),Mi(),ji());return Dl(e,t,a,n),t.child}function Ul(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ql(e,t,n,r,a){var i=Ya();return i=null===i?null:{parent:Fa._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},null!==e&&Xa(0,null),Mi(),Ri(t),null!==e&&Aa(e,t,r,!0),t.childLanes=a,null}function Bl(e,t){return(t=ts({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Wl(e,t,n){return fi(t,e.child,null,n),(e=Bl(t,t.pendingProps)).flags|=2,Fi(t),t.memoizedState=null,e}function Vl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(a(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Hl(e,t,n,r,a){return Pa(t),n=no(e,t,n,r,void 0,a),r=oo(),null===e||Ll?(ha&&r&&sa(t),t.flags|=1,Dl(e,t,n,a),t.child):(lo(e,t,a),os(e,t,a))}function Kl(e,t,n,r,a,i){return Pa(t),t.updateQueue=null,n=ao(t,r,n,a),ro(e),r=oo(),null===e||Ll?(ha&&r&&sa(t),t.flags|=1,Dl(e,t,n,i),t.child):(lo(e,t,i),os(e,t,i))}function Gl(e,t,n,r,a){if(Pa(t),null===t.stateNode){var i=Rr,o=n.contextType;"object"==typeof o&&null!==o&&(i=Ia(o)),i=new n(r,i),t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,i.updater=kl,t.stateNode=i,i._reactInternals=t,(i=t.stateNode).props=r,i.state=t.memoizedState,i.refs={},yi(t),o=n.contextType,i.context="object"==typeof o&&null!==o?Ia(o):Rr,i.state=t.memoizedState,"function"==typeof(o=n.getDerivedStateFromProps)&&(xl(t,n,o,r),i.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(o=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),o!==i.state&&kl.enqueueReplaceState(i,i.state,null),Ei(t,r,i,a),Ni(),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){i=t.stateNode;var l=t.memoizedProps,s=Nl(n,l);i.props=s;var c=i.context,u=n.contextType;o=Rr,"object"==typeof u&&null!==u&&(o=Ia(u));var d=n.getDerivedStateFromProps;u="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate,l=t.pendingProps!==l,u||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l||c!==o)&&Sl(t,i,r,o),bi=!1;var m=t.memoizedState;i.state=m,Ei(t,r,i,a),Ni(),c=t.memoizedState,l||m!==c||bi?("function"==typeof d&&(xl(t,n,d,r),c=t.memoizedState),(s=bi||Cl(t,n,s,r,m,c,o))?(u||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=o,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,vi(e,t),u=Nl(n,o=t.memoizedProps),i.props=u,d=t.pendingProps,m=i.context,c=n.contextType,s=Rr,"object"==typeof c&&null!==c&&(s=Ia(c)),(c="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(o!==d||m!==s)&&Sl(t,i,r,s),bi=!1,m=t.memoizedState,i.state=m,Ei(t,r,i,a),Ni();var h=t.memoizedState;o!==d||m!==h||bi||null!==e&&null!==e.dependencies&&Ma(e.dependencies)?("function"==typeof l&&(xl(t,n,l,r),h=t.memoizedState),(u=bi||Cl(t,n,u,r,m,h,s)||null!==e&&null!==e.dependencies&&Ma(e.dependencies))?(c||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,h,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,h,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=s,r=u):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Vl(e,t),r=!!(128&t.flags),i||r?(i=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:i.render(),t.flags|=1,null!==e&&r?(t.child=fi(t,e.child,null,a),t.child=fi(t,null,n,a)):Dl(e,t,n,a),t.memoizedState=i.state,e=t.child):e=os(e,t,a),e}function Ql(e,t,n,r){return xa(),t.flags|=256,Dl(e,t,n,r),t.child}var Yl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xl(e){return{baseLanes:e,cachePool:Ja()}}function Jl(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=zc),e}function Zl(e,t,n){var r,i=t.pendingProps,o=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&Ui.current)),r&&(o=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(ha){if(o?Di(t):ji(),(e=ma)?null!==(e=null!==(e=Md(e,fa))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==ra?{id:aa,overflow:ia}:null,retryLane:536870912,hydrationErrors:null},(n=Kr(e)).return=t,t.child=n,da=t,ma=null):e=null,null===e)throw ba(t);return Id(e)?t.lanes=32:t.lanes=536870912,null}var s=i.children;return i=i.fallback,o?(ji(),s=ts({mode:"hidden",children:s},o=t.mode),i=Vr(i,o,n,null),s.return=t,i.return=t,s.sibling=i,t.child=s,(i=t.child).memoizedState=Xl(n),i.childLanes=Jl(e,r,n),t.memoizedState=Yl,Ul(null,i)):(Di(t),es(t,s))}var c=e.memoizedState;if(null!==c&&null!==(s=c.dehydrated)){if(l)256&t.flags?(Di(t),t.flags&=-257,t=ns(e,t,n)):null!==t.memoizedState?(ji(),t.child=e.child,t.flags|=128,t=null):(ji(),s=i.fallback,o=t.mode,i=ts({mode:"visible",children:i.children},o),(s=Vr(s,o,n,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,fi(t,e.child,null,n),(i=t.child).memoizedState=Xl(n),i.childLanes=Jl(e,r,n),t.memoizedState=Yl,t=Ul(null,i));else if(Di(t),Id(s)){if(r=s.nextSibling&&s.nextSibling.dataset)var u=r.dgst;r=u,(i=Error(a(419))).stack="",i.digest=r,Ca({value:i,source:null,stack:null}),t=ns(e,t,n)}else if(Ll||Aa(e,t,n,!1),r=0!==(n&e.childLanes),Ll||r){if(null!==(r=gc)&&(0!==(i=Oe(r,n))&&i!==c.retryLane))throw c.retryLane=i,Lr(e,i),Yc(r,e,i),Il;Pd(s)||su(),t=ns(e,t,n)}else Pd(s)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ma=Ld(s.nextSibling),da=t,ha=!0,pa=null,fa=!1,null!==e&&ua(t,e),(t=es(t,i.children)).flags|=4096);return t}return o?(ji(),s=i.fallback,o=t.mode,u=(c=e.child).sibling,(i=qr(c,{mode:"hidden",children:i.children})).subtreeFlags=65011712&c.subtreeFlags,null!==u?s=qr(u,s):(s=Vr(s,o,n,null)).flags|=2,s.return=t,i.return=t,i.sibling=s,t.child=i,Ul(null,i),i=t.child,null===(s=e.child.memoizedState)?s=Xl(n):(null!==(o=s.cachePool)?(c=Fa._currentValue,o=o.parent!==c?{parent:c,pool:c}:o):o=Ja(),s={baseLanes:s.baseLanes|n,cachePool:o}),i.memoizedState=s,i.childLanes=Jl(e,r,n),t.memoizedState=Yl,Ul(e.child,i)):(Di(t),e=(n=e.child).sibling,(n=qr(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function es(e,t){return(t=ts({mode:"visible",children:t},e.mode)).return=e,e.child=t}function ts(e,t){return(e=Fr(22,e,null,t)).lanes=0,e}function ns(e,t,n){return fi(t,e.child,null,n),(e=es(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function rs(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),za(e.return,t,n)}function as(e,t,n,r,a,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a,o.treeForkCount=i)}function is(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;r=r.children;var o=Ui.current,l=!!(2&o);if(l?(o=1&o|2,t.flags|=128):o&=1,B(Ui,o),Dl(e,t,r,n),r=ha?ea:0,!l&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&rs(e,n,t);else if(19===e.tag)rs(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===qi(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),as(t,!1,a,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===qi(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}as(t,!0,n,null,i,r);break;case"together":as(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function os(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ec|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Aa(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=qr(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=qr(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function ls(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Ma(e))}function ss(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Ll=!0;else{if(!(ls(e,n)||128&t.flags))return Ll=!1,function(e,t,n){switch(t.tag){case 3:Y(t,t.stateNode.containerInfo),$a(0,Fa,e.memoizedState.cache),xa();break;case 27:case 5:J(t);break;case 4:Y(t,t.stateNode.containerInfo);break;case 10:$a(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Oi(t),null;break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(Di(t),t.flags|=128,null):0!==(n&t.child.childLanes)?Zl(e,t,n):(Di(t),null!==(e=os(e,t,n))?e.sibling:null);Di(t);break;case 19:var a=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Aa(e,t,n,!1),r=0!==(n&t.childLanes)),a){if(r)return is(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),B(Ui,Ui.current),r)break;return null;case 22:return t.lanes=0,Fl(e,t,n,t.pendingProps);case 24:$a(0,Fa,e.memoizedState.cache)}return os(e,t,n)}(e,t,n);Ll=!!(131072&e.flags)}else Ll=!1,ha&&1048576&t.flags&&la(t,ea,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ii(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var i=e.$$typeof;if(i===S){t.tag=11,t=Ol(null,t,e,r,n);break e}if(i===$){t.tag=14,t=Rl(null,t,e,r,n);break e}}throw t=I(e)||e,Error(a(306,t,""))}Ur(e)?(r=Nl(e,r),t.tag=1,t=Gl(null,t,e,r,n)):(t.tag=0,t=Hl(null,t,e,r,n))}return t;case 0:return Hl(e,t,t.type,t.pendingProps,n);case 1:return Gl(e,t,r=t.type,i=Nl(r,t.pendingProps),n);case 3:e:{if(Y(t,t.stateNode.containerInfo),null===e)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,vi(e,t),Ei(t,r,null,n);var l=t.memoizedState;if(r=l.cache,$a(0,Fa,r),r!==o.cache&&Ta(t,[Fa],n,!0),Ni(),r=l.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Ql(e,t,r,n);break e}if(r!==i){Ca(i=Yr(Error(a(424)),t)),t=Ql(e,t,r,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(ma=Ld(e.firstChild),da=t,ha=!0,pa=null,fa=!0,n=gi(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(xa(),r===i){t=os(e,t,n);break e}Dl(e,t,r,n)}t=t.child}return t;case 26:return Vl(e,t),null===e?(n=Kd(t.type,null,t.pendingProps,null))?t.memoizedState=n:ha||(n=t.type,e=t.pendingProps,(r=yd(G.current).createElement(n))[Be]=t,r[We]=e,pd(r,n,e),nt(r),t.stateNode=r):t.memoizedState=Kd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return J(t),null===e&&ha&&(r=t.stateNode=jd(t.type,t.pendingProps,G.current),da=t,fa=!0,i=ma,_d(t.type)?(Dd=i,ma=Ld(r.firstChild)):ma=i),Dl(e,t,t.pendingProps.children,n),Vl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&ha&&((i=r=ma)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[Ye])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(i=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(i!==a.rel||e.getAttribute("href")!==(null==a.href||""===a.href?null:a.href)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin)||e.getAttribute("title")!==(null==a.title?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((i=e.getAttribute("src"))!==(null==a.src?null:a.src)||e.getAttribute("type")!==(null==a.type?null:a.type)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var i=null==a.name?null:""+a.name;if("hidden"===a.type&&e.getAttribute("name")===i)return e}if(null===(e=Ld(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,fa))?(t.stateNode=r,da=t,ma=Ld(r.firstChild),fa=!1,i=!0):i=!1),i||ba(t)),J(t),i=t.type,o=t.pendingProps,l=null!==e?e.memoizedProps:null,r=o.children,xd(i,o)?r=null:null!==l&&xd(i,l)&&(t.flags|=32),null!==t.memoizedState&&(i=no(e,t,io,null,null,n),mm._currentValue=i),Vl(e,t),Dl(e,t,r,n),t.child;case 6:return null===e&&ha&&((e=n=ma)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n)return null;if(null===(e=Ld(e.nextSibling)))return null}return e}(n,t.pendingProps,fa))?(t.stateNode=n,da=t,ma=null,e=!0):e=!1),e||ba(t)),null;case 13:return Zl(e,t,n);case 4:return Y(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=fi(t,null,r,n):Dl(e,t,r,n),t.child;case 11:return Ol(e,t,t.type,t.pendingProps,n);case 7:return Dl(e,t,t.pendingProps,n),t.child;case 8:case 12:return Dl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,$a(0,t.type,r.value),Dl(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Pa(t),r=r(i=Ia(i)),t.flags|=1,Dl(e,t,r,n),t.child;case 14:return Rl(e,t,t.type,t.pendingProps,n);case 15:return jl(e,t,t.type,t.pendingProps,n);case 19:return is(e,t,n);case 31:return function(e,t,n){var r=t.pendingProps,i=!!(128&t.flags);if(t.flags&=-129,null===e){if(ha){if("hidden"===r.mode)return e=Bl(t,r),t.lanes=536870912,Ul(null,e);if(Oi(t),(e=ma)?null!==(e=null!==(e=Md(e,fa))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==ra?{id:aa,overflow:ia}:null,retryLane:536870912,hydrationErrors:null},(n=Kr(e)).return=t,t.child=n,da=t,ma=null):e=null,null===e)throw ba(t);return t.lanes=536870912,null}return Bl(t,r)}var o=e.memoizedState;if(null!==o){var l=o.dehydrated;if(Oi(t),i)if(256&t.flags)t.flags&=-257,t=Wl(e,t,n);else{if(null===t.memoizedState)throw Error(a(558));t.child=e.child,t.flags|=128,t=null}else if(Ll||Aa(e,t,n,!1),i=0!==(n&e.childLanes),Ll||i){if(null!==(r=gc)&&0!==(l=Oe(r,n))&&l!==o.retryLane)throw o.retryLane=l,Lr(e,l),Yc(r,e,l),Il;su(),t=Wl(e,t,n)}else e=o.treeContext,ma=Ld(l.nextSibling),da=t,ha=!0,pa=null,fa=!1,null!==e&&ua(t,e),(t=Bl(t,r)).flags|=4096;return t}return(e=qr(e.child,{mode:r.mode,children:r.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,n);case 22:return Fl(e,t,n,t.pendingProps);case 24:return Pa(t),r=Ia(Fa),null===e?(null===(i=Ya())&&(i=gc,o=Ua(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},yi(t),$a(0,Fa,i)):(0!==(e.lanes&n)&&(vi(e,t),Ei(t,null,null,n),Ni()),i=e.memoizedState,o=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),$a(0,Fa,r)):(r=o.cache,$a(0,Fa,r),r!==i.cache&&Ta(t,[Fa],n,!0))),Dl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function cs(e){e.flags|=4}function us(e,t,n,r,a){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&a)===a)if(e.stateNode.complete)e.flags|=8192;else{if(!iu())throw oi=ni,ei;e.flags|=8192}}else e.flags&=-16777217}function ds(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!om(t)){if(!iu())throw oi=ni,ei;e.flags|=8192}}function ms(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Me():536870912,e.lanes|=t,Tc|=t)}function hs(e,t){if(!ha)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ps(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=65011712&a.subtreeFlags,r|=65011712&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fs(e,t,n){var r=t.pendingProps;switch(ca(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return ps(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),_a(Fa),X(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(wa(t)?cs(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,ka())),ps(t),null;case 26:var i=t.type,o=t.memoizedState;return null===e?(cs(t),null!==o?(ps(t),ds(t,o)):(ps(t),us(t,i,0,0,n))):o?o!==e.memoizedState?(cs(t),ps(t),ds(t,o)):(ps(t),t.flags&=-16777217):((e=e.memoizedProps)!==r&&cs(t),ps(t),us(t,i,0,0,n)),null;case 27:if(Z(t),n=G.current,i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&cs(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return ps(t),null}e=H.current,wa(t)?ya(t):(e=jd(i,r,n),t.stateNode=e,cs(t))}return ps(t),null;case 5:if(Z(t),i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&cs(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return ps(t),null}if(o=H.current,wa(t))ya(t);else{var l=yd(G.current);switch(o){case 1:o=l.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:o=l.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":o=l.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":o=l.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":(o=l.createElement("div")).innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o="string"==typeof r.is?l.createElement("select",{is:r.is}):l.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o="string"==typeof r.is?l.createElement(i,{is:r.is}):l.createElement(i)}}o[Be]=t,o[We]=r;e:for(l=t.child;null!==l;){if(5===l.tag||6===l.tag)o.appendChild(l.stateNode);else if(4!==l.tag&&27!==l.tag&&null!==l.child){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;null===l.sibling;){if(null===l.return||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=o;e:switch(pd(o,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&cs(t)}}return ps(t),us(t,t.type,null===e||e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&cs(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));if(e=G.current,wa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(i=da))switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Be]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||dd(e.nodeValue,n)))||ba(t,!0)}else(e=yd(e).createTextNode(r))[Be]=t,t.stateNode=e}return ps(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(r=wa(t),null!==n){if(null===e){if(!r)throw Error(a(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(a(557));e[Be]=t}else xa(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ps(t),e=!1}else n=ka(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(Fi(t),t):(Fi(t),null);if(128&t.flags)throw Error(a(558))}return ps(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(i=wa(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(a(318));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(a(317));i[Be]=t}else xa(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ps(t),i=!1}else i=ka(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return 256&t.flags?(Fi(t),t):(Fi(t),null)}return Fi(t),128&t.flags?(t.lanes=n,t):(n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(i=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(i=r.alternate.memoizedState.cachePool.pool),o=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ms(t,t.updateQueue),ps(t),null);case 4:return X(),null===e&&td(t.stateNode.containerInfo),ps(t),null;case 10:return _a(t.type),ps(t),null;case 19:if(q(Ui),null===(r=t.memoizedState))return ps(t),null;if(i=!!(128&t.flags),null===(o=r.rendering))if(i)hs(r,!1);else{if(0!==Nc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=qi(e))){for(t.flags|=128,hs(r,!1),e=o.updateQueue,t.updateQueue=e,ms(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)Br(n,e),n=n.sibling;return B(Ui,1&Ui.current|2),ha&&oa(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&ue()>Dc&&(t.flags|=128,i=!0,hs(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=qi(o))){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,ms(t,e),hs(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!ha)return ps(t),null}else 2*ue()-r.renderingStartTime>Dc&&536870912!==n&&(t.flags|=128,i=!0,hs(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ue(),e.sibling=null,n=Ui.current,B(Ui,i?1&n|2:1&n),ha&&oa(t,r.treeForkCount),e):(ps(t),null);case 22:case 23:return Fi(t),Pi(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(ps(t),6&t.subtreeFlags&&(t.flags|=8192)):ps(t),null!==(n=t.updateQueue)&&ms(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&q(Qa),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),_a(Fa),ps(t),null;case 25:case 30:return null}throw Error(a(156,t.tag))}function gs(e,t){switch(ca(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return _a(Fa),X(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return Z(t),null;case 31:if(null!==t.memoizedState){if(Fi(t),null===t.alternate)throw Error(a(340));xa()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Fi(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));xa()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return q(Ui),null;case 4:return X(),null;case 10:return _a(t.type),null;case 22:case 23:return Fi(t),Pi(),null!==e&&q(Qa),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return _a(Fa),null;default:return null}}function bs(e,t){switch(ca(t),t.tag){case 3:_a(Fa),X();break;case 26:case 27:case 5:Z(t);break;case 4:X();break;case 31:null!==t.memoizedState&&Fi(t);break;case 13:Fi(t);break;case 19:q(Ui);break;case 10:_a(t.type);break;case 22:case 23:Fi(t),Pi(),null!==e&&q(Qa);break;case 24:_a(Fa)}}function ys(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==a)}}catch(l){Nu(t,t.return,l)}}function vs(e,t,n){try{var r=t.updateQueue,a=null!==r?r.lastEffect:null;if(null!==a){var i=a.next;r=i;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(void 0!==l){o.destroy=void 0,a=t;var s=n,c=l;try{c()}catch(u){Nu(a,s,u)}}}r=r.next}while(r!==i)}}catch(u){Nu(t,t.return,u)}}function ws(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{_i(t,n)}catch(r){Nu(e,e.return,r)}}}function xs(e,t,n){n.props=Nl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Nu(e,t,r)}}function ks(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(a){Nu(e,t,a)}}function Cs(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(a){Nu(e,t,a)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(i){Nu(e,t,i)}else n.current=null}function Ss(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(a){Nu(e,e.return,a)}}function Ns(e,t,n){try{var r=e.stateNode;!function(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,o=null,l=null,s=null,c=null,u=null,d=null;for(p in n){var m=n[p];if(n.hasOwnProperty(p)&&null!=m)switch(p){case"checked":case"value":break;case"defaultValue":c=m;default:r.hasOwnProperty(p)||md(e,t,p,null,r,m)}}for(var h in r){var p=r[h];if(m=n[h],r.hasOwnProperty(h)&&(null!=p||null!=m))switch(h){case"type":o=p;break;case"name":i=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":l=p;break;case"defaultValue":s=p;break;case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(a(137,t));break;default:p!==m&&md(e,t,h,p,r,m)}}return void wt(e,l,s,c,u,d,o,i);case"select":for(o in p=l=s=h=null,n)if(c=n[o],n.hasOwnProperty(o)&&null!=c)switch(o){case"value":break;case"multiple":p=c;default:r.hasOwnProperty(o)||md(e,t,o,null,r,c)}for(i in r)if(o=r[i],c=n[i],r.hasOwnProperty(i)&&(null!=o||null!=c))switch(i){case"value":h=o;break;case"defaultValue":s=o;break;case"multiple":l=o;default:o!==c&&md(e,t,i,o,r,c)}return t=s,n=l,r=p,void(null!=h?Ct(e,!!n,h,!1):!!r!=!!n&&(null!=t?Ct(e,!!n,t,!0):Ct(e,!!n,n?[]:"",!1)));case"textarea":for(s in p=h=null,n)if(i=n[s],n.hasOwnProperty(s)&&null!=i&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:md(e,t,s,null,r,i)}for(l in r)if(i=r[l],o=n[l],r.hasOwnProperty(l)&&(null!=i||null!=o))switch(l){case"value":h=i;break;case"defaultValue":p=i;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=i)throw Error(a(91));break;default:i!==o&&md(e,t,l,i,r,o)}return void St(e,h,p);case"option":for(var f in n)if(h=n[f],n.hasOwnProperty(f)&&null!=h&&!r.hasOwnProperty(f))if("selected"===f)e.selected=!1;else md(e,t,f,null,r,h);for(c in r)if(h=r[c],p=n[c],r.hasOwnProperty(c)&&h!==p&&(null!=h||null!=p))if("selected"===c)e.selected=h&&"function"!=typeof h&&"symbol"!=typeof h;else md(e,t,c,h,r,p);return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in n)h=n[g],n.hasOwnProperty(g)&&null!=h&&!r.hasOwnProperty(g)&&md(e,t,g,null,r,h);for(u in r)if(h=r[u],p=n[u],r.hasOwnProperty(u)&&h!==p&&(null!=h||null!=p))switch(u){case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(a(137,t));break;default:md(e,t,u,h,r,p)}return;default:if(Tt(t)){for(var b in n)h=n[b],n.hasOwnProperty(b)&&void 0!==h&&!r.hasOwnProperty(b)&&hd(e,t,b,void 0,r,h);for(d in r)h=r[d],p=n[d],!r.hasOwnProperty(d)||h===p||void 0===h&&void 0===p||hd(e,t,d,h,r,p);return}}for(var y in n)h=n[y],n.hasOwnProperty(y)&&null!=h&&!r.hasOwnProperty(y)&&md(e,t,y,null,r,h);for(m in r)h=r[m],p=n[m],!r.hasOwnProperty(m)||h===p||null==h&&null==p||md(e,t,m,h,r,p)}(r,e.type,n,t),r[We]=t}catch(i){Nu(e,e.return,i)}}function Es(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&_d(e.type)||4===e.tag}function $s(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Es(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&_d(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function _s(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=It));else if(4!==r&&(27===r&&_d(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(_s(e,t,n),e=e.sibling;null!==e;)_s(e,t,n),e=e.sibling}function zs(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&_d(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(zs(e,t,n),e=e.sibling;null!==e;)zs(e,t,n),e=e.sibling}function Ts(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);pd(t,r,n),t[Be]=e,t[We]=n}catch(i){Nu(e,e.return,i)}}var As=!1,Ms=!1,Ps=!1,Is="function"==typeof WeakSet?WeakSet:Set,Ls=null;function Ds(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ys(e,n),4&r&&ys(5,n);break;case 1:if(Ys(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(o){Nu(n,n.return,o)}else{var a=Nl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(l){Nu(n,n.return,l)}}64&r&&ws(n),512&r&&ks(n,n.return);break;case 3:if(Ys(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{_i(e,t)}catch(o){Nu(n,n.return,o)}}break;case 27:null===t&&4&r&&Ts(n);case 26:case 5:Ys(e,n),null===t&&4&r&&Ss(n),512&r&&ks(n,n.return);break;case 12:Ys(e,n);break;case 31:Ys(e,n),4&r&&qs(e,n);break;case 13:Ys(e,n),4&r&&Bs(e,n),64&r&&(null!==(e=n.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=zu.bind(null,n))));break;case 22:if(!(r=null!==n.memoizedState||As)){t=null!==t&&null!==t.memoizedState||Ms,a=As;var i=Ms;As=r,(Ms=t)&&!i?Js(e,n,!!(8772&n.subtreeFlags)):Ys(e,n),As=a,Ms=i}break;case 30:break;default:Ys(e,n)}}function Os(e){var t=e.alternate;null!==t&&(e.alternate=null,Os(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&Xe(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Rs=null,js=!1;function Fs(e,t,n){for(n=n.child;null!==n;)Us(e,t,n),n=n.sibling}function Us(e,t,n){if(we&&"function"==typeof we.onCommitFiberUnmount)try{we.onCommitFiberUnmount(ve,n)}catch(i){}switch(n.tag){case 26:Ms||Cs(n,t),Fs(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:Ms||Cs(n,t);var r=Rs,a=js;_d(n.type)&&(Rs=n.stateNode,js=!1),Fs(e,t,n),Fd(n.stateNode),Rs=r,js=a;break;case 5:Ms||Cs(n,t);case 6:if(r=Rs,a=js,Rs=null,Fs(e,t,n),js=a,null!==(Rs=r))if(js)try{(9===Rs.nodeType?Rs.body:"HTML"===Rs.nodeName?Rs.ownerDocument.body:Rs).removeChild(n.stateNode)}catch(o){Nu(n,t,o)}else try{Rs.removeChild(n.stateNode)}catch(o){Nu(n,t,o)}break;case 18:null!==Rs&&(js?(zd(9===(e=Rs).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Hm(e)):zd(Rs,n.stateNode));break;case 4:r=Rs,a=js,Rs=n.stateNode.containerInfo,js=!0,Fs(e,t,n),Rs=r,js=a;break;case 0:case 11:case 14:case 15:vs(2,n,t),Ms||vs(4,n,t),Fs(e,t,n);break;case 1:Ms||(Cs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&xs(n,t,r)),Fs(e,t,n);break;case 21:Fs(e,t,n);break;case 22:Ms=(r=Ms)||null!==n.memoizedState,Fs(e,t,n),Ms=r;break;default:Fs(e,t,n)}}function qs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Hm(e)}catch(n){Nu(t,t.return,n)}}}function Bs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Hm(e)}catch(n){Nu(t,t.return,n)}}function Ws(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Is),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Is),t;default:throw Error(a(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Tu.bind(null,e,t);t.then(r,r)}})}function Vs(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r],o=e,l=t,s=l;e:for(;null!==s;){switch(s.tag){case 27:if(_d(s.type)){Rs=s.stateNode,js=!1;break e}break;case 5:Rs=s.stateNode,js=!1;break e;case 3:case 4:Rs=s.stateNode.containerInfo,js=!0;break e}s=s.return}if(null===Rs)throw Error(a(160));Us(o,l,i),Rs=null,js=!1,null!==(o=i.alternate)&&(o.return=null),i.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)Ks(t,e),t=t.sibling}var Hs=null;function Ks(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vs(t,e),Gs(e),4&r&&(vs(3,e,e.return),ys(3,e),vs(5,e,e.return));break;case 1:Vs(t,e),Gs(e),512&r&&(Ms||null===n||Cs(n,n.return)),64&r&&As&&(null!==(e=e.updateQueue)&&(null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r))));break;case 26:var i=Hs;if(Vs(t,e),Gs(e),512&r&&(Ms||null===n||Cs(n,n.return)),4&r){var o=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":(!(o=i.getElementsByTagName("title")[0])||o[Ye]||o[Be]||"http://www.w3.org/2000/svg"===o.namespaceURI||o.hasAttribute("itemprop"))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector("head > title"))),pd(o,r,n),o[Be]=e,nt(o),r=o;break e;case"link":var l=am("link","href",i).get(r+(n.href||""));if(l)for(var s=0;s<l.length;s++)if((o=l[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&o.getAttribute("rel")===(null==n.rel?null:n.rel)&&o.getAttribute("title")===(null==n.title?null:n.title)&&o.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){l.splice(s,1);break t}pd(o=i.createElement(r),r,n),i.head.appendChild(o);break;case"meta":if(l=am("meta","content",i).get(r+(n.content||"")))for(s=0;s<l.length;s++)if((o=l[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&o.getAttribute("name")===(null==n.name?null:n.name)&&o.getAttribute("property")===(null==n.property?null:n.property)&&o.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&o.getAttribute("charset")===(null==n.charSet?null:n.charSet)){l.splice(s,1);break t}pd(o=i.createElement(r),r,n),i.head.appendChild(o);break;default:throw Error(a(468,r))}o[Be]=e,nt(o),r=o}e.stateNode=r}else im(i,e.type,e.stateNode);else e.stateNode=Zd(i,r,e.memoizedProps);else o!==r?(null===o?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):o.count--,null===r?im(i,e.type,e.stateNode):Zd(i,r,e.memoizedProps)):null===r&&null!==e.stateNode&&Ns(e,e.memoizedProps,n.memoizedProps)}break;case 27:Vs(t,e),Gs(e),512&r&&(Ms||null===n||Cs(n,n.return)),null!==n&&4&r&&Ns(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Vs(t,e),Gs(e),512&r&&(Ms||null===n||Cs(n,n.return)),32&e.flags){i=e.stateNode;try{Et(i,"")}catch(f){Nu(e,e.return,f)}}4&r&&null!=e.stateNode&&Ns(e,i=e.memoizedProps,null!==n?n.memoizedProps:i),1024&r&&(Ps=!0);break;case 6:if(Vs(t,e),Gs(e),4&r){if(null===e.stateNode)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(f){Nu(e,e.return,f)}}break;case 3:if(rm=null,i=Hs,Hs=Bd(t.containerInfo),Vs(t,e),Hs=i,Gs(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Hm(t.containerInfo)}catch(f){Nu(e,e.return,f)}Ps&&(Ps=!1,Qs(e));break;case 4:r=Hs,Hs=Bd(e.stateNode.containerInfo),Vs(t,e),Gs(e),Hs=r;break;case 12:default:Vs(t,e),Gs(e);break;case 31:case 19:Vs(t,e),Gs(e),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Ws(e,r)));break;case 13:Vs(t,e),Gs(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Ic=ue()),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Ws(e,r)));break;case 22:i=null!==e.memoizedState;var c=null!==n&&null!==n.memoizedState,u=As,d=Ms;if(As=u||i,Ms=d||c,Vs(t,e),Ms=d,As=u,Gs(e),8192&r)e:for(t=e.stateNode,t._visibility=i?-2&t._visibility:1|t._visibility,i&&(null===n||c||As||Ms||Xs(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){c=n=t;try{if(o=c.stateNode,i)"function"==typeof(l=o.style).setProperty?l.setProperty("display","none","important"):l.display="none";else{s=c.stateNode;var m=c.memoizedProps.style,h=null!=m&&m.hasOwnProperty("display")?m.display:null;s.style.display=null==h||"boolean"==typeof h?"":(""+h).trim()}}catch(f){Nu(c,c.return,f)}}}else if(6===t.tag){if(null===n){c=t;try{c.stateNode.nodeValue=i?"":c.memoizedProps}catch(f){Nu(c,c.return,f)}}}else if(18===t.tag){if(null===n){c=t;try{var p=c.stateNode;i?Td(p,!0):Td(c.stateNode,!1)}catch(f){Nu(c,c.return,f)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&(null!==(r=e.updateQueue)&&(null!==(n=r.retryQueue)&&(r.retryQueue=null,Ws(e,n))));case 30:case 21:}}function Gs(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(Es(r)){n=r;break}r=r.return}if(null==n)throw Error(a(160));switch(n.tag){case 27:var i=n.stateNode;zs(e,$s(e),i);break;case 5:var o=n.stateNode;32&n.flags&&(Et(o,""),n.flags&=-33),zs(e,$s(e),o);break;case 3:case 4:var l=n.stateNode.containerInfo;_s(e,$s(e),l);break;default:throw Error(a(161))}}catch(s){Nu(e,e.return,s)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Qs(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;Qs(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function Ys(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Ds(e,t.alternate,t),t=t.sibling}function Xs(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:vs(4,t,t.return),Xs(t);break;case 1:Cs(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&xs(t,t.return,n),Xs(t);break;case 27:Fd(t.stateNode);case 26:case 5:Cs(t,t.return),Xs(t);break;case 22:null===t.memoizedState&&Xs(t);break;default:Xs(t)}e=e.sibling}}function Js(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,a=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:Js(a,i,n),ys(4,i);break;case 1:if(Js(a,i,n),"function"==typeof(a=(r=i).stateNode).componentDidMount)try{a.componentDidMount()}catch(c){Nu(r,r.return,c)}if(null!==(a=(r=i).updateQueue)){var l=r.stateNode;try{var s=a.shared.hiddenCallbacks;if(null!==s)for(a.shared.hiddenCallbacks=null,a=0;a<s.length;a++)$i(s[a],l)}catch(c){Nu(r,r.return,c)}}n&&64&o&&ws(i),ks(i,i.return);break;case 27:Ts(i);case 26:case 5:Js(a,i,n),n&&null===r&&4&o&&Ss(i),ks(i,i.return);break;case 12:Js(a,i,n);break;case 31:Js(a,i,n),n&&4&o&&qs(a,i);break;case 13:Js(a,i,n),n&&4&o&&Bs(a,i);break;case 22:null===i.memoizedState&&Js(a,i,n),ks(i,i.return);break;case 30:break;default:Js(a,i,n)}t=t.sibling}}function Zs(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&qa(n))}function ec(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&qa(e))}function tc(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)nc(e,t,n,r),t=t.sibling}function nc(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:tc(e,t,n,r),2048&a&&ys(9,t);break;case 1:case 31:case 13:default:tc(e,t,n,r);break;case 3:tc(e,t,n,r),2048&a&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&qa(e)));break;case 12:if(2048&a){tc(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,l=i.onPostCommit;"function"==typeof l&&l(o,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(s){Nu(t,t.return,s)}}else tc(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,null!==t.memoizedState?2&i._visibility?tc(e,t,n,r):ac(e,t):2&i._visibility?tc(e,t,n,r):(i._visibility|=2,rc(e,t,n,r,!!(10256&t.subtreeFlags)||!1)),2048&a&&Zs(o,t);break;case 24:tc(e,t,n,r),2048&a&&ec(t.alternate,t)}}function rc(e,t,n,r,a){for(a=a&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var i=e,o=t,l=n,s=r,c=o.flags;switch(o.tag){case 0:case 11:case 15:rc(i,o,l,s,a),ys(8,o);break;case 23:break;case 22:var u=o.stateNode;null!==o.memoizedState?2&u._visibility?rc(i,o,l,s,a):ac(i,o):(u._visibility|=2,rc(i,o,l,s,a)),a&&2048&c&&Zs(o.alternate,o);break;case 24:rc(i,o,l,s,a),a&&2048&c&&ec(o.alternate,o);break;default:rc(i,o,l,s,a)}t=t.sibling}}function ac(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:ac(n,r),2048&a&&Zs(r.alternate,r);break;case 24:ac(n,r),2048&a&&ec(r.alternate,r);break;default:ac(n,r)}t=t.sibling}}var ic=8192;function oc(e,t,n){if(e.subtreeFlags&ic)for(e=e.child;null!==e;)lc(e,t,n),e=e.sibling}function lc(e,t,n){switch(e.tag){case 26:oc(e,t,n),e.flags&ic&&null!==e.memoizedState&&function(e,t,n,r){if(!("stylesheet"!==n.type||"string"==typeof r.media&&!1===matchMedia(r.media).matches||4&n.state.loading)){if(null===n.instance){var a=Gd(r.href),i=t.querySelector(Qd(a));if(i)return null!==(t=i._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=sm.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,void nt(i);i=t.ownerDocument||t,r=Yd(r),(a=Ud.get(a))&&tm(r,a),nt(i=i.createElement("link"));var o=i;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),pd(i,"link",r),n.instance=i}null===e.stylesheets&&(e.stylesheets=/* @__PURE__ */new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(3&n.state.loading)&&(e.count++,n=sm.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}(n,Hs,e.memoizedState,e.memoizedProps);break;case 5:default:oc(e,t,n);break;case 3:case 4:var r=Hs;Hs=Bd(e.stateNode.containerInfo),oc(e,t,n),Hs=r;break;case 22:null===e.memoizedState&&(null!==(r=e.alternate)&&null!==r.memoizedState?(r=ic,ic=16777216,oc(e,t,n),ic=r):oc(e,t,n))}}function sc(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function cc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Ls=r,mc(r,e)}sc(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)uc(e),e=e.sibling}function uc(e){switch(e.tag){case 0:case 11:case 15:cc(e),2048&e.flags&&vs(9,e,e.return);break;case 3:case 12:default:cc(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,dc(e)):cc(e)}}function dc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Ls=r,mc(r,e)}sc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:vs(8,t,t.return),dc(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,dc(t));break;default:dc(t)}e=e.sibling}}function mc(e,t){for(;null!==Ls;){var n=Ls;switch(n.tag){case 0:case 11:case 15:vs(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:qa(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Ls=r;else e:for(n=e;null!==Ls;){var a=(r=Ls).sibling,i=r.return;if(Os(r),r===n){Ls=null;break e}if(null!==a){a.return=i,Ls=a;break e}Ls=i}}}var hc={getCacheForType:function(e){var t=Ia(Fa),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ia(Fa).controller.signal}},pc="function"==typeof WeakMap?WeakMap:Map,fc=0,gc=null,bc=null,yc=0,vc=0,wc=null,xc=!1,kc=!1,Cc=!1,Sc=0,Nc=0,Ec=0,$c=0,_c=0,zc=0,Tc=0,Ac=null,Mc=null,Pc=!1,Ic=0,Lc=0,Dc=1/0,Oc=null,Rc=null,jc=0,Fc=null,Uc=null,qc=0,Bc=0,Wc=null,Vc=null,Hc=0,Kc=null;function Gc(){return 2&fc&&0!==yc?yc&-yc:null!==D.T?Wu():Fe()}function Qc(){if(0===zc)if(536870912&yc&&!ha)zc=536870912;else{var e=Ee;!(3932160&(Ee<<=1))&&(Ee=262144),zc=e}return null!==(e=Ii.current)&&(e.flags|=32),zc}function Yc(e,t,n){(e!==gc||2!==vc&&9!==vc)&&null===e.cancelPendingCommit||(ru(e,0),eu(e,yc,zc,!1)),Ie(e,n),2&fc&&e===gc||(e===gc&&(!(2&fc)&&($c|=n),4===Nc&&eu(e,yc,zc,!1)),Ou(e))}function Xc(e,t,n){if(6&fc)throw Error(a(327));for(var r=!n&&!(127&t)&&0===(t&e.expiredLanes)||Te(e,t),i=r?function(e,t){var n=fc;fc|=2;var r=ou(),i=lu();gc!==e||yc!==t?(Oc=null,Dc=ue()+500,ru(e,t)):kc=Te(e,t);e:for(;;)try{if(0!==vc&&null!==bc){t=bc;var o=wc;t:switch(vc){case 1:vc=0,wc=null,pu(e,t,o,1);break;case 2:case 9:if(ri(o)){vc=0,wc=null,hu(t);break}t=function(){2!==vc&&9!==vc||gc!==e||(vc=7),Ou(e)},o.then(t,t);break e;case 3:vc=7;break e;case 4:vc=5;break e;case 7:ri(o)?(vc=0,wc=null,hu(t)):(vc=0,wc=null,pu(e,t,o,7));break;case 5:var l=null;switch(bc.tag){case 26:l=bc.memoizedState;case 5:case 27:var s=bc;if(l?om(l):s.stateNode.complete){vc=0,wc=null;var c=s.sibling;if(null!==c)bc=c;else{var u=s.return;null!==u?(bc=u,fu(u)):bc=null}break t}}vc=0,wc=null,pu(e,t,o,5);break;case 6:vc=0,wc=null,pu(e,t,o,6);break;case 8:nu(),Nc=6;break e;default:throw Error(a(462))}}du();break}catch(d){au(e,d)}return Ea=Na=null,D.H=r,D.A=i,fc=n,null!==bc?0:(gc=null,yc=0,Mr(),Nc)}(e,t):cu(e,t,!0),o=r;;){if(0===i){kc&&!r&&eu(e,t,0,!1);break}if(n=e.current.alternate,!o||Zc(n)){if(2===i){if(o=t,e.errorRecoveryDisabledLanes&o)var l=0;else l=0!==(l=-536870913&e.pendingLanes)?l:536870912&l?536870912:0;if(0!==l){t=l;e:{var s=e;i=Ac;var c=s.current.memoizedState.isDehydrated;if(c&&(ru(s,l).flags|=256),2!==(l=cu(s,l,!1))){if(Cc&&!c){s.errorRecoveryDisabledLanes|=o,$c|=o,i=4;break e}o=Mc,Mc=i,null!==o&&(null===Mc?Mc=o:Mc.push.apply(Mc,o))}i=l}if(o=!1,2!==i)continue}}if(1===i){ru(e,0),eu(e,t,0,!0);break}e:{switch(r=e,o=i){case 0:case 1:throw Error(a(345));case 4:if((4194048&t)!==t)break;case 6:eu(r,t,zc,!xc);break e;case 2:Mc=null;break;case 3:case 5:break;default:throw Error(a(329))}if((62914560&t)===t&&10<(i=Ic+300-ue())){if(eu(r,t,zc,!xc),0!==ze(r,0,!0))break e;qc=t,r.timeoutHandle=Cd(Jc.bind(null,r,n,Mc,Oc,Pc,t,zc,$c,Tc,xc,o,"Throttled",-0,0),i)}else Jc(r,n,Mc,Oc,Pc,t,zc,$c,Tc,xc,o,null,-0,0)}break}i=cu(e,t,!1),o=!1}Ou(e)}function Jc(e,t,n,r,a,i,o,l,s,c,u,d,m,h){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){lc(t,i,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:It});var p=(62914560&i)===i?Ic-ue():(4194048&i)===i?Lc-ue():0;if(null!==(p=function(e,t){return e.stylesheets&&0===e.count&&um(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&um(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===lm&&(lm=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var a=n[r],i=a.transferSize,o=a.initiatorType,l=a.duration;if(i&&l&&fd(o)){for(o=0,l=a.responseEnd,r+=1;r<n.length;r++){var s=n[r],c=s.startTime;if(c>l)break;var u=s.transferSize,d=s.initiatorType;u&&fd(d)&&(o+=u*((s=s.responseEnd)<l?1:(l-c)/(s-c)))}if(--r,t+=8*(i+o)/(a.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var a=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&um(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>lm?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}(d,p)))return qc=i,e.cancelPendingCommit=p(bu.bind(null,e,t,i,n,r,a,o,l,s,u,d,null,m,h)),void eu(e,i,o,!c)}bu(e,t,i,n,r,a,o,l,s)}function Zc(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&(null!==(n=t.updateQueue)&&null!==(n=n.stores)))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!er(i(),a))return!1}catch(o){return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function eu(e,t,n,r){t&=~_c,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var i=31-ke(a),o=1<<i;r[i]=-1,a&=~o}0!==n&&Le(e,n,t)}function tu(){return!!(6&fc)||(Ru(0),!1)}function nu(){if(null!==bc){if(0===vc)var e=bc.return;else Ea=Na=null,so(e=bc),ci=null,ui=0,e=bc;for(;null!==e;)bs(e.alternate,e),e=e.return;bc=null}}function ru(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,Sd(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),qc=0,nu(),gc=e,bc=n=qr(e.current,null),yc=t,vc=0,wc=null,xc=!1,kc=Te(e,t),Cc=!1,Tc=zc=_c=$c=Ec=Nc=0,Mc=Ac=null,Pc=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var a=31-ke(r),i=1<<a;t|=e[a],r&=~i}return Sc=t,Mr(),n}function au(e,t){Wi=null,D.H=bl,t===Za||t===ti?(t=li(),vc=3):t===ei?(t=li(),vc=4):vc=t===Il?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,wc=t,null===bc&&(Nc=1,zl(e,Yr(t,e.current)))}function iu(){var e=Ii.current;return null===e||((4194048&yc)===yc?null===Li:!!((62914560&yc)===yc||536870912&yc)&&e===Li)}function ou(){var e=D.H;return D.H=bl,null===e?bl:e}function lu(){var e=D.A;return D.A=hc,e}function su(){Nc=4,xc||(4194048&yc)!==yc&&null!==Ii.current||(kc=!0),!(134217727&Ec)&&!(134217727&$c)||null===gc||eu(gc,yc,zc,!1)}function cu(e,t,n){var r=fc;fc|=2;var a=ou(),i=lu();gc===e&&yc===t||(Oc=null,ru(e,t)),t=!1;var o=Nc;e:for(;;)try{if(0!==vc&&null!==bc){var l=bc,s=wc;switch(vc){case 8:nu(),o=6;break e;case 3:case 2:case 9:case 6:null===Ii.current&&(t=!0);var c=vc;if(vc=0,wc=null,pu(e,l,s,c),n&&kc){o=0;break e}break;default:c=vc,vc=0,wc=null,pu(e,l,s,c)}}uu(),o=Nc;break}catch(u){au(e,u)}return t&&e.shellSuspendCounter++,Ea=Na=null,fc=r,D.H=a,D.A=i,null===bc&&(gc=null,yc=0,Mr()),o}function uu(){for(;null!==bc;)mu(bc)}function du(){for(;null!==bc&&!se();)mu(bc)}function mu(e){var t=ss(e.alternate,e,Sc);e.memoizedProps=e.pendingProps,null===t?fu(e):bc=t}function hu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Kl(n,t,t.pendingProps,t.type,void 0,yc);break;case 11:t=Kl(n,t,t.pendingProps,t.type.render,t.ref,yc);break;case 5:so(t);default:bs(n,t),t=ss(n,t=bc=Br(t,Sc),Sc)}e.memoizedProps=e.pendingProps,null===t?fu(e):bc=t}function pu(e,t,n,r){Ea=Na=null,so(t),ci=null,ui=0;var i=t.return;try{if(function(e,t,n,r,i){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Aa(t,n,i,!0),null!==(n=Ii.current)){switch(n.tag){case 31:case 13:return null===Li?su():null===n.alternate&&0===Nc&&(Nc=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ni?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=/* @__PURE__ */new Set([r]):t.add(r),Eu(e,r,i)),!1;case 22:return n.flags|=65536,r===ni?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:/* @__PURE__ */new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=/* @__PURE__ */new Set([r]):n.add(r),Eu(e,r,i)),!1}throw Error(a(435,n.tag))}return Eu(e,r,i),su(),!1}if(ha)return null!==(t=Ii.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==ga&&Ca(Yr(e=Error(a(422),{cause:r}),n))):(r!==ga&&Ca(Yr(t=Error(a(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,i&=-i,e.lanes|=i,r=Yr(r,n),Ci(e,i=Al(e.stateNode,r,i)),4!==Nc&&(Nc=2)),!1;var o=Error(a(520),{cause:r});if(o=Yr(o,n),null===Ac?Ac=[o]:Ac.push(o),4!==Nc&&(Nc=2),null===t)return!0;r=Yr(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,Ci(n,e=Al(n.stateNode,r,e)),!1;case 1:if(t=n.type,o=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===o||"function"!=typeof o.componentDidCatch||null!==Rc&&Rc.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,Pl(i=Ml(i),e,n,r),Ci(n,i),!1}n=n.return}while(null!==n);return!1}(e,i,t,n,yc))return Nc=1,zl(e,Yr(n,e.current)),void(bc=null)}catch(o){if(null!==i)throw bc=i,o;return Nc=1,zl(e,Yr(n,e.current)),void(bc=null)}32768&t.flags?(ha||1===r?e=!0:kc||536870912&yc?e=!1:(xc=e=!0,(2===r||9===r||3===r||6===r)&&(null!==(r=Ii.current)&&13===r.tag&&(r.flags|=16384))),gu(t,e)):fu(t)}function fu(e){var t=e;do{if(32768&t.flags)return void gu(t,xc);e=t.return;var n=fs(t.alternate,t,Sc);if(null!==n)return void(bc=n);if(null!==(t=t.sibling))return void(bc=t);bc=t=e}while(null!==t);0===Nc&&(Nc=5)}function gu(e,t){do{var n=gs(e.alternate,e);if(null!==n)return n.flags&=32767,void(bc=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(bc=e);bc=e=n}while(null!==e);Nc=6,bc=null}function bu(e,t,n,r,i,o,l,s,c){e.cancelPendingCommit=null;do{ku()}while(0!==jc);if(6&fc)throw Error(a(327));if(null!==t){if(t===e.current)throw Error(a(177));if(o=t.lanes|t.childLanes,function(e,t,n,r,a,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-ke(n),d=1<<u;l[u]=0,s[u]=-1;var m=c[u];if(null!==m)for(c[u]=null,u=0;u<m.length;u++){var h=m[u];null!==h&&(h.lane&=-536870913)}n&=~d}0!==r&&Le(e,r,0),0!==i&&0===a&&0!==e.tag&&(e.suspendedLanes|=i&~(o&~t))}(e,n,o|=Ar,l,s,c),e===gc&&(bc=gc=null,yc=0),Uc=t,Fc=e,qc=n,Bc=o,Wc=i,Vc=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,oe(pe,function(){return Cu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=D.T,D.T=null,i=O.p,O.p=2,l=fc,fc|=4;try{!function(e,t){if(e=e.containerInfo,gd=xm,or(e=ir(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(g){n=null;break e}var l=0,s=-1,c=-1,u=0,d=0,m=e,h=null;t:for(;;){for(var p;m!==n||0!==i&&3!==m.nodeType||(s=l+i),m!==o||0!==r&&3!==m.nodeType||(c=l+r),3===m.nodeType&&(l+=m.nodeValue.length),null!==(p=m.firstChild);)h=m,m=p;for(;;){if(m===e)break t;if(h===n&&++u===i&&(s=l),h===o&&++d===r&&(c=l),null!==(p=m.nextSibling))break;h=(m=h).parentNode}m=p}n=-1===s||-1===c?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(bd={focusedElem:e,selectionRange:n},xm=!1,Ls=t;null!==Ls;)if(e=(t=Ls).child,1028&t.subtreeFlags&&null!==e)e.return=t,Ls=e;else for(;null!==Ls;){switch(o=(t=Ls).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(n=0;n<e.length;n++)(i=e[n]).ref.impl=i.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==o){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var f=Nl(n.type,i);e=r.getSnapshotBeforeUpdate(f,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(b){Nu(n,n.return,b)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))Ad(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ad(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(a(163))}if(null!==(e=t.sibling)){e.return=t.return,Ls=e;break}Ls=t.return}}(e,t)}finally{fc=l,O.p=i,D.T=r}}jc=1,yu(),vu(),wu()}}function yu(){if(1===jc){jc=0;var e=Fc,t=Uc,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=D.T,D.T=null;var r=O.p;O.p=2;var a=fc;fc|=4;try{Ks(t,e);var i=bd,o=ir(e.containerInfo),l=i.focusedElem,s=i.selectionRange;if(o!==l&&l&&l.ownerDocument&&ar(l.ownerDocument.documentElement,l)){if(null!==s&&or(l)){var c=s.start,u=s.end;if(void 0===u&&(u=c),"selectionStart"in l)l.selectionStart=c,l.selectionEnd=Math.min(u,l.value.length);else{var d=l.ownerDocument||document,m=d&&d.defaultView||window;if(m.getSelection){var h=m.getSelection(),p=l.textContent.length,f=Math.min(s.start,p),g=void 0===s.end?f:Math.min(s.end,p);!h.extend&&f>g&&(o=g,g=f,f=o);var b=rr(l,f),y=rr(l,g);if(b&&y&&(1!==h.rangeCount||h.anchorNode!==b.node||h.anchorOffset!==b.offset||h.focusNode!==y.node||h.focusOffset!==y.offset)){var v=d.createRange();v.setStart(b.node,b.offset),h.removeAllRanges(),f>g?(h.addRange(v),h.extend(y.node,y.offset)):(v.setEnd(y.node,y.offset),h.addRange(v))}}}}for(d=[],h=l;h=h.parentNode;)1===h.nodeType&&d.push({element:h,left:h.scrollLeft,top:h.scrollTop});for("function"==typeof l.focus&&l.focus(),l=0;l<d.length;l++){var w=d[l];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}xm=!!gd,bd=gd=null}finally{fc=a,O.p=r,D.T=n}}e.current=t,jc=2}}function vu(){if(2===jc){jc=0;var e=Fc,t=Uc,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=D.T,D.T=null;var r=O.p;O.p=2;var a=fc;fc|=4;try{Ds(e,t.alternate,t)}finally{fc=a,O.p=r,D.T=n}}jc=3}}function wu(){if(4===jc||3===jc){jc=0,ce();var e=Fc,t=Uc,n=qc,r=Vc;10256&t.subtreeFlags||10256&t.flags?jc=5:(jc=0,Uc=Fc=null,xu(e,e.pendingLanes));var a=e.pendingLanes;if(0===a&&(Rc=null),je(n),t=t.stateNode,we&&"function"==typeof we.onCommitFiberRoot)try{we.onCommitFiberRoot(ve,t,void 0,!(128&~t.current.flags))}catch(s){}if(null!==r){t=D.T,a=O.p,O.p=2,D.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];i(l.value,{componentStack:l.stack})}}finally{D.T=t,O.p=a}}3&qc&&ku(),Ou(e),a=e.pendingLanes,261930&n&&42&a?e===Kc?Hc++:(Hc=0,Kc=e):Hc=0,Ru(0)}}function xu(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,qa(t)))}function ku(){return yu(),vu(),wu(),Cu()}function Cu(){if(5!==jc)return!1;var e=Fc,t=Bc;Bc=0;var n=je(qc),r=D.T,i=O.p;try{O.p=32>n?32:n,D.T=null,n=Wc,Wc=null;var o=Fc,l=qc;if(jc=0,Uc=Fc=null,qc=0,6&fc)throw Error(a(331));var s=fc;if(fc|=4,uc(o.current),nc(o,o.current,l,n),fc=s,Ru(0,!1),we&&"function"==typeof we.onPostCommitFiberRoot)try{we.onPostCommitFiberRoot(ve,o)}catch(c){}return!0}finally{O.p=i,D.T=r,xu(e,t)}}function Su(e,t,n){t=Yr(n,t),null!==(e=xi(e,t=Al(e.stateNode,t,2),2))&&(Ie(e,2),Ou(e))}function Nu(e,t,n){if(3===e.tag)Su(e,e,n);else for(;null!==t;){if(3===t.tag){Su(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Rc||!Rc.has(r))){e=Yr(n,e),null!==(r=xi(t,n=Ml(2),2))&&(Pl(n,r,t,e),Ie(r,2),Ou(r));break}}t=t.return}}function Eu(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new pc;var a=/* @__PURE__ */new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=/* @__PURE__ */new Set,r.set(t,a));a.has(n)||(Cc=!0,a.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,gc===e&&(yc&n)===n&&(4===Nc||3===Nc&&(62914560&yc)===yc&&300>ue()-Ic?!(2&fc)&&ru(e,0):_c|=n,Tc===yc&&(Tc=0)),Ou(e)}function _u(e,t){0===t&&(t=Me()),null!==(e=Lr(e,t))&&(Ie(e,t),Ou(e))}function zu(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),_u(e,n)}function Tu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}null!==r&&r.delete(t),_u(e,n)}var Au=null,Mu=null,Pu=!1,Iu=!1,Lu=!1,Du=0;function Ou(e){e!==Mu&&null===e.next&&(null===Mu?Au=Mu=e:Mu=Mu.next=e),Iu=!0,Pu||(Pu=!0,Ed(function(){6&fc?oe(me,ju):Fu()}))}function Ru(e,t){if(!Lu&&Iu){Lu=!0;do{for(var n=!1,r=Au;null!==r;){if(0!==e){var a=r.pendingLanes;if(0===a)var i=0;else{var o=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-ke(42|e)+1)-1,i=201326741&(i&=a&~(o&~l))?201326741&i|1:i?2|i:0}0!==i&&(n=!0,Bu(r,i))}else i=yc,!(3&(i=ze(r,r===gc?i:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||Te(r,i)||(n=!0,Bu(r,i));r=r.next}}while(n);Lu=!1}}function ju(){Fu()}function Fu(){Iu=Pu=!1;var e=0;0!==Du&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==kd&&(kd=e,!0);return kd=null,!1}()&&(e=Du);for(var t=ue(),n=null,r=Au;null!==r;){var a=r.next,i=Uu(r,t);0===i?(r.next=null,null===n?Au=a:n.next=a,null===a&&(Mu=n)):(n=r,(0!==e||3&i)&&(Iu=!0)),r=a}0!==jc&&5!==jc||Ru(e),0!==Du&&(Du=0)}function Uu(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=-62914561&e.pendingLanes;0<i;){var o=31-ke(i),l=1<<o,s=a[o];-1===s?0!==(l&n)&&0===(l&r)||(a[o]=Ae(l,t)):s<=t&&(e.expiredLanes|=l),i&=~l}if(n=yc,n=ze(e,e===(t=gc)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===vc||9===vc)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&le(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||Te(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&le(r),je(n)){case 2:case 8:n=he;break;case 32:default:n=pe;break;case 268435456:n=ge}return r=qu.bind(null,e),n=oe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&le(r),e.callbackPriority=2,e.callbackNode=null,2}function qu(e,t){if(0!==jc&&5!==jc)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ku()&&e.callbackNode!==n)return null;var r=yc;return 0===(r=ze(e,e===gc?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Xc(e,r,t),Uu(e,ue()),null!=e.callbackNode&&e.callbackNode===n?qu.bind(null,e):null)}function Bu(e,t){if(ku())return null;Xc(e,t,!0)}function Wu(){if(0===Du){var e=Va;0===e&&(e=Ne,!(261888&(Ne<<=1))&&(Ne=256)),Du=e}return Du}function Vu(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Pt(""+e)}function Hu(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}for(var Ku=0;Ku<Er.length;Ku++){var Gu=Er[Ku];$r(Gu.toLowerCase(),"on"+(Gu[0].toUpperCase()+Gu.slice(1)))}$r(yr,"onAnimationEnd"),$r(vr,"onAnimationIteration"),$r(wr,"onAnimationStart"),$r("dblclick","onDoubleClick"),$r("focusin","onFocus"),$r("focusout","onBlur"),$r(xr,"onTransitionRun"),$r(kr,"onTransitionStart"),$r(Cr,"onTransitionCancel"),$r(Sr,"onTransitionEnd"),ot("onMouseEnter",["mouseout","mouseover"]),ot("onMouseLeave",["mouseout","mouseover"]),ot("onPointerEnter",["pointerout","pointerover"]),ot("onPointerLeave",["pointerout","pointerover"]),it("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),it("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),it("onBeforeInput",["compositionend","keypress","textInput","paste"]),it("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),it("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),it("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Yu=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qu));function Xu(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],s=l.instance,c=l.currentTarget;if(l=l.listener,s!==i&&a.isPropagationStopped())break e;i=l,a.currentTarget=c;try{i(a)}catch(u){_r(u)}a.currentTarget=null,i=s}else for(o=0;o<r.length;o++){if(s=(l=r[o]).instance,c=l.currentTarget,l=l.listener,s!==i&&a.isPropagationStopped())break e;i=l,a.currentTarget=c;try{i(a)}catch(u){_r(u)}a.currentTarget=null,i=s}}}}function Ju(e,t){var n=t[He];void 0===n&&(n=t[He]=/* @__PURE__ */new Set);var r=e+"__bubble";n.has(r)||(nd(t,e,2,!1),n.add(r))}function Zu(e,t,n){var r=0;t&&(r|=4),nd(n,e,r,t)}var ed="_reactListening"+Math.random().toString(36).slice(2);function td(e){if(!e[ed]){e[ed]=!0,rt.forEach(function(t){"selectionchange"!==t&&(Yu.has(t)||Zu(t,!1,e),Zu(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[ed]||(t[ed]=!0,Zu("selectionchange",!1,t))}}function nd(e,t,n,r){switch(_m(t)){case 2:var a=km;break;case 8:a=Cm;break;default:a=Sm}n=a.bind(null,t,n,e),a=void 0,!Wt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function rd(e,t,n,r,a){var i=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var o=r.tag;if(3===o||4===o){var s=r.stateNode.containerInfo;if(s===a)break;if(4===o)for(o=r.return;null!==o;){var c=o.tag;if((3===c||4===c)&&o.stateNode.containerInfo===a)return;o=o.return}for(;null!==s;){if(null===(o=Je(s)))return;if(5===(c=o.tag)||6===c||26===c||27===c){r=i=o;continue e}s=s.parentNode}}r=r.return}Ut(function(){var r=i,a=Dt(n),o=[];e:{var s=Nr.get(e);if(void 0!==s){var c=an,u=e;switch(e){case"keypress":if(0===Yt(n))break e;case"keydown":case"keyup":c=wn;break;case"focusin":u="focus",c=dn;break;case"focusout":u="blur",c=dn;break;case"beforeblur":case"afterblur":c=dn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=cn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=un;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=kn;break;case yr:case vr:case wr:c=mn;break;case Sr:c=Cn;break;case"scroll":case"scrollend":c=ln;break;case"wheel":c=Sn;break;case"copy":case"cut":case"paste":c=hn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=xn;break;case"toggle":case"beforetoggle":c=Nn}var d=!!(4&t),m=!d&&("scroll"===e||"scrollend"===e),h=d?null!==s?s+"Capture":null:s;d=[];for(var p,f=r;null!==f;){var g=f;if(p=g.stateNode,5!==(g=g.tag)&&26!==g&&27!==g||null===p||null===h||null!=(g=qt(f,h))&&d.push(ad(f,g,p)),m)break;f=f.return}0<d.length&&(s=new c(s,u,null,n,a),o.push({event:s,listeners:d}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===Lt||!(u=n.relatedTarget||n.fromElement)||!Je(u)&&!u[Ve])&&(c||s)&&(s=a.window===a?a:(s=a.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=r,null!==(u=(u=n.relatedTarget||n.toElement)?Je(u):null)&&(m=l(u),d=u.tag,u!==m||5!==d&&27!==d&&6!==d)&&(u=null)):(c=null,u=r),c!==u)){if(d=cn,g="onMouseLeave",h="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(d=xn,g="onPointerLeave",h="onPointerEnter",f="pointer"),m=null==c?s:et(c),p=null==u?s:et(u),(s=new d(g,f+"leave",c,n,a)).target=m,s.relatedTarget=p,g=null,Je(a)===r&&((d=new d(h,f+"enter",u,n,a)).target=p,d.relatedTarget=m,g=d),m=g,c&&u)e:{for(d=od,f=u,p=0,g=h=c;g;g=d(g))p++;g=0;for(var b=f;b;b=d(b))g++;for(;0<p-g;)h=d(h),p--;for(;0<g-p;)f=d(f),g--;for(;p--;){if(h===f||null!==f&&h===f.alternate){d=h;break e}h=d(h),f=d(f)}d=null}else d=null;null!==c&&ld(o,s,c,d,!1),null!==u&&null!==m&&ld(o,m,u,d,!0)}if("select"===(c=(s=r?et(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var y=Bn;else if(On(s))if(Wn)y=Zn;else{y=Xn;var v=Yn}else!(c=s.nodeName)||"input"!==c.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Tt(r.elementType)&&(y=Bn):y=Jn;switch(y&&(y=y(e,r))?Rn(o,y,n,a):(v&&v(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&kt(s,"number",s.value)),v=r?et(r):window,e){case"focusin":(On(v)||"true"===v.contentEditable)&&(sr=v,cr=r,ur=null);break;case"focusout":ur=cr=sr=null;break;case"mousedown":dr=!0;break;case"contextmenu":case"mouseup":case"dragend":dr=!1,mr(o,n,a);break;case"selectionchange":if(lr)break;case"keydown":case"keyup":mr(o,n,a)}var w;if($n)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else Ln?Pn(e,n)&&(x="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(x="onCompositionStart");x&&(Tn&&"ko"!==n.locale&&(Ln||"onCompositionStart"!==x?"onCompositionEnd"===x&&Ln&&(w=Qt()):(Kt="value"in(Ht=a)?Ht.value:Ht.textContent,Ln=!0)),0<(v=id(r,x)).length&&(x=new pn(x,e,null,n,a),o.push({event:x,listeners:v}),w?x.data=w:null!==(w=In(n))&&(x.data=w))),(w=zn?function(e,t){switch(e){case"compositionend":return In(t);case"keypress":return 32!==t.which?null:(Mn=!0,An);case"textInput":return(e=t.data)===An&&Mn?null:e;default:return null}}(e,n):function(e,t){if(Ln)return"compositionend"===e||!$n&&Pn(e,t)?(e=Qt(),Gt=Kt=Ht=null,Ln=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Tn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(x=id(r,"onBeforeInput")).length&&(v=new pn("onBeforeInput","beforeinput",null,n,a),o.push({event:v,listeners:x}),v.data=w)),function(e,t,n,r,a){if("submit"===t&&n&&n.stateNode===a){var i=Vu((a[We]||null).action),o=r.submitter;o&&null!==(t=(t=o[We]||null)?Vu(t.formAction):o.getAttribute("formAction"))&&(i=t,o=null);var l=new an("action","action",null,r,a);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==Du){var e=o?Hu(a,o):new FormData(a);rl(n,{pending:!0,data:e,method:a.method,action:i},null,e)}}else"function"==typeof i&&(l.preventDefault(),e=o?Hu(a,o):new FormData(a),rl(n,{pending:!0,data:e,method:a.method,action:i},i,e))},currentTarget:a}]})}}(o,e,r,n,a)}Xu(o,t)})}function ad(e,t,n){return{instance:e,listener:t,currentTarget:n}}function id(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,i=a.stateNode;if(5!==(a=a.tag)&&26!==a&&27!==a||null===i||(null!=(a=qt(e,n))&&r.unshift(ad(e,a,i)),null!=(a=qt(e,t))&&r.push(ad(e,a,i))),3===e.tag)return r;e=e.return}return[]}function od(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function ld(e,t,n,r,a){for(var i=t._reactName,o=[];null!==n&&n!==r;){var l=n,s=l.alternate,c=l.stateNode;if(l=l.tag,null!==s&&s===r)break;5!==l&&26!==l&&27!==l||null===c||(s=c,a?null!=(c=qt(n,i))&&o.unshift(ad(n,c,s)):a||null!=(c=qt(n,i))&&o.push(ad(n,c,s))),n=n.return}0!==o.length&&e.push({event:t,listeners:o})}var sd=/\r\n?/g,cd=/\u0000|\uFFFD/g;function ud(e){return("string"==typeof e?e:""+e).replace(sd,"\n").replace(cd,"")}function dd(e,t){return t=ud(t),ud(e)===t}function md(e,t,n,r,i,o){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||Et(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&Et(e,""+r);break;case"className":dt(e,"class",r);break;case"tabIndex":dt(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":dt(e,n,r);break;case"style":zt(e,r,o);break;case"data":if("object"!==t){dt(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Pt(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if("function"==typeof o&&("formAction"===n?("input"!==t&&md(e,t,"name",i.name,i,null),md(e,t,"formEncType",i.formEncType,i,null),md(e,t,"formMethod",i.formMethod,i,null),md(e,t,"formTarget",i.formTarget,i,null)):(md(e,t,"encType",i.encType,i,null),md(e,t,"method",i.method,i,null),md(e,t,"target",i.target,i,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Pt(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=It);break;case"onScroll":null!=r&&Ju("scroll",e);break;case"onScrollEnd":null!=r&&Ju("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(a(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(a(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=Pt(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Ju("beforetoggle",e),Ju("toggle",e),ut(e,"popover",r);break;case"xlinkActuate":mt(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":mt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":mt(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":mt(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":mt(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":mt(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":mt(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":mt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":mt(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":ut(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&ut(e,n=At.get(n)||n,r)}}function hd(e,t,n,r,i,o){switch(n){case"style":zt(e,r,o);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(a(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(a(60));e.innerHTML=n}}break;case"children":"string"==typeof r?Et(e,r):("number"==typeof r||"bigint"==typeof r)&&Et(e,""+r);break;case"onScroll":null!=r&&Ju("scroll",e);break;case"onScrollEnd":null!=r&&Ju("scrollend",e);break;case"onClick":null!=r&&(e.onclick=It);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:at.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),"function"==typeof(o=null!=(o=e[We]||null)?o[n]:null)&&e.removeEventListener(t,o,i),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):ut(e,n,r):("function"!=typeof o&&null!==o&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i)))}}function pd(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ju("error",e),Ju("load",e);var r,i=!1,o=!1;for(r in n)if(n.hasOwnProperty(r)){var l=n[r];if(null!=l)switch(r){case"src":i=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:md(e,t,r,l,n,null)}}return o&&md(e,t,"srcSet",n.srcSet,n,null),void(i&&md(e,t,"src",n.src,n,null));case"input":Ju("invalid",e);var s=r=l=o=null,c=null,u=null;for(i in n)if(n.hasOwnProperty(i)){var d=n[i];if(null!=d)switch(i){case"name":o=d;break;case"type":l=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":r=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(null!=d)throw Error(a(137,t));break;default:md(e,t,i,d,n,null)}}return void xt(e,r,s,c,u,l,o,!1);case"select":for(o in Ju("invalid",e),i=l=r=null,n)if(n.hasOwnProperty(o)&&null!=(s=n[o]))switch(o){case"value":r=s;break;case"defaultValue":l=s;break;case"multiple":i=s;default:md(e,t,o,s,n,null)}return t=r,n=l,e.multiple=!!i,void(null!=t?Ct(e,!!i,t,!1):null!=n&&Ct(e,!!i,n,!0));case"textarea":for(l in Ju("invalid",e),r=o=i=null,n)if(n.hasOwnProperty(l)&&null!=(s=n[l]))switch(l){case"value":i=s;break;case"defaultValue":o=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(a(91));break;default:md(e,t,l,s,n,null)}return void Nt(e,i,o,r);case"option":for(c in n)if(n.hasOwnProperty(c)&&null!=(i=n[c]))if("selected"===c)e.selected=i&&"function"!=typeof i&&"symbol"!=typeof i;else md(e,t,c,i,n,null);return;case"dialog":Ju("beforetoggle",e),Ju("toggle",e),Ju("cancel",e),Ju("close",e);break;case"iframe":case"object":Ju("load",e);break;case"video":case"audio":for(i=0;i<Qu.length;i++)Ju(Qu[i],e);break;case"image":Ju("error",e),Ju("load",e);break;case"details":Ju("toggle",e);break;case"embed":case"source":case"link":Ju("error",e),Ju("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&null!=(i=n[u]))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:md(e,t,u,i,n,null)}return;default:if(Tt(t)){for(d in n)n.hasOwnProperty(d)&&(void 0!==(i=n[d])&&hd(e,t,d,i,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(null!=(i=n[s])&&md(e,t,s,i,n,null))}function fd(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var gd=null,bd=null;function yd(e){return 9===e.nodeType?e:e.ownerDocument}function vd(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function wd(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function xd(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var kd=null;var Cd="function"==typeof setTimeout?setTimeout:void 0,Sd="function"==typeof clearTimeout?clearTimeout:void 0,Nd="function"==typeof Promise?Promise:void 0,Ed="function"==typeof queueMicrotask?queueMicrotask:void 0!==Nd?function(e){return Nd.resolve(null).then(e).catch($d)}:Cd;function $d(e){setTimeout(function(){throw e})}function _d(e){return"head"===e}function zd(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)||"/&"===n){if(0===r)return e.removeChild(a),void Hm(t);r--}else if("$"===n||"$?"===n||"$~"===n||"$!"===n||"&"===n)r++;else if("html"===n)Fd(e.ownerDocument.documentElement);else if("head"===n){Fd(n=e.ownerDocument.head);for(var i=n.firstChild;i;){var o=i.nextSibling,l=i.nodeName;i[Ye]||"SCRIPT"===l||"STYLE"===l||"LINK"===l&&"stylesheet"===i.rel.toLowerCase()||n.removeChild(i),i=o}}else"body"===n&&Fd(e.ownerDocument.body);n=a}while(n);Hm(t)}function Td(e,t){var n=e;e=0;do{var r=n.nextSibling;if(1===n.nodeType?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",""===n.getAttribute("style")&&n.removeAttribute("style")):3===n.nodeType&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===e)break;e--}else"$"!==n&&"$?"!==n&&"$~"!==n&&"$!"!==n||e++;n=r}while(n)}function Ad(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Ad(n),Xe(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function Md(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=Ld(e.nextSibling)))return null}return e}function Pd(e){return"$?"===e.data||"$~"===e.data}function Id(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function Ld(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Dd=null;function Od(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n||"/&"===n){if(0===t)return Ld(e.nextSibling);t--}else"$"!==n&&"$!"!==n&&"$?"!==n&&"$~"!==n&&"&"!==n||t++}e=e.nextSibling}return null}function Rd(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n||"$~"===n||"&"===n){if(0===t)return e;t--}else"/$"!==n&&"/&"!==n||t++}e=e.previousSibling}return null}function jd(e,t,n){switch(t=yd(n),e){case"html":if(!(e=t.documentElement))throw Error(a(452));return e;case"head":if(!(e=t.head))throw Error(a(453));return e;case"body":if(!(e=t.body))throw Error(a(454));return e;default:throw Error(a(451))}}function Fd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Xe(e)}var Ud=/* @__PURE__ */new Map,qd=/* @__PURE__ */new Set;function Bd(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Wd=O.d;O.d={f:function(){var e=Wd.f(),t=tu();return e||t},r:function(e){var t=Ze(e);null!==t&&5===t.tag&&"form"===t.type?il(t):Wd.r(e)},D:function(e){Wd.D(e),Hd("dns-prefetch",e,null)},C:function(e,t){Wd.C(e,t),Hd("preconnect",e,t)},L:function(e,t,n){Wd.L(e,t,n);var r=Vd;if(r&&e&&t){var a='link[rel="preload"][as="'+vt(t)+'"]';"image"===t&&n&&n.imageSrcSet?(a+='[imagesrcset="'+vt(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(a+='[imagesizes="'+vt(n.imageSizes)+'"]')):a+='[href="'+vt(e)+'"]';var i=a;switch(t){case"style":i=Gd(e);break;case"script":i=Xd(e)}Ud.has(i)||(e=m({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),Ud.set(i,e),null!==r.querySelector(a)||"style"===t&&r.querySelector(Qd(i))||"script"===t&&r.querySelector(Jd(i))||(pd(t=r.createElement("link"),"link",e),nt(t),r.head.appendChild(t)))}},m:function(e,t){Wd.m(e,t);var n=Vd;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",a='link[rel="modulepreload"][as="'+vt(r)+'"][href="'+vt(e)+'"]',i=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Xd(e)}if(!Ud.has(i)&&(e=m({rel:"modulepreload",href:e},t),Ud.set(i,e),null===n.querySelector(a))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Jd(i)))return}pd(r=n.createElement("link"),"link",e),nt(r),n.head.appendChild(r)}}},X:function(e,t){Wd.X(e,t);var n=Vd;if(n&&e){var r=tt(n).hoistableScripts,a=Xd(e),i=r.get(a);i||((i=n.querySelector(Jd(a)))||(e=m({src:e,async:!0},t),(t=Ud.get(a))&&nm(e,t),nt(i=n.createElement("script")),pd(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}},S:function(e,t,n){Wd.S(e,t,n);var r=Vd;if(r&&e){var a=tt(r).hoistableStyles,i=Gd(e);t=t||"default";var o=a.get(i);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Qd(i)))l.loading=5;else{e=m({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ud.get(i))&&tm(e,n);var s=o=r.createElement("link");nt(s),pd(s,"link",e),s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),s.addEventListener("load",function(){l.loading|=1}),s.addEventListener("error",function(){l.loading|=2}),l.loading|=4,em(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},a.set(i,o)}}},M:function(e,t){Wd.M(e,t);var n=Vd;if(n&&e){var r=tt(n).hoistableScripts,a=Xd(e),i=r.get(a);i||((i=n.querySelector(Jd(a)))||(e=m({src:e,async:!0,type:"module"},t),(t=Ud.get(a))&&nm(e,t),nt(i=n.createElement("script")),pd(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}}};var Vd="undefined"==typeof document?null:document;function Hd(e,t,n){var r=Vd;if(r&&"string"==typeof t&&t){var a=vt(t);a='link[rel="'+e+'"][href="'+a+'"]',"string"==typeof n&&(a+='[crossorigin="'+n+'"]'),qd.has(a)||(qd.add(a),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(a)&&(pd(t=r.createElement("link"),"link",e),nt(t),r.head.appendChild(t)))}}function Kd(e,t,n,r){var i,o,l,s,c=(c=G.current)?Bd(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=Gd(n.href),(r=(n=tt(c).hoistableStyles).get(t))||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=Gd(n.href);var u=tt(c).hoistableStyles,d=u.get(e);if(d||(c=c.ownerDocument||c,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,d),(u=c.querySelector(Qd(e)))&&!u._p&&(d.instance=u,d.state.loading=5),Ud.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ud.set(e,n),u||(i=c,o=e,l=n,s=d.state,i.querySelector('link[rel="preload"][as="style"]['+o+"]")?s.loading=1:(o=i.createElement("link"),s.preload=o,o.addEventListener("load",function(){return s.loading|=1}),o.addEventListener("error",function(){return s.loading|=2}),pd(o,"link",l),nt(o),i.head.appendChild(o))))),t&&null===r)throw Error(a(528,""));return d}if(t&&null!==r)throw Error(a(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Xd(n),(r=(n=tt(c).hoistableScripts).get(t))||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Gd(e){return'href="'+vt(e)+'"'}function Qd(e){return'link[rel="stylesheet"]['+e+"]"}function Yd(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Xd(e){return'[src="'+vt(e)+'"]'}function Jd(e){return"script[async]"+e}function Zd(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+vt(n.href)+'"]');if(r)return t.instance=r,nt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return nt(r=(e.ownerDocument||e).createElement("style")),pd(r,"style",i),em(r,n.precedence,e),t.instance=r;case"stylesheet":i=Gd(n.href);var o=e.querySelector(Qd(i));if(o)return t.state.loading|=4,t.instance=o,nt(o),o;r=Yd(n),(i=Ud.get(i))&&tm(r,i),nt(o=(e.ownerDocument||e).createElement("link"));var l=o;return l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),pd(o,"link",r),t.state.loading|=4,em(o,n.precedence,e),t.instance=o;case"script":return o=Xd(n.src),(i=e.querySelector(Jd(o)))?(t.instance=i,nt(i),i):(r=n,(i=Ud.get(o))&&nm(r=m({},n),i),nt(i=(e=e.ownerDocument||e).createElement("script")),pd(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(a(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,em(r,n.precedence,e));return t.instance}function em(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,i=a,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)i=l;else if(i!==a)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function tm(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function nm(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var rm=null;function am(e,t,n){if(null===rm){var r=/* @__PURE__ */new Map,a=rm=/* @__PURE__ */new Map;a.set(n,r)}else(r=(a=rm).get(n))||(r=/* @__PURE__ */new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var i=n[a];if(!(i[Ye]||i[Be]||"link"===e&&"stylesheet"===i.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==i.namespaceURI){var o=i.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(i):r.set(o,[i])}}return r}function im(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function om(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var lm=0;function sm(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)um(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var cm=null;function um(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,cm=/* @__PURE__ */new Map,t.forEach(dm,e),cm=null,sm.call(e))}function dm(e,t){if(!(4&t.state.loading)){var n=cm.get(e);if(n)var r=n.get(null);else{n=/* @__PURE__ */new Map,cm.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<a.length;i++){var o=a[i];"LINK"!==o.nodeName&&"not all"===o.getAttribute("media")||(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}o=(a=t.instance).getAttribute("data-precedence"),(i=n.get(o)||r)===r&&n.set(null,a),n.set(o,a),this.count++,r=sm.bind(this),a.addEventListener("load",r),a.addEventListener("error",r),i?i.parentNode.insertBefore(a,i.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(a,e.firstChild),t.state.loading|=4}}var mm={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function hm(e,t,n,r,a,i,o,l,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Pe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pe(0),this.hiddenUpdates=Pe(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=/* @__PURE__ */new Map}function pm(e,t,n,r,a,i,o,l,s,c,u,d){return e=new hm(e,t,n,o,s,c,u,d,l),t=1,!0===i&&(t|=24),i=Fr(3,null,null,t),e.current=i,i.stateNode=e,(t=Ua()).refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},yi(i),e}function fm(e){return e?e=Rr:Rr}function gm(e,t,n,r,a,i){a=fm(a),null===r.context?r.context=a:r.pendingContext=a,(r=wi(t)).payload={element:n},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(n=xi(e,r,t))&&(Yc(n,0,t),ki(n,e,t))}function bm(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function ym(e,t){bm(e,t),(e=e.alternate)&&bm(e,t)}function vm(e){if(13===e.tag||31===e.tag){var t=Lr(e,67108864);null!==t&&Yc(t,0,67108864),ym(e,67108864)}}function wm(e){if(13===e.tag||31===e.tag){var t=Gc(),n=Lr(e,t=Re(t));null!==n&&Yc(n,0,t),ym(e,t)}}var xm=!0;function km(e,t,n,r){var a=D.T;D.T=null;var i=O.p;try{O.p=2,Sm(e,t,n,r)}finally{O.p=i,D.T=a}}function Cm(e,t,n,r){var a=D.T;D.T=null;var i=O.p;try{O.p=8,Sm(e,t,n,r)}finally{O.p=i,D.T=a}}function Sm(e,t,n,r){if(xm){var a=Nm(r);if(null===a)rd(e,t,r,Em,n),Om(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return Tm=Rm(Tm,e,t,n,r,a),!0;case"dragenter":return Am=Rm(Am,e,t,n,r,a),!0;case"mouseover":return Mm=Rm(Mm,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Pm.set(i,Rm(Pm.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Im.set(i,Rm(Im.get(i)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(Om(e,r),4&t&&-1<Dm.indexOf(e)){for(;null!==a;){var i=Ze(a);if(null!==i)switch(i.tag){case 3:if((i=i.stateNode).current.memoizedState.isDehydrated){var o=_e(i.pendingLanes);if(0!==o){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var s=1<<31-ke(o);l.entanglements[1]|=s,o&=~s}Ou(i),!(6&fc)&&(Dc=ue()+500,Ru(0))}}break;case 31:case 13:null!==(l=Lr(i,2))&&Yc(l,0,2),tu(),ym(i,2)}if(null===(i=Nm(r))&&rd(e,t,r,Em,n),i===a)break;a=i}null!==a&&r.stopPropagation()}else rd(e,t,r,null,n)}}function Nm(e){return $m(e=Dt(e))}var Em=null;function $m(e){if(Em=null,null!==(e=Je(e))){var t=l(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=s(t)))return e;e=null}else if(31===n){if(null!==(e=c(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Em=e,null}function _m(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(de()){case me:return 2;case he:return 8;case pe:case fe:return 32;case ge:return 268435456;default:return 32}default:return 32}}var zm=!1,Tm=null,Am=null,Mm=null,Pm=/* @__PURE__ */new Map,Im=/* @__PURE__ */new Map,Lm=[],Dm="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Om(e,t){switch(e){case"focusin":case"focusout":Tm=null;break;case"dragenter":case"dragleave":Am=null;break;case"mouseover":case"mouseout":Mm=null;break;case"pointerover":case"pointerout":Pm.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Im.delete(t.pointerId)}}function Rm(e,t,n,r,a,i){return null===e||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},null!==t&&(null!==(t=Ze(t))&&vm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function jm(e){var t=Je(e.target);if(null!==t){var n=l(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=s(n)))return e.blockedOn=t,void Ue(e.priority,function(){wm(n)})}else if(31===t){if(null!==(t=c(n)))return e.blockedOn=t,void Ue(e.priority,function(){wm(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Fm(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Nm(e.nativeEvent);if(null!==n)return null!==(t=Ze(n))&&vm(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);Lt=r,n.target.dispatchEvent(r),Lt=null,t.shift()}return!0}function Um(e,t,n){Fm(e)&&n.delete(t)}function qm(){zm=!1,null!==Tm&&Fm(Tm)&&(Tm=null),null!==Am&&Fm(Am)&&(Am=null),null!==Mm&&Fm(Mm)&&(Mm=null),Pm.forEach(Um),Im.forEach(Um)}function Bm(e,n){e.blockedOn===n&&(e.blockedOn=null,zm||(zm=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qm)))}var Wm=null;function Vm(e){Wm!==e&&(Wm=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wm===e&&(Wm=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if("function"!=typeof r){if(null===$m(r||n))continue;break}var i=Ze(n);null!==i&&(e.splice(t,3),t-=3,rl(i,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function Hm(e){function t(t){return Bm(t,e)}null!==Tm&&Bm(Tm,e),null!==Am&&Bm(Am,e),null!==Mm&&Bm(Mm,e),Pm.forEach(t),Im.forEach(t);for(var n=0;n<Lm.length;n++){var r=Lm[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Lm.length&&null===(n=Lm[0]).blockedOn;)jm(n),null===n.blockedOn&&Lm.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var a=n[r],i=n[r+1],o=a[We]||null;if("function"==typeof i)o||Vm(n);else if(o){var l=null;if(i&&i.hasAttribute("formAction")){if(a=i,o=i[We]||null)l=o.formAction;else if(null!==$m(a))continue}else l=o.action;"function"==typeof l?n[r+1]=l:(n.splice(r,3),r-=3),Vm(n)}}}function Km(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return a=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==a&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"==typeof navigation){var r=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==a&&(a(),a=null)}}}function Gm(e){this._internalRoot=e}function Qm(e){this._internalRoot=e}Qm.prototype.render=Gm.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(a(409));gm(t.current,Gc(),e,t,null,null)},Qm.prototype.unmount=Gm.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;gm(e.current,2,null,e,null,null),tu(),t[Ve]=null}},Qm.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lm.length&&0!==t&&t<Lm[n].priority;n++);Lm.splice(n,0,e),0===n&&jm(e)}};var Ym=n.version;if("19.2.3"!==Ym)throw Error(a(527,Ym,"19.2.3"));O.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw e=Object.keys(e).join(","),Error(a(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=l(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}(t),e=null===(e=null!==e?d(e):null)?null:e.stateNode};var Xm={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.3"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Jm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jm.isDisabled&&Jm.supportsFiber)try{ve=Jm.inject(Xm),we=Jm}catch(eh){}}return y.createRoot=function(e,t){if(!i(e))throw Error(a(299));var n=!1,r="",o=El,l=$l,s=_l;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(o=t.onUncaughtError),void 0!==t.onCaughtError&&(l=t.onCaughtError),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=pm(e,1,!1,null,0,n,r,null,o,l,s,Km),e[Ve]=t.current,td(e),new Gm(t)},y.hydrateRoot=function(e,t,n){if(!i(e))throw Error(a(299));var r=!1,o="",l=El,s=$l,c=_l,u=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onUncaughtError&&(l=n.onUncaughtError),void 0!==n.onCaughtError&&(s=n.onCaughtError),void 0!==n.onRecoverableError&&(c=n.onRecoverableError),void 0!==n.formState&&(u=n.formState)),(t=pm(e,1,!0,t,0,r,o,u,l,s,c,Km)).context=fm(null),n=t.current,(o=wi(r=Re(r=Gc()))).callback=null,xi(n,o,r),n=r,t.current.lanes=n,Ie(t,n),Ou(t),e[Ve]=t.current,td(e),new Qm(t)},y.version="19.2.3",y}var C=(g||(g=1,function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),b.exports=k()),b.exports);const S=new class{constructor(){this.supportsContainerQueries=this.detectContainerQueries(),this.init()}detectContainerQueries(){if("undefined"==typeof window)return!1;try{if("CSS"in window&&"supports"in window.CSS)return window.CSS.supports("container-type","inline-size");const e=document.createElement("div");return e.style.containerType="inline-size","inline-size"===e.style.containerType}catch{return!1}}init(){"undefined"!=typeof window&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.applyClasses()):this.applyClasses())}applyClasses(){document.querySelectorAll(".limbo-component-container-wrapper").forEach(e=>{this.supportsContainerQueries?(e.classList.add("container-queries-supported"),e.classList.remove("container-queries-fallback")):(e.classList.add("container-queries-fallback"),e.classList.remove("container-queries-supported"))}),this.supportsContainerQueries?(document.body.classList.add("container-queries-supported"),document.body.classList.remove("container-queries-fallback")):(document.body.classList.add("container-queries-fallback"),document.body.classList.remove("container-queries-supported"))}getContainerWidth(e){if(!e)return window.innerWidth;let t=e.closest(".limbo-component-container-wrapper");return t||(t=e.closest(".limbo-modal-content")),t||(t=e.closest(".limbo-modal")),t||(t=document.body),t.offsetWidth||t.clientWidth}shouldUseMobileStyles(e,t=768){return this.getContainerWidth(e)<=t}applyResponsiveClasses(e){if(this.supportsContainerQueries)return;const t=this.shouldUseMobileStyles(e),n=this.shouldUseMobileStyles(e,1024)&&!t;e.classList.toggle("limbo-mobile-fallback",t),e.classList.toggle("limbo-tablet-fallback",n),e.classList.toggle("limbo-desktop-fallback",!t&&!n)}observeResize(){if(!this.supportsContainerQueries)if("ResizeObserver"in window){const e=new ResizeObserver(e=>{e.forEach(e=>{this.applyResponsiveClasses(e.target)})});document.querySelectorAll(".limbo-component-container-wrapper").forEach(t=>{e.observe(t)})}else window.addEventListener("resize",()=>{document.querySelectorAll(".limbo-component-container-wrapper").forEach(e=>{this.applyResponsiveClasses(e)})})}};function N(e={}){const{useContainerQuery:r=!1,containerElement:a=null}=e,[i,o]=t(()=>{const e=r&&a?S.getContainerWidth(a):"undefined"!=typeof window?window.innerWidth:0,t="undefined"!=typeof window&&(e<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)),n="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);return{isMobile:t,isTouch:n,isTablet:"undefined"!=typeof window&&(e>768&&e<=1024&&n),orientation:"undefined"!=typeof window?window.innerHeight>window.innerWidth?"portrait":"landscape":"portrait",viewport:{width:"undefined"!=typeof window?window.innerWidth:0,height:"undefined"!=typeof window?window.innerHeight:0},container:{width:e,supportsContainerQueries:S.supportsContainerQueries}}});n(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,n=r&&a?S.getContainerWidth(a):e,i=n<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),l="ontouchstart"in window||navigator.maxTouchPoints>0;o({isMobile:i,isTouch:l,isTablet:n>768&&n<=1024&&l,orientation:t>e?"portrait":"landscape",viewport:{width:e,height:t},container:{width:n,supportsContainerQueries:S.supportsContainerQueries}})};let t;const n=()=>{clearTimeout(t),t=setTimeout(e,150)};return window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(e,100)}),()=>{clearTimeout(t),window.removeEventListener("resize",n),window.removeEventListener("orientationchange",e)}},[r,a]);const l="portrait"===i.orientation,s="landscape"===i.orientation,c=i.isMobile||i.isTablet&&l;return{...i,isPortrait:l,isLandscape:s,isCompactMode:c,isMobileSize:i.viewport.width<=640,isTabletSize:i.viewport.width>640&&i.viewport.width<=1024,isDesktopSize:i.viewport.width>1024,deviceClass:i.isMobile?"mobile":i.isTablet?"tablet":"desktop"}}function E({tabs:e,active:t,onChange:n}){const{isMobile:r,isTouch:a}=N(),i=["limbo-tabs","flex","gap-4","border-b-2","border-brand-blue-200","mb-6",r&&"overflow-x-auto scrollbar-none"].filter(Boolean).join(" "),o=e=>{const t=["limbo-tab","relative","px-6","py-2","font-medium","text-brand-blue-1000","bg-transparent","border-0","border-b-2","cursor-pointer","transition-all","duration-200","hover:text-pink-1000","focus:outline-none","focus-visible:ring-2","focus-visible:ring-brand-blue-400","focus-visible:ring-offset-2"];return e?t.push("border-b-brand-blue-1000","font-semibold","limbo-active"):t.push("border-b-transparent"),r&&t.push("min-w-[120px]","min-h-[44px]","text-base","shrink-0"),a&&t.push("touch-manipulation"),t.join(" ")};/* @__PURE__ */
2
- return l("div",{className:i,role:"tablist","aria-label":"Opciones de navegación",style:r?{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"}:void 0,children:e.map(r=>{const i=t===r.id;return!i&&r.hideNonActive?null:/* @__PURE__ */l("button",{"data-tab-id":r.id,onClick:()=>n(r.id),onKeyDown:t=>((t,r)=>{const a=e.findIndex(e=>e.id===r);let i=a;switch(t.key){case"ArrowLeft":case"ArrowUp":t.preventDefault(),i=a>0?a-1:e.length-1;break;case"ArrowRight":case"ArrowDown":t.preventDefault(),i=a<e.length-1?a+1:0;break;case"Home":t.preventDefault(),i=0;break;case"End":t.preventDefault(),i=e.length-1;break;case"Enter":case" ":return t.preventDefault(),void n(r);default:return}const o=e[i];o&&!o.hideNonActive&&(n(o.id),setTimeout(()=>{const e=document.querySelector(`[data-tab-id="${o.id}"]`);e&&e.focus()},0))})(t,r.id),className:o(i),role:"tab","aria-selected":i,"aria-controls":`tabpanel-${r.id}`,tabIndex:i?0:-1,id:`tab-${r.id}`,style:a?{WebkitTapHighlightColor:"transparent"}:void 0,children:r.label},r.id)})})}const $="https://led-dev-limbo-dev.eu.els.local",_="https://limbo.lefebvre.es";let z={publicKey:null,token:null,authMode:null,tokenEndpoint:null,tokenProvider:null,prod:!1};function T({prod:e=!1}={}){return e?_:$}async function A({endpoint:e,method:t="GET",body:n=null,prod:r=!1,basePath:a="",customHeaders:i={},isFormData:o=!1,useJWT:l=!0}){try{const s=r||z.prod,c=await async function({isFormData:e=!1,useJWT:t=!0,customHeaders:n={}}={}){const r={"Access-Control-Allow-Origin":`${window.location.hostname||"*"}`};e||(r["Content-Type"]="application/json");let a=z.token;if(t){if("jwt"===z.authMode&&z.tokenProvider&&!a)try{console.log("🔑 Calling tokenProvider..."),a=await z.tokenProvider(),console.log("✅ Token obtained from tokenProvider"),z.token=a}catch(i){throw console.error("❌ tokenProvider failed:",i),new Error("Failed to obtain token from tokenProvider: "+i.message)}else if("session"===z.authMode&&!a)try{const e=T(z),t=z.tokenEndpoint||"/auth/token",n=await fetch(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":`${window.location.hostname||"*"}`},body:JSON.stringify({public_key:z.publicKey}),credentials:"include"});if(!n.ok)throw new Error(`Session auth failed: ${n.status}`);a=(await n.json()).token,z.token=a}catch(i){throw console.error("❌ Session authentication failed:",i),new Error("Failed to authenticate with session. User must be logged in.")}a?r.Authorization=`Bearer ${a}`:console.warn("⚠️ No JWT token available:",{authMode:z.authMode,hasPublicKey:!!z.publicKey,hasTokenProvider:!!z.tokenProvider})}return e&&delete r["Content-Type"],{...r,...n}}({isFormData:o,useJWT:l,customHeaders:i});"GET"===t&&!n&&c["Content-Type"]&&delete c["Content-Type"];const u=await fetch(`${T({prod:s})}${a}${e}`,{method:t,headers:c,body:n?o?n:JSON.stringify(n):void 0,credentials:"include"});if(204===u.status)return{success:!0,data:null,message:"No content",httpCode:204,timestamp:/* @__PURE__ */(new Date).toISOString()};if(!u.ok){let e=`HTTP ${u.status}: ${u.statusText}`,t=null;try{const n=await u.json();t=n,n.error?e=`${n.error.code}: ${n.error.message}`:n.message&&(e=n.message)}catch{}throw 401===u.status&&t&&("token_expired"===t.error||t.message&&t.message.includes("expired")||t.message&&t.message.includes("caducado")||t.error&&t.error.includes("expired"))&&window.dispatchEvent(new CustomEvent("tokenExpiredError",{detail:{error:{response:{status:401,data:t}}}})),new Error(e)}return u.json()}catch(s){throw new Error(`API Error: ${s.message}`)}}function M(){const e={...z};return e?.prod||!1?"https://limbo.lefebvre.es":"http://localhost"}function P(e){if(!e?.id)return null;return`${M()}/api/assets/${e.id}/download`}function I(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("/")){return`${M()}${e}`}return e}function L(e){return Array.isArray(e)?e.map(e=>({id:e.id,name:e.name,width:e.width,height:e.height,format:e.output_format,file_size:e.file_size,crop_params:e.crop_params,url:I(e.url),expires_at:e.expires_at,created_at:e.created_at})):[]}function D(e){if(e.message&&!e.message.includes("API Error:"))return e;let t=e.message||"Unknown API error";return t.startsWith("API Error: ")&&(t=t.substring(11)),new Error(t)}const O="/api";async function R(e={}){try{const t=new URLSearchParams(e).toString(),n=t?`/assets?${t}`:"/assets";return function(e){if(!e?.success||!Array.isArray(e?.data?.data))return{result:[]};const t={result:e.data.data.map(e=>({id:e.id,filename:e.filename||e.original_filename,mime_type:e.mime_type,file_size:e.file_size,width:e.width,height:e.height,upload_date:e.upload_date||e.created_at,processing_status:e.processing_status||e.status,variants:e.variants_count&&(L(e.variants)||L(e.image_variants))||[],url:I(e.master_url||e.master?.url_signed||e.urls?.original||e.url)||P(e),webp_available:e.webp_available||!!e.webp_url,metadata:e.metadata||{},variants_count:e.variants_count||0}))};return e.data.pagination&&(t.pagination={page:e.data.pagination.page,limit:e.data.pagination.limit,total:e.data.pagination.total,pages:e.data.pagination.pages}),t}(await A({endpoint:n,method:"GET",basePath:O,useJWT:!0}))}catch(t){throw D(t)}}async function j(e,t=null,n=!1){try{const r=new FormData;r.append("file",e),t&&r.append("uploaded_by",t),n&&r.append("store_original",n.toString());return function(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;return{result:{id:t.id,filename:t.original_filename,mime_type:t.mime_type,file_size:t.file_size,width:t.width,height:t.height,status:t.status,upload_date:t.created_at,url:I(t.master?.url_signed),master_format:t.master?.format,processing:t.processing||{master_webp:"processing"===t.status?"queued":"completed",variants:"processing"===t.status?"queued":"completed"},checksum:t.checksum,storage_path:t.storage_path_base,metadata:t.metadata||{}}}}(await A({endpoint:"/assets",method:"POST",body:r,basePath:O,isFormData:!0,useJWT:!0}))}catch(r){throw D(r)}}async function F(e,{variant_name:t,width:n,height:r,crop_params:a,preset_aspect:i=null,preset_size:o=null,output_format:l="webp"}){try{const s=[{name:t,width:n,height:r,output_format:l,crop_params:a}];i&&(s[0].preset_aspect=i),o&&(s[0].preset_size=o);return function(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;if("sync"===t.processing_mode&&t.variants&&t.variants.length>0){const e=t.variants[0];return{result:{id:e.id||null,name:e.name,width:parseInt(e.size?.split("x")[0])||e.width,height:parseInt(e.size?.split("x")[1])||e.height,format:e.format,file_size:e.file_size,url:e.url,status:e.status,asset_id:t.asset_id,created_at:e.created_at||/* @__PURE__ */(new Date).toISOString(),all_variants:t.variants}}}return{result:{job_id:t.job_id,asset_id:t.asset_id,variants_requested:t.variants_requested||[],processing_mode:t.processing_mode||"async",estimated_completion:t.estimated_completion,variant_statuses:(t.variant_statuses||t.variants||[]).map(e=>({name:e.name,status:e.status,size:e.expected_size||e.size,format:e.format}))}}}(await A({endpoint:`/assets/${e}/variants`,method:"POST",body:{variants:s,async:!1},basePath:O,useJWT:!0}))}catch(s){throw D(s)}}async function U(e){try{const n=await A({endpoint:`/assets/${e}/variants`,method:"GET",basePath:O,useJWT:!0});return t=n,t?.success&&Array.isArray(t?.data?.variants)?{result:t.data.variants.map(e=>({id:e.id,name:e.filename||e.name||`Variante ${e.id}`,filename:e.filename,mime_type:e.mime_type,format:e.output_format||e.format||(e.mime_type?e.mime_type.split("/")[1]:"jpg"),file_size:e.file_size,width:e.width,height:e.height,upload_date:e.upload_date||e.created_at,processing_status:e.processing_status||e.status,url:I(e.master_url||e.master?.url_signed||e.urls?.original||e.url)||P(e),webp_available:e.webp_available||!!e.webp_url,metadata:e.metadata||{},crop_data:e.crop_data||{},crop_params:e.crop_params||e.crop_data||{},parent_asset_id:e.parent_asset_id||t.data.asset_id,variant_type:e.variant_type||"crop"}))}:{result:[]}}catch(n){throw D(n)}var t}function q(){const[e,n]=t({}),[a,i]=t({}),[o,l]=t({}),s=r(async t=>{if(t&&!a[t]){if(e[t])return e[t];i(e=>({...e,[t]:!0})),l(e=>({...e,[t]:null}));try{const e=await U(t),r=e?.result||[];return n(e=>({...e,[t]:r})),r}catch(r){return console.error("Error loading variants:",r),l(e=>({...e,[t]:r.message})),[]}finally{i(e=>({...e,[t]:!1}))}}},[e,a]),c=r(t=>e[t]||[],[e]),u=r(e=>a[e]||!1,[a]),d=r(e=>o[e]||null,[o]),m=r(e=>{n(t=>{const n={...t};return delete n[e],n}),i(t=>{const n={...t};return delete n[e],n}),l(t=>{const n={...t};return delete n[e],n})},[]),h=r(async e=>(m(e),await s(e)),[m,s]),p=r(async(e,t)=>{try{return await async function(e,t){try{return await A({endpoint:`/assets/${e}/variants/${t}`,method:"DELETE",basePath:O,useJWT:!0})}catch(n){throw D(n)}}(e,t),n(n=>{const r=n[e]||[];return{...n,[e]:r.filter(e=>e.id!==t)}}),{success:!0}}catch(r){return console.error("Error deleting variant:",r),{success:!1,error:r.message}}},[]);return{loadVariants:s,getVariants:c,isLoading:u,getError:d,clearVariants:m,refreshVariants:h,removeVariant:p}}function B({src:e,alt:i="Imagen",title:o="",subtitle:c="",onClose:u,isOpen:d=!1}){const[m,h]=t(1),[p,f]=t({x:0,y:0}),[g,b]=t(!1),[y,v]=t({x:0,y:0}),[w,x]=t(!1),[k,C]=t(!1),S=a(null),N=a(null);n(()=>{d&&(h(1),f({x:0,y:0}),x(!1),C(!1))},[d]);const E=r(()=>{h(e=>Math.min(e+.25,5))},[]),$=r(()=>{h(e=>Math.max(e-.25,.25))},[]),_=r(()=>{h(1),f({x:0,y:0})},[]),z=r(()=>{h(1),f({x:0,y:0})},[]),T=r(e=>{if("Escape"===e.key)return e.preventDefault(),void u?.();if((e.ctrlKey||e.metaKey)&&("+"===e.key||"="===e.key))return e.preventDefault(),void E();if((e.ctrlKey||e.metaKey)&&"-"===e.key)return e.preventDefault(),void $();if((e.ctrlKey||e.metaKey)&&"0"===e.key)return e.preventDefault(),void _();if(m>1){const t=50;switch(e.key){case"ArrowUp":e.preventDefault(),f(e=>({...e,y:e.y+t}));break;case"ArrowDown":e.preventDefault(),f(e=>({...e,y:e.y-t}));break;case"ArrowLeft":e.preventDefault(),f(e=>({...e,x:e.x+t}));break;case"ArrowRight":e.preventDefault(),f(e=>({...e,x:e.x-t}))}}},[u,E,$,_,m]),A=r(e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.deltaY<0?E():$())},[E,$]),M=r(e=>{m>1&&0===e.button&&(e.preventDefault(),b(!0),v({x:e.clientX-p.x,y:e.clientY-p.y}))},[m,p]),P=r(e=>{g&&f({x:e.clientX-y.x,y:e.clientY-y.y})},[g,y]),I=r(()=>{b(!1)},[]),L=r(()=>{1===m?h(2):_()},[m,_]);if(n(()=>{if(!d)return;document.addEventListener("keydown",T),document.addEventListener("mouseup",I),document.addEventListener("mousemove",P);const e=e=>{!e.ctrlKey&&!e.metaKey||"+"!==e.key&&"-"!==e.key&&"="!==e.key&&"0"!==e.key||e.preventDefault()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",T),document.removeEventListener("mouseup",I),document.removeEventListener("mousemove",P),document.removeEventListener("keydown",e)}},[d,T,I,P]),n(()=>(document.body.style.overflow=d?"hidden":"",()=>{document.body.style.overflow=""}),[d]),!d)return null;const D=Math.round(100*m);/* @__PURE__ */
1
+ import e,{useState as t,useEffect as n,useCallback as r,useRef as a,useMemo as i}from"react";import o from"react-dom";import{jsx as l,jsxs as s,Fragment as c}from"react/jsx-runtime";const u={es:{"button.select":"Seleccionar","button.upload":"Subir imagen","button.cancel":"Cancelar","button.close":"Cerrar","button.save":"Guardar","button.delete":"Eliminar","button.download":"Descargar","button.copy":"Copiar URL","button.crop":"Recortar","button.apply":"Aplicar","button.reset":"Reiniciar","button.back":"Volver","button.next":"Siguiente","button.previous":"Anterior","tab.gallery":"Galería","tab.upload":"Subir","tab.ia":"IA","tab.stock":"Stock","tab.cropper":"Recortar","message.loading":"Cargando...","message.uploading":"Subiendo imagen...","message.processing":"Procesando...","message.no_images":"No hay imágenes disponibles","message.upload_success":"Imagen subida correctamente","message.upload_error":"Error al subir la imagen","message.delete_confirm":"¿Estás seguro de que deseas eliminar esta imagen? Esta acción también eliminará todos sus recortes.","message.copy_success":"URL copiada al portapapeles","message.copy_error":"Error al copiar URL","error.file_too_large":"El archivo es demasiado grande","error.invalid_format":"Formato de archivo no válido","error.upload_failed":"Error al subir el archivo","error.network":"Error de conexión","error.unknown":"Error desconocido","error.api_key_missing":"API Key no proporcionada","placeholder.search":"Buscar imágenes...","placeholder.prompt":"Describe la imagen que quieres generar...","label.file_name":"Nombre del archivo","label.file_size":"Tamaño","label.dimensions":"Dimensiones","label.format":"Formato","label.uploaded_by":"Subido por","label.uploaded_at":"Fecha de subida","preset.square":"Cuadrado","preset.landscape":"Paisaje","preset.portrait":"Retrato","preset.thumbnail":"Miniatura","preset.medium":"Medio","preset.large":"Grande","preset.custom":"Personalizado"},en:{"button.select":"Select","button.upload":"Upload image","button.cancel":"Cancel","button.close":"Close","button.save":"Save","button.delete":"Delete","button.download":"Download","button.copy":"Copy URL","button.crop":"Crop","button.apply":"Apply","button.reset":"Reset","button.back":"Back","button.next":"Next","button.previous":"Previous","tab.gallery":"Gallery","tab.upload":"Upload","tab.ia":"AI","tab.stock":"Stock","tab.cropper":"Crop","message.loading":"Loading...","message.uploading":"Uploading image...","message.processing":"Processing...","message.no_images":"No images available","message.upload_success":"Image uploaded successfully","message.upload_error":"Error uploading image","message.delete_confirm":"Are you sure you want to delete this image?","message.copy_success":"URL copied to clipboard","message.copy_error":"Error copying URL","error.file_too_large":"File is too large","error.invalid_format":"Invalid file format","error.upload_failed":"Upload failed","error.network":"Network error","error.unknown":"Unknown error","error.api_key_missing":"API Key not provided","placeholder.search":"Search images...","placeholder.prompt":"Describe the image you want to generate...","label.file_name":"File name","label.file_size":"Size","label.dimensions":"Dimensions","label.format":"Format","label.uploaded_by":"Uploaded by","label.uploaded_at":"Upload date","preset.square":"Square","preset.landscape":"Landscape","preset.portrait":"Portrait","preset.thumbnail":"Thumbnail","preset.medium":"Medium","preset.large":"Large","preset.custom":"Custom"}};class d{constructor(e="es",t={}){this.locale=e,this.messages=this._mergeMessages(t)}_mergeMessages(e){const t={...u};return Object.keys(e).forEach(n=>{t[n]={...t[n]||{},...e[n]}}),t}t(e,t={}){let n=(this.messages[this.locale]||this.messages.es)[e]||e;return Object.keys(t).forEach(e=>{n=n.replace(`{${e}}`,t[e])}),n}setLocale(e){this.messages[e]?this.locale=e:console.warn(`Locale ${e} not available, keeping ${this.locale}`)}getLocale(){return this.locale}getAvailableLocales(){return Object.keys(this.messages)}addMessages(e,t){this.messages[e]={...this.messages[e]||{},...t}}hasKey(e){return e in(this.messages[this.locale]||this.messages.es)}}new d;class m{constructor(){this.globalConfig={},this.defaults={container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0,showPreview:!0},cropper:{quality:.9,format:"webp",aspectRatio:null,lockAspectRatio:!1,showFreeAspectRatio:!0,showDimensionInputs:!1,enableEditMode:!0,showDownloadInCropper:!1,showCropName:!1,mandatoryCrops:[],allowCustomCrops:!0},gallery:{filters:{showNameFilter:!0,showUploadedByFilter:!1,showDateFilter:!0,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{maxSize:"10MB",formats:["jpg","jpeg","png","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null},downloadFormat:"webp",return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar imagen",buttonStyle:"primary",buttonClass:"limbo-auto-button",scanOnLoad:!0,observeChanges:!0},presets:{aspects:[{name:"square",ratio:"1:1",label:"Cuadrado"},{name:"landscape",ratio:"16:9",label:"Paisaje"},{name:"portrait",ratio:"9:16",label:"Retrato"}],sizes:[{name:"thumbnail",width:300,height:300,fit:"cover",label:"Miniatura"},{name:"medium",width:800,height:600,fit:"cover",label:"Medio"},{name:"large",width:1920,height:1080,fit:"cover",label:"Grande"}],required:[],lockUserCrop:!1,allowArbitrary:!0,defaultAspect:"square",defaultSize:"medium"},modal:{size:"medium",title:"Limbo Image Manager",backdrop:!0,closeOnEscape:!0,closeOnBackdrop:!0,showCloseButton:!0},callbacks:{onUpload:null,onSelect:null,onDelete:null,onCropsSaved:null,onCropperComplete:null,onCropperCancelled:null,onCropperError:null},autoDestroy:!1,autoHideOnComplete:!1,debug:!1,apiEndpoint:null,auth:{apiKey:null,publicKey:null,portal:null,authMode:"jwt",tokenStorage:"memory",autoRefresh:!0,refreshBuffer:30},apiKey:null}}setGlobal(e){return this.globalConfig={...this.globalConfig,...e},this}getGlobal(){return{...this.globalConfig}}merge(e={}){return this._deepMerge(this.defaults,this.globalConfig,e)}_deepMerge(...e){const t={};return e.forEach(e=>{e&&"object"==typeof e&&Object.keys(e).forEach(n=>{e[n]&&"object"==typeof e[n]&&!Array.isArray(e[n])?t[n]=this._deepMerge(t[n]||{},e[n]):t[n]=e[n]})}),t}setDefaults(e){return this.defaults=this._deepMerge(this.defaults,e),this}getDefaults(){return JSON.parse(JSON.stringify(this.defaults))}resetDefaults(){return this.defaults=this._getOriginalDefaults(),this}get(e,t=null){const n=t||this.merge();return this._getValueByPath(n,e)}set(e,t){return this._setValueByPath(this.globalConfig,e,t),this}_getValueByPath(e,t){return t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e)}_setValueByPath(e,t,n){const r=t.split("."),a=r.pop();r.reduce((e,t)=>(e[t]&&"object"==typeof e[t]||(e[t]={}),e[t]),e)[a]=n}_getOriginalDefaults(){return{container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0,showPreview:!0},interaction:{allowSelection:!1,allowCropping:!0,requiresCropping:!1,selectionMode:"direct"},cropper:{quality:.9,format:"webp",aspectRatio:null,lockAspectRatio:!1,showFreeAspectRatio:!0,showDimensionInputs:!1,enableEditMode:!0,showDownloadInCropper:!1,showCropName:!1,mandatoryCrops:[],allowCustomCrops:!0},gallery:{filters:{showNameFilter:!0,showUploadedByFilter:!1,showDateFilter:!0,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{maxSize:"10MB",formats:["jpg","jpeg","png","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null},return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar imagen",buttonStyle:"primary",buttonClass:"limbo-auto-button",scanOnLoad:!0,observeChanges:!0},modal:{size:"medium",title:"Limbo Image Manager",backdrop:!0,closeOnEscape:!0,closeOnBackdrop:!0,showCloseButton:!0},i18n:{locale:"es",messages:{},autoDetect:!0},theme:{colors:{},spacing:{},typography:{},borderRadius:{},shadows:{},customProperties:{}},callbacks:{onUpload:null,onSelect:null,onDelete:null,onCropsSaved:null,onCropperComplete:null,onCropperCancelled:null,onCropperError:null},autoDestroy:!1,autoHideOnComplete:!1,debug:!1,apiEndpoint:null,auth:{apiKey:null,publicKey:null,portal:null,authMode:"jwt",tokenStorage:"memory",autoRefresh:!0,refreshBuffer:30},apiKey:null}}_validatePresets(e){const t=[];if(e.aspects&&e.aspects.forEach((e,n)=>{e.name&&e.ratio||t.push(`Aspect preset ${n}: name and ratio are required`),e.ratio&&!/^\d+:\d+$/.test(e.ratio)&&t.push(`Aspect preset ${e.name}: ratio must be in format "w:h"`)}),e.sizes&&e.sizes.forEach((e,n)=>{e.name&&e.width||t.push(`Size preset ${n}: name and width are required`),e.width&&e.width<=0&&t.push(`Size preset ${e.name}: width must be positive`),e.height&&e.height<=0&&t.push(`Size preset ${e.name}: height must be positive`)}),e.required&&Array.isArray(e.required)){const n=[...e.aspects?.map(e=>e.name)||[],...e.sizes?.map(e=>e.name)||[]];e.required.forEach(e=>{n.includes(e)||t.push(`Required preset "${e}" not found in available presets`)})}return t}getPreset(e,t,n="aspect"){const r=e.presets||this.defaults.presets;return"aspect"===n?r.aspects?.find(e=>e.name===t):"size"===n?r.sizes?.find(e=>e.name===t):null}isPresetRequired(e,t){const n=e.presets||this.defaults.presets;return n.required?.includes(t)||!1}getAvailableAspects(e){return(e.presets||this.defaults.presets).aspects||[]}getAvailableSizes(e){return(e.presets||this.defaults.presets).sizes||[]}createI18n(e){const t=e.i18n||this.defaults.i18n;let n=t.locale;if(t.autoDetect&&"auto"===n){const e=(navigator.language||navigator.userLanguage).split("-")[0];n=["es","en"].includes(e)?e:"es"}else t.autoDetect&&!n&&(n="es");return new d(n,t.messages)}validate(e){const t=[],n=this._deepMerge(this.globalConfig.auth||{},e.auth||{}),r=e.apiKey||this.globalConfig.apiKey;if("jwt"!==n.authMode&&r||n.apiKey||t.push("auth.apiKey es requerido para autenticación JWT"),"legacy"!==n.authMode||r||t.push("apiKey es requerido para modo legacy"),n.apiKey||r||t.push("Se requiere configuración de autenticación (auth.apiKey o apiKey legacy)"),e.mode&&!["embed","modal","button"].includes(e.mode)&&t.push("mode debe ser: embed, modal o button"),e.features&&!Array.isArray(e.features)&&t.push("features debe ser un array"),e.presets){const n=this._validatePresets(e.presets);t.push(...n)}return{isValid:0===t.length,errors:t}}setJWTAuth(e,t=null,n={}){const r={apiKey:e,publicKey:t,authMode:"jwt",tokenStorage:n.tokenStorage||"memory",autoRefresh:!1!==n.autoRefresh,refreshBuffer:n.refreshBuffer||30,portal:n.portal||null,...n};return this.set("auth",r),this}getAuthConfig(e=null){const t=e||this.merge();return{authMode:t.auth?.authMode||(t.apiKey?"legacy":"jwt"),apiKey:t.auth?.apiKey||t.apiKey,publicKey:t.auth?.publicKey,portal:t.auth?.portal,tokenStorage:t.auth?.tokenStorage||"memory",autoRefresh:!1!==t.auth?.autoRefresh,refreshBuffer:t.auth?.refreshBuffer||30}}isJWTMode(e=null){return"jwt"===this.getAuthConfig(e).authMode}isLegacyMode(e=null){return"legacy"===this.getAuthConfig(e).authMode}migrateToJWT(e=null){const t=e||this.globalConfig.apiKey;if(!t)throw new Error("No hay apiKey para migrar a JWT");return this.setJWTAuth(t),this}getMandatoryCrops(e=null){const t=e||this.merge();return t.cropper?.mandatoryCrops||[]}hasMandatoryCrops(e=null){return this.getMandatoryCrops(e).length>0}isEditModeEnabled(e=null){const t=e||this.merge();return!1!==t.cropper?.enableEditMode}showDimensionInputs(e=null){const t=e||this.merge();return!0===t.cropper?.showDimensionInputs}showDownloadInCropper(e=null){const t=e||this.merge();return!0===t.cropper?.showDownloadInCropper}showCropName(e=null){const t=e||this.merge();return!0===t.cropper?.showCropName}allowCustomCrops(e=null){const t=e||this.merge();return!1!==t.cropper?.allowCustomCrops}getGalleryFilters(e=null){const t=e||this.merge();return t.gallery?.filters||this.defaults.gallery.filters}isGalleryFilterEnabled(e,t=null){const n=this.getGalleryFilters(t);return n.enabledFilters?.includes(e)||!1}getCustomGalleryFilters(e=null){return this.getGalleryFilters(e).customFilters||[]}getGalleryLoadingConfig(e=null){const t=e||this.merge();return t.gallery?.loading||this.defaults.gallery.loading}showGalleryPlaceholders(e=null){return!1!==this.getGalleryLoadingConfig(e).showPlaceholders}getPlaceholderCount(e=null){return this.getGalleryLoadingConfig(e).placeholderCount||10}showGallerySpinner(e=null){return!1!==this.getGalleryLoadingConfig(e).showSpinner}getGalleryPagination(e=null){const t=e||this.merge();return t.gallery?.pagination||this.defaults.gallery.pagination}getItemsPerPage(e=null){return this.getGalleryPagination(e).itemsPerPage||20}}var h,p,f,g,b={exports:{}},y={},v={exports:{}},w={};function x(){return p||(p=1,v.exports=(h||(h=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,i=e[r];if(!(0<a(i,t)))break e;e[r]=t,e[n]=i,n=r}}function n(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length,o=i>>>1;r<o;){var l=2*(r+1)-1,s=e[l],c=l+1,u=e[c];if(0>a(s,n))c<i&&0>a(u,s)?(e[r]=u,e[c]=n,r=c):(e[r]=s,e[l]=n,r=l);else{if(!(c<i&&0>a(u,n)))break e;e[r]=u,e[c]=n,r=c}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var s=[],c=[],u=1,d=null,m=3,h=!1,p=!1,f=!1,g=!1,b="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var a=n(c);null!==a;){if(null===a.callback)r(c);else{if(!(a.startTime<=e))break;r(c),a.sortIndex=a.expirationTime,t(s,a)}a=n(c)}}function x(e){if(f=!1,w(e),!p)if(null!==n(s))p=!0,C||(C=!0,k());else{var t=n(c);null!==t&&A(x,t.startTime-e)}}var k,C=!1,S=-1,N=5,E=-1;function $(){return!(!g&&e.unstable_now()-E<N)}function _(){if(g=!1,C){var t=e.unstable_now();E=t;var a=!0;try{e:{p=!1,f&&(f=!1,y(S),S=-1),h=!0;var i=m;try{t:{for(w(t),d=n(s);null!==d&&!(d.expirationTime>t&&$());){var o=d.callback;if("function"==typeof o){d.callback=null,m=d.priorityLevel;var l=o(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof l){d.callback=l,w(t),a=!0;break t}d===n(s)&&r(s),w(t)}else r(s);d=n(s)}if(null!==d)a=!0;else{var u=n(c);null!==u&&A(x,u.startTime-t),a=!1}}break e}finally{d=null,m=i,h=!1}a=void 0}}finally{a?k():C=!1}}}if("function"==typeof v)k=function(){v(_)};else if("undefined"!=typeof MessageChannel){var z=new MessageChannel,T=z.port2;z.port1.onmessage=_,k=function(){T.postMessage(null)}}else k=function(){b(_,0)};function A(t,n){S=b(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var n=m;m=t;try{return e()}finally{m=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=m;m=e;try{return t()}finally{m=n}},e.unstable_scheduleCallback=function(r,a,i){var o=e.unstable_now();switch(i="object"==typeof i&&null!==i&&"number"==typeof(i=i.delay)&&0<i?o+i:o,r){case 1:var l=-1;break;case 2:l=250;break;case 5:l=1073741823;break;case 4:l=1e4;break;default:l=5e3}return r={id:u++,callback:a,priorityLevel:r,startTime:i,expirationTime:l=i+l,sortIndex:-1},i>o?(r.sortIndex=i,t(c,r),null===n(s)&&r===n(c)&&(f?(y(S),S=-1):f=!0,A(x,i-o))):(r.sortIndex=l,t(s,r),p||h||(p=!0,C||(C=!0,k()))),r},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(e){var t=m;return function(){var n=m;m=t;try{return e.apply(this,arguments)}finally{m=n}}}}(w)),w)),v.exports}function k(){if(f)return y;f=1;var t=x(),n=e,r=o;function a(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function s(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function c(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function u(e){if(l(e)!==e)throw Error(a(188))}function d(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=d(e)))return t;e=e.sibling}return null}var m=Object.assign,h=/* @__PURE__ */Symbol.for("react.element"),p=/* @__PURE__ */Symbol.for("react.transitional.element"),g=/* @__PURE__ */Symbol.for("react.portal"),b=/* @__PURE__ */Symbol.for("react.fragment"),v=/* @__PURE__ */Symbol.for("react.strict_mode"),w=/* @__PURE__ */Symbol.for("react.profiler"),k=/* @__PURE__ */Symbol.for("react.consumer"),C=/* @__PURE__ */Symbol.for("react.context"),S=/* @__PURE__ */Symbol.for("react.forward_ref"),N=/* @__PURE__ */Symbol.for("react.suspense"),E=/* @__PURE__ */Symbol.for("react.suspense_list"),$=/* @__PURE__ */Symbol.for("react.memo"),_=/* @__PURE__ */Symbol.for("react.lazy"),z=/* @__PURE__ */Symbol.for("react.activity"),T=/* @__PURE__ */Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function P(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=A&&e[A]||e["@@iterator"])?e:null}var M=/* @__PURE__ */Symbol.for("react.client.reference");function I(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===M?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case b:return"Fragment";case w:return"Profiler";case v:return"StrictMode";case N:return"Suspense";case E:return"SuspenseList";case z:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case g:return"Portal";case C:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case S:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case $:return null!==(t=e.displayName||null)?t:I(e.type)||"Memo";case _:t=e._payload,e=e._init;try{return I(e(t))}catch(n){}}return null}var L=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},j=[],F=-1;function U(e){return{current:e}}function q(e){0>F||(e.current=j[F],j[F]=null,F--)}function B(e,t){F++,j[F]=e.current,e.current=t}var W,V,H=U(null),K=U(null),G=U(null),Q=U(null);function Y(e,t){switch(B(G,t),B(K,e),B(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=wd(t=vd(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}q(H),B(H,e)}function X(){q(H),q(K),q(G)}function J(e){null!==e.memoizedState&&B(Q,e);var t=H.current,n=wd(t,e.type);t!==n&&(B(K,e),B(H,n))}function Z(e){K.current===e&&(q(H),q(K)),Q.current===e&&(q(Q),mm._currentValue=R)}function ee(e){if(void 0===W)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);W=t&&t[1]||"",V=-1<n.stack.indexOf("\n at")?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+W+e+V}var te=!1;function ne(e,t){if(!e||te)return"";te=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(a){var r=a}Reflect.construct(e,[],n)}else{try{n.call()}catch(i){r=i}e.call(n.prototype)}}else{try{throw Error()}catch(o){r=o}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(l){if(l&&r&&"string"==typeof l.stack)return[l.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],l=i[1];if(o&&l){var s=o.split("\n"),c=l.split("\n");for(a=r=0;r<s.length&&!s[r].includes("DetermineComponentFrameRoot");)r++;for(;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;if(r===s.length||a===c.length)for(r=s.length-1,a=c.length-1;1<=r&&0<=a&&s[r]!==c[a];)a--;for(;1<=r&&0<=a;r--,a--)if(s[r]!==c[a]){if(1!==r||1!==a)do{if(r--,0>--a||s[r]!==c[a]){var u="\n"+s[r].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}}while(1<=r&&0<=a);break}}}finally{te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ee(n):""}function re(e,t){switch(e.tag){case 26:case 27:case 5:return ee(e.type);case 16:return ee("Lazy");case 13:return e.child!==t&&null!==t?ee("Suspense Fallback"):ee("Suspense");case 19:return ee("SuspenseList");case 0:case 15:return ne(e.type,!1);case 11:return ne(e.type.render,!1);case 1:return ne(e.type,!0);case 31:return ee("Activity");default:return""}}function ae(e){try{var t="",n=null;do{t+=re(e,n),n=e,e=e.return}while(e);return t}catch(r){return"\nError generating stack: "+r.message+"\n"+r.stack}}var ie=Object.prototype.hasOwnProperty,oe=t.unstable_scheduleCallback,le=t.unstable_cancelCallback,se=t.unstable_shouldYield,ce=t.unstable_requestPaint,ue=t.unstable_now,de=t.unstable_getCurrentPriorityLevel,me=t.unstable_ImmediatePriority,he=t.unstable_UserBlockingPriority,pe=t.unstable_NormalPriority,fe=t.unstable_LowPriority,ge=t.unstable_IdlePriority,be=t.log,ye=t.unstable_setDisableYieldValue,ve=null,we=null;function xe(e){if("function"==typeof be&&ye(e),we&&"function"==typeof we.setStrictMode)try{we.setStrictMode(ve,e)}catch(t){}}var ke=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(Ce(e)/Se|0)|0},Ce=Math.log,Se=Math.LN2;var Ne=256,Ee=262144,$e=4194304;function _e(e){var t=42&e;if(0!==t)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!==(r=l&~i)?a=_e(r):0!==(o&=l)?a=_e(o):n||0!==(n=l&~e)&&(a=_e(n)):0!==(l=r&~i)?a=_e(l):0!==o?a=_e(o):n||0!==(n=r&~e)&&(a=_e(n)),0===a?0:0!==t&&t!==a&&0===(t&i)&&((i=a&-a)>=(n=t&-t)||32===i&&4194048&n)?t:a}function Te(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Ae(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;default:return-1}}function Pe(){var e=$e;return!(62914560&($e<<=1))&&($e=4194304),e}function Me(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ie(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Le(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ke(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|261930&n}function De(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ke(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function Oe(e,t){var n=t&-t;return 0!==((n=42&n?1:Re(n))&(e.suspendedLanes|t))?0:n}function Re(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function je(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function Fe(){var e=O.p;return 0!==e?e:void 0===(e=window.event)?32:_m(e.type)}function Ue(e,t){var n=O.p;try{return O.p=e,t()}finally{O.p=n}}var qe=Math.random().toString(36).slice(2),Be="__reactFiber$"+qe,We="__reactProps$"+qe,Ve="__reactContainer$"+qe,He="__reactEvents$"+qe,Ke="__reactListeners$"+qe,Ge="__reactHandles$"+qe,Qe="__reactResources$"+qe,Ye="__reactMarker$"+qe;function Xe(e){delete e[Be],delete e[We],delete e[He],delete e[Ke],delete e[Ge]}function Je(e){var t=e[Be];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ve]||n[Be]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Rd(e);null!==e;){if(n=e[Be])return n;e=Rd(e)}return t}n=(e=n).parentNode}return null}function Ze(e){if(e=e[Be]||e[Ve]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function et(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(a(33))}function tt(e){var t=e[Qe];return t||(t=e[Qe]={hoistableStyles:/* @__PURE__ */new Map,hoistableScripts:/* @__PURE__ */new Map}),t}function nt(e){e[Ye]=!0}var rt=/* @__PURE__ */new Set,at={};function it(e,t){ot(e,t),ot(e+"Capture",t)}function ot(e,t){for(at[e]=t,e=0;e<t.length;e++)rt.add(t[e])}var lt=RegExp("^[: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]*$"),st={},ct={};function ut(e,t,n){if(a=t,ie.call(ct,a)||!ie.call(st,a)&&(lt.test(a)?ct[a]=!0:(st[a]=!0,0)))if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var r=t.toLowerCase().slice(0,5);if("data-"!==r&&"aria-"!==r)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}var a}function dt(e,t,n){if(null===n)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+n)}}function mt(e,t,n,r){if(null===r)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+r)}}function ht(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function pt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ft(e){if(!e._valueTracker){var t=pt(e)?"checked":"value";e._valueTracker=function(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==r&&"function"==typeof r.get&&"function"==typeof r.set){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(e){n=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function gt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=pt(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function bt(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var yt=/[\n"\\]/g;function vt(e){return e.replace(yt,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function wt(e,t,n,r,a,i,o,l){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ht(t)):e.value!==""+ht(t)&&(e.value=""+ht(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?kt(e,o,ht(t)):null!=n?kt(e,o,ht(n)):null!=r&&e.removeAttribute("value"),null==a&&null!=i&&(e.defaultChecked=!!i),null!=a&&(e.checked=a&&"function"!=typeof a&&"symbol"!=typeof a),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ht(l):e.removeAttribute("name")}function xt(e,t,n,r,a,i,o,l){if(null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.type=i),null!=t||null!=n){if(("submit"===i||"reset"===i)&&null==t)return void ft(e);n=null!=n?""+ht(n):"",t=null!=t?""+ht(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:a)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o),ft(e)}function kt(e,t,n){"number"===t&&bt(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ct(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ht(n),t=null,a=0;a<e.length;a++){if(e[a].value===n)return e[a].selected=!0,void(r&&(e[a].defaultSelected=!0));null!==t||e[a].disabled||(t=e[a])}null!==t&&(t.selected=!0)}}function St(e,t,n){null==t||((t=""+ht(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+ht(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function Nt(e,t,n,r){if(null==t){if(null!=r){if(null!=n)throw Error(a(92));if(L(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}null==n&&(n=""),t=n}n=ht(t),e.defaultValue=n,(r=e.textContent)===n&&""!==r&&null!==r&&(e.value=r),ft(e)}function Et(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var $t=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function _t(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||$t.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function zt(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(a(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&_t(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&_t(e,o,t[o])}function Tt(e){if(-1===e.indexOf("-"))return!1;switch(e){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 At=/* @__PURE__ */new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Pt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Mt(e){return Pt.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function It(){}var Lt=null;function Dt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ot=null,Rt=null;function jt(e){var t=Ze(e);if(t&&(e=t.stateNode)){var n=e[We]||null;e:switch(e=t.stateNode,t.type){case"input":if(wt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+vt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[We]||null;if(!i)throw Error(a(90));wt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)(r=n[t]).form===e.form&&gt(r)}break e;case"textarea":St(e,n.value,n.defaultValue);break e;case"select":null!=(t=n.value)&&Ct(e,!!n.multiple,t,!1)}}}var Ft=!1;function Ut(e,t,n){if(Ft)return e(t,n);Ft=!0;try{return e(t)}finally{if(Ft=!1,(null!==Ot||null!==Rt)&&(tu(),Ot&&(t=Ot,e=Rt,Rt=Ot=null,jt(t),e)))for(t=0;t<e.length;t++)jt(e[t])}}function qt(e,t){var n=e.stateNode;if(null===n)return null;var r=n[We]||null;if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(a(231,t,typeof n));return n}var Bt=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Wt=!1;if(Bt)try{var Vt={};Object.defineProperty(Vt,"passive",{get:function(){Wt=!0}}),window.addEventListener("test",Vt,Vt),window.removeEventListener("test",Vt,Vt)}catch(Zm){Wt=!1}var Ht=null,Kt=null,Gt=null;function Qt(){if(Gt)return Gt;var e,t,n=Kt,r=n.length,a="value"in Ht?Ht.value:Ht.textContent,i=a.length;for(e=0;e<r&&n[e]===a[e];e++);var o=r-e;for(t=1;t<=o&&n[r-t]===a[i-t];t++);return Gt=a.slice(e,1<t?1-t:void 0)}function Yt(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Xt(){return!0}function Jt(){return!1}function Zt(e){function t(t,n,r,a,i){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=a,this.target=i,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(a):a[o]);return this.isDefaultPrevented=(null!=a.defaultPrevented?a.defaultPrevented:!1===a.returnValue)?Xt:Jt,this.isPropagationStopped=Jt,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Xt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Xt)},persist:function(){},isPersistent:Xt}),t}var en,tn,nn,rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},an=Zt(rn),on=m({},rn,{view:0,detail:0}),ln=Zt(on),sn=m({},on,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nn&&(nn&&"mousemove"===e.type?(en=e.screenX-nn.screenX,tn=e.screenY-nn.screenY):tn=en=0,nn=e),en)},movementY:function(e){return"movementY"in e?e.movementY:tn}}),cn=Zt(sn),un=Zt(m({},sn,{dataTransfer:0})),dn=Zt(m({},on,{relatedTarget:0})),mn=Zt(m({},rn,{animationName:0,elapsedTime:0,pseudoElement:0})),hn=Zt(m({},rn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),pn=Zt(m({},rn,{data:0})),fn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},bn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=bn[e])&&!!t[e]}function vn(){return yn}var wn=Zt(m({},on,{key:function(e){if(e.key){var t=fn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Yt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?gn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vn,charCode:function(e){return"keypress"===e.type?Yt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Yt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),xn=Zt(m({},sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=Zt(m({},on,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vn})),Cn=Zt(m({},rn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Sn=Zt(m({},sn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Nn=Zt(m({},rn,{newState:0,oldState:0})),En=[9,13,27,32],$n=Bt&&"CompositionEvent"in window,_n=null;Bt&&"documentMode"in document&&(_n=document.documentMode);var zn=Bt&&"TextEvent"in window&&!_n,Tn=Bt&&(!$n||_n&&8<_n&&11>=_n),An=String.fromCharCode(32),Pn=!1;function Mn(e,t){switch(e){case"keyup":return-1!==En.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function In(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ln=!1;var Dn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function On(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Dn[e.type]:"textarea"===t}function Rn(e,t,n,r){Ot?Rt?Rt.push(r):Rt=[r]:Ot=r,0<(t=id(t,"onChange")).length&&(n=new an("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var jn=null,Fn=null;function Un(e){Xu(e,0)}function qn(e){if(gt(et(e)))return e}function Bn(e,t){if("change"===e)return t}var Wn=!1;if(Bt){var Vn;if(Bt){var Hn="oninput"in document;if(!Hn){var Kn=document.createElement("div");Kn.setAttribute("oninput","return;"),Hn="function"==typeof Kn.oninput}Vn=Hn}else Vn=!1;Wn=Vn&&(!document.documentMode||9<document.documentMode)}function Gn(){jn&&(jn.detachEvent("onpropertychange",Qn),Fn=jn=null)}function Qn(e){if("value"===e.propertyName&&qn(Fn)){var t=[];Rn(t,Fn,e,Dt(e)),Ut(Un,t)}}function Yn(e,t,n){"focusin"===e?(Gn(),Fn=n,(jn=t).attachEvent("onpropertychange",Qn)):"focusout"===e&&Gn()}function Xn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return qn(Fn)}function Jn(e,t){if("click"===e)return qn(t)}function Zn(e,t){if("input"===e||"change"===e)return qn(t)}var er="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function tr(e,t){if(er(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!ie.call(t,a)||!er(e[a],t[a]))return!1}return!0}function nr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function rr(e,t){var n,r=nr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=nr(r)}}function ar(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ar(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function ir(e){for(var t=bt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=bt((e=t.contentWindow).document)}return t}function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var lr=Bt&&"documentMode"in document&&11>=document.documentMode,sr=null,cr=null,ur=null,dr=!1;function mr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;dr||null==sr||sr!==bt(r)||("selectionStart"in(r=sr)&&or(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ur&&tr(ur,r)||(ur=r,0<(r=id(cr,"onSelect")).length&&(t=new an("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=sr)))}function hr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pr={animationend:hr("Animation","AnimationEnd"),animationiteration:hr("Animation","AnimationIteration"),animationstart:hr("Animation","AnimationStart"),transitionrun:hr("Transition","TransitionRun"),transitionstart:hr("Transition","TransitionStart"),transitioncancel:hr("Transition","TransitionCancel"),transitionend:hr("Transition","TransitionEnd")},fr={},gr={};function br(e){if(fr[e])return fr[e];if(!pr[e])return e;var t,n=pr[e];for(t in n)if(n.hasOwnProperty(t)&&t in gr)return fr[e]=n[t];return e}Bt&&(gr=document.createElement("div").style,"AnimationEvent"in window||(delete pr.animationend.animation,delete pr.animationiteration.animation,delete pr.animationstart.animation),"TransitionEvent"in window||delete pr.transitionend.transition);var yr=br("animationend"),vr=br("animationiteration"),wr=br("animationstart"),xr=br("transitionrun"),kr=br("transitionstart"),Cr=br("transitioncancel"),Sr=br("transitionend"),Nr=/* @__PURE__ */new Map,Er="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function $r(e,t){Nr.set(e,t),it(t,[e])}Er.push("scrollEnd");var _r="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},zr=[],Tr=0,Ar=0;function Pr(){for(var e=Tr,t=Ar=Tr=0;t<e;){var n=zr[t];zr[t++]=null;var r=zr[t];zr[t++]=null;var a=zr[t];zr[t++]=null;var i=zr[t];if(zr[t++]=null,null!==r&&null!==a){var o=r.pending;null===o?a.next=a:(a.next=o.next,o.next=a),r.pending=a}0!==i&&Dr(n,a,i)}}function Mr(e,t,n,r){zr[Tr++]=e,zr[Tr++]=t,zr[Tr++]=n,zr[Tr++]=r,Ar|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function Ir(e,t,n,r){return Mr(e,t,n,r),Or(e)}function Lr(e,t){return Mr(e,null,null,t),Or(e)}function Dr(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var a=!1,i=e.return;null!==i;)i.childLanes|=n,null!==(r=i.alternate)&&(r.childLanes|=n),22===i.tag&&(null===(e=i.stateNode)||1&e._visibility||(a=!0)),e=i,i=i.return;return 3===e.tag?(i=e.stateNode,a&&null!==t&&(a=31-ke(n),null===(r=(e=i.hiddenUpdates)[a])?e[a]=[t]:r.push(t),t.lane=536870912|n),i):null}function Or(e){if(50<Hc)throw Hc=0,Kc=null,Error(a(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Rr={};function jr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,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 Fr(e,t,n,r){return new jr(e,t,n,r)}function Ur(e){return!(!(e=e.prototype)||!e.isReactComponent)}function qr(e,t){var n=e.alternate;return null===n?((n=Fr(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=65011712&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Br(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Wr(e,t,n,r,i,o){var l=0;if(r=e,"function"==typeof e)Ur(e)&&(l=1);else if("string"==typeof e)l=function(e,t,n){if(1===n||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,n,H.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case z:return(e=Fr(31,n,t,i)).elementType=z,e.lanes=o,e;case b:return Vr(n.children,i,o,t);case v:l=8,i|=24;break;case w:return(e=Fr(12,n,t,2|i)).elementType=w,e.lanes=o,e;case N:return(e=Fr(13,n,t,i)).elementType=N,e.lanes=o,e;case E:return(e=Fr(19,n,t,i)).elementType=E,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case C:l=10;break e;case k:l=9;break e;case S:l=11;break e;case $:l=14;break e;case _:l=16,r=null;break e}l=29,n=Error(a(130,null===e?"null":typeof e,"")),r=null}return(t=Fr(l,n,t,i)).elementType=e,t.type=r,t.lanes=o,t}function Vr(e,t,n,r){return(e=Fr(7,e,r,t)).lanes=n,e}function Hr(e,t,n){return(e=Fr(6,e,null,t)).lanes=n,e}function Kr(e){var t=Fr(18,null,null,0);return t.stateNode=e,t}function Gr(e,t,n){return(t=Fr(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Qr=/* @__PURE__ */new WeakMap;function Yr(e,t){if("object"==typeof e&&null!==e){var n=Qr.get(e);return void 0!==n?n:(t={value:e,source:t,stack:ae(t)},Qr.set(e,t),t)}return{value:e,source:t,stack:ae(t)}}var Xr=[],Jr=0,Zr=null,ea=0,ta=[],na=0,ra=null,aa=1,ia="";function oa(e,t){Xr[Jr++]=ea,Xr[Jr++]=Zr,Zr=e,ea=t}function la(e,t,n){ta[na++]=aa,ta[na++]=ia,ta[na++]=ra,ra=e;var r=aa;e=ia;var a=32-ke(r)-1;r&=~(1<<a),n+=1;var i=32-ke(t)+a;if(30<i){var o=a-a%5;i=(r&(1<<o)-1).toString(32),r>>=o,a-=o,aa=1<<32-ke(t)+a|n<<a|r,ia=i+e}else aa=1<<i|n<<a|r,ia=e}function sa(e){null!==e.return&&(oa(e,1),la(e,1,0))}function ca(e){for(;e===Zr;)Zr=Xr[--Jr],Xr[Jr]=null,ea=Xr[--Jr],Xr[Jr]=null;for(;e===ra;)ra=ta[--na],ta[na]=null,ia=ta[--na],ta[na]=null,aa=ta[--na],ta[na]=null}function ua(e,t){ta[na++]=aa,ta[na++]=ia,ta[na++]=ra,aa=t.id,ia=t.overflow,ra=e}var da=null,ma=null,ha=!1,pa=null,fa=!1,ga=Error(a(519));function ba(e){throw Ca(Yr(Error(a(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),ga}function ya(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Be]=e,t[We]=r,n){case"dialog":Ju("cancel",t),Ju("close",t);break;case"iframe":case"object":case"embed":Ju("load",t);break;case"video":case"audio":for(n=0;n<Qu.length;n++)Ju(Qu[n],t);break;case"source":Ju("error",t);break;case"img":case"image":case"link":Ju("error",t),Ju("load",t);break;case"details":Ju("toggle",t);break;case"input":Ju("invalid",t),xt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ju("invalid",t);break;case"textarea":Ju("invalid",t),Nt(t,r.value,r.defaultValue,r.children)}"string"!=typeof(n=r.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===r.suppressHydrationWarning||dd(t.textContent,n)?(null!=r.popover&&(Ju("beforetoggle",t),Ju("toggle",t)),null!=r.onScroll&&Ju("scroll",t),null!=r.onScrollEnd&&Ju("scrollend",t),null!=r.onClick&&(t.onclick=It),t=!0):t=!1,t||ba(e,!0)}function va(e){for(da=e.return;da;)switch(da.tag){case 5:case 31:case 13:return void(fa=!1);case 27:case 3:return void(fa=!0);default:da=da.return}}function wa(e){if(e!==da)return!1;if(!ha)return va(e),ha=!0,!1;var t,n=e.tag;if((t=3!==n&&27!==n)&&((t=5===n)&&(t=!("form"!==(t=e.type)&&"button"!==t)||xd(e.type,e.memoizedProps)),t=!t),t&&ma&&ba(e),va(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));ma=Od(e)}else if(31===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));ma=Od(e)}else 27===n?(n=ma,_d(e.type)?(e=Dd,Dd=null,ma=e):ma=n):ma=da?Ld(e.stateNode.nextSibling):null;return!0}function xa(){ma=da=null,ha=!1}function ka(){var e=pa;return null!==e&&(null===Pc?Pc=e:Pc.push.apply(Pc,e),pa=null),e}function Ca(e){null===pa?pa=[e]:pa.push(e)}var Sa=U(null),Na=null,Ea=null;function $a(e,t,n){B(Sa,t._currentValue),t._currentValue=n}function _a(e){e._currentValue=Sa.current,q(Sa)}function za(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ta(e,t,n,r){var i=e.child;for(null!==i&&(i.return=e);null!==i;){var o=i.dependencies;if(null!==o){var l=i.child;o=o.firstContext;e:for(;null!==o;){var s=o;o=i;for(var c=0;c<t.length;c++)if(s.context===t[c]){o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),za(o.return,n,e),r||(l=null);break e}o=s.next}}else if(18===i.tag){if(null===(l=i.return))throw Error(a(341));l.lanes|=n,null!==(o=l.alternate)&&(o.lanes|=n),za(l,n,e),l=null}else l=i.child;if(null!==l)l.return=i;else for(l=i;null!==l;){if(l===e){l=null;break}if(null!==(i=l.sibling)){i.return=l.return,l=i;break}l=l.return}i=l}}function Aa(e,t,n,r){e=null;for(var i=t,o=!1;null!==i;){if(!o)if(524288&i.flags)o=!0;else if(262144&i.flags)break;if(10===i.tag){var l=i.alternate;if(null===l)throw Error(a(387));if(null!==(l=l.memoizedProps)){var s=i.type;er(i.pendingProps.value,l.value)||(null!==e?e.push(s):e=[s])}}else if(i===Q.current){if(null===(l=i.alternate))throw Error(a(387));l.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(null!==e?e.push(mm):e=[mm])}i=i.return}null!==e&&Ta(t,e,n,r),t.flags|=262144}function Pa(e){for(e=e.firstContext;null!==e;){if(!er(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ma(e){Na=e,Ea=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Ia(e){return Da(Na,e)}function La(e,t){return null===Na&&Ma(e),Da(e,t)}function Da(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===Ea){if(null===e)throw Error(a(308));Ea=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ea=Ea.next=t;return n}var Oa="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Ra=t.unstable_scheduleCallback,ja=t.unstable_NormalPriority,Fa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ua(){return{controller:new Oa,data:/* @__PURE__ */new Map,refCount:0}}function qa(e){e.refCount--,0===e.refCount&&Ra(ja,function(){e.controller.abort()})}var Ba=null,Wa=0,Va=0,Ha=null;function Ka(){if(0===--Wa&&null!==Ba){null!==Ha&&(Ha.status="fulfilled");var e=Ba;Ba=null,Va=0,Ha=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Ga=D.S;D.S=function(e,t){Lc=ue(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===Ba){var n=Ba=[];Wa=0,Va=Wu(),Ha={status:"pending",value:void 0,then:function(e){n.push(e)}}}Wa++,t.then(Ka,Ka)}(0,t),null!==Ga&&Ga(e,t)};var Qa=U(null);function Ya(){var e=Qa.current;return null!==e?e:gc.pooledCache}function Xa(e,t){B(Qa,null===t?Qa.current:t.pool)}function Ja(){var e=Ya();return null===e?null:{parent:Fa._currentValue,pool:e}}var Za=Error(a(460)),ei=Error(a(474)),ti=Error(a(542)),ni={then:function(){}};function ri(e){return"fulfilled"===(e=e.status)||"rejected"===e}function ai(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(It,It),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw si(e=t.reason),e;default:if("string"==typeof t.status)t.then(It,It);else{if(null!==(e=gc)&&100<e.shellSuspendCounter)throw Error(a(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw si(e=t.reason),e}throw oi=t,Za}}function ii(e){try{return(0,e._init)(e._payload)}catch(t){if(null!==t&&"object"==typeof t&&"function"==typeof t.then)throw oi=t,Za;throw t}}var oi=null;function li(){if(null===oi)throw Error(a(459));var e=oi;return oi=null,e}function si(e){if(e===Za||e===ti)throw Error(a(483))}var ci=null,ui=0;function di(e){var t=ui;return ui+=1,null===ci&&(ci=[]),ai(ci,e,t)}function mi(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function hi(e,t){if(t.$$typeof===h)throw Error(a(525));throw e=Object.prototype.toString.call(t),Error(a(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function pi(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e){for(var t=/* @__PURE__ */new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(e,t){return(e=qr(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=67108866,n):r:(t.flags|=67108866,n):(t.flags|=1048576,n)}function l(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,r){return null===t||6!==t.tag?((t=Hr(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function c(e,t,n,r){var a=n.type;return a===b?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===_&&ii(a)===t.type)?(mi(t=i(t,n.props),n),t.return=e,t):(mi(t=Wr(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Gr(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function d(e,t,n,r,a){return null===t||7!==t.tag?((t=Vr(n,e.mode,r,a)).return=e,t):((t=i(t,n)).return=e,t)}function m(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Hr(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case p:return mi(n=Wr(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case g:return(t=Gr(t,e.mode,n)).return=e,t;case _:return m(e,t=ii(t),n)}if(L(t)||P(t))return(t=Vr(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return m(e,di(t),n);if(t.$$typeof===C)return m(e,La(e,t),n);hi(e,t)}return null}function h(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==a?null:s(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case p:return n.key===a?c(e,t,n,r):null;case g:return n.key===a?u(e,t,n,r):null;case _:return h(e,t,n=ii(n),r)}if(L(n)||P(n))return null!==a?null:d(e,t,n,r,null);if("function"==typeof n.then)return h(e,t,di(n),r);if(n.$$typeof===C)return h(e,t,La(e,n),r);hi(e,n)}return null}function f(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return s(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case p:return c(t,e=e.get(null===r.key?n:r.key)||null,r,a);case g:return u(t,e=e.get(null===r.key?n:r.key)||null,r,a);case _:return f(e,t,n,r=ii(r),a)}if(L(r)||P(r))return d(t,e=e.get(n)||null,r,a,null);if("function"==typeof r.then)return f(e,t,n,di(r),a);if(r.$$typeof===C)return f(e,t,n,La(t,r),a);hi(t,r)}return null}function y(s,c,u,d){if("object"==typeof u&&null!==u&&u.type===b&&null===u.key&&(u=u.props.children),"object"==typeof u&&null!==u){switch(u.$$typeof){case p:e:{for(var v=u.key;null!==c;){if(c.key===v){if((v=u.type)===b){if(7===c.tag){n(s,c.sibling),(d=i(c,u.props.children)).return=s,s=d;break e}}else if(c.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===_&&ii(v)===c.type){n(s,c.sibling),mi(d=i(c,u.props),u),d.return=s,s=d;break e}n(s,c);break}t(s,c),c=c.sibling}u.type===b?((d=Vr(u.props.children,s.mode,d,u.key)).return=s,s=d):(mi(d=Wr(u.type,u.key,u.props,null,s.mode,d),u),d.return=s,s=d)}return l(s);case g:e:{for(v=u.key;null!==c;){if(c.key===v){if(4===c.tag&&c.stateNode.containerInfo===u.containerInfo&&c.stateNode.implementation===u.implementation){n(s,c.sibling),(d=i(c,u.children||[])).return=s,s=d;break e}n(s,c);break}t(s,c),c=c.sibling}(d=Gr(u,s.mode,d)).return=s,s=d}return l(s);case _:return y(s,c,u=ii(u),d)}if(L(u))return function(a,i,l,s){for(var c=null,u=null,d=i,p=i=0,g=null;null!==d&&p<l.length;p++){d.index>p?(g=d,d=null):g=d.sibling;var b=h(a,d,l[p],s);if(null===b){null===d&&(d=g);break}e&&d&&null===b.alternate&&t(a,d),i=o(b,i,p),null===u?c=b:u.sibling=b,u=b,d=g}if(p===l.length)return n(a,d),ha&&oa(a,p),c;if(null===d){for(;p<l.length;p++)null!==(d=m(a,l[p],s))&&(i=o(d,i,p),null===u?c=d:u.sibling=d,u=d);return ha&&oa(a,p),c}for(d=r(d);p<l.length;p++)null!==(g=f(d,a,p,l[p],s))&&(e&&null!==g.alternate&&d.delete(null===g.key?p:g.key),i=o(g,i,p),null===u?c=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(a,e)}),ha&&oa(a,p),c}(s,c,u,d);if(P(u)){if("function"!=typeof(v=P(u)))throw Error(a(150));return function(i,l,s,c){if(null==s)throw Error(a(151));for(var u=null,d=null,p=l,g=l=0,b=null,y=s.next();null!==p&&!y.done;g++,y=s.next()){p.index>g?(b=p,p=null):b=p.sibling;var v=h(i,p,y.value,c);if(null===v){null===p&&(p=b);break}e&&p&&null===v.alternate&&t(i,p),l=o(v,l,g),null===d?u=v:d.sibling=v,d=v,p=b}if(y.done)return n(i,p),ha&&oa(i,g),u;if(null===p){for(;!y.done;g++,y=s.next())null!==(y=m(i,y.value,c))&&(l=o(y,l,g),null===d?u=y:d.sibling=y,d=y);return ha&&oa(i,g),u}for(p=r(p);!y.done;g++,y=s.next())null!==(y=f(p,i,g,y.value,c))&&(e&&null!==y.alternate&&p.delete(null===y.key?g:y.key),l=o(y,l,g),null===d?u=y:d.sibling=y,d=y);return e&&p.forEach(function(e){return t(i,e)}),ha&&oa(i,g),u}(s,c,u=v.call(u),d)}if("function"==typeof u.then)return y(s,c,di(u),d);if(u.$$typeof===C)return y(s,c,La(s,u),d);hi(s,u)}return"string"==typeof u&&""!==u||"number"==typeof u||"bigint"==typeof u?(u=""+u,null!==c&&6===c.tag?(n(s,c.sibling),(d=i(c,u)).return=s,s=d):(n(s,c),(d=Hr(u,s.mode,d)).return=s,s=d),l(s)):n(s,c)}return function(e,t,n,r){try{ui=0;var a=y(e,t,n,r);return ci=null,a}catch(o){if(o===Za||o===ti)throw o;var i=Fr(29,o,null,e.mode);return i.lanes=r,i.return=e,i}}}var fi=pi(!0),gi=pi(!1),bi=!1;function yi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vi(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function wi(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xi(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&fc){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=Or(e),Dr(e,null,n),t}return Mr(e,r,t,n),Or(e)}function ki(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,De(e,n)}}function Ci(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,i=null;if(null!==(n=n.firstBaseUpdate)){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===i?a=i=o:i=i.next=o,n=n.next}while(null!==n);null===i?a=i=t:i=i.next=t}else a=i=t;return n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Si=!1;function Ni(){if(Si){if(null!==Ha)throw Ha}}function Ei(e,t,n,r){Si=!1;var a=e.updateQueue;bi=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(null!==l){a.shared.pending=null;var s=l,c=s.next;s.next=null,null===o?i=c:o.next=c,o=s;var u=e.alternate;null!==u&&((l=(u=u.updateQueue).lastBaseUpdate)!==o&&(null===l?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=s))}if(null!==i){var d=a.baseState;for(o=0,u=c=s=null,l=i;;){var h=-536870913&l.lane,p=h!==l.lane;if(p?(yc&h)===h:(r&h)===h){0!==h&&h===Va&&(Si=!0),null!==u&&(u=u.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var f=e,g=l;h=t;var b=n;switch(g.tag){case 1:if("function"==typeof(f=g.payload)){d=f.call(b,d,h);break e}d=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(h="function"==typeof(f=g.payload)?f.call(b,d,h):f))break e;d=m({},d,h);break e;case 2:bi=!0}}null!==(h=l.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=a.callbacks)?a.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===u?(c=u=p,s=d):u=u.next=p,o|=h;if(null===(l=l.next)){if(null===(l=a.shared.pending))break;l=(p=l).next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}null===u&&(s=d),a.baseState=s,a.firstBaseUpdate=c,a.lastBaseUpdate=u,null===i&&(a.shared.lanes=0),Ec|=o,e.lanes=o,e.memoizedState=d}}function $i(e,t){if("function"!=typeof e)throw Error(a(191,e));e.call(t)}function _i(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)$i(n[e],t)}var zi=U(null),Ti=U(0);function Ai(e,t){B(Ti,e=Sc),B(zi,t),Sc=e|t.baseLanes}function Pi(){B(Ti,Sc),B(zi,zi.current)}function Mi(){Sc=Ti.current,q(zi),q(Ti)}var Ii=U(null),Li=null;function Di(e){var t=e.alternate;B(Ui,1&Ui.current),B(Ii,e),null===Li&&(null===t||null!==zi.current||null!==t.memoizedState)&&(Li=e)}function Oi(e){B(Ui,Ui.current),B(Ii,e),null===Li&&(Li=e)}function Ri(e){22===e.tag?(B(Ui,Ui.current),B(Ii,e),null===Li&&(Li=e)):ji()}function ji(){B(Ui,Ui.current),B(Ii,Ii.current)}function Fi(e){q(Ii),Li===e&&(Li=null),q(Ui)}var Ui=U(0);function qi(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Md(n)||Id(n)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(128&t.flags)return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Bi=0,Wi=null,Vi=null,Hi=null,Ki=!1,Gi=!1,Qi=!1,Yi=0,Xi=0,Ji=null,Zi=0;function eo(){throw Error(a(321))}function to(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!er(e[n],t[n]))return!1;return!0}function no(e,t,n,r,a,i){return Bi=i,Wi=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=null===e||null===e.memoizedState?yl:vl,Qi=!1,i=n(r,a),Qi=!1,Gi&&(i=ao(t,n,r,a)),ro(e),i}function ro(e){D.H=bl;var t=null!==Vi&&null!==Vi.next;if(Bi=0,Hi=Vi=Wi=null,Ki=!1,Xi=0,Ji=null,t)throw Error(a(300));null===e||Ll||null!==(e=e.dependencies)&&Pa(e)&&(Ll=!0)}function ao(e,t,n,r){Wi=e;var i=0;do{if(Gi&&(Ji=null),Xi=0,Gi=!1,25<=i)throw Error(a(301));if(i+=1,Hi=Vi=null,null!=e.updateQueue){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,null!=o.memoCache&&(o.memoCache.index=0)}D.H=wl,o=t(n,r)}while(Gi);return o}function io(){var e=D.H,t=e.useState()[0];return t="function"==typeof t.then?mo(t):t,e=e.useState()[0],(null!==Vi?Vi.memoizedState:null)!==e&&(Wi.flags|=1024),t}function oo(){var e=0!==Yi;return Yi=0,e}function lo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function so(e){if(Ki){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Ki=!1}Bi=0,Hi=Vi=Wi=null,Gi=!1,Xi=Yi=0,Ji=null}function co(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Hi?Wi.memoizedState=Hi=e:Hi=Hi.next=e,Hi}function uo(){if(null===Vi){var e=Wi.alternate;e=null!==e?e.memoizedState:null}else e=Vi.next;var t=null===Hi?Wi.memoizedState:Hi.next;if(null!==t)Hi=t,Vi=e;else{if(null===e){if(null===Wi.alternate)throw Error(a(467));throw Error(a(310))}e={memoizedState:(Vi=e).memoizedState,baseState:Vi.baseState,baseQueue:Vi.baseQueue,queue:Vi.queue,next:null},null===Hi?Wi.memoizedState=Hi=e:Hi=Hi.next=e}return Hi}function mo(e){var t=Xi;return Xi+=1,null===Ji&&(Ji=[]),e=ai(Ji,e,t),t=Wi,null===(null===Hi?t.memoizedState:Hi.next)&&(t=t.alternate,D.H=null===t||null===t.memoizedState?yl:vl),e}function ho(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return mo(e);if(e.$$typeof===C)return Ia(e)}throw Error(a(438,String(e)))}function po(e){var t=null,n=Wi.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=Wi.alternate;null!==r&&(null!==(r=r.updateQueue)&&(null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===n&&(n={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=T;return t.index++,n}function fo(e,t){return"function"==typeof t?t(e):t}function go(e){return bo(uo(),Vi,e)}function bo(e,t,n){var r=e.queue;if(null===r)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(null!==o){if(null!==i){var l=i.next;i.next=o.next,o.next=l}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,null===i)e.memoizedState=o;else{var s=l=null,c=null,u=t=i.next,d=!1;do{var m=-536870913&u.lane;if(m!==u.lane?(yc&m)===m:(Bi&m)===m){var h=u.revertLane;if(0===h)null!==c&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),m===Va&&(d=!0);else{if((Bi&h)===h){u=u.next,h===Va&&(d=!0);continue}m={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=m,l=o):c=c.next=m,Wi.lanes|=h,Ec|=h}m=u.action,Qi&&n(o,m),o=u.hasEagerState?u.eagerState:n(o,m)}else h={lane:m,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=h,l=o):c=c.next=h,Wi.lanes|=m,Ec|=m;u=u.next}while(null!==u&&u!==t);if(null===c?l=o:c.next=s,!er(o,e.memoizedState)&&(Ll=!0,d&&null!==(n=Ha)))throw n;e.memoizedState=o,e.baseState=l,e.baseQueue=c,r.lastRenderedState=o}return null===i&&(r.lanes=0),[e.memoizedState,r.dispatch]}function yo(e){var t=uo(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var l=i=i.next;do{o=e(o,l.action),l=l.next}while(l!==i);er(o,t.memoizedState)||(Ll=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vo(e,t,n){var r=Wi,i=uo(),o=ha;if(o){if(void 0===n)throw Error(a(407));n=n()}else n=t();var l=!er((Vi||i).memoizedState,n);if(l&&(i.memoizedState=n,Ll=!0),i=i.queue,Wo(ko.bind(null,r,i,e),[e]),i.getSnapshot!==t||l||null!==Hi&&1&Hi.memoizedState.tag){if(r.flags|=2048,jo(9,{destroy:void 0},xo.bind(null,r,i,n,t),null),null===gc)throw Error(a(349));o||127&Bi||wo(r,t,n)}return n}function wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Wi.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function xo(e,t,n,r){t.value=n,t.getSnapshot=r,Co(t)&&So(e)}function ko(e,t,n){return n(function(){Co(t)&&So(e)})}function Co(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!er(e,n)}catch(r){return!0}}function So(e){var t=Lr(e,2);null!==t&&Yc(t,e,2)}function No(e){var t=co();if("function"==typeof e){var n=e;if(e=n(),Qi){xe(!0);try{n()}finally{xe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:e},t}function Eo(e,t,n,r){return e.baseState=n,bo(e,Vi,"function"==typeof r?r:fo)}function $o(e,t,n,r,i){if(pl(e))throw Error(a(485));if(null!==(e=t.action)){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};null!==D.T?n(!0):o.isTransition=!1,r(o),null===(n=t.pending)?(o.next=t.pending=o,_o(t,o)):(o.next=n.next,t.pending=n.next=o)}}function _o(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var i=D.T,o={};D.T=o;try{var l=n(a,r),s=D.S;null!==s&&s(o,l),zo(e,t,l)}catch(c){Ao(e,t,c)}finally{null!==i&&null!==o.types&&(i.types=o.types),D.T=i}}else try{zo(e,t,i=n(a,r))}catch(u){Ao(e,t,u)}}function zo(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){To(e,t,n)},function(n){return Ao(e,t,n)}):To(e,t,n)}function To(e,t,n){t.status="fulfilled",t.value=n,Po(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,_o(e,n)))}function Ao(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do{t.status="rejected",t.reason=n,Po(t),t=t.next}while(t!==r)}e.action=null}function Po(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mo(e,t){return t}function Io(e,t){if(ha){var n=gc.formState;if(null!==n){e:{var r=Wi;if(ha){if(ma){t:{for(var a=ma,i=fa;8!==a.nodeType;){if(!i){a=null;break t}if(null===(a=Ld(a.nextSibling))){a=null;break t}}a="F!"===(i=a.data)||"F"===i?a:null}if(a){ma=Ld(a.nextSibling),r="F!"===a.data;break e}}ba(r)}r=!1}r&&(t=n[0])}}return(n=co()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:t},n.queue=r,n=dl.bind(null,Wi,r),r.dispatch=n,r=No(!1),i=hl.bind(null,Wi,!1,r.queue),a={state:t,dispatch:null,action:e,pending:null},(r=co()).queue=a,n=$o.bind(null,Wi,a,i,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function Lo(e){return Do(uo(),Vi,e)}function Do(e,t,n){if(t=bo(e,t,Mo)[0],e=go(fo)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=mo(t)}catch(o){if(o===Za)throw ti;throw o}else r=t;var a=(t=uo()).queue,i=a.dispatch;return n!==t.memoizedState&&(Wi.flags|=2048,jo(9,{destroy:void 0},Oo.bind(null,a,n),null)),[r,i,e]}function Oo(e,t){e.action=t}function Ro(e){var t=uo(),n=Vi;if(null!==n)return Do(t,n,e);uo(),t=t.memoizedState;var r=(n=uo()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function jo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=Wi.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Fo(){return uo().memoizedState}function Uo(e,t,n,r){var a=co();Wi.flags|=e,a.memoizedState=jo(1|t,{destroy:void 0},n,void 0===r?null:r)}function qo(e,t,n,r){var a=uo();r=void 0===r?null:r;var i=a.memoizedState.inst;null!==Vi&&null!==r&&to(r,Vi.memoizedState.deps)?a.memoizedState=jo(t,i,n,r):(Wi.flags|=e,a.memoizedState=jo(1|t,i,n,r))}function Bo(e,t){Uo(8390656,8,e,t)}function Wo(e,t){qo(2048,8,e,t)}function Vo(e){var t=uo().memoizedState;return function(e){Wi.flags|=4;var t=Wi.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Wi.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if(2&fc)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function Ho(e,t){return qo(4,2,e,t)}function Ko(e,t){return qo(4,4,e,t)}function Go(e,t){if("function"==typeof t){e=e();var n=t(e);return function(){"function"==typeof n?n():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function Qo(e,t,n){n=null!=n?n.concat([e]):null,qo(4,4,Go.bind(null,t,e),n)}function Yo(){}function Xo(e,t){var n=uo();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&to(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Jo(e,t){var n=uo();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&to(t,r[1]))return r[0];if(r=e(),Qi){xe(!0);try{e()}finally{xe(!1)}}return n.memoizedState=[r,t],r}function Zo(e,t,n){return void 0===n||1073741824&Bi&&!(261930&yc)?e.memoizedState=t:(e.memoizedState=n,e=Qc(),Wi.lanes|=e,Ec|=e,n)}function el(e,t,n,r){return er(n,t)?n:null!==zi.current?(e=Zo(e,n,r),er(e,t)||(Ll=!0),e):42&Bi&&(!(1073741824&Bi)||261930&yc)?(e=Qc(),Wi.lanes|=e,Ec|=e,t):(Ll=!0,e.memoizedState=n)}function tl(e,t,n,r,a){var i=O.p;O.p=0!==i&&8>i?i:8;var o,l,s,c=D.T,u={};D.T=u,hl(e,!1,t,n);try{var d=a(),m=D.S;if(null!==m&&m(u,d),null!==d&&"object"==typeof d&&"function"==typeof d.then)ml(e,t,(o=r,l=[],s={status:"pending",value:null,reason:null,then:function(e){l.push(e)}},d.then(function(){s.status="fulfilled",s.value=o;for(var e=0;e<l.length;e++)(0,l[e])(o)},function(e){for(s.status="rejected",s.reason=e,e=0;e<l.length;e++)(0,l[e])(void 0)}),s),Gc());else ml(e,t,r,Gc())}catch(h){ml(e,t,{then:function(){},status:"rejected",reason:h},Gc())}finally{O.p=i,null!==c&&null!==u.types&&(c.types=u.types),D.T=c}}function nl(){}function rl(e,t,n,r){if(5!==e.tag)throw Error(a(476));var i=al(e).queue;tl(e,i,t,R,null===n?nl:function(){return il(e),n(r)})}function al(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:R},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function il(e){var t=al(e);null===t.next&&(t=e.alternate.memoizedState),ml(e,t.next.queue,{},Gc())}function ol(){return Ia(mm)}function ll(){return uo().memoizedState}function sl(){return uo().memoizedState}function cl(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=Gc(),r=xi(t,e=wi(n),n);return null!==r&&(Yc(r,t,n),ki(r,t,n)),t={cache:Ua()},void(e.payload=t)}t=t.return}}function ul(e,t,n){var r=Gc();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pl(e)?fl(t,n):null!==(n=Ir(e,t,n,r))&&(Yc(n,e,r),gl(n,t,r))}function dl(e,t,n){ml(e,t,n,Gc())}function ml(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pl(e))fl(t,a);else{var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var o=t.lastRenderedState,l=i(o,n);if(a.hasEagerState=!0,a.eagerState=l,er(l,o))return Mr(e,t,a,0),null===gc&&Pr(),!1}catch(s){}if(null!==(n=Ir(e,t,a,r)))return Yc(n,e,r),gl(n,t,r),!0}return!1}function hl(e,t,n,r){if(r={lane:2,revertLane:Wu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pl(e)){if(t)throw Error(a(479))}else null!==(t=Ir(e,n,r,2))&&Yc(t,e,2)}function pl(e){var t=e.alternate;return e===Wi||null!==t&&t===Wi}function fl(e,t){Gi=Ki=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gl(e,t,n){if(4194048&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,De(e,n)}}var bl={readContext:Ia,use:ho,useCallback:eo,useContext:eo,useEffect:eo,useImperativeHandle:eo,useLayoutEffect:eo,useInsertionEffect:eo,useMemo:eo,useReducer:eo,useRef:eo,useState:eo,useDebugValue:eo,useDeferredValue:eo,useTransition:eo,useSyncExternalStore:eo,useId:eo,useHostTransitionStatus:eo,useFormState:eo,useActionState:eo,useOptimistic:eo,useMemoCache:eo,useCacheRefresh:eo};bl.useEffectEvent=eo;var yl={readContext:Ia,use:ho,useCallback:function(e,t){return co().memoizedState=[e,void 0===t?null:t],e},useContext:Ia,useEffect:Bo,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,Uo(4194308,4,Go.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Uo(4194308,4,e,t)},useInsertionEffect:function(e,t){Uo(4,2,e,t)},useMemo:function(e,t){var n=co();t=void 0===t?null:t;var r=e();if(Qi){xe(!0);try{e()}finally{xe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=co();if(void 0!==n){var a=n(t);if(Qi){xe(!0);try{n(t)}finally{xe(!1)}}}else a=t;return r.memoizedState=r.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},r.queue=e,e=e.dispatch=ul.bind(null,Wi,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},co().memoizedState=e},useState:function(e){var t=(e=No(e)).queue,n=dl.bind(null,Wi,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Yo,useDeferredValue:function(e,t){return Zo(co(),e,t)},useTransition:function(){var e=No(!1);return e=tl.bind(null,Wi,e.queue,!0,!1),co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Wi,i=co();if(ha){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===gc)throw Error(a(349));127&yc||wo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,Bo(ko.bind(null,r,o,e),[e]),r.flags|=2048,jo(9,{destroy:void 0},xo.bind(null,r,o,n,t),null),n},useId:function(){var e=co(),t=gc.identifierPrefix;if(ha){var n=ia;t="_"+t+"R_"+(n=(aa&~(1<<32-ke(aa)-1)).toString(32)+n),0<(n=Yi++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=Zi++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ol,useFormState:Io,useActionState:Io,useOptimistic:function(e){var t=co();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=hl.bind(null,Wi,!0,n),n.dispatch=t,[e,t]},useMemoCache:po,useCacheRefresh:function(){return co().memoizedState=cl.bind(null,Wi)},useEffectEvent:function(e){var t=co(),n={impl:e};return t.memoizedState=n,function(){if(2&fc)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},vl={readContext:Ia,use:ho,useCallback:Xo,useContext:Ia,useEffect:Wo,useImperativeHandle:Qo,useInsertionEffect:Ho,useLayoutEffect:Ko,useMemo:Jo,useReducer:go,useRef:Fo,useState:function(){return go(fo)},useDebugValue:Yo,useDeferredValue:function(e,t){return el(uo(),Vi.memoizedState,e,t)},useTransition:function(){var e=go(fo)[0],t=uo().memoizedState;return["boolean"==typeof e?e:mo(e),t]},useSyncExternalStore:vo,useId:ll,useHostTransitionStatus:ol,useFormState:Lo,useActionState:Lo,useOptimistic:function(e,t){return Eo(uo(),0,e,t)},useMemoCache:po,useCacheRefresh:sl};vl.useEffectEvent=Vo;var wl={readContext:Ia,use:ho,useCallback:Xo,useContext:Ia,useEffect:Wo,useImperativeHandle:Qo,useInsertionEffect:Ho,useLayoutEffect:Ko,useMemo:Jo,useReducer:yo,useRef:Fo,useState:function(){return yo(fo)},useDebugValue:Yo,useDeferredValue:function(e,t){var n=uo();return null===Vi?Zo(n,e,t):el(n,Vi.memoizedState,e,t)},useTransition:function(){var e=yo(fo)[0],t=uo().memoizedState;return["boolean"==typeof e?e:mo(e),t]},useSyncExternalStore:vo,useId:ll,useHostTransitionStatus:ol,useFormState:Ro,useActionState:Ro,useOptimistic:function(e,t){var n=uo();return null!==Vi?Eo(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:po,useCacheRefresh:sl};function xl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:m({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}wl.useEffectEvent=Vo;var kl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Gc(),a=wi(r);a.payload=t,null!=n&&(a.callback=n),null!==(t=xi(e,a,r))&&(Yc(t,e,r),ki(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Gc(),a=wi(r);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=xi(e,a,r))&&(Yc(t,e,r),ki(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gc(),r=wi(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=xi(e,r,n))&&(Yc(t,e,n),ki(t,e,n))}};function Cl(e,t,n,r,a,i,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,o):!t.prototype||!t.prototype.isPureReactComponent||(!tr(n,r)||!tr(a,i))}function Sl(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&kl.enqueueReplaceState(t,t.state,null)}function Nl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=m({},n)),e)void 0===n[a]&&(n[a]=e[a]);return n}function El(e){_r(e)}function $l(e){console.error(e)}function _l(e){_r(e)}function zl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Tl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Al(e,t,n){return(n=wi(n)).tag=3,n.payload={element:null},n.callback=function(){zl(e,t)},n}function Pl(e){return(e=wi(e)).tag=3,e}function Ml(e,t,n,r){var a=n.type.getDerivedStateFromError;if("function"==typeof a){var i=r.value;e.payload=function(){return a(i)},e.callback=function(){Tl(t,n,r)}}var o=n.stateNode;null!==o&&"function"==typeof o.componentDidCatch&&(e.callback=function(){Tl(t,n,r),"function"!=typeof a&&(null===Rc?Rc=/* @__PURE__ */new Set([this]):Rc.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Il=Error(a(461)),Ll=!1;function Dl(e,t,n,r){t.child=null===e?gi(t,null,n,r):fi(t,e.child,n,r)}function Ol(e,t,n,r,a){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)"ref"!==l&&(o[l]=r[l])}else o=r;return Ma(t),r=no(e,t,n,o,i,a),l=oo(),null===e||Ll?(ha&&l&&sa(t),t.flags|=1,Dl(e,t,r,a),t.child):(lo(e,t,a),os(e,t,a))}function Rl(e,t,n,r,a){if(null===e){var i=n.type;return"function"!=typeof i||Ur(i)||void 0!==i.defaultProps||null!==n.compare?((e=Wr(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,jl(e,t,i,r,a))}if(i=e.child,!ls(e,a)){var o=i.memoizedProps;if((n=null!==(n=n.compare)?n:tr)(o,r)&&e.ref===t.ref)return os(e,t,a)}return t.flags|=1,(e=qr(i,r)).ref=t.ref,e.return=t,t.child=e}function jl(e,t,n,r,a){if(null!==e){var i=e.memoizedProps;if(tr(i,r)&&e.ref===t.ref){if(Ll=!1,t.pendingProps=r=i,!ls(e,a))return t.lanes=e.lanes,os(e,t,a);131072&e.flags&&(Ll=!0)}}return Hl(e,t,n,r,a)}function Fl(e,t,n,r){var a=r.children,i=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===r.mode){if(128&t.flags){if(i=null!==i?i.baseLanes|n:n,null!==e){for(r=t.child=e.child,a=0;null!==r;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~i}else r=0,t.child=null;return ql(e,t,i,n,r)}if(!(536870912&n))return r=t.lanes=536870912,ql(e,t,null!==i?i.baseLanes|n:n,n,r);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Xa(0,null!==i?i.cachePool:null),null!==i?Ai(t,i):Pi(),Ri(t)}else null!==i?(Xa(0,i.cachePool),Ai(t,i),ji(),t.memoizedState=null):(null!==e&&Xa(0,null),Pi(),ji());return Dl(e,t,a,n),t.child}function Ul(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ql(e,t,n,r,a){var i=Ya();return i=null===i?null:{parent:Fa._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},null!==e&&Xa(0,null),Pi(),Ri(t),null!==e&&Aa(e,t,r,!0),t.childLanes=a,null}function Bl(e,t){return(t=ts({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Wl(e,t,n){return fi(t,e.child,null,n),(e=Bl(t,t.pendingProps)).flags|=2,Fi(t),t.memoizedState=null,e}function Vl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(a(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Hl(e,t,n,r,a){return Ma(t),n=no(e,t,n,r,void 0,a),r=oo(),null===e||Ll?(ha&&r&&sa(t),t.flags|=1,Dl(e,t,n,a),t.child):(lo(e,t,a),os(e,t,a))}function Kl(e,t,n,r,a,i){return Ma(t),t.updateQueue=null,n=ao(t,r,n,a),ro(e),r=oo(),null===e||Ll?(ha&&r&&sa(t),t.flags|=1,Dl(e,t,n,i),t.child):(lo(e,t,i),os(e,t,i))}function Gl(e,t,n,r,a){if(Ma(t),null===t.stateNode){var i=Rr,o=n.contextType;"object"==typeof o&&null!==o&&(i=Ia(o)),i=new n(r,i),t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,i.updater=kl,t.stateNode=i,i._reactInternals=t,(i=t.stateNode).props=r,i.state=t.memoizedState,i.refs={},yi(t),o=n.contextType,i.context="object"==typeof o&&null!==o?Ia(o):Rr,i.state=t.memoizedState,"function"==typeof(o=n.getDerivedStateFromProps)&&(xl(t,n,o,r),i.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(o=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),o!==i.state&&kl.enqueueReplaceState(i,i.state,null),Ei(t,r,i,a),Ni(),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){i=t.stateNode;var l=t.memoizedProps,s=Nl(n,l);i.props=s;var c=i.context,u=n.contextType;o=Rr,"object"==typeof u&&null!==u&&(o=Ia(u));var d=n.getDerivedStateFromProps;u="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate,l=t.pendingProps!==l,u||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l||c!==o)&&Sl(t,i,r,o),bi=!1;var m=t.memoizedState;i.state=m,Ei(t,r,i,a),Ni(),c=t.memoizedState,l||m!==c||bi?("function"==typeof d&&(xl(t,n,d,r),c=t.memoizedState),(s=bi||Cl(t,n,s,r,m,c,o))?(u||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=o,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,vi(e,t),u=Nl(n,o=t.memoizedProps),i.props=u,d=t.pendingProps,m=i.context,c=n.contextType,s=Rr,"object"==typeof c&&null!==c&&(s=Ia(c)),(c="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(o!==d||m!==s)&&Sl(t,i,r,s),bi=!1,m=t.memoizedState,i.state=m,Ei(t,r,i,a),Ni();var h=t.memoizedState;o!==d||m!==h||bi||null!==e&&null!==e.dependencies&&Pa(e.dependencies)?("function"==typeof l&&(xl(t,n,l,r),h=t.memoizedState),(u=bi||Cl(t,n,u,r,m,h,s)||null!==e&&null!==e.dependencies&&Pa(e.dependencies))?(c||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,h,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,h,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=s,r=u):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Vl(e,t),r=!!(128&t.flags),i||r?(i=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:i.render(),t.flags|=1,null!==e&&r?(t.child=fi(t,e.child,null,a),t.child=fi(t,null,n,a)):Dl(e,t,n,a),t.memoizedState=i.state,e=t.child):e=os(e,t,a),e}function Ql(e,t,n,r){return xa(),t.flags|=256,Dl(e,t,n,r),t.child}var Yl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xl(e){return{baseLanes:e,cachePool:Ja()}}function Jl(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=zc),e}function Zl(e,t,n){var r,i=t.pendingProps,o=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&Ui.current)),r&&(o=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(ha){if(o?Di(t):ji(),(e=ma)?null!==(e=null!==(e=Pd(e,fa))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==ra?{id:aa,overflow:ia}:null,retryLane:536870912,hydrationErrors:null},(n=Kr(e)).return=t,t.child=n,da=t,ma=null):e=null,null===e)throw ba(t);return Id(e)?t.lanes=32:t.lanes=536870912,null}var s=i.children;return i=i.fallback,o?(ji(),s=ts({mode:"hidden",children:s},o=t.mode),i=Vr(i,o,n,null),s.return=t,i.return=t,s.sibling=i,t.child=s,(i=t.child).memoizedState=Xl(n),i.childLanes=Jl(e,r,n),t.memoizedState=Yl,Ul(null,i)):(Di(t),es(t,s))}var c=e.memoizedState;if(null!==c&&null!==(s=c.dehydrated)){if(l)256&t.flags?(Di(t),t.flags&=-257,t=ns(e,t,n)):null!==t.memoizedState?(ji(),t.child=e.child,t.flags|=128,t=null):(ji(),s=i.fallback,o=t.mode,i=ts({mode:"visible",children:i.children},o),(s=Vr(s,o,n,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,fi(t,e.child,null,n),(i=t.child).memoizedState=Xl(n),i.childLanes=Jl(e,r,n),t.memoizedState=Yl,t=Ul(null,i));else if(Di(t),Id(s)){if(r=s.nextSibling&&s.nextSibling.dataset)var u=r.dgst;r=u,(i=Error(a(419))).stack="",i.digest=r,Ca({value:i,source:null,stack:null}),t=ns(e,t,n)}else if(Ll||Aa(e,t,n,!1),r=0!==(n&e.childLanes),Ll||r){if(null!==(r=gc)&&(0!==(i=Oe(r,n))&&i!==c.retryLane))throw c.retryLane=i,Lr(e,i),Yc(r,e,i),Il;Md(s)||su(),t=ns(e,t,n)}else Md(s)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ma=Ld(s.nextSibling),da=t,ha=!0,pa=null,fa=!1,null!==e&&ua(t,e),(t=es(t,i.children)).flags|=4096);return t}return o?(ji(),s=i.fallback,o=t.mode,u=(c=e.child).sibling,(i=qr(c,{mode:"hidden",children:i.children})).subtreeFlags=65011712&c.subtreeFlags,null!==u?s=qr(u,s):(s=Vr(s,o,n,null)).flags|=2,s.return=t,i.return=t,i.sibling=s,t.child=i,Ul(null,i),i=t.child,null===(s=e.child.memoizedState)?s=Xl(n):(null!==(o=s.cachePool)?(c=Fa._currentValue,o=o.parent!==c?{parent:c,pool:c}:o):o=Ja(),s={baseLanes:s.baseLanes|n,cachePool:o}),i.memoizedState=s,i.childLanes=Jl(e,r,n),t.memoizedState=Yl,Ul(e.child,i)):(Di(t),e=(n=e.child).sibling,(n=qr(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function es(e,t){return(t=ts({mode:"visible",children:t},e.mode)).return=e,e.child=t}function ts(e,t){return(e=Fr(22,e,null,t)).lanes=0,e}function ns(e,t,n){return fi(t,e.child,null,n),(e=es(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function rs(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),za(e.return,t,n)}function as(e,t,n,r,a,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a,o.treeForkCount=i)}function is(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;r=r.children;var o=Ui.current,l=!!(2&o);if(l?(o=1&o|2,t.flags|=128):o&=1,B(Ui,o),Dl(e,t,r,n),r=ha?ea:0,!l&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&rs(e,n,t);else if(19===e.tag)rs(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"forwards":for(n=t.child,a=null;null!==n;)null!==(e=n.alternate)&&null===qi(e)&&(a=n),n=n.sibling;null===(n=a)?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),as(t,!1,a,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===qi(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}as(t,!0,n,null,i,r);break;case"together":as(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function os(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ec|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(Aa(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=qr(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=qr(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function ls(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Pa(e))}function ss(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Ll=!0;else{if(!(ls(e,n)||128&t.flags))return Ll=!1,function(e,t,n){switch(t.tag){case 3:Y(t,t.stateNode.containerInfo),$a(0,Fa,e.memoizedState.cache),xa();break;case 27:case 5:J(t);break;case 4:Y(t,t.stateNode.containerInfo);break;case 10:$a(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Oi(t),null;break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(Di(t),t.flags|=128,null):0!==(n&t.child.childLanes)?Zl(e,t,n):(Di(t),null!==(e=os(e,t,n))?e.sibling:null);Di(t);break;case 19:var a=!!(128&e.flags);if((r=0!==(n&t.childLanes))||(Aa(e,t,n,!1),r=0!==(n&t.childLanes)),a){if(r)return is(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),B(Ui,Ui.current),r)break;return null;case 22:return t.lanes=0,Fl(e,t,n,t.pendingProps);case 24:$a(0,Fa,e.memoizedState.cache)}return os(e,t,n)}(e,t,n);Ll=!!(131072&e.flags)}else Ll=!1,ha&&1048576&t.flags&&la(t,ea,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ii(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var i=e.$$typeof;if(i===S){t.tag=11,t=Ol(null,t,e,r,n);break e}if(i===$){t.tag=14,t=Rl(null,t,e,r,n);break e}}throw t=I(e)||e,Error(a(306,t,""))}Ur(e)?(r=Nl(e,r),t.tag=1,t=Gl(null,t,e,r,n)):(t.tag=0,t=Hl(null,t,e,r,n))}return t;case 0:return Hl(e,t,t.type,t.pendingProps,n);case 1:return Gl(e,t,r=t.type,i=Nl(r,t.pendingProps),n);case 3:e:{if(Y(t,t.stateNode.containerInfo),null===e)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,vi(e,t),Ei(t,r,null,n);var l=t.memoizedState;if(r=l.cache,$a(0,Fa,r),r!==o.cache&&Ta(t,[Fa],n,!0),Ni(),r=l.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Ql(e,t,r,n);break e}if(r!==i){Ca(i=Yr(Error(a(424)),t)),t=Ql(e,t,r,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(ma=Ld(e.firstChild),da=t,ha=!0,pa=null,fa=!0,n=gi(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(xa(),r===i){t=os(e,t,n);break e}Dl(e,t,r,n)}t=t.child}return t;case 26:return Vl(e,t),null===e?(n=Kd(t.type,null,t.pendingProps,null))?t.memoizedState=n:ha||(n=t.type,e=t.pendingProps,(r=yd(G.current).createElement(n))[Be]=t,r[We]=e,pd(r,n,e),nt(r),t.stateNode=r):t.memoizedState=Kd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return J(t),null===e&&ha&&(r=t.stateNode=jd(t.type,t.pendingProps,G.current),da=t,fa=!0,i=ma,_d(t.type)?(Dd=i,ma=Ld(r.firstChild)):ma=i),Dl(e,t,t.pendingProps.children,n),Vl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&ha&&((i=r=ma)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){var a=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[Ye])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(i=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(i!==a.rel||e.getAttribute("href")!==(null==a.href||""===a.href?null:a.href)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin)||e.getAttribute("title")!==(null==a.title?null:a.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((i=e.getAttribute("src"))!==(null==a.src?null:a.src)||e.getAttribute("type")!==(null==a.type?null:a.type)||e.getAttribute("crossorigin")!==(null==a.crossOrigin?null:a.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var i=null==a.name?null:""+a.name;if("hidden"===a.type&&e.getAttribute("name")===i)return e}if(null===(e=Ld(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,fa))?(t.stateNode=r,da=t,ma=Ld(r.firstChild),fa=!1,i=!0):i=!1),i||ba(t)),J(t),i=t.type,o=t.pendingProps,l=null!==e?e.memoizedProps:null,r=o.children,xd(i,o)?r=null:null!==l&&xd(i,l)&&(t.flags|=32),null!==t.memoizedState&&(i=no(e,t,io,null,null,n),mm._currentValue=i),Vl(e,t),Dl(e,t,r,n),t.child;case 6:return null===e&&ha&&((e=n=ma)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n)return null;if(null===(e=Ld(e.nextSibling)))return null}return e}(n,t.pendingProps,fa))?(t.stateNode=n,da=t,ma=null,e=!0):e=!1),e||ba(t)),null;case 13:return Zl(e,t,n);case 4:return Y(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=fi(t,null,r,n):Dl(e,t,r,n),t.child;case 11:return Ol(e,t,t.type,t.pendingProps,n);case 7:return Dl(e,t,t.pendingProps,n),t.child;case 8:case 12:return Dl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,$a(0,t.type,r.value),Dl(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Ma(t),r=r(i=Ia(i)),t.flags|=1,Dl(e,t,r,n),t.child;case 14:return Rl(e,t,t.type,t.pendingProps,n);case 15:return jl(e,t,t.type,t.pendingProps,n);case 19:return is(e,t,n);case 31:return function(e,t,n){var r=t.pendingProps,i=!!(128&t.flags);if(t.flags&=-129,null===e){if(ha){if("hidden"===r.mode)return e=Bl(t,r),t.lanes=536870912,Ul(null,e);if(Oi(t),(e=ma)?null!==(e=null!==(e=Pd(e,fa))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==ra?{id:aa,overflow:ia}:null,retryLane:536870912,hydrationErrors:null},(n=Kr(e)).return=t,t.child=n,da=t,ma=null):e=null,null===e)throw ba(t);return t.lanes=536870912,null}return Bl(t,r)}var o=e.memoizedState;if(null!==o){var l=o.dehydrated;if(Oi(t),i)if(256&t.flags)t.flags&=-257,t=Wl(e,t,n);else{if(null===t.memoizedState)throw Error(a(558));t.child=e.child,t.flags|=128,t=null}else if(Ll||Aa(e,t,n,!1),i=0!==(n&e.childLanes),Ll||i){if(null!==(r=gc)&&0!==(l=Oe(r,n))&&l!==o.retryLane)throw o.retryLane=l,Lr(e,l),Yc(r,e,l),Il;su(),t=Wl(e,t,n)}else e=o.treeContext,ma=Ld(l.nextSibling),da=t,ha=!0,pa=null,fa=!1,null!==e&&ua(t,e),(t=Bl(t,r)).flags|=4096;return t}return(e=qr(e.child,{mode:r.mode,children:r.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,n);case 22:return Fl(e,t,n,t.pendingProps);case 24:return Ma(t),r=Ia(Fa),null===e?(null===(i=Ya())&&(i=gc,o=Ua(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},yi(t),$a(0,Fa,i)):(0!==(e.lanes&n)&&(vi(e,t),Ei(t,null,null,n),Ni()),i=e.memoizedState,o=t.memoizedState,i.parent!==r?(i={parent:r,cache:r},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),$a(0,Fa,r)):(r=o.cache,$a(0,Fa,r),r!==i.cache&&Ta(t,[Fa],n,!0))),Dl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function cs(e){e.flags|=4}function us(e,t,n,r,a){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&a)===a)if(e.stateNode.complete)e.flags|=8192;else{if(!iu())throw oi=ni,ei;e.flags|=8192}}else e.flags&=-16777217}function ds(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!om(t)){if(!iu())throw oi=ni,ei;e.flags|=8192}}function ms(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Pe():536870912,e.lanes|=t,Tc|=t)}function hs(e,t){if(!ha)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ps(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=65011712&a.subtreeFlags,r|=65011712&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fs(e,t,n){var r=t.pendingProps;switch(ca(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return ps(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),_a(Fa),X(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(wa(t)?cs(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,ka())),ps(t),null;case 26:var i=t.type,o=t.memoizedState;return null===e?(cs(t),null!==o?(ps(t),ds(t,o)):(ps(t),us(t,i,0,0,n))):o?o!==e.memoizedState?(cs(t),ps(t),ds(t,o)):(ps(t),t.flags&=-16777217):((e=e.memoizedProps)!==r&&cs(t),ps(t),us(t,i,0,0,n)),null;case 27:if(Z(t),n=G.current,i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&cs(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return ps(t),null}e=H.current,wa(t)?ya(t):(e=jd(i,r,n),t.stateNode=e,cs(t))}return ps(t),null;case 5:if(Z(t),i=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&cs(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return ps(t),null}if(o=H.current,wa(t))ya(t);else{var l=yd(G.current);switch(o){case 1:o=l.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:o=l.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":o=l.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":o=l.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":(o=l.createElement("div")).innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o="string"==typeof r.is?l.createElement("select",{is:r.is}):l.createElement("select"),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o="string"==typeof r.is?l.createElement(i,{is:r.is}):l.createElement(i)}}o[Be]=t,o[We]=r;e:for(l=t.child;null!==l;){if(5===l.tag||6===l.tag)o.appendChild(l.stateNode);else if(4!==l.tag&&27!==l.tag&&null!==l.child){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;null===l.sibling;){if(null===l.return||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=o;e:switch(pd(o,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&cs(t)}}return ps(t),us(t,t.type,null===e||e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&cs(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));if(e=G.current,wa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,null!==(i=da))switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Be]=t,(e=!!(e.nodeValue===n||null!==r&&!0===r.suppressHydrationWarning||dd(e.nodeValue,n)))||ba(t,!0)}else(e=yd(e).createTextNode(r))[Be]=t,t.stateNode=e}return ps(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(r=wa(t),null!==n){if(null===e){if(!r)throw Error(a(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(a(557));e[Be]=t}else xa(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ps(t),e=!1}else n=ka(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(Fi(t),t):(Fi(t),null);if(128&t.flags)throw Error(a(558))}return ps(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(i=wa(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(a(318));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(a(317));i[Be]=t}else xa(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;ps(t),i=!1}else i=ka(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return 256&t.flags?(Fi(t),t):(Fi(t),null)}return Fi(t),128&t.flags?(t.lanes=n,t):(n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(i=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(i=r.alternate.memoizedState.cachePool.pool),o=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ms(t,t.updateQueue),ps(t),null);case 4:return X(),null===e&&td(t.stateNode.containerInfo),ps(t),null;case 10:return _a(t.type),ps(t),null;case 19:if(q(Ui),null===(r=t.memoizedState))return ps(t),null;if(i=!!(128&t.flags),null===(o=r.rendering))if(i)hs(r,!1);else{if(0!==Nc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(o=qi(e))){for(t.flags|=128,hs(r,!1),e=o.updateQueue,t.updateQueue=e,ms(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)Br(n,e),n=n.sibling;return B(Ui,1&Ui.current|2),ha&&oa(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&ue()>Dc&&(t.flags|=128,i=!0,hs(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=qi(o))){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,ms(t,e),hs(r,!0),null===r.tail&&"hidden"===r.tailMode&&!o.alternate&&!ha)return ps(t),null}else 2*ue()-r.renderingStartTime>Dc&&536870912!==n&&(t.flags|=128,i=!0,hs(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=r.last)?e.sibling=o:t.child=o,r.last=o)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ue(),e.sibling=null,n=Ui.current,B(Ui,i?1&n|2:1&n),ha&&oa(t,r.treeForkCount),e):(ps(t),null);case 22:case 23:return Fi(t),Mi(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&n)&&!(128&t.flags)&&(ps(t),6&t.subtreeFlags&&(t.flags|=8192)):ps(t),null!==(n=t.updateQueue)&&ms(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&q(Qa),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),_a(Fa),ps(t),null;case 25:case 30:return null}throw Error(a(156,t.tag))}function gs(e,t){switch(ca(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return _a(Fa),X(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return Z(t),null;case 31:if(null!==t.memoizedState){if(Fi(t),null===t.alternate)throw Error(a(340));xa()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Fi(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));xa()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return q(Ui),null;case 4:return X(),null;case 10:return _a(t.type),null;case 22:case 23:return Fi(t),Mi(),null!==e&&q(Qa),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return _a(Fa),null;default:return null}}function bs(e,t){switch(ca(t),t.tag){case 3:_a(Fa),X();break;case 26:case 27:case 5:Z(t);break;case 4:X();break;case 31:null!==t.memoizedState&&Fi(t);break;case 13:Fi(t);break;case 19:q(Ui);break;case 10:_a(t.type);break;case 22:case 23:Fi(t),Mi(),null!==e&&q(Qa);break;case 24:_a(Fa)}}function ys(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==a)}}catch(l){Nu(t,t.return,l)}}function vs(e,t,n){try{var r=t.updateQueue,a=null!==r?r.lastEffect:null;if(null!==a){var i=a.next;r=i;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(void 0!==l){o.destroy=void 0,a=t;var s=n,c=l;try{c()}catch(u){Nu(a,s,u)}}}r=r.next}while(r!==i)}}catch(u){Nu(t,t.return,u)}}function ws(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{_i(t,n)}catch(r){Nu(e,e.return,r)}}}function xs(e,t,n){n.props=Nl(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Nu(e,t,r)}}function ks(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(a){Nu(e,t,a)}}function Cs(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(a){Nu(e,t,a)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(i){Nu(e,t,i)}else n.current=null}function Ss(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(a){Nu(e,e.return,a)}}function Ns(e,t,n){try{var r=e.stateNode;!function(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,o=null,l=null,s=null,c=null,u=null,d=null;for(p in n){var m=n[p];if(n.hasOwnProperty(p)&&null!=m)switch(p){case"checked":case"value":break;case"defaultValue":c=m;default:r.hasOwnProperty(p)||md(e,t,p,null,r,m)}}for(var h in r){var p=r[h];if(m=n[h],r.hasOwnProperty(h)&&(null!=p||null!=m))switch(h){case"type":o=p;break;case"name":i=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":l=p;break;case"defaultValue":s=p;break;case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(a(137,t));break;default:p!==m&&md(e,t,h,p,r,m)}}return void wt(e,l,s,c,u,d,o,i);case"select":for(o in p=l=s=h=null,n)if(c=n[o],n.hasOwnProperty(o)&&null!=c)switch(o){case"value":break;case"multiple":p=c;default:r.hasOwnProperty(o)||md(e,t,o,null,r,c)}for(i in r)if(o=r[i],c=n[i],r.hasOwnProperty(i)&&(null!=o||null!=c))switch(i){case"value":h=o;break;case"defaultValue":s=o;break;case"multiple":l=o;default:o!==c&&md(e,t,i,o,r,c)}return t=s,n=l,r=p,void(null!=h?Ct(e,!!n,h,!1):!!r!=!!n&&(null!=t?Ct(e,!!n,t,!0):Ct(e,!!n,n?[]:"",!1)));case"textarea":for(s in p=h=null,n)if(i=n[s],n.hasOwnProperty(s)&&null!=i&&!r.hasOwnProperty(s))switch(s){case"value":case"children":break;default:md(e,t,s,null,r,i)}for(l in r)if(i=r[l],o=n[l],r.hasOwnProperty(l)&&(null!=i||null!=o))switch(l){case"value":h=i;break;case"defaultValue":p=i;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=i)throw Error(a(91));break;default:i!==o&&md(e,t,l,i,r,o)}return void St(e,h,p);case"option":for(var f in n)if(h=n[f],n.hasOwnProperty(f)&&null!=h&&!r.hasOwnProperty(f))if("selected"===f)e.selected=!1;else md(e,t,f,null,r,h);for(c in r)if(h=r[c],p=n[c],r.hasOwnProperty(c)&&h!==p&&(null!=h||null!=p))if("selected"===c)e.selected=h&&"function"!=typeof h&&"symbol"!=typeof h;else md(e,t,c,h,r,p);return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in n)h=n[g],n.hasOwnProperty(g)&&null!=h&&!r.hasOwnProperty(g)&&md(e,t,g,null,r,h);for(u in r)if(h=r[u],p=n[u],r.hasOwnProperty(u)&&h!==p&&(null!=h||null!=p))switch(u){case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(a(137,t));break;default:md(e,t,u,h,r,p)}return;default:if(Tt(t)){for(var b in n)h=n[b],n.hasOwnProperty(b)&&void 0!==h&&!r.hasOwnProperty(b)&&hd(e,t,b,void 0,r,h);for(d in r)h=r[d],p=n[d],!r.hasOwnProperty(d)||h===p||void 0===h&&void 0===p||hd(e,t,d,h,r,p);return}}for(var y in n)h=n[y],n.hasOwnProperty(y)&&null!=h&&!r.hasOwnProperty(y)&&md(e,t,y,null,r,h);for(m in r)h=r[m],p=n[m],!r.hasOwnProperty(m)||h===p||null==h&&null==p||md(e,t,m,h,r,p)}(r,e.type,n,t),r[We]=t}catch(i){Nu(e,e.return,i)}}function Es(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&_d(e.type)||4===e.tag}function $s(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Es(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&_d(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function _s(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?(9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).insertBefore(e,t):((t=9===n.nodeType?n.body:"HTML"===n.nodeName?n.ownerDocument.body:n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=It));else if(4!==r&&(27===r&&_d(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(_s(e,t,n),e=e.sibling;null!==e;)_s(e,t,n),e=e.sibling}function zs(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&(27===r&&_d(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(zs(e,t,n),e=e.sibling;null!==e;)zs(e,t,n),e=e.sibling}function Ts(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);pd(t,r,n),t[Be]=e,t[We]=n}catch(i){Nu(e,e.return,i)}}var As=!1,Ps=!1,Ms=!1,Is="function"==typeof WeakSet?WeakSet:Set,Ls=null;function Ds(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ys(e,n),4&r&&ys(5,n);break;case 1:if(Ys(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(o){Nu(n,n.return,o)}else{var a=Nl(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(l){Nu(n,n.return,l)}}64&r&&ws(n),512&r&&ks(n,n.return);break;case 3:if(Ys(e,n),64&r&&null!==(e=n.updateQueue)){if(t=null,null!==n.child)switch(n.child.tag){case 27:case 5:case 1:t=n.child.stateNode}try{_i(e,t)}catch(o){Nu(n,n.return,o)}}break;case 27:null===t&&4&r&&Ts(n);case 26:case 5:Ys(e,n),null===t&&4&r&&Ss(n),512&r&&ks(n,n.return);break;case 12:Ys(e,n);break;case 31:Ys(e,n),4&r&&qs(e,n);break;case 13:Ys(e,n),4&r&&Bs(e,n),64&r&&(null!==(e=n.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var n=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==n.readyState)t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}(e,n=zu.bind(null,n))));break;case 22:if(!(r=null!==n.memoizedState||As)){t=null!==t&&null!==t.memoizedState||Ps,a=As;var i=Ps;As=r,(Ps=t)&&!i?Js(e,n,!!(8772&n.subtreeFlags)):Ys(e,n),As=a,Ps=i}break;case 30:break;default:Ys(e,n)}}function Os(e){var t=e.alternate;null!==t&&(e.alternate=null,Os(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&Xe(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Rs=null,js=!1;function Fs(e,t,n){for(n=n.child;null!==n;)Us(e,t,n),n=n.sibling}function Us(e,t,n){if(we&&"function"==typeof we.onCommitFiberUnmount)try{we.onCommitFiberUnmount(ve,n)}catch(i){}switch(n.tag){case 26:Ps||Cs(n,t),Fs(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:Ps||Cs(n,t);var r=Rs,a=js;_d(n.type)&&(Rs=n.stateNode,js=!1),Fs(e,t,n),Fd(n.stateNode),Rs=r,js=a;break;case 5:Ps||Cs(n,t);case 6:if(r=Rs,a=js,Rs=null,Fs(e,t,n),js=a,null!==(Rs=r))if(js)try{(9===Rs.nodeType?Rs.body:"HTML"===Rs.nodeName?Rs.ownerDocument.body:Rs).removeChild(n.stateNode)}catch(o){Nu(n,t,o)}else try{Rs.removeChild(n.stateNode)}catch(o){Nu(n,t,o)}break;case 18:null!==Rs&&(js?(zd(9===(e=Rs).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Hm(e)):zd(Rs,n.stateNode));break;case 4:r=Rs,a=js,Rs=n.stateNode.containerInfo,js=!0,Fs(e,t,n),Rs=r,js=a;break;case 0:case 11:case 14:case 15:vs(2,n,t),Ps||vs(4,n,t),Fs(e,t,n);break;case 1:Ps||(Cs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&xs(n,t,r)),Fs(e,t,n);break;case 21:Fs(e,t,n);break;case 22:Ps=(r=Ps)||null!==n.memoizedState,Fs(e,t,n),Ps=r;break;default:Fs(e,t,n)}}function qs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Hm(e)}catch(n){Nu(t,t.return,n)}}}function Bs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Hm(e)}catch(n){Nu(t,t.return,n)}}function Ws(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Is),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Is),t;default:throw Error(a(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Tu.bind(null,e,t);t.then(r,r)}})}function Vs(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r],o=e,l=t,s=l;e:for(;null!==s;){switch(s.tag){case 27:if(_d(s.type)){Rs=s.stateNode,js=!1;break e}break;case 5:Rs=s.stateNode,js=!1;break e;case 3:case 4:Rs=s.stateNode.containerInfo,js=!0;break e}s=s.return}if(null===Rs)throw Error(a(160));Us(o,l,i),Rs=null,js=!1,null!==(o=i.alternate)&&(o.return=null),i.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)Ks(t,e),t=t.sibling}var Hs=null;function Ks(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vs(t,e),Gs(e),4&r&&(vs(3,e,e.return),ys(3,e),vs(5,e,e.return));break;case 1:Vs(t,e),Gs(e),512&r&&(Ps||null===n||Cs(n,n.return)),64&r&&As&&(null!==(e=e.updateQueue)&&(null!==(r=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?r:n.concat(r))));break;case 26:var i=Hs;if(Vs(t,e),Gs(e),512&r&&(Ps||null===n||Cs(n,n.return)),4&r){var o=null!==n?n.memoizedState:null;if(r=e.memoizedState,null===n)if(null===r)if(null===e.stateNode){e:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;t:switch(r){case"title":(!(o=i.getElementsByTagName("title")[0])||o[Ye]||o[Be]||"http://www.w3.org/2000/svg"===o.namespaceURI||o.hasAttribute("itemprop"))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector("head > title"))),pd(o,r,n),o[Be]=e,nt(o),r=o;break e;case"link":var l=am("link","href",i).get(r+(n.href||""));if(l)for(var s=0;s<l.length;s++)if((o=l[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&o.getAttribute("rel")===(null==n.rel?null:n.rel)&&o.getAttribute("title")===(null==n.title?null:n.title)&&o.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){l.splice(s,1);break t}pd(o=i.createElement(r),r,n),i.head.appendChild(o);break;case"meta":if(l=am("meta","content",i).get(r+(n.content||"")))for(s=0;s<l.length;s++)if((o=l[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&o.getAttribute("name")===(null==n.name?null:n.name)&&o.getAttribute("property")===(null==n.property?null:n.property)&&o.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&o.getAttribute("charset")===(null==n.charSet?null:n.charSet)){l.splice(s,1);break t}pd(o=i.createElement(r),r,n),i.head.appendChild(o);break;default:throw Error(a(468,r))}o[Be]=e,nt(o),r=o}e.stateNode=r}else im(i,e.type,e.stateNode);else e.stateNode=Zd(i,r,e.memoizedProps);else o!==r?(null===o?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):o.count--,null===r?im(i,e.type,e.stateNode):Zd(i,r,e.memoizedProps)):null===r&&null!==e.stateNode&&Ns(e,e.memoizedProps,n.memoizedProps)}break;case 27:Vs(t,e),Gs(e),512&r&&(Ps||null===n||Cs(n,n.return)),null!==n&&4&r&&Ns(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Vs(t,e),Gs(e),512&r&&(Ps||null===n||Cs(n,n.return)),32&e.flags){i=e.stateNode;try{Et(i,"")}catch(f){Nu(e,e.return,f)}}4&r&&null!=e.stateNode&&Ns(e,i=e.memoizedProps,null!==n?n.memoizedProps:i),1024&r&&(Ms=!0);break;case 6:if(Vs(t,e),Gs(e),4&r){if(null===e.stateNode)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(f){Nu(e,e.return,f)}}break;case 3:if(rm=null,i=Hs,Hs=Bd(t.containerInfo),Vs(t,e),Hs=i,Gs(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Hm(t.containerInfo)}catch(f){Nu(e,e.return,f)}Ms&&(Ms=!1,Qs(e));break;case 4:r=Hs,Hs=Bd(e.stateNode.containerInfo),Vs(t,e),Gs(e),Hs=r;break;case 12:default:Vs(t,e),Gs(e);break;case 31:case 19:Vs(t,e),Gs(e),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Ws(e,r)));break;case 13:Vs(t,e),Gs(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Ic=ue()),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,Ws(e,r)));break;case 22:i=null!==e.memoizedState;var c=null!==n&&null!==n.memoizedState,u=As,d=Ps;if(As=u||i,Ps=d||c,Vs(t,e),Ps=d,As=u,Gs(e),8192&r)e:for(t=e.stateNode,t._visibility=i?-2&t._visibility:1|t._visibility,i&&(null===n||c||As||Ps||Xs(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){c=n=t;try{if(o=c.stateNode,i)"function"==typeof(l=o.style).setProperty?l.setProperty("display","none","important"):l.display="none";else{s=c.stateNode;var m=c.memoizedProps.style,h=null!=m&&m.hasOwnProperty("display")?m.display:null;s.style.display=null==h||"boolean"==typeof h?"":(""+h).trim()}}catch(f){Nu(c,c.return,f)}}}else if(6===t.tag){if(null===n){c=t;try{c.stateNode.nodeValue=i?"":c.memoizedProps}catch(f){Nu(c,c.return,f)}}}else if(18===t.tag){if(null===n){c=t;try{var p=c.stateNode;i?Td(p,!0):Td(c.stateNode,!1)}catch(f){Nu(c,c.return,f)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}4&r&&(null!==(r=e.updateQueue)&&(null!==(n=r.retryQueue)&&(r.retryQueue=null,Ws(e,n))));case 30:case 21:}}function Gs(e){var t=e.flags;if(2&t){try{for(var n,r=e.return;null!==r;){if(Es(r)){n=r;break}r=r.return}if(null==n)throw Error(a(160));switch(n.tag){case 27:var i=n.stateNode;zs(e,$s(e),i);break;case 5:var o=n.stateNode;32&n.flags&&(Et(o,""),n.flags&=-33),zs(e,$s(e),o);break;case 3:case 4:var l=n.stateNode.containerInfo;_s(e,$s(e),l);break;default:throw Error(a(161))}}catch(s){Nu(e,e.return,s)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Qs(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;Qs(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function Ys(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Ds(e,t.alternate,t),t=t.sibling}function Xs(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:vs(4,t,t.return),Xs(t);break;case 1:Cs(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&xs(t,t.return,n),Xs(t);break;case 27:Fd(t.stateNode);case 26:case 5:Cs(t,t.return),Xs(t);break;case 22:null===t.memoizedState&&Xs(t);break;default:Xs(t)}e=e.sibling}}function Js(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var r=t.alternate,a=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:Js(a,i,n),ys(4,i);break;case 1:if(Js(a,i,n),"function"==typeof(a=(r=i).stateNode).componentDidMount)try{a.componentDidMount()}catch(c){Nu(r,r.return,c)}if(null!==(a=(r=i).updateQueue)){var l=r.stateNode;try{var s=a.shared.hiddenCallbacks;if(null!==s)for(a.shared.hiddenCallbacks=null,a=0;a<s.length;a++)$i(s[a],l)}catch(c){Nu(r,r.return,c)}}n&&64&o&&ws(i),ks(i,i.return);break;case 27:Ts(i);case 26:case 5:Js(a,i,n),n&&null===r&&4&o&&Ss(i),ks(i,i.return);break;case 12:Js(a,i,n);break;case 31:Js(a,i,n),n&&4&o&&qs(a,i);break;case 13:Js(a,i,n),n&&4&o&&Bs(a,i);break;case 22:null===i.memoizedState&&Js(a,i,n),ks(i,i.return);break;case 30:break;default:Js(a,i,n)}t=t.sibling}}function Zs(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&qa(n))}function ec(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&qa(e))}function tc(e,t,n,r){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)nc(e,t,n,r),t=t.sibling}function nc(e,t,n,r){var a=t.flags;switch(t.tag){case 0:case 11:case 15:tc(e,t,n,r),2048&a&&ys(9,t);break;case 1:case 31:case 13:default:tc(e,t,n,r);break;case 3:tc(e,t,n,r),2048&a&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&qa(e)));break;case 12:if(2048&a){tc(e,t,n,r),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,l=i.onPostCommit;"function"==typeof l&&l(o,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(s){Nu(t,t.return,s)}}else tc(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,null!==t.memoizedState?2&i._visibility?tc(e,t,n,r):ac(e,t):2&i._visibility?tc(e,t,n,r):(i._visibility|=2,rc(e,t,n,r,!!(10256&t.subtreeFlags)||!1)),2048&a&&Zs(o,t);break;case 24:tc(e,t,n,r),2048&a&&ec(t.alternate,t)}}function rc(e,t,n,r,a){for(a=a&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var i=e,o=t,l=n,s=r,c=o.flags;switch(o.tag){case 0:case 11:case 15:rc(i,o,l,s,a),ys(8,o);break;case 23:break;case 22:var u=o.stateNode;null!==o.memoizedState?2&u._visibility?rc(i,o,l,s,a):ac(i,o):(u._visibility|=2,rc(i,o,l,s,a)),a&&2048&c&&Zs(o.alternate,o);break;case 24:rc(i,o,l,s,a),a&&2048&c&&ec(o.alternate,o);break;default:rc(i,o,l,s,a)}t=t.sibling}}function ac(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,r=t,a=r.flags;switch(r.tag){case 22:ac(n,r),2048&a&&Zs(r.alternate,r);break;case 24:ac(n,r),2048&a&&ec(r.alternate,r);break;default:ac(n,r)}t=t.sibling}}var ic=8192;function oc(e,t,n){if(e.subtreeFlags&ic)for(e=e.child;null!==e;)lc(e,t,n),e=e.sibling}function lc(e,t,n){switch(e.tag){case 26:oc(e,t,n),e.flags&ic&&null!==e.memoizedState&&function(e,t,n,r){if(!("stylesheet"!==n.type||"string"==typeof r.media&&!1===matchMedia(r.media).matches||4&n.state.loading)){if(null===n.instance){var a=Gd(r.href),i=t.querySelector(Qd(a));if(i)return null!==(t=i._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=sm.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,void nt(i);i=t.ownerDocument||t,r=Yd(r),(a=Ud.get(a))&&tm(r,a),nt(i=i.createElement("link"));var o=i;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),pd(i,"link",r),n.instance=i}null===e.stylesheets&&(e.stylesheets=/* @__PURE__ */new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(3&n.state.loading)&&(e.count++,n=sm.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}(n,Hs,e.memoizedState,e.memoizedProps);break;case 5:default:oc(e,t,n);break;case 3:case 4:var r=Hs;Hs=Bd(e.stateNode.containerInfo),oc(e,t,n),Hs=r;break;case 22:null===e.memoizedState&&(null!==(r=e.alternate)&&null!==r.memoizedState?(r=ic,ic=16777216,oc(e,t,n),ic=r):oc(e,t,n))}}function sc(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function cc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Ls=r,mc(r,e)}sc(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)uc(e),e=e.sibling}function uc(e){switch(e.tag){case 0:case 11:case 15:cc(e),2048&e.flags&&vs(9,e,e.return);break;case 3:case 12:default:cc(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,dc(e)):cc(e)}}function dc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];Ls=r,mc(r,e)}sc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:vs(8,t,t.return),dc(t);break;case 22:2&(n=t.stateNode)._visibility&&(n._visibility&=-3,dc(t));break;default:dc(t)}e=e.sibling}}function mc(e,t){for(;null!==Ls;){var n=Ls;switch(n.tag){case 0:case 11:case 15:vs(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:qa(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,Ls=r;else e:for(n=e;null!==Ls;){var a=(r=Ls).sibling,i=r.return;if(Os(r),r===n){Ls=null;break e}if(null!==a){a.return=i,Ls=a;break e}Ls=i}}}var hc={getCacheForType:function(e){var t=Ia(Fa),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ia(Fa).controller.signal}},pc="function"==typeof WeakMap?WeakMap:Map,fc=0,gc=null,bc=null,yc=0,vc=0,wc=null,xc=!1,kc=!1,Cc=!1,Sc=0,Nc=0,Ec=0,$c=0,_c=0,zc=0,Tc=0,Ac=null,Pc=null,Mc=!1,Ic=0,Lc=0,Dc=1/0,Oc=null,Rc=null,jc=0,Fc=null,Uc=null,qc=0,Bc=0,Wc=null,Vc=null,Hc=0,Kc=null;function Gc(){return 2&fc&&0!==yc?yc&-yc:null!==D.T?Wu():Fe()}function Qc(){if(0===zc)if(536870912&yc&&!ha)zc=536870912;else{var e=Ee;!(3932160&(Ee<<=1))&&(Ee=262144),zc=e}return null!==(e=Ii.current)&&(e.flags|=32),zc}function Yc(e,t,n){(e!==gc||2!==vc&&9!==vc)&&null===e.cancelPendingCommit||(ru(e,0),eu(e,yc,zc,!1)),Ie(e,n),2&fc&&e===gc||(e===gc&&(!(2&fc)&&($c|=n),4===Nc&&eu(e,yc,zc,!1)),Ou(e))}function Xc(e,t,n){if(6&fc)throw Error(a(327));for(var r=!n&&!(127&t)&&0===(t&e.expiredLanes)||Te(e,t),i=r?function(e,t){var n=fc;fc|=2;var r=ou(),i=lu();gc!==e||yc!==t?(Oc=null,Dc=ue()+500,ru(e,t)):kc=Te(e,t);e:for(;;)try{if(0!==vc&&null!==bc){t=bc;var o=wc;t:switch(vc){case 1:vc=0,wc=null,pu(e,t,o,1);break;case 2:case 9:if(ri(o)){vc=0,wc=null,hu(t);break}t=function(){2!==vc&&9!==vc||gc!==e||(vc=7),Ou(e)},o.then(t,t);break e;case 3:vc=7;break e;case 4:vc=5;break e;case 7:ri(o)?(vc=0,wc=null,hu(t)):(vc=0,wc=null,pu(e,t,o,7));break;case 5:var l=null;switch(bc.tag){case 26:l=bc.memoizedState;case 5:case 27:var s=bc;if(l?om(l):s.stateNode.complete){vc=0,wc=null;var c=s.sibling;if(null!==c)bc=c;else{var u=s.return;null!==u?(bc=u,fu(u)):bc=null}break t}}vc=0,wc=null,pu(e,t,o,5);break;case 6:vc=0,wc=null,pu(e,t,o,6);break;case 8:nu(),Nc=6;break e;default:throw Error(a(462))}}du();break}catch(d){au(e,d)}return Ea=Na=null,D.H=r,D.A=i,fc=n,null!==bc?0:(gc=null,yc=0,Pr(),Nc)}(e,t):cu(e,t,!0),o=r;;){if(0===i){kc&&!r&&eu(e,t,0,!1);break}if(n=e.current.alternate,!o||Zc(n)){if(2===i){if(o=t,e.errorRecoveryDisabledLanes&o)var l=0;else l=0!==(l=-536870913&e.pendingLanes)?l:536870912&l?536870912:0;if(0!==l){t=l;e:{var s=e;i=Ac;var c=s.current.memoizedState.isDehydrated;if(c&&(ru(s,l).flags|=256),2!==(l=cu(s,l,!1))){if(Cc&&!c){s.errorRecoveryDisabledLanes|=o,$c|=o,i=4;break e}o=Pc,Pc=i,null!==o&&(null===Pc?Pc=o:Pc.push.apply(Pc,o))}i=l}if(o=!1,2!==i)continue}}if(1===i){ru(e,0),eu(e,t,0,!0);break}e:{switch(r=e,o=i){case 0:case 1:throw Error(a(345));case 4:if((4194048&t)!==t)break;case 6:eu(r,t,zc,!xc);break e;case 2:Pc=null;break;case 3:case 5:break;default:throw Error(a(329))}if((62914560&t)===t&&10<(i=Ic+300-ue())){if(eu(r,t,zc,!xc),0!==ze(r,0,!0))break e;qc=t,r.timeoutHandle=Cd(Jc.bind(null,r,n,Pc,Oc,Mc,t,zc,$c,Tc,xc,o,"Throttled",-0,0),i)}else Jc(r,n,Pc,Oc,Mc,t,zc,$c,Tc,xc,o,null,-0,0)}break}i=cu(e,t,!1),o=!1}Ou(e)}function Jc(e,t,n,r,a,i,o,l,s,c,u,d,m,h){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){lc(t,i,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:It});var p=(62914560&i)===i?Ic-ue():(4194048&i)===i?Lc-ue():0;if(null!==(p=function(e,t){return e.stylesheets&&0===e.count&&um(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&um(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===lm&&(lm=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var a=n[r],i=a.transferSize,o=a.initiatorType,l=a.duration;if(i&&l&&fd(o)){for(o=0,l=a.responseEnd,r+=1;r<n.length;r++){var s=n[r],c=s.startTime;if(c>l)break;var u=s.transferSize,d=s.initiatorType;u&&fd(d)&&(o+=u*((s=s.responseEnd)<l?1:(l-c)/(s-c)))}if(--r,t+=8*(i+o)/(a.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var a=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&um(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>lm?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(a)}}:null}(d,p)))return qc=i,e.cancelPendingCommit=p(bu.bind(null,e,t,i,n,r,a,o,l,s,u,d,null,m,h)),void eu(e,i,o,!c)}bu(e,t,i,n,r,a,o,l,s)}function Zc(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&(null!==(n=t.updateQueue)&&null!==(n=n.stores)))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!er(i(),a))return!1}catch(o){return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function eu(e,t,n,r){t&=~_c,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var i=31-ke(a),o=1<<i;r[i]=-1,a&=~o}0!==n&&Le(e,n,t)}function tu(){return!!(6&fc)||(Ru(0),!1)}function nu(){if(null!==bc){if(0===vc)var e=bc.return;else Ea=Na=null,so(e=bc),ci=null,ui=0,e=bc;for(;null!==e;)bs(e.alternate,e),e=e.return;bc=null}}function ru(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,Sd(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),qc=0,nu(),gc=e,bc=n=qr(e.current,null),yc=t,vc=0,wc=null,xc=!1,kc=Te(e,t),Cc=!1,Tc=zc=_c=$c=Ec=Nc=0,Pc=Ac=null,Mc=!1,8&t&&(t|=32&t);var r=e.entangledLanes;if(0!==r)for(e=e.entanglements,r&=t;0<r;){var a=31-ke(r),i=1<<a;t|=e[a],r&=~i}return Sc=t,Pr(),n}function au(e,t){Wi=null,D.H=bl,t===Za||t===ti?(t=li(),vc=3):t===ei?(t=li(),vc=4):vc=t===Il?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,wc=t,null===bc&&(Nc=1,zl(e,Yr(t,e.current)))}function iu(){var e=Ii.current;return null===e||((4194048&yc)===yc?null===Li:!!((62914560&yc)===yc||536870912&yc)&&e===Li)}function ou(){var e=D.H;return D.H=bl,null===e?bl:e}function lu(){var e=D.A;return D.A=hc,e}function su(){Nc=4,xc||(4194048&yc)!==yc&&null!==Ii.current||(kc=!0),!(134217727&Ec)&&!(134217727&$c)||null===gc||eu(gc,yc,zc,!1)}function cu(e,t,n){var r=fc;fc|=2;var a=ou(),i=lu();gc===e&&yc===t||(Oc=null,ru(e,t)),t=!1;var o=Nc;e:for(;;)try{if(0!==vc&&null!==bc){var l=bc,s=wc;switch(vc){case 8:nu(),o=6;break e;case 3:case 2:case 9:case 6:null===Ii.current&&(t=!0);var c=vc;if(vc=0,wc=null,pu(e,l,s,c),n&&kc){o=0;break e}break;default:c=vc,vc=0,wc=null,pu(e,l,s,c)}}uu(),o=Nc;break}catch(u){au(e,u)}return t&&e.shellSuspendCounter++,Ea=Na=null,fc=r,D.H=a,D.A=i,null===bc&&(gc=null,yc=0,Pr()),o}function uu(){for(;null!==bc;)mu(bc)}function du(){for(;null!==bc&&!se();)mu(bc)}function mu(e){var t=ss(e.alternate,e,Sc);e.memoizedProps=e.pendingProps,null===t?fu(e):bc=t}function hu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Kl(n,t,t.pendingProps,t.type,void 0,yc);break;case 11:t=Kl(n,t,t.pendingProps,t.type.render,t.ref,yc);break;case 5:so(t);default:bs(n,t),t=ss(n,t=bc=Br(t,Sc),Sc)}e.memoizedProps=e.pendingProps,null===t?fu(e):bc=t}function pu(e,t,n,r){Ea=Na=null,so(t),ci=null,ui=0;var i=t.return;try{if(function(e,t,n,r,i){if(n.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=n.alternate)&&Aa(t,n,i,!0),null!==(n=Ii.current)){switch(n.tag){case 31:case 13:return null===Li?su():null===n.alternate&&0===Nc&&(Nc=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ni?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=/* @__PURE__ */new Set([r]):t.add(r),Eu(e,r,i)),!1;case 22:return n.flags|=65536,r===ni?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:/* @__PURE__ */new Set([r])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=/* @__PURE__ */new Set([r]):n.add(r),Eu(e,r,i)),!1}throw Error(a(435,n.tag))}return Eu(e,r,i),su(),!1}if(ha)return null!==(t=Ii.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==ga&&Ca(Yr(e=Error(a(422),{cause:r}),n))):(r!==ga&&Ca(Yr(t=Error(a(423),{cause:r}),n)),(e=e.current.alternate).flags|=65536,i&=-i,e.lanes|=i,r=Yr(r,n),Ci(e,i=Al(e.stateNode,r,i)),4!==Nc&&(Nc=2)),!1;var o=Error(a(520),{cause:r});if(o=Yr(o,n),null===Ac?Ac=[o]:Ac.push(o),4!==Nc&&(Nc=2),null===t)return!0;r=Yr(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,Ci(n,e=Al(n.stateNode,r,e)),!1;case 1:if(t=n.type,o=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===o||"function"!=typeof o.componentDidCatch||null!==Rc&&Rc.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,Ml(i=Pl(i),e,n,r),Ci(n,i),!1}n=n.return}while(null!==n);return!1}(e,i,t,n,yc))return Nc=1,zl(e,Yr(n,e.current)),void(bc=null)}catch(o){if(null!==i)throw bc=i,o;return Nc=1,zl(e,Yr(n,e.current)),void(bc=null)}32768&t.flags?(ha||1===r?e=!0:kc||536870912&yc?e=!1:(xc=e=!0,(2===r||9===r||3===r||6===r)&&(null!==(r=Ii.current)&&13===r.tag&&(r.flags|=16384))),gu(t,e)):fu(t)}function fu(e){var t=e;do{if(32768&t.flags)return void gu(t,xc);e=t.return;var n=fs(t.alternate,t,Sc);if(null!==n)return void(bc=n);if(null!==(t=t.sibling))return void(bc=t);bc=t=e}while(null!==t);0===Nc&&(Nc=5)}function gu(e,t){do{var n=gs(e.alternate,e);if(null!==n)return n.flags&=32767,void(bc=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(bc=e);bc=e=n}while(null!==e);Nc=6,bc=null}function bu(e,t,n,r,i,o,l,s,c){e.cancelPendingCommit=null;do{ku()}while(0!==jc);if(6&fc)throw Error(a(327));if(null!==t){if(t===e.current)throw Error(a(177));if(o=t.lanes|t.childLanes,function(e,t,n,r,a,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-ke(n),d=1<<u;l[u]=0,s[u]=-1;var m=c[u];if(null!==m)for(c[u]=null,u=0;u<m.length;u++){var h=m[u];null!==h&&(h.lane&=-536870913)}n&=~d}0!==r&&Le(e,r,0),0!==i&&0===a&&0!==e.tag&&(e.suspendedLanes|=i&~(o&~t))}(e,n,o|=Ar,l,s,c),e===gc&&(bc=gc=null,yc=0),Uc=t,Fc=e,qc=n,Bc=o,Wc=i,Vc=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,oe(pe,function(){return Cu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=D.T,D.T=null,i=O.p,O.p=2,l=fc,fc|=4;try{!function(e,t){if(e=e.containerInfo,gd=xm,or(e=ir(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch(g){n=null;break e}var l=0,s=-1,c=-1,u=0,d=0,m=e,h=null;t:for(;;){for(var p;m!==n||0!==i&&3!==m.nodeType||(s=l+i),m!==o||0!==r&&3!==m.nodeType||(c=l+r),3===m.nodeType&&(l+=m.nodeValue.length),null!==(p=m.firstChild);)h=m,m=p;for(;;){if(m===e)break t;if(h===n&&++u===i&&(s=l),h===o&&++d===r&&(c=l),null!==(p=m.nextSibling))break;h=(m=h).parentNode}m=p}n=-1===s||-1===c?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(bd={focusedElem:e,selectionRange:n},xm=!1,Ls=t;null!==Ls;)if(e=(t=Ls).child,1028&t.subtreeFlags&&null!==e)e.return=t,Ls=e;else for(;null!==Ls;){switch(o=(t=Ls).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(n=0;n<e.length;n++)(i=e[n]).ref.impl=i.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==o){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var f=Nl(n.type,i);e=r.getSnapshotBeforeUpdate(f,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(b){Nu(n,n.return,b)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))Ad(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ad(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(a(163))}if(null!==(e=t.sibling)){e.return=t.return,Ls=e;break}Ls=t.return}}(e,t)}finally{fc=l,O.p=i,D.T=r}}jc=1,yu(),vu(),wu()}}function yu(){if(1===jc){jc=0;var e=Fc,t=Uc,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=D.T,D.T=null;var r=O.p;O.p=2;var a=fc;fc|=4;try{Ks(t,e);var i=bd,o=ir(e.containerInfo),l=i.focusedElem,s=i.selectionRange;if(o!==l&&l&&l.ownerDocument&&ar(l.ownerDocument.documentElement,l)){if(null!==s&&or(l)){var c=s.start,u=s.end;if(void 0===u&&(u=c),"selectionStart"in l)l.selectionStart=c,l.selectionEnd=Math.min(u,l.value.length);else{var d=l.ownerDocument||document,m=d&&d.defaultView||window;if(m.getSelection){var h=m.getSelection(),p=l.textContent.length,f=Math.min(s.start,p),g=void 0===s.end?f:Math.min(s.end,p);!h.extend&&f>g&&(o=g,g=f,f=o);var b=rr(l,f),y=rr(l,g);if(b&&y&&(1!==h.rangeCount||h.anchorNode!==b.node||h.anchorOffset!==b.offset||h.focusNode!==y.node||h.focusOffset!==y.offset)){var v=d.createRange();v.setStart(b.node,b.offset),h.removeAllRanges(),f>g?(h.addRange(v),h.extend(y.node,y.offset)):(v.setEnd(y.node,y.offset),h.addRange(v))}}}}for(d=[],h=l;h=h.parentNode;)1===h.nodeType&&d.push({element:h,left:h.scrollLeft,top:h.scrollTop});for("function"==typeof l.focus&&l.focus(),l=0;l<d.length;l++){var w=d[l];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}xm=!!gd,bd=gd=null}finally{fc=a,O.p=r,D.T=n}}e.current=t,jc=2}}function vu(){if(2===jc){jc=0;var e=Fc,t=Uc,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=D.T,D.T=null;var r=O.p;O.p=2;var a=fc;fc|=4;try{Ds(e,t.alternate,t)}finally{fc=a,O.p=r,D.T=n}}jc=3}}function wu(){if(4===jc||3===jc){jc=0,ce();var e=Fc,t=Uc,n=qc,r=Vc;10256&t.subtreeFlags||10256&t.flags?jc=5:(jc=0,Uc=Fc=null,xu(e,e.pendingLanes));var a=e.pendingLanes;if(0===a&&(Rc=null),je(n),t=t.stateNode,we&&"function"==typeof we.onCommitFiberRoot)try{we.onCommitFiberRoot(ve,t,void 0,!(128&~t.current.flags))}catch(s){}if(null!==r){t=D.T,a=O.p,O.p=2,D.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var l=r[o];i(l.value,{componentStack:l.stack})}}finally{D.T=t,O.p=a}}3&qc&&ku(),Ou(e),a=e.pendingLanes,261930&n&&42&a?e===Kc?Hc++:(Hc=0,Kc=e):Hc=0,Ru(0)}}function xu(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,qa(t)))}function ku(){return yu(),vu(),wu(),Cu()}function Cu(){if(5!==jc)return!1;var e=Fc,t=Bc;Bc=0;var n=je(qc),r=D.T,i=O.p;try{O.p=32>n?32:n,D.T=null,n=Wc,Wc=null;var o=Fc,l=qc;if(jc=0,Uc=Fc=null,qc=0,6&fc)throw Error(a(331));var s=fc;if(fc|=4,uc(o.current),nc(o,o.current,l,n),fc=s,Ru(0,!1),we&&"function"==typeof we.onPostCommitFiberRoot)try{we.onPostCommitFiberRoot(ve,o)}catch(c){}return!0}finally{O.p=i,D.T=r,xu(e,t)}}function Su(e,t,n){t=Yr(n,t),null!==(e=xi(e,t=Al(e.stateNode,t,2),2))&&(Ie(e,2),Ou(e))}function Nu(e,t,n){if(3===e.tag)Su(e,e,n);else for(;null!==t;){if(3===t.tag){Su(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===Rc||!Rc.has(r))){e=Yr(n,e),null!==(r=xi(t,n=Pl(2),2))&&(Ml(n,r,t,e),Ie(r,2),Ou(r));break}}t=t.return}}function Eu(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new pc;var a=/* @__PURE__ */new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=/* @__PURE__ */new Set,r.set(t,a));a.has(n)||(Cc=!0,a.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,gc===e&&(yc&n)===n&&(4===Nc||3===Nc&&(62914560&yc)===yc&&300>ue()-Ic?!(2&fc)&&ru(e,0):_c|=n,Tc===yc&&(Tc=0)),Ou(e)}function _u(e,t){0===t&&(t=Pe()),null!==(e=Lr(e,t))&&(Ie(e,t),Ou(e))}function zu(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),_u(e,n)}function Tu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}null!==r&&r.delete(t),_u(e,n)}var Au=null,Pu=null,Mu=!1,Iu=!1,Lu=!1,Du=0;function Ou(e){e!==Pu&&null===e.next&&(null===Pu?Au=Pu=e:Pu=Pu.next=e),Iu=!0,Mu||(Mu=!0,Ed(function(){6&fc?oe(me,ju):Fu()}))}function Ru(e,t){if(!Lu&&Iu){Lu=!0;do{for(var n=!1,r=Au;null!==r;){if(0!==e){var a=r.pendingLanes;if(0===a)var i=0;else{var o=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-ke(42|e)+1)-1,i=201326741&(i&=a&~(o&~l))?201326741&i|1:i?2|i:0}0!==i&&(n=!0,Bu(r,i))}else i=yc,!(3&(i=ze(r,r===gc?i:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||Te(r,i)||(n=!0,Bu(r,i));r=r.next}}while(n);Lu=!1}}function ju(){Fu()}function Fu(){Iu=Mu=!1;var e=0;0!==Du&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==kd&&(kd=e,!0);return kd=null,!1}()&&(e=Du);for(var t=ue(),n=null,r=Au;null!==r;){var a=r.next,i=Uu(r,t);0===i?(r.next=null,null===n?Au=a:n.next=a,null===a&&(Pu=n)):(n=r,(0!==e||3&i)&&(Iu=!0)),r=a}0!==jc&&5!==jc||Ru(e),0!==Du&&(Du=0)}function Uu(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=-62914561&e.pendingLanes;0<i;){var o=31-ke(i),l=1<<o,s=a[o];-1===s?0!==(l&n)&&0===(l&r)||(a[o]=Ae(l,t)):s<=t&&(e.expiredLanes|=l),i&=~l}if(n=yc,n=ze(e,e===(t=gc)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),r=e.callbackNode,0===n||e===t&&(2===vc||9===vc)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&le(r),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||Te(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&le(r),je(n)){case 2:case 8:n=he;break;case 32:default:n=pe;break;case 268435456:n=ge}return r=qu.bind(null,e),n=oe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&le(r),e.callbackPriority=2,e.callbackNode=null,2}function qu(e,t){if(0!==jc&&5!==jc)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ku()&&e.callbackNode!==n)return null;var r=yc;return 0===(r=ze(e,e===gc?r:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Xc(e,r,t),Uu(e,ue()),null!=e.callbackNode&&e.callbackNode===n?qu.bind(null,e):null)}function Bu(e,t){if(ku())return null;Xc(e,t,!0)}function Wu(){if(0===Du){var e=Va;0===e&&(e=Ne,!(261888&(Ne<<=1))&&(Ne=256)),Du=e}return Du}function Vu(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Mt(""+e)}function Hu(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}for(var Ku=0;Ku<Er.length;Ku++){var Gu=Er[Ku];$r(Gu.toLowerCase(),"on"+(Gu[0].toUpperCase()+Gu.slice(1)))}$r(yr,"onAnimationEnd"),$r(vr,"onAnimationIteration"),$r(wr,"onAnimationStart"),$r("dblclick","onDoubleClick"),$r("focusin","onFocus"),$r("focusout","onBlur"),$r(xr,"onTransitionRun"),$r(kr,"onTransitionStart"),$r(Cr,"onTransitionCancel"),$r(Sr,"onTransitionEnd"),ot("onMouseEnter",["mouseout","mouseover"]),ot("onMouseLeave",["mouseout","mouseover"]),ot("onPointerEnter",["pointerout","pointerover"]),ot("onPointerLeave",["pointerout","pointerover"]),it("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),it("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),it("onBeforeInput",["compositionend","keypress","textInput","paste"]),it("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),it("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),it("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Qu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Yu=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qu));function Xu(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],s=l.instance,c=l.currentTarget;if(l=l.listener,s!==i&&a.isPropagationStopped())break e;i=l,a.currentTarget=c;try{i(a)}catch(u){_r(u)}a.currentTarget=null,i=s}else for(o=0;o<r.length;o++){if(s=(l=r[o]).instance,c=l.currentTarget,l=l.listener,s!==i&&a.isPropagationStopped())break e;i=l,a.currentTarget=c;try{i(a)}catch(u){_r(u)}a.currentTarget=null,i=s}}}}function Ju(e,t){var n=t[He];void 0===n&&(n=t[He]=/* @__PURE__ */new Set);var r=e+"__bubble";n.has(r)||(nd(t,e,2,!1),n.add(r))}function Zu(e,t,n){var r=0;t&&(r|=4),nd(n,e,r,t)}var ed="_reactListening"+Math.random().toString(36).slice(2);function td(e){if(!e[ed]){e[ed]=!0,rt.forEach(function(t){"selectionchange"!==t&&(Yu.has(t)||Zu(t,!1,e),Zu(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[ed]||(t[ed]=!0,Zu("selectionchange",!1,t))}}function nd(e,t,n,r){switch(_m(t)){case 2:var a=km;break;case 8:a=Cm;break;default:a=Sm}n=a.bind(null,t,n,e),a=void 0,!Wt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(a=!0),r?void 0!==a?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):void 0!==a?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function rd(e,t,n,r,a){var i=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var o=r.tag;if(3===o||4===o){var s=r.stateNode.containerInfo;if(s===a)break;if(4===o)for(o=r.return;null!==o;){var c=o.tag;if((3===c||4===c)&&o.stateNode.containerInfo===a)return;o=o.return}for(;null!==s;){if(null===(o=Je(s)))return;if(5===(c=o.tag)||6===c||26===c||27===c){r=i=o;continue e}s=s.parentNode}}r=r.return}Ut(function(){var r=i,a=Dt(n),o=[];e:{var s=Nr.get(e);if(void 0!==s){var c=an,u=e;switch(e){case"keypress":if(0===Yt(n))break e;case"keydown":case"keyup":c=wn;break;case"focusin":u="focus",c=dn;break;case"focusout":u="blur",c=dn;break;case"beforeblur":case"afterblur":c=dn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=cn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=un;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=kn;break;case yr:case vr:case wr:c=mn;break;case Sr:c=Cn;break;case"scroll":case"scrollend":c=ln;break;case"wheel":c=Sn;break;case"copy":case"cut":case"paste":c=hn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=xn;break;case"toggle":case"beforetoggle":c=Nn}var d=!!(4&t),m=!d&&("scroll"===e||"scrollend"===e),h=d?null!==s?s+"Capture":null:s;d=[];for(var p,f=r;null!==f;){var g=f;if(p=g.stateNode,5!==(g=g.tag)&&26!==g&&27!==g||null===p||null===h||null!=(g=qt(f,h))&&d.push(ad(f,g,p)),m)break;f=f.return}0<d.length&&(s=new c(s,u,null,n,a),o.push({event:s,listeners:d}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===Lt||!(u=n.relatedTarget||n.fromElement)||!Je(u)&&!u[Ve])&&(c||s)&&(s=a.window===a?a:(s=a.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=r,null!==(u=(u=n.relatedTarget||n.toElement)?Je(u):null)&&(m=l(u),d=u.tag,u!==m||5!==d&&27!==d&&6!==d)&&(u=null)):(c=null,u=r),c!==u)){if(d=cn,g="onMouseLeave",h="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(d=xn,g="onPointerLeave",h="onPointerEnter",f="pointer"),m=null==c?s:et(c),p=null==u?s:et(u),(s=new d(g,f+"leave",c,n,a)).target=m,s.relatedTarget=p,g=null,Je(a)===r&&((d=new d(h,f+"enter",u,n,a)).target=p,d.relatedTarget=m,g=d),m=g,c&&u)e:{for(d=od,f=u,p=0,g=h=c;g;g=d(g))p++;g=0;for(var b=f;b;b=d(b))g++;for(;0<p-g;)h=d(h),p--;for(;0<g-p;)f=d(f),g--;for(;p--;){if(h===f||null!==f&&h===f.alternate){d=h;break e}h=d(h),f=d(f)}d=null}else d=null;null!==c&&ld(o,s,c,d,!1),null!==u&&null!==m&&ld(o,m,u,d,!0)}if("select"===(c=(s=r?et(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var y=Bn;else if(On(s))if(Wn)y=Zn;else{y=Xn;var v=Yn}else!(c=s.nodeName)||"input"!==c.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?r&&Tt(r.elementType)&&(y=Bn):y=Jn;switch(y&&(y=y(e,r))?Rn(o,y,n,a):(v&&v(e,s,r),"focusout"===e&&r&&"number"===s.type&&null!=r.memoizedProps.value&&kt(s,"number",s.value)),v=r?et(r):window,e){case"focusin":(On(v)||"true"===v.contentEditable)&&(sr=v,cr=r,ur=null);break;case"focusout":ur=cr=sr=null;break;case"mousedown":dr=!0;break;case"contextmenu":case"mouseup":case"dragend":dr=!1,mr(o,n,a);break;case"selectionchange":if(lr)break;case"keydown":case"keyup":mr(o,n,a)}var w;if($n)e:{switch(e){case"compositionstart":var x="onCompositionStart";break e;case"compositionend":x="onCompositionEnd";break e;case"compositionupdate":x="onCompositionUpdate";break e}x=void 0}else Ln?Mn(e,n)&&(x="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(x="onCompositionStart");x&&(Tn&&"ko"!==n.locale&&(Ln||"onCompositionStart"!==x?"onCompositionEnd"===x&&Ln&&(w=Qt()):(Kt="value"in(Ht=a)?Ht.value:Ht.textContent,Ln=!0)),0<(v=id(r,x)).length&&(x=new pn(x,e,null,n,a),o.push({event:x,listeners:v}),w?x.data=w:null!==(w=In(n))&&(x.data=w))),(w=zn?function(e,t){switch(e){case"compositionend":return In(t);case"keypress":return 32!==t.which?null:(Pn=!0,An);case"textInput":return(e=t.data)===An&&Pn?null:e;default:return null}}(e,n):function(e,t){if(Ln)return"compositionend"===e||!$n&&Mn(e,t)?(e=Qt(),Gt=Kt=Ht=null,Ln=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Tn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(x=id(r,"onBeforeInput")).length&&(v=new pn("onBeforeInput","beforeinput",null,n,a),o.push({event:v,listeners:x}),v.data=w)),function(e,t,n,r,a){if("submit"===t&&n&&n.stateNode===a){var i=Vu((a[We]||null).action),o=r.submitter;o&&null!==(t=(t=o[We]||null)?Vu(t.formAction):o.getAttribute("formAction"))&&(i=t,o=null);var l=new an("action","action",null,r,a);e.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(0!==Du){var e=o?Hu(a,o):new FormData(a);rl(n,{pending:!0,data:e,method:a.method,action:i},null,e)}}else"function"==typeof i&&(l.preventDefault(),e=o?Hu(a,o):new FormData(a),rl(n,{pending:!0,data:e,method:a.method,action:i},i,e))},currentTarget:a}]})}}(o,e,r,n,a)}Xu(o,t)})}function ad(e,t,n){return{instance:e,listener:t,currentTarget:n}}function id(e,t){for(var n=t+"Capture",r=[];null!==e;){var a=e,i=a.stateNode;if(5!==(a=a.tag)&&26!==a&&27!==a||null===i||(null!=(a=qt(e,n))&&r.unshift(ad(e,a,i)),null!=(a=qt(e,t))&&r.push(ad(e,a,i))),3===e.tag)return r;e=e.return}return[]}function od(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function ld(e,t,n,r,a){for(var i=t._reactName,o=[];null!==n&&n!==r;){var l=n,s=l.alternate,c=l.stateNode;if(l=l.tag,null!==s&&s===r)break;5!==l&&26!==l&&27!==l||null===c||(s=c,a?null!=(c=qt(n,i))&&o.unshift(ad(n,c,s)):a||null!=(c=qt(n,i))&&o.push(ad(n,c,s))),n=n.return}0!==o.length&&e.push({event:t,listeners:o})}var sd=/\r\n?/g,cd=/\u0000|\uFFFD/g;function ud(e){return("string"==typeof e?e:""+e).replace(sd,"\n").replace(cd,"")}function dd(e,t){return t=ud(t),ud(e)===t}function md(e,t,n,r,i,o){switch(n){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||Et(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&Et(e,""+r);break;case"className":dt(e,"class",r);break;case"tabIndex":dt(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":dt(e,n,r);break;case"style":zt(e,r,o);break;case"data":if("object"!==t){dt(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Mt(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if("function"==typeof r){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if("function"==typeof o&&("formAction"===n?("input"!==t&&md(e,t,"name",i.name,i,null),md(e,t,"formEncType",i.formEncType,i,null),md(e,t,"formMethod",i.formMethod,i,null),md(e,t,"formTarget",i.formTarget,i,null)):(md(e,t,"encType",i.encType,i,null),md(e,t,"method",i.method,i,null),md(e,t,"target",i.target,i,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(n);break}r=Mt(""+r),e.setAttribute(n,r);break;case"onClick":null!=r&&(e.onclick=It);break;case"onScroll":null!=r&&Ju("scroll",e);break;case"onScrollEnd":null!=r&&Ju("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(a(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(a(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}n=Mt(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===r?e.setAttribute(n,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Ju("beforetoggle",e),Ju("toggle",e),ut(e,"popover",r);break;case"xlinkActuate":mt(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":mt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":mt(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":mt(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":mt(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":mt(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":mt(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":mt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":mt(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":ut(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])&&ut(e,n=At.get(n)||n,r)}}function hd(e,t,n,r,i,o){switch(n){case"style":zt(e,r,o);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(a(61));if(null!=(n=r.__html)){if(null!=i.children)throw Error(a(60));e.innerHTML=n}}break;case"children":"string"==typeof r?Et(e,r):("number"==typeof r||"bigint"==typeof r)&&Et(e,""+r);break;case"onScroll":null!=r&&Ju("scroll",e);break;case"onScrollEnd":null!=r&&Ju("scrollend",e);break;case"onClick":null!=r&&(e.onclick=It);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:at.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),"function"==typeof(o=null!=(o=e[We]||null)?o[n]:null)&&e.removeEventListener(t,o,i),"function"!=typeof r)?n in e?e[n]=r:!0===r?e.setAttribute(n,""):ut(e,n,r):("function"!=typeof o&&null!==o&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i)))}}function pd(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ju("error",e),Ju("load",e);var r,i=!1,o=!1;for(r in n)if(n.hasOwnProperty(r)){var l=n[r];if(null!=l)switch(r){case"src":i=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:md(e,t,r,l,n,null)}}return o&&md(e,t,"srcSet",n.srcSet,n,null),void(i&&md(e,t,"src",n.src,n,null));case"input":Ju("invalid",e);var s=r=l=o=null,c=null,u=null;for(i in n)if(n.hasOwnProperty(i)){var d=n[i];if(null!=d)switch(i){case"name":o=d;break;case"type":l=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":r=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(null!=d)throw Error(a(137,t));break;default:md(e,t,i,d,n,null)}}return void xt(e,r,s,c,u,l,o,!1);case"select":for(o in Ju("invalid",e),i=l=r=null,n)if(n.hasOwnProperty(o)&&null!=(s=n[o]))switch(o){case"value":r=s;break;case"defaultValue":l=s;break;case"multiple":i=s;default:md(e,t,o,s,n,null)}return t=r,n=l,e.multiple=!!i,void(null!=t?Ct(e,!!i,t,!1):null!=n&&Ct(e,!!i,n,!0));case"textarea":for(l in Ju("invalid",e),r=o=i=null,n)if(n.hasOwnProperty(l)&&null!=(s=n[l]))switch(l){case"value":i=s;break;case"defaultValue":o=s;break;case"children":r=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(a(91));break;default:md(e,t,l,s,n,null)}return void Nt(e,i,o,r);case"option":for(c in n)if(n.hasOwnProperty(c)&&null!=(i=n[c]))if("selected"===c)e.selected=i&&"function"!=typeof i&&"symbol"!=typeof i;else md(e,t,c,i,n,null);return;case"dialog":Ju("beforetoggle",e),Ju("toggle",e),Ju("cancel",e),Ju("close",e);break;case"iframe":case"object":Ju("load",e);break;case"video":case"audio":for(i=0;i<Qu.length;i++)Ju(Qu[i],e);break;case"image":Ju("error",e),Ju("load",e);break;case"details":Ju("toggle",e);break;case"embed":case"source":case"link":Ju("error",e),Ju("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in n)if(n.hasOwnProperty(u)&&null!=(i=n[u]))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,t));default:md(e,t,u,i,n,null)}return;default:if(Tt(t)){for(d in n)n.hasOwnProperty(d)&&(void 0!==(i=n[d])&&hd(e,t,d,i,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(null!=(i=n[s])&&md(e,t,s,i,n,null))}function fd(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var gd=null,bd=null;function yd(e){return 9===e.nodeType?e:e.ownerDocument}function vd(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function wd(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function xd(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var kd=null;var Cd="function"==typeof setTimeout?setTimeout:void 0,Sd="function"==typeof clearTimeout?clearTimeout:void 0,Nd="function"==typeof Promise?Promise:void 0,Ed="function"==typeof queueMicrotask?queueMicrotask:void 0!==Nd?function(e){return Nd.resolve(null).then(e).catch($d)}:Cd;function $d(e){setTimeout(function(){throw e})}function _d(e){return"head"===e}function zd(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&8===a.nodeType)if("/$"===(n=a.data)||"/&"===n){if(0===r)return e.removeChild(a),void Hm(t);r--}else if("$"===n||"$?"===n||"$~"===n||"$!"===n||"&"===n)r++;else if("html"===n)Fd(e.ownerDocument.documentElement);else if("head"===n){Fd(n=e.ownerDocument.head);for(var i=n.firstChild;i;){var o=i.nextSibling,l=i.nodeName;i[Ye]||"SCRIPT"===l||"STYLE"===l||"LINK"===l&&"stylesheet"===i.rel.toLowerCase()||n.removeChild(i),i=o}}else"body"===n&&Fd(e.ownerDocument.body);n=a}while(n);Hm(t)}function Td(e,t){var n=e;e=0;do{var r=n.nextSibling;if(1===n.nodeType?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",""===n.getAttribute("style")&&n.removeAttribute("style")):3===n.nodeType&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===e)break;e--}else"$"!==n&&"$?"!==n&&"$~"!==n&&"$!"!==n||e++;n=r}while(n)}function Ad(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Ad(n),Xe(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function Pd(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=Ld(e.nextSibling)))return null}return e}function Md(e){return"$?"===e.data||"$~"===e.data}function Id(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function Ld(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Dd=null;function Od(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n||"/&"===n){if(0===t)return Ld(e.nextSibling);t--}else"$"!==n&&"$!"!==n&&"$?"!==n&&"$~"!==n&&"&"!==n||t++}e=e.nextSibling}return null}function Rd(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n||"$~"===n||"&"===n){if(0===t)return e;t--}else"/$"!==n&&"/&"!==n||t++}e=e.previousSibling}return null}function jd(e,t,n){switch(t=yd(n),e){case"html":if(!(e=t.documentElement))throw Error(a(452));return e;case"head":if(!(e=t.head))throw Error(a(453));return e;case"body":if(!(e=t.body))throw Error(a(454));return e;default:throw Error(a(451))}}function Fd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Xe(e)}var Ud=/* @__PURE__ */new Map,qd=/* @__PURE__ */new Set;function Bd(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Wd=O.d;O.d={f:function(){var e=Wd.f(),t=tu();return e||t},r:function(e){var t=Ze(e);null!==t&&5===t.tag&&"form"===t.type?il(t):Wd.r(e)},D:function(e){Wd.D(e),Hd("dns-prefetch",e,null)},C:function(e,t){Wd.C(e,t),Hd("preconnect",e,t)},L:function(e,t,n){Wd.L(e,t,n);var r=Vd;if(r&&e&&t){var a='link[rel="preload"][as="'+vt(t)+'"]';"image"===t&&n&&n.imageSrcSet?(a+='[imagesrcset="'+vt(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(a+='[imagesizes="'+vt(n.imageSizes)+'"]')):a+='[href="'+vt(e)+'"]';var i=a;switch(t){case"style":i=Gd(e);break;case"script":i=Xd(e)}Ud.has(i)||(e=m({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),Ud.set(i,e),null!==r.querySelector(a)||"style"===t&&r.querySelector(Qd(i))||"script"===t&&r.querySelector(Jd(i))||(pd(t=r.createElement("link"),"link",e),nt(t),r.head.appendChild(t)))}},m:function(e,t){Wd.m(e,t);var n=Vd;if(n&&e){var r=t&&"string"==typeof t.as?t.as:"script",a='link[rel="modulepreload"][as="'+vt(r)+'"][href="'+vt(e)+'"]',i=a;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Xd(e)}if(!Ud.has(i)&&(e=m({rel:"modulepreload",href:e},t),Ud.set(i,e),null===n.querySelector(a))){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Jd(i)))return}pd(r=n.createElement("link"),"link",e),nt(r),n.head.appendChild(r)}}},X:function(e,t){Wd.X(e,t);var n=Vd;if(n&&e){var r=tt(n).hoistableScripts,a=Xd(e),i=r.get(a);i||((i=n.querySelector(Jd(a)))||(e=m({src:e,async:!0},t),(t=Ud.get(a))&&nm(e,t),nt(i=n.createElement("script")),pd(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}},S:function(e,t,n){Wd.S(e,t,n);var r=Vd;if(r&&e){var a=tt(r).hoistableStyles,i=Gd(e);t=t||"default";var o=a.get(i);if(!o){var l={loading:0,preload:null};if(o=r.querySelector(Qd(i)))l.loading=5;else{e=m({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ud.get(i))&&tm(e,n);var s=o=r.createElement("link");nt(s),pd(s,"link",e),s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),s.addEventListener("load",function(){l.loading|=1}),s.addEventListener("error",function(){l.loading|=2}),l.loading|=4,em(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:l},a.set(i,o)}}},M:function(e,t){Wd.M(e,t);var n=Vd;if(n&&e){var r=tt(n).hoistableScripts,a=Xd(e),i=r.get(a);i||((i=n.querySelector(Jd(a)))||(e=m({src:e,async:!0,type:"module"},t),(t=Ud.get(a))&&nm(e,t),nt(i=n.createElement("script")),pd(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(a,i))}}};var Vd="undefined"==typeof document?null:document;function Hd(e,t,n){var r=Vd;if(r&&"string"==typeof t&&t){var a=vt(t);a='link[rel="'+e+'"][href="'+a+'"]',"string"==typeof n&&(a+='[crossorigin="'+n+'"]'),qd.has(a)||(qd.add(a),e={rel:e,crossOrigin:n,href:t},null===r.querySelector(a)&&(pd(t=r.createElement("link"),"link",e),nt(t),r.head.appendChild(t)))}}function Kd(e,t,n,r){var i,o,l,s,c=(c=G.current)?Bd(c):null;if(!c)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=Gd(n.href),(r=(n=tt(c).hoistableStyles).get(t))||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===n.rel&&"string"==typeof n.href&&"string"==typeof n.precedence){e=Gd(n.href);var u=tt(c).hoistableStyles,d=u.get(e);if(d||(c=c.ownerDocument||c,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,d),(u=c.querySelector(Qd(e)))&&!u._p&&(d.instance=u,d.state.loading=5),Ud.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ud.set(e,n),u||(i=c,o=e,l=n,s=d.state,i.querySelector('link[rel="preload"][as="style"]['+o+"]")?s.loading=1:(o=i.createElement("link"),s.preload=o,o.addEventListener("load",function(){return s.loading|=1}),o.addEventListener("error",function(){return s.loading|=2}),pd(o,"link",l),nt(o),i.head.appendChild(o))))),t&&null===r)throw Error(a(528,""));return d}if(t&&null!==r)throw Error(a(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Xd(n),(r=(n=tt(c).hoistableScripts).get(t))||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Gd(e){return'href="'+vt(e)+'"'}function Qd(e){return'link[rel="stylesheet"]['+e+"]"}function Yd(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Xd(e){return'[src="'+vt(e)+'"]'}function Jd(e){return"script[async]"+e}function Zd(e,t,n){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+vt(n.href)+'"]');if(r)return t.instance=r,nt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return nt(r=(e.ownerDocument||e).createElement("style")),pd(r,"style",i),em(r,n.precedence,e),t.instance=r;case"stylesheet":i=Gd(n.href);var o=e.querySelector(Qd(i));if(o)return t.state.loading|=4,t.instance=o,nt(o),o;r=Yd(n),(i=Ud.get(i))&&tm(r,i),nt(o=(e.ownerDocument||e).createElement("link"));var l=o;return l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),pd(o,"link",r),t.state.loading|=4,em(o,n.precedence,e),t.instance=o;case"script":return o=Xd(n.src),(i=e.querySelector(Jd(o)))?(t.instance=i,nt(i),i):(r=n,(i=Ud.get(o))&&nm(r=m({},n),i),nt(i=(e=e.ownerDocument||e).createElement("script")),pd(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(a(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,em(r,n.precedence,e));return t.instance}function em(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=r.length?r[r.length-1]:null,i=a,o=0;o<r.length;o++){var l=r[o];if(l.dataset.precedence===t)i=l;else if(i!==a)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function tm(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function nm(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var rm=null;function am(e,t,n){if(null===rm){var r=/* @__PURE__ */new Map,a=rm=/* @__PURE__ */new Map;a.set(n,r)}else(r=(a=rm).get(n))||(r=/* @__PURE__ */new Map,a.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),a=0;a<n.length;a++){var i=n[a];if(!(i[Ye]||i[Be]||"link"===e&&"stylesheet"===i.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==i.namespaceURI){var o=i.getAttribute(t)||"";o=e+o;var l=r.get(o);l?l.push(i):r.set(o,[i])}}return r}function im(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function om(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var lm=0;function sm(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)um(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var cm=null;function um(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,cm=/* @__PURE__ */new Map,t.forEach(dm,e),cm=null,sm.call(e))}function dm(e,t){if(!(4&t.state.loading)){var n=cm.get(e);if(n)var r=n.get(null);else{n=/* @__PURE__ */new Map,cm.set(e,n);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<a.length;i++){var o=a[i];"LINK"!==o.nodeName&&"not all"===o.getAttribute("media")||(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}o=(a=t.instance).getAttribute("data-precedence"),(i=n.get(o)||r)===r&&n.set(null,a),n.set(o,a),this.count++,r=sm.bind(this),a.addEventListener("load",r),a.addEventListener("error",r),i?i.parentNode.insertBefore(a,i.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(a,e.firstChild),t.state.loading|=4}}var mm={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function hm(e,t,n,r,a,i,o,l,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Me(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Me(0),this.hiddenUpdates=Me(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=/* @__PURE__ */new Map}function pm(e,t,n,r,a,i,o,l,s,c,u,d){return e=new hm(e,t,n,o,s,c,u,d,l),t=1,!0===i&&(t|=24),i=Fr(3,null,null,t),e.current=i,i.stateNode=e,(t=Ua()).refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},yi(i),e}function fm(e){return e?e=Rr:Rr}function gm(e,t,n,r,a,i){a=fm(a),null===r.context?r.context=a:r.pendingContext=a,(r=wi(t)).payload={element:n},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(n=xi(e,r,t))&&(Yc(n,0,t),ki(n,e,t))}function bm(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function ym(e,t){bm(e,t),(e=e.alternate)&&bm(e,t)}function vm(e){if(13===e.tag||31===e.tag){var t=Lr(e,67108864);null!==t&&Yc(t,0,67108864),ym(e,67108864)}}function wm(e){if(13===e.tag||31===e.tag){var t=Gc(),n=Lr(e,t=Re(t));null!==n&&Yc(n,0,t),ym(e,t)}}var xm=!0;function km(e,t,n,r){var a=D.T;D.T=null;var i=O.p;try{O.p=2,Sm(e,t,n,r)}finally{O.p=i,D.T=a}}function Cm(e,t,n,r){var a=D.T;D.T=null;var i=O.p;try{O.p=8,Sm(e,t,n,r)}finally{O.p=i,D.T=a}}function Sm(e,t,n,r){if(xm){var a=Nm(r);if(null===a)rd(e,t,r,Em,n),Om(e,r);else if(function(e,t,n,r,a){switch(t){case"focusin":return Tm=Rm(Tm,e,t,n,r,a),!0;case"dragenter":return Am=Rm(Am,e,t,n,r,a),!0;case"mouseover":return Pm=Rm(Pm,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Mm.set(i,Rm(Mm.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Im.set(i,Rm(Im.get(i)||null,e,t,n,r,a)),!0}return!1}(a,e,t,n,r))r.stopPropagation();else if(Om(e,r),4&t&&-1<Dm.indexOf(e)){for(;null!==a;){var i=Ze(a);if(null!==i)switch(i.tag){case 3:if((i=i.stateNode).current.memoizedState.isDehydrated){var o=_e(i.pendingLanes);if(0!==o){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;o;){var s=1<<31-ke(o);l.entanglements[1]|=s,o&=~s}Ou(i),!(6&fc)&&(Dc=ue()+500,Ru(0))}}break;case 31:case 13:null!==(l=Lr(i,2))&&Yc(l,0,2),tu(),ym(i,2)}if(null===(i=Nm(r))&&rd(e,t,r,Em,n),i===a)break;a=i}null!==a&&r.stopPropagation()}else rd(e,t,r,null,n)}}function Nm(e){return $m(e=Dt(e))}var Em=null;function $m(e){if(Em=null,null!==(e=Je(e))){var t=l(e);if(null===t)e=null;else{var n=t.tag;if(13===n){if(null!==(e=s(t)))return e;e=null}else if(31===n){if(null!==(e=c(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Em=e,null}function _m(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(de()){case me:return 2;case he:return 8;case pe:case fe:return 32;case ge:return 268435456;default:return 32}default:return 32}}var zm=!1,Tm=null,Am=null,Pm=null,Mm=/* @__PURE__ */new Map,Im=/* @__PURE__ */new Map,Lm=[],Dm="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Om(e,t){switch(e){case"focusin":case"focusout":Tm=null;break;case"dragenter":case"dragleave":Am=null;break;case"mouseover":case"mouseout":Pm=null;break;case"pointerover":case"pointerout":Mm.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Im.delete(t.pointerId)}}function Rm(e,t,n,r,a,i){return null===e||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},null!==t&&(null!==(t=Ze(t))&&vm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==a&&-1===t.indexOf(a)&&t.push(a),e)}function jm(e){var t=Je(e.target);if(null!==t){var n=l(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=s(n)))return e.blockedOn=t,void Ue(e.priority,function(){wm(n)})}else if(31===t){if(null!==(t=c(n)))return e.blockedOn=t,void Ue(e.priority,function(){wm(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Fm(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Nm(e.nativeEvent);if(null!==n)return null!==(t=Ze(n))&&vm(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);Lt=r,n.target.dispatchEvent(r),Lt=null,t.shift()}return!0}function Um(e,t,n){Fm(e)&&n.delete(t)}function qm(){zm=!1,null!==Tm&&Fm(Tm)&&(Tm=null),null!==Am&&Fm(Am)&&(Am=null),null!==Pm&&Fm(Pm)&&(Pm=null),Mm.forEach(Um),Im.forEach(Um)}function Bm(e,n){e.blockedOn===n&&(e.blockedOn=null,zm||(zm=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qm)))}var Wm=null;function Vm(e){Wm!==e&&(Wm=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wm===e&&(Wm=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],a=e[t+2];if("function"!=typeof r){if(null===$m(r||n))continue;break}var i=Ze(n);null!==i&&(e.splice(t,3),t-=3,rl(i,{pending:!0,data:a,method:n.method,action:r},r,a))}}))}function Hm(e){function t(t){return Bm(t,e)}null!==Tm&&Bm(Tm,e),null!==Am&&Bm(Am,e),null!==Pm&&Bm(Pm,e),Mm.forEach(t),Im.forEach(t);for(var n=0;n<Lm.length;n++){var r=Lm[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Lm.length&&null===(n=Lm[0]).blockedOn;)jm(n),null===n.blockedOn&&Lm.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(r=0;r<n.length;r+=3){var a=n[r],i=n[r+1],o=a[We]||null;if("function"==typeof i)o||Vm(n);else if(o){var l=null;if(i&&i.hasAttribute("formAction")){if(a=i,o=i[We]||null)l=o.formAction;else if(null!==$m(a))continue}else l=o.action;"function"==typeof l?n[r+1]=l:(n.splice(r,3),r-=3),Vm(n)}}}function Km(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return a=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==a&&(a(),a=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"==typeof navigation){var r=!1,a=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==a&&(a(),a=null)}}}function Gm(e){this._internalRoot=e}function Qm(e){this._internalRoot=e}Qm.prototype.render=Gm.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(a(409));gm(t.current,Gc(),e,t,null,null)},Qm.prototype.unmount=Gm.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;gm(e.current,2,null,e,null,null),tu(),t[Ve]=null}},Qm.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lm.length&&0!==t&&t<Lm[n].priority;n++);Lm.splice(n,0,e),0===n&&jm(e)}};var Ym=n.version;if("19.2.3"!==Ym)throw Error(a(527,Ym,"19.2.3"));O.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw e=Object.keys(e).join(","),Error(a(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=l(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}(t),e=null===(e=null!==e?d(e):null)?null:e.stateNode};var Xm={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.3"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Jm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jm.isDisabled&&Jm.supportsFiber)try{ve=Jm.inject(Xm),we=Jm}catch(eh){}}return y.createRoot=function(e,t){if(!i(e))throw Error(a(299));var n=!1,r="",o=El,l=$l,s=_l;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onUncaughtError&&(o=t.onUncaughtError),void 0!==t.onCaughtError&&(l=t.onCaughtError),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=pm(e,1,!1,null,0,n,r,null,o,l,s,Km),e[Ve]=t.current,td(e),new Gm(t)},y.hydrateRoot=function(e,t,n){if(!i(e))throw Error(a(299));var r=!1,o="",l=El,s=$l,c=_l,u=null;return null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(o=n.identifierPrefix),void 0!==n.onUncaughtError&&(l=n.onUncaughtError),void 0!==n.onCaughtError&&(s=n.onCaughtError),void 0!==n.onRecoverableError&&(c=n.onRecoverableError),void 0!==n.formState&&(u=n.formState)),(t=pm(e,1,!0,t,0,r,o,u,l,s,c,Km)).context=fm(null),n=t.current,(o=wi(r=Re(r=Gc()))).callback=null,xi(n,o,r),n=r,t.current.lanes=n,Ie(t,n),Ou(t),e[Ve]=t.current,td(e),new Qm(t)},y.version="19.2.3",y}var C=(g||(g=1,function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),b.exports=k()),b.exports);const S=new class{constructor(){this.supportsContainerQueries=this.detectContainerQueries(),this.init()}detectContainerQueries(){if("undefined"==typeof window)return!1;try{if("CSS"in window&&"supports"in window.CSS)return window.CSS.supports("container-type","inline-size");const e=document.createElement("div");return e.style.containerType="inline-size","inline-size"===e.style.containerType}catch{return!1}}init(){"undefined"!=typeof window&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.applyClasses()):this.applyClasses())}applyClasses(){document.querySelectorAll(".limbo-component-container-wrapper").forEach(e=>{this.supportsContainerQueries?(e.classList.add("container-queries-supported"),e.classList.remove("container-queries-fallback")):(e.classList.add("container-queries-fallback"),e.classList.remove("container-queries-supported"))}),this.supportsContainerQueries?(document.body.classList.add("container-queries-supported"),document.body.classList.remove("container-queries-fallback")):(document.body.classList.add("container-queries-fallback"),document.body.classList.remove("container-queries-supported"))}getContainerWidth(e){if(!e)return window.innerWidth;let t=e.closest(".limbo-component-container-wrapper");return t||(t=e.closest(".limbo-modal-content")),t||(t=e.closest(".limbo-modal")),t||(t=document.body),t.offsetWidth||t.clientWidth}shouldUseMobileStyles(e,t=768){return this.getContainerWidth(e)<=t}applyResponsiveClasses(e){if(this.supportsContainerQueries)return;const t=this.shouldUseMobileStyles(e),n=this.shouldUseMobileStyles(e,1024)&&!t;e.classList.toggle("limbo-mobile-fallback",t),e.classList.toggle("limbo-tablet-fallback",n),e.classList.toggle("limbo-desktop-fallback",!t&&!n)}observeResize(){if(!this.supportsContainerQueries)if("ResizeObserver"in window){const e=new ResizeObserver(e=>{e.forEach(e=>{this.applyResponsiveClasses(e.target)})});document.querySelectorAll(".limbo-component-container-wrapper").forEach(t=>{e.observe(t)})}else window.addEventListener("resize",()=>{document.querySelectorAll(".limbo-component-container-wrapper").forEach(e=>{this.applyResponsiveClasses(e)})})}};function N(e={}){const{useContainerQuery:r=!1,containerElement:a=null}=e,[i,o]=t(()=>{const e=r&&a?S.getContainerWidth(a):"undefined"!=typeof window?window.innerWidth:0,t="undefined"!=typeof window&&(e<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)),n="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);return{isMobile:t,isTouch:n,isTablet:"undefined"!=typeof window&&(e>768&&e<=1024&&n),orientation:"undefined"!=typeof window?window.innerHeight>window.innerWidth?"portrait":"landscape":"portrait",viewport:{width:"undefined"!=typeof window?window.innerWidth:0,height:"undefined"!=typeof window?window.innerHeight:0},container:{width:e,supportsContainerQueries:S.supportsContainerQueries}}});n(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,n=r&&a?S.getContainerWidth(a):e,i=n<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),l="ontouchstart"in window||navigator.maxTouchPoints>0;o({isMobile:i,isTouch:l,isTablet:n>768&&n<=1024&&l,orientation:t>e?"portrait":"landscape",viewport:{width:e,height:t},container:{width:n,supportsContainerQueries:S.supportsContainerQueries}})};let t;const n=()=>{clearTimeout(t),t=setTimeout(e,150)};return window.addEventListener("resize",n),window.addEventListener("orientationchange",()=>{setTimeout(e,100)}),()=>{clearTimeout(t),window.removeEventListener("resize",n),window.removeEventListener("orientationchange",e)}},[r,a]);const l="portrait"===i.orientation,s="landscape"===i.orientation,c=i.isMobile||i.isTablet&&l;return{...i,isPortrait:l,isLandscape:s,isCompactMode:c,isMobileSize:i.viewport.width<=640,isTabletSize:i.viewport.width>640&&i.viewport.width<=1024,isDesktopSize:i.viewport.width>1024,deviceClass:i.isMobile?"mobile":i.isTablet?"tablet":"desktop"}}function E({tabs:e,active:t,onChange:n}){const{isMobile:r,isTouch:a}=N(),i=["limbo-tabs","flex","gap-4","border-b-2","border-brand-blue-200","mb-6",r&&"overflow-x-auto scrollbar-none"].filter(Boolean).join(" "),o=e=>{const t=["limbo-tab","relative","px-6","py-2","font-medium","text-brand-blue-1000","bg-transparent","border-0","border-b-2","cursor-pointer","transition-all","duration-200","hover:text-pink-1000","focus:outline-none","focus-visible:ring-2","focus-visible:ring-brand-blue-400","focus-visible:ring-offset-2"];return e?t.push("border-b-brand-blue-1000","font-semibold","limbo-active"):t.push("border-b-transparent"),r&&t.push("min-w-[120px]","min-h-[44px]","text-base","shrink-0"),a&&t.push("touch-manipulation"),t.join(" ")};/* @__PURE__ */
2
+ return l("div",{className:i,role:"tablist","aria-label":"Opciones de navegación",style:r?{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"}:void 0,children:e.map(r=>{const i=t===r.id;return!i&&r.hideNonActive?null:/* @__PURE__ */l("button",{"data-tab-id":r.id,onClick:()=>n(r.id),onKeyDown:t=>((t,r)=>{const a=e.findIndex(e=>e.id===r);let i=a;switch(t.key){case"ArrowLeft":case"ArrowUp":t.preventDefault(),i=a>0?a-1:e.length-1;break;case"ArrowRight":case"ArrowDown":t.preventDefault(),i=a<e.length-1?a+1:0;break;case"Home":t.preventDefault(),i=0;break;case"End":t.preventDefault(),i=e.length-1;break;case"Enter":case" ":return t.preventDefault(),void n(r);default:return}const o=e[i];o&&!o.hideNonActive&&(n(o.id),setTimeout(()=>{const e=document.querySelector(`[data-tab-id="${o.id}"]`);e&&e.focus()},0))})(t,r.id),className:o(i),role:"tab","aria-selected":i,"aria-controls":`tabpanel-${r.id}`,tabIndex:i?0:-1,id:`tab-${r.id}`,style:a?{WebkitTapHighlightColor:"transparent"}:void 0,children:r.label},r.id)})})}const $="https://led-dev-limbo-dev.eu.els.local",_="https://limbo.lefebvre.es";let z={publicKey:null,token:null,authMode:null,tokenEndpoint:null,tokenProvider:null,prod:!1};function T({prod:e=!1}={}){return e?_:$}async function A({endpoint:e,method:t="GET",body:n=null,prod:r=!1,basePath:a="",customHeaders:i={},isFormData:o=!1,useJWT:l=!0}){try{const s=r||z.prod,c=await async function({isFormData:e=!1,useJWT:t=!0,customHeaders:n={}}={}){const r={"Access-Control-Allow-Origin":`${window.location.hostname||"*"}`};e||(r["Content-Type"]="application/json");let a=z.token;if(t){if("jwt"===z.authMode&&z.tokenProvider&&!a)try{console.log("🔑 Calling tokenProvider..."),a=await z.tokenProvider(),console.log("✅ Token obtained from tokenProvider"),z.token=a}catch(i){throw console.error("❌ tokenProvider failed:",i),new Error("Failed to obtain token from tokenProvider: "+i.message)}else if("session"===z.authMode&&!a)try{const e=T(z),t=z.tokenEndpoint||"/auth/token",n=await fetch(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":`${window.location.hostname||"*"}`},body:JSON.stringify({public_key:z.publicKey}),credentials:"include"});if(!n.ok)throw new Error(`Session auth failed: ${n.status}`);a=(await n.json()).token,z.token=a}catch(i){throw console.error("❌ Session authentication failed:",i),new Error("Failed to authenticate with session. User must be logged in.")}a?r.Authorization=`Bearer ${a}`:console.warn("⚠️ No JWT token available:",{authMode:z.authMode,hasPublicKey:!!z.publicKey,hasTokenProvider:!!z.tokenProvider})}return e&&delete r["Content-Type"],{...r,...n}}({isFormData:o,useJWT:l,customHeaders:i});"GET"===t&&!n&&c["Content-Type"]&&delete c["Content-Type"];const u=await fetch(`${T({prod:s})}${a}${e}`,{method:t,headers:c,body:n?o?n:JSON.stringify(n):void 0,credentials:"include"});if(204===u.status)return{success:!0,data:null,message:"No content",httpCode:204,timestamp:/* @__PURE__ */(new Date).toISOString()};if(!u.ok){let e=`HTTP ${u.status}: ${u.statusText}`,t=null;try{const n=await u.json();t=n,n.error?e=`${n.error.code}: ${n.error.message}`:n.message&&(e=n.message)}catch{}throw 401===u.status&&t&&("token_expired"===t.error||t.message&&t.message.includes("expired")||t.message&&t.message.includes("caducado")||t.error&&t.error.includes("expired"))&&window.dispatchEvent(new CustomEvent("tokenExpiredError",{detail:{error:{response:{status:401,data:t}}}})),new Error(e)}return u.json()}catch(s){throw new Error(`API Error: ${s.message}`)}}function P(){const e={...z};return e?.prod||!1?"https://limbo.lefebvre.es":"http://localhost"}function M(e){if(!e?.id)return null;return`${P()}/api/assets/${e.id}/download`}function I(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("/")){return`${P()}${e}`}return e}function L(e){return Array.isArray(e)?e.map(e=>({id:e.id,name:e.name,width:e.width,height:e.height,format:e.output_format,file_size:e.file_size,crop_params:e.crop_params,url:I(e.url),expires_at:e.expires_at,created_at:e.created_at})):[]}function D(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;if("sync"===t.processing_mode&&t.variants&&t.variants.length>0){const e=t.variants[0];return{result:{id:e.id||null,name:e.name,width:parseInt(e.size?.split("x")[0])||e.width,height:parseInt(e.size?.split("x")[1])||e.height,format:e.format,file_size:e.file_size,url:e.url,status:e.status,asset_id:t.asset_id,created_at:e.created_at||/* @__PURE__ */(new Date).toISOString(),all_variants:t.variants}}}return{result:{job_id:t.job_id,asset_id:t.asset_id,variants_requested:t.variants_requested||[],processing_mode:t.processing_mode||"async",estimated_completion:t.estimated_completion,variant_statuses:(t.variant_statuses||t.variants||[]).map(e=>({name:e.name,status:e.status,size:e.expected_size||e.size,format:e.format}))}}}function O(e){if(e.message&&!e.message.includes("API Error:"))return e;let t=e.message||"Unknown API error";return t.startsWith("API Error: ")&&(t=t.substring(11)),new Error(t)}const R="/api";async function j(e={}){try{const t=new URLSearchParams(e).toString(),n=t?`/assets?${t}`:"/assets";return function(e){if(!e?.success||!Array.isArray(e?.data?.data))return{result:[]};const t={result:e.data.data.map(e=>({id:e.id,filename:e.filename||e.original_filename,mime_type:e.mime_type,file_size:e.file_size,width:e.width,height:e.height,upload_date:e.upload_date||e.created_at,processing_status:e.processing_status||e.status,variants:e.variants_count&&(L(e.variants)||L(e.image_variants))||[],url:I(e.master_url||e.master?.url_signed||e.urls?.original||e.url)||M(e),webp_available:e.webp_available||!!e.webp_url,metadata:e.metadata||{},variants_count:e.variants_count||0}))};return e.data.pagination&&(t.pagination={page:e.data.pagination.page,limit:e.data.pagination.limit,total:e.data.pagination.total,pages:e.data.pagination.pages}),t}(await A({endpoint:n,method:"GET",basePath:R,useJWT:!0}))}catch(t){throw O(t)}}async function F(e,t=null,n=!1){try{const r=new FormData;r.append("file",e),t&&r.append("uploaded_by",t),n&&r.append("store_original",n.toString());return function(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;return{result:{id:t.id,filename:t.original_filename,mime_type:t.mime_type,file_size:t.file_size,width:t.width,height:t.height,status:t.status,upload_date:t.created_at,url:I(t.master?.url_signed),master_format:t.master?.format,processing:t.processing||{master_webp:"processing"===t.status?"queued":"completed",variants:"processing"===t.status?"queued":"completed"},checksum:t.checksum,storage_path:t.storage_path_base,metadata:t.metadata||{}}}}(await A({endpoint:"/assets",method:"POST",body:r,basePath:R,isFormData:!0,useJWT:!0}))}catch(r){throw O(r)}}async function U(e){try{const n=await A({endpoint:`/assets/${e}/variants`,method:"GET",basePath:R,useJWT:!0});return t=n,t?.success&&Array.isArray(t?.data?.variants)?{result:t.data.variants.map(e=>({id:e.id,name:e.filename||e.name||`Variante ${e.id}`,filename:e.filename,mime_type:e.mime_type,format:e.output_format||e.format||(e.mime_type?e.mime_type.split("/")[1]:"jpg"),file_size:e.file_size,width:e.width,height:e.height,upload_date:e.upload_date||e.created_at,processing_status:e.processing_status||e.status,url:I(e.master_url||e.master?.url_signed||e.urls?.original||e.url)||M(e),webp_available:e.webp_available||!!e.webp_url,metadata:e.metadata||{},crop_data:e.crop_data||{},crop_params:e.crop_params||e.crop_data||{},parent_asset_id:e.parent_asset_id||t.data.asset_id,variant_type:e.variant_type||"crop"}))}:{result:[]}}catch(n){throw O(n)}var t}function q(){const[e,n]=t({}),[a,i]=t({}),[o,l]=t({}),s=r(async t=>{if(t&&!a[t]){if(e[t])return e[t];i(e=>({...e,[t]:!0})),l(e=>({...e,[t]:null}));try{const e=await U(t),r=e?.result||[];return n(e=>({...e,[t]:r})),r}catch(r){return console.error("Error loading variants:",r),l(e=>({...e,[t]:r.message})),[]}finally{i(e=>({...e,[t]:!1}))}}},[e,a]),c=r(t=>e[t]||[],[e]),u=r(e=>a[e]||!1,[a]),d=r(e=>o[e]||null,[o]),m=r(e=>{n(t=>{const n={...t};return delete n[e],n}),i(t=>{const n={...t};return delete n[e],n}),l(t=>{const n={...t};return delete n[e],n})},[]),h=r(async e=>(m(e),await s(e)),[m,s]),p=r(async(e,t)=>{try{return await async function(e,t){try{return await A({endpoint:`/assets/${e}/variants/${t}`,method:"DELETE",basePath:R,useJWT:!0})}catch(n){throw O(n)}}(e,t),n(n=>{const r=n[e]||[];return{...n,[e]:r.filter(e=>e.id!==t)}}),{success:!0}}catch(r){return console.error("Error deleting variant:",r),{success:!1,error:r.message}}},[]);return{loadVariants:s,getVariants:c,isLoading:u,getError:d,clearVariants:m,refreshVariants:h,removeVariant:p}}function B({src:e,alt:i="Imagen",title:o="",subtitle:c="",onClose:u,isOpen:d=!1}){const[m,h]=t(1),[p,f]=t({x:0,y:0}),[g,b]=t(!1),[y,v]=t(!1),[w,x]=t({x:0,y:0}),[k,C]=t(!1),[S,N]=t(!1),E=a(null),$=a(null);n(()=>{d&&(h(1),f({x:0,y:0}),C(!1),N(!1))},[d]);const _=r(()=>{h(e=>Math.min(e+.25,5)),f({x:0,y:0})},[]),z=r(()=>{h(e=>Math.max(e-.25,.25)),f({x:0,y:0})},[]),T=r(()=>{h(1),f({x:0,y:0})},[]),A=r(()=>{h(1),f({x:0,y:0})},[]),P=r(e=>{if("Escape"===e.key)return e.preventDefault(),void u?.();if((e.ctrlKey||e.metaKey)&&("+"===e.key||"="===e.key))return e.preventDefault(),void _();if((e.ctrlKey||e.metaKey)&&"-"===e.key)return e.preventDefault(),void z();if((e.ctrlKey||e.metaKey)&&"0"===e.key)return e.preventDefault(),void T();if(m>1){const t=50;switch(e.key){case"ArrowUp":e.preventDefault(),f(e=>({...e,y:e.y+t}));break;case"ArrowDown":e.preventDefault(),f(e=>({...e,y:e.y-t}));break;case"ArrowLeft":e.preventDefault(),f(e=>({...e,x:e.x+t}));break;case"ArrowRight":e.preventDefault(),f(e=>({...e,x:e.x-t}))}}},[u,_,z,T,m]),M=r(e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.deltaY<0?_():z())},[_,z]),I=r(e=>{m>1&&0===e.button&&(e.preventDefault(),b(!0),v(!1),x({x:e.clientX-p.x,y:e.clientY-p.y}))},[m,p]),L=r(e=>{g&&(v(!0),f({x:e.clientX-w.x,y:e.clientY-w.y}))},[g,w]),D=r(()=>{b(!1)},[]),O=r(e=>{e.stopPropagation(),1!==m||y||(h(2),f({x:0,y:0})),v(!1)},[m,y]),R=r(e=>{e.stopPropagation(),1===m?(h(2),f({x:0,y:0})):T()},[m,T]);if(n(()=>{if(!d)return;document.addEventListener("keydown",P),document.addEventListener("mouseup",D),document.addEventListener("mousemove",L);const e=e=>{!e.ctrlKey&&!e.metaKey||"+"!==e.key&&"-"!==e.key&&"="!==e.key&&"0"!==e.key||e.preventDefault()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",P),document.removeEventListener("mouseup",D),document.removeEventListener("mousemove",L),document.removeEventListener("keydown",e)}},[d,P,D,L]),n(()=>(document.body.style.overflow=d?"hidden":"",()=>{document.body.style.overflow=""}),[d]),!d)return null;const j=Math.round(100*m);/* @__PURE__ */
3
3
  return s("div",{className:"fixed inset-0 bg-black/95 z-[10000] flex flex-col",role:"dialog","aria-modal":"true","aria-label":"Visor de imagen",children:[
4
4
  /* @__PURE__ */s("div",{className:"flex items-center justify-between px-4 py-3 bg-black/50 backdrop-blur-sm",children:[
5
5
  /* @__PURE__ */s("div",{className:"flex-1 min-w-0",children:[o&&/* @__PURE__ */l("h2",{className:"text-white font-medium text-sm truncate",children:o.split(".")[0]}),c&&/* @__PURE__ */l("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:c})]}),
6
6
  /* @__PURE__ */s("div",{className:"flex items-center gap-2 mx-4",children:[
7
- /* @__PURE__ */l("button",{type:"button",onClick:$,disabled:m<=.25,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-white/10 hover:bg-white/20 text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Reducir zoom",title:"Reducir zoom (Ctrl -)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})}),
8
- /* @__PURE__ */s("div",{className:"w-20 text-center text-white text-sm font-medium bg-white/10 rounded-lg px-2 py-1.5 cursor-pointer hover:bg-white/20 transition-colors",onClick:_,title:"Click para restablecer zoom",role:"button",tabIndex:0,onKeyDown:e=>"Enter"===e.key&&_(),children:[D,"%"]}),
9
- /* @__PURE__ */l("button",{type:"button",onClick:E,disabled:m>=5,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-white/10 hover:bg-white/20 text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Aumentar zoom",title:"Aumentar zoom (Ctrl +)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),
10
- /* @__PURE__ */l("button",{type:"button",onClick:z,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-white/10 hover:bg-white/20 text-white transition-colors ml-2","aria-label":"Ajustar a pantalla",title:"Ajustar a pantalla (Ctrl 0)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]}),
7
+ /* @__PURE__ */l("button",{type:"button",onClick:z,disabled:m<=.25,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-white/10 hover:bg-white/20 text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Reducir zoom",title:"Reducir zoom (Ctrl -)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})}),
8
+ /* @__PURE__ */s("div",{className:"w-20 text-center text-white text-sm font-medium bg-white/10 rounded-lg px-2 py-1.5 cursor-pointer hover:bg-white/20 transition-colors",onClick:T,title:"Click para restablecer zoom",role:"button",tabIndex:0,onKeyDown:e=>"Enter"===e.key&&T(),children:[j,"%"]}),
9
+ /* @__PURE__ */l("button",{type:"button",onClick:_,disabled:m>=5,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-white/10 hover:bg-white/20 text-white disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"Aumentar zoom",title:"Aumentar zoom (Ctrl +)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),
10
+ /* @__PURE__ */l("button",{type:"button",onClick:A,className:"w-8 h-8 flex items-center justify-center rounded-lg bg-white/10 hover:bg-white/20 text-white transition-colors ml-2","aria-label":"Ajustar a pantalla",title:"Ajustar a pantalla (Ctrl 0)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})})]}),
11
11
  /* @__PURE__ */l("button",{type:"button",onClick:u,className:"w-10 h-10 flex items-center justify-center rounded-lg bg-white/10 hover:bg-red-1000/80 text-white transition-colors","aria-label":"Cerrar visor (ESC)",title:"Cerrar (ESC)",children:/* @__PURE__ */l("svg",{className:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),
12
- /* @__PURE__ */s("div",{ref:S,className:`flex-1 overflow-hidden flex items-center justify-center ${m>1?"cursor-grab":"cursor-zoom-in"} ${g?"cursor-grabbing":""}`,onClick:e=>{1===m&&e.target===S.current&&u?.()},onWheel:A,onMouseDown:M,onDoubleClick:L,children:[!w&&!k&&/* @__PURE__ */l("div",{className:"absolute inset-0 flex items-center justify-center",children:/* @__PURE__ */l("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),k&&/* @__PURE__ */s("div",{className:"text-center text-white",children:[
12
+ /* @__PURE__ */s("div",{ref:E,className:`flex-1 overflow-hidden flex items-center justify-center ${m>1?"cursor-grab":"cursor-zoom-in"} ${g?"cursor-grabbing":""}`,onClick:e=>{e.target===E.current&&u?.()},onWheel:M,onMouseDown:I,children:[!k&&!S&&/* @__PURE__ */l("div",{className:"absolute inset-0 flex items-center justify-center",children:/* @__PURE__ */l("div",{className:"w-12 h-12 border-4 border-white/20 border-t-white rounded-full animate-spin"})}),S&&/* @__PURE__ */s("div",{className:"text-center text-white",children:[
13
13
  /* @__PURE__ */l("svg",{className:"w-16 h-16 mx-auto mb-4 text-red-800",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),
14
14
  /* @__PURE__ */l("p",{className:"text-lg font-medium",children:"Error al cargar la imagen"}),
15
15
  /* @__PURE__ */l("p",{className:"text-gray-400 text-sm mt-2",children:"No se pudo cargar la imagen"})]}),
16
- /* @__PURE__ */l("img",{ref:N,src:e,alt:i,className:"max-w-full max-h-full object-contain transition-opacity duration-200 select-none "+(w?"opacity-100":"opacity-0"),style:{transform:`scale(${m}) translate(${p.x/m}px, ${p.y/m}px)`,transition:g?"none":"transform 0.2s ease-out"},onLoad:()=>x(!0),onError:()=>C(!0),draggable:!1})]}),
16
+ /* @__PURE__ */l("img",{ref:$,src:e,alt:i,className:"max-w-full max-h-full object-contain transition-opacity duration-200 select-none "+(k?"opacity-100":"opacity-0"),style:{transform:`scale(${m}) translate(${p.x/m}px, ${p.y/m}px)`,transition:g?"none":"transform 0.2s ease-out"},onLoad:()=>C(!0),onError:()=>N(!0),onClick:O,onDoubleClick:R,draggable:!1})]}),
17
17
  /* @__PURE__ */l("div",{className:"px-4 py-2 bg-black/50 backdrop-blur-sm text-center",children:/* @__PURE__ */s("p",{className:"text-gray-400 text-xs",children:[
18
18
  /* @__PURE__ */s("span",{className:"hidden sm:inline",children:[
19
19
  /* @__PURE__ */l("kbd",{className:"px-1.5 py-0.5 bg-white/10 rounded text-white",children:"Ctrl"})," + rueda para zoom •"," ",
20
20
  /* @__PURE__ */l("kbd",{className:"px-1.5 py-0.5 bg-white/10 rounded text-white",children:"Ctrl"})," +"," ",
21
21
  /* @__PURE__ */l("kbd",{className:"px-1.5 py-0.5 bg-white/10 rounded text-white",children:"+"})," /"," ",
22
- /* @__PURE__ */l("kbd",{className:"px-1.5 py-0.5 bg-white/10 rounded text-white",children:"-"})," zoom •"," ","Doble click para ampliar/restablecer •"," ","Flechas para mover •"," ",
22
+ /* @__PURE__ */l("kbd",{className:"px-1.5 py-0.5 bg-white/10 rounded text-white",children:"-"})," ","zoom •"," ","Doble click para ampliar/restablecer •"," ","Flechas para mover •"," ",
23
23
  /* @__PURE__ */l("kbd",{className:"px-1.5 py-0.5 bg-white/10 rounded text-white",children:"ESC"})," cerrar"]}),
24
- /* @__PURE__ */l("span",{className:"sm:hidden",children:"Doble click para zoom • ESC para cerrar"})]})})]})}function W({image:i,isOpen:o,onClose:u,onSelect:d,onDelete:m,onCrop:h,onVariantDeleted:p,allowedActions:f={select:!0,download:!0,copy:!0,delete:!0,crop:!0}}){const{loadVariants:g,getVariants:b,isLoading:y,getError:v,removeVariant:w}=q(),x=window.limboCore?.accessibilityManager,[k,C]=e.useState(null),[S,N]=e.useState(null),[E,$]=t(null),_=(window.limboCore?.config?.getGlobal()||{}).interaction||{allowSelection:!1,allowCropping:!0},z=_.allowSelection&&f.select&&d,T=_.allowCropping&&f.crop&&h,A=f.download,M=f.delete,[P,I]=e.useState(/* @__PURE__ */new Set),L=a(null),D=a(null),O=r(e=>{if("Escape"===e.key){if(E)return;e.preventDefault(),u?.()}if("Tab"===e.key&&L.current){const t=L.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n?.focus())}},[u,E]);n(()=>{if(o)return D.current?.focus(),document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o,O]);const R=e.useMemo(()=>i?.variants||[],[i?.variants]),j=b(i?.id),F=R.length>0?R:j,U=0===R.length&&y(i?.id),W=0===R.length?v(i?.id):null;n(()=>{!o||!i?.id||i?.variants&&0!==i.variants.length||g(i.id)},[o,i?.id,i?.variants,g]),e.useEffect(()=>{o&&I(/* @__PURE__ */new Set)},[o]);if(!o)return null;const V=[{...i,isOriginal:!0},...F.map(e=>({...e,isOriginal:!1}))];/* @__PURE__ */
24
+ /* @__PURE__ */l("span",{className:"sm:hidden",children:"Click para zoom • Doble click para restablecer • ESC para cerrar"})]})})]})}function W({image:i,isOpen:o,onClose:u,onSelect:d,onDelete:m,onCrop:h,onVariantDeleted:p,allowedActions:f={select:!0,download:!0,copy:!0,delete:!0,crop:!0}}){const{loadVariants:g,getVariants:b,isLoading:y,getError:v,removeVariant:w}=q(),x=window.limboCore?.accessibilityManager,[k,C]=e.useState(null),[S,N]=e.useState(null),[E,$]=t(null),_=(window.limboCore?.config?.getGlobal()||{}).interaction||{allowSelection:!1,allowCropping:!0},z=_.allowSelection&&f.select&&d,T=_.allowCropping&&f.crop&&h,A=f.download,P=f.delete,[M,I]=e.useState(/* @__PURE__ */new Set),[L,D]=e.useState(/* @__PURE__ */new Set),O=a(null),R=a(null),j=r(e=>{if("Escape"===e.key){if(E)return;e.preventDefault(),u?.()}if("Tab"===e.key&&O.current){const t=O.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),n?.focus())}},[u,E]);n(()=>{if(o)return R.current?.focus(),document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[o,j]);const F=e.useMemo(()=>i?.variants||[],[i?.variants]),U=b(i?.id),W=(F.length>0?F:U).filter(e=>!L.has(e.id)),V=0===F.length&&y(i?.id),H=0===F.length?v(i?.id):null;n(()=>{!o||!i?.id||i?.variants&&0!==i.variants.length||g(i.id)},[o,i?.id,i?.variants,g]),e.useEffect(()=>{o&&(I(/* @__PURE__ */new Set),D(/* @__PURE__ */new Set))},[o]);if(!o)return null;const K=[{...i,isOriginal:!0},...W.map(e=>({...e,isOriginal:!1}))];/* @__PURE__ */
25
25
  return s("div",{className:"fixed inset-0 bg-black/85 flex items-center justify-center z-[1000] p-4",onClick:()=>{E||u?.()},role:"dialog","aria-modal":"true","aria-labelledby":"variants-modal-title","aria-describedby":"variants-modal-description",children:[
26
- /* @__PURE__ */s("div",{ref:L,className:"bg-white rounded-xl max-w-[95vw] max-h-[90vh] overflow-hidden shadow-2xl flex flex-col w-[900px]",onClick:e=>e.stopPropagation(),children:[
26
+ /* @__PURE__ */s("div",{ref:O,className:"bg-white rounded-xl max-w-[95vw] max-h-[90vh] overflow-hidden shadow-2xl flex flex-col w-[900px]",onClick:e=>e.stopPropagation(),children:[
27
27
  /* @__PURE__ */s("div",{className:"px-5 py-4 border-b border-gray-200 flex justify-between items-center bg-gray-50",children:[
28
28
  /* @__PURE__ */s("div",{className:"flex-1 min-w-0 pr-4",children:[
29
29
  /* @__PURE__ */l("h2",{id:"variants-modal-title",className:"m-0 text-lg font-semibold text-gray-900 truncate",children:i?.filename}),
30
- /* @__PURE__ */s("p",{id:"variants-modal-description",className:"text-sm text-gray-500 mt-1",children:["Imagen original y ",F.length," recorte",1!==F.length?"s":""," disponible",1!==F.length?"s":""]})]}),
31
- /* @__PURE__ */l("button",{ref:D,className:"w-10 h-10 flex items-center justify-center rounded-lg bg-gray-100 hover:bg-red-200 text-gray-500 hover:text-red-1000 transition-colors focus:outline-none focus:ring-2 focus:ring-brand-blue-400",onClick:u,"aria-label":"Cerrar modal (ESC)",title:"Cerrar (ESC)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),k&&/* @__PURE__ */l("div",{className:"mx-2 mt-2 px-2 py-1.5 rounded text-xs "+("success"===S?"bg-green-50 text-green-1000":"bg-red-50 text-red-1000"),role:"alert",children:k}),
32
- /* @__PURE__ */l("div",{className:"p-5 overflow-y-auto flex-1 bg-gray-50/50",children:U?/* @__PURE__ */s("div",{className:"text-center py-16 text-gray-500",role:"status","aria-live":"polite",children:[
30
+ /* @__PURE__ */s("p",{id:"variants-modal-description",className:"text-sm text-gray-500 mt-1",children:["Imagen original y ",W.length," recorte",1!==W.length?"s":""," disponible",1!==W.length?"s":""]})]}),
31
+ /* @__PURE__ */l("button",{ref:R,className:"w-10 h-10 flex items-center justify-center rounded-lg bg-gray-100 hover:bg-red-200 text-gray-500 hover:text-red-1000 transition-colors focus:outline-none focus:ring-2 focus:ring-brand-blue-400",onClick:u,"aria-label":"Cerrar modal (ESC)",title:"Cerrar (ESC)",children:/* @__PURE__ */l("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),k&&/* @__PURE__ */l("div",{className:"mx-2 mt-2 px-2 py-1.5 rounded text-xs "+("success"===S?"bg-green-50 text-green-1000":"bg-red-50 text-red-1000"),role:"alert",children:k}),
32
+ /* @__PURE__ */l("div",{className:"p-5 overflow-y-auto flex-1 bg-gray-50/50",children:V?/* @__PURE__ */s("div",{className:"text-center py-16 text-gray-500",role:"status","aria-live":"polite",children:[
33
33
  /* @__PURE__ */l("div",{className:"w-12 h-12 border-4 border-gray-200 border-t-brand-blue-800 rounded-full animate-spin mx-auto mb-4"}),
34
- /* @__PURE__ */l("p",{className:"text-base",children:"Cargando variantes..."})]}):W?/* @__PURE__ */s("div",{className:"text-center py-16 text-red-1000",role:"alert",children:[
34
+ /* @__PURE__ */l("p",{className:"text-base",children:"Cargando variantes..."})]}):H?/* @__PURE__ */s("div",{className:"text-center py-16 text-red-1000",role:"alert",children:[
35
35
  /* @__PURE__ */l("svg",{className:"w-12 h-12 mx-auto mb-4 text-red-800",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),
36
- /* @__PURE__ */s("p",{className:"text-base font-medium",children:["Error: ",W]}),
37
- /* @__PURE__ */l("button",{onClick:()=>g(i.id),className:"mt-4 text-sm px-5 py-2.5 rounded-lg bg-brand-blue-800 text-white hover:bg-brand-blue-1000 focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-2",children:"Reintentar"})]}):0===F.length?/* @__PURE__ */s("div",{className:"text-center py-16 text-gray-500",children:[
36
+ /* @__PURE__ */s("p",{className:"text-base font-medium",children:["Error: ",H]}),
37
+ /* @__PURE__ */l("button",{onClick:()=>g(i.id),className:"mt-4 text-sm px-5 py-2.5 rounded-lg bg-brand-blue-800 text-white hover:bg-brand-blue-1000 focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-2",children:"Reintentar"})]}):0===W.length?/* @__PURE__ */s("div",{className:"text-center py-16 text-gray-500",children:[
38
38
  /* @__PURE__ */l("svg",{className:"w-12 h-12 mx-auto mb-4 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),
39
- /* @__PURE__ */l("p",{className:"text-base",children:"No hay recortes disponibles"})]}):/* @__PURE__ */l("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",role:"list","aria-label":"Lista de imágenes",children:V.map((e,t)=>{const n=e.isOriginal,r=!n&&P.has(e.id),a=e.url,o=n?"Original":e.name||e.filename||`Recorte ${t}`,f=n?i.width:e.width,g=n?i.height:e.height,b=n?i.file_size:e.file_size||0;/* @__PURE__ */
39
+ /* @__PURE__ */l("p",{className:"text-base",children:"No hay recortes disponibles"})]}):/* @__PURE__ */l("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",role:"list","aria-label":"Lista de imágenes",children:K.map((e,t)=>{const n=e.isOriginal,r=!n&&M.has(e.id),a=e.url,o=n?"Original":e.name||e.filename||`Recorte ${t}`,f=n?i.width:e.width,g=n?i.height:e.height,b=n?i.file_size:e.file_size||0;/* @__PURE__ */
40
40
  return s("article",{role:"listitem","aria-label":`${o} - ${f}×${g} píxeles`,className:`rounded-xl overflow-hidden transition-all shadow-sm hover:shadow-lg ${n?"ring-2 ring-brand-blue-800 ring-offset-2 bg-white":"border border-gray-200 bg-white hover:border-brand-blue-400"} focus-within:ring-2 focus-within:ring-brand-blue-400`,children:[
41
41
  /* @__PURE__ */s("button",{type:"button",title:"Click para ampliar con zoom",className:"relative w-full cursor-pointer aspect-square flex items-center justify-center overflow-hidden bg-gray-100 focus:outline-none group",onClick:r?void 0:()=>{return n?(x?.announce(`Abriendo visor de imagen: ${i.filename}`),void $({src:i.url,title:i.filename||"Original",subtitle:`${i.width}×${i.height} · ${Math.round((i.file_size||0)/1024)}KB`})):(t=e,x?.announce(`Abriendo visor de imagen: ${t.name}`),void $({src:t.url,title:t.name||t.filename||"Recorte",subtitle:`${t.width}×${t.height} · ${Math.round((t.file_size||0)/1024)}KB`}));var t},"aria-label":`Ver ${o} en tamaño completo con zoom`,disabled:r,children:[r?/* @__PURE__ */s("div",{className:"text-center text-gray-400",children:[
42
42
  /* @__PURE__ */l("svg",{className:"w-10 h-10 mx-auto mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),
@@ -48,21 +48,23 @@ return s("article",{role:"listitem","aria-label":`${o} - ${f}×${g} píxeles`,cl
48
48
  /* @__PURE__ */l("h3",{className:"text-sm font-semibold text-gray-900 truncate mb-2",title:o,children:o}),
49
49
  /* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
50
50
  /* @__PURE__ */s("span",{className:"text-xs text-gray-500 font-medium",children:[f,"×",g," ·"," ",Math.round(b/1024),"KB"]}),
51
- /* @__PURE__ */s("div",{className:"flex gap-2",role:"group","aria-label":`Acciones para ${o}`,children:[n&&T&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 rounded-lg bg-brand-blue-400 hover:bg-brand-blue-800 cursor-pointer text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-1 transition-colors shadow-sm",onClick:e=>{e.stopPropagation(),h&&(x?.announce(`Abriendo herramienta de recorte para ${i.filename}`),h(i),u?.())},"aria-label":"Crear nuevo recorte",title:"Recortar",children:/* @__PURE__ */l("span",{className:"icon icon-scissors-white icon--sm"})}),A&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 rounded-lg bg-brand-blue-400 hover:bg-brand-blue-800 cursor-pointer text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-1 transition-colors shadow-sm",onClick:t=>{t.stopPropagation(),n?(async()=>{const{downloadImage:e}=await Promise.resolve().then(()=>Qt);await e(i.url||i.path,i.filename||"limbo-image",{originalFormat:i.format,accessibilityManager:x})})():(async e=>{const{downloadImage:t}=await Promise.resolve().then(()=>Qt);await t(e.url,e.name||"limbo-variant",{originalFormat:e.format||e.output_format,accessibilityManager:x})})(e)},"aria-label":`Descargar ${o}`,title:"Descargar",children:/* @__PURE__ */l("span",{className:"icon icon-download-white icon--sm"})}),M&&(!n||m)&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 rounded-lg bg-red-1000 hover:bg-red-800 cursor-pointer text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-red-800 focus:ring-offset-1 transition-colors shadow-sm",onClick:t=>{t.stopPropagation(),n?(async()=>{if(!m)return;window.confirm(`¿Estás seguro de que deseas eliminar "${i.filename}"? Esta acción también eliminará todos sus recortes.`)&&(x?.announce(`Eliminando imagen ${i.filename}`),await m(i.id),u?.())})():(async e=>{if(window.confirm(`¿Estás seguro de que deseas eliminar el recorte "${e.name||e.filename}"?`)){x?.announce(`Eliminando recorte ${e.name||e.filename}`);const t=await w(i.id,e.id);t.success?(C("Recorte eliminado correctamente"),N("success"),x?.announce("Recorte eliminado correctamente"),p?.(),setTimeout(()=>{C(null),N(null)},3e3)):(C(`Error al eliminar recorte: ${t.error}`),N("error"),x?.announceError(`Error al eliminar recorte: ${t.error}`),setTimeout(()=>{C(null),N(null)},5e3))}})(e)},"aria-label":`Eliminar ${o}`,title:"Eliminar",children:/* @__PURE__ */l("span",{className:"icon icon-close-small-white icon--sm"})}),z&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 cursor-pointer rounded-lg bg-brand-blue-1000 text-white hover:bg-brand-blue-800 flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-1 transition-colors shadow-sm",onClick:t=>{t.stopPropagation(),n?(d?.(i),u?.()):(e=>{const t={id:e.id,filename:`${i.filename}_${e.name}`,url:e.url,width:e.width,height:e.height,mime_type:`image/${e.format}`,file_size:e.file_size,upload_date:e.created_at,processing_status:"completed",is_variant:!0,parent_asset_id:i.id,variant_info:e};x?.announce(`Recorte seleccionado: ${e.name}`),d?.(t),u?.()})(e)},"aria-label":`Seleccionar ${o}`,title:"Seleccionar",children:/* @__PURE__ */l("span",{className:"icon icon-tick-white icon--sm"})})]})]})]})]},n?"original":e.id)})})})]}),
52
- /* @__PURE__ */l(B,{isOpen:!!E,src:E?.src||"",alt:E?.title||"Imagen",title:E?.title,subtitle:E?.subtitle,onClose:()=>$(null)})]})}function V({image:n,onDelete:r,onCrop:a,onSelect:i,thumbnailSize:o=32,isDeleting:u=!1,allowedActions:d={select:!0,download:!0,copy:!0,delete:!0,crop:!0,variants:!0}}){const[m,h]=t(!1),[p,f]=t(!1),[g,b]=t(!1),[y,v]=t(n.variants_count||0),{isMobile:w,isTouch:x}=N(),k=window.limboCore?.accessibilityManager,C=(window.limboCore?.config?.getGlobal()||{}).interaction||{allowSelection:!1,allowCropping:!0},S=e=>{e.stopPropagation(),k?.announce(`Eliminando imagen ${n.filename}`,"assertive"),r?.(n)},E=async e=>{e.stopPropagation();let t=n.url||n.path;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(t);else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}h(!0),k?.announce(`URL de ${n.filename} copiada al portapapeles. Nota: La URL puede tener un tiempo de validez limitado.`),setTimeout(()=>h(!1),2e3)}catch(r){console.error("Error al copiar URL:",r),k?.announce(`Error al copiar URL de ${n.filename}. Inténtalo de nuevo.`),alert(`Error al copiar URL de ${n.filename}. Por favor, inténtalo de nuevo.`)}},$=async e=>{e.preventDefault(),e.stopPropagation();const{downloadImage:t}=await Promise.resolve().then(()=>Qt);await t(n.url||n.path,n.filename||"limbo-image",{originalFormat:n.format,accessibilityManager:k})},_=e=>{e.stopPropagation(),k?.announce(`Editando imagen ${n.filename}`),a?.(n)},z=n.variants&&n.variants.length>0||y>0,T=y,A=e.useCallback(()=>{v(e=>Math.max(0,e-1))},[]);e.useEffect(()=>{v(n.variants_count||0)},[n.variants_count]);const M=C.allowSelection&&d.select&&i,P=C.allowCropping&&d.crop&&a,I=()=>{z?(k?.announce(`Mostrando recortes de ${n.filename}`),f(!0)):(k?.announce(`Abriendo visor de ${n.filename}`),b(!0))};/* @__PURE__ */
51
+ /* @__PURE__ */s("div",{className:"flex gap-2",role:"group","aria-label":`Acciones para ${o}`,children:[n&&T&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 rounded-lg bg-brand-blue-400 hover:bg-brand-blue-800 cursor-pointer text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-1 transition-colors shadow-sm",onClick:e=>{e.stopPropagation(),h&&(x?.announce(`Abriendo herramienta de recorte para ${i.filename}`),h(i),u?.())},"aria-label":"Crear nuevo recorte",title:"Recortar",children:/* @__PURE__ */l("span",{className:"icon icon-scissors-white icon--sm"})}),A&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 rounded-lg bg-brand-blue-400 hover:bg-brand-blue-800 cursor-pointer text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-1 transition-colors shadow-sm",onClick:t=>{t.stopPropagation(),n?(async()=>{const{downloadImage:e}=await Promise.resolve().then(()=>Yt);await e(i.url||i.path,i.filename||"limbo-image",{originalFormat:i.format,accessibilityManager:x})})():(async e=>{const{downloadImage:t}=await Promise.resolve().then(()=>Yt);await t(e.url,e.name||"limbo-variant",{originalFormat:e.format||e.output_format,accessibilityManager:x})})(e)},"aria-label":`Descargar ${o}`,title:"Descargar",children:/* @__PURE__ */l("span",{className:"icon icon-download-white icon--sm"})}),P&&(!n||m)&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 rounded-lg bg-red-1000 hover:bg-red-800 cursor-pointer text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-red-800 focus:ring-offset-1 transition-colors shadow-sm",onClick:t=>{t.stopPropagation(),n?(async()=>{if(!m)return;window.confirm(`¿Estás seguro de que deseas eliminar "${i.filename}"? Esta acción también eliminará todos sus recortes.`)&&(x?.announce(`Eliminando imagen ${i.filename}`),await m(i.id),u?.())})():(async e=>{if(window.confirm(`¿Estás seguro de que deseas eliminar el recorte "${e.name||e.filename}"?`)){x?.announce(`Eliminando recorte ${e.name||e.filename}`);const t=await w(i.id,e.id);t.success?(D(t=>/* @__PURE__ */new Set([...t,e.id])),C("Recorte eliminado correctamente"),N("success"),x?.announce("Recorte eliminado correctamente"),p?.(),setTimeout(()=>{C(null),N(null)},3e3)):(C(`Error al eliminar recorte: ${t.error}`),N("error"),x?.announceError(`Error al eliminar recorte: ${t.error}`),setTimeout(()=>{C(null),N(null)},5e3))}})(e)},"aria-label":`Eliminar ${o}`,title:"Eliminar",children:/* @__PURE__ */l("span",{className:"icon icon-close-small-white icon--sm"})}),z&&/* @__PURE__ */l("button",{type:"button",className:"w-8 h-8 cursor-pointer rounded-lg bg-brand-blue-1000 text-white hover:bg-brand-blue-800 flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-brand-blue-400 focus:ring-offset-1 transition-colors shadow-sm",onClick:t=>{t.stopPropagation(),n?(d?.(i),u?.()):(e=>{const t={id:e.id,filename:`${i.filename}_${e.name}`,url:e.url,width:e.width,height:e.height,mime_type:`image/${e.format}`,file_size:e.file_size,upload_date:e.created_at,processing_status:"completed",is_variant:!0,parent_asset_id:i.id,variant_info:e};x?.announce(`Recorte seleccionado: ${e.name}`),d?.(t),u?.()})(e)},"aria-label":`Seleccionar ${o}`,title:"Seleccionar",children:/* @__PURE__ */l("span",{className:"icon icon-tick-white icon--sm"})})]})]})]})]},n?"original":e.id)})})})]}),
52
+ /* @__PURE__ */l(B,{isOpen:!!E,src:E?.src||"",alt:E?.title||"Imagen",title:E?.title,subtitle:E?.subtitle,onClose:()=>$(null)})]})}function V({image:n,onDelete:r,onCrop:a,onSelect:i,thumbnailSize:o=32,isDeleting:u=!1,allowedActions:d={select:!0,download:!0,copy:!0,delete:!0,crop:!0,variants:!0}}){const[m,h]=t(!1),[p,f]=t(!1),[g,b]=t(!1),[y,v]=t(n.variants_count||0),[w,x]=t(!0),[k,C]=t(!1),{isMobile:S,isTouch:E}=N(),$=window.limboCore?.accessibilityManager,_=(window.limboCore?.config?.getGlobal()||{}).interaction||{allowSelection:!1,allowCropping:!0},z=e=>{e.stopPropagation(),$?.announce(`Eliminando imagen ${n.filename}`,"assertive"),r?.(n)},T=async e=>{e.stopPropagation();let t=n.url||n.path;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(t);else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e)}h(!0),$?.announce(`URL de ${n.filename} copiada al portapapeles. Nota: La URL puede tener un tiempo de validez limitado.`),setTimeout(()=>h(!1),2e3)}catch(r){console.error("Error al copiar URL:",r),$?.announce(`Error al copiar URL de ${n.filename}. Inténtalo de nuevo.`),alert(`Error al copiar URL de ${n.filename}. Por favor, inténtalo de nuevo.`)}},A=async e=>{e.preventDefault(),e.stopPropagation();const{downloadImage:t}=await Promise.resolve().then(()=>Yt);await t(n.url||n.path,n.filename||"limbo-image",{originalFormat:n.format,accessibilityManager:$})},P=e=>{e.stopPropagation(),$?.announce(`Editando imagen ${n.filename}`),a?.(n)},M=n.variants&&n.variants.length>0||y>0,I=y,L=e.useCallback(()=>{v(e=>Math.max(0,e-1))},[]);e.useEffect(()=>{v(n.variants_count||0)},[n.variants_count]),e.useEffect(()=>{x(!0),C(!1)},[n.url,n.path]);const D=_.allowSelection&&d.select&&i,O=_.allowCropping&&d.crop&&a,R=()=>{M?($?.announce(`Mostrando recortes de ${n.filename}`),f(!0)):($?.announce(`Abriendo visor de ${n.filename}`),b(!0))};/* @__PURE__ */
53
53
  return s(c,{children:[
54
- /* @__PURE__ */s("div",{className:`limbo-image-card flex flex-col items-center cursor-pointer relative transition ${u?"opacity-50":""} ${w?"limbo-image-card--mobile":""}`,onClick:I,onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),I();break;case"d":case"D":d.download&&(e.preventDefault(),$(e));break;case"c":case"C":d.copy&&(e.preventDefault(),E(e));break;case"Delete":case"Backspace":d.delete&&r&&(e.preventDefault(),S(e));break;case"x":case"X":d.crop&&a&&(e.preventDefault(),_(e));break;case"v":case"V":d.variants&&(e.preventDefault(),(e=>{e.stopPropagation(),k?.announce(`Mostrando recortes de ${n.filename}`),f(!0)})(e))}},title:z?`Ver ${T} recorte${1!==T?"s":""} de ${n.filename}`:w?"Toque para ampliar imagen":"Click para ampliar imagen con zoom",role:"button",tabIndex:0,"aria-label":`Imagen ${n.filename}. ${n.width}x${n.height} px`,style:{...x&&{touchAction:"manipulation",WebkitTapHighlightColor:"transparent"}},children:[
55
- /* @__PURE__ */s("div",{className:"limbo-image-actions "+(w?"limbo-image-actions--mobile":""),children:[!z&&M&&/* @__PURE__ */l("button",{type:"button",title:"Seleccionar imagen",className:"btn btn-success bg-brand-blue-800 hover:bg-brand-blue-1000 border border-brand-blue-1000 "+(w?"btn--touch":""),onClick:e=>{e.stopPropagation(),k?.announce(`Seleccionando ${n.filename} para el portal`),i?.(n)},tabIndex:-1,style:{...w&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:"icon icon-tick-white icon--sm","aria-hidden":"true"})}),P&&/* @__PURE__ */l("button",{type:"button",title:"Editar imagen",className:"btn btn-crop bg-brand-blue-400 hover:bg-brand-blue-800 border border-brand-blue-1000 "+(w?"btn--touch":""),onClick:_,tabIndex:-1,style:{...w&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:"icon icon-scissors-white icon--sm","aria-hidden":"true"})}),d.copy&&/* @__PURE__ */l("button",{type:"button",title:m?"¡Copiado!":"Copiar URL",className:"btn btn-copy bg-brand-blue-400 hover:bg-brand-blue-800 border border-brand-blue-1000 "+(w?"btn--touch":""),onClick:E,tabIndex:-1,style:{...w&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:`icon ${m?"icon-copied-white":"icon-copy-white"} icon--sm`,"aria-hidden":"true"})}),d.download&&/* @__PURE__ */l("button",{type:"button",title:"Descargar",className:"btn btn-download bg-brand-blue-400 hover:bg-brand-blue-800 border border-brand-blue-1000 "+(w?"btn--touch":""),onClick:$,tabIndex:-1,style:{...w&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:"icon icon-download-white icon--sm","aria-hidden":"true"})}),d.delete&&r&&/* @__PURE__ */l("button",{onClick:S,disabled:u,className:"btn btn-delete bg-red-1000 hover:bg-red-800 border border-red-1000/50 "+(w?"btn--touch":""),title:"Eliminar imagen",tabIndex:-1,style:{...w&&{width:"40px",height:"40px"}},children:u?"…":/* @__PURE__ */l("span",{className:"icon icon-close-small-white icon--sm","aria-hidden":"true"})})]}),
56
- /* @__PURE__ */l("img",{src:n.url||n.path,loading:"eager",alt:n.filename.split(".")[0]??n.filename,className:"w-full object-cover rounded aspect-square "+(z?"ring-2 ring-brand-blue-400 ring-offset-2":""),sizes:`height: ${6*o}px,width: ${6*o}px`,draggable:!1,style:{...w&&{minHeight:`${Math.max(3*o,80)}px`,height:"auto",aspectRatio:"1 / 1",objectFit:"cover"}}}),
57
- /* @__PURE__ */s("span",{className:"text-xs mt-1 limbo-truncate w-full text-center limbo-image-card-name "+(w?"limbo-image-card-name--mobile":""),style:{...w&&{fontSize:"0.75rem",lineHeight:"1.2",maxWidth:"100%",padding:"2px 4px",backgroundColor:"rgba(255, 255, 255, 0.9)",borderRadius:"4px",color:"#333",fontWeight:"500"}},children:[n.filename.split(".")[0]??n.filename,z&&/* @__PURE__ */l("span",{className:"limbo-variants-indicator",style:{marginLeft:"4px",padding:"1px 6px",backgroundColor:"#dc2626",color:"white",borderRadius:"10px",fontSize:"10px",fontWeight:"700",display:"inline-block"},title:`${T} recorte${1!==T?"s":""}`,children:T})]})]}),
58
- /* @__PURE__ */l(W,{image:n,isOpen:p,onClose:()=>f(!1),onSelect:i,onDelete:r,onCrop:a,onVariantDeleted:A,allowedActions:{select:d.select,download:d.download,copy:d.copy,delete:d.delete,crop:d.crop}}),
54
+ /* @__PURE__ */s("div",{className:`limbo-image-card flex flex-col items-center cursor-pointer relative transition ${u?"opacity-50":""} ${S?"limbo-image-card--mobile":""}`,onClick:R,onKeyDown:e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),R();break;case"d":case"D":d.download&&(e.preventDefault(),A(e));break;case"c":case"C":d.copy&&(e.preventDefault(),T(e));break;case"Delete":case"Backspace":d.delete&&r&&(e.preventDefault(),z(e));break;case"x":case"X":d.crop&&a&&(e.preventDefault(),P(e));break;case"v":case"V":d.variants&&(e.preventDefault(),(e=>{e.stopPropagation(),$?.announce(`Mostrando recortes de ${n.filename}`),f(!0)})(e))}},title:M?`Ver ${I} recorte${1!==I?"s":""} de ${n.filename}`:S?"Toque para ampliar imagen":"Click para ampliar imagen con zoom",role:"button",tabIndex:0,"aria-label":`Imagen ${n.filename}. ${n.width}x${n.height} px`,style:{...E&&{touchAction:"manipulation",WebkitTapHighlightColor:"transparent"}},children:[
55
+ /* @__PURE__ */s("div",{className:"limbo-image-actions "+(S?"limbo-image-actions--mobile":""),children:[!M&&D&&/* @__PURE__ */l("button",{type:"button",title:"Seleccionar imagen",className:"btn btn-success bg-brand-blue-800 hover:bg-brand-blue-1000 border border-brand-blue-1000 "+(S?"btn--touch":""),onClick:e=>{e.stopPropagation(),$?.announce(`Seleccionando ${n.filename} para el portal`),i?.(n)},tabIndex:-1,style:{...S&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:"icon icon-tick-white icon--sm","aria-hidden":"true"})}),O&&/* @__PURE__ */l("button",{type:"button",title:"Editar imagen",className:"btn btn-crop bg-brand-blue-400 hover:bg-brand-blue-800 border border-brand-blue-1000 "+(S?"btn--touch":""),onClick:P,tabIndex:-1,style:{...S&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:"icon icon-scissors-white icon--sm","aria-hidden":"true"})}),d.copy&&/* @__PURE__ */l("button",{type:"button",title:m?"¡Copiado!":"Copiar URL",className:"btn btn-copy bg-brand-blue-400 hover:bg-brand-blue-800 border border-brand-blue-1000 "+(S?"btn--touch":""),onClick:T,tabIndex:-1,style:{...S&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:`icon ${m?"icon-copied-white":"icon-copy-white"} icon--sm`,"aria-hidden":"true"})}),d.download&&/* @__PURE__ */l("button",{type:"button",title:"Descargar",className:"btn btn-download bg-brand-blue-400 hover:bg-brand-blue-800 border border-brand-blue-1000 "+(S?"btn--touch":""),onClick:A,tabIndex:-1,style:{...S&&{width:"40px",height:"40px"}},children:/* @__PURE__ */l("span",{className:"icon icon-download-white icon--sm","aria-hidden":"true"})}),d.delete&&r&&/* @__PURE__ */l("button",{onClick:z,disabled:u,className:"btn btn-delete bg-red-1000 hover:bg-red-800 border border-red-1000/50 "+(S?"btn--touch":""),title:"Eliminar imagen",tabIndex:-1,style:{...S&&{width:"40px",height:"40px"}},children:u?"…":/* @__PURE__ */l("span",{className:"icon icon-close-small-white icon--sm","aria-hidden":"true"})})]}),w&&!k&&/* @__PURE__ */l("div",{className:"w-full aspect-square rounded bg-neutral-200 animate-pulse flex items-center justify-center "+(M?"ring-2 ring-brand-blue-400 ring-offset-2":""),style:{...S&&{minHeight:`${Math.max(3*o,80)}px`}},children:/* @__PURE__ */l("span",{className:"icon icon-spinner w-8 h-8 animate-spin"})}),k&&/* @__PURE__ */s("div",{className:"w-full aspect-square rounded bg-neutral-100 flex flex-col items-center justify-center text-neutral-400",style:{...S&&{minHeight:`${Math.max(3*o,80)}px`}},children:[
56
+ /* @__PURE__ */l("span",{className:"icon icon-close icon--lg mb-1","aria-hidden":"true"}),
57
+ /* @__PURE__ */l("span",{className:"text-xs",children:"Error al cargar"})]}),
58
+ /* @__PURE__ */l("img",{src:n.url||n.path,loading:"eager",alt:n.filename.split(".")[0]??n.filename,className:`w-full object-cover rounded aspect-square ${M?"ring-2 ring-brand-blue-400 ring-offset-2":""} ${w||k?"hidden":""}`,sizes:`height: ${6*o}px,width: ${6*o}px`,draggable:!1,onLoad:()=>x(!1),onError:()=>{x(!1),C(!0)},style:{...S&&{minHeight:`${Math.max(3*o,80)}px`,height:"auto",aspectRatio:"1 / 1",objectFit:"cover"}}}),
59
+ /* @__PURE__ */s("span",{className:"text-xs mt-1 limbo-truncate w-full text-center limbo-image-card-name "+(S?"limbo-image-card-name--mobile":""),style:{...S&&{fontSize:"0.75rem",lineHeight:"1.2",maxWidth:"100%",padding:"2px 4px",backgroundColor:"rgba(255, 255, 255, 0.9)",borderRadius:"4px",color:"#333",fontWeight:"500"}},children:[n.filename.split(".")[0]??n.filename,M&&/* @__PURE__ */l("span",{className:"limbo-variants-indicator",style:{marginLeft:"4px",padding:"1px 6px",backgroundColor:"#dc2626",color:"white",borderRadius:"10px",fontSize:"10px",fontWeight:"700",display:"inline-block"},title:`${I} recorte${1!==I?"s":""}`,children:I})]})]}),
60
+ /* @__PURE__ */l(W,{image:n,isOpen:p,onClose:()=>f(!1),onSelect:i,onDelete:r,onCrop:a,onVariantDeleted:L,allowedActions:{select:d.select,download:d.download,copy:d.copy,delete:d.delete,crop:d.crop}}),
59
61
  /* @__PURE__ */l(B,{isOpen:g,src:n.url||n.path,alt:n.filename,title:n.filename,subtitle:`${n.width}×${n.height} · ${Math.round((n.file_size||0)/1024)}KB`,onClose:()=>b(!1)})]})}function H(){/* @__PURE__ */
60
62
  return s("div",{className:"limbo-image-card animate-pulse",role:"status","aria-label":"Cargando imágen...",children:[
61
63
  /* @__PURE__ */l("div",{className:"w-full aspect-square bg-neutral-gray-200 rounded-md flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-spinner"})}),
62
64
  /* @__PURE__ */l("div",{className:"limbo-image-card-name opacity-100 position-relative bottom-0 p-2",children:/* @__PURE__ */l("div",{className:"h-4 bg-neutral-gray-200 rounded w-3/4"})}),
63
65
  /* @__PURE__ */l("span",{className:"sr-only",children:"Cargando imágen..."})]})}function K({onSelect:e,onCrop:t,onDelete:r,deletingId:i,images:o,loading:u,error:d,filters:m={name:"",dateFrom:"",dateTo:"",uploadedBy:""},onFiltersChange:h,filterConfig:p={showNameFilter:!0,showUploadedByFilter:!1,showDateFilter:!0},loadingConfig:f={showPlaceholders:!0,placeholderCount:10,showSpinner:!0},allowedActions:g={select:!0,download:!0,copy:!0,delete:!0,crop:!0,variants:!0}}){const b=!1!==p.showNameFilter,y=!0===p.showUploadedByFilter,v=!1!==p.showDateFilter,w=a(null),x=window.limboCore?.accessibilityManager;n(()=>{if(w.current&&window.limboCore?.keyboardManager){const e="gallery-grid";w.current.setAttribute("data-grid-id",e),window.limboCore.keyboardManager.setupGridNavigation(w.current,{itemSelector:".limbo-image-card",gridId:e,columns:"auto"})}},[o]),n(()=>{u?x?.announceLoading(!0,"galería"):u||d?d&&x?.announceError(d,"galería"):(x?.announceLoading(!1,"galería"),o.length>0&&x?.announce(`Se encontraron ${o.length} imágenes en la galería`))},[u,d,o.length,x]);const k=e=>{const{name:t,value:n}=e.target;h&&h({...m,[t]:n})};/* @__PURE__ */
64
- return s("div",{className:"w-full px-4 py-4",children:[
65
- /* @__PURE__ */l("div",{className:"p-2 mb-2",children:/* @__PURE__ */s("form",{className:"limbo-form-grid flex flex-col sm:flex-row flex-wrap gap-4 items-start sm:items-end justify-between",onSubmit:e=>e.preventDefault(),"aria-label":"Filtrar imágenes",children:[b&&/* @__PURE__ */s("div",{className:"flex flex-col w-full sm:min-w-45 sm:flex-1",children:[
66
+ return s("div",{className:"w-full py-4",children:[
67
+ /* @__PURE__ */l("div",{className:"p-2 px-4 mb-2",children:/* @__PURE__ */s("form",{className:"limbo-form-grid flex flex-col sm:flex-row flex-wrap gap-4 items-start sm:items-end justify-between",onSubmit:e=>e.preventDefault(),"aria-label":"Filtrar imágenes",children:[b&&/* @__PURE__ */s("div",{className:"flex flex-col w-full sm:min-w-45 sm:flex-1",children:[
66
68
  /* @__PURE__ */l("label",{htmlFor:"name",className:"limbo-form-label mb-1",children:"Nombre"}),
67
69
  /* @__PURE__ */l("input",{type:"text",name:"name",id:"name",placeholder:"Buscar por nombre...",value:m.name,onChange:k,className:"limbo-form-control",autoComplete:"off"})]}),
68
70
  /* @__PURE__ */s("div",{className:"flex flex-col sm:flex-row flex-wrap gap-2 justify-between items-start sm:items-end w-full sm:w-auto",children:[v&&/* @__PURE__ */s(c,{children:[
@@ -76,7 +78,7 @@ return s("div",{className:"w-full px-4 py-4",children:[
76
78
  /* @__PURE__ */l("input",{type:"text",name:"uploadedBy",id:"uploadedBy",placeholder:"Subido por",value:m.uploadedBy,onChange:k,className:"limbo-form-control"})]})]})]})}),u?/* @__PURE__ */s("div",{className:"relative",children:[
77
79
  /* @__PURE__ */l("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80 z-10 min-h-75",children:/* @__PURE__ */s("div",{className:"flex flex-col items-center gap-3",children:[
78
80
  /* @__PURE__ */l("span",{className:"icon icon-spinner p-4 animate-spin"}),
79
- /* @__PURE__ */l("span",{className:"text-sm text-gray-600 font-medium",children:"Cargando imágenes..."})]})}),f.showPlaceholders&&/* @__PURE__ */l("div",{ref:w,className:"limbo-gallery opacity-30","data-limbo-responsive":!0,role:"grid","aria-label":"Cargando imágenes de la galería","aria-busy":"true",children:Array.from({length:f.placeholderCount}).map((e,t)=>/* @__PURE__ */l("div",{role:"gridcell","aria-posinset":t+1,"aria-setsize":f.placeholderCount,children:/* @__PURE__ */l(H,{})},`skeleton-${t}`))})]}):/* @__PURE__ */l("div",d?{className:"alert alert-danger text-center",children:d}:{ref:w,className:"limbo-gallery","data-limbo-responsive":!0,"data-grid-id":"gallery-grid",role:"grid","aria-label":"Galería de imágenes. Use las flechas para navegar entre imágenes",children:o.length>0?o.map((n,a)=>/* @__PURE__ */l("div",{role:"gridcell","aria-posinset":a+1,"aria-setsize":o.length,children:/* @__PURE__ */l(V,{image:n,onSelect:e,onCrop:t,onDelete:g.delete&&r?()=>r(n.id):null,thumbnailSize:32,isDeleting:i===n.id,allowedActions:g})},n.id)):/* @__PURE__ */l("div",{className:"col-span-full text-center text-gray-500 py-8",role:"status","aria-live":"polite",children:/* @__PURE__ */l("p",{children:"No se han encontrado imágenes"})})})]})}function G({image:e,onDiscard:r,onRetry:a,onDownload:i,onSelect:o,showRetry:c=!1,disabled:u=!1}){const[d,m]=t(null),[h,p]=t({name:"",size:"",type:""}),[f,g]=t(!1);n(()=>{if(!e)return void m(null);const t=URL.createObjectURL(e);return m(t),p({name:e.name||"imagen.webp",size:b(e.size||0),type:e.type||"image/webp"}),()=>{URL.revokeObjectURL(t)}},[e]);const b=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["Bytes","KB","MB","GB"][t]};return e&&d?/* @__PURE__ */s("div",{className:"w-fit md:w-full bg-white border border-gray-200 rounded-lg px-1 sm:px-3 py-2 m-0 shadow-sm",children:[
81
+ /* @__PURE__ */l("span",{className:"text-sm text-gray-600 font-medium",children:"Cargando imágenes..."})]})}),f.showPlaceholders&&/* @__PURE__ */l("div",{ref:w,className:"limbo-gallery opacity-30","data-limbo-responsive":!0,role:"grid","aria-label":"Cargando imágenes de la galería","aria-busy":"true",children:Array.from({length:f.placeholderCount}).map((e,t)=>/* @__PURE__ */l("div",{role:"gridcell","aria-posinset":t+1,"aria-setsize":f.placeholderCount,children:/* @__PURE__ */l(H,{})},`skeleton-${t}`))})]}):/* @__PURE__ */l("div",d?{className:"alert alert-danger text-center",children:d}:{ref:w,className:"limbo-gallery px-3","data-limbo-responsive":!0,"data-grid-id":"gallery-grid",role:"grid","aria-label":"Galería de imágenes. Use las flechas para navegar entre imágenes",children:o.length>0?o.map((n,a)=>/* @__PURE__ */l("div",{role:"gridcell","aria-posinset":a+1,"aria-setsize":o.length,children:/* @__PURE__ */l(V,{image:n,onSelect:e,onCrop:t,onDelete:g.delete&&r?()=>r(n.id):null,thumbnailSize:32,isDeleting:i===n.id,allowedActions:g})},n.id)):/* @__PURE__ */l("div",{className:"col-span-full text-center text-gray-500 py-8",role:"status","aria-live":"polite",children:/* @__PURE__ */l("p",{children:"No se han encontrado imágenes"})})})]})}function G({image:e,onDiscard:r,onRetry:a,onDownload:i,onSelect:o,showRetry:c=!1,disabled:u=!1}){const[d,m]=t(null),[h,p]=t({name:"",size:"",type:""}),[f,g]=t(!1);n(()=>{if(!e)return void m(null);const t=URL.createObjectURL(e);return m(t),p({name:e.name||"imagen.webp",size:b(e.size||0),type:e.type||"image/webp"}),()=>{URL.revokeObjectURL(t)}},[e]);const b=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["Bytes","KB","MB","GB"][t]};return e&&d?/* @__PURE__ */s("div",{className:"w-fit md:w-full bg-white border border-gray-200 rounded-lg px-1 sm:px-3 py-2 m-0 shadow-sm",children:[
80
82
  /* @__PURE__ */s("div",{className:"flex items-center justify-between mb-4 px-1",children:[
81
83
  /* @__PURE__ */l("h3",{className:"text-sm font-medium text-gray-700",children:"Vista previa de imagen"}),
82
84
  /* @__PURE__ */l("button",{type:"button",onClick:r,disabled:u,className:"p-1.5 text-gray-400 cursor-pointer hover:text-gray-600 hover:bg-red-300 rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Descartar imagen",title:"Descartar imagen",children:/* @__PURE__ */l("span",{className:"icon icon-close-small icon--md"})})]}),
@@ -105,13 +107,13 @@ return s("div",{className:"w-full px-4 py-4",children:[
105
107
  /* @__PURE__ */s("button",{type:"button",onClick:()=>o&&o(h.name),disabled:u,className:"flex-1 md:flex-none flex items-center justify-center gap-2 px-4 py-2.5 bg-brand-blue-800 border border-brand-blue-800 text-white rounded-lg hover:bg-brand-blue-1000 cursor-pointer hover:border-brand-blue-1000 transition-colors disabled:opacity-50 disabled:cursor-not-allowed text-sm font-medium shadow-sm","aria-label":"Seleccionar imagen para recortar",children:[
106
108
  /* @__PURE__ */l("span",{className:"icon icon-tick-white icon--sm"}),
107
109
  /* @__PURE__ */l("span",{children:"Seleccionar"})]})]})]}),
108
- /* @__PURE__ */l(B,{isOpen:f,src:d,alt:h.name,title:h.name,subtitle:`${h.size} • ${h.type.split("/")[1]?.toUpperCase()||"IMAGE"}`,onClose:()=>g(!1)})]}):null}function Q({file:e,setFile:t,previewUrl:n,setPreviewUrl:r,fileInputRef:a,onSelect:i,disabled:o}){/* @__PURE__ */
110
+ /* @__PURE__ */l(B,{isOpen:f,src:d,alt:h.name,title:h.name,subtitle:`${h.size} • ${h.type.split("/")[1]?.toUpperCase()||"IMAGE"}`,onClose:()=>g(!1)})]}):null}function Q({file:e,setFile:n,previewUrl:r,setPreviewUrl:a,fileInputRef:i,onSelect:o,disabled:c}){const[u,d]=t(!1),m=e=>{if(n(e),e){const t=URL.createObjectURL(e);a(t)}else a(null)};/* @__PURE__ */
109
111
  return s("div",{className:"flex flex-col items-center gap-6","aria-label":"Subir imagen desde dispositivo",children:[
110
- /* @__PURE__ */s("label",{htmlFor:"file-input",className:"w-fit md:w-full flex flex-col items-center justify-center border-2 border-dashed border-brand-blue-200 rounded-xl p-8 cursor-pointer hover:border-brand-blue-1000 hover:to-bright-blue-200 hover:from-brand-blue-50 focus-within:border-brand-blue-800 from-bright-blue-50 to-brand-blue-50 bg-linear-to-br transition",tabIndex:0,style:{outline:"none"},children:[
112
+ /* @__PURE__ */s("label",{htmlFor:"file-input",className:"w-fit md:w-full flex flex-col items-center justify-center border-2 border-dashed rounded-xl p-8 cursor-pointer transition "+(u?"border-brand-blue-1000 bg-brand-blue-100 scale-[1.02]":"border-brand-blue-200 hover:border-brand-blue-1000 hover:to-bright-blue-200 hover:from-brand-blue-50 focus-within:border-brand-blue-800 from-bright-blue-50 to-brand-blue-50 bg-linear-to-br"),tabIndex:0,style:{outline:"none"},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),c||d(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||d(!1)},onDrop:e=>{if(e.preventDefault(),e.stopPropagation(),d(!1),c)return;const t=e.dataTransfer?.files;if(t&&t.length>0){const e=t[0];e.type.startsWith("image/")&&m(e)}},children:[
111
113
  /* @__PURE__ */l("span",{className:"icon icon-upload icon--lg mb-2","aria-hidden":"true"}),
112
114
  /* @__PURE__ */l("span",{className:"font-medium text-brand-blue-1000 mb-1",children:"Haz clic o arrastra una imagen aquí"}),
113
115
  /* @__PURE__ */l("span",{className:"text-sm text-neutral-700",children:"Formatos permitidos: JPG, PNG, GIF, SVG, WebP"}),
114
- /* @__PURE__ */l("input",{id:"file-input",ref:a,type:"file",accept:"image/jpeg,image/png,image/svg,image/webp,image/gif",onChange:e=>{const n=e.target.files[0];if(t(n),n){const e=URL.createObjectURL(n);r(e)}else r(null)},disabled:o,className:"sr-only","aria-label":"Seleccionar imagen"})]}),e&&/* @__PURE__ */l(G,{image:e,onDiscard:()=>{t(null),r(null),a.current&&(a.current.value="")},onDownload:()=>{},onSelect:t=>{if(e&&!o&&i)if(t&&t!==e.name){const n=new File([e],t,{type:e.type});i(n)}else i(e)},showRetry:!1,disabled:o})]})}const Y="/api";const X=/* @__PURE__ */new Map;function J(e=!1){const[r,a]=t([]),[i,o]=t(!0),[l,s]=t(null);n(()=>{const t=`ai-services-${e}`,n=X.get(t),r=Date.now();if(n&&r-n.timestamp<864e5)return a(n.data),void o(!1);let i=!0;return(async()=>{try{const n=await function(e=!1){return A({endpoint:"/ai/services",prod:e,basePath:Y})}(e);if(!i)return;const o=n?.data||n?.result||[],l=Array.isArray(o)?o.map(e=>({label:e.name||e.label,slug:e.slug,type:e.type,description:e.description,image:e.image,costInfo:e.cost_info||null})):Object.entries(o).map(([e,t])=>({label:e,slug:t,type:"image_generation",description:null,image:null,costInfo:null}));a(l),X.set(t,{data:l,timestamp:r})}catch(n){i&&s(n.message)}finally{i&&o(!1)}})(),()=>{i=!1}},[e]);return{services:r,loading:i,error:l,invalidateCache:()=>{X.delete(`ai-services-${e}`)}}}const Z=/* @__PURE__ */new Map;function ee(e=!1){const[n,r]=t(null),[a,i]=t(!1),[o,l]=t(null);return{params:n,loading:a,error:o,fetchParams:async t=>{i(!0),l(null);const n=`${e}-${t}`,a=Date.now(),o=Z.get(n);if(o&&a-o.timestamp<864e5)return r(o.data),i(!1),o.data;try{const i=await function({services:e=null,form:t=!1}={},n=!1){const r={};return e&&(r.services=e),!1!==t&&(r.form=t),A({endpoint:"/ai/params"+(Object.keys(r).length?"?"+new URLSearchParams(r).toString():""),method:"GET",prod:n,basePath:"/api/atenea"})}({services:t,form:!1},e),o=i?.result?.data||i?.data||i?.result||i;return r(o),Z.set(n,{data:o,timestamp:a}),o}catch(s){return l(s.message),r(null),null}finally{i(!1)}},reset:()=>{l(null),r(null)}}}function te({show:e=!1,message:t="Cargando...",className:n=""}){return e?/* @__PURE__ */l("div",{className:`absolute inset-0 bg-white/80 backdrop-blur-sm z-50 flex flex-col items-center justify-center ${n}`,"aria-live":"polite","aria-busy":"true",role:"status",children:/* @__PURE__ */s("div",{className:"flex flex-col items-center gap-4",children:[
116
+ /* @__PURE__ */l("input",{id:"file-input",ref:i,type:"file",accept:"image/jpeg,image/png,image/svg,image/webp,image/gif",onChange:e=>{const t=e.target.files[0];m(t)},disabled:c,className:"sr-only","aria-label":"Seleccionar imagen"})]}),e&&/* @__PURE__ */l(G,{image:e,onDiscard:()=>{n(null),a(null),i.current&&(i.current.value="")},onDownload:()=>{},onSelect:t=>{if(e&&!c&&o)if(t&&t!==e.name){const n=new File([e],t,{type:e.type});o(n)}else o(e)},showRetry:!1,disabled:c})]})}const Y="/api";const X=/* @__PURE__ */new Map;function J(e=!1){const[r,a]=t([]),[i,o]=t(!0),[l,s]=t(null);n(()=>{const t=`ai-services-${e}`,n=X.get(t),r=Date.now();if(n&&r-n.timestamp<864e5)return a(n.data),void o(!1);let i=!0;return(async()=>{try{const n=await function(e=!1){return A({endpoint:"/ai/services",prod:e,basePath:Y})}(e);if(!i)return;const o=n?.data||n?.result||[],l=Array.isArray(o)?o.map(e=>({label:e.name||e.label,slug:e.slug,type:e.type,description:e.description,image:e.image,costInfo:e.cost_info||null})):Object.entries(o).map(([e,t])=>({label:e,slug:t,type:"image_generation",description:null,image:null,costInfo:null}));a(l),X.set(t,{data:l,timestamp:r})}catch(n){i&&s(n.message)}finally{i&&o(!1)}})(),()=>{i=!1}},[e]);return{services:r,loading:i,error:l,invalidateCache:()=>{X.delete(`ai-services-${e}`)}}}const Z=/* @__PURE__ */new Map;function ee(e=!1){const[n,r]=t(null),[a,i]=t(!1),[o,l]=t(null);return{params:n,loading:a,error:o,fetchParams:async t=>{i(!0),l(null);const n=`${e}-${t}`,a=Date.now(),o=Z.get(n);if(o&&a-o.timestamp<864e5)return r(o.data),i(!1),o.data;try{const i=await function({services:e=null,form:t=!1}={},n=!1){const r={};return e&&(r.services=e),!1!==t&&(r.form=t),A({endpoint:"/ai/params"+(Object.keys(r).length?"?"+new URLSearchParams(r).toString():""),method:"GET",prod:n,basePath:"/api/atenea"})}({services:t,form:!1},e),o=i?.result?.data||i?.data||i?.result||i;return r(o),Z.set(n,{data:o,timestamp:a}),o}catch(s){return l(s.message),r(null),null}finally{i(!1)}},reset:()=>{l(null),r(null)}}}function te({show:e=!1,message:t="Cargando...",className:n=""}){return e?/* @__PURE__ */l("div",{className:`absolute inset-0 min-h-50 bg-white/80 backdrop-blur-sm z-50 flex flex-col items-center justify-center ${n}`,"aria-live":"polite","aria-busy":"true",role:"status",children:/* @__PURE__ */s("div",{className:"flex flex-col items-center gap-4",children:[
115
117
  /* @__PURE__ */l("span",{className:"icon icon-spinner p-4 animate-spin"}),
116
118
  /* @__PURE__ */l("p",{className:"text-brand-blue-1000 font-medium text-lg",children:t})]})}):null}function ne({prod:n,disabled:r,onSelect:a}){const i=J(n),o=ee(n),[u,d]=t(""),[m,h]=t(""),[p,f]=t({}),[g,b]=t(!1),[y,v]=t(null),[w,x]=t(null),[k,C]=t(null),[S,N]=t(!0),[E,$]=t(!1);e.useEffect(()=>{if(!i.loading&&1===i.services.length){const e=i.services[0];h(e.slug),N(!1),o.fetchParams(e.slug,!0)}},[i.loading,i.services]),e.useEffect(()=>{if(!m)return;const e=o.params?.[m]?.parameters;if(e){const t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default??""]));t.service=m,f(t)}},[m,o.params]);const _=e=>{const{name:t,value:n}=e.target;f(e=>({...e,[t]:n}))},z=async(e,t=!1)=>{e.preventDefault(),b(!0),v(null),x(null);try{t?p.prompt=u:d(p.prompt||"");const e=await function(e,t=!1){return A({endpoint:"/ai/generate",method:"POST",body:e,prod:t,basePath:Y})}(p,n);let a=null;if(e?.data?.images&&Array.isArray(e.data.images)&&e.data.images.length>0?a=e.data.images[0]:e?.result?.images&&Array.isArray(e.result.images)&&e.result.images.length>0?a=e.result.images[0]:Array.isArray(e)&&e.length>0?a=e[0]:"string"==typeof e&&(a=e),!a)throw new Error("No se pudo extraer la imagen de la respuesta");if(a.startsWith("http"))try{const e=`${window.limboCore?.config?.getGlobal()?.prod?"https://limbo.lefebvre.es":"https://led-dev-limbo-dev.eu.els.local"}/api/atenea/proxy?url=${encodeURIComponent(a)}`,t=await fetch(e,{credentials:"include",headers:{Authorization:`Bearer ${window.limboCore?.apiClient?.token||""}`}});if(!t.ok)throw new Error(`Failed to download image: ${t.status}`);const n=await t.blob(),r=new File([n],"ai-image.webp",{type:n.type||"image/webp"});C(r)}catch(r){throw new Error(`Error downloading image via proxy: ${r.message}`)}else{const e=a.replace(/^data:image\/\w+;base64,/,""),t=atob(e),n=new Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);const r=new Uint8Array(n),i=new File([r],"ai-image.webp",{type:"image/webp"});C(i)}x(e?.data?.images||e?.result?.images||null)}catch(a){v(a.message||"Error al generar la imagen")}finally{b(!1)}};return i.loading?/* @__PURE__ */s("div",{className:"flex items-center justify-center py-8",children:[
117
119
  /* @__PURE__ */l("span",{className:"limbo-loader mr-2"})," Cargando servicios IA..."]}):i.services.length?/* @__PURE__ */l("div",{className:"flex flex-col mx-4 pb-2",children:/* @__PURE__ */s(c,S?{children:[
@@ -134,10 +136,10 @@ return s("div",{className:"h-fit w-full",children:[i.services.length>1&&/* @__PU
134
136
  /* @__PURE__ */s("button",{type:"button",onClick:()=>$(!E),className:"flex items-center gap-2 text-sm font-medium text-brand-blue-800 hover:text-brand-blue-1000 mb-3 transition-colors",children:[
135
137
  /* @__PURE__ */l("svg",{className:"w-4 h-4 transition-transform "+(E?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),"Opciones avanzadas",!E&&/* @__PURE__ */s("span",{className:"text-xs text-gray-500",children:["(",a.length," opciones)"]})]}),E&&/* @__PURE__ */l("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 animate-fadeIn",children:a.map(([e,t])=>c(e,t))})]}),
136
138
  /* @__PURE__ */l("button",{type:"submit",disabled:g||r,title:g?"Generando imagen...":k?"Generar otra imagen":"Generar imagen",className:"limbo-btn w-full mt-2 "+(g?"cursor-not-allowed limbo-btn-disabled":"limbo-btn-primary"),style:{minHeight:44},children:g?"Generando imagen...":k?"Generar otra imagen":"Generar imagen"})]}),
137
- /* @__PURE__ */l(te,{show:g,message:"Generando imagen con IA..."})]})]})})(),y&&/* @__PURE__ */l("div",{className:"alert alert-danger mt-4",children:y}),k&&/* @__PURE__ */l("div",{className:"mt-6 md:w-full mx-auto",children:/* @__PURE__ */l(G,{image:k,onDiscard:()=>{C(null),x(null),v(null)},onRetry:e=>z(e,!0),onDownload:()=>{},onSelect:e=>{if(a){const t=k||w;if(e&&t&&e!==t.name){const n=new File([t],e,{type:t.type});a(n)}else a(t)}},showRetry:!0,disabled:g||r})})]})}):/* @__PURE__ */l("div",{className:"alert alert-warning",children:"No hay servicios IA disponibles."})}const re="/api";const ae=/* @__PURE__ */new Map;function ie(e=!1){const[r,a]=t([]),[i,o]=t(!0),[l,s]=t(null);n(()=>{const t=`stock-services-${e}`,n=ae.get(t),r=Date.now();if(n&&r-n.timestamp<864e5)return a(n.data),void o(!1);let i=!0;return(async()=>{try{const n=await function(e=!1){return A({endpoint:"/stock/services",prod:e,basePath:re})}(e);if(!i)return;if(204===n?.httpCode||null===n?.data)return a([]),s("No hay servicios de stock disponibles en este momento"),void ae.set(t,{data:[],timestamp:r});const o=n?.data||n?.result||[],l=Array.isArray(o)?o.map(e=>({label:e.name||e.label,slug:e.slug,type:e.type,description:e.description,image:e.image})):Object.entries(o).map(([e,t])=>({label:e,slug:t,type:"stock_image",description:null,image:null}));a(l),ae.set(t,{data:l,timestamp:r})}catch(n){i&&s(n.message)}finally{i&&o(!1)}})(),()=>{i=!1}},[e]);return{services:r,loading:i,error:l,invalidateCache:()=>{ae.delete(`stock-services-${e}`)}}}function oe({prod:n,disabled:r,onSelect:a}){const i=e.useRef(null),o=ie(n),u=(e,t)=>{try{const n=sessionStorage.getItem(`limbo_stock_${e}`);return n?JSON.parse(n):t}catch{return t}},[d,m]=t(()=>u("selectedService","")),[h,p]=t(()=>u("dynamicForm",{})),[f,g]=t(()=>u("stockImages",[])),[b,y]=t(()=>u("currentPage",1)),[v,w]=t(()=>u("paginationInfo",null)),[x,k]=t(null),C=ee(n),[S,N]=t(!1),[E,$]=t(null),[_,z]=t(null),[T,M]=t(!0),[P,I]=t(!1),[L,D]=t(null);e.useEffect(()=>{sessionStorage.setItem("limbo_stock_selectedService",JSON.stringify(d))},[d]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_dynamicForm",JSON.stringify(h))},[h]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_stockImages",JSON.stringify(f))},[f]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_currentPage",JSON.stringify(b))},[b]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_paginationInfo",JSON.stringify(v))},[v]),e.useEffect(()=>{if(!o.loading&&1===o.services.length){const e=o.services[0];m(e.slug),M(!1),C.fetchParams(e.slug,!0)}},[o.loading,o.services]),e.useEffect(()=>{if(!d)return;const e=C.params?.[d]?.parameters;if(e){const t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default??""]));t.service=d,p(t)}},[d,C.params]);const O=e=>{const{name:t,value:n}=e.target;p(e=>({...e,[t]:n}))},R=async(e=1)=>{N(!0),$(null),1===e&&g([]);try{let t;if(1===e){const n=C.params?.[d]?.parameters,r={...h};Object.entries(n||{}).forEach(([e,t])=>{e in r||(r[e]=t.default??"")}),r.per_page=parseInt(r.per_page),r.service=d,r.page=e,t=r,i.current={...r}}else t={...i.current,page:e};const r=await function(e,t=!1){return A({endpoint:"/stock/search",method:"POST",body:e,prod:t,basePath:re})}(t,n),a=r?.data?.images||[];let o=r?.data?.pagination||null,l=null;o&&(l={total:o.total_count??o.total??a.length,per_page:o.per_page??(Array.isArray(a)?a.length:0),current_page:o.page??o.current_page??e}),g(j(Array.isArray(a)?a:[])),w(l),y(l?.current_page||e)}catch(t){$(t.message||"Error al buscar imágenes")}finally{N(!1)}},j=e=>{const t=/* @__PURE__ */new Set,n=[];return(e||[]).forEach((e,r)=>{const a=e.url||e.preview_url||e.full||e.preview;a&&!t.has(a)&&(t.add(a),n.push({...e,preview:e.preview_url||e.preview||e.url||e.full,full:e.url||e.full||e.preview_url,id:e.id||r,title:e.title||e.filename||`Imagen ${r+1}`,source:e.service||d,sourceTitle:o.services.find(e=>e.slug===d)?.label||d}))}),n},F=async e=>{e.preventDefault();const t=h.query||h.search||h.term||"";t.trim().length<5?$("La búsqueda debe tener al menos 5 caracteres"):(k(t),await R(1))},U=e=>{e<1||R(e)},q=async e=>{z(e.id),$(null);try{const t={service:d,image_id:e.id},r=await function(e,t=!1){return A({endpoint:"/stock/download",method:"POST",body:e,prod:t,basePath:re})}(t,n),a=r?.result?.url||r?.result?.download_url||r?.data?.images?.url||r?.data?.url||r?.images?.url||r?.url;if(!a)throw console.error("Download response structure:",r),new Error("No se pudo obtener la URL de descarga");{const t=await fetch(a),n=await t.blob(),i=r?.result?.filename||r?.data?.images?.filename||r?.data?.filename||`stock-${e.id}.jpg`,o=new File([n],i,{type:n.type||"image/jpeg"});D(o)}}catch(t){$(t.message||"No se pudo recuperar la imagen seleccionada")}finally{z(null)}};return o.loading?/* @__PURE__ */s("div",{className:"flex items-center justify-center py-8",children:[
139
+ /* @__PURE__ */l(te,{show:g,message:"Generando imagen con IA..."})]})]})})(),y&&/* @__PURE__ */l("div",{className:"alert alert-danger mt-4",children:y}),k&&/* @__PURE__ */l("div",{className:"mt-6 md:w-full mx-auto",children:/* @__PURE__ */l(G,{image:k,onDiscard:()=>{C(null),x(null),v(null)},onRetry:e=>z(e,!0),onDownload:()=>{},onSelect:e=>{if(a){const t=k||w;if(e&&t&&e!==t.name){const n=new File([t],e,{type:t.type});a(n)}else a(t)}},showRetry:!0,disabled:g||r})})]})}):/* @__PURE__ */l("div",{className:"alert alert-warning",children:"No hay servicios IA disponibles."})}const re="/api";const ae=/* @__PURE__ */new Map;function ie(e=!1){const[r,a]=t([]),[i,o]=t(!0),[l,s]=t(null);n(()=>{const t=`stock-services-${e}`,n=ae.get(t),r=Date.now();if(n&&r-n.timestamp<864e5)return a(n.data),void o(!1);let i=!0;return(async()=>{try{const n=await function(e=!1){return A({endpoint:"/stock/services",prod:e,basePath:re})}(e);if(!i)return;if(204===n?.httpCode||null===n?.data)return a([]),s("No hay servicios de stock disponibles en este momento"),void ae.set(t,{data:[],timestamp:r});const o=n?.data||n?.result||[],l=Array.isArray(o)?o.map(e=>({label:e.name||e.label,slug:e.slug,type:e.type,description:e.description,image:e.image})):Object.entries(o).map(([e,t])=>({label:e,slug:t,type:"stock_image",description:null,image:null}));a(l),ae.set(t,{data:l,timestamp:r})}catch(n){i&&s(n.message)}finally{i&&o(!1)}})(),()=>{i=!1}},[e]);return{services:r,loading:i,error:l,invalidateCache:()=>{ae.delete(`stock-services-${e}`)}}}function oe({prod:n,disabled:r,onSelect:a}){const i=e.useRef(null),o=ie(n),u=(e,t)=>{try{const n=sessionStorage.getItem(`limbo_stock_${e}`);return n?JSON.parse(n):t}catch{return t}},[d,m]=t(()=>u("selectedService","")),[h,p]=t(()=>u("dynamicForm",{})),[f,g]=t(()=>u("stockImages",[])),[b,y]=t(()=>u("currentPage",1)),[v,w]=t(()=>u("paginationInfo",null)),[x,k]=t(null),C=ee(n),[S,N]=t(!1),[E,$]=t(null),[_,z]=t(null),[T,P]=t(!0),[M,I]=t(!1),[L,D]=t(null);e.useEffect(()=>{sessionStorage.setItem("limbo_stock_selectedService",JSON.stringify(d))},[d]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_dynamicForm",JSON.stringify(h))},[h]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_stockImages",JSON.stringify(f))},[f]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_currentPage",JSON.stringify(b))},[b]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_paginationInfo",JSON.stringify(v))},[v]),e.useEffect(()=>{if(!o.loading&&1===o.services.length){const e=o.services[0];m(e.slug),P(!1),C.fetchParams(e.slug,!0)}},[o.loading,o.services]),e.useEffect(()=>{if(!d)return;const e=C.params?.[d]?.parameters;if(e){const t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default??""]));t.service=d,p(t)}},[d,C.params]);const O=e=>{const{name:t,value:n}=e.target;p(e=>({...e,[t]:n}))},R=async(e=1)=>{N(!0),$(null),1===e&&g([]);try{let t;if(1===e){const n=C.params?.[d]?.parameters,r={...h};Object.entries(n||{}).forEach(([e,t])=>{e in r||(r[e]=t.default??"")}),r.per_page=parseInt(r.per_page),r.service=d,r.page=e,t=r,i.current={...r}}else t={...i.current,page:e};const r=await function(e,t=!1){return A({endpoint:"/stock/search",method:"POST",body:e,prod:t,basePath:re})}(t,n),a=r?.data?.images||[];let o=r?.data?.pagination||null,l=null;o&&(l={total:o.total_count??o.total??a.length,per_page:o.per_page??(Array.isArray(a)?a.length:0),current_page:o.page??o.current_page??e}),g(j(Array.isArray(a)?a:[])),w(l),y(l?.current_page||e)}catch(t){$(t.message||"Error al buscar imágenes")}finally{N(!1)}},j=e=>{const t=/* @__PURE__ */new Set,n=[];return(e||[]).forEach((e,r)=>{const a=e.url||e.preview_url||e.full||e.preview;a&&!t.has(a)&&(t.add(a),n.push({...e,preview:e.preview_url||e.preview||e.url||e.full,full:e.url||e.full||e.preview_url,id:e.id||r,title:e.title||e.filename||`Imagen ${r+1}`,source:e.service||d,sourceTitle:o.services.find(e=>e.slug===d)?.label||d}))}),n},F=async e=>{e.preventDefault();const t=h.query||h.search||h.term||"";t.trim().length<5?$("La búsqueda debe tener al menos 5 caracteres"):(k(t),await R(1))},U=e=>{e<1||R(e)},q=async e=>{z(e.id),$(null);try{const t={service:d,image_id:e.id},r=await function(e,t=!1){return A({endpoint:"/stock/download",method:"POST",body:e,prod:t,basePath:re})}(t,n),a=r?.result?.url||r?.result?.download_url||r?.data?.images?.url||r?.data?.url||r?.images?.url||r?.url;if(!a)throw console.error("Download response structure:",r),new Error("No se pudo obtener la URL de descarga");{const t=await fetch(a),n=await t.blob(),i=r?.result?.filename||r?.data?.images?.filename||r?.data?.filename||`stock-${e.id}.jpg`,o=new File([n],i,{type:n.type||"image/jpeg"});D(o)}}catch(t){$(t.message||"No se pudo recuperar la imagen seleccionada")}finally{z(null)}};return o.loading?/* @__PURE__ */s("div",{className:"flex items-center justify-center py-8",children:[
138
140
  /* @__PURE__ */l("span",{className:"limbo-loader mr-2"})," Cargando servicios de Stock..."]}):o.services.length?/* @__PURE__ */l("div",{className:"flex flex-col mx-4 pb-2",children:/* @__PURE__ */s(c,T?{children:[
139
141
  /* @__PURE__ */l("h3",{className:"text-2xl font-semibold text-brand-blue-1000 mb-3",children:"Selecciona el servicio de Stock"}),o.error&&/* @__PURE__ */l("div",{className:"alert alert-danger",children:o.error}),
140
- /* @__PURE__ */l("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:o.services.map(e=>/* @__PURE__ */s("button",{type:"button",onClick:()=>{m(e.slug),M(!1),p({}),g([]),y(1),w(null),$(null),C.fetchParams(e.slug,!0)},disabled:o.loading||r,className:`group relative p-4 rounded-lg border-2 transition-all duration-200 overflow-hidden flex flex-col items-center justify-center min-h-30 border-gray-200 hover:border-brand-blue-300 hover:shadow-md ${o.loading||r?"opacity-50 cursor-not-allowed":"cursor-pointer"} `,style:{position:"relative"},children:[e.image&&/* @__PURE__ */l("div",{className:"absolute inset-0 bg-cover bg-center transition-opacity duration-200 group-hover:opacity-40",style:{backgroundImage:`url(${e.image})`,opacity:.2}}),
142
+ /* @__PURE__ */l("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:o.services.map(e=>/* @__PURE__ */s("button",{type:"button",onClick:()=>{m(e.slug),P(!1),p({}),g([]),y(1),w(null),$(null),C.fetchParams(e.slug,!0)},disabled:o.loading||r,className:`group relative p-4 rounded-lg border-2 transition-all duration-200 overflow-hidden flex flex-col items-center justify-center min-h-30 border-gray-200 hover:border-brand-blue-300 hover:shadow-md ${o.loading||r?"opacity-50 cursor-not-allowed":"cursor-pointer"} `,style:{position:"relative"},children:[e.image&&/* @__PURE__ */l("div",{className:"absolute inset-0 bg-cover bg-center transition-opacity duration-200 group-hover:opacity-40",style:{backgroundImage:`url(${e.image})`,opacity:.2}}),
141
143
  /* @__PURE__ */s("div",{className:"relative z-10 flex flex-col items-center justify-center gap-2 text-center",children:[
142
144
  /* @__PURE__ */l("span",{className:"text-base font-semibold text-gray-800",children:e.label}),e.description&&/* @__PURE__ */l("span",{className:"text-xs text-gray-600 limbo-line-clamp-2",children:e.description})]})]},e.slug))})]}:{children:[
143
145
  /* @__PURE__ */l("h3",{className:"text-2xl font-semibold text-brand-blue-1000",children:o.services.find(e=>e.slug===d)?.label||"Búsqueda Stock"}),C.loading&&/* @__PURE__ */l("div",{children:"Cargando parámetros..."}),C.error&&/* @__PURE__ */l("div",{className:"alert alert-danger",children:C.error}),d&&(()=>{const e=C.params?.[d]?.parameters;if(!e)return null;const t=Object.entries(e).filter(([,e])=>!e.hidden),n=t.filter(([e])=>e.toLowerCase().includes("query")||e.toLowerCase().includes("search")||e.toLowerCase().includes("term")),a=t.filter(([e])=>!e.toLowerCase().includes("query")&&!e.toLowerCase().includes("search")&&!e.toLowerCase().includes("term")),i=(e,t)=>{let n=t.placeholder||"";n||(n="integer"===t.type?t.minValue&&t.maxValue?`Entre ${t.minValue} y ${t.maxValue}`:t.minValue?`Mínimo ${t.minValue}`:t.maxValue?`Máximo ${t.maxValue}`:"Introduce un número":e.toLowerCase().includes("query")||e.toLowerCase().includes("search")||e.toLowerCase().includes("term")?"Buscar imágenes...":`Introduce ${(t.label||e).toLowerCase()}`);const a=e.toLowerCase().includes("query")||e.toLowerCase().includes("search")||e.toLowerCase().includes("term");/* @__PURE__ */
@@ -145,13 +147,13 @@ return s("div",{className:"flex flex-col gap-1",children:[
145
147
  /* @__PURE__ */s("label",{htmlFor:`stock-${e}`,className:"text-xs font-medium text-brand-blue-1000",children:[t.label||e,t.required&&/* @__PURE__ */l("span",{className:"text-red-1000 ml-1",children:"*"})]}),t.options&&t.multiple?/* @__PURE__ */l("div",{className:"flex flex-wrap gap-2 min-h-[50px] px-2 justify-between border-2 border-gray-transparent-500 rounded-lg",children:t.options.map(t=>/* @__PURE__ */s("label",{className:"flex items-center gap-1",children:[
146
148
  /* @__PURE__ */l("input",{type:"checkbox",name:`stock-${e}`,value:t,checked:Array.isArray(h[e])&&h[e].includes(t),onChange:()=>((e,t)=>{p(n=>{const r=Array.isArray(n[e])?n[e]:[];return r.includes(t)?{...n,[e]:r.filter(e=>e!==t)}:{...n,[e]:[...r,t]}})})(e,t),disabled:r}),
147
149
  /* @__PURE__ */l("span",{className:"text-xs",children:t})]},t))}):t.options?/* @__PURE__ */l("select",{id:`stock-${e}`,name:e,value:h[e]??"",onChange:O,className:"limbo-input",disabled:r,title:t.label||e,children:t.options.map(e=>/* @__PURE__ */l("option",{value:e,children:e},e))}):a?/* @__PURE__ */l("textarea",{id:`stock-${e}`,name:e,value:h[e]??"",onChange:O,className:"limbo-input resize-none overflow-y-auto",disabled:r,required:t.required,placeholder:n,title:t.label||e,rows:3,style:{maxHeight:"9rem",minHeight:"3rem"},onInput:e=>{e.target.style.height="auto";const t=Math.min(e.target.scrollHeight,144);e.target.style.height=`${t}px`}}):/* @__PURE__ */l("input",{id:`stock-${e}`,type:"integer"===t.type?"number":"text",name:e,value:h[e]??"",onChange:O,className:"limbo-input",disabled:r,required:t.required,min:t.minValue,max:t.maxValue,placeholder:n,title:t.label||e})]},e)};/* @__PURE__ */
148
- return s("div",{children:[o.services.length>1&&/* @__PURE__ */s("button",{type:"button",onClick:()=>{M(!0),m(""),p({}),g([]),y(1),w(null),$(null)},className:"flex cursor-pointer items-center gap-2 text-brand-blue-800 hover:text-brand-blue-1000 mb-4 font-medium",children:[
150
+ return s("div",{children:[o.services.length>1&&/* @__PURE__ */s("button",{type:"button",onClick:()=>{P(!0),m(""),p({}),g([]),y(1),w(null),$(null)},className:"flex cursor-pointer items-center gap-2 text-brand-blue-800 hover:text-brand-blue-1000 mb-4 font-medium",children:[
149
151
  /* @__PURE__ */l("span",{className:"icon icon-arrow-left"}),"Volver al menú de servicios"]}),
150
152
  /* @__PURE__ */s("div",{className:"relative",children:[
151
153
  /* @__PURE__ */s("form",{onSubmit:F,"data-type":"stock",className:"flex flex-col gap-3 mt-4 border-t-1 pt-4 border-brand-blue-200","aria-label":"Formulario búsqueda de imágenes de Stock",children:[
152
154
  /* @__PURE__ */l("div",{className:"flex flex-col gap-3",children:n.map(([e,t])=>i(e,t))}),a.length>0&&/* @__PURE__ */s("div",{className:"border-t border-gray-200 pt-3",children:[
153
- /* @__PURE__ */s("button",{type:"button",onClick:()=>I(!P),className:"flex items-center gap-2 text-sm font-medium text-brand-blue-800 hover:text-brand-blue-1000 mb-3 transition-colors",children:[
154
- /* @__PURE__ */l("svg",{className:"w-4 h-4 transition-transform "+(P?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),"Opciones avanzadas",!P&&/* @__PURE__ */s("span",{className:"text-xs text-gray-500",children:["(",a.length," opciones)"]})]}),P&&/* @__PURE__ */l("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 animate-fadeIn",children:a.map(([e,t])=>i(e,t))})]}),
155
+ /* @__PURE__ */s("button",{type:"button",onClick:()=>I(!M),className:"flex items-center gap-2 text-sm font-medium text-brand-blue-800 hover:text-brand-blue-1000 mb-3 transition-colors",children:[
156
+ /* @__PURE__ */l("svg",{className:"w-4 h-4 transition-transform "+(M?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),"Opciones avanzadas",!M&&/* @__PURE__ */s("span",{className:"text-xs text-gray-500",children:["(",a.length," opciones)"]})]}),M&&/* @__PURE__ */l("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 animate-fadeIn",children:a.map(([e,t])=>i(e,t))})]}),
155
157
  /* @__PURE__ */l("button",{type:"submit",disabled:S||r,className:"limbo-btn w-full mt-2 "+(S?"cursor-not-allowed limbo-btn-disabled":"limbo-btn-primary"),style:{minHeight:44},children:S?"Buscando...":"Buscar imágenes"})]}),
156
158
  /* @__PURE__ */l(te,{show:S&&!f.length,message:"Buscando imágenes..."})]})]})})(),E&&/* @__PURE__ */l("div",{className:"alert alert-danger mt-4",children:E}),L&&/* @__PURE__ */l("div",{className:"mt-6 md:w-full mx-auto",children:/* @__PURE__ */l(G,{image:L,onDiscard:()=>{D(null),$(null)},onDownload:()=>{},onSelect:e=>{if(a)if(e&&L&&e!==L.name){const t=new File([L],e,{type:L.type});a(t)}else a(L)},showRetry:!1,disabled:r})}),!L&&f.length>0&&/* @__PURE__ */s(c,{children:[
157
159
  /* @__PURE__ */s("div",{className:"mt-6 grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-1 relative","aria-live":"polite",children:[
@@ -172,7 +174,7 @@ return s("div",{children:[o.services.length>1&&/* @__PURE__ */s("button",{type:"
172
174
  /* @__PURE__ */l("span",{className:"icon icon-search icon--lg mb-2"}),
173
175
  /* @__PURE__ */s("p",{children:['No se encontraron imágenes para "',h.query,'"']}),
174
176
  /* @__PURE__ */l("p",{className:"text-sm mt-1",children:"Intenta con otros términos de búsqueda"})]})]})}):/* @__PURE__ */l("div",{className:"alert alert-warning",children:"No hay servicios de Stock disponibles."})}const le="/api";const se=/* @__PURE__ */new Map;function ce(e=!1){const[r,a]=t([]),[i,o]=t(!0),[l,s]=t(null);n(()=>{const t=`portal-sources-${e}`,n=se.get(t),r=Date.now();if(n&&r-n.timestamp<864e5)return a(n.data),void o(!1);let i=!0;return(async()=>{try{const n=await function(e=!1,t=!0){const n=new URLSearchParams;return n.set("active",t?"true":"false"),A({endpoint:`/external/portals?${n.toString()}`,method:"GET",prod:e,basePath:le})}(e,!0);if(!i)return;let o=n?.data?.sources?.portals||n?.data?.portals||n?.data||[];Array.isArray(o)||(o=[]);const l=o.map(e=>({id:e.slug||e.id,numericId:e.id,name:e.name,title:e.name,slug:e.slug,url:e.website_url,image:e.logo_url,isActive:e.is_active}));a(l),se.set(t,{data:l,timestamp:r})}catch(n){i&&s(n.message)}finally{i&&o(!1)}})(),()=>{i=!1}},[e]);return{sources:r,loading:i,error:l,invalidateCache:()=>{se.delete(`portal-sources-${e}`)}}}const ue=({src:t,fallbackSrc:n,alt:r,className:a,onError:i})=>{const[o,c]=e.useState("loading"),[u,d]=e.useState(t),[m,h]=e.useState(!1);return"error"===o?null:/* @__PURE__ */s("div",{className:"relative w-full h-full",children:["loading"===o&&/* @__PURE__ */l("div",{className:"absolute inset-0 bg-linear-to-r from-gray-200 via-gray-100 to-gray-200 animate-pulse flex items-center justify-center",children:/* @__PURE__ */l("div",{className:"flex flex-col items-center gap-2",children:/* @__PURE__ */l("span",{className:"icon icon-spinner w-8 h-8 text-gray-400 animate-spin"})})}),
175
- /* @__PURE__ */l("img",{src:u,alt:r,className:`${a} ${"loading"===o?"opacity-0":"opacity-100"} transition-opacity duration-300`,loading:"lazy",onLoad:()=>{c("loaded")},onError:()=>{n&&!m?(h(!0),d(n),c("loading")):(c("error"),i&&i())}})]})};function de({prod:n,disabled:r,onSelect:i}){const o=e.useRef(null),u=ce(n),d=(e,t)=>{try{const n=sessionStorage.getItem(`limbo_portals_${e}`);return n?JSON.parse(n):t}catch{return t}},[m,h]=t(()=>d("selectedPortals",[])),[p,f]=t(()=>d("searchName","")),[g,b]=t(()=>d("limit",20)),[y,v]=t(()=>d("currentPage",1)),[w,x]=t(!1),[k,C]=t(null),[S,N]=t(()=>d("images",[])),[E,$]=t(()=>d("portalResults",{})),[_,z]=t(()=>d("paginationInfo",null)),[M,P]=t(null),[I,L]=t(null),D=a({}),[O,R]=t(/* @__PURE__ */new Set);e.useEffect(()=>{sessionStorage.setItem("limbo_portals_selectedPortals",JSON.stringify(m))},[m]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_searchName",JSON.stringify(p))},[p]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_limit",JSON.stringify(g))},[g]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_currentPage",JSON.stringify(y))},[y]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_images",JSON.stringify(S))},[S]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_portalResults",JSON.stringify(E))},[E]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_paginationInfo",JSON.stringify(_))},[_]);const j=async(e=1)=>{if(0===m.length)return void C("Selecciona al menos un portal");const t=((e,t,n,r)=>`${e.sort().join(",")}_${t}_${n}_${r}`)(m,p.trim(),g,e),r=D.current[t];if(r)return N(r.images),$(r.portalResults),z(r.paginationInfo),v(e),void C(null);x(!0),C(null),1===e&&(N([]),$({}),z(null));try{let r;if(1===e){r={sources:m,totalPortals:u.sources.length,page:e,withImage:!0};const t=p.trim();t&&(r.name=t),g&&50!==g&&(r.limit=g),o.current={...r}}else r={...o.current,page:e};const a=await function(e,t=!1){const n=new URLSearchParams,r=e.sources||[];e.portal?n.set("portal",e.portal):r.length>0&&n.set("portals",r.join(","));const a=e.q||e.name||e.search;if(a&&n.set("q",a),!0===e.withImage&&n.set("withImage","1"),e.limit&&n.set("limit",String(e.limit)),void 0!==e.offset)n.set("offset",String(e.offset));else if(e.page&&e.limit){const t=(e.page-1)*e.limit;n.set("offset",String(t))}return A({endpoint:`/external/articles?${n.toString()}`,method:"GET",prod:t,basePath:le})}(r,n),i=a?.data||{},l=i?.articles||i||[],s=i?.total||l.length,c=i?.limit||g,d=i?.offset||0,h={total:s,pages:Math.ceil(s/c),current_page:Math.floor(d/c)+1,per_page:c},f=[],b={};l.forEach(e=>{const t=e.portal?.id||"unknown",r=u.sources.find(e=>e.id===t||e.slug===t),a=r?.title||r?.name||e.portal?.name||t;if(b[t]||(b[t]={title:a,status:200,response:"OK",count:0}),e.image_url){const r=e.image_url;b[t].count++;const i=`${T({prod:n})}/api/atenea/proxy?url=${encodeURIComponent(r)}`;f.push({id:e.id,title:e.title,excerpt:e.excerpt,url:r,full:r,preview:r,thumbnail:r,proxiedUrl:i,filename:`${e.title}.jpg`,source:t,sourceTitle:a,author:e.author,categories:e.categories,published_at:e.published_at,article_url:e.url})}}),D.current[t]={images:f,portalResults:b,paginationInfo:h},N(f),$(b),z(h),v(e),R(/* @__PURE__ */new Set),0!==f.length||a?.result?.success||C(a?.result?.message||"No se encontraron imágenes")}catch(a){C(a.message||"Error al buscar imágenes en portales")}finally{x(!1)}},F=e=>{e<1||j(e)};return u.loading?/* @__PURE__ */s("div",{className:"flex items-center justify-center py-8",children:[
177
+ /* @__PURE__ */l("img",{src:u,alt:r,className:`${a} ${"loading"===o?"opacity-0":"opacity-100"} transition-opacity duration-300`,loading:"lazy",onLoad:()=>{c("loaded")},onError:()=>{n&&!m?(h(!0),d(n),c("loading")):(c("error"),i&&i())}})]})};function de({prod:n,disabled:r,onSelect:i}){const o=e.useRef(null),u=ce(n),d=(e,t)=>{try{const n=sessionStorage.getItem(`limbo_portals_${e}`);return n?JSON.parse(n):t}catch{return t}},[m,h]=t(()=>d("selectedPortals",[])),[p,f]=t(()=>d("searchName","")),[g,b]=t(()=>d("limit",20)),[y,v]=t(()=>d("currentPage",1)),[w,x]=t(!1),[k,C]=t(null),[S,N]=t(()=>d("images",[])),[E,$]=t(()=>d("portalResults",{})),[_,z]=t(()=>d("paginationInfo",null)),[P,M]=t(null),[I,L]=t(null),D=a({}),[O,R]=t(/* @__PURE__ */new Set);e.useEffect(()=>{sessionStorage.setItem("limbo_portals_selectedPortals",JSON.stringify(m))},[m]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_searchName",JSON.stringify(p))},[p]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_limit",JSON.stringify(g))},[g]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_currentPage",JSON.stringify(y))},[y]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_images",JSON.stringify(S))},[S]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_portalResults",JSON.stringify(E))},[E]),e.useEffect(()=>{sessionStorage.setItem("limbo_portals_paginationInfo",JSON.stringify(_))},[_]);const j=async(e=1)=>{if(0===m.length)return void C("Selecciona al menos un portal");const t=((e,t,n,r)=>`${e.sort().join(",")}_${t}_${n}_${r}`)(m,p.trim(),g,e),r=D.current[t];if(r)return N(r.images),$(r.portalResults),z(r.paginationInfo),v(e),void C(null);x(!0),C(null),1===e&&(N([]),$({}),z(null));try{let r;if(1===e){r={sources:m,totalPortals:u.sources.length,page:e,withImage:!0};const t=p.trim();t&&(r.name=t),g&&50!==g&&(r.limit=g),o.current={...r}}else r={...o.current,page:e};const a=await function(e,t=!1){const n=new URLSearchParams,r=e.sources||[];e.portal?n.set("portal",e.portal):r.length>0&&n.set("portals",r.join(","));const a=e.q||e.name||e.search;if(a&&n.set("q",a),!0===e.withImage&&n.set("withImage","1"),e.limit&&n.set("limit",String(e.limit)),void 0!==e.offset)n.set("offset",String(e.offset));else if(e.page&&e.limit){const t=(e.page-1)*e.limit;n.set("offset",String(t))}return A({endpoint:`/external/articles?${n.toString()}`,method:"GET",prod:t,basePath:le})}(r,n),i=a?.data||{},l=i?.articles||i||[],s=i?.total||l.length,c=i?.limit||g,d=i?.offset||0,h={total:s,pages:Math.ceil(s/c),current_page:Math.floor(d/c)+1,per_page:c},f=[],b={};l.forEach(e=>{const t=e.portal?.id||"unknown",r=u.sources.find(e=>e.id===t||e.slug===t),a=r?.title||r?.name||e.portal?.name||t;if(b[t]||(b[t]={title:a,status:200,response:"OK",count:0}),e.image_url){const r=e.image_url;b[t].count++;const i=`${T({prod:n})}/api/atenea/proxy?url=${encodeURIComponent(r)}`;f.push({id:e.id,title:e.title,excerpt:e.excerpt,url:r,full:r,preview:r,thumbnail:r,proxiedUrl:i,filename:`${e.title}.jpg`,source:t,sourceTitle:a,author:e.author,categories:e.categories,published_at:e.published_at,article_url:e.url})}}),D.current[t]={images:f,portalResults:b,paginationInfo:h},N(f),$(b),z(h),v(e),R(/* @__PURE__ */new Set),0!==f.length||a?.result?.success||C(a?.result?.message||"No se encontraron imágenes")}catch(a){C(a.message||"Error al buscar imágenes en portales")}finally{x(!1)}},F=e=>{e<1||j(e)};return u.loading?/* @__PURE__ */s("div",{className:"flex items-center justify-center py-8",children:[
176
178
  /* @__PURE__ */l("span",{className:"limbo-loader mr-2"})," Cargando portales disponibles..."]}):u.sources.length?/* @__PURE__ */s("div",{className:"flex flex-col gap-2",children:[
177
179
  /* @__PURE__ */l("h3",{className:"text-lg font-semibold text-brand-blue-1000",children:"Buscar en Portales Externos"}),
178
180
  /* @__PURE__ */s("form",{onSubmit:e=>{e.preventDefault(),j(1)},className:"flex flex-col gap-4 border-t pt-4 border-brand-blue-200",children:[
@@ -197,14 +199,14 @@ return s("button",{type:"button",onClick:()=>{return t=e.id,void h(e=>e.includes
197
199
  /* @__PURE__ */l("h4",{className:"text-sm font-semibold mb-2",children:"Resultados por portal:"}),
198
200
  /* @__PURE__ */l("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 text-sm",children:Object.entries(E).map(([e,t])=>/* @__PURE__ */s("div",{className:"flex items-center justify-between p-2 rounded "+(200===t.status?"bg-green-50":"bg-red-50"),children:[t.image?/* @__PURE__ */l("img",{src:t.image,alt:t.title,className:"w-10 h-10 object-cover rounded"}):/* @__PURE__ */l("span",{className:"font-medium",children:t.title}),
199
201
  /* @__PURE__ */l("span",{className:200===t.status?"text-green-1000":"text-red-1000",children:200===t.status?`${t.count} imágenes`:t.response})]},e))})]}),I&&/* @__PURE__ */l("div",{className:"mt-6 md:w-full mx-auto",children:/* @__PURE__ */l(G,{image:I,onDiscard:()=>{L(null),C(null)},onDownload:()=>{},onSelect:e=>{if(i)if(e&&I&&e!==I.name){const t=new File([I],e,{type:I.type});i(t)}else i(I)},showRetry:!1,disabled:r})}),!I&&(S.length>0||w)&&/* @__PURE__ */s(c,{children:[
200
- /* @__PURE__ */s("div",{className:"mt-6 relative","aria-live":"polite",children:[w&&/* @__PURE__ */l("div",{className:"absolute inset-0 bg-white/80 z-10 flex items-center justify-center rounded-lg",children:/* @__PURE__ */s("div",{className:"flex flex-col items-center gap-2",children:[
202
+ /* @__PURE__ */s("div",{className:"mt-6 relative min-h-50","aria-live":"polite",children:[w&&/* @__PURE__ */l("div",{className:"absolute inset-0 bg-white/80 z-10 flex items-center justify-center rounded-lg",children:/* @__PURE__ */s("div",{className:"flex flex-col items-center gap-2",children:[
201
203
  /* @__PURE__ */l("span",{className:"limbo-loader"}),
202
204
  /* @__PURE__ */l("span",{className:"text-sm text-brand-blue-800",children:"Buscando imágenes..."})]})}),
203
205
  /* @__PURE__ */s("div",{className:"relative grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2",children:[
204
- /* @__PURE__ */l(te,{show:w,message:"Cargando imágenes..."}),S.map((e,t)=>{const a=`${e.source}-${e.id||t}`,i=e.preview||e.thumbnail||e.url||e.full;return O.has(a)?null:/* @__PURE__ */s("div",{className:"group border border-brand-blue-200 rounded-lg overflow-hidden bg-white shadow-sm hover:shadow-md transition-all duration-200 cursor-pointer",onClick:()=>!M&&!w&&!r&&(async e=>{P(e.url||e.full),C(null);try{const t=e.full||e.url||e.preview;if(!t)throw new Error("No se encontró URL de la imagen");const r=`${T({prod:n})}/api/atenea/proxy?url=${encodeURIComponent(t)}`,a=await fetch(r);if(!a.ok)throw new Error(`Error al descargar: ${a.status}`);const i=await a.blob(),o=e.filename||e.title||`portal-${e.id||Date.now()}.jpg`,l=new File([i],o,{type:i.type||"image/jpeg"});L(l)}catch(t){C(t.message||"No se pudo recuperar la imagen del portal")}finally{P(null)}})(e),children:[
206
+ /* @__PURE__ */l(te,{show:w,message:"Cargando imágenes..."}),S.map((e,t)=>{const a=`${e.source}-${e.id||t}`,i=e.preview||e.thumbnail||e.url||e.full;return O.has(a)?null:/* @__PURE__ */s("div",{className:"group border border-brand-blue-200 rounded-lg overflow-hidden bg-white shadow-sm hover:shadow-md transition-all duration-200 cursor-pointer",onClick:()=>!P&&!w&&!r&&(async e=>{M(e.url||e.full),C(null);try{const t=e.full||e.url||e.preview;if(!t)throw new Error("No se encontró URL de la imagen");const r=`${T({prod:n})}/api/atenea/proxy?url=${encodeURIComponent(t)}`,a=await fetch(r);if(!a.ok)throw new Error(`Error al descargar: ${a.status}`);const i=await a.blob(),o=e.filename||e.title||`portal-${e.id||Date.now()}.jpg`,l=new File([i],o,{type:i.type||"image/jpeg"});L(l)}catch(t){C(t.message||"No se pudo recuperar la imagen del portal")}finally{M(null)}})(e),children:[
205
207
  /* @__PURE__ */s("div",{className:"relative aspect-video bg-neutral-100",children:[
206
208
  /* @__PURE__ */l(ue,{src:i,fallbackSrc:e.proxiedUrl,alt:e.title||e.filename||`Imagen ${t+1}`,className:"object-cover w-full h-full",onError:()=>{R(e=>{const t=new Set(e);return t.add(a),t})}}),
207
- /* @__PURE__ */l("span",{className:"absolute top-1 left-1 bg-black/60 text-white text-xs px-2 py-1 rounded",children:e.sourceTitle}),M===(e.url||e.full)?/* @__PURE__ */s("div",{className:"absolute inset-0 bg-white/90 flex flex-col items-center justify-center gap-2",children:[
209
+ /* @__PURE__ */l("span",{className:"absolute top-1 left-1 bg-black/60 text-white text-xs px-2 py-1 rounded",children:e.sourceTitle}),P===(e.url||e.full)?/* @__PURE__ */s("div",{className:"absolute inset-0 bg-white/90 flex flex-col items-center justify-center gap-2",children:[
208
210
  /* @__PURE__ */s("div",{className:"relative w-10 h-10",children:[
209
211
  /* @__PURE__ */l("div",{className:"absolute inset-0 border-4 border-brand-blue-200 rounded-full"}),
210
212
  /* @__PURE__ */l("div",{className:"absolute inset-0 border-4 border-brand-blue-800 rounded-full border-t-transparent animate-spin"})]}),
@@ -223,41 +225,41 @@ return s("button",{type:"button",onClick:()=>{return t=e.id,void h(e=>e.includes
223
225
  return s("div",{className:"limbo-upload-form py-4 min-w-fit max-w-7xl mx-auto",children:[
224
226
  /* @__PURE__ */l("div",{className:b,role:"tablist","aria-label":"Opciones de subida de imagen",style:o?{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"}:void 0,children:me.map(e=>{const t=u===e.id;/* @__PURE__ */
225
227
  return l("button",{type:"button","data-upload-tab-id":e.id,className:y(t),"aria-current":t?"page":void 0,"aria-selected":t,role:"tab",tabIndex:t?0:-1,onClick:()=>d(e.id),onKeyDown:t=>((e,t)=>{const n=me.findIndex(e=>e.id===t);let r=n;switch(e.key){case"ArrowLeft":e.preventDefault(),r=n>0?n-1:me.length-1;break;case"ArrowRight":e.preventDefault(),r=n<me.length-1?n+1:0;break;case"Home":e.preventDefault(),r=0;break;case"End":e.preventDefault(),r=me.length-1;break;case"Enter":case" ":return e.preventDefault(),void d(t);default:return}const a=me[r];a&&(d(a.id),setTimeout(()=>{const e=document.querySelector(`[data-upload-tab-id="${a.id}"]`);e&&e.focus()},0))})(t,e.id),id:`upload-tab-${e.id}`,"aria-controls":`upload-tabpanel-${e.id}`,style:c?{WebkitTapHighlightColor:"transparent"}:void 0,children:e.label},e.id)})}),
226
- /* @__PURE__ */s("div",{className:"limbo-tab-content px-2 py-2",role:"tabpanel",id:`upload-tabpanel-${u}`,"aria-labelledby":`upload-tab-${u}`,children:["upload"===u&&/* @__PURE__ */l(Q,{file:m,setFile:h,previewUrl:p,setPreviewUrl:f,fileInputRef:g,onSelect:e,disabled:n}),"ai"===u&&/* @__PURE__ */l(ne,{apiKey:r,prod:i,disabled:n,onSelect:e}),"stock"===u&&/* @__PURE__ */l(oe,{apiKey:r,prod:i,disabled:n,onSelect:e}),"portals"===u&&/* @__PURE__ */l(de,{apiKey:r,prod:i,disabled:n,onSelect:e})]})]})}const pe="undefined"!=typeof window&&void 0!==window.document,fe=pe?window:{},ge=!!pe&&"ontouchstart"in fe.document.documentElement,be=!!pe&&"PointerEvent"in fe,ye="cropper",ve=`${ye}-canvas`,we=`${ye}-crosshair`,xe=`${ye}-grid`,ke=`${ye}-handle`,Ce=`${ye}-image`,Se=`${ye}-selection`,Ne=`${ye}-shade`,Ee=`${ye}-viewer`,$e="select",_e="move",ze="scale",Te="rotate",Ae="transform",Me="none",Pe="n-resize",Ie="e-resize",Le="s-resize",De="w-resize",Oe="ne-resize",Re="nw-resize",je="se-resize",Fe="sw-resize",Ue=be?"pointerdown":ge?"touchstart":"mousedown",qe=be?"pointermove":ge?"touchmove":"mousemove",Be=be?"pointerup pointercancel":ge?"touchend touchcancel":"mouseup",We="error",Ve="keydown",He="load",Ke="wheel",Ge="action",Qe="actionend",Ye="actionstart",Xe="change",Je="transform";const Ze=Number.isNaN||fe.isNaN;function et(e){return"number"==typeof e&&!Ze(e)}function tt(e){return et(e)&&e>0&&e<1/0}function nt(e){return"object"==typeof e&&null!==e}const{hasOwnProperty:rt}=Object.prototype;function at(e){if(!nt(e))return!1;try{const{constructor:t}=e,{prototype:n}=t;return t&&n&&rt.call(n,"isPrototypeOf")}catch(t){return!1}}function it(e){return"function"==typeof e}function ot(e){return"object"==typeof e&&null!==e&&1===e.nodeType}const lt=/([a-z\d])([A-Z])/g;function st(e){return String(e).replace(lt,"$1-$2").toLowerCase()}const ct=/-[A-z\d]/g;function ut(e){return e.replace(ct,e=>e.slice(1).toUpperCase())}const dt=/\s\s*/;function mt(e,t,n,r){t.trim().split(dt).forEach(t=>{e.removeEventListener(t,n,r)})}function ht(e,t,n,r){t.trim().split(dt).forEach(t=>{e.addEventListener(t,n,r)})}function pt(e,t,n,r){ht(e,t,n,Object.assign(Object.assign({},r),{once:!0}))}const ft={bubbles:!0,cancelable:!0,composed:!0};const gt=Promise.resolve();function bt(e){const{documentElement:t}=e.ownerDocument,n=e.getBoundingClientRect();return{left:n.left+(fe.pageXOffset-t.clientLeft),top:n.top+(fe.pageYOffset-t.clientTop)}}const yt=/deg|g?rad|turn$/i;function vt(e){const t=parseFloat(e)||0;if(0!==t){const[n="rad"]=String(e).match(yt)||[];switch(n.toLowerCase()){case"deg":return t/360*(2*Math.PI);case"grad":return t/400*(2*Math.PI);case"turn":return t*(2*Math.PI)}}return t}const wt="contain";function xt(e,t=wt){const{aspectRatio:n}=e;let{width:r,height:a}=e;const i=tt(r),o=tt(a);if(i&&o){const e=a*n;t===wt&&e>r||"cover"===t&&e<r?a=r/n:r=a*n}else i?a=r/n:o&&(r=a*n);return{width:r,height:a}}function kt(e,...t){if(0===t.length)return e;const[n,r,a,i,o,l]=e,[s,c,u,d,m,h]=t[0];return kt(e=[n*s+a*c,r*s+i*c,n*u+a*d,r*u+i*d,n*m+a*h+o,r*m+i*h+l],...t.slice(1))}const Ct=/left|top|width|height/i,St="open",Nt=/* @__PURE__ */new WeakMap,Et=/* @__PURE__ */new WeakMap,$t=/* @__PURE__ */new Map,_t=fe.document&&Array.isArray(fe.document.adoptedStyleSheets)&&"replaceSync"in fe.CSSStyleSheet.prototype;class zt extends HTMLElement{get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}constructor(){var e,t;super(),this.shadowRootMode=St,this.slottable=!0;const n=null===(t=null===(e=Object.getPrototypeOf(this))||void 0===e?void 0:e.constructor)||void 0===t?void 0:t.$name;n&&$t.set(n,this.tagName.toLowerCase())}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(e,t,n){if(Object.is(n,t))return;const r=ut(e);let a=n;switch(typeof this[r]){case"boolean":a=null!==n&&"false"!==n;break;case"number":a=Number(n)}switch(this[r]=a,e){case"theme-color":{const e=Et.get(this),t=this.$sharedStyle;e&&t&&(_t?e.replaceSync(t):e.textContent=t);break}}}$propertyChangedCallback(e,t,n){if(!Object.is(n,t))switch(e=st(e),typeof n){case"boolean":!0===n?this.hasAttribute(e)||this.setAttribute(e,""):this.removeAttribute(e);break;case"number":n=Ze(n)?"":String(n);default:n?this.getAttribute(e)!==n&&this.setAttribute(e,n):this.removeAttribute(e)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach(e=>{const t=ut(e);let n=this[t];(function(e){return void 0===e})(n)||this.$propertyChangedCallback(t,void 0,n),Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>n,set(e){const r=n;n=e,this.$propertyChangedCallback(t,r,e)}})});const e=this.shadowRoot||this.attachShadow({mode:this.shadowRootMode||St});if(Nt.set(this,e),Et.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const t=document.createElement("template");t.innerHTML=this.$template,e.appendChild(t.content)}if(this.slottable){const t=document.createElement("slot");e.appendChild(t)}}disconnectedCallback(){Et.has(this)&&Et.delete(this),Nt.has(this)&&Nt.delete(this)}$getTagNameOf(e){var t;return null!==(t=$t.get(e))&&void 0!==t?t:e}$setStyles(e){return Object.keys(e).forEach(t=>{let n=e[t];et(n)&&(n=0!==n&&Ct.test(t)?`${n}px`:String(n)),this.style[t]=n}),this}$getShadowRoot(){return this.shadowRoot||Nt.get(this)}$addStyles(e){let t;const n=this.$getShadowRoot();return _t?(t=new CSSStyleSheet,t.replaceSync(e),n.adoptedStyleSheets=n.adoptedStyleSheets.concat(t)):(t=document.createElement("style"),t.textContent=e,n.appendChild(t)),t}$emit(e,t,n){return function(e,t,n,r){return e.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},ft),{detail:n}),r)))}(this,e,t,n)}$nextTick(e){return function(e,t){return t?gt.then(e?t.bind(e):t):gt}(this,e)}static $define(e,t){nt(e)&&(t=e,e=""),e||(e=this.$name||this.name),e=st(e),pe&&fe.customElements&&!fe.customElements.get(e)&&customElements.define(e,this,t)}}zt.$version="2.1.0";class Tt extends zt{constructor(){super(...arguments),this.$onPointerDown=null,this.$onPointerMove=null,this.$onPointerUp=null,this.$onWheel=null,this.$wheeling=!1,this.$pointers=/* @__PURE__ */new Map,this.$style=':host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}',this.$action=Me,this.background=!1,this.disabled=!1,this.scaleStep=.1,this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback(),this.disabled||this.$bind()}disconnectedCallback(){this.disabled||this.$unbind(),super.disconnectedCallback()}$propertyChangedCallback(e,t,n){if(!Object.is(n,t)&&(super.$propertyChangedCallback(e,t,n),"disabled"===e))n?this.$unbind():this.$bind()}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),ht(this,Ue,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),ht(this.ownerDocument,qe,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),ht(this.ownerDocument,Be,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),ht(this,Ke,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(mt(this,Ue,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(mt(this.ownerDocument,qe,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(mt(this.ownerDocument,Be,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(mt(this,Ke,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(e){const{buttons:t,button:n,type:r}=e;if(this.disabled||("pointerdown"===r&&"mouse"===e.pointerType||"mousedown"===r)&&(et(t)&&1!==t||et(n)&&0!==n||e.ctrlKey))return;const{$pointers:a}=this;let i="";if(e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:n})=>{a.set(e,{startX:t,startY:n,endX:t,endY:n})});else{const{pointerId:t=0,pageX:n,pageY:r}=e;a.set(t,{startX:n,startY:r,endX:n,endY:r})}a.size>1?i=Ae:ot(e.target)&&(i=e.target.action||e.target.getAttribute("action")||""),!1!==this.$emit(Ye,{action:i,relatedEvent:e})&&(e.preventDefault(),this.$action=i,this.style.willChange="transform")}$handlePointerMove(e){const{$action:t,$pointers:n}=this;if(this.disabled||t===Me||0===n.size)return;if(!1===this.$emit("actionmove",{action:t,relatedEvent:e}))return;if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:r})=>{const a=n.get(e);a&&Object.assign(a,{endX:t,endY:r})});else{const{pointerId:t=0,pageX:r,pageY:a}=e,i=n.get(t);i&&Object.assign(i,{endX:r,endY:a})}const r={action:t,relatedEvent:e};if(t===Ae){const t=new Map(n);let a=0,i=0,o=0,l=0,s=e.pageX,c=e.pageY;n.forEach((e,n)=>{t.delete(n),t.forEach(t=>{let n=t.startX-e.startX,r=t.startY-e.startY,u=t.endX-e.endX,d=t.endY-e.endY,m=0,h=0,p=0,f=0;if(0===n?r<0?p=2*Math.PI:r>0&&(p=Math.PI):n>0?p=Math.PI/2+Math.atan(r/n):n<0&&(p=1.5*Math.PI+Math.atan(r/n)),0===u?d<0?f=2*Math.PI:d>0&&(f=Math.PI):u>0?f=Math.PI/2+Math.atan(d/u):u<0&&(f=1.5*Math.PI+Math.atan(d/u)),f>0||p>0){const n=f-p,r=Math.abs(n);r>a&&(a=r,o=n,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}if(n=Math.abs(n),r=Math.abs(r),u=Math.abs(u),d=Math.abs(d),n>0&&r>0?m=Math.sqrt(n*n+r*r):n>0?m=n:r>0&&(m=r),u>0&&d>0?h=Math.sqrt(u*u+d*d):u>0?h=u:d>0&&(h=d),m>0&&h>0){const n=(h-m)/m,r=Math.abs(n);r>i&&(i=r,l=n,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}})});const u=a>0,d=i>0;u&&d?(r.rotate=o,r.scale=l,r.centerX=s,r.centerY=c):u?(r.action=Te,r.rotate=o,r.centerX=s,r.centerY=c):d?(r.action=ze,r.scale=l,r.centerX=s,r.centerY=c):r.action=Me}else{const[e]=Array.from(n.values());Object.assign(r,e)}n.forEach(e=>{e.startX=e.endX,e.startY=e.endY}),r.action!==Me&&this.$emit(Ge,r,{cancelable:!1})}$handlePointerUp(e){const{$action:t,$pointers:n}=this;if(!this.disabled&&t!==Me&&!1!==this.$emit(Qe,{action:t,relatedEvent:e})){if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e})=>{n.delete(e)});else{const{pointerId:t=0}=e;n.delete(t)}0===n.size&&(this.style.willChange="",this.$action=Me)}}$handleWheel(e){if(this.disabled)return;if(e.preventDefault(),this.$wheeling)return;this.$wheeling=!0,setTimeout(()=>{this.$wheeling=!1},50);const t=(e.deltaY>0?-1:1)*this.scaleStep;this.$emit(Ge,{action:ze,scale:t,relatedEvent:e},{cancelable:!1})}$setAction(e){return"string"==typeof e&&(this.$action=e),this}$toCanvas(e){return new Promise((t,n)=>{if(!this.isConnected)return void n(new Error("The current element is not connected to the DOM."));const r=document.createElement("canvas");let a=this.offsetWidth,i=this.offsetHeight,o=1;at(e)&&(tt(e.width)||tt(e.height))&&(({width:a,height:i}=xt({aspectRatio:a/i,width:e.width,height:e.height})),o=a/this.offsetWidth),r.width=a,r.height=i;const l=this.querySelector(this.$getTagNameOf(Ce));l?l.$ready().then(n=>{const s=r.getContext("2d");if(s){const[t,c,u,d,m,h]=l.$getTransform();let p=m,f=h,g=n.naturalWidth,b=n.naturalHeight;1!==o&&(p*=o,f*=o,g*=o,b*=o);const y=g/2,v=b/2;s.fillStyle="transparent",s.fillRect(0,0,a,i),at(e)&&it(e.beforeDraw)&&e.beforeDraw.call(this,s,r),s.save(),s.translate(y,v),s.transform(t,c,u,d,p,f),s.translate(-y,-v),s.drawImage(n,0,0,g,b),s.restore()}t(r)}).catch(n):t(r)})}}Tt.$name=ve,Tt.$version="2.1.0";const At=/* @__PURE__ */new WeakMap,Mt=["alt","crossorigin","decoding","elementtiming","fetchpriority","loading","referrerpolicy","sizes","src","srcset"];class Pt extends zt{constructor(){super(...arguments),this.$matrix=[1,0,0,1,0,0],this.$onLoad=null,this.$onCanvasAction=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$actionStartTarget=null,this.$style=":host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}",this.$image=new Image,this.initialCenterSize="contain",this.rotatable=!1,this.scalable=!1,this.skewable=!1,this.slottable=!1,this.translatable=!1,this.alt="",this.crossorigin="",this.decoding="",this.elementtiming="",this.fetchpriority="",this.loading="",this.referrerpolicy="",this.sizes="",this.src="",this.srcset=""}set $canvas(e){At.set(this,e)}get $canvas(){return At.get(this)}static get observedAttributes(){return super.observedAttributes.concat(Mt,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(e,t,n){Object.is(n,t)||(super.attributeChangedCallback(e,t,n),Mt.includes(e)&&this.$image.setAttribute(e,n))}$propertyChangedCallback(e,t,n){if(!Object.is(n,t)&&(super.$propertyChangedCallback(e,t,n),"initialCenterSize"===e))this.$nextTick(()=>{this.$center(n)})}connectedCallback(){super.connectedCallback();const{$image:e}=this,t=this.closest(this.$getTagNameOf(ve));t&&(this.$canvas=t,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=e=>{var t,n;this.$actionStartTarget=null===(n=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===n?void 0:n.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),ht(t,Ye,this.$onCanvasActionStart),ht(t,Qe,this.$onCanvasActionEnd),ht(t,Ge,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),ht(e,He,this.$onLoad),this.$getShadowRoot().appendChild(e)}disconnectedCallback(){const{$image:e,$canvas:t}=this;t&&(this.$onCanvasActionStart&&(mt(t,Ye,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(mt(t,Qe,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(mt(t,Ge,this.$onCanvasAction),this.$onCanvasAction=null)),e&&this.$onLoad&&(mt(e,He,this.$onLoad),this.$onLoad=null),this.$getShadowRoot().removeChild(e),super.disconnectedCallback()}$handleLoad(){const{$image:e}=this;this.$setStyles({width:e.naturalWidth,height:e.naturalHeight}),this.$canvas&&this.$center(this.initialCenterSize)}$handleAction(e){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:t}=this,{detail:n}=e;if(n){const{relatedEvent:e}=n;let{action:r}=n;switch(r!==Ae||this.rotatable&&this.scalable||(r=this.rotatable?Te:this.scalable?ze:Me),r){case _e:if(this.translatable){let r=null;e&&(r=e.target.closest(this.$getTagNameOf(Se))),r||(r=t.querySelector(this.$getTagNameOf(Se))),r&&r.multiple&&!r.active&&(r=t.querySelector(`${this.$getTagNameOf(Se)}[active]`)),r&&!r.hidden&&r.movable&&!r.dynamic&&this.$actionStartTarget&&r.contains(this.$actionStartTarget)||this.$move(n.endX-n.startX,n.endY-n.startY)}break;case Te:if(this.rotatable)if(e){const{x:t,y:r}=this.getBoundingClientRect();this.$rotate(n.rotate,e.clientX-t,e.clientY-r)}else this.$rotate(n.rotate);break;case ze:if(this.scalable)if(e){const t=e.target.closest(this.$getTagNameOf(Se));if(!t||!t.zoomable||t.zoomable&&t.dynamic){const{x:t,y:r}=this.getBoundingClientRect();this.$zoom(n.scale,e.clientX-t,e.clientY-r)}}else this.$zoom(n.scale);break;case Ae:if(this.rotatable&&this.scalable){const{rotate:t}=n;let{scale:r}=n;r<0?r=1/(1-r):r+=1;const a=Math.cos(t),i=Math.sin(t),[o,l,s,c]=[a*r,i*r,-i*r,a*r];if(e){const t=this.getBoundingClientRect(),n=e.clientX-t.x,r=e.clientY-t.y,[a,i,u,d]=this.$matrix,m=n-t.width/2,h=r-t.height/2,p=(m*d-u*h)/(a*d-u*i),f=(h*a-i*m)/(a*d-u*i);this.$transform(o,l,s,c,p*(1-o)+f*s,f*(1-c)+p*l)}else this.$transform(o,l,s,c,0,0)}}}}$ready(e){const{$image:t}=this,n=new Promise((e,n)=>{const r=new Error("Failed to load the image source");if(t.complete)t.naturalWidth>0&&t.naturalHeight>0?e(t):n(r);else{const a=()=>{mt(t,We,i),setTimeout(()=>{e(t)})},i=()=>{mt(t,He,a),n(r)};pt(t,He,a),pt(t,We,i)}});return it(e)&&n.then(t=>(e(t),t)),n}$center(e){const{parentElement:t}=this;if(!t)return this;const n=t.getBoundingClientRect(),r=n.width,a=n.height,{x:i,y:o,width:l,height:s}=this.getBoundingClientRect(),c=i+l/2,u=o+s/2,d=n.x+r/2,m=n.y+a/2;if(this.$move(d-c,m-u),e&&(l!==r||s!==a)){const t=r/l,n=a/s;switch(e){case"cover":this.$scale(Math.max(t,n));break;case"contain":this.$scale(Math.min(t,n))}}return this}$move(e,t=e){if(this.translatable&&et(e)&&et(t)){const[n,r,a,i]=this.$matrix,o=(e*i-a*t)/(n*i-a*r),l=(t*n-r*e)/(n*i-a*r);this.$translate(o,l)}return this}$moveTo(e,t=e){if(this.translatable&&et(e)&&et(t)){const[n,r,a,i]=this.$matrix,o=(e*i-a*t)/(n*i-a*r),l=(t*n-r*e)/(n*i-a*r);this.$setTransform(n,r,a,i,o,l)}return this}$rotate(e,t,n){if(this.rotatable){const r=vt(e),a=Math.cos(r),i=Math.sin(r),[o,l,s,c]=[a,i,-i,a];if(et(t)&&et(n)){const[e,r,a,i]=this.$matrix,{width:u,height:d}=this.getBoundingClientRect(),m=t-u/2,h=n-d/2,p=(m*i-a*h)/(e*i-a*r),f=(h*e-r*m)/(e*i-a*r);this.$transform(o,l,s,c,p*(1-o)-f*s,f*(1-c)-p*l)}else this.$transform(o,l,s,c,0,0)}return this}$zoom(e,t,n){if(!this.scalable||0===e)return this;if(e<0?e=1/(1-e):e+=1,et(t)&&et(n)){const[r,a,i,o]=this.$matrix,{width:l,height:s}=this.getBoundingClientRect(),c=t-l/2,u=n-s/2,d=(c*o-i*u)/(r*o-i*a),m=(u*r-a*c)/(r*o-i*a);this.$transform(e,0,0,e,d*(1-e),m*(1-e))}else this.$scale(e);return this}$scale(e,t=e){return this.scalable&&this.$transform(e,0,0,t,0,0),this}$skew(e,t=0){if(this.skewable){const n=vt(e),r=vt(t);this.$transform(1,Math.tan(r),Math.tan(n),1,0,0)}return this}$translate(e,t=e){return this.translatable&&et(e)&&et(t)&&this.$transform(1,0,0,1,e,t),this}$transform(e,t,n,r,a,i){return et(e)&&et(t)&&et(n)&&et(r)&&et(a)&&et(i)?this.$setTransform(kt(this.$matrix,[e,t,n,r,a,i])):this}$setTransform(e,t,n,r,a,i){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(e)&&([e,t,n,r,a,i]=e),et(e)&&et(t)&&et(n)&&et(r)&&et(a)&&et(i))){const o=[...this.$matrix],l=[e,t,n,r,a,i];if(!1===this.$emit(Je,{matrix:l,oldMatrix:o}))return this;this.$matrix=l,this.style.transform=`matrix(${l.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}Pt.$name=Ce,Pt.$version="2.1.0";const It=/* @__PURE__ */new WeakMap;class Lt extends zt{constructor(){super(...arguments),this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$onSelectionChange=null,this.$style=":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}",this.x=0,this.y=0,this.width=0,this.height=0,this.slottable=!1,this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(e){It.set(this,e)}get $canvas(){return It.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(ve));if(e){this.$canvas=e,this.style.position="absolute";const t=e.querySelector(this.$getTagNameOf(Se));t&&(this.$onCanvasActionStart=e=>{t.hidden&&e.detail.action===$e&&(this.hidden=!1)},this.$onCanvasActionEnd=e=>{t.hidden&&e.detail.action===$e&&(this.hidden=!0)},this.$onSelectionChange=e=>{const{x:n,y:r,width:a,height:i}=e.defaultPrevented?t:e.detail;this.$change(n,r,a,i),(t.hidden||0===n&&0===r&&0===a&&0===i)&&(this.hidden=!0)},ht(e,Ye,this.$onCanvasActionStart),ht(e,Qe,this.$onCanvasActionEnd),ht(e,Xe,this.$onSelectionChange))}this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(mt(e,Ye,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(mt(e,Qe,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onSelectionChange&&(mt(e,Xe,this.$onSelectionChange),this.$onSelectionChange=null)),super.disconnectedCallback()}$change(e,t,n=this.width,r=this.height){return et(e)&&et(t)&&et(n)&&et(r)&&(e!==this.x||t!==this.y||n!==this.width||r!==this.height)?(this.hidden&&(this.hidden=!1),this.x=e,this.y=t,this.width=n,this.height=r,this.$render()):this}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:fe.innerWidth})}}Lt.$name=Ne,Lt.$version="2.1.0";class Dt extends zt{constructor(){super(...arguments),this.$onCanvasCropEnd=null,this.$onCanvasCropStart=null,this.$style=':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}',this.action=Me,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}Dt.$name=ke,Dt.$version="2.1.0";const Ot=/* @__PURE__ */new WeakMap;class Rt extends zt{constructor(){super(...arguments),this.$onCanvasAction=null,this.$onCanvasActionStart=null,this.$onCanvasActionEnd=null,this.$onDocumentKeyDown=null,this.$action="",this.$actionStartTarget=null,this.$changing=!1,this.$style=':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}',this.$initialSelection={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.width=0,this.height=0,this.aspectRatio=NaN,this.initialAspectRatio=NaN,this.initialCoverage=NaN,this.active=!1,this.linked=!1,this.dynamic=!1,this.movable=!1,this.resizable=!1,this.zoomable=!1,this.multiple=!1,this.keyboard=!1,this.outlined=!1,this.precise=!1}set $canvas(e){Ot.set(this,e)}get $canvas(){return Ot.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","dynamic","height","initial-aspect-ratio","initial-coverage","keyboard","linked","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(e,t,n){if(!Object.is(n,t))switch(super.$propertyChangedCallback(e,t,n),e){case"x":case"y":case"width":case"height":this.$changing||this.$nextTick(()=>{this.$change(this.x,this.y,this.width,this.height,this.aspectRatio,!0)});break;case"aspectRatio":case"initialAspectRatio":this.$nextTick(()=>{this.$initSelection()});break;case"initialCoverage":this.$nextTick(()=>{tt(n)&&n<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(n?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),ht(this.ownerDocument,Ve,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(mt(this.ownerDocument,Ve,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>{if(this.$canvas){const e=this.$getSelections();n?(e.forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Xe,{x:this.x,y:this.y,width:this.width,height:this.height})):(this.active=!1,e.slice(1).forEach(e=>{this.$removeSelection(e)}))}});break;case"precise":this.$nextTick(()=>{this.$change(this.x,this.y)});break;case"linked":n&&(this.dynamic=!0)}}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(ve));e?(this.$canvas=e,this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`}),this.hidden||this.$render(),this.$initSelection(!0),this.$onCanvasActionStart=this.$handleActionStart.bind(this),this.$onCanvasActionEnd=this.$handleActionEnd.bind(this),this.$onCanvasAction=this.$handleAction.bind(this),ht(e,Ye,this.$onCanvasActionStart),ht(e,Qe,this.$onCanvasActionEnd),ht(e,Ge,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(mt(e,Ye,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(mt(e,Qe,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(mt(e,Ge,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let e=[];return this.parentElement&&(e=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(Se)))),e}$initSelection(e=!1,t=!1){const{initialCoverage:n,parentElement:r}=this;if(tt(n)&&r){const a=this.aspectRatio||this.initialAspectRatio;let i=(t?0:this.width)||r.offsetWidth*n,o=(t?0:this.height)||r.offsetHeight*n;tt(a)&&({width:i,height:o}=xt({aspectRatio:a,width:i,height:o})),this.$change(this.x,this.y,i,o),e&&this.$center(),this.$initialSelection={x:this.x,y:this.y,width:this.width,height:this.height}}}$createSelection(){const e=this.cloneNode(!0);return this.hasAttribute("id")&&e.removeAttribute("id"),e.initialCoverage=NaN,this.active=!1,this.parentElement&&this.parentElement.insertBefore(e,this.nextSibling),e}$removeSelection(e=this){if(this.parentElement){const t=this.$getSelections();if(t.length>1){const n=t.indexOf(e),r=t[n+1]||t[n-1];r&&(e.active=!1,this.parentElement.removeChild(e),r.active=!0,r.$emit(Xe,{x:r.x,y:r.y,width:r.width,height:r.height}))}else this.$clear()}}$handleActionStart(e){var t,n;const r=null===(n=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===n?void 0:n.target;this.$action="",this.$actionStartTarget=r,!this.hidden&&this.multiple&&!this.active&&r===this&&this.parentElement&&(this.$getSelections().forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Xe,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(e){const{currentTarget:t,detail:n}=e;if(!t||!n)return;const{relatedEvent:r}=n;let{action:a}=n;const i=r?function(e){if("function"==typeof e.composedPath)return e.composedPath().find(ot)||e.target;return e.target}(r):null;if(!a&&this.multiple&&(a=this.$action||(null==i?void 0:i.action),this.$action=a),!a||this.hidden&&a!==$e||this.multiple&&!this.active&&a!==ze)return;const{width:o,height:l}=this;let s=n.endX-n.startX,c=n.endY-n.startY,{aspectRatio:u}=this;switch(!tt(u)&&r.shiftKey&&(u=tt(o)&&tt(l)?o/l:1),a){case $e:if(0!==s||0!==c){0===s?s=c:0===c&&(c=s);const{$canvas:e}=this,r=bt(t);(this.multiple&&!this.hidden?this.$createSelection():this).$change(n.startX-r.left,n.startY-r.top,Math.abs(s),Math.abs(c),u),s<0?c<0?a=Re:c>0&&(a=Fe):s>0&&(c<0?a=Oe:c>0&&(a=je)),e&&(e.$action=a)}break;case _e:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(s,c);break;case ze:if(r&&this.zoomable&&(this.dynamic||this.contains(r.target))){const e=bt(t);this.$zoom(n.scale,r.pageX-e.left,r.pageY-e.top)}break;default:this.$resize(a,s,c,u)}}$handleActionEnd(){this.$action="",this.$actionStartTarget=null}$handleKeyDown(e){if(this.hidden||!this.keyboard||this.multiple&&!this.active||e.defaultPrevented)return;const{activeElement:t}=document;if(!t||!["INPUT","TEXTAREA"].includes(t.tagName)&&!["true","plaintext-only"].includes(t.contentEditable))switch(e.key){case"Backspace":e.metaKey&&(e.preventDefault(),this.$removeSelection());break;case"Delete":e.preventDefault(),this.$removeSelection();break;case"ArrowLeft":e.preventDefault(),this.$move(-1,0);break;case"ArrowRight":e.preventDefault(),this.$move(1,0);break;case"ArrowUp":e.preventDefault(),this.$move(0,-1);break;case"ArrowDown":e.preventDefault(),this.$move(0,1);break;case"+":e.preventDefault(),this.$zoom(.1);break;case"-":e.preventDefault(),this.$zoom(-.1)}}$center(){const{parentElement:e}=this;if(!e)return this;const t=(e.offsetWidth-this.width)/2,n=(e.offsetHeight-this.height)/2;return this.$change(t,n)}$move(e,t=e){return this.$moveTo(this.x+e,this.y+t)}$moveTo(e,t=e){return this.movable?this.$change(e,t):this}$resize(e,t=0,n=0,r=this.aspectRatio){if(!this.resizable)return this;const a=tt(r),{$canvas:i}=this;let{x:o,y:l,width:s,height:c}=this;switch(e){case Pe:l+=n,c-=n,c<0&&(e=Le,c=-c,l-=c),a&&(o+=(t=n*r)/2,s-=t,s<0&&(s=-s,o-=s));break;case Ie:s+=t,s<0&&(e=De,s=-s,o-=s),a&&(l-=(n=t/r)/2,c+=n,c<0&&(c=-c,l-=c));break;case Le:c+=n,c<0&&(e=Pe,c=-c,l-=c),a&&(o-=(t=n*r)/2,s+=t,s<0&&(s=-s,o-=s));break;case De:o+=t,s-=t,s<0&&(e=Ie,s=-s,o-=s),a&&(l+=(n=t/r)/2,c-=n,c<0&&(c=-c,l-=c));break;case Oe:a&&(n=-t/r),l+=n,c-=n,s+=t,s<0&&c<0?(e=Fe,s=-s,c=-c,o-=s,l-=c):s<0?(e=Re,s=-s,o-=s):c<0&&(e=je,c=-c,l-=c);break;case Re:a&&(n=t/r),o+=t,l+=n,s-=t,c-=n,s<0&&c<0?(e=je,s=-s,c=-c,o-=s,l-=c):s<0?(e=Oe,s=-s,o-=s):c<0&&(e=Fe,c=-c,l-=c);break;case je:a&&(n=t/r),s+=t,c+=n,s<0&&c<0?(e=Re,s=-s,c=-c,o-=s,l-=c):s<0?(e=Fe,s=-s,o-=s):c<0&&(e=Oe,c=-c,l-=c);break;case Fe:a&&(n=-t/r),o+=t,s-=t,c+=n,s<0&&c<0?(e=Oe,s=-s,c=-c,o-=s,l-=c):s<0?(e=je,s=-s,o-=s):c<0&&(e=Re,c=-c,l-=c)}return i&&i.$setAction(e),this.$change(o,l,s,c)}$zoom(e,t,n){if(!this.zoomable||0===e)return this;e<0?e=1/(1-e):e+=1;const{width:r,height:a}=this,i=r*e,o=a*e;let l=this.x,s=this.y;return et(t)&&et(n)?(l-=(i-r)*((t-this.x)/r),s-=(o-a)*((n-this.y)/a)):(l-=(i-r)/2,s-=(o-a)/2),this.$change(l,s,i,o)}$change(e,t,n=this.width,r=this.height,a=this.aspectRatio,i=!1){return this.$changing||!et(e)||!et(t)||!et(n)||!et(r)||n<0||r<0?this:(tt(a)&&({width:n,height:r}=xt({aspectRatio:a,width:n,height:r},"cover")),this.precise||(e=Math.round(e),t=Math.round(t),n=Math.round(n),r=Math.round(r)),e===this.x&&t===this.y&&n===this.width&&r===this.height&&Object.is(a,this.aspectRatio)&&!i?this:(this.hidden&&(this.hidden=!1),!1===this.$emit(Xe,{x:e,y:t,width:n,height:r})?this:(this.$changing=!0,this.x=e,this.y=t,this.width=n,this.height=r,this.$changing=!1,this.$render())))}$reset(){const{x:e,y:t,width:n,height:r}=this.$initialSelection;return this.$change(e,t,n,r)}$clear(){return this.$change(0,0,0,0,NaN,!0),this.hidden=!0,this}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(e){return new Promise((t,n)=>{if(!this.isConnected)return void n(new Error("The current element is not connected to the DOM."));const r=document.createElement("canvas");let{width:a,height:i}=this,o=1;if(at(e)&&(tt(e.width)||tt(e.height))&&(({width:a,height:i}=xt({aspectRatio:a/i,width:e.width,height:e.height})),o=a/this.width),r.width=a,r.height=i,!this.$canvas)return void t(r);const l=this.$canvas.querySelector(this.$getTagNameOf(Ce));l?l.$ready().then(n=>{const s=r.getContext("2d");if(s){const[t,c,u,d,m,h]=l.$getTransform(),p=-this.x,f=-this.y,g=(p*d-u*f)/(t*d-u*c),b=(f*t-c*p)/(t*d-u*c);let y=t*g+u*b+m,v=c*g+d*b+h,w=n.naturalWidth,x=n.naturalHeight;1!==o&&(y*=o,v*=o,w*=o,x*=o);const k=w/2,C=x/2;s.fillStyle="transparent",s.fillRect(0,0,a,i),at(e)&&it(e.beforeDraw)&&e.beforeDraw.call(this,s,r),s.save(),s.translate(k,C),s.transform(t,c,u,d,y,v),s.translate(-k,-C),s.drawImage(n,0,0,w,x),s.restore()}t(r)}).catch(n):t(r)})}}Rt.$name=Se,Rt.$version="2.1.0";class jt extends zt{constructor(){super(...arguments),this.$style=":host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}",this.bordered=!1,this.columns=3,this.covered=!1,this.rows=3,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["bordered","columns","covered","rows"])}$propertyChangedCallback(e,t,n){Object.is(n,t)||(super.$propertyChangedCallback(e,t,n),"rows"!==e&&"columns"!==e||this.$nextTick(()=>{this.$render()}))}connectedCallback(){super.connectedCallback(),this.$render()}$render(){const e=this.$getShadowRoot(),t=document.createDocumentFragment();for(let n=0;n<this.rows;n+=1){const e=document.createElement("span");e.setAttribute("role","row");for(let t=0;t<this.columns;t+=1){const t=document.createElement("span");t.setAttribute("role","gridcell"),e.appendChild(t)}t.appendChild(e)}e&&(e.innerHTML="",e.appendChild(t))}}jt.$name=xe,jt.$version="2.1.0";class Ft extends zt{constructor(){super(...arguments),this.$style=':host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}',this.centered=!1,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["centered"])}}Ft.$name=we,Ft.$version="2.1.0";const Ut=/* @__PURE__ */new WeakMap,qt=/* @__PURE__ */new WeakMap,Bt=/* @__PURE__ */new WeakMap,Wt=/* @__PURE__ */new WeakMap,Vt="vertical";class Ht extends zt{constructor(){super(...arguments),this.$onSelectionChange=null,this.$onSourceImageLoad=null,this.$onSourceImageTransform=null,this.$scale=1,this.$style=":host{display:block;height:100%;overflow:hidden;position:relative;width:100%}",this.resize=Vt,this.selection="",this.slottable=!1}set $image(e){qt.set(this,e)}get $image(){return qt.get(this)}set $sourceImage(e){Wt.set(this,e)}get $sourceImage(){return Wt.get(this)}set $canvas(e){Ut.set(this,e)}get $canvas(){return Ut.get(this)}set $selection(e){Bt.set(this,e)}get $selection(){return Bt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["resize","selection"])}connectedCallback(){var e,t;super.connectedCallback();let n=null;if(n=this.selection?null!==(t=null===(e=function(e){const t=e.getRootNode();switch(t.nodeType){case 1:return t.ownerDocument;case 9:case 11:return t}return null}(this))||void 0===e?void 0:e.querySelector(this.selection))&&void 0!==t?t:null:this.closest(this.$getTagNameOf(Se)),ot(n)){this.$selection=n,this.$onSelectionChange=this.$handleSelectionChange.bind(this),ht(n,Xe,this.$onSelectionChange);const e=n.closest(this.$getTagNameOf(ve));if(e){this.$canvas=e;const t=e.querySelector(this.$getTagNameOf(Ce));t&&(this.$sourceImage=t,this.$image=t.cloneNode(!0),this.$getShadowRoot().appendChild(this.$image),this.$onSourceImageLoad=this.$handleSourceImageLoad.bind(this),this.$onSourceImageTransform=this.$handleSourceImageTransform.bind(this),ht(t.$image,He,this.$onSourceImageLoad),ht(t,Je,this.$onSourceImageTransform))}this.$render()}}disconnectedCallback(){const{$selection:e,$sourceImage:t}=this;e&&this.$onSelectionChange&&(mt(e,Xe,this.$onSelectionChange),this.$onSelectionChange=null),t&&this.$onSourceImageLoad&&(mt(t.$image,He,this.$onSourceImageLoad),this.$onSourceImageLoad=null),t&&this.$onSourceImageTransform&&(mt(t,Je,this.$onSourceImageTransform),this.$onSourceImageTransform=null),super.disconnectedCallback()}$handleSelectionChange(e){this.$render(e.defaultPrevented?this.$selection:e.detail)}$handleSourceImageLoad(){const{$image:e,$sourceImage:t}=this,n=e.getAttribute("src"),r=t.getAttribute("src");r&&r!==n&&(e.setAttribute("src",r),e.$ready(()=>{this.$render()}))}$handleSourceImageTransform(e){this.$render(void 0,e.detail.matrix)}$render(e,t){const{$canvas:n,$selection:r}=this;e||r.hidden||(e=r),(!e||0===e.x&&0===e.y&&0===e.width&&0===e.height)&&(e={x:0,y:0,width:n.offsetWidth,height:n.offsetHeight});const{x:a,y:i,width:o,height:l}=e,s={},{clientWidth:c,clientHeight:u}=this;let d=c,m=u,h=NaN;switch(this.resize){case"both":h=1,d=o,m=l,s.width=o,s.height=l;break;case"horizontal":h=l>0?u/l:0,d=o*h,s.width=d;break;case Vt:h=o>0?c/o:0,m=l*h,s.height=m;break;default:c>0?h=o>0?c/o:0:u>0&&(h=l>0?u/l:0)}this.$scale=h,this.$setStyles(s),this.$sourceImage&&setTimeout(()=>{this.$transformImageByOffset(null!=t?t:this.$sourceImage.$getTransform(),-a,-i)})}$transformImageByOffset(e,t,n){const{$image:r,$scale:a,$sourceImage:i}=this;if(i&&r&&a>=0){const[i,o,l,s,c,u]=e,d=(t*s-l*n)/(i*s-l*o),m=(n*i-o*t)/(i*s-l*o),h=i*d+l*m+c,p=o*d+s*m+u;r.$ready(e=>{this.$setStyles.call(r,{width:e.naturalWidth*a,height:e.naturalHeight*a})}),r.$setTransform(i,o,l,s,h*a,p*a)}}}Ht.$name=Ee,Ht.$version="2.1.0",Tt.$define(),Ft.$define(),jt.$define(),Dt.$define(),Pt.$define(),Rt.$define(),Lt.$define(),Ht.$define();class Kt{constructor(e,t,n){this.canvasRef=e,this.imageRef=t,this.selectionRef=n}get canvasElement(){return this.canvasRef?.current}get image(){return this.imageRef?.current}get selectionElement(){return this.selectionRef?.current}get isReady(){return!!(this.canvasElement&&this.image&&this.selectionElement)}transform={move:(e,t)=>{if(!this.image)return!1;try{return this.image.$move(e,t),!0}catch(n){return console.warn("Error moving image:",n),!1}},moveTo:(e,t)=>{if(!this.image)return!1;try{return this.image.$moveTo(e,t),!0}catch(n){return console.warn("Error moving image to position:",n),!1}},zoom:e=>{if(!this.image)return!1;try{return this.image.$zoom(e),!0}catch(t){return console.warn("Error zooming image:",t),!1}},rotate:e=>{if(!this.image)return!1;try{const t=e*Math.PI/180;return this.image.$rotate(t),!0}catch(t){return console.warn("Error rotating image:",t),!1}},scale:(e,t=e)=>{if(!this.image)return!1;try{return this.image.$scale(e,t),!0}catch(n){return console.warn("Error scaling image:",n),!1}},center:(e="contain")=>{if(!this.image)return!1;try{return this.image.$center(e),!0}catch(t){return console.warn("Error centering image:",t),!1}},reset:()=>{if(!this.image)return!1;try{return this.image.$resetTransform(),!0}catch(e){return console.warn("Error resetting transform:",e),!1}},getTransform:()=>{if(!this.image)return null;try{return this.image.$getTransform()}catch(e){return console.warn("Error getting transform:",e),null}},setTransform:(e,t,n,r,a,i)=>{if(!this.image)return!1;try{return this.image.$setTransform(e,t,n,r,a,i),!0}catch(o){return console.warn("Error setting transform:",o),!1}},resetZoom:()=>{if(!this.image)return!1;try{const e=this.image.$getTransform();if(!e)return!1;const[t,n,r,a,i,o]=e,l=Math.sqrt(t*t+n*n),s=Math.sqrt(r*r+a*a),c=t/l,u=n/l,d=r/s,m=a/s;return this.image.$setTransform(c,u,d,m,i,o),!0}catch(e){return console.warn("Error resetting zoom:",e),!1}},setZoom:e=>{if(!this.image||e<=0)return!1;try{const t=this.image.$getTransform();if(!t)return!1;const[n,r,a,i,o,l]=t,s=Math.sqrt(n*n+r*r),c=Math.sqrt(a*a+i*i),u=n/s*e,d=r/s*e,m=a/c*e,h=i/c*e;return this.image.$setTransform(u,d,m,h,o,l),!0}catch(t){return console.warn("Error setting zoom level:",t),!1}},getZoom:()=>{if(!this.image)return 1;try{const e=this.image.$getTransform();if(!e)return 1;const[t,n]=e;return Math.sqrt(t*t+n*n)}catch(e){return console.warn("Error getting zoom level:",e),1}},fitToCanvas:(e=.1)=>{if(!this.image||!this.canvasElement)return!1;try{const t=this.canvasElement.getBoundingClientRect();let n=this.image.querySelector("img")||this.image;if(!n?.naturalWidth||!n?.naturalHeight)return!1;const r=1-e,a=t.width*r/n.naturalWidth,i=t.height*r/n.naturalHeight,o=Math.min(a,i,1);return this.transform.setZoom(o)}catch(t){return console.warn("Error fitting to canvas:",t),!1}}};selection={center:()=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$center(),!0}catch(e){return console.warn("Error centering selection:",e),!1}},reset:()=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$reset(),!0}catch(e){return console.warn("Error resetting selection:",e),!1}},setCoverage:e=>{if(!this.selectionElement||e<0||e>1)return!1;try{return this.selectionElement.initialCoverage=e,this.selectionElement.$reset(),!0}catch(t){return console.warn("Error setting coverage:",t),!1}},setAspectRatio:e=>{if(!this.selectionElement)return!1;try{let t;if(""===e||null==e)t=NaN;else if("number"==typeof e)t=e;else{if("string"!=typeof e)return console.warn("Unsupported aspect ratio type:",typeof e,e),!1;if(e.includes("/")){const[n,r]=e.split("/").map(e=>parseFloat(e.trim()));if(isNaN(n)||isNaN(r)||0===r)return console.warn("Invalid aspect ratio format:",e),!1;t=n/r}else if(t=parseFloat(e),isNaN(t))return console.warn("Invalid aspect ratio format:",e),!1}return this.selectionElement.aspectRatio=t,this.selectionElement.$render(),!0}catch(t){return console.warn("Error setting aspect ratio:",t),!1}},move:(e,t)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$move(e,t),!0}catch(n){return console.warn("Error moving selection:",n),!1}},zoom:e=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$zoom(e),!0}catch(t){return console.warn("Error zooming selection:",t),!1}},change:(e,t,n,r,a)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$change(e,t,n,r,a),!0}catch(i){return console.warn("Error changing selection:",i),!1}},set:(e,t,n,r)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.x=e,this.selectionElement.y=t,this.selectionElement.width=n,this.selectionElement.height=r,this.selectionElement.$render(),!0}catch(a){return console.warn("Error setting selection:",a),!1}},toCanvas:async(e={})=>{if(!this.selectionElement)return null;try{const t={width:800,height:600,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",...e};return await this.selectionElement.$toCanvas(t)}catch(t){return console.warn("Error exporting to canvas:",t),null}},getData:()=>{if(!this.selectionElement)return null;try{return{x:this.selectionElement.x,y:this.selectionElement.y,width:this.selectionElement.width,height:this.selectionElement.height,aspectRatio:this.selectionElement.aspectRatio}}catch(e){return console.warn("Error getting selection data:",e),null}}};canvas={setBackground:e=>{if(!this.canvasElement)return!1;try{return this.canvasElement.background=e,!0}catch(t){return console.warn("Error setting background:",t),!1}},setScaleStep:e=>{if(!this.canvasElement)return!1;try{return this.canvasElement.scaleStep=e,!0}catch(t){return console.warn("Error setting scale step:",t),!1}},setDisabled:e=>{if(!this.canvasElement)return!1;try{return this.canvasElement.disabled=e,!0}catch(t){return console.warn("Error setting disabled state:",t),!1}}};utils={flipHorizontal:()=>{const e=this.transform.getTransform();if(!e)return!1;const[t,n,r,a,i,o]=e;return this.transform.setTransform(-t,n,r,a,i,o)},flipVertical:()=>{const e=this.transform.getTransform();if(!e)return!1;const[t,n,r,a,i,o]=e;return this.transform.setTransform(t,n,r,-a,i,o)},setupInitialView:async(e={})=>{const{paspartuFactor:t=.85,retries:n=3,retryDelay:r=200}=e;return new Promise(e=>{const a=(i=0)=>{if(!this.isReady)return i<n?void setTimeout(()=>a(i+1),r):void e(!1);try{const o=this.canvasElement.getBoundingClientRect();let l=this.image.querySelector("img")||this.image;if(!l?.naturalWidth||!l?.naturalHeight)return i<n?void setTimeout(()=>a(i+1),r):(this.transform.center(),void e(!1));if(o.width>0&&o.height>0){const n=o.width*t/l.naturalWidth,r=o.height*t/l.naturalHeight,a=Math.min(n,r,1);this.transform.setTransform(a,0,0,a,0,0)?setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100):(this.transform.reset(),setTimeout(()=>{a<1&&this.transform.scale(a),setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100)},100))}else this.transform.center(),e(!1)}catch(o){console.warn("Error in setup:",o),this.transform.center(),e(!1)}};a()})},resetAll:()=>{const e={transform:this.transform.reset(),selection:this.selection.reset(),center:!1};return setTimeout(()=>{e.center=this.transform.center()&&this.selection.center()},100),e},checkExportability:async()=>{try{return!!(await this.selection.toCanvas({width:1,height:1}))}catch{return!1}},resetZoomOnly:()=>this.transform.resetZoom(),getZoomInfo:()=>{const e=this.transform.getZoom();return{current:e,isZoomedIn:e>1,isZoomedOut:e<1,percentage:Math.round(100*e)}},setBackground:e=>this.canvas.setBackground(e)};setupEventListeners(e={}){const{onSelectionChange:t,onImageTransform:n,onAction:r,onActionStart:a,onActionMove:i,onActionEnd:o}=e,l=[];if(t&&this.selectionElement){const e=e=>{t({x:e.detail.x,y:e.detail.y,width:e.detail.width,height:e.detail.height})};this.selectionElement.addEventListener("change",e),l.push(()=>{this.selectionElement&&this.selectionElement.removeEventListener("change",e)})}if(n&&this.image){const e=e=>{n({matrix:e.detail.matrix,oldMatrix:e.detail.oldMatrix})};this.image.addEventListener("transform",e),l.push(()=>{this.image&&this.image.removeEventListener("transform",e)})}if(this.canvasElement){if(r){const e=e=>r(e.detail);this.canvasElement.addEventListener("action",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("action",e)})}if(a){const e=e=>a(e.detail);this.canvasElement.addEventListener("actionstart",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionstart",e)})}if(i){const e=e=>i(e.detail);this.canvasElement.addEventListener("actionmove",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionmove",e)})}if(o){const e=e=>o(e.detail);this.canvasElement.addEventListener("actionend",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionend",e)})}}return()=>{l.forEach(e=>e())}}}async function Gt(e,t,n={}){const{format:r=null,originalFormat:a="webp",onSuccess:i=null,onError:o=null,accessibilityManager:l=null}=n;try{const n=window.limboCore?.config?.getGlobal(),o=r||n?.downloadFormat||a||"webp",s=`${t.split(".")[0]}.${o}`;if(l&&l.announce(`Descargando ${s}`),e.startsWith("data:image/"))return function(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),setTimeout(()=>{document.body.removeChild(n)},100)}(e,s),i&&i(s),l&&l.announce(`${s} descargado correctamente`),!0;const c=await fetch(e,{mode:"cors"});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);const u=await c.blob();let d=u;const m=u.type;m!==`image/${"jpg"===o?"jpeg":o}`&&function(e){return["webp","jpeg","jpg","png"].includes(e.toLowerCase())}(o)&&(d=await async function(e,t){return new Promise((n,r)=>{const a=new Image,i=URL.createObjectURL(e);a.onload=()=>{try{const r=document.createElement("canvas");r.width=a.width,r.height=a.height;r.getContext("2d").drawImage(a,0,0);const o=`image/${"jpg"===t?"jpeg":t}`,l="png"===t?void 0:.92;r.toBlob(t=>{URL.revokeObjectURL(i),n(t||e)},o,l)}catch(r){URL.revokeObjectURL(i),n(e)}},a.onerror=()=>{URL.revokeObjectURL(i),n(e)},a.src=i})}(u,o));const h=window.URL.createObjectURL(d),p=document.createElement("a");return p.href=h,p.download=s,p.style.display="none",document.body.appendChild(p),p.click(),setTimeout(()=>{window.URL.revokeObjectURL(h),document.body.removeChild(p)},100),i&&i(s),l&&l.announce(`${s} descargado correctamente`),!0}catch(s){return console.error("Error downloading image:",s),o&&o(s),l&&l.announce(`Error al descargar la imagen: ${s.message}`),!1}}const Qt=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Gt,downloadImage:Gt},Symbol.toStringTag,{value:"Module"}));function Yt({image:e,onSave:o,onCancel:u,onDelete:d,onError:m=null,deleting:h=!1,onVariantCreated:p=null,onUpload:f=null,uploading:g=!1,cropperConfig:b=null}){const[y,v]=t(!1),[w,x]=t(null),[k,C]=t(!1),[S,N]=t(!0),[E,$]=t(!0),[_,z]=t({x:20,y:100}),[T,A]=t(!1),[M,P]=t({x:0,y:0}),[I,L]=t(!1),[D,O]=t(!0),[R,j]=t(!1),[U,q]=t({horizontal:!1,vertical:!1}),[W,V]=t(!1),[H,K]=t(!1),[G,Q]=t(!1),[Y,X]=t(!1),[J]=t(()=>{if(!e||!e.filename)return"image";const[t]=e.filename.split(".");return t}),Z=i(()=>{if(b)return{mandatoryCrops:b.mandatoryCrops||[],allowCustomCrops:!1!==b.allowAdditionalCrops,showDimensionInputs:!0===b.showDimensionInputs,maxCrops:b.maxCrops||null};const e=window.limboCore?.config?.getGlobal()||{};return{mandatoryCrops:e.cropper?.mandatoryCrops||[],allowCustomCrops:!1!==e.cropper?.allowCustomCrops,showDimensionInputs:!0===e.cropper?.showDimensionInputs,maxCrops:e.cropper?.maxCrops||null}},[b]),[ee,ne]=t(()=>Z.mandatoryCrops.length>0?Z.mandatoryCrops.map((e,t)=>({id:`crop-${t}`,label:e.label,width:e.width,height:e.height,required:!1!==e.required,isCustom:!1,confirmed:!1,lockDimensions:!(!e.width||!e.height),savedState:null})):[{id:"crop-default-0",label:J,width:e.width||1920,height:e.height||1080,required:!1,isCustom:!0,confirmed:!1,savedState:null}]),[re,ae]=t(0),ie=ee[re],oe=i(()=>ie&&ie.width&&ie.height?ie.width/ie.height:"",[ie]),le=i(()=>{const e=50;if(!oe||""===oe)return{minWidth:e,minHeight:e};if(oe>=1){return{minWidth:e,minHeight:e/oe}}return{minWidth:e*oe,minHeight:e}},[oe]),[se,ce]=t(!1),[ue,de]=t([]),[me,he]=t(null),pe=window.limboCore?.accessibilityManager,{createCropVariant:fe,loading:ge,error:be}=function(){const[e,n]=t(!1),[r,a]=t(null),[i,o]=t(null),l=async(e,t)=>{if(!e||!t)return a("ID de asset y configuración de variante son requeridos"),null;n(!0),a(null),o(null);try{const n=await F(e,{variant_name:t.name,width:t.width,height:t.height,crop_params:t.crop_params,preset_aspect:t.preset_aspect,preset_size:t.preset_size,output_format:t.output_format});if(n?.result)return o(n.result),n.result;throw new Error("No se pudo crear la variante")}catch(r){return console.error("Error creating variant:",r),a(r.message||"Error desconocido al crear variante"),null}finally{n(!1)}};return{createVariant:l,createCropVariant:async(e,t,n={})=>{const r={name:n.name||`crop_${Date.now()}`,width:n.width||800,height:n.height||600,output_format:n.format||"webp",crop_params:{x:t.x||0,y:t.y||0,width:t.width||1,height:t.height||1}};return await l(e,r)},loading:e,error:r,createdVariant:i,reset:()=>{a(null),o(null)}}}(),ye=((e,i={})=>{const o=a(null),l=a(null),s=a(null),c=a(null),[u,d]=t(null),[m,h]=t(null),[p,f]=t(!1),[g,b]=t(!0),[y,v]=t(0),w={aspectRatio:"",shade:!0,paspartuFactor:.85,...i};n(()=>{o.current&&l.current&&s.current&&(c.current=new Kt(o,l,s),f(!0))},[]),n(()=>{if(c.current)return c.current.setupEventListeners({onSelectionChange:e=>{d(e)},onImageTransform:()=>{v(e=>e+1)}})},[p]),n(()=>{c.current&&e&&(async()=>{c.current.selection.setAspectRatio(w.aspectRatio),c.current.canvas.setBackground(w.shade),await c.current.utils.setupInitialView({paspartuFactor:w.paspartuFactor});const e=await c.current.utils.checkExportability();b(e);const t=l.current?.querySelector("img")||l.current;t?.naturalWidth&&t?.naturalHeight&&h({naturalWidth:t.naturalWidth,naturalHeight:t.naturalHeight,currentWidth:t.width,currentHeight:t.height})})()},[e]),n(()=>{c.current&&p&&c.current.selection.setAspectRatio(w.aspectRatio)},[w.aspectRatio,p]),n(()=>{c.current&&p&&c.current.canvas.setBackground(w.shade)},[w.shade,p]);const x=r(()=>({move:(e,t)=>c.current?.transform.move(e,t)||!1,zoom:e=>c.current?.transform.zoom(e)||!1,rotate:e=>c.current?.transform.rotate(e)||!1,center:()=>c.current?.transform.center()||!1,reset:()=>c.current?.transform.reset()||!1,resetZoom:()=>c.current?.transform.resetZoom()||!1,setZoom:e=>c.current?.transform.setZoom(e)||!1,getZoom:()=>c.current?.transform.getZoom()||1,fitToCanvas:e=>c.current?.transform.fitToCanvas(e)||!1,flipHorizontal:()=>c.current?.utils.flipHorizontal()||!1,flipVertical:()=>c.current?.utils.flipVertical()||!1}),[]),k=r(()=>({center:()=>c.current?.selection.center()||!1,reset:()=>c.current?.selection.reset()||!1,setCoverage:e=>c.current?.selection.setCoverage(e)||!1,setAspectRatio:e=>c.current?.selection.setAspectRatio(e)||!1,toCanvas:e=>c.current?.selection.toCanvas(e)||Promise.resolve(null)}),[]),C=r(()=>({resetAll:()=>{if(c.current){const e=c.current.utils.resetAll();return d(null),e}return!1},setBackground:e=>c.current?.canvas.setBackground(e)||!1,resetZoomOnly:()=>c.current?.utils.resetZoomOnly()||!1,getZoomInfo:()=>c.current?.utils.getZoomInfo()||{current:1,percentage:100,isZoomedIn:!1,isZoomedOut:!1}}),[]);return{refs:{canvasRef:o,imageRef:l,selectionRef:s},state:{cropData:u,imageInfo:m,isReady:p,canExport:g,transformVersion:y},transform:x(),selection:k(),utils:C(),manager:c.current}})(e,{aspectRatio:oe||null,showGrid:S,shade:E,initialCoverage:.5,paspartuFactor:.85}),{refs:ve,state:we,transform:xe,selection:ke,utils:Ce}=ye,{canvasRef:Se,imageRef:Ne,selectionRef:Ee}=ve,{cropData:$e,imageInfo:_e,canExport:ze,transformVersion:Te}=we,Ae=i(()=>_e||{naturalWidth:e.width||1920,naturalHeight:e.height||1080,currentWidth:e.width||1920,currentHeight:e.height||1080},[_e,e.width,e.height]),Me=r(()=>N(e=>!e),[]),Pe=r(()=>$(e=>!e),[]),Ie=r(()=>K(e=>!e),[]),Le=r(()=>Q(e=>!e),[]),De=r(()=>X(e=>!e),[]),Oe=r(()=>xe.center(),[xe]),Re=r(()=>ke.center(),[ke]),je=r(()=>ke.reset(),[ke]),Fe=r((e,t)=>xe.move(e,t),[xe]),Ue=r(e=>xe.zoom(e),[xe]),qe=r(e=>xe.rotate(e),[xe]),Be=r(e=>{ke.setCoverage(e)},[ke]),We=r(()=>{q(e=>{const t=!e.horizontal;return xe.flipHorizontal(),{...e,horizontal:t}})},[xe]),Ve=r(()=>{q(e=>{const t=!e.vertical;return xe.flipVertical(),{...e,vertical:t}})},[xe]),He=r(()=>{if(!ye.manager||!we.isReady)return null;try{const e=$e?{...$e}:null;let t=null;if(Ee.current){const e=Ee.current;t={x:e.x??0,y:e.y??0,width:e.width??0,height:e.height??0}}let n=null;if(Ne.current){const e=Ne.current.$getTransform?.();e&&Array.isArray(e)&&(n=[...e])}const r={cropData:e,selectorState:t,imageTransform:n,flipState:{horizontal:U.horizontal,vertical:U.vertical}};return console.log(`[CropperView] 💾 Guardando estado del crop ${re}:`,r),ne(e=>e.map((e,t)=>t===re?{...e,savedState:r}:e)),r}catch(e){return console.warn("Error saving crop state:",e),null}},[ye.manager,we.isReady,$e,U,re,Ne,Ee]),Ke=r(e=>{const t=ee[e];if(!t||!t.savedState)return console.log(`[CropperView] ℹ️ No hay estado guardado para crop ${e}, centrando...`),void setTimeout(()=>{Oe(),setTimeout(()=>Re(),100)},100);if(ye.manager&&we.isReady)try{const{savedState:n}=t;if(console.log(`[CropperView] ♻️ Restaurando estado del crop ${e}:`,n),n.imageTransform&&Ne.current&&Array.isArray(n.imageTransform)&&setTimeout(()=>{if(Ne.current&&Ne.current.$setTransform){const[e,t,r,a,i,o]=n.imageTransform;Ne.current.$setTransform(e,t,r,a,i,o),console.log(`[CropperView] ✅ Imagen restaurada: transform(${e.toFixed(2)}, ${t.toFixed(2)}, ${r.toFixed(2)}, ${a.toFixed(2)}, ${i.toFixed(0)}, ${o.toFixed(0)})`)}},100),n.selectorState&&Ee.current){const{x:e,y:t,width:r,height:a}=n.selectorState;setTimeout(()=>{Ee.current&&(Ee.current.x=e,Ee.current.y=t,Ee.current.width=r,Ee.current.height=a,Ee.current.$render&&Ee.current.$render(),console.log(`[CropperView] ✅ Selector restaurado: ${r}×${a} en (${e}, ${t})`))},150)}n.flipState&&q({horizontal:n.flipState.horizontal??!1,vertical:n.flipState.vertical??!1}),console.log("[CropperView] ✨ Estado restaurado completamente")}catch(n){console.error("Error restoring crop state:",n),setTimeout(()=>{Oe(),setTimeout(()=>Re(),100)},100)}else console.warn("Cropper not ready for state restoration")},[ee,ye.manager,we.isReady,Oe,Re,Ee,Ne]),Ge=r(()=>{for(let e=0;e<ee.length;e++){const t=ee[e];if(!t.label||""===t.label.trim())return e}return-1},[ee]),Qe=r(async e=>{e!==re&&(j(!0),He(),await new Promise(e=>setTimeout(e,100)),ae(e),await new Promise(e=>setTimeout(e,250)),Ke(e),await new Promise(e=>setTimeout(e,200)),j(!1))},[re,He,Ke]),Ye=r(()=>{if(!Z.allowCustomCrops)return void alert("No se pueden añadir recortes personalizados en este modo.");const t={id:`crop-custom-${Date.now()}`,label:`Recorte ${ee.length+1}`,width:e.width||1920,height:e.height||1080,required:!1,isCustom:!0,confirmed:!1,savedState:null};ne(e=>[...e,t]),pe?.announce(`Nuevo recorte personalizado añadido: ${t.label}. Selecciónalo para editarlo.`)},[Z.allowCustomCrops,ee.length,e.width,e.height,pe]),Xe=r((e,t)=>{const n=parseInt(t,10);""===t||isNaN(n)||ne(t=>t.map((t,r)=>r===re?{...t,[e]:n}:t))},[re]),Je=r(e=>{const t=ie[e];let n=100;if(Se.current&&_e){const e=Se.current.getBoundingClientRect(),t=Math.min(e.width,e.height);n=Math.max(100,Math.round(.05*t))}const r=Math.max(n,Math.min(5e3,t));r!==t&&ne(t=>t.map((t,n)=>n===re?{...t,[e]:r}:t));const a={...ie,[e]:r},i=a.width/a.height,o=ke.getData?.();ke.setAspectRatio(i),o&&void 0!==o.x&&setTimeout(()=>{ke.set?.(o.x,o.y,o.width,o.height)},50)},[re,ie,ke,Se,_e]),Ze=r(e=>{ne(t=>t.map((t,n)=>n===re?{...t,label:e}:t))},[re]),et=r((e,t=null)=>{t=t||ee[e].label;if(!window.confirm(`¿Estás seguro de que deseas eliminar "${t||"este recorte"}"? Esta acción también eliminará todos sus recortes.`))return;const n=ee[e];if(n.required)alert("No se puede eliminar un recorte obligatorio.");else if(1!==ee.length){if(ne(t=>t.filter((t,n)=>n!==e)),e===re){const t=Math.max(0,e-1);ae(t)}else e<re&&ae(e=>e-1);pe?.announce(`Recorte ${n.label} eliminado`)}else alert("Debe haber al menos un recorte.")},[ee,re,pe]),tt=r(async()=>{if(!ze)return null;try{const t=await ke.toCanvas({width:800,height:600,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});return t?t.toDataURL(`image/${globalThis.downloadFormat||e.mime_type.split("/")[1]||"webp"}`,.9):null}catch(t){return console.warn("Error generating preview:",t),null}},[ze,e.mime_type,ke]),nt=r(async()=>{if(y)return v(!1),x(null),void C(!1);if(ze){v(!0),C(!0);try{const e=await tt();e?x(e):(v(!1),alert("No se puede exportar el recorte por restricciones de CORS en la imagen original."))}finally{C(!1)}}else alert("No se puede exportar el recorte por restricciones de CORS en la imagen original.")},[ze,tt,y]),rt=r(e=>{e.target.closest(".limbo-preview-modal-header")&&(A(!0),P({x:e.clientX-_.x,y:e.clientY-_.y}))},[_]),at=r(e=>{T&&(e.preventDefault(),z({x:e.clientX-M.x,y:e.clientY-M.y}))},[T,M]),it=r(()=>{A(!1)},[]),ot=r(e=>{if(!e.target.closest(".limbo-preview-modal-header"))return;const t=e.touches[0];A(!0),P({x:t.clientX-_.x,y:t.clientY-_.y})},[_]),lt=r(e=>{if(!T)return;e.preventDefault();const t=e.touches[0];z({x:t.clientX-M.x,y:t.clientY-M.y})},[T,M]),st=r(()=>{A(!1)},[]);n(()=>{if(T)return document.addEventListener("mousemove",at),document.addEventListener("mouseup",it),document.addEventListener("touchmove",lt,{passive:!1}),document.addEventListener("touchend",st),()=>{document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",it),document.removeEventListener("touchmove",lt),document.removeEventListener("touchend",st)}},[T,at,it,lt,st]),n(()=>{if(!I)return;const e=e=>{"Escape"===e.key&&L(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[I]);const ct=r(async(t,n=null)=>{const r=ee[t];if(!r)throw new Error(`Crop ${t} no encontrado`);let a;if(r.savedState&&r.savedState.cropData)a=r.savedState.cropData,console.log(`[CropperView] Usando savedState para crop ${t}:`,a);else{if(t!==re||!$e)throw new Error(`No hay datos de recorte para el crop "${r.label}". Ajusta el recorte antes de guardar.`);a=$e,console.log(`[CropperView] Usando cropData actual para crop activo ${t}:`,a)}if(!a.x&&0!==a.x||!a.y&&0!==a.y||!a.width||!a.height)throw new Error(`Datos de recorte inválidos para "${r.label}"`);if(!Ae?.naturalWidth||!Ae?.naturalHeight)throw new Error("Información de imagen no disponible");const{x:i,y:o,width:l,height:s}=a,{naturalWidth:c,naturalHeight:u}=Ae,d={x:i/c,y:o/u,width:l/c,height:s/u},m=Math.min(r.width,5e3),h=Math.min(r.height,5e3),f=`${r.label||"crop"}_${m}_${h}`,g=n||e.id,b=await fe(g,d,{name:f,width:m,height:h,format:globalThis.downloadFormat||"webp",quality:90});if(b)return pe?.announceSuccess(`Recorte creado: ${f}`),p?.(g,b),b;throw new Error("No se pudo crear la variante")},[ee,re,$e,Ae,fe,e.id,p,pe]),ut=r(async()=>{if(!ze){const e="No se puede exportar el recorte por restricciones de CORS en la imagen original.";return pe?.announceError(e),void alert(e)}if(!we.isReady){const e="El cropper aún no está inicializado. Espera un momento e inténtalo de nuevo.";return pe?.announceError(e),void alert(e)}He(),pe?.announce("Creando recorte de la imagen");try{let t=e.id,n=null;if(e.file&&f){pe?.announce("Subiendo imagen...");const r=await f(e.file);if(!r||!r.id)throw new Error("No se pudo subir la imagen al servidor");t=r.id,n=r,pe?.announceSuccess("Imagen subida correctamente")}const r=await ct(re,t);r&&o(n?{crops:[r],asset:n}:r)}catch(t){console.warn("Error creating crop variant:",t);const e=t.message||"No se pudo crear el recorte. Inténtalo de nuevo.";pe?.announceError(e),alert(e),m?.(t)}},[ze,we.isReady,pe,He,ct,re,o,m,e.file,e.id,f]),dt=r(async t=>{He(),pe?.announce(`Guardando ${t.length} recortes...`);try{let r=e.id,a=null;if(e.file&&f){pe?.announce("Subiendo imagen...");const t=await f(e.file);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");r=t.id,a=t,pe?.announceSuccess("Imagen subida correctamente")}const i=[],l=[];for(const e of t)try{const t=await ct(e,r);t&&i.push(t)}catch(n){l.push({crop:ee[e]?.label||`Crop ${e}`,error:n.message})}if(i.length>0&&(pe?.announceSuccess(`${i.length} recorte(s) guardado(s) correctamente`),o(a?{crops:i,asset:a}:i)),l.length>0){const e=`Errores al guardar algunos recortes:\n${l.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;pe?.announceError(e),alert(e)}}catch(n){const e=n.message||"Error al procesar los recortes";pe?.announceError(e),alert(e),m?.(n)}},[He,ct,ee,pe,o,e.file,e.id,f,m]),mt=r(async()=>{const e=Ge();if(-1!==e){const t=ee[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void ae(e)}if(ee.length>1){he("save");const e=ee.map((e,t)=>({crop:e,index:t})).filter(({crop:e,index:t})=>e.required||e.savedState||t===re).map(({index:e})=>e);return de(e),void ce(!0)}await ut()},[Ge,ee,ut,re]),ht=r(async t=>{const n=ee[t];if(!n)throw new Error(`Crop ${t} no encontrado`);if(!n.savedState&&t!==re)throw new Error(`El recorte "${n.label}" aún no ha sido configurado`);const r={index:re,imageTransform:Ne.current?.$getTransform?.(),selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null};try{if(t!==re&&n.savedState){if(console.log(`[CropperView] 🔄 Restaurando temporalmente crop ${t} para descarga...`),n.savedState.imageTransform&&Ne.current?.$setTransform){const[e,t,r,a,i,o]=n.savedState.imageTransform;Ne.current.$setTransform(e,t,r,a,i,o)}if(n.savedState.selectorState&&Ee.current){const{x:e,y:t,width:r,height:a}=n.savedState.selectorState;Ee.current.x=e,Ee.current.y=t,Ee.current.width=r,Ee.current.height=a,Ee.current.$render?.()}await new Promise(e=>setTimeout(e,100))}const r=await ke.toCanvas({width:n.width,height:n.height,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!r)throw new Error(`No se pudo generar el canvas para "${n.label}"`);const a=r.toDataURL(`image/${globalThis.downloadFormat||e.mime_type.split("/")[1]||"webp"}`,.9),i=`${(n.label||"crop").replace(/\.[^/.]+$/,"").replace(/\s+/g,"-").trim()}_${n.width}_${n.height}`;return await Gt(a,i,{accessibilityManager:pe,onSuccess:e=>{console.log(`✅ Descargado: ${e}`)},onError:e=>{throw new Error(`Error al descargar "${n.label}": ${e.message}`)}}),{crop:n.label,filename:i}}finally{if(t!==re&&r.imageTransform&&Ne.current?.$setTransform){console.log(`[CropperView] ↩️ Restaurando estado original del crop ${r.index}...`);const[e,t,n,a,i,o]=r.imageTransform;if(Ne.current.$setTransform(e,t,n,a,i,o),r.selectorState&&Ee.current){const{x:e,y:t,width:n,height:a}=r.selectorState;Ee.current.x=e,Ee.current.y=t,Ee.current.width=n,Ee.current.height=a,Ee.current.$render?.()}}}},[ee,re,ke,e.mime_type,pe,Ne,Ee]),pt=r(async e=>{He(),pe?.announce(`Descargando ${e.length} recortes...`);const t=[],n=[];for(const a of e)try{const e=await ht(a);e&&t.push(e)}catch(r){n.push({crop:ee[a]?.label||`Crop ${a}`,error:r.message})}if(t.length>0&&pe?.announceSuccess(`${t.length} recorte(s) descargado(s) correctamente`),n.length>0){const e=`Errores al descargar algunos recortes:\n${n.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;pe?.announceError(e),alert(e)}},[He,ht,ee,pe]),ft=r(async()=>{if(!ze){const e="No se puede descargar el recorte por restricciones de CORS en la imagen original.";return pe?.announceError(e),void alert(e)}He(),pe?.announce("Preparando descarga del recorte");try{await ht(re),pe?.announceSuccess("Recorte descargado correctamente")}catch(e){console.error("Error downloading crop:",e);const t=e.message||"Error al descargar el recorte";pe?.announceError(t),alert(t)}},[ze,pe,He,ht,re]),gt=r(async()=>{const e=Ge();if(-1!==e){const t=ee[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void ae(e)}if(ee.length>1){he("download");const e=ee.map((e,t)=>({crop:e,index:t})).filter(({crop:e,index:t})=>e.savedState||t===re).map(({index:e})=>e);return de(e),void ce(!0)}await ft()},[Ge,ee,ft,re]),bt=r(async()=>{if(e.file&&f)try{pe?.announce("Subiendo imagen original...");const t=await f(e.file);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");pe?.announceSuccess("Imagen guardada correctamente"),o({asset:t,crops:[]})}catch(t){console.error("Error guardando imagen original:",t);const e=t.message||"No se pudo guardar la imagen. Inténtalo de nuevo.";pe?.announceError(e),alert(e),m?.(t)}else u()},[e.file,f,u,o,m,pe]);return n(()=>{v(!1),x(null)},[e]),n(()=>{ye.manager&&we.isReady&&D&&(console.log("[CropperView] Carga inicial completada, centrando imagen y selector..."),setTimeout(()=>{Oe(),setTimeout(()=>{Re(),O(!1),console.log("[CropperView] Carga inicial finalizada")},100)},50))},[ye.manager,we.isReady,D,Oe,Re]),n(()=>{ye.manager&&we.isReady&&(oe&&ke.setAspectRatio(oe),Ce.setBackground(E))},[oe,E,ye.manager,we.isReady,ke,Ce]),n(()=>{if(!_e||!we.isReady||Z.mandatoryCrops.length>0)return;const e=ee[0];if(e&&"crop-default-0"===e.id&&(1920===e.width||1080===e.height)){const t=Math.min(_e.naturalWidth,5e3),n=Math.min(_e.naturalHeight,5e3);ne([{...e,width:t,height:n}]),console.log(`[CropperView] Crop por defecto actualizado a ${t}×${n}px`)}},[_e,we.isReady,Z.mandatoryCrops.length,ee]),n(()=>{if(!y||!ze)return;const e=setTimeout(async()=>{C(e=>!w&&!e||e);try{const e=await tt();e&&x(e)}finally{C(!1)}},300);return()=>{clearTimeout(e),C(!1)}},[$e,Te,y,ze,tt,oe,U,w]),n(()=>{const e=Se.current,t=t=>{if("Delete"===t.key||"Backspace"===t.key||"Backspace"===t.key&&t.metaKey||"Backspace"===t.key&&t.ctrlKey){const n=t.target;if(e&&(n===e||n===document.body||n===document.documentElement||"CROPPER-CANVAS"===n.tagName||"CROPPER-SELECTION"===n.tagName||"CROPPER-IMAGE"===n.tagName||"CROPPER-HANDLE"===n.tagName||"CROPPER-GRID"===n.tagName||n.closest("cropper-canvas")||e.contains(n)))return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1}};return document.addEventListener("keydown",t,!0),document.addEventListener("keyup",t,!0),window.addEventListener("keydown",t,!0),e&&e.addEventListener("keydown",t,!0),()=>{document.removeEventListener("keydown",t,!0),document.removeEventListener("keyup",t,!0),window.removeEventListener("keydown",t,!0),e&&e.removeEventListener("keydown",t,!0)}},[Se]),e?/* @__PURE__ */s("div",{className:"limbo-cropper-view px-2 border-2 border-gray-200/50 rounded-lg max-w-7xl mx-auto w-full min-w-full h-full min-h-full flex flex-col",children:[
228
+ /* @__PURE__ */s("div",{className:"limbo-tab-content px-2 py-2",role:"tabpanel",id:`upload-tabpanel-${u}`,"aria-labelledby":`upload-tab-${u}`,children:["upload"===u&&/* @__PURE__ */l(Q,{file:m,setFile:h,previewUrl:p,setPreviewUrl:f,fileInputRef:g,onSelect:e,disabled:n}),"ai"===u&&/* @__PURE__ */l(ne,{apiKey:r,prod:i,disabled:n,onSelect:e}),"stock"===u&&/* @__PURE__ */l(oe,{apiKey:r,prod:i,disabled:n,onSelect:e}),"portals"===u&&/* @__PURE__ */l(de,{apiKey:r,prod:i,disabled:n,onSelect:e})]})]})}const pe="undefined"!=typeof window&&void 0!==window.document,fe=pe?window:{},ge=!!pe&&"ontouchstart"in fe.document.documentElement,be=!!pe&&"PointerEvent"in fe,ye="cropper",ve=`${ye}-canvas`,we=`${ye}-crosshair`,xe=`${ye}-grid`,ke=`${ye}-handle`,Ce=`${ye}-image`,Se=`${ye}-selection`,Ne=`${ye}-shade`,Ee=`${ye}-viewer`,$e="select",_e="move",ze="scale",Te="rotate",Ae="transform",Pe="none",Me="n-resize",Ie="e-resize",Le="s-resize",De="w-resize",Oe="ne-resize",Re="nw-resize",je="se-resize",Fe="sw-resize",Ue=be?"pointerdown":ge?"touchstart":"mousedown",qe=be?"pointermove":ge?"touchmove":"mousemove",Be=be?"pointerup pointercancel":ge?"touchend touchcancel":"mouseup",We="error",Ve="keydown",He="load",Ke="wheel",Ge="action",Qe="actionend",Ye="actionstart",Xe="change",Je="transform";const Ze=Number.isNaN||fe.isNaN;function et(e){return"number"==typeof e&&!Ze(e)}function tt(e){return et(e)&&e>0&&e<1/0}function nt(e){return"object"==typeof e&&null!==e}const{hasOwnProperty:rt}=Object.prototype;function at(e){if(!nt(e))return!1;try{const{constructor:t}=e,{prototype:n}=t;return t&&n&&rt.call(n,"isPrototypeOf")}catch(t){return!1}}function it(e){return"function"==typeof e}function ot(e){return"object"==typeof e&&null!==e&&1===e.nodeType}const lt=/([a-z\d])([A-Z])/g;function st(e){return String(e).replace(lt,"$1-$2").toLowerCase()}const ct=/-[A-z\d]/g;function ut(e){return e.replace(ct,e=>e.slice(1).toUpperCase())}const dt=/\s\s*/;function mt(e,t,n,r){t.trim().split(dt).forEach(t=>{e.removeEventListener(t,n,r)})}function ht(e,t,n,r){t.trim().split(dt).forEach(t=>{e.addEventListener(t,n,r)})}function pt(e,t,n,r){ht(e,t,n,Object.assign(Object.assign({},r),{once:!0}))}const ft={bubbles:!0,cancelable:!0,composed:!0};const gt=Promise.resolve();function bt(e){const{documentElement:t}=e.ownerDocument,n=e.getBoundingClientRect();return{left:n.left+(fe.pageXOffset-t.clientLeft),top:n.top+(fe.pageYOffset-t.clientTop)}}const yt=/deg|g?rad|turn$/i;function vt(e){const t=parseFloat(e)||0;if(0!==t){const[n="rad"]=String(e).match(yt)||[];switch(n.toLowerCase()){case"deg":return t/360*(2*Math.PI);case"grad":return t/400*(2*Math.PI);case"turn":return t*(2*Math.PI)}}return t}const wt="contain";function xt(e,t=wt){const{aspectRatio:n}=e;let{width:r,height:a}=e;const i=tt(r),o=tt(a);if(i&&o){const e=a*n;t===wt&&e>r||"cover"===t&&e<r?a=r/n:r=a*n}else i?a=r/n:o&&(r=a*n);return{width:r,height:a}}function kt(e,...t){if(0===t.length)return e;const[n,r,a,i,o,l]=e,[s,c,u,d,m,h]=t[0];return kt(e=[n*s+a*c,r*s+i*c,n*u+a*d,r*u+i*d,n*m+a*h+o,r*m+i*h+l],...t.slice(1))}const Ct=/left|top|width|height/i,St="open",Nt=/* @__PURE__ */new WeakMap,Et=/* @__PURE__ */new WeakMap,$t=/* @__PURE__ */new Map,_t=fe.document&&Array.isArray(fe.document.adoptedStyleSheets)&&"replaceSync"in fe.CSSStyleSheet.prototype;class zt extends HTMLElement{get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}constructor(){var e,t;super(),this.shadowRootMode=St,this.slottable=!0;const n=null===(t=null===(e=Object.getPrototypeOf(this))||void 0===e?void 0:e.constructor)||void 0===t?void 0:t.$name;n&&$t.set(n,this.tagName.toLowerCase())}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(e,t,n){if(Object.is(n,t))return;const r=ut(e);let a=n;switch(typeof this[r]){case"boolean":a=null!==n&&"false"!==n;break;case"number":a=Number(n)}switch(this[r]=a,e){case"theme-color":{const e=Et.get(this),t=this.$sharedStyle;e&&t&&(_t?e.replaceSync(t):e.textContent=t);break}}}$propertyChangedCallback(e,t,n){if(!Object.is(n,t))switch(e=st(e),typeof n){case"boolean":!0===n?this.hasAttribute(e)||this.setAttribute(e,""):this.removeAttribute(e);break;case"number":n=Ze(n)?"":String(n);default:n?this.getAttribute(e)!==n&&this.setAttribute(e,n):this.removeAttribute(e)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach(e=>{const t=ut(e);let n=this[t];(function(e){return void 0===e})(n)||this.$propertyChangedCallback(t,void 0,n),Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>n,set(e){const r=n;n=e,this.$propertyChangedCallback(t,r,e)}})});const e=this.shadowRoot||this.attachShadow({mode:this.shadowRootMode||St});if(Nt.set(this,e),Et.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const t=document.createElement("template");t.innerHTML=this.$template,e.appendChild(t.content)}if(this.slottable){const t=document.createElement("slot");e.appendChild(t)}}disconnectedCallback(){Et.has(this)&&Et.delete(this),Nt.has(this)&&Nt.delete(this)}$getTagNameOf(e){var t;return null!==(t=$t.get(e))&&void 0!==t?t:e}$setStyles(e){return Object.keys(e).forEach(t=>{let n=e[t];et(n)&&(n=0!==n&&Ct.test(t)?`${n}px`:String(n)),this.style[t]=n}),this}$getShadowRoot(){return this.shadowRoot||Nt.get(this)}$addStyles(e){let t;const n=this.$getShadowRoot();return _t?(t=new CSSStyleSheet,t.replaceSync(e),n.adoptedStyleSheets=n.adoptedStyleSheets.concat(t)):(t=document.createElement("style"),t.textContent=e,n.appendChild(t)),t}$emit(e,t,n){return function(e,t,n,r){return e.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},ft),{detail:n}),r)))}(this,e,t,n)}$nextTick(e){return function(e,t){return t?gt.then(e?t.bind(e):t):gt}(this,e)}static $define(e,t){nt(e)&&(t=e,e=""),e||(e=this.$name||this.name),e=st(e),pe&&fe.customElements&&!fe.customElements.get(e)&&customElements.define(e,this,t)}}zt.$version="2.1.0";class Tt extends zt{constructor(){super(...arguments),this.$onPointerDown=null,this.$onPointerMove=null,this.$onPointerUp=null,this.$onWheel=null,this.$wheeling=!1,this.$pointers=/* @__PURE__ */new Map,this.$style=':host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:"";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}',this.$action=Pe,this.background=!1,this.disabled=!1,this.scaleStep=.1,this.themeColor="#39f"}static get observedAttributes(){return super.observedAttributes.concat(["background","disabled","scale-step"])}connectedCallback(){super.connectedCallback(),this.disabled||this.$bind()}disconnectedCallback(){this.disabled||this.$unbind(),super.disconnectedCallback()}$propertyChangedCallback(e,t,n){if(!Object.is(n,t)&&(super.$propertyChangedCallback(e,t,n),"disabled"===e))n?this.$unbind():this.$bind()}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),ht(this,Ue,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),ht(this.ownerDocument,qe,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),ht(this.ownerDocument,Be,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),ht(this,Ke,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(mt(this,Ue,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(mt(this.ownerDocument,qe,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(mt(this.ownerDocument,Be,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(mt(this,Ke,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(e){const{buttons:t,button:n,type:r}=e;if(this.disabled||("pointerdown"===r&&"mouse"===e.pointerType||"mousedown"===r)&&(et(t)&&1!==t||et(n)&&0!==n||e.ctrlKey))return;const{$pointers:a}=this;let i="";if(e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:n})=>{a.set(e,{startX:t,startY:n,endX:t,endY:n})});else{const{pointerId:t=0,pageX:n,pageY:r}=e;a.set(t,{startX:n,startY:r,endX:n,endY:r})}a.size>1?i=Ae:ot(e.target)&&(i=e.target.action||e.target.getAttribute("action")||""),!1!==this.$emit(Ye,{action:i,relatedEvent:e})&&(e.preventDefault(),this.$action=i,this.style.willChange="transform")}$handlePointerMove(e){const{$action:t,$pointers:n}=this;if(this.disabled||t===Pe||0===n.size)return;if(!1===this.$emit("actionmove",{action:t,relatedEvent:e}))return;if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:r})=>{const a=n.get(e);a&&Object.assign(a,{endX:t,endY:r})});else{const{pointerId:t=0,pageX:r,pageY:a}=e,i=n.get(t);i&&Object.assign(i,{endX:r,endY:a})}const r={action:t,relatedEvent:e};if(t===Ae){const t=new Map(n);let a=0,i=0,o=0,l=0,s=e.pageX,c=e.pageY;n.forEach((e,n)=>{t.delete(n),t.forEach(t=>{let n=t.startX-e.startX,r=t.startY-e.startY,u=t.endX-e.endX,d=t.endY-e.endY,m=0,h=0,p=0,f=0;if(0===n?r<0?p=2*Math.PI:r>0&&(p=Math.PI):n>0?p=Math.PI/2+Math.atan(r/n):n<0&&(p=1.5*Math.PI+Math.atan(r/n)),0===u?d<0?f=2*Math.PI:d>0&&(f=Math.PI):u>0?f=Math.PI/2+Math.atan(d/u):u<0&&(f=1.5*Math.PI+Math.atan(d/u)),f>0||p>0){const n=f-p,r=Math.abs(n);r>a&&(a=r,o=n,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}if(n=Math.abs(n),r=Math.abs(r),u=Math.abs(u),d=Math.abs(d),n>0&&r>0?m=Math.sqrt(n*n+r*r):n>0?m=n:r>0&&(m=r),u>0&&d>0?h=Math.sqrt(u*u+d*d):u>0?h=u:d>0&&(h=d),m>0&&h>0){const n=(h-m)/m,r=Math.abs(n);r>i&&(i=r,l=n,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}})});const u=a>0,d=i>0;u&&d?(r.rotate=o,r.scale=l,r.centerX=s,r.centerY=c):u?(r.action=Te,r.rotate=o,r.centerX=s,r.centerY=c):d?(r.action=ze,r.scale=l,r.centerX=s,r.centerY=c):r.action=Pe}else{const[e]=Array.from(n.values());Object.assign(r,e)}n.forEach(e=>{e.startX=e.endX,e.startY=e.endY}),r.action!==Pe&&this.$emit(Ge,r,{cancelable:!1})}$handlePointerUp(e){const{$action:t,$pointers:n}=this;if(!this.disabled&&t!==Pe&&!1!==this.$emit(Qe,{action:t,relatedEvent:e})){if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e})=>{n.delete(e)});else{const{pointerId:t=0}=e;n.delete(t)}0===n.size&&(this.style.willChange="",this.$action=Pe)}}$handleWheel(e){if(this.disabled)return;if(e.preventDefault(),this.$wheeling)return;this.$wheeling=!0,setTimeout(()=>{this.$wheeling=!1},50);const t=(e.deltaY>0?-1:1)*this.scaleStep;this.$emit(Ge,{action:ze,scale:t,relatedEvent:e},{cancelable:!1})}$setAction(e){return"string"==typeof e&&(this.$action=e),this}$toCanvas(e){return new Promise((t,n)=>{if(!this.isConnected)return void n(new Error("The current element is not connected to the DOM."));const r=document.createElement("canvas");let a=this.offsetWidth,i=this.offsetHeight,o=1;at(e)&&(tt(e.width)||tt(e.height))&&(({width:a,height:i}=xt({aspectRatio:a/i,width:e.width,height:e.height})),o=a/this.offsetWidth),r.width=a,r.height=i;const l=this.querySelector(this.$getTagNameOf(Ce));l?l.$ready().then(n=>{const s=r.getContext("2d");if(s){const[t,c,u,d,m,h]=l.$getTransform();let p=m,f=h,g=n.naturalWidth,b=n.naturalHeight;1!==o&&(p*=o,f*=o,g*=o,b*=o);const y=g/2,v=b/2;s.fillStyle="transparent",s.fillRect(0,0,a,i),at(e)&&it(e.beforeDraw)&&e.beforeDraw.call(this,s,r),s.save(),s.translate(y,v),s.transform(t,c,u,d,p,f),s.translate(-y,-v),s.drawImage(n,0,0,g,b),s.restore()}t(r)}).catch(n):t(r)})}}Tt.$name=ve,Tt.$version="2.1.0";const At=/* @__PURE__ */new WeakMap,Pt=["alt","crossorigin","decoding","elementtiming","fetchpriority","loading","referrerpolicy","sizes","src","srcset"];class Mt extends zt{constructor(){super(...arguments),this.$matrix=[1,0,0,1,0,0],this.$onLoad=null,this.$onCanvasAction=null,this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$actionStartTarget=null,this.$style=":host{display:inline-block}img{display:block;height:100%;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}",this.$image=new Image,this.initialCenterSize="contain",this.rotatable=!1,this.scalable=!1,this.skewable=!1,this.slottable=!1,this.translatable=!1,this.alt="",this.crossorigin="",this.decoding="",this.elementtiming="",this.fetchpriority="",this.loading="",this.referrerpolicy="",this.sizes="",this.src="",this.srcset=""}set $canvas(e){At.set(this,e)}get $canvas(){return At.get(this)}static get observedAttributes(){return super.observedAttributes.concat(Pt,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(e,t,n){Object.is(n,t)||(super.attributeChangedCallback(e,t,n),Pt.includes(e)&&this.$image.setAttribute(e,n))}$propertyChangedCallback(e,t,n){if(!Object.is(n,t)&&(super.$propertyChangedCallback(e,t,n),"initialCenterSize"===e))this.$nextTick(()=>{this.$center(n)})}connectedCallback(){super.connectedCallback();const{$image:e}=this,t=this.closest(this.$getTagNameOf(ve));t&&(this.$canvas=t,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=e=>{var t,n;this.$actionStartTarget=null===(n=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===n?void 0:n.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),ht(t,Ye,this.$onCanvasActionStart),ht(t,Qe,this.$onCanvasActionEnd),ht(t,Ge,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),ht(e,He,this.$onLoad),this.$getShadowRoot().appendChild(e)}disconnectedCallback(){const{$image:e,$canvas:t}=this;t&&(this.$onCanvasActionStart&&(mt(t,Ye,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(mt(t,Qe,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(mt(t,Ge,this.$onCanvasAction),this.$onCanvasAction=null)),e&&this.$onLoad&&(mt(e,He,this.$onLoad),this.$onLoad=null),this.$getShadowRoot().removeChild(e),super.disconnectedCallback()}$handleLoad(){const{$image:e}=this;this.$setStyles({width:e.naturalWidth,height:e.naturalHeight}),this.$canvas&&this.$center(this.initialCenterSize)}$handleAction(e){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:t}=this,{detail:n}=e;if(n){const{relatedEvent:e}=n;let{action:r}=n;switch(r!==Ae||this.rotatable&&this.scalable||(r=this.rotatable?Te:this.scalable?ze:Pe),r){case _e:if(this.translatable){let r=null;e&&(r=e.target.closest(this.$getTagNameOf(Se))),r||(r=t.querySelector(this.$getTagNameOf(Se))),r&&r.multiple&&!r.active&&(r=t.querySelector(`${this.$getTagNameOf(Se)}[active]`)),r&&!r.hidden&&r.movable&&!r.dynamic&&this.$actionStartTarget&&r.contains(this.$actionStartTarget)||this.$move(n.endX-n.startX,n.endY-n.startY)}break;case Te:if(this.rotatable)if(e){const{x:t,y:r}=this.getBoundingClientRect();this.$rotate(n.rotate,e.clientX-t,e.clientY-r)}else this.$rotate(n.rotate);break;case ze:if(this.scalable)if(e){const t=e.target.closest(this.$getTagNameOf(Se));if(!t||!t.zoomable||t.zoomable&&t.dynamic){const{x:t,y:r}=this.getBoundingClientRect();this.$zoom(n.scale,e.clientX-t,e.clientY-r)}}else this.$zoom(n.scale);break;case Ae:if(this.rotatable&&this.scalable){const{rotate:t}=n;let{scale:r}=n;r<0?r=1/(1-r):r+=1;const a=Math.cos(t),i=Math.sin(t),[o,l,s,c]=[a*r,i*r,-i*r,a*r];if(e){const t=this.getBoundingClientRect(),n=e.clientX-t.x,r=e.clientY-t.y,[a,i,u,d]=this.$matrix,m=n-t.width/2,h=r-t.height/2,p=(m*d-u*h)/(a*d-u*i),f=(h*a-i*m)/(a*d-u*i);this.$transform(o,l,s,c,p*(1-o)+f*s,f*(1-c)+p*l)}else this.$transform(o,l,s,c,0,0)}}}}$ready(e){const{$image:t}=this,n=new Promise((e,n)=>{const r=new Error("Failed to load the image source");if(t.complete)t.naturalWidth>0&&t.naturalHeight>0?e(t):n(r);else{const a=()=>{mt(t,We,i),setTimeout(()=>{e(t)})},i=()=>{mt(t,He,a),n(r)};pt(t,He,a),pt(t,We,i)}});return it(e)&&n.then(t=>(e(t),t)),n}$center(e){const{parentElement:t}=this;if(!t)return this;const n=t.getBoundingClientRect(),r=n.width,a=n.height,{x:i,y:o,width:l,height:s}=this.getBoundingClientRect(),c=i+l/2,u=o+s/2,d=n.x+r/2,m=n.y+a/2;if(this.$move(d-c,m-u),e&&(l!==r||s!==a)){const t=r/l,n=a/s;switch(e){case"cover":this.$scale(Math.max(t,n));break;case"contain":this.$scale(Math.min(t,n))}}return this}$move(e,t=e){if(this.translatable&&et(e)&&et(t)){const[n,r,a,i]=this.$matrix,o=(e*i-a*t)/(n*i-a*r),l=(t*n-r*e)/(n*i-a*r);this.$translate(o,l)}return this}$moveTo(e,t=e){if(this.translatable&&et(e)&&et(t)){const[n,r,a,i]=this.$matrix,o=(e*i-a*t)/(n*i-a*r),l=(t*n-r*e)/(n*i-a*r);this.$setTransform(n,r,a,i,o,l)}return this}$rotate(e,t,n){if(this.rotatable){const r=vt(e),a=Math.cos(r),i=Math.sin(r),[o,l,s,c]=[a,i,-i,a];if(et(t)&&et(n)){const[e,r,a,i]=this.$matrix,{width:u,height:d}=this.getBoundingClientRect(),m=t-u/2,h=n-d/2,p=(m*i-a*h)/(e*i-a*r),f=(h*e-r*m)/(e*i-a*r);this.$transform(o,l,s,c,p*(1-o)-f*s,f*(1-c)-p*l)}else this.$transform(o,l,s,c,0,0)}return this}$zoom(e,t,n){if(!this.scalable||0===e)return this;if(e<0?e=1/(1-e):e+=1,et(t)&&et(n)){const[r,a,i,o]=this.$matrix,{width:l,height:s}=this.getBoundingClientRect(),c=t-l/2,u=n-s/2,d=(c*o-i*u)/(r*o-i*a),m=(u*r-a*c)/(r*o-i*a);this.$transform(e,0,0,e,d*(1-e),m*(1-e))}else this.$scale(e);return this}$scale(e,t=e){return this.scalable&&this.$transform(e,0,0,t,0,0),this}$skew(e,t=0){if(this.skewable){const n=vt(e),r=vt(t);this.$transform(1,Math.tan(r),Math.tan(n),1,0,0)}return this}$translate(e,t=e){return this.translatable&&et(e)&&et(t)&&this.$transform(1,0,0,1,e,t),this}$transform(e,t,n,r,a,i){return et(e)&&et(t)&&et(n)&&et(r)&&et(a)&&et(i)?this.$setTransform(kt(this.$matrix,[e,t,n,r,a,i])):this}$setTransform(e,t,n,r,a,i){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(e)&&([e,t,n,r,a,i]=e),et(e)&&et(t)&&et(n)&&et(r)&&et(a)&&et(i))){const o=[...this.$matrix],l=[e,t,n,r,a,i];if(!1===this.$emit(Je,{matrix:l,oldMatrix:o}))return this;this.$matrix=l,this.style.transform=`matrix(${l.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}Mt.$name=Ce,Mt.$version="2.1.0";const It=/* @__PURE__ */new WeakMap;class Lt extends zt{constructor(){super(...arguments),this.$onCanvasActionEnd=null,this.$onCanvasActionStart=null,this.$onSelectionChange=null,this.$style=":host{display:block;height:0;left:0;outline:var(--theme-color) solid 1px;position:relative;top:0;width:0}:host([transparent]){outline-color:transparent}",this.x=0,this.y=0,this.width=0,this.height=0,this.slottable=!1,this.themeColor="rgba(0, 0, 0, 0.65)"}set $canvas(e){It.set(this,e)}get $canvas(){return It.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(ve));if(e){this.$canvas=e,this.style.position="absolute";const t=e.querySelector(this.$getTagNameOf(Se));t&&(this.$onCanvasActionStart=e=>{t.hidden&&e.detail.action===$e&&(this.hidden=!1)},this.$onCanvasActionEnd=e=>{t.hidden&&e.detail.action===$e&&(this.hidden=!0)},this.$onSelectionChange=e=>{const{x:n,y:r,width:a,height:i}=e.defaultPrevented?t:e.detail;this.$change(n,r,a,i),(t.hidden||0===n&&0===r&&0===a&&0===i)&&(this.hidden=!0)},ht(e,Ye,this.$onCanvasActionStart),ht(e,Qe,this.$onCanvasActionEnd),ht(e,Xe,this.$onSelectionChange))}this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(mt(e,Ye,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(mt(e,Qe,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onSelectionChange&&(mt(e,Xe,this.$onSelectionChange),this.$onSelectionChange=null)),super.disconnectedCallback()}$change(e,t,n=this.width,r=this.height){return et(e)&&et(t)&&et(n)&&et(r)&&(e!==this.x||t!==this.y||n!==this.width||r!==this.height)?(this.hidden&&(this.hidden=!1),this.x=e,this.y=t,this.width=n,this.height=r,this.$render()):this}$reset(){return this.$change(0,0,0,0)}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height,outlineWidth:fe.innerWidth})}}Lt.$name=Ne,Lt.$version="2.1.0";class Dt extends zt{constructor(){super(...arguments),this.$onCanvasCropEnd=null,this.$onCanvasCropStart=null,this.$style=':host{background-color:var(--theme-color);display:block}:host([action=move]),:host([action=select]){height:100%;left:0;position:absolute;top:0;width:100%}:host([action=move]){cursor:move}:host([action=select]){cursor:crosshair}:host([action$=-resize]){background-color:transparent;height:15px;position:absolute;width:15px}:host([action$=-resize]):after{background-color:var(--theme-color);content:"";display:block;height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:5px}:host([action=n-resize]),:host([action=s-resize]){cursor:ns-resize;left:50%;transform:translateX(-50%);width:100%}:host([action=n-resize]){top:-8px}:host([action=s-resize]){bottom:-8px}:host([action=e-resize]),:host([action=w-resize]){cursor:ew-resize;height:100%;top:50%;transform:translateY(-50%)}:host([action=e-resize]){right:-8px}:host([action=w-resize]){left:-8px}:host([action=ne-resize]){cursor:nesw-resize;right:-8px;top:-8px}:host([action=nw-resize]){cursor:nwse-resize;left:-8px;top:-8px}:host([action=se-resize]){bottom:-8px;cursor:nwse-resize;right:-8px}:host([action=se-resize]):after{height:15px;width:15px}@media (pointer:coarse){:host([action=se-resize]):after{height:10px;width:10px}}@media (pointer:fine){:host([action=se-resize]):after{height:5px;width:5px}}:host([action=sw-resize]){bottom:-8px;cursor:nesw-resize;left:-8px}:host([plain]){background-color:transparent}',this.action=Pe,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}Dt.$name=ke,Dt.$version="2.1.0";const Ot=/* @__PURE__ */new WeakMap;class Rt extends zt{constructor(){super(...arguments),this.$onCanvasAction=null,this.$onCanvasActionStart=null,this.$onCanvasActionEnd=null,this.$onDocumentKeyDown=null,this.$action="",this.$actionStartTarget=null,this.$changing=!1,this.$style=':host{display:block;left:0;position:relative;right:0}:host([outlined]){outline:1px solid var(--theme-color)}:host([multiple]){outline:1px dashed hsla(0,0%,100%,.5)}:host([multiple]):after{bottom:0;content:"";cursor:pointer;display:block;left:0;position:absolute;right:0;top:0}:host([multiple][active]){outline-color:var(--theme-color);z-index:1}:host([multiple])>*{visibility:hidden}:host([multiple][active])>*{visibility:visible}:host([multiple][active]):after{display:none}',this.$initialSelection={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.width=0,this.height=0,this.aspectRatio=NaN,this.initialAspectRatio=NaN,this.initialCoverage=NaN,this.active=!1,this.linked=!1,this.dynamic=!1,this.movable=!1,this.resizable=!1,this.zoomable=!1,this.multiple=!1,this.keyboard=!1,this.outlined=!1,this.precise=!1}set $canvas(e){Ot.set(this,e)}get $canvas(){return Ot.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["active","aspect-ratio","dynamic","height","initial-aspect-ratio","initial-coverage","keyboard","linked","movable","multiple","outlined","precise","resizable","width","x","y","zoomable"])}$propertyChangedCallback(e,t,n){if(!Object.is(n,t))switch(super.$propertyChangedCallback(e,t,n),e){case"x":case"y":case"width":case"height":this.$changing||this.$nextTick(()=>{this.$change(this.x,this.y,this.width,this.height,this.aspectRatio,!0)});break;case"aspectRatio":case"initialAspectRatio":this.$nextTick(()=>{this.$initSelection()});break;case"initialCoverage":this.$nextTick(()=>{tt(n)&&n<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(n?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),ht(this.ownerDocument,Ve,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(mt(this.ownerDocument,Ve,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>{if(this.$canvas){const e=this.$getSelections();n?(e.forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Xe,{x:this.x,y:this.y,width:this.width,height:this.height})):(this.active=!1,e.slice(1).forEach(e=>{this.$removeSelection(e)}))}});break;case"precise":this.$nextTick(()=>{this.$change(this.x,this.y)});break;case"linked":n&&(this.dynamic=!0)}}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(ve));e?(this.$canvas=e,this.$setStyles({position:"absolute",transform:`translate(${this.x}px, ${this.y}px)`}),this.hidden||this.$render(),this.$initSelection(!0),this.$onCanvasActionStart=this.$handleActionStart.bind(this),this.$onCanvasActionEnd=this.$handleActionEnd.bind(this),this.$onCanvasAction=this.$handleAction.bind(this),ht(e,Ye,this.$onCanvasActionStart),ht(e,Qe,this.$onCanvasActionEnd),ht(e,Ge,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(mt(e,Ye,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(mt(e,Qe,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(mt(e,Ge,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let e=[];return this.parentElement&&(e=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(Se)))),e}$initSelection(e=!1,t=!1){const{initialCoverage:n,parentElement:r}=this;if(tt(n)&&r){const a=this.aspectRatio||this.initialAspectRatio;let i=(t?0:this.width)||r.offsetWidth*n,o=(t?0:this.height)||r.offsetHeight*n;tt(a)&&({width:i,height:o}=xt({aspectRatio:a,width:i,height:o})),this.$change(this.x,this.y,i,o),e&&this.$center(),this.$initialSelection={x:this.x,y:this.y,width:this.width,height:this.height}}}$createSelection(){const e=this.cloneNode(!0);return this.hasAttribute("id")&&e.removeAttribute("id"),e.initialCoverage=NaN,this.active=!1,this.parentElement&&this.parentElement.insertBefore(e,this.nextSibling),e}$removeSelection(e=this){if(this.parentElement){const t=this.$getSelections();if(t.length>1){const n=t.indexOf(e),r=t[n+1]||t[n-1];r&&(e.active=!1,this.parentElement.removeChild(e),r.active=!0,r.$emit(Xe,{x:r.x,y:r.y,width:r.width,height:r.height}))}else this.$clear()}}$handleActionStart(e){var t,n;const r=null===(n=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===n?void 0:n.target;this.$action="",this.$actionStartTarget=r,!this.hidden&&this.multiple&&!this.active&&r===this&&this.parentElement&&(this.$getSelections().forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Xe,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(e){const{currentTarget:t,detail:n}=e;if(!t||!n)return;const{relatedEvent:r}=n;let{action:a}=n;const i=r?function(e){if("function"==typeof e.composedPath)return e.composedPath().find(ot)||e.target;return e.target}(r):null;if(!a&&this.multiple&&(a=this.$action||(null==i?void 0:i.action),this.$action=a),!a||this.hidden&&a!==$e||this.multiple&&!this.active&&a!==ze)return;const{width:o,height:l}=this;let s=n.endX-n.startX,c=n.endY-n.startY,{aspectRatio:u}=this;switch(!tt(u)&&r.shiftKey&&(u=tt(o)&&tt(l)?o/l:1),a){case $e:if(0!==s||0!==c){0===s?s=c:0===c&&(c=s);const{$canvas:e}=this,r=bt(t);(this.multiple&&!this.hidden?this.$createSelection():this).$change(n.startX-r.left,n.startY-r.top,Math.abs(s),Math.abs(c),u),s<0?c<0?a=Re:c>0&&(a=Fe):s>0&&(c<0?a=Oe:c>0&&(a=je)),e&&(e.$action=a)}break;case _e:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(s,c);break;case ze:if(r&&this.zoomable&&(this.dynamic||this.contains(r.target))){const e=bt(t);this.$zoom(n.scale,r.pageX-e.left,r.pageY-e.top)}break;default:this.$resize(a,s,c,u)}}$handleActionEnd(){this.$action="",this.$actionStartTarget=null}$handleKeyDown(e){if(this.hidden||!this.keyboard||this.multiple&&!this.active||e.defaultPrevented)return;const{activeElement:t}=document;if(!t||!["INPUT","TEXTAREA"].includes(t.tagName)&&!["true","plaintext-only"].includes(t.contentEditable))switch(e.key){case"Backspace":e.metaKey&&(e.preventDefault(),this.$removeSelection());break;case"Delete":e.preventDefault(),this.$removeSelection();break;case"ArrowLeft":e.preventDefault(),this.$move(-1,0);break;case"ArrowRight":e.preventDefault(),this.$move(1,0);break;case"ArrowUp":e.preventDefault(),this.$move(0,-1);break;case"ArrowDown":e.preventDefault(),this.$move(0,1);break;case"+":e.preventDefault(),this.$zoom(.1);break;case"-":e.preventDefault(),this.$zoom(-.1)}}$center(){const{parentElement:e}=this;if(!e)return this;const t=(e.offsetWidth-this.width)/2,n=(e.offsetHeight-this.height)/2;return this.$change(t,n)}$move(e,t=e){return this.$moveTo(this.x+e,this.y+t)}$moveTo(e,t=e){return this.movable?this.$change(e,t):this}$resize(e,t=0,n=0,r=this.aspectRatio){if(!this.resizable)return this;const a=tt(r),{$canvas:i}=this;let{x:o,y:l,width:s,height:c}=this;switch(e){case Me:l+=n,c-=n,c<0&&(e=Le,c=-c,l-=c),a&&(o+=(t=n*r)/2,s-=t,s<0&&(s=-s,o-=s));break;case Ie:s+=t,s<0&&(e=De,s=-s,o-=s),a&&(l-=(n=t/r)/2,c+=n,c<0&&(c=-c,l-=c));break;case Le:c+=n,c<0&&(e=Me,c=-c,l-=c),a&&(o-=(t=n*r)/2,s+=t,s<0&&(s=-s,o-=s));break;case De:o+=t,s-=t,s<0&&(e=Ie,s=-s,o-=s),a&&(l+=(n=t/r)/2,c-=n,c<0&&(c=-c,l-=c));break;case Oe:a&&(n=-t/r),l+=n,c-=n,s+=t,s<0&&c<0?(e=Fe,s=-s,c=-c,o-=s,l-=c):s<0?(e=Re,s=-s,o-=s):c<0&&(e=je,c=-c,l-=c);break;case Re:a&&(n=t/r),o+=t,l+=n,s-=t,c-=n,s<0&&c<0?(e=je,s=-s,c=-c,o-=s,l-=c):s<0?(e=Oe,s=-s,o-=s):c<0&&(e=Fe,c=-c,l-=c);break;case je:a&&(n=t/r),s+=t,c+=n,s<0&&c<0?(e=Re,s=-s,c=-c,o-=s,l-=c):s<0?(e=Fe,s=-s,o-=s):c<0&&(e=Oe,c=-c,l-=c);break;case Fe:a&&(n=-t/r),o+=t,s-=t,c+=n,s<0&&c<0?(e=Oe,s=-s,c=-c,o-=s,l-=c):s<0?(e=je,s=-s,o-=s):c<0&&(e=Re,c=-c,l-=c)}return i&&i.$setAction(e),this.$change(o,l,s,c)}$zoom(e,t,n){if(!this.zoomable||0===e)return this;e<0?e=1/(1-e):e+=1;const{width:r,height:a}=this,i=r*e,o=a*e;let l=this.x,s=this.y;return et(t)&&et(n)?(l-=(i-r)*((t-this.x)/r),s-=(o-a)*((n-this.y)/a)):(l-=(i-r)/2,s-=(o-a)/2),this.$change(l,s,i,o)}$change(e,t,n=this.width,r=this.height,a=this.aspectRatio,i=!1){return this.$changing||!et(e)||!et(t)||!et(n)||!et(r)||n<0||r<0?this:(tt(a)&&({width:n,height:r}=xt({aspectRatio:a,width:n,height:r},"cover")),this.precise||(e=Math.round(e),t=Math.round(t),n=Math.round(n),r=Math.round(r)),e===this.x&&t===this.y&&n===this.width&&r===this.height&&Object.is(a,this.aspectRatio)&&!i?this:(this.hidden&&(this.hidden=!1),!1===this.$emit(Xe,{x:e,y:t,width:n,height:r})?this:(this.$changing=!0,this.x=e,this.y=t,this.width=n,this.height=r,this.$changing=!1,this.$render())))}$reset(){const{x:e,y:t,width:n,height:r}=this.$initialSelection;return this.$change(e,t,n,r)}$clear(){return this.$change(0,0,0,0,NaN,!0),this.hidden=!0,this}$render(){return this.$setStyles({transform:`translate(${this.x}px, ${this.y}px)`,width:this.width,height:this.height})}$toCanvas(e){return new Promise((t,n)=>{if(!this.isConnected)return void n(new Error("The current element is not connected to the DOM."));const r=document.createElement("canvas");let{width:a,height:i}=this,o=1;if(at(e)&&(tt(e.width)||tt(e.height))&&(({width:a,height:i}=xt({aspectRatio:a/i,width:e.width,height:e.height})),o=a/this.width),r.width=a,r.height=i,!this.$canvas)return void t(r);const l=this.$canvas.querySelector(this.$getTagNameOf(Ce));l?l.$ready().then(n=>{const s=r.getContext("2d");if(s){const[t,c,u,d,m,h]=l.$getTransform(),p=-this.x,f=-this.y,g=(p*d-u*f)/(t*d-u*c),b=(f*t-c*p)/(t*d-u*c);let y=t*g+u*b+m,v=c*g+d*b+h,w=n.naturalWidth,x=n.naturalHeight;1!==o&&(y*=o,v*=o,w*=o,x*=o);const k=w/2,C=x/2;s.fillStyle="transparent",s.fillRect(0,0,a,i),at(e)&&it(e.beforeDraw)&&e.beforeDraw.call(this,s,r),s.save(),s.translate(k,C),s.transform(t,c,u,d,y,v),s.translate(-k,-C),s.drawImage(n,0,0,w,x),s.restore()}t(r)}).catch(n):t(r)})}}Rt.$name=Se,Rt.$version="2.1.0";class jt extends zt{constructor(){super(...arguments),this.$style=":host{display:flex;flex-direction:column;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([bordered]){border:1px dashed var(--theme-color)}:host([covered]){bottom:0;left:0;position:absolute;right:0;top:0}:host>span{display:flex;flex:1}:host>span+span{border-top:1px dashed var(--theme-color)}:host>span>span{flex:1}:host>span>span+span{border-left:1px dashed var(--theme-color)}",this.bordered=!1,this.columns=3,this.covered=!1,this.rows=3,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["bordered","columns","covered","rows"])}$propertyChangedCallback(e,t,n){Object.is(n,t)||(super.$propertyChangedCallback(e,t,n),"rows"!==e&&"columns"!==e||this.$nextTick(()=>{this.$render()}))}connectedCallback(){super.connectedCallback(),this.$render()}$render(){const e=this.$getShadowRoot(),t=document.createDocumentFragment();for(let n=0;n<this.rows;n+=1){const e=document.createElement("span");e.setAttribute("role","row");for(let t=0;t<this.columns;t+=1){const t=document.createElement("span");t.setAttribute("role","gridcell"),e.appendChild(t)}t.appendChild(e)}e&&(e.innerHTML="",e.appendChild(t))}}jt.$name=xe,jt.$version="2.1.0";class Ft extends zt{constructor(){super(...arguments),this.$style=':host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:"";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}',this.centered=!1,this.slottable=!1,this.themeColor="rgba(238, 238, 238, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["centered"])}}Ft.$name=we,Ft.$version="2.1.0";const Ut=/* @__PURE__ */new WeakMap,qt=/* @__PURE__ */new WeakMap,Bt=/* @__PURE__ */new WeakMap,Wt=/* @__PURE__ */new WeakMap,Vt="vertical";class Ht extends zt{constructor(){super(...arguments),this.$onSelectionChange=null,this.$onSourceImageLoad=null,this.$onSourceImageTransform=null,this.$scale=1,this.$style=":host{display:block;height:100%;overflow:hidden;position:relative;width:100%}",this.resize=Vt,this.selection="",this.slottable=!1}set $image(e){qt.set(this,e)}get $image(){return qt.get(this)}set $sourceImage(e){Wt.set(this,e)}get $sourceImage(){return Wt.get(this)}set $canvas(e){Ut.set(this,e)}get $canvas(){return Ut.get(this)}set $selection(e){Bt.set(this,e)}get $selection(){return Bt.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["resize","selection"])}connectedCallback(){var e,t;super.connectedCallback();let n=null;if(n=this.selection?null!==(t=null===(e=function(e){const t=e.getRootNode();switch(t.nodeType){case 1:return t.ownerDocument;case 9:case 11:return t}return null}(this))||void 0===e?void 0:e.querySelector(this.selection))&&void 0!==t?t:null:this.closest(this.$getTagNameOf(Se)),ot(n)){this.$selection=n,this.$onSelectionChange=this.$handleSelectionChange.bind(this),ht(n,Xe,this.$onSelectionChange);const e=n.closest(this.$getTagNameOf(ve));if(e){this.$canvas=e;const t=e.querySelector(this.$getTagNameOf(Ce));t&&(this.$sourceImage=t,this.$image=t.cloneNode(!0),this.$getShadowRoot().appendChild(this.$image),this.$onSourceImageLoad=this.$handleSourceImageLoad.bind(this),this.$onSourceImageTransform=this.$handleSourceImageTransform.bind(this),ht(t.$image,He,this.$onSourceImageLoad),ht(t,Je,this.$onSourceImageTransform))}this.$render()}}disconnectedCallback(){const{$selection:e,$sourceImage:t}=this;e&&this.$onSelectionChange&&(mt(e,Xe,this.$onSelectionChange),this.$onSelectionChange=null),t&&this.$onSourceImageLoad&&(mt(t.$image,He,this.$onSourceImageLoad),this.$onSourceImageLoad=null),t&&this.$onSourceImageTransform&&(mt(t,Je,this.$onSourceImageTransform),this.$onSourceImageTransform=null),super.disconnectedCallback()}$handleSelectionChange(e){this.$render(e.defaultPrevented?this.$selection:e.detail)}$handleSourceImageLoad(){const{$image:e,$sourceImage:t}=this,n=e.getAttribute("src"),r=t.getAttribute("src");r&&r!==n&&(e.setAttribute("src",r),e.$ready(()=>{this.$render()}))}$handleSourceImageTransform(e){this.$render(void 0,e.detail.matrix)}$render(e,t){const{$canvas:n,$selection:r}=this;e||r.hidden||(e=r),(!e||0===e.x&&0===e.y&&0===e.width&&0===e.height)&&(e={x:0,y:0,width:n.offsetWidth,height:n.offsetHeight});const{x:a,y:i,width:o,height:l}=e,s={},{clientWidth:c,clientHeight:u}=this;let d=c,m=u,h=NaN;switch(this.resize){case"both":h=1,d=o,m=l,s.width=o,s.height=l;break;case"horizontal":h=l>0?u/l:0,d=o*h,s.width=d;break;case Vt:h=o>0?c/o:0,m=l*h,s.height=m;break;default:c>0?h=o>0?c/o:0:u>0&&(h=l>0?u/l:0)}this.$scale=h,this.$setStyles(s),this.$sourceImage&&setTimeout(()=>{this.$transformImageByOffset(null!=t?t:this.$sourceImage.$getTransform(),-a,-i)})}$transformImageByOffset(e,t,n){const{$image:r,$scale:a,$sourceImage:i}=this;if(i&&r&&a>=0){const[i,o,l,s,c,u]=e,d=(t*s-l*n)/(i*s-l*o),m=(n*i-o*t)/(i*s-l*o),h=i*d+l*m+c,p=o*d+s*m+u;r.$ready(e=>{this.$setStyles.call(r,{width:e.naturalWidth*a,height:e.naturalHeight*a})}),r.$setTransform(i,o,l,s,h*a,p*a)}}}function Kt(){const[e,n]=t(!1),[r,a]=t(null),[i,o]=t(null),l=async(e,t)=>{if(!e||!t)return a("ID de asset y configuración de variante son requeridos"),null;n(!0),a(null),o(null);try{const n=await async function(e,{variant_name:t,width:n,height:a,crop_params:i,preset_aspect:o=null,preset_size:l=null,output_format:s="webp"}){try{const r=[{name:t,width:n,height:a,output_format:s,crop_params:i}];return o&&(r[0].preset_aspect=o),l&&(r[0].preset_size=l),D(await A({endpoint:`/assets/${e}/variants`,method:"POST",body:{variants:r,async:!1},basePath:R,useJWT:!0}))}catch(r){throw O(r)}}(e,{variant_name:t.name,width:t.width,height:t.height,crop_params:t.crop_params,preset_aspect:t.preset_aspect,preset_size:t.preset_size,output_format:t.output_format});if(n?.result)return o(n.result),n.result;throw new Error("No se pudo crear la variante")}catch(i){return console.error("Error creating variant:",i),a(i.message||"Error desconocido al crear variante"),null}finally{n(!1)}};return{createVariant:l,createCropVariant:async(e,t,n={})=>{const r={name:n.name||`crop_${Date.now()}`,width:n.width||800,height:n.height||600,output_format:n.format||"webp",crop_params:{x:t.x||0,y:t.y||0,width:t.width||1,height:t.height||1}};return await l(e,r)},createVariantFromBlob:async(e,t,i={})=>{if(!e||!t)return a("ID de asset y blob son requeridos"),null;n(!0),a(null),o(null);try{const n=await async function(e,t,n={}){try{const r=new FormData,a=n.format||"webp",i=`${n.name||"variant"}.${a}`;return r.append("file",t,i),r.append("variant_name",n.name||"variant"),r.append("width",String(n.width||0)),r.append("height",String(n.height||0)),r.append("output_format",n.format||"webp"),D(await A({endpoint:`/assets/${e}/variants/upload`,method:"POST",body:r,basePath:R,isFormData:!0,useJWT:!0}))}catch(r){throw O(r)}}(e,t,{name:i.name||`crop_${Date.now()}`,width:i.width||0,height:i.height||0,format:i.format||"webp"});if(n?.result)return o(n.result),n.result;throw new Error("No se pudo crear la variante")}catch(l){return console.error("Error creating variant from blob:",l),a(l.message||"Error desconocido al crear variante"),null}finally{n(!1)}},loading:e,error:r,createdVariant:i,reset:()=>{a(null),o(null)}}}Ht.$name=Ee,Ht.$version="2.1.0",Tt.$define(),Ft.$define(),jt.$define(),Dt.$define(),Mt.$define(),Rt.$define(),Lt.$define(),Ht.$define();class Gt{constructor(e,t,n){this.canvasRef=e,this.imageRef=t,this.selectionRef=n}get canvasElement(){return this.canvasRef?.current}get image(){return this.imageRef?.current}get selectionElement(){return this.selectionRef?.current}get isReady(){return!!(this.canvasElement&&this.image&&this.selectionElement)}transform={move:(e,t)=>{if(!this.image)return!1;try{return this.image.$move(e,t),!0}catch(n){return console.warn("Error moving image:",n),!1}},moveTo:(e,t)=>{if(!this.image)return!1;try{return this.image.$moveTo(e,t),!0}catch(n){return console.warn("Error moving image to position:",n),!1}},zoom:e=>{if(!this.image)return!1;try{return this.image.$zoom(e),!0}catch(t){return console.warn("Error zooming image:",t),!1}},rotate:e=>{if(!this.image)return!1;try{const t=e*Math.PI/180;return this.image.$rotate(t),!0}catch(t){return console.warn("Error rotating image:",t),!1}},scale:(e,t=e)=>{if(!this.image)return!1;try{return this.image.$scale(e,t),!0}catch(n){return console.warn("Error scaling image:",n),!1}},center:(e="contain")=>{if(!this.image)return!1;try{return this.image.$center(e),!0}catch(t){return console.warn("Error centering image:",t),!1}},reset:()=>{if(!this.image)return!1;try{return this.image.$resetTransform(),!0}catch(e){return console.warn("Error resetting transform:",e),!1}},getTransform:()=>{if(!this.image)return null;try{return this.image.$getTransform()}catch(e){return console.warn("Error getting transform:",e),null}},setTransform:(e,t,n,r,a,i)=>{if(!this.image)return!1;try{return this.image.$setTransform(e,t,n,r,a,i),!0}catch(o){return console.warn("Error setting transform:",o),!1}},resetZoom:()=>{if(!this.image)return!1;try{const e=this.image.$getTransform();if(!e)return!1;const[t,n,r,a,i,o]=e,l=Math.sqrt(t*t+n*n),s=Math.sqrt(r*r+a*a),c=t/l,u=n/l,d=r/s,m=a/s;return this.image.$setTransform(c,u,d,m,i,o),!0}catch(e){return console.warn("Error resetting zoom:",e),!1}},setZoom:e=>{if(!this.image||e<=0)return!1;try{const t=this.image.$getTransform();if(!t)return!1;const[n,r,a,i,o,l]=t,s=Math.sqrt(n*n+r*r),c=Math.sqrt(a*a+i*i),u=n/s*e,d=r/s*e,m=a/c*e,h=i/c*e;return this.image.$setTransform(u,d,m,h,o,l),!0}catch(t){return console.warn("Error setting zoom level:",t),!1}},getZoom:()=>{if(!this.image)return 1;try{const e=this.image.$getTransform();if(!e)return 1;const[t,n]=e;return Math.sqrt(t*t+n*n)}catch(e){return console.warn("Error getting zoom level:",e),1}},fitToCanvas:(e=.1)=>{if(!this.image||!this.canvasElement)return!1;try{const t=this.canvasElement.getBoundingClientRect();let n=this.image.querySelector("img")||this.image;if(!n?.naturalWidth||!n?.naturalHeight)return!1;const r=1-e,a=t.width*r/n.naturalWidth,i=t.height*r/n.naturalHeight,o=Math.min(a,i,1);return this.transform.setZoom(o)}catch(t){return console.warn("Error fitting to canvas:",t),!1}}};selection={center:()=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$center(),!0}catch(e){return console.warn("Error centering selection:",e),!1}},reset:()=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$reset(),!0}catch(e){return console.warn("Error resetting selection:",e),!1}},setCoverage:e=>{if(!this.selectionElement||e<0||e>1)return!1;try{return this.selectionElement.initialCoverage=e,this.selectionElement.$reset(),!0}catch(t){return console.warn("Error setting coverage:",t),!1}},setAspectRatio:e=>{if(!this.selectionElement)return!1;try{let t;if(""===e||null==e)t=NaN;else if("number"==typeof e)t=e;else{if("string"!=typeof e)return console.warn("Unsupported aspect ratio type:",typeof e,e),!1;if(e.includes("/")){const[n,r]=e.split("/").map(e=>parseFloat(e.trim()));if(isNaN(n)||isNaN(r)||0===r)return console.warn("Invalid aspect ratio format:",e),!1;t=n/r}else if(t=parseFloat(e),isNaN(t))return console.warn("Invalid aspect ratio format:",e),!1}return this.selectionElement.aspectRatio=t,this.selectionElement.$render(),!0}catch(t){return console.warn("Error setting aspect ratio:",t),!1}},move:(e,t)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$move(e,t),!0}catch(n){return console.warn("Error moving selection:",n),!1}},zoom:e=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$zoom(e),!0}catch(t){return console.warn("Error zooming selection:",t),!1}},change:(e,t,n,r,a)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$change(e,t,n,r,a),!0}catch(i){return console.warn("Error changing selection:",i),!1}},set:(e,t,n,r)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.x=e,this.selectionElement.y=t,this.selectionElement.width=n,this.selectionElement.height=r,this.selectionElement.$render(),!0}catch(a){return console.warn("Error setting selection:",a),!1}},toCanvas:async(e={})=>{if(!this.selectionElement)return null;try{const t={width:800,height:600,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",...e};return await this.selectionElement.$toCanvas(t)}catch(t){return console.warn("Error exporting to canvas:",t),null}},getData:()=>{if(!this.selectionElement)return null;try{return{x:this.selectionElement.x,y:this.selectionElement.y,width:this.selectionElement.width,height:this.selectionElement.height,aspectRatio:this.selectionElement.aspectRatio}}catch(e){return console.warn("Error getting selection data:",e),null}}};canvas={setBackground:e=>{if(!this.canvasElement)return!1;try{return this.canvasElement.background=e,!0}catch(t){return console.warn("Error setting background:",t),!1}},setScaleStep:e=>{if(!this.canvasElement)return!1;try{return this.canvasElement.scaleStep=e,!0}catch(t){return console.warn("Error setting scale step:",t),!1}},setDisabled:e=>{if(!this.canvasElement)return!1;try{return this.canvasElement.disabled=e,!0}catch(t){return console.warn("Error setting disabled state:",t),!1}}};utils={flipHorizontal:()=>{const e=this.transform.getTransform();if(!e)return!1;const[t,n,r,a,i,o]=e;return this.transform.setTransform(-t,n,r,a,i,o)},flipVertical:()=>{const e=this.transform.getTransform();if(!e)return!1;const[t,n,r,a,i,o]=e;return this.transform.setTransform(t,n,r,-a,i,o)},setupInitialView:async(e={})=>{const{paspartuFactor:t=.85,retries:n=3,retryDelay:r=200}=e;return new Promise(e=>{const a=(i=0)=>{if(!this.isReady)return i<n?void setTimeout(()=>a(i+1),r):void e(!1);try{const o=this.canvasElement.getBoundingClientRect();let l=this.image.querySelector("img")||this.image;if(!l?.naturalWidth||!l?.naturalHeight)return i<n?void setTimeout(()=>a(i+1),r):(this.transform.center(),void e(!1));if(o.width>0&&o.height>0){const n=o.width*t/l.naturalWidth,r=o.height*t/l.naturalHeight,a=Math.min(n,r,1);this.transform.setTransform(a,0,0,a,0,0)?setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100):(this.transform.reset(),setTimeout(()=>{a<1&&this.transform.scale(a),setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100)},100))}else this.transform.center(),e(!1)}catch(o){console.warn("Error in setup:",o),this.transform.center(),e(!1)}};a()})},resetAll:()=>{const e={transform:this.transform.reset(),selection:this.selection.reset(),center:!1};return setTimeout(()=>{e.center=this.transform.center()&&this.selection.center()},100),e},checkExportability:async()=>{try{return!!(await this.selection.toCanvas({width:1,height:1}))}catch{return!1}},resetZoomOnly:()=>this.transform.resetZoom(),getZoomInfo:()=>{const e=this.transform.getZoom();return{current:e,isZoomedIn:e>1,isZoomedOut:e<1,percentage:Math.round(100*e)}},setBackground:e=>this.canvas.setBackground(e)};setupEventListeners(e={}){const{onSelectionChange:t,onImageTransform:n,onAction:r,onActionStart:a,onActionMove:i,onActionEnd:o}=e,l=[];if(t&&this.selectionElement){const e=e=>{t({x:e.detail.x,y:e.detail.y,width:e.detail.width,height:e.detail.height})};this.selectionElement.addEventListener("change",e),l.push(()=>{this.selectionElement&&this.selectionElement.removeEventListener("change",e)})}if(n&&this.image){const e=e=>{n({matrix:e.detail.matrix,oldMatrix:e.detail.oldMatrix})};this.image.addEventListener("transform",e),l.push(()=>{this.image&&this.image.removeEventListener("transform",e)})}if(this.canvasElement){if(r){const e=e=>r(e.detail);this.canvasElement.addEventListener("action",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("action",e)})}if(a){const e=e=>a(e.detail);this.canvasElement.addEventListener("actionstart",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionstart",e)})}if(i){const e=e=>i(e.detail);this.canvasElement.addEventListener("actionmove",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionmove",e)})}if(o){const e=e=>o(e.detail);this.canvasElement.addEventListener("actionend",e),l.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionend",e)})}}return()=>{l.forEach(e=>e())}}}async function Qt(e,t,n={}){const{format:r=null,originalFormat:a="webp",onSuccess:i=null,onError:o=null,accessibilityManager:l=null}=n;try{const n=window.limboCore?.config?.getGlobal(),o=r||n?.downloadFormat||a||"webp",s=`${t.split(".")[0]}.${o}`;if(l&&l.announce(`Descargando ${s}`),e.startsWith("data:image/"))return function(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),setTimeout(()=>{document.body.removeChild(n)},100)}(e,s),i&&i(s),l&&l.announce(`${s} descargado correctamente`),!0;const c=await fetch(e,{mode:"cors"});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);const u=await c.blob();let d=u;const m=u.type;m!==`image/${"jpg"===o?"jpeg":o}`&&function(e){return["webp","jpeg","jpg","png"].includes(e.toLowerCase())}(o)&&(d=await async function(e,t){return new Promise((n,r)=>{const a=new Image,i=URL.createObjectURL(e);a.onload=()=>{try{const r=document.createElement("canvas");r.width=a.width,r.height=a.height;r.getContext("2d").drawImage(a,0,0);const o=`image/${"jpg"===t?"jpeg":t}`,l="png"===t?void 0:.92;r.toBlob(t=>{URL.revokeObjectURL(i),n(t||e)},o,l)}catch(r){URL.revokeObjectURL(i),n(e)}},a.onerror=()=>{URL.revokeObjectURL(i),n(e)},a.src=i})}(u,o));const h=window.URL.createObjectURL(d),p=document.createElement("a");return p.href=h,p.download=s,p.style.display="none",document.body.appendChild(p),p.click(),setTimeout(()=>{window.URL.revokeObjectURL(h),document.body.removeChild(p)},100),i&&i(s),l&&l.announce(`${s} descargado correctamente`),!0}catch(s){return console.error("Error downloading image:",s),o&&o(s),l&&l.announce(`Error al descargar la imagen: ${s.message}`),!1}}const Yt=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Qt,downloadImage:Qt},Symbol.toStringTag,{value:"Module"}));function Xt({image:e,onSave:o,onCancel:u,onDelete:d,onError:m=null,deleting:h=!1,onVariantCreated:p=null,onUpload:f=null,uploading:g=!1,cropperConfig:b=null}){const[y,v]=t(!1),[w,x]=t(null),[k,C]=t(!1),[S,N]=t(!0),[E,$]=t(!0),[_,z]=t({x:20,y:100}),[T,A]=t(!1),[P,M]=t({x:0,y:0}),[I,L]=t(!1),[D,O]=t(!0),[R,j]=t(!1),[F,U]=t({horizontal:!1,vertical:!1}),[q,W]=t(!1),[V,H]=t(!1),[K,G]=t(!1),[Q,Y]=t(!1),[X]=t(()=>{if(!e||!e.filename)return"image";const[t]=e.filename.split(".");return t}),J=i(()=>{if(b)return{mandatoryCrops:b.mandatoryCrops||[],allowCustomCrops:!1!==b.allowAdditionalCrops,showDimensionInputs:!0===b.showDimensionInputs,maxCrops:b.maxCrops||null};const e=window.limboCore?.config?.getGlobal()||{};return{mandatoryCrops:e.cropper?.mandatoryCrops||[],allowCustomCrops:!1!==e.cropper?.allowCustomCrops,showDimensionInputs:!0===e.cropper?.showDimensionInputs,maxCrops:e.cropper?.maxCrops||null}},[b]),[Z,ee]=t(()=>J.mandatoryCrops.length>0?J.mandatoryCrops.map((e,t)=>({id:`crop-${t}`,label:e.label,width:e.width,height:e.height,required:!1!==e.required,isCustom:!1,confirmed:!1,lockDimensions:!(!e.width||!e.height),savedState:null})):[{id:"crop-default-0",label:X,width:e.width||1920,height:e.height||1080,required:!1,isCustom:!0,confirmed:!1,savedState:null}]),[ne,re]=t(0),ae=Z[ne],ie=i(()=>ae&&ae.width&&ae.height?ae.width/ae.height:"",[ae]),oe=i(()=>{const e=50;if(!ie||""===ie)return{minWidth:e,minHeight:e};if(ie>=1){return{minWidth:e,minHeight:e/ie}}return{minWidth:e*ie,minHeight:e}},[ie]),[le,se]=t(!1),[ce,ue]=t([]),[de,me]=t(null),he=window.limboCore?.accessibilityManager,{createVariantFromBlob:pe,loading:fe,error:ge}=Kt(),be=((e,i={})=>{const o=a(null),l=a(null),s=a(null),c=a(null),[u,d]=t(null),[m,h]=t(null),[p,f]=t(!1),[g,b]=t(!0),[y,v]=t(0),w={aspectRatio:"",shade:!0,paspartuFactor:.85,...i};n(()=>{o.current&&l.current&&s.current&&(c.current=new Gt(o,l,s),f(!0))},[]),n(()=>{if(c.current)return c.current.setupEventListeners({onSelectionChange:e=>{d(e)},onImageTransform:()=>{v(e=>e+1)}})},[p]),n(()=>{c.current&&e&&(async()=>{c.current.selection.setAspectRatio(w.aspectRatio),c.current.canvas.setBackground(w.shade),await c.current.utils.setupInitialView({paspartuFactor:w.paspartuFactor});const e=await c.current.utils.checkExportability();b(e);const t=l.current?.querySelector("img")||l.current;t?.naturalWidth&&t?.naturalHeight&&h({naturalWidth:t.naturalWidth,naturalHeight:t.naturalHeight,currentWidth:t.width,currentHeight:t.height})})()},[e]),n(()=>{c.current&&p&&c.current.selection.setAspectRatio(w.aspectRatio)},[w.aspectRatio,p]),n(()=>{c.current&&p&&c.current.canvas.setBackground(w.shade)},[w.shade,p]);const x=r(()=>({move:(e,t)=>c.current?.transform.move(e,t)||!1,zoom:e=>c.current?.transform.zoom(e)||!1,rotate:e=>c.current?.transform.rotate(e)||!1,center:()=>c.current?.transform.center()||!1,reset:()=>c.current?.transform.reset()||!1,resetZoom:()=>c.current?.transform.resetZoom()||!1,setZoom:e=>c.current?.transform.setZoom(e)||!1,getZoom:()=>c.current?.transform.getZoom()||1,fitToCanvas:e=>c.current?.transform.fitToCanvas(e)||!1,flipHorizontal:()=>c.current?.utils.flipHorizontal()||!1,flipVertical:()=>c.current?.utils.flipVertical()||!1}),[]),k=r(()=>({center:()=>c.current?.selection.center()||!1,reset:()=>c.current?.selection.reset()||!1,setCoverage:e=>c.current?.selection.setCoverage(e)||!1,setAspectRatio:e=>c.current?.selection.setAspectRatio(e)||!1,toCanvas:e=>c.current?.selection.toCanvas(e)||Promise.resolve(null)}),[]),C=r(()=>({resetAll:()=>{if(c.current){const e=c.current.utils.resetAll();return d(null),e}return!1},setBackground:e=>c.current?.canvas.setBackground(e)||!1,resetZoomOnly:()=>c.current?.utils.resetZoomOnly()||!1,getZoomInfo:()=>c.current?.utils.getZoomInfo()||{current:1,percentage:100,isZoomedIn:!1,isZoomedOut:!1}}),[]);return{refs:{canvasRef:o,imageRef:l,selectionRef:s},state:{cropData:u,imageInfo:m,isReady:p,canExport:g,transformVersion:y},transform:x(),selection:k(),utils:C(),manager:c.current}})(e,{aspectRatio:ie||null,showGrid:S,shade:E,initialCoverage:.5,paspartuFactor:.85}),{refs:ye,state:ve,transform:we,selection:xe,utils:ke}=be,{canvasRef:Ce,imageRef:Se,selectionRef:Ne}=ye,{cropData:Ee,imageInfo:$e,canExport:_e,transformVersion:ze}=ve,Te=i(()=>$e||{naturalWidth:e.width||1920,naturalHeight:e.height||1080,currentWidth:e.width||1920,currentHeight:e.height||1080},[$e,e.width,e.height]),Ae=r(()=>N(e=>!e),[]),Pe=r(()=>$(e=>!e),[]),Me=r(()=>H(e=>!e),[]),Ie=r(()=>G(e=>!e),[]),Le=r(()=>Y(e=>!e),[]),De=r(()=>we.center(),[we]),Oe=r(()=>xe.center(),[xe]),Re=r(()=>xe.reset(),[xe]),je=r((e,t)=>we.move(e,t),[we]),Fe=r(e=>we.zoom(e),[we]),Ue=r(e=>we.rotate(e),[we]),qe=r(e=>{xe.setCoverage(e)},[xe]),Be=r(()=>{U(e=>{const t=!e.horizontal;return we.flipHorizontal(),{...e,horizontal:t}})},[we]),We=r(()=>{U(e=>{const t=!e.vertical;return we.flipVertical(),{...e,vertical:t}})},[we]),Ve=r(()=>{if(!be.manager||!ve.isReady)return null;try{const e=Ee?{...Ee}:null;let t=null;if(Ne.current){const e=Ne.current;t={x:e.x??0,y:e.y??0,width:e.width??0,height:e.height??0}}let n=null;if(Se.current){const e=Se.current.$getTransform?.();e&&Array.isArray(e)&&(n=[...e])}const r={cropData:e,selectorState:t,imageTransform:n,flipState:{horizontal:F.horizontal,vertical:F.vertical}};return console.log(`[CropperView] 💾 Guardando estado del crop ${ne}:`,r),ee(e=>e.map((e,t)=>t===ne?{...e,savedState:r}:e)),r}catch(e){return console.warn("Error saving crop state:",e),null}},[be.manager,ve.isReady,Ee,F,ne,Se,Ne]),He=r(e=>{const t=Z[e];if(!t||!t.savedState)return console.log(`[CropperView] ℹ️ No hay estado guardado para crop ${e}, centrando...`),void setTimeout(()=>{De(),setTimeout(()=>Oe(),100)},100);if(be.manager&&ve.isReady)try{const{savedState:n}=t;if(console.log(`[CropperView] ♻️ Restaurando estado del crop ${e}:`,n),n.imageTransform&&Se.current&&Array.isArray(n.imageTransform)&&setTimeout(()=>{if(Se.current&&Se.current.$setTransform){const[e,t,r,a,i,o]=n.imageTransform;Se.current.$setTransform(e,t,r,a,i,o),console.log(`[CropperView] ✅ Imagen restaurada: transform(${e.toFixed(2)}, ${t.toFixed(2)}, ${r.toFixed(2)}, ${a.toFixed(2)}, ${i.toFixed(0)}, ${o.toFixed(0)})`)}},100),n.selectorState&&Ne.current){const{x:e,y:t,width:r,height:a}=n.selectorState;setTimeout(()=>{Ne.current&&(Ne.current.x=e,Ne.current.y=t,Ne.current.width=r,Ne.current.height=a,Ne.current.$render&&Ne.current.$render(),console.log(`[CropperView] ✅ Selector restaurado: ${r}×${a} en (${e}, ${t})`))},150)}n.flipState&&U({horizontal:n.flipState.horizontal??!1,vertical:n.flipState.vertical??!1}),console.log("[CropperView] ✨ Estado restaurado completamente")}catch(n){console.error("Error restoring crop state:",n),setTimeout(()=>{De(),setTimeout(()=>Oe(),100)},100)}else console.warn("Cropper not ready for state restoration")},[Z,be.manager,ve.isReady,De,Oe,Ne,Se]),Ke=r(()=>{for(let e=0;e<Z.length;e++){const t=Z[e];if(!t.label||""===t.label.trim())return e}return-1},[Z]),Ge=r(async e=>{e!==ne&&(j(!0),Ve(),await new Promise(e=>setTimeout(e,100)),re(e),await new Promise(e=>setTimeout(e,250)),He(e),await new Promise(e=>setTimeout(e,200)),j(!1))},[ne,Ve,He]),Qe=r(()=>{if(!J.allowCustomCrops)return void alert("No se pueden añadir recortes personalizados en este modo.");const t={id:`crop-custom-${Date.now()}`,label:`Recorte ${Z.length+1}`,width:e.width||1920,height:e.height||1080,required:!1,isCustom:!0,confirmed:!1,savedState:null};ee(e=>[...e,t]),he?.announce(`Nuevo recorte personalizado añadido: ${t.label}. Selecciónalo para editarlo.`)},[J.allowCustomCrops,Z.length,e.width,e.height,he]),Ye=r((e,t)=>{const n=parseInt(t,10);""===t||isNaN(n)||ee(t=>t.map((t,r)=>r===ne?{...t,[e]:n}:t))},[ne]),Xe=r(e=>{const t=ae[e];let n=100;if(Ce.current&&$e){const e=Ce.current.getBoundingClientRect(),t=Math.min(e.width,e.height);n=Math.max(100,Math.round(.05*t))}const r=Math.max(n,Math.min(5e3,t));r!==t&&ee(t=>t.map((t,n)=>n===ne?{...t,[e]:r}:t));const a={...ae,[e]:r},i=a.width/a.height,o=xe.getData?.();xe.setAspectRatio(i),o&&void 0!==o.x&&setTimeout(()=>{xe.set?.(o.x,o.y,o.width,o.height)},50)},[ne,ae,xe,Ce,$e]),Je=r(e=>{ee(t=>t.map((t,n)=>n===ne?{...t,label:e}:t))},[ne]),Ze=r((e,t=null)=>{t=t||Z[e].label;if(!window.confirm(`¿Estás seguro de que deseas eliminar "${t||"este recorte"}"? Esta acción también eliminará todos sus recortes.`))return;const n=Z[e];if(n.required)alert("No se puede eliminar un recorte obligatorio.");else if(1!==Z.length){if(ee(t=>t.filter((t,n)=>n!==e)),e===ne){const t=Math.max(0,e-1);re(t)}else e<ne&&re(e=>e-1);he?.announce(`Recorte ${n.label} eliminado`)}else alert("Debe haber al menos un recorte.")},[Z,ne,he]),et=r(async()=>{if(!_e)return null;try{const t=await xe.toCanvas({width:800,height:600,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});return t?t.toDataURL(`image/${globalThis.downloadFormat||e.mime_type.split("/")[1]||"webp"}`,.9):null}catch(t){return console.warn("Error generating preview:",t),null}},[_e,e.mime_type,xe]),tt=r(async()=>{if(y)return v(!1),x(null),void C(!1);if(_e){v(!0),C(!0);try{const e=await et();e?x(e):(v(!1),alert("No se puede exportar el recorte por restricciones de CORS en la imagen original."))}finally{C(!1)}}else alert("No se puede exportar el recorte por restricciones de CORS en la imagen original.")},[_e,et,y]),nt=r(e=>{e.target.closest(".limbo-preview-modal-header")&&(A(!0),M({x:e.clientX-_.x,y:e.clientY-_.y}))},[_]),rt=r(e=>{T&&(e.preventDefault(),z({x:e.clientX-P.x,y:e.clientY-P.y}))},[T,P]),at=r(()=>{A(!1)},[]),it=r(e=>{if(!e.target.closest(".limbo-preview-modal-header"))return;const t=e.touches[0];A(!0),M({x:t.clientX-_.x,y:t.clientY-_.y})},[_]),ot=r(e=>{if(!T)return;e.preventDefault();const t=e.touches[0];z({x:t.clientX-P.x,y:t.clientY-P.y})},[T,P]),lt=r(()=>{A(!1)},[]);n(()=>{if(T)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",at),document.addEventListener("touchmove",ot,{passive:!1}),document.addEventListener("touchend",lt),()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",at),document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",lt)}},[T,rt,at,ot,lt]),n(()=>{if(!I)return;const e=e=>{"Escape"===e.key&&L(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[I]);const st=r(async(t,n=null)=>{const r=Z[t];if(!r)throw new Error(`Crop ${t} no encontrado`);if(!r.savedState&&t!==ne)throw new Error(`El recorte "${r.label}" aún no ha sido configurado`);const a={index:ne,imageTransform:Se.current?.$getTransform?.(),selectorState:Ne.current?{x:Ne.current.x,y:Ne.current.y,width:Ne.current.width,height:Ne.current.height}:null};try{if(t!==ne&&r.savedState){if(console.log(`[CropperView] 🔄 Restaurando temporalmente crop ${t} para guardado...`),r.savedState.imageTransform&&Se.current?.$setTransform){const[e,t,n,a,i,o]=r.savedState.imageTransform;Se.current.$setTransform(e,t,n,a,i,o)}if(r.savedState.selectorState&&Ne.current){const{x:e,y:t,width:n,height:a}=r.savedState.selectorState;Ne.current.x=e,Ne.current.y=t,Ne.current.width=n,Ne.current.height=a,Ne.current.$render?.()}await new Promise(e=>setTimeout(e,100))}const a=Math.min(r.width,5e3),i=Math.min(r.height,5e3),o=await xe.toCanvas({width:a,height:i,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!o)throw new Error(`No se pudo generar el canvas para "${r.label}"`);const l=globalThis.downloadFormat||"webp",s="webp"===l?"image/webp":"png"===l?"image/png":"image/jpeg",c=.9,u=await new Promise((e,t)=>{o.toBlob(n=>{n?e(n):t(new Error("No se pudo convertir el canvas a blob"))},s,c)});console.log("[CropperView] Canvas convertido a blob:",{size:u.size,type:u.type,dimensions:`${a}x${i}`});const d=`${r.label||"crop"}_${a}_${i}`,m=n||e.id,h=await pe(m,u,{name:d,width:a,height:i,format:l});if(h)return he?.announceSuccess(`Recorte creado: ${d}`),p?.(m,h),h;throw new Error("No se pudo crear la variante")}finally{if(t!==ne&&a.imageTransform&&Se.current?.$setTransform){console.log(`[CropperView] ↩️ Restaurando estado original del crop ${a.index}...`);const[e,t,n,r,i,o]=a.imageTransform;if(Se.current.$setTransform(e,t,n,r,i,o),a.selectorState&&Ne.current){const{x:e,y:t,width:n,height:r}=a.selectorState;Ne.current.x=e,Ne.current.y=t,Ne.current.width=n,Ne.current.height=r,Ne.current.$render?.()}}}},[Z,ne,xe,pe,e.id,p,he,Se,Ne]),ct=r(async()=>{if(!_e){const e="No se puede exportar el recorte por restricciones de CORS en la imagen original.";return he?.announceError(e),void alert(e)}if(!ve.isReady){const e="El cropper aún no está inicializado. Espera un momento e inténtalo de nuevo.";return he?.announceError(e),void alert(e)}Ve(),he?.announce("Creando recorte de la imagen");try{let t=e.id,n=null;if(e.file&&f){he?.announce("Subiendo imagen...");const r=await f(e.file);if(!r||!r.id)throw new Error("No se pudo subir la imagen al servidor");t=r.id,n=r,he?.announceSuccess("Imagen subida correctamente")}const r=await st(ne,t);r&&o(n?{crops:[r],asset:n}:r)}catch(t){console.warn("Error creating crop variant:",t);const e=t.message||"No se pudo crear el recorte. Inténtalo de nuevo.";he?.announceError(e),alert(e),m?.(t)}},[_e,ve.isReady,he,Ve,st,ne,o,m,e.file,e.id,f]),ut=r(async t=>{Ve(),he?.announce(`Guardando ${t.length} recortes...`);try{let r=e.id,a=null;if(e.file&&f){he?.announce("Subiendo imagen...");const t=await f(e.file);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");r=t.id,a=t,he?.announceSuccess("Imagen subida correctamente")}const i=[],l=[];for(const e of t)try{const t=await st(e,r);t&&i.push(t)}catch(n){l.push({crop:Z[e]?.label||`Crop ${e}`,error:n.message})}if(i.length>0&&(he?.announceSuccess(`${i.length} recorte(s) guardado(s) correctamente`),o(a?{crops:i,asset:a}:i)),l.length>0){const e=`Errores al guardar algunos recortes:\n${l.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;he?.announceError(e),alert(e)}}catch(n){const e=n.message||"Error al procesar los recortes";he?.announceError(e),alert(e),m?.(n)}},[Ve,st,Z,he,o,e.file,e.id,f,m]),dt=r(async()=>{const e=Ke();if(-1!==e){const t=Z[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void re(e)}if(Z.length>1){me("save");const e=Z.map((e,t)=>({crop:e,index:t})).filter(({crop:e,index:t})=>e.required||e.savedState||t===ne).map(({index:e})=>e);return ue(e),void se(!0)}await ct()},[Ke,Z,ct,ne]),mt=r(async t=>{const n=Z[t];if(!n)throw new Error(`Crop ${t} no encontrado`);if(!n.savedState&&t!==ne)throw new Error(`El recorte "${n.label}" aún no ha sido configurado`);const r={index:ne,imageTransform:Se.current?.$getTransform?.(),selectorState:Ne.current?{x:Ne.current.x,y:Ne.current.y,width:Ne.current.width,height:Ne.current.height}:null};try{if(t!==ne&&n.savedState){if(console.log(`[CropperView] 🔄 Restaurando temporalmente crop ${t} para descarga...`),n.savedState.imageTransform&&Se.current?.$setTransform){const[e,t,r,a,i,o]=n.savedState.imageTransform;Se.current.$setTransform(e,t,r,a,i,o)}if(n.savedState.selectorState&&Ne.current){const{x:e,y:t,width:r,height:a}=n.savedState.selectorState;Ne.current.x=e,Ne.current.y=t,Ne.current.width=r,Ne.current.height=a,Ne.current.$render?.()}await new Promise(e=>setTimeout(e,100))}const r=await xe.toCanvas({width:n.width,height:n.height,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!r)throw new Error(`No se pudo generar el canvas para "${n.label}"`);const a=r.toDataURL(`image/${globalThis.downloadFormat||e.mime_type.split("/")[1]||"webp"}`,.9),i=`${(n.label||"crop").replace(/\.[^/.]+$/,"").replace(/\s+/g,"-").trim()}_${n.width}_${n.height}`;return await Qt(a,i,{accessibilityManager:he,onSuccess:e=>{console.log(`✅ Descargado: ${e}`)},onError:e=>{throw new Error(`Error al descargar "${n.label}": ${e.message}`)}}),{crop:n.label,filename:i}}finally{if(t!==ne&&r.imageTransform&&Se.current?.$setTransform){console.log(`[CropperView] ↩️ Restaurando estado original del crop ${r.index}...`);const[e,t,n,a,i,o]=r.imageTransform;if(Se.current.$setTransform(e,t,n,a,i,o),r.selectorState&&Ne.current){const{x:e,y:t,width:n,height:a}=r.selectorState;Ne.current.x=e,Ne.current.y=t,Ne.current.width=n,Ne.current.height=a,Ne.current.$render?.()}}}},[Z,ne,xe,e.mime_type,he,Se,Ne]),ht=r(async e=>{Ve(),he?.announce(`Descargando ${e.length} recortes...`);const t=[],n=[];for(const a of e)try{const e=await mt(a);e&&t.push(e)}catch(r){n.push({crop:Z[a]?.label||`Crop ${a}`,error:r.message})}if(t.length>0&&he?.announceSuccess(`${t.length} recorte(s) descargado(s) correctamente`),n.length>0){const e=`Errores al descargar algunos recortes:\n${n.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;he?.announceError(e),alert(e)}},[Ve,mt,Z,he]),pt=r(async()=>{if(!_e){const e="No se puede descargar el recorte por restricciones de CORS en la imagen original.";return he?.announceError(e),void alert(e)}Ve(),he?.announce("Preparando descarga del recorte");try{await mt(ne),he?.announceSuccess("Recorte descargado correctamente")}catch(e){console.error("Error downloading crop:",e);const t=e.message||"Error al descargar el recorte";he?.announceError(t),alert(t)}},[_e,he,Ve,mt,ne]),ft=r(async()=>{const e=Ke();if(-1!==e){const t=Z[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void re(e)}if(Z.length>1){me("download");const e=Z.map((e,t)=>({crop:e,index:t})).filter(({crop:e,index:t})=>e.savedState||t===ne).map(({index:e})=>e);return ue(e),void se(!0)}await pt()},[Ke,Z,pt,ne]),gt=r(async()=>{if(e.file&&f)try{he?.announce("Subiendo imagen original...");const t=await f(e.file);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");he?.announceSuccess("Imagen guardada correctamente"),o({asset:t,crops:[]})}catch(t){console.error("Error guardando imagen original:",t);const e=t.message||"No se pudo guardar la imagen. Inténtalo de nuevo.";he?.announceError(e),alert(e),m?.(t)}else u()},[e.file,f,u,o,m,he]);return n(()=>{v(!1),x(null)},[e]),n(()=>{be.manager&&ve.isReady&&D&&(console.log("[CropperView] Carga inicial completada, centrando imagen y selector..."),setTimeout(()=>{De(),setTimeout(()=>{Oe(),O(!1),console.log("[CropperView] Carga inicial finalizada")},100)},50))},[be.manager,ve.isReady,D,De,Oe]),n(()=>{be.manager&&ve.isReady&&(ie&&xe.setAspectRatio(ie),ke.setBackground(E))},[ie,E,be.manager,ve.isReady,xe,ke]),n(()=>{if(!$e||!ve.isReady||J.mandatoryCrops.length>0)return;const e=Z[0];if(e&&"crop-default-0"===e.id&&(1920===e.width||1080===e.height)){const t=Math.min($e.naturalWidth,5e3),n=Math.min($e.naturalHeight,5e3);ee([{...e,width:t,height:n}]),console.log(`[CropperView] Crop por defecto actualizado a ${t}×${n}px`)}},[$e,ve.isReady,J.mandatoryCrops.length,Z]),n(()=>{if(!y||!_e)return;const e=setTimeout(async()=>{C(e=>!w&&!e||e);try{const e=await et();e&&x(e)}finally{C(!1)}},300);return()=>{clearTimeout(e),C(!1)}},[Ee,ze,y,_e,et,ie,F,w]),n(()=>{const e=Ce.current,t=t=>{if("Delete"===t.key||"Backspace"===t.key||"Backspace"===t.key&&t.metaKey||"Backspace"===t.key&&t.ctrlKey){const n=t.target;if(e&&(n===e||n===document.body||n===document.documentElement||"CROPPER-CANVAS"===n.tagName||"CROPPER-SELECTION"===n.tagName||"CROPPER-IMAGE"===n.tagName||"CROPPER-HANDLE"===n.tagName||"CROPPER-GRID"===n.tagName||n.closest("cropper-canvas")||e.contains(n)))return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1}};return document.addEventListener("keydown",t,!0),document.addEventListener("keyup",t,!0),window.addEventListener("keydown",t,!0),e&&e.addEventListener("keydown",t,!0),()=>{document.removeEventListener("keydown",t,!0),document.removeEventListener("keyup",t,!0),window.removeEventListener("keydown",t,!0),e&&e.removeEventListener("keydown",t,!0)}},[Ce]),e?/* @__PURE__ */s("div",{className:"limbo-cropper-view px-2 border-2 border-gray-200/50 rounded-lg max-w-7xl mx-auto w-full min-w-full h-full min-h-full flex flex-col",children:[
227
229
  /* @__PURE__ */s("div",{className:"limbo-cropper-header flex flex-row justify-between items-start flex-wrap mx-2 py-2 border-b border-gray-200 bg-white z-10 shrink-0 lg:gap-2",children:[
228
230
  /* @__PURE__ */s("div",{className:"flex-1 min-w-fit space-y-2 max-w-fit",children:[
229
231
  /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
230
- /* @__PURE__ */l("h2",{className:"text-lg sm:text-xl font-extrabold text-gray-800",children:"Generar recortes"}),ee.length>1&&/* @__PURE__ */l("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 text-xs font-semibold rounded",children:ie.label})]}),
232
+ /* @__PURE__ */l("h2",{className:"text-lg sm:text-xl font-extrabold text-gray-800",children:"Generar recortes"}),Z.length>1&&/* @__PURE__ */l("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 text-xs font-semibold rounded",children:ae.label})]}),
231
233
  /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
232
234
  /* @__PURE__ */l("label",{className:"text-xs text-gray-500 whitespace-nowrap w-fit",children:"Nombre:"}),
233
- /* @__PURE__ */l("div",{className:"",children:J+"."+(globalThis.downloadFormat||e.mime_type.split("/")[1]||"webp")})]})]}),
235
+ /* @__PURE__ */l("div",{className:"",children:X+"."+(globalThis.downloadFormat||e.mime_type.split("/")[1]||"webp")})]})]}),
234
236
  /* @__PURE__ */s("div",{className:"flex flex-row self-end gap-2 w-full max-w-fit sm:w-auto flex-wrap",children:[
235
- /* @__PURE__ */s("button",{onClick:u,disabled:ge,className:"flex flex-row items-center gap-1 self-end w-full max-w-fit sm:w-auto px-3 cursor-pointer py-1.5 text-sm rounded bg-neutral-gray-500 hover:bg-neutral-gray-700 transition-colors text-white disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Cancelar y volver",title:"Cancelar y volver",children:[
236
- /* @__PURE__ */l("span",{className:"icon icon-arrow-left-white icon--sm m-0 p-0"})," ","Cancelar"]}),d&&/* @__PURE__ */s("button",{onClick:()=>d(e),disabled:h|ge,className:"flex flex-row items-center gap-1 self-end w-full max-w-fit sm:w-auto px-3 cursor-pointer py-1.5 text-sm rounded bg-red-800 hover:bg-red-1000 transition-colors text-white disabled:opacity-50 disabled:cursor-not-allowed","aria-label":`Eliminar imagen ${e.filename}`,title:`Eliminar imagen ${e.filename}`,children:[
237
+ /* @__PURE__ */s("button",{onClick:u,disabled:fe,className:"flex flex-row items-center gap-1 self-end w-full max-w-fit sm:w-auto px-3 cursor-pointer py-1.5 text-sm rounded bg-neutral-gray-500 hover:bg-neutral-gray-700 transition-colors text-white disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Cancelar y volver",title:"Cancelar y volver",children:[
238
+ /* @__PURE__ */l("span",{className:"icon icon-arrow-left-white icon--sm m-0 p-0"})," ","Cancelar"]}),d&&/* @__PURE__ */s("button",{onClick:()=>d(e),disabled:h|fe,className:"flex flex-row items-center gap-1 self-end w-full max-w-fit sm:w-auto px-3 cursor-pointer py-1.5 text-sm rounded bg-red-800 hover:bg-red-1000 transition-colors text-white disabled:opacity-50 disabled:cursor-not-allowed","aria-label":`Eliminar imagen ${e.filename}`,title:`Eliminar imagen ${e.filename}`,children:[
237
239
  /* @__PURE__ */l("span",{className:"icon icon-close-small-white icon--sm m-0 p-0"}),h?"Eliminando...":"Eliminar"]})]})]}),
238
- /* @__PURE__ */s("div",{className:"limbo-cropper-status bg-white border-gray-100 py-0 pb-0 flex-shrink-0",children:[be&&/* @__PURE__ */s("div",{className:"alert alert-danger mb-2 text-sm",role:"alert",children:[
239
- /* @__PURE__ */l("strong",{children:"Error:"})," ",be]}),_e&&/* @__PURE__ */s("div",{className:"alert alert-secondary mb-2 text-sm",role:"status",children:[
240
- /* @__PURE__ */l("strong",{children:"Original:"})," ",_e.naturalWidth," ×"," ",_e.naturalHeight," px",_e.currentWidth!==_e.naturalWidth&&/* @__PURE__ */s("span",{className:"ml-2 sm:ml-3 text-xs block sm:inline",children:["(Mostrada: ",Math.round(_e.currentWidth)," ×"," ",Math.round(_e.currentHeight)," px)"]})]}),!ze&&/* @__PURE__ */l("div",{className:"alert alert-warning mb-2 text-sm",role:"alert",children:"⚠️ No se puede exportar por restricciones CORS"}),
240
+ /* @__PURE__ */s("div",{className:"limbo-cropper-status bg-white border-gray-100 py-0 pb-0 flex-shrink-0",children:[ge&&/* @__PURE__ */s("div",{className:"alert alert-danger mb-2 text-sm",role:"alert",children:[
241
+ /* @__PURE__ */l("strong",{children:"Error:"})," ",ge]}),$e&&/* @__PURE__ */s("div",{className:"alert alert-secondary mb-2 text-sm",role:"status",children:[
242
+ /* @__PURE__ */l("strong",{children:"Original:"})," ",$e.naturalWidth," ×"," ",$e.naturalHeight," px",$e.currentWidth!==$e.naturalWidth&&/* @__PURE__ */s("span",{className:"ml-2 sm:ml-3 text-xs block sm:inline",children:["(Mostrada: ",Math.round($e.currentWidth)," ×"," ",Math.round($e.currentHeight)," px)"]})]}),!_e&&/* @__PURE__ */l("div",{className:"alert alert-warning mb-2 text-sm",role:"alert",children:"⚠️ No se puede exportar por restricciones CORS"}),
241
243
  /* @__PURE__ */s("div",{className:"bg-white border-b border-gray-200 py-2 mx-2 shrink-0 sticky top-0 z-10 mb-1",children:[
242
244
  /* @__PURE__ */s("div",{className:"flex items-center justify-between mb-2",children:[
243
- /* @__PURE__ */s("h3",{className:"text-sm font-semibold text-gray-700",children:["Recortes ",ee.length>1&&`(${ee.length})`]}),Z.allowCustomCrops&&/* @__PURE__ */s("button",{onClick:Ye,disabled:ge,className:"text-xs cursor-pointer px-2 py-1 bg-brand-blue-50 hover:bg-brand-blue-200 text-brand-blue-1000 rounded border border-brand-blue-200 transition-colors flex items-center gap-1",title:"Añadir recorte personalizado",children:[
245
+ /* @__PURE__ */s("h3",{className:"text-sm font-semibold text-gray-700",children:["Recortes ",Z.length>1&&`(${Z.length})`]}),J.allowCustomCrops&&/* @__PURE__ */s("button",{onClick:Qe,disabled:fe,className:"text-xs cursor-pointer px-2 py-1 bg-brand-blue-50 hover:bg-brand-blue-200 text-brand-blue-1000 rounded border border-brand-blue-200 transition-colors flex items-center gap-1",title:"Añadir recorte personalizado",children:[
244
246
  /* @__PURE__ */l("span",{className:"icon icon-add icon--sm",style:{filter:"var(--icon-blue)"}}),"Añadir recorte"]})]}),
245
- /* @__PURE__ */l("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-1.5 max-h-48 overflow-y-auto",children:ee.map((e,t)=>{const n=e.savedState||t===re;/* @__PURE__ */
246
- return s("label",{className:"flex flex-col p-1.5 rounded border cursor-pointer transition-colors min-h-17.5 w-full "+(re===t?"bg-blue-50 border-blue-300":n?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-orange-50 border-orange-300 hover:bg-orange-100"),children:[
247
- /* @__PURE__ */l("input",{type:"radio",name:"active-crop",checked:re===t,onChange:()=>Qe(t),disabled:ge,className:"hidden"}),
247
+ /* @__PURE__ */l("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-1.5 max-h-48 overflow-y-auto",children:Z.map((e,t)=>{const n=e.savedState||t===ne;/* @__PURE__ */
248
+ return s("label",{className:"h-fit flex flex-col p-1.5 rounded border cursor-pointer transition-colors min-h-17.5 w-full "+(ne===t?"bg-blue-50 border-blue-300":n?"bg-gray-50 border-gray-200 hover:bg-gray-100":"bg-orange-50 border-orange-300 hover:bg-orange-100"),children:[
249
+ /* @__PURE__ */l("input",{type:"radio",name:"active-crop",checked:ne===t,onChange:()=>Ge(t),disabled:fe,className:"hidden"}),
248
250
  /* @__PURE__ */s("div",{className:"flex items-center gap-1 mb-1",children:[
249
- /* @__PURE__ */l("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */s("div",{className:"flex flex-wrap items-center gap-1 min-h-",children:[re!==t||e.required?/* @__PURE__ */l("span",{className:"text-xs font-medium text-gray-800 limbo-truncate",children:e.label}):/* @__PURE__ */l("input",{type:"text",value:e.label,onChange:e=>Ze(e.target.value),disabled:ge,className:"w-full text-xs px-1 py-0.5 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500 min-h-5",placeholder:"Nombre",maxLength:25,onClick:e=>e.stopPropagation()}),e.required&&/* @__PURE__ */l("span",{className:"text-[10px] px-1 py-0.5 bg-red-200 text-red-1000 rounded whitespace-nowrap truncate",children:"Obligatorio"})]})}),!e.required&&ee.length>1&&/* @__PURE__ */l("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),et(t,e.label)},className:"shrink-0 hover:bg-red-500/70 text-red-1000 p-1 rounded max-h-fit aspect-square cursor-pointer flex",title:"Eliminar",children:/* @__PURE__ */l("span",{className:"icon icon-close-small icon--xs"})})]}),
250
- /* @__PURE__ */l("div",{className:"flex items-center gap-1 mt-auto",children:re===t?/* @__PURE__ */s(c,{children:[
251
- /* @__PURE__ */l("input",{type:"number",min:"100",max:"5000",value:e.width,onChange:e=>Xe("width",e.target.value),onBlur:()=>Je("width"),disabled:ge||e.lockDimensions,className:"flex-1 text-xs px-1 py-0.5 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500 "+(e.lockDimensions?"border-gray-200 bg-gray-100 text-gray-500 cursor-not-allowed":"border-gray-300"),placeholder:"W",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Ancho en píxeles"}),
251
+ /* @__PURE__ */l("div",{className:"flex-1 min-w-0",children:/* @__PURE__ */s("div",{className:"flex flex-wrap items-center gap-1 min-h-",children:[ne!==t||e.required?/* @__PURE__ */l("span",{className:"text-xs font-medium text-gray-800 limbo-truncate",children:e.label}):/* @__PURE__ */l("input",{type:"text",value:e.label,onChange:e=>Je(e.target.value),disabled:fe,className:"w-full text-xs px-1 py-0.5 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-blue-500 min-h-5",placeholder:"Nombre",maxLength:25,onClick:e=>e.stopPropagation()}),e.required&&/* @__PURE__ */l("span",{className:"text-[10px] px-1 py-0.5 bg-red-200 text-red-1000 rounded whitespace-nowrap truncate",children:"Obligatorio"})]})}),!e.required&&Z.length>1&&/* @__PURE__ */l("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),Ze(t,e.label)},className:"shrink-0 hover:bg-red-500/70 text-red-1000 p-1 rounded max-h-fit aspect-square cursor-pointer flex",title:"Eliminar",children:/* @__PURE__ */l("span",{className:"icon icon-close-small icon--xs"})})]}),
252
+ /* @__PURE__ */l("div",{className:"flex items-center gap-1 mt-auto",children:ne===t?/* @__PURE__ */s(c,{children:[
253
+ /* @__PURE__ */l("input",{type:"number",min:"100",max:"5000",value:e.width,onChange:e=>Ye("width",e.target.value),onBlur:()=>Xe("width"),disabled:fe||e.lockDimensions,className:"max-h-fit flex-1 text-xs px-1 py-0.5 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500 "+(e.lockDimensions?"border-gray-200 bg-gray-100 text-gray-500 cursor-not-allowed":"border-gray-300"),placeholder:"W",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Ancho en píxeles"}),
252
254
  /* @__PURE__ */l("span",{className:"text-gray-400 text-xs",children:"×"}),
253
- /* @__PURE__ */l("input",{type:"number",min:"100",max:"5000",value:e.height,onChange:e=>Xe("height",e.target.value),onBlur:()=>Je("height"),disabled:ge||e.lockDimensions,className:"flex-1 text-xs px-1 py-0.5 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500 "+(e.lockDimensions?"border-gray-200 bg-gray-100 text-gray-500 cursor-not-allowed":"border-gray-300"),placeholder:"H",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Alto en píxeles"})]}):/* @__PURE__ */s("span",{className:"text-xs text-gray-500",children:[e.width," × ",e.height," px"]})}),!n&&/* @__PURE__ */l("div",{className:"text-xs px-1 py-0.5 bg-orange-200 text-neutral-gray-25 text-shadow-xs font-semibold rounded text-center mt-1",children:"Sin configurar"})]},e.id)})})]})]}),
255
+ /* @__PURE__ */l("input",{type:"number",min:"100",max:"5000",value:e.height,onChange:e=>Ye("height",e.target.value),onBlur:()=>Xe("height"),disabled:fe||e.lockDimensions,className:"max-h-fit flex-1 text-xs px-1 py-0.5 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500 "+(e.lockDimensions?"border-gray-200 bg-gray-100 text-gray-500 cursor-not-allowed":"border-gray-300"),placeholder:"H",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Alto en píxeles"})]}):/* @__PURE__ */s("span",{className:"text-xs text-gray-500",children:[e.width," × ",e.height," px"]})}),!n&&/* @__PURE__ */l("div",{className:"text-xs px-1 py-0.5 bg-orange-300 text-neutral-gray-25 text-shadow-xs font-semibold rounded text-center mt-1",children:"Sin configurar"})]},e.id)})})]})]}),
254
256
  /* @__PURE__ */s("div",{className:"flex flex-col lg:flex-row flex-1 w-full overflow-hidden lg:max-h-130 mx-2 py-1",children:[
255
257
  /* @__PURE__ */l("div",{className:"relative flex-1 lg:flex-2 h-full shrink-0 grow-1 order-0 min-h-100 lg:min-h-130",children:/* @__PURE__ */s("div",{className:"absolute inset-0 bg-white rounded-lg border-2 border-gray-200 overflow-hidden",children:[
256
258
  /* @__PURE__ */l(te,{show:D,message:"Cargando recortador..."}),
257
- /* @__PURE__ */l(te,{show:R,message:`Cambiando a: ${ee[re]?.label||"recorte"}...`}),
258
- /* @__PURE__ */s("cropper-canvas",{ref:Se,style:{width:"100%",height:"100%",display:"block"},background:!!E||void 0,id:"limbo-cropperjs-canvas",tabindex:"-1",onKeyDown:e=>{"Delete"!==e.key&&"Backspace"!==e.key||(e.preventDefault(),e.stopPropagation())},children:[
259
- /* @__PURE__ */l("cropper-image",{ref:Ne,src:e.url||e.path,alt:e.filename,id:"limbo-cropperjs-image",action:"move",crossOrigin:"anonymous",rotatable:!0,scalable:!0,skewable:!0,translatable:!0}),
260
- /* @__PURE__ */s("cropper-selection",{ref:Ee,"initial-coverage":"0.5",movable:!0,resizable:!0,keyboard:"true",action:"move",style:{cursor:"move",minWidth:`${le.minWidth}px`,minHeight:`${le.minHeight}px`},"data-prevent-delete":"true",tabindex:"-1",children:[S&&/* @__PURE__ */l("cropper-grid",{role:"grid",action:"move",covered:!0,bordered:!0}),
259
+ /* @__PURE__ */l(te,{show:R,message:`Cambiando a: ${Z[ne]?.label||"recorte"}...`}),
260
+ /* @__PURE__ */s("cropper-canvas",{ref:Ce,style:{width:"100%",height:"100%",display:"block"},background:!!E||void 0,id:"limbo-cropperjs-canvas",tabindex:"-1",onKeyDown:e=>{"Delete"!==e.key&&"Backspace"!==e.key||(e.preventDefault(),e.stopPropagation())},children:[
261
+ /* @__PURE__ */l("cropper-image",{ref:Se,src:e.url||e.path,alt:e.filename,id:"limbo-cropperjs-image",action:"move",crossOrigin:"anonymous",rotatable:!0,scalable:!0,skewable:!0,translatable:!0}),
262
+ /* @__PURE__ */s("cropper-selection",{ref:Ne,"initial-coverage":"0.5",movable:!0,resizable:!0,keyboard:"true",action:"move",style:{cursor:"move",minWidth:`${oe.minWidth}px`,minHeight:`${oe.minHeight}px`},"data-prevent-delete":"true",tabindex:"-1",children:[S&&/* @__PURE__ */l("cropper-grid",{role:"grid",action:"move",covered:!0,bordered:!0}),
261
263
  /* @__PURE__ */l("cropper-handle",{action:"move",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"32px",height:"32px",zIndex:"10"}}),
262
264
  /* @__PURE__ */l("cropper-handle",{action:"n-resize"}),
263
265
  /* @__PURE__ */l("cropper-handle",{action:"e-resize"}),
@@ -269,94 +271,94 @@ return s("label",{className:"flex flex-col p-1.5 rounded border cursor-pointer t
269
271
  /* @__PURE__ */l("cropper-handle",{action:"sw-resize"})]})]})]})}),
270
272
  /* @__PURE__ */l("div",{className:"w-full lg:max-w-80 mt-2 lg:my-0 overflow-y-auto bg-white border-t lg:border-t-0 lg:border-l border-gray-200 flex-shrink-0",children:/* @__PURE__ */s("div",{className:"h-full mt-2 lg:my-0 limbo-me-2 lg:mx-2 space-y-2 grid grid-cols-2 md:grid-cols-3 flex-wrap md:flex-nowrap items-start flex-row gap-2 lg:gap-0 lg:block",children:[
271
273
  /* @__PURE__ */s("div",{className:"bg-white rounded border w-full border-gray-200 mb-2",children:[
272
- /* @__PURE__ */l("button",{onClick:De,className:"hidden sm:block w-full p-2 mb-05 cursor-pointer hover:bg-neutral-gray-050/50 transition-colors rounded-t-sm","aria-expanded":Y,"aria-label":"Mostrar/ocultar opciones de visualización",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
274
+ /* @__PURE__ */l("button",{onClick:Le,className:"hidden sm:block w-full p-2 mb-05 cursor-pointer hover:bg-neutral-gray-050/50 transition-colors rounded-t-sm","aria-expanded":Q,"aria-label":"Mostrar/ocultar opciones de visualización",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
273
275
  /* @__PURE__ */l("h3",{className:"text-sm font-semibold text-gray-700",children:"Transformar imagen"}),
274
- /* @__PURE__ */l("div",{className:"text-center",children:/* @__PURE__ */l("span",{className:`icon ${Y?"icon-chevron-up":"icon-chevron-down"} text-center icon--xs`})})]})}),
275
- /* @__PURE__ */s("div",{className:"p-2 space-y-2 justify-items-stretch static "+(Y?"block":"sm:hidden"),children:[
276
+ /* @__PURE__ */l("div",{className:"text-center",children:/* @__PURE__ */l("span",{className:`icon ${Q?"icon-chevron-up":"icon-chevron-down"} text-center icon--xs`})})]})}),
277
+ /* @__PURE__ */s("div",{className:"p-2 space-y-2 justify-items-stretch static "+(Q?"block":"sm:hidden"),children:[
276
278
  /* @__PURE__ */l("div",{className:"mb-3 block",children:/* @__PURE__ */s("div",{className:"grid grid-cols-5 gap-1 content-center h-fit mx-auto",children:[
277
- /* @__PURE__ */l("button",{onClick:()=>Ue(-.2),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Alejar",disabled:ge,"aria-label":"Alejar imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-zoom-out-blue"})})}),
278
- /* @__PURE__ */l("button",{onClick:()=>Fe(-10,-10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover arriba-izquierda",disabled:ge,"aria-label":"Mover imagen hacia arriba-izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md -rotate-45"})})}),
279
- /* @__PURE__ */l("button",{onClick:()=>Fe(0,-10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover arriba",disabled:ge,"aria-label":"Mover imagen hacia arriba",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md"})})}),
280
- /* @__PURE__ */l("button",{onClick:()=>Fe(10,-10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover arriba-derecha",disabled:ge,"aria-label":"Mover imagen hacia arriba-derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md rotate-45"})})}),
281
- /* @__PURE__ */l("button",{onClick:()=>Ue(.2),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Acercar 20%",disabled:ge,"aria-label":"Acercar imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-zoom-in-blue"})})}),
282
- /* @__PURE__ */l("button",{onClick:()=>qe(-45),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Rotar -45°",disabled:ge,"aria-label":"Rotar imagen 45 grados a la izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"text-brand-blue-1000 font-medium",children:"-45°"})})}),
283
- /* @__PURE__ */l("button",{onClick:()=>Fe(-10,0),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover izquierda",disabled:ge,"aria-label":"Mover imagen hacia la izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-left-blue"})})}),
284
- /* @__PURE__ */l("button",{onClick:Oe,className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Centrar y ajustar imagen",disabled:ge,"aria-label":"Centrar y ajustar imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-radio-button-blue icon-md"})})}),
285
- /* @__PURE__ */l("button",{onClick:()=>Fe(10,0),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover derecha",disabled:ge,"aria-label":"Mover imagen hacia la derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-right-blue"})})}),
286
- /* @__PURE__ */l("button",{onClick:()=>qe(45),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Rotar +45°",disabled:ge,"aria-label":"Rotar imagen 45 grados a la derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"text-brand-blue-1000 font-medium",children:"+45°"})})}),
287
- /* @__PURE__ */l("button",{onClick:We,className:"px-0 rounded cursor-pointer transition-colors text-sm aspect-square "+(U.horizontal?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),title:"Voltear horizontalmente "+(U.horizontal?"(activo)":""),disabled:ge,"aria-label":"Voltear imagen horizontalmente","aria-pressed":U.horizontal,children:/* @__PURE__ */l("div",{className:"flex items-center justify-center gap-2",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-left-right-blue border border-brand-blue-1000 rounded"})})}),
288
- /* @__PURE__ */l("button",{onClick:()=>Fe(-10,10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover abajo-izquierda",disabled:ge,"aria-label":"Mover imagen hacia abajo-izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md -rotate-145"})})}),
289
- /* @__PURE__ */l("button",{onClick:()=>Fe(0,10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover abajo",disabled:ge,"aria-label":"Mover imagen hacia abajo",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-down-blue"})})}),
290
- /* @__PURE__ */l("button",{onClick:()=>Fe(10,10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover abajo-derecha",disabled:ge,"aria-label":"Mover imagen hacia abajo-derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md rotate-145"})})}),
291
- /* @__PURE__ */l("button",{onClick:Ve,className:"px-0 rounded cursor-pointer transition-colors aspect-square text-sm "+(U.vertical?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),title:"Voltear verticalmente "+(U.vertical?"(activo)":""),disabled:ge,"aria-label":"Voltear imagen verticalmente","aria-pressed":U.vertical,children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-down-blue border border-brand-blue-1000 rounded"})})})]})}),
292
- /* @__PURE__ */l("div",{className:"flex flex-col gap-2",children:/* @__PURE__ */l("button",{onClick:()=>{xe.reset(),q({horizontal:!1,vertical:!1})},className:"w-full p-2 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",title:"Reiniciar transformaciones",disabled:ge,"aria-label":"Reiniciar todas las transformaciones de la imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */s("span",{children:[
279
+ /* @__PURE__ */l("button",{onClick:()=>Fe(-.2),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Alejar",disabled:fe,"aria-label":"Alejar imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-zoom-out-blue"})})}),
280
+ /* @__PURE__ */l("button",{onClick:()=>je(-10,-10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover arriba-izquierda",disabled:fe,"aria-label":"Mover imagen hacia arriba-izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md -rotate-45"})})}),
281
+ /* @__PURE__ */l("button",{onClick:()=>je(0,-10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover arriba",disabled:fe,"aria-label":"Mover imagen hacia arriba",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md"})})}),
282
+ /* @__PURE__ */l("button",{onClick:()=>je(10,-10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover arriba-derecha",disabled:fe,"aria-label":"Mover imagen hacia arriba-derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md rotate-45"})})}),
283
+ /* @__PURE__ */l("button",{onClick:()=>Fe(.2),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Acercar 20%",disabled:fe,"aria-label":"Acercar imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-zoom-in-blue"})})}),
284
+ /* @__PURE__ */l("button",{onClick:()=>Ue(-45),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Rotar -45°",disabled:fe,"aria-label":"Rotar imagen 45 grados a la izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"text-brand-blue-1000 font-medium",children:"-45°"})})}),
285
+ /* @__PURE__ */l("button",{onClick:()=>je(-10,0),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover izquierda",disabled:fe,"aria-label":"Mover imagen hacia la izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-left-blue"})})}),
286
+ /* @__PURE__ */l("button",{onClick:De,className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Centrar y ajustar imagen",disabled:fe,"aria-label":"Centrar y ajustar imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-radio-button-blue icon-md"})})}),
287
+ /* @__PURE__ */l("button",{onClick:()=>je(10,0),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover derecha",disabled:fe,"aria-label":"Mover imagen hacia la derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-right-blue"})})}),
288
+ /* @__PURE__ */l("button",{onClick:()=>Ue(45),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Rotar +45°",disabled:fe,"aria-label":"Rotar imagen 45 grados a la derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"text-brand-blue-1000 font-medium",children:"+45°"})})}),
289
+ /* @__PURE__ */l("button",{onClick:Be,className:"px-0 rounded cursor-pointer transition-colors text-sm aspect-square "+(F.horizontal?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),title:"Voltear horizontalmente "+(F.horizontal?"(activo)":""),disabled:fe,"aria-label":"Voltear imagen horizontalmente","aria-pressed":F.horizontal,children:/* @__PURE__ */l("div",{className:"flex items-center justify-center gap-2",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-left-right-blue border border-brand-blue-1000 rounded"})})}),
290
+ /* @__PURE__ */l("button",{onClick:()=>je(-10,10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover abajo-izquierda",disabled:fe,"aria-label":"Mover imagen hacia abajo-izquierda",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md -rotate-145"})})}),
291
+ /* @__PURE__ */l("button",{onClick:()=>je(0,10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover abajo",disabled:fe,"aria-label":"Mover imagen hacia abajo",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-down-blue"})})}),
292
+ /* @__PURE__ */l("button",{onClick:()=>je(10,10),className:"px-0 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200 aspect-square",title:"Mover abajo-derecha",disabled:fe,"aria-label":"Mover imagen hacia abajo-derecha",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-blue icon--md rotate-145"})})}),
293
+ /* @__PURE__ */l("button",{onClick:We,className:"px-0 rounded cursor-pointer transition-colors aspect-square text-sm "+(F.vertical?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),title:"Voltear verticalmente "+(F.vertical?"(activo)":""),disabled:fe,"aria-label":"Voltear imagen verticalmente","aria-pressed":F.vertical,children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{className:"icon icon-arrow-up-down-blue border border-brand-blue-1000 rounded"})})})]})}),
294
+ /* @__PURE__ */l("div",{className:"flex flex-col gap-2",children:/* @__PURE__ */l("button",{onClick:()=>{we.reset(),U({horizontal:!1,vertical:!1})},className:"w-full p-2 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",title:"Reiniciar transformaciones",disabled:fe,"aria-label":"Reiniciar todas las transformaciones de la imagen",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */s("span",{children:[
293
295
  /* @__PURE__ */l("span",{className:"icon icon-refresh-blue icon--sm align-[middle!important] "})," ","Reiniciar ajustes"]})})})})]})]}),
294
- /* @__PURE__ */s("div",{className:"bg-white rounded border border-gray-200 w-full"+(G?"":" bg-neutral-gray-50/50"),children:[
295
- /* @__PURE__ */l("button",{onClick:Le,className:"hidden sm:block w-full cursor-pointer hover:bg-neutral-gray-050/50 p-2 mb-05 transition-colors rounded-t-sm","aria-expanded":G,"aria-label":"Mostrar/ocultar opciones de visualizción",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
296
+ /* @__PURE__ */s("div",{className:"bg-white rounded border border-gray-200 w-full"+(K?"":" bg-neutral-gray-50/50"),children:[
297
+ /* @__PURE__ */l("button",{onClick:Ie,className:"hidden sm:block w-full cursor-pointer hover:bg-neutral-gray-050/50 p-2 mb-05 transition-colors rounded-t-sm","aria-expanded":K,"aria-label":"Mostrar/ocultar opciones de visualizción",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
296
298
  /* @__PURE__ */l("h3",{className:"text-sm font-semibold text-gray-700",children:"Ajustes del selector"}),
297
- /* @__PURE__ */l("div",{className:"text-center",children:/* @__PURE__ */l("span",{className:`icon ${G?"icon-chevron-up":"icon-chevron-down"} text-center icon--xs`})})]})}),
298
- /* @__PURE__ */s("div",{className:"p-2 space-y-2 justify-items-stretch static "+(G?"block":"sm:hidden"),children:[
299
+ /* @__PURE__ */l("div",{className:"text-center",children:/* @__PURE__ */l("span",{className:`icon ${K?"icon-chevron-up":"icon-chevron-down"} text-center icon--xs`})})]})}),
300
+ /* @__PURE__ */s("div",{className:"p-2 space-y-2 justify-items-stretch static "+(K?"block":"sm:hidden"),children:[
299
301
  /* @__PURE__ */l("div",{children:/* @__PURE__ */s("div",{className:"grid grid-cols-2 gap-2",children:[
300
- /* @__PURE__ */l("button",{onClick:()=>Be(.5),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:ge,"aria-label":"Selección 50%",title:"Tamaño de selector 50%",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"50%"})})}),
301
- /* @__PURE__ */l("button",{onClick:()=>Be(.7),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:ge,"aria-label":"Selección 70%",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"70%"})})}),
302
- /* @__PURE__ */l("button",{onClick:()=>Be(.9),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:ge,"aria-label":"Selección 90%",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"90%"})})}),
303
- /* @__PURE__ */l("button",{onClick:()=>Be(1),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:ge,"aria-label":"Selección completa",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"100%"})})})]})}),
302
+ /* @__PURE__ */l("button",{onClick:()=>qe(.5),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:fe,"aria-label":"Selección 50%",title:"Tamaño de selector 50%",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"50%"})})}),
303
+ /* @__PURE__ */l("button",{onClick:()=>qe(.7),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:fe,"aria-label":"Selección 70%",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"70%"})})}),
304
+ /* @__PURE__ */l("button",{onClick:()=>qe(.9),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:fe,"aria-label":"Selección 90%",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"90%"})})}),
305
+ /* @__PURE__ */l("button",{onClick:()=>qe(1),className:"p-1 rounded cursor-pointer transition-colors text-xs bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",disabled:fe,"aria-label":"Selección completa",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */l("span",{children:"100%"})})})]})}),
304
306
  /* @__PURE__ */s("div",{className:"space-y-2 pt-2",children:[
305
- /* @__PURE__ */l("button",{onClick:Re,className:"w-full p-1 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",title:"Centrar selección",disabled:ge,"aria-label":"Centrar área de selección",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */s("span",{children:[
307
+ /* @__PURE__ */l("button",{onClick:Oe,className:"w-full p-1 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",title:"Centrar selección",disabled:fe,"aria-label":"Centrar área de selección",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */s("span",{children:[
306
308
  /* @__PURE__ */l("span",{className:"icon icon-radio-button icon--sm align-[middle!important] "})," ","Centrar selección"]})})}),
307
- /* @__PURE__ */l("button",{onClick:je,className:"w-full p-1 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",title:"Reiniciar selección",disabled:ge,"aria-label":"Reiniciar área de selección",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */s("span",{children:[
309
+ /* @__PURE__ */l("button",{onClick:Re,className:"w-full p-1 rounded cursor-pointer transition-colors text-sm bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200",title:"Reiniciar selección",disabled:fe,"aria-label":"Reiniciar área de selección",children:/* @__PURE__ */l("div",{className:"flex items-center justify-center",children:/* @__PURE__ */s("span",{children:[
308
310
  /* @__PURE__ */l("span",{className:"icon icon-refresh icon--sm limbo-lign-[middle!important] "})," ","Reset selección"]})})})]})]})]}),
309
311
  /* @__PURE__ */s("div",{className:"bg-white rounded border border-gray-200 w-full",children:[
310
- /* @__PURE__ */l("button",{onClick:Ie,className:"hidden sm:block w-full cursor-pointer hover:bg-neutral-gray-050/50 transition-colors rounded-t-sm mb-05 p-2","aria-expanded":H,"aria-label":"Mostrar/ocultar opciones de visualización",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
312
+ /* @__PURE__ */l("button",{onClick:Me,className:"hidden sm:block w-full cursor-pointer hover:bg-neutral-gray-050/50 transition-colors rounded-t-sm mb-05 p-2","aria-expanded":V,"aria-label":"Mostrar/ocultar opciones de visualización",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
311
313
  /* @__PURE__ */l("h3",{className:"text-sm font-semibold text-gray-700",children:"Visualización"}),
312
- /* @__PURE__ */l("div",{className:"text-center",children:/* @__PURE__ */l("span",{className:`icon ${H?"icon-chevron-up":"icon-chevron-down"} text-center icon--xs`})})]})}),
313
- /* @__PURE__ */s("div",{className:"py-2 space-y-2 justify-items-stretch static "+(H?"block":"sm:hidden"),children:[
314
- /* @__PURE__ */s("button",{onClick:Me,className:"w-auto flex cursor-pointer items-center justify-between mx-2 p-1 rounded transition-colors "+(S?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),disabled:ge,"aria-pressed":S,title:"Mostrar/ocultar cuadrícula de la regla de los tercios en el selector","aria-label":"Activar/desactivar grid",children:[
314
+ /* @__PURE__ */l("div",{className:"text-center",children:/* @__PURE__ */l("span",{className:`icon ${V?"icon-chevron-up":"icon-chevron-down"} text-center icon--xs`})})]})}),
315
+ /* @__PURE__ */s("div",{className:"py-2 space-y-2 justify-items-stretch static "+(V?"block":"sm:hidden"),children:[
316
+ /* @__PURE__ */s("button",{onClick:Ae,className:"w-auto flex cursor-pointer items-center justify-between mx-2 p-1 rounded transition-colors "+(S?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),disabled:fe,"aria-pressed":S,title:"Mostrar/ocultar cuadrícula de la regla de los tercios en el selector","aria-label":"Activar/desactivar grid",children:[
315
317
  /* @__PURE__ */s("span",{className:"text-sm flex items-center",children:[
316
318
  /* @__PURE__ */l("span",{className:"icon icon-area-blue limbo-me-1"})," ","Cuadrícula"]}),
317
319
  /* @__PURE__ */l("span",{className:"text-xs",children:S?/* @__PURE__ */s(c,{children:[
318
320
  /* @__PURE__ */l("span",{className:"icon icon-tick icon--xs align-[middle!important] -mt-0.5"})," ","Activo"]}):"Inactivo"})]}),
319
- /* @__PURE__ */s("button",{onClick:Pe,className:"w-auto flex cursor-pointer items-center justify-between mx-2 p-1 rounded transition-colors "+(E?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),disabled:ge,"aria-pressed":E,"aria-label":"Activar/desactivar sombreado",children:[
321
+ /* @__PURE__ */s("button",{onClick:Pe,className:"w-auto flex cursor-pointer items-center justify-between mx-2 p-1 rounded transition-colors "+(E?"bg-blue-100 border border-blue-300 text-blue-800":"bg-gray-100 border border-gray-300 text-gray-700 hover:bg-gray-200"),disabled:fe,"aria-pressed":E,"aria-label":"Activar/desactivar sombreado",children:[
320
322
  /* @__PURE__ */s("span",{className:"text-sm flex items-center",children:[
321
323
  /* @__PURE__ */l("span",{className:"icon icon-comparison-blue limbo-me-1"})," ","Tablero"]}),
322
324
  /* @__PURE__ */l("span",{className:"text-xs",children:E?/* @__PURE__ */s(c,{children:[
323
325
  /* @__PURE__ */l("span",{className:"icon icon-tick icon--xs align-[middle!important] -mt-0.5"})," ","Activo"]}):"Inactivo"})]})]})]})]})})]}),
324
326
  /* @__PURE__ */s("div",{className:"flex justify-between shrink-0 border-t border-gray-200 bg-white mx-2 mt-1 py-2 lg:gap-0",children:[
325
- /* @__PURE__ */s("button",{onClick:()=>V(!0),className:"text-nowrap block cursor-pointer lg:flex items-center gap-2 px-2 py-1 bg-gradient-to-br from-brand-blue-50 to-green-50 hover:from-brand-blue-100 hover:to-green-100 border border-blue-200 rounded-lg shadow-sm transition-colors","aria-label":"Abrir guía de uso",children:[
327
+ /* @__PURE__ */s("button",{onClick:()=>W(!0),className:"text-nowrap block cursor-pointer lg:flex items-center gap-2 px-2 py-1 bg-gradient-to-br from-brand-blue-50 to-green-50 hover:from-brand-blue-100 hover:to-green-100 border border-blue-200 rounded-lg shadow-sm transition-colors","aria-label":"Abrir guía de uso",children:[
326
328
  /* @__PURE__ */l("span",{className:"icon icon-lightbulb text-yellow-500"}),
327
329
  /* @__PURE__ */l("span",{className:"text-sm font-semibold text-blue-800",children:"Guía de uso"}),
328
330
  /* @__PURE__ */l("span",{className:"icon icon-arrow-down scale-75 -rotate-145"})]}),
329
- /* @__PURE__ */l("button",{onClick:nt,disabled:ge||!ze,className:`px-3 cursor-pointer py-1.5 text-sm rounded transition-colors ${y?"bg-red-1000 hover:bg-red-800 text-white":"bg-brand-blue-800 hover:bg-brand-blue-1000 text-white"} disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":"Vista previa",title:"Mostrar/Ocultar vista previa",children:/* @__PURE__ */s("div",{className:"flex items-center gap-1",children:[
331
+ /* @__PURE__ */l("button",{onClick:tt,disabled:fe||!_e,className:`px-3 cursor-pointer py-1.5 text-sm rounded transition-colors ${y?"bg-red-1000 hover:bg-red-800 text-white":"bg-brand-blue-800 hover:bg-brand-blue-1000 text-white"} disabled:opacity-50 disabled:cursor-not-allowed`,"aria-label":"Vista previa",title:"Mostrar/Ocultar vista previa",children:/* @__PURE__ */s("div",{className:"flex items-center gap-1",children:[
330
332
  /* @__PURE__ */l("span",{className:"icon icon-search-white icon--sm"}),
331
333
  /* @__PURE__ */l("span",{className:"hidden sm:inline whitespace-nowrap",children:y?"Cerrar previa":"Vista previa"})]})}),
332
334
  /* @__PURE__ */s("div",{className:"flex flex-row gap-1 lg:gap-2 items-center justify-end",children:[
333
- /* @__PURE__ */l("button",{onClick:gt,disabled:ge||!ze,className:"cursor-pointer px-3 py-1.5 text-sm rounded bg-brand-blue-800 hover:bg-brand-blue-1000 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Descargar",title:"Descargar recorte sin guardar",children:/* @__PURE__ */s("div",{className:"flex items-center gap-1",children:[
335
+ /* @__PURE__ */l("button",{onClick:ft,disabled:fe||!_e,className:"cursor-pointer px-3 py-1.5 text-sm rounded bg-brand-blue-800 hover:bg-brand-blue-1000 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Descargar",title:"Descargar recorte sin guardar",children:/* @__PURE__ */s("div",{className:"flex items-center gap-1",children:[
334
336
  /* @__PURE__ */l("span",{className:"icon icon-download-white icon--sm"}),
335
- /* @__PURE__ */l("span",{className:"hidden md:inline whitespace-nowrap",children:"Descargar"})]})}),e.file&&/* @__PURE__ */l("button",{onClick:bt,disabled:ge||g,className:"px-3 cursor-pointer py-1.5 text-sm rounded bg-teal-600 hover:bg-teal-700 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Conservar solo imagen original sin crear recortes",title:"Subir y guardar la imagen original sin crear recortes",children:/* @__PURE__ */s("div",{className:"flex items-center gap-1",children:[
337
+ /* @__PURE__ */l("span",{className:"hidden md:inline whitespace-nowrap",children:"Descargar"})]})}),e.file&&/* @__PURE__ */l("button",{onClick:gt,disabled:fe||g,className:"px-3 cursor-pointer py-1.5 text-sm rounded bg-teal-600 hover:bg-teal-700 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Conservar solo imagen original sin crear recortes",title:"Subir y guardar la imagen original sin crear recortes",children:/* @__PURE__ */s("div",{className:"flex items-center gap-1",children:[
336
338
  /* @__PURE__ */l("span",{className:"icon icon-tick-white icon--sm"}),
337
339
  /* @__PURE__ */l("span",{className:"hidden md:inline whitespace-nowrap",children:"Conservar original"})]})}),
338
- /* @__PURE__ */l("button",{onClick:mt,disabled:ge||!$e||!Ae||!ze||!we.isReady,className:"px-3 cursor-pointer py-1.5 text-sm rounded bg-green-600 hover:bg-green-700 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Guardar imagen recortada",children:/* @__PURE__ */l("div",{className:"flex items-center gap-1",children:/* @__PURE__ */s(c,ge?{children:[
340
+ /* @__PURE__ */l("button",{onClick:dt,disabled:fe||!Ee||!Te||!_e||!ve.isReady,className:"px-3 cursor-pointer py-1.5 text-sm rounded bg-green-600 hover:bg-green-700 text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",title:"Guardar imagen recortada",children:/* @__PURE__ */l("div",{className:"flex items-center gap-1",children:/* @__PURE__ */s(c,fe?{children:[
339
341
  /* @__PURE__ */l("span",{className:"icon icon-save-white icon--sm"}),
340
342
  /* @__PURE__ */l("span",{children:"Guardando..."})]}:{children:[
341
343
  /* @__PURE__ */l("span",{className:"icon icon-save-white icon--sm"}),
342
- /* @__PURE__ */l("span",{className:"hidden md:inline whitespace-nowrap",children:"Guardar recorte"})]})})})]})]}),se&&/* @__PURE__ */l("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] p-4",children:/* @__PURE__ */s("div",{className:"bg-white rounded-lg shadow-xl max-w-lg w-full max-h-[80vh] overflow-hidden flex flex-col",children:[
344
+ /* @__PURE__ */l("span",{className:"hidden md:inline whitespace-nowrap",children:"Guardar recorte"})]})})})]})]}),le&&/* @__PURE__ */l("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] p-4",children:/* @__PURE__ */s("div",{className:"bg-white rounded-lg shadow-xl max-w-lg w-full max-h-[80vh] overflow-hidden flex flex-col",children:[
343
345
  /* @__PURE__ */s("div",{className:"px-6 py-4 border-b border-gray-200",children:[
344
- /* @__PURE__ */l("h3",{className:"text-lg font-semibold text-gray-800",children:"save"===me?"Seleccionar recortes a guardar":"Seleccionar recortes a descargar"}),
345
- /* @__PURE__ */s("p",{className:"text-sm text-gray-600 mt-1",children:["Marca los recortes que deseas"," ","save"===me?"guardar":"descargar"]})]}),
346
- /* @__PURE__ */l("div",{className:"px-6 py-4 overflow-y-auto flex-1",children:/* @__PURE__ */l("div",{className:"space-y-2",children:ee.map((e,t)=>{const n=e.savedState||t===re,r=!e.required&&!n;/* @__PURE__ */
347
- return s("label",{className:`flex items-center gap-3 p-3 rounded border transition-colors ${ue.includes(t)?"bg-blue-50 border-blue-300":r?"bg-gray-100 border-gray-300 opacity-60":"bg-gray-50 border-gray-200 hover:bg-gray-100"} ${r?"cursor-not-allowed":"cursor-pointer"}`,children:[
348
- /* @__PURE__ */l("input",{type:"checkbox",checked:ue.includes(t),disabled:r,onChange:e=>{e.target.checked?de(e=>[...e,t]):de(e=>e.filter(e=>e!==t))},className:"w-4 h-4 text-blue-600"}),
346
+ /* @__PURE__ */l("h3",{className:"text-lg font-semibold text-gray-800",children:"save"===de?"Seleccionar recortes a guardar":"Seleccionar recortes a descargar"}),
347
+ /* @__PURE__ */s("p",{className:"text-sm text-gray-600 mt-1",children:["Marca los recortes que deseas"," ","save"===de?"guardar":"descargar"]})]}),
348
+ /* @__PURE__ */l("div",{className:"px-6 py-4 overflow-y-auto flex-1",children:/* @__PURE__ */l("div",{className:"space-y-2",children:Z.map((e,t)=>{const n=e.savedState||t===ne,r=!e.required&&!n;/* @__PURE__ */
349
+ return s("label",{className:`flex items-center gap-3 p-3 rounded border transition-colors ${ce.includes(t)?"bg-blue-50 border-blue-300":r?"bg-gray-100 border-gray-300 opacity-60":"bg-gray-50 border-gray-200 hover:bg-gray-100"} ${r?"cursor-not-allowed":"cursor-pointer"}`,children:[
350
+ /* @__PURE__ */l("input",{type:"checkbox",checked:ce.includes(t),disabled:r,onChange:e=>{e.target.checked?ue(e=>[...e,t]):ue(e=>e.filter(e=>e!==t))},className:"w-4 h-4 text-blue-600"}),
349
351
  /* @__PURE__ */s("div",{className:"flex-1 min-w-0",children:[
350
352
  /* @__PURE__ */s("div",{className:"flex items-center gap-2 flex-wrap",children:[
351
353
  /* @__PURE__ */s("span",{title:"Nombre del archivo a descargar",className:"text-sm font-medium text-gray-800 truncate",children:[e.label,"_",e.width,"_",e.height]}),e.required&&/* @__PURE__ */l("span",{className:"text-xs px-1.5 py-0.5 bg-red-200 text-red-1000 rounded whitespace-nowrap",children:"Obligatorio"}),!n&&!e.required&&/* @__PURE__ */l("span",{className:"text-xs px-1.5 py-0.5 bg-orange-100 text-orange-700 rounded whitespace-nowrap",children:"Sin configurar"})]}),
352
354
  /* @__PURE__ */s("span",{title:"Dimensiones del recorte",className:"text-xs text-gray-500",children:[e.width," × ",e.height," px"]})]})]},e.id)})})}),
353
355
  /* @__PURE__ */s("div",{className:"px-6 py-4 border-t border-gray-200 flex gap-3 justify-end",children:[
354
- /* @__PURE__ */l("button",{onClick:()=>{ce(!1),he(null),de([])},className:"limbo-btn limbo-btn-secondary px-4 py-2",children:"Cancelar"}),
355
- /* @__PURE__ */s("button",{onClick:async()=>{if(ce(!1),"save"===me)if(1===ue.length){const e=re;ae(ue[0]),await new Promise(e=>setTimeout(e,100)),await ut(),ae(e)}else await dt(ue);else if(1===ue.length){const e=re;ae(ue[0]),await new Promise(e=>setTimeout(e,100)),await ft(),ae(e)}else await pt(ue);he(null),de([])},disabled:0===ue.length,className:"limbo-btn limbo-btn-primary px-4 py-2 disabled:opacity-50 disabled:cursor-not-allowed",children:["save"===me?"Guardar":"Descargar"," (",ue.length,")"]})]})]})}),W&&/* @__PURE__ */l("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[9999] p-4",children:/* @__PURE__ */s("div",{className:"bg-white rounded-lg shadow-xl max-w-5xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[
356
+ /* @__PURE__ */l("button",{onClick:()=>{se(!1),me(null),ue([])},className:"limbo-btn limbo-btn-secondary px-4 py-2",children:"Cancelar"}),
357
+ /* @__PURE__ */s("button",{onClick:async()=>{if(se(!1),"save"===de)if(1===ce.length){const e=ne;re(ce[0]),await new Promise(e=>setTimeout(e,100)),await ct(),re(e)}else await ut(ce);else if(1===ce.length){const e=ne;re(ce[0]),await new Promise(e=>setTimeout(e,100)),await pt(),re(e)}else await ht(ce);me(null),ue([])},disabled:0===ce.length,className:"limbo-btn limbo-btn-primary px-4 py-2 disabled:opacity-50 disabled:cursor-not-allowed",children:["save"===de?"Guardar":"Descargar"," (",ce.length,")"]})]})]})}),q&&/* @__PURE__ */l("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[9999] p-4",children:/* @__PURE__ */s("div",{className:"bg-white rounded-lg shadow-xl max-w-5xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[
356
358
  /* @__PURE__ */l("div",{className:"px-6 py-4 border-b border-gray-200 bg-brand-blue-50",children:/* @__PURE__ */s("div",{className:"flex items-center justify-between",children:[
357
359
  /* @__PURE__ */s("h3",{className:"text-xl font-semibold text-brand-blue-1000 flex items-center gap-2",children:[
358
360
  /* @__PURE__ */l("span",{className:"icon icon-lightbulb text-yellow-500"}),"Guía de uso del Cropper"]}),
359
- /* @__PURE__ */l("button",{onClick:()=>V(!1),className:"text-gray-400 hover:text-gray-600 p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Cerrar modal",children:/* @__PURE__ */l("span",{className:"icon icon-close-small icon--lg"})})]})}),
361
+ /* @__PURE__ */l("button",{onClick:()=>W(!1),className:"text-gray-400 hover:text-gray-600 p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Cerrar modal",children:/* @__PURE__ */l("span",{className:"icon icon-close-small icon--lg"})})]})}),
360
362
  /* @__PURE__ */s("div",{className:"px-6 py-4 overflow-y-auto flex-1 space-y-4",children:[
361
363
  /* @__PURE__ */s("div",{className:"bg-brand-blue-50 rounded-lg p-4 border-l-4 border-brand-blue-400",children:[
362
364
  /* @__PURE__ */l("h4",{className:"font-semibold text-brand-blue-1000 mb-3 text-base flex items-center gap-2",children:"🖱️ Navegación básica"}),
@@ -458,7 +460,7 @@ return s("label",{className:`flex items-center gap-3 p-3 rounded border transiti
458
460
  /* @__PURE__ */l("span",{className:"font-bold min-w-fit",children:"•"}),
459
461
  /* @__PURE__ */s("div",{children:[
460
462
  /* @__PURE__ */l("strong",{children:"Cambios pendientes:"})," Recuerda guardar tus cambios antes de cerrar o cambiar de imagen"]})]})]})]})]}),
461
- /* @__PURE__ */l("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50",children:/* @__PURE__ */l("button",{onClick:()=>V(!1),className:"limbo-btn limbo-btn-primary w-full",children:"Entendido"})})]})}),y&&/* @__PURE__ */l("div",{className:"min-w-[90%] fixed md:absolute inset-0 md:inset-auto bg-black/50 md:bg-transparent flex items-center justify-center md:block z-[9999] md:z-50 pointer-events-none",onClick:e=>{e.target===e.currentTarget&&window.innerWidth<768&&(v(!1),x(null))},children:/* @__PURE__ */s("div",{className:"pointer-events-auto bg-white rounded-lg shadow-2xl border-2 border-brand-blue-800 overflow-hidden flex flex-col max-w-md w-full mx-4 md:mx-0 max-h-[80vh] md:max-h-[600px]",style:{...window.innerWidth>=768?{position:"absolute",left:`${_.x}px`,top:`${_.y}px`,width:"420px",cursor:T?"grabbing":"default"}:{}},onMouseDown:rt,onTouchStart:ot,children:[
463
+ /* @__PURE__ */l("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50",children:/* @__PURE__ */l("button",{onClick:()=>W(!1),className:"limbo-btn limbo-btn-primary w-full",children:"Entendido"})})]})}),y&&/* @__PURE__ */l("div",{className:"min-w-[90%] fixed md:absolute inset-0 md:inset-auto bg-black/50 md:bg-transparent flex items-center justify-center md:block z-[9999] md:z-50 pointer-events-none",onClick:e=>{e.target===e.currentTarget&&window.innerWidth<768&&(v(!1),x(null))},children:/* @__PURE__ */s("div",{className:"pointer-events-auto bg-white rounded-lg shadow-2xl border-2 border-brand-blue-800 overflow-hidden flex flex-col max-w-md w-full mx-4 md:mx-0 max-h-[80vh] md:max-h-[600px]",style:{...window.innerWidth>=768?{position:"absolute",left:`${_.x}px`,top:`${_.y}px`,width:"420px",cursor:T?"grabbing":"default"}:{}},onMouseDown:nt,onTouchStart:it,children:[
462
464
  /* @__PURE__ */s("div",{className:"limbo-preview-modal-header px-4 py-3 bg-gradient-to-r from-brand-blue-800 to-brand-blue-1000 text-white flex items-center justify-between cursor-grab active:cursor-grabbing select-none",style:{cursor:T?"grabbing":"grab"},children:[
463
465
  /* @__PURE__ */s("div",{className:"flex items-center gap-2",children:[
464
466
  /* @__PURE__ */l("span",{className:"icon icon-search-white icon--sm"}),
@@ -473,36 +475,36 @@ return s("label",{className:`flex items-center gap-3 p-3 rounded border transiti
473
475
  /* @__PURE__ */l("span",{className:"icon icon-search-white icon--xs"}),
474
476
  /* @__PURE__ */l("span",{children:"Ampliar"})]})]}),
475
477
  /* @__PURE__ */s("div",{className:"text-center text-xs text-gray-500",children:[
476
- /* @__PURE__ */l("p",{className:"font-medium text-gray-700 mb-1",children:ie?.label||"Recorte"}),
477
- /* @__PURE__ */s("p",{children:[ie?.width," × ",ie?.height," px"]})]})]}):/* @__PURE__ */l("div",{className:"flex items-center justify-center h-full min-h-[200px]",children:/* @__PURE__ */l("p",{className:"text-sm text-gray-500",children:"No se pudo generar la vista previa"})})}),
478
+ /* @__PURE__ */l("p",{className:"font-medium text-gray-700 mb-1",children:ae?.label||"Recorte"}),
479
+ /* @__PURE__ */s("p",{children:[ae?.width," × ",ae?.height," px"]})]})]}):/* @__PURE__ */l("div",{className:"flex items-center justify-center h-full min-h-[200px]",children:/* @__PURE__ */l("p",{className:"text-sm text-gray-500",children:"No se pudo generar la vista previa"})})}),
478
480
  /* @__PURE__ */l("div",{className:"px-4 py-2 bg-gray-100 border-t border-gray-200",children:/* @__PURE__ */s("p",{className:"text-xs text-gray-600 text-center",children:[
479
481
  /* @__PURE__ */s("span",{className:"hidden md:inline",children:["Arrastra desde el título para mover •"," "]}),"Actualización automática al editar"]})})]})}),
480
- /* @__PURE__ */l(B,{src:w,alt:"Vista previa del recorte",title:ie?.label||"Recorte",subtitle:`${ie?.width||0} × ${ie?.height||0} px`,isOpen:I&&!!w,onClose:()=>L(!1)})]}):null}function Xt({currentPage:t,totalPages:n,onPageChange:r,disabled:a=!1}){if(!n||n<=1)return null;const i=(()=>{const e=[],r=[],a=Math.max(1,t-2),i=Math.min(n,t+2);for(let t=a;t<=i;t++)e.push(t);return a>1&&(r.push(1),a>2&&r.push("...")),r.push(...e),i<n&&(i<n-1&&r.push("..."),r.push(n)),r})();/* @__PURE__ */
482
+ /* @__PURE__ */l(B,{src:w,alt:"Vista previa del recorte",title:ae?.label||"Recorte",subtitle:`${ae?.width||0} × ${ae?.height||0} px`,isOpen:I&&!!w,onClose:()=>L(!1)})]}):null}function Jt({currentPage:t,totalPages:n,onPageChange:r,disabled:a=!1}){if(!n||n<=1)return null;const i=(()=>{const e=[],r=[],a=Math.max(1,t-2),i=Math.min(n,t+2);for(let t=a;t<=i;t++)e.push(t);return a>1&&(r.push(1),a>2&&r.push("...")),r.push(...e),i<n&&(i<n-1&&r.push("..."),r.push(n)),r})();/* @__PURE__ */
481
483
  return s("div",{className:"flex items-center justify-center space-x-2 py-4",children:[
482
484
  /* @__PURE__ */s("button",{onClick:()=>{t>1&&r(t-1)},disabled:a||t<=1,className:` px-3 py-2 text-sm font-medium rounded-md transition-colors disabled:cursor-default cursor-pointer ${a||t<=1?"text-gray-400 bg-gray-100 cursor-not-allowed":"text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 focus:ring-2 focus:ring-blue-500"} `,children:[
483
485
  /* @__PURE__ */l("span",{className:"icon icon-arrow-left-white icon--sm"})," Anterior"]}),
484
486
  /* @__PURE__ */l("div",{className:"flex space-x-1",children:i.map((n,i)=>/* @__PURE__ */l(e.Fragment,{children:"..."===n?/* @__PURE__ */l("span",{className:"px-3 py-2 text-sm text-gray-500",children:"..."}):/* @__PURE__ */l("button",{onClick:()=>(e=>{e!==t&&r(e)})(n),disabled:a,className:` px-3 py-2 text-sm font-medium rounded-md transition-colors disabled:cursor-default cursor-pointer ${n===t?"bg-blue-600 text-white border border-blue-600":a?"text-gray-400 bg-gray-100 cursor-not-allowed":"text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 focus:ring-2 focus:ring-blue-500"} `,children:n})},`page-${n}-${i}`))}),
485
487
  /* @__PURE__ */s("button",{onClick:()=>{t<n&&r(t+1)},disabled:a||t>=n,className:` px-3 py-2 text-sm font-medium rounded-md transition-colors disabled:cursor-default cursor-pointer ${a||t>=n?"text-gray-400 bg-gray-100 cursor-not-allowed":"text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 focus:ring-2 focus:ring-blue-500"} `,children:["Siguiente ",
486
488
  /* @__PURE__ */l("span",{className:"icon icon-arrow-right-white icon--sm"})]}),
487
- /* @__PURE__ */s("div",{className:"text-sm text-gray-500 ml-4",children:["Página ",t," de ",n]})]})}function Jt({text:e="Cargando..."}){/* @__PURE__ */
489
+ /* @__PURE__ */s("div",{className:"text-sm text-gray-500 ml-4",children:["Página ",t," de ",n]})]})}function Zt({text:e="Cargando..."}){/* @__PURE__ */
488
490
  return s("div",{className:"flex flex-col items-center justify-center py-8 text-gray-600",role:"status","aria-live":"polite","aria-label":e,children:[
489
491
  /* @__PURE__ */s("svg",{className:"animate-spin h-6 w-6 mb-2 text-blue-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[
490
492
  /* @__PURE__ */l("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),
491
493
  /* @__PURE__ */l("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8H4z"})]}),
492
- /* @__PURE__ */l("p",{className:"text-sm",id:"loader-text",children:e})]})}function Zt({isOpen:e,onClose:t}){return e?/* @__PURE__ */l("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",style:{zIndex:9999},children:/* @__PURE__ */s("div",{className:"bg-white rounded-lg p-6 max-w-md mx-4 shadow-xl",children:[
494
+ /* @__PURE__ */l("p",{className:"text-sm",id:"loader-text",children:e})]})}function en({isOpen:e,onClose:t}){return e?/* @__PURE__ */l("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",style:{zIndex:9999},children:/* @__PURE__ */s("div",{className:"bg-white rounded-lg p-6 max-w-md mx-4 shadow-xl",children:[
493
495
  /* @__PURE__ */s("div",{className:"flex items-center mb-4",children:[
494
496
  /* @__PURE__ */l("svg",{className:"w-6 h-6 text-red-1000 mr-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),
495
497
  /* @__PURE__ */l("h3",{className:"text-lg font-semibold text-gray-900",children:"Sesión Expirada"})]}),
496
498
  /* @__PURE__ */s("div",{className:"mb-6",children:[
497
499
  /* @__PURE__ */l("p",{className:"text-gray-600 mb-2",children:"Su sesión ha expirado por seguridad."}),
498
500
  /* @__PURE__ */l("p",{className:"text-gray-600",children:"Es necesario recargar la página para obtener un nuevo token de acceso."})]}),
499
- /* @__PURE__ */l("div",{className:"flex justify-end space-x-3",children:/* @__PURE__ */l("button",{onClick:t,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors",children:"Recargar Página"})})]})}):null}function en(){const[e,n]=t(!1),[r,a]=t(null);return{deleteImg:async e=>{if(!e)return a("ID de imagen no proporcionado"),!1;n(!0),a(null);try{const t=await async function(e){try{return await A({endpoint:`/assets/${e}`,method:"DELETE",basePath:O,useJWT:!0})}catch(r){throw D(r)}}(e);return!1!==t.success}catch(t){return a(t.message),!1}finally{n(!1)}},loading:e,error:r,reset:()=>{a(null)}}}const tn=/* @__PURE__ */new Map;function nn(e,r=500){const[a,i]=t(e);return n(()=>{const t=setTimeout(()=>{i(e)},r);return()=>{clearTimeout(t)}},[e,r]),a}function rn({apiKey:e,prod:a=!1,url:o=!0,features:u=["gallery","upload","cropper"],modeUI:d="full",ui:m={showActions:["select","download","copy","delete","crop","variants"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0},callbacks:h={},instanceId:p=null,itemsPerPage:f=10,_externalImage:g=null,cropperConfig:b=null}){sessionStorage.removeItem("limbo_stock_selectedService"),sessionStorage.removeItem("limbo_stock_dynamicForm"),sessionStorage.removeItem("limbo_stock_stockImages"),sessionStorage.removeItem("limbo_stock_currentPage"),sessionStorage.removeItem("limbo_stock_paginationInfo"),sessionStorage.removeItem("limbo_portals_searchName"),sessionStorage.removeItem("limbo_portals_limit"),sessionStorage.removeItem("limbo_portals_currentPage"),sessionStorage.removeItem("limbo_portals_images"),sessionStorage.removeItem("limbo_portals_portalResults"),sessionStorage.removeItem("limbo_portals_paginationInfo");const[y,v]=t({name:"",uploadedBy:"",dateFrom:"",dateTo:""}),w=nn(y.name,500),x=nn(y.uploadedBy,500),k=(()=>{switch(d){case"gallery-only":return["gallery"];case"upload-only":return["upload","cropper"];case"crop-only":return["cropper"];case"ia-only":return["ia"];default:return u}})(),[C,S]=t(k.includes("gallery")?"gallery":k.includes("upload")?"upload":k.includes("cropper")?"cropper":k.includes("ia")?"ia":k[0]||"gallery"),[N,$]=t(null);n(()=>{g&&(console.log("📸 Imagen externa detectada:",g),$(g),S("cropper"))},[g]);const[_,z]=t(1),{isTokenExpired:T,handleTokenExpiredClose:A}=function(){const[e,a]=t(!1),i=r(e=>{if(401===e?.response?.status){const t=e.response.data;if("token_expired"===t?.error||t?.message?.includes("expired")||t?.message?.includes("caducado")||t?.error?.includes("expired"))return a(!0),!0}return!1},[]),o=r(()=>{a(!1),alert("El token ha expirado. La página se recargará para obtener un nuevo token."),window.location.reload()},[]);return n(()=>{const e=e=>{e.detail&&e.detail.error&&i(e.detail.error)};return window.addEventListener("tokenExpiredError",e),()=>{window.removeEventListener("tokenExpiredError",e)}},[i]),{isTokenExpired:e,checkTokenExpiration:i,handleTokenExpiredClose:o}}(),{upload:M,loading:P,error:I,uploadedImage:L,reset:D}=function(){const[e,n]=t(!1),[r,a]=t(null),[i,o]=t(null);return{upload:async(e,t=null)=>{if(!e)return a("No se ha proporcionado ningún archivo"),null;n(!0),a(null),o(null);try{const n=await j(e,t,!1),r=n.result||n;return o(r),r}catch(r){return a(r.message),null}finally{n(!1)}},loading:e,error:r,uploadedImage:i,reset:()=>{a(null),o(null)}}}(),{deleteImg:O,loading:F,error:U,reset:B}=en(),W={limit:f,page:_,...w&&{name:w},...x&&{uploadedBy:x},...y.dateFrom&&{dateFrom:y.dateFrom},...y.dateTo&&{dateTo:y.dateTo}},V=k.includes("gallery"),{images:H,loading:G,error:Q,pagination:Y,invalidateCache:X,setImages:J}=function(e,r=!1,a={},o=!0){const[l,s]=t([]),[c,u]=t(o),[d,m]=t(null),[h,p]=t(null),[f,g]=t(0),b=i(()=>JSON.stringify(a),[a]);return n(()=>{if(!o)return void u(!1);const e=`${b}`,t=tn.get(e),n=Date.now();if(t&&n-t.timestamp<6e5)return s(t.data),p(t.pagination||null),void u(!1);let r=!0;return(async()=>{if(f>=3)r&&(m("Error de autenticación: Verifica tus credenciales API"),u(!1));else try{const t=await R(a);if(!r)return;const i=t.result||t.data||[],o=t.pagination||null;s(i),p(o),m(null),g(0),tn.set(e,{data:i,pagination:o,timestamp:n})}catch(t){r&&(m(t.message),g(e=>e+1))}finally{r&&u(!1)}})(),()=>{r=!1}},[e,r,b,f,a,o]),{images:l,loading:c,error:d,pagination:h,setImages:s,invalidateCache:()=>{tn.delete(`${b}`)}}}(e,a,W,V),{refreshVariants:Z}=q(),ee=e=>!m.hideActions?.includes(e)&&(!!m.showActions?.includes(e)||!(m.showActions?.length>0)),te=[{id:"gallery",label:"Galería",feature:"gallery"},{id:"upload",label:"Subir nueva",feature:"upload"},{id:"cropper",label:"Recortador",hideNonActive:!0,feature:"cropper"}].filter(e=>k.includes(e.feature)),ne=async e=>{const t=URL.createObjectURL(e),n=await new Promise(e=>{const n=new Image;n.onload=()=>{e({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(t)},n.onerror=()=>{e({width:1920,height:1080}),URL.revokeObjectURL(t)},n.src=t}),r={file:e,filename:e.name,mime_type:e.type,url:URL.createObjectURL(e),width:n.width,height:n.height};if($(r),k.includes("cropper"))S("cropper");else{const t=await M(e);t&&(X(),z(1),J(e=>[t,...e]),S("gallery"),h.onUpload&&h.onUpload({assetId:t.id,url:t.url,fileName:t.filename,mime:t.mime_type,width:t.width,height:t.height,instanceId:p}))}},re=async e=>{if(!confirm("¿Estás seguro de que deseas eliminar esta imagen? Esta acción también eliminará todos sus recortes."))return;await O(e)&&(X(),z(1),J(t=>t.filter(t=>t.id!==e)),N&&N.id===e&&($(null),S("gallery")))},ae=()=>"crop-only"===d||1===k.length&&"cropper"===k[0]?"crop-only":k.includes("gallery")?"with-gallery":k.includes("upload")&&!k.includes("gallery")?"upload-only":"with-gallery";/* @__PURE__ */
500
- return s(c,{children:[m.showTabs&&"cropper"!=C&&/* @__PURE__ */l(E,{tabs:te,active:C,onChange:e=>{S(e),"upload"!==e&&D(),"gallery"!==e&&B()}}),Q&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al cargar imágenes: ",Q]}),U&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al eliminar imagen: ",U]}),"gallery"===C&&/* @__PURE__ */s(c,{children:[F&&/* @__PURE__ */l(Jt,{text:"Eliminando imagen..."}),L&&/* @__PURE__ */s("div",{className:"alert alert-success absolute top-0 right-[50px] m-4",children:["✅ Imagen subida correctamente: ",L.filename]}),
501
- /* @__PURE__ */l(K,{onSelect:e=>{h.onSelect&&h.onSelect({assetId:e.id,url:e.url,fileName:e.filename,mime:e.mime_type,width:e.width,height:e.height,instanceId:p})},onCrop:e=>{$(e),k.includes("cropper")&&S("cropper")},onDelete:ee("delete")?re:null,deletingId:F,images:H,loading:G,error:Q,filters:y,onFiltersChange:e=>{v(e),z(1)},filterConfig:m.galleryFilters||{},loadingConfig:m.galleryLoading||{},allowedActions:{select:ee("select"),download:ee("download"),copy:ee("copy"),delete:ee("delete"),crop:ee("crop")}}),Y&&!G&&/* @__PURE__ */l(Xt,{currentPage:Y.page||_,totalPages:Y.pages||1,onPageChange:e=>{z(e)},disabled:G||F})]}),"upload"===C&&/* @__PURE__ */s("div",{children:[P&&/* @__PURE__ */l(Jt,{text:"Subiendo imagen..."}),I&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al subir imagen: ",I]}),L&&/* @__PURE__ */s("div",{className:"alert alert-success absolute top-0 right-[50px] m-4",children:["✅ Imagen subida correctamente: ",L.filename]}),
502
- /* @__PURE__ */l(he,{onSelect:ne,disabled:P,apiKey:e,prod:a})]}),"cropper"===C&&N&&/* @__PURE__ */l(Yt,{image:N,onSave:e=>{const t=ae(),n=window.limboCore?.config?.getGlobal()||{},r=n.mode||"embed",a=n.autoHideOnComplete||!1;let i=[],o=null;e.crops&&e.asset?(i=e.crops,o=e.asset):i=Array.isArray(e)?e:[e],o&&"with-gallery"===t&&(J(e=>[o,...e]),z(1),h.onUpload&&h.onUpload({assetId:o.id,url:o.url,fileName:o.filename,mime:o.mime_type,width:o.width,height:o.height,instanceId:p})),"with-gallery"===t&&X();const l=o||N,s={crops:i,assetId:l?.id,instanceId:p,asset:l?{id:l.id,url:l.url||l.urlSigned,width:l.width,height:l.height,filename:l.filename,mime_type:l.mime_type}:null};switch(h.onCropsSaved&&h.onCropsSaved(s),window.limboCore?.events&&window.limboCore.events.emit("cropsSaved",s),t){case"with-gallery":$(null),S("gallery");break;case"upload-only":"modal"===r?window.limboCore?.modals?.closeAllModals():($(null),S("upload"));break;case"crop-only":if("modal"===r)h.onCropperComplete&&h.onCropperComplete({crops:i,instanceId:p}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:i,instanceId:p}),window.limboCore?.modals?.closeAllModals();else if(h.onCropperComplete&&h.onCropperComplete({crops:i,instanceId:p}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:i,instanceId:p}),a){const e=document.querySelector(`#limbo-instance-${p}`);e&&(e.style.display="none")}}},onCancel:()=>{const e=ae(),t=(window.limboCore?.config?.getGlobal()||{}).mode||"embed";switch(h.onCropperCancelled&&h.onCropperCancelled({assetId:N?.id,instanceId:p}),window.limboCore?.events&&window.limboCore.events.emit("cropperCancelled",{assetId:N?.id,instanceId:p}),e){case"with-gallery":$(null),S("gallery");break;case"upload-only":"modal"===t?window.limboCore?.modals?.closeAllModals():($(null),S("upload"));break;case"crop-only":"modal"===t?window.limboCore?.modals?.closeAllModals():window.limboCore?.events&&window.limboCore.events.emit("cropperClosed",{instanceId:p,reason:"cancelled"})}},onDelete:N?.id&&ee("delete")?()=>re(N.id):null,onError:e=>{h.onCropperError&&h.onCropperError(e,p),window.limboCore?.events&&window.limboCore.events.emit("cropperError",{error:e,assetId:N?.id,instanceId:p}),console.error("Cropper error:",e)},deleting:F,onVariantCreated:(e,t)=>{Z(e)},onUpload:M,uploading:P,cropperConfig:b}),"cropper"===C&&!N&&
503
- /* @__PURE__ */s("div","crop-only"===d?{children:[P&&/* @__PURE__ */l(Jt,{text:"Subiendo imagen..."}),I&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al subir imagen: ",I]}),
504
- /* @__PURE__ */l(he,{onSelect:ne,disabled:P,apiKey:e,prod:a})]}:{className:"limbo-empty-state flex flex-col items-center justify-center py-12 px-6 text-center",children:[
501
+ /* @__PURE__ */l("div",{className:"flex justify-end space-x-3",children:/* @__PURE__ */l("button",{onClick:t,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors",children:"Recargar Página"})})]})}):null}function tn(){const[e,n]=t(!1),[r,a]=t(null);return{deleteImg:async e=>{if(!e)return a("ID de imagen no proporcionado"),!1;n(!0),a(null);try{const t=await async function(e){try{return await A({endpoint:`/assets/${e}`,method:"DELETE",basePath:R,useJWT:!0})}catch(r){throw O(r)}}(e);return!1!==t.success}catch(t){return a(t.message),!1}finally{n(!1)}},loading:e,error:r,reset:()=>{a(null)}}}const nn=/* @__PURE__ */new Map;function rn(e,r=500){const[a,i]=t(e);return n(()=>{const t=setTimeout(()=>{i(e)},r);return()=>{clearTimeout(t)}},[e,r]),a}function an({apiKey:e,prod:a=!1,url:o=!0,features:u=["gallery","upload","cropper"],modeUI:d="full",ui:m={showActions:["select","download","copy","delete","crop","variants"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0},callbacks:h={},instanceId:p=null,itemsPerPage:f=10,_externalImage:g=null,cropperConfig:b=null}){sessionStorage.removeItem("limbo_stock_selectedService"),sessionStorage.removeItem("limbo_stock_dynamicForm"),sessionStorage.removeItem("limbo_stock_stockImages"),sessionStorage.removeItem("limbo_stock_currentPage"),sessionStorage.removeItem("limbo_stock_paginationInfo"),sessionStorage.removeItem("limbo_portals_searchName"),sessionStorage.removeItem("limbo_portals_limit"),sessionStorage.removeItem("limbo_portals_currentPage"),sessionStorage.removeItem("limbo_portals_images"),sessionStorage.removeItem("limbo_portals_portalResults"),sessionStorage.removeItem("limbo_portals_paginationInfo");const[y,v]=t({name:"",uploadedBy:"",dateFrom:"",dateTo:""}),w=rn(y.name,500),x=rn(y.uploadedBy,500),k=(()=>{switch(d){case"gallery-only":return["gallery"];case"upload-only":return["upload","cropper"];case"crop-only":return["cropper"];case"ia-only":return["ia"];default:return u}})(),[C,S]=t(k.includes("gallery")?"gallery":k.includes("upload")?"upload":k.includes("cropper")?"cropper":k.includes("ia")?"ia":k[0]||"gallery"),[N,$]=t(null);n(()=>{g&&(console.log("📸 Imagen externa detectada:",g),$(g),S("cropper"))},[g]);const[_,z]=t(1),{isTokenExpired:T,handleTokenExpiredClose:A}=function(){const[e,a]=t(!1),i=r(e=>{if(401===e?.response?.status){const t=e.response.data;if("token_expired"===t?.error||t?.message?.includes("expired")||t?.message?.includes("caducado")||t?.error?.includes("expired"))return a(!0),!0}return!1},[]),o=r(()=>{a(!1),alert("El token ha expirado. La página se recargará para obtener un nuevo token."),window.location.reload()},[]);return n(()=>{const e=e=>{e.detail&&e.detail.error&&i(e.detail.error)};return window.addEventListener("tokenExpiredError",e),()=>{window.removeEventListener("tokenExpiredError",e)}},[i]),{isTokenExpired:e,checkTokenExpiration:i,handleTokenExpiredClose:o}}(),{upload:P,loading:M,error:I,uploadedImage:L,reset:D}=function(){const[e,n]=t(!1),[r,a]=t(null),[i,o]=t(null);return{upload:async(e,t=null)=>{if(!e)return a("No se ha proporcionado ningún archivo"),null;n(!0),a(null),o(null);try{const n=await F(e,t,!1),r=n.result||n;return o(r),r}catch(r){return a(r.message),null}finally{n(!1)}},loading:e,error:r,uploadedImage:i,reset:()=>{a(null),o(null)}}}(),{deleteImg:O,loading:R,error:U,reset:B}=tn(),W={limit:f,page:_,...w&&{name:w},...x&&{uploadedBy:x},...y.dateFrom&&{dateFrom:y.dateFrom},...y.dateTo&&{dateTo:y.dateTo}},V=k.includes("gallery"),{images:H,loading:G,error:Q,pagination:Y,invalidateCache:X,setImages:J}=function(e,r=!1,a={},o=!0){const[l,s]=t([]),[c,u]=t(o),[d,m]=t(null),[h,p]=t(null),[f,g]=t(0),b=i(()=>JSON.stringify(a),[a]);return n(()=>{if(!o)return void u(!1);const e=`${b}`,t=nn.get(e),n=Date.now();if(t&&n-t.timestamp<6e5)return s(t.data),p(t.pagination||null),void u(!1);let r=!0;return(async()=>{if(f>=3)r&&(m("Error de autenticación: Verifica tus credenciales API"),u(!1));else try{const t=await j(a);if(!r)return;const i=t.result||t.data||[],o=t.pagination||null;s(i),p(o),m(null),g(0),nn.set(e,{data:i,pagination:o,timestamp:n})}catch(t){r&&(m(t.message),g(e=>e+1))}finally{r&&u(!1)}})(),()=>{r=!1}},[e,r,b,f,a,o]),{images:l,loading:c,error:d,pagination:h,setImages:s,invalidateCache:()=>{nn.delete(`${b}`)}}}(e,a,W,V),{refreshVariants:Z}=q(),ee=e=>!m.hideActions?.includes(e)&&(!!m.showActions?.includes(e)||!(m.showActions?.length>0)),te=[{id:"gallery",label:"Galería",feature:"gallery"},{id:"upload",label:"Subir nueva",feature:"upload"},{id:"cropper",label:"Recortador",hideNonActive:!0,feature:"cropper"}].filter(e=>k.includes(e.feature)),ne=async e=>{const t=URL.createObjectURL(e),n=await new Promise(e=>{const n=new Image;n.onload=()=>{e({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(t)},n.onerror=()=>{e({width:1920,height:1080}),URL.revokeObjectURL(t)},n.src=t}),r={file:e,filename:e.name,mime_type:e.type,url:URL.createObjectURL(e),width:n.width,height:n.height};if($(r),k.includes("cropper"))S("cropper");else{const t=await P(e);t&&(X(),z(1),J(e=>[t,...e]),S("gallery"),h.onUpload&&h.onUpload({assetId:t.id,url:t.url,fileName:t.filename,mime:t.mime_type,width:t.width,height:t.height,instanceId:p}))}},re=async e=>{if(!confirm("¿Estás seguro de que deseas eliminar esta imagen? Esta acción también eliminará todos sus recortes."))return;await O(e)&&(X(),z(1),J(t=>t.filter(t=>t.id!==e)),N&&N.id===e&&($(null),S("gallery")))},ae=()=>"crop-only"===d||1===k.length&&"cropper"===k[0]?"crop-only":k.includes("gallery")?"with-gallery":k.includes("upload")&&!k.includes("gallery")?"upload-only":"with-gallery";/* @__PURE__ */
502
+ return s(c,{children:[m.showTabs&&"cropper"!=C&&/* @__PURE__ */l(E,{tabs:te,active:C,onChange:e=>{S(e),"upload"!==e&&D(),"gallery"!==e&&B()}}),Q&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al cargar imágenes: ",Q]}),U&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al eliminar imagen: ",U]}),"gallery"===C&&/* @__PURE__ */s(c,{children:[R&&/* @__PURE__ */l(Zt,{text:"Eliminando imagen..."}),L&&/* @__PURE__ */s("div",{className:"alert alert-success absolute top-0 right-[50px] m-4",children:["✅ Imagen subida correctamente: ",L.filename]}),
503
+ /* @__PURE__ */l(K,{onSelect:e=>{h.onSelect&&h.onSelect({assetId:e.id,url:e.url,fileName:e.filename,mime:e.mime_type,width:e.width,height:e.height,instanceId:p})},onCrop:e=>{$(e),k.includes("cropper")&&S("cropper")},onDelete:ee("delete")?re:null,deletingId:R,images:H,loading:G,error:Q,filters:y,onFiltersChange:e=>{v(e),z(1)},filterConfig:m.galleryFilters||{},loadingConfig:m.galleryLoading||{},allowedActions:{select:ee("select"),download:ee("download"),copy:ee("copy"),delete:ee("delete"),crop:ee("crop")}}),Y&&!G&&/* @__PURE__ */l(Jt,{currentPage:Y.page||_,totalPages:Y.pages||1,onPageChange:e=>{z(e)},disabled:G||R})]}),"upload"===C&&/* @__PURE__ */s("div",{children:[M&&/* @__PURE__ */l(Zt,{text:"Subiendo imagen..."}),I&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al subir imagen: ",I]}),L&&/* @__PURE__ */s("div",{className:"alert alert-success absolute top-0 right-[50px] m-4",children:["✅ Imagen subida correctamente: ",L.filename]}),
504
+ /* @__PURE__ */l(he,{onSelect:ne,disabled:M,apiKey:e,prod:a})]}),"cropper"===C&&N&&/* @__PURE__ */l(Xt,{image:N,onSave:e=>{const t=ae(),n=window.limboCore?.config?.getGlobal()||{},r=n.mode||"embed",a=n.autoHideOnComplete||!1;let i=[],o=null;e.crops&&e.asset?(i=e.crops,o=e.asset):i=Array.isArray(e)?e:[e],o&&"with-gallery"===t&&(J(e=>[o,...e]),z(1),h.onUpload&&h.onUpload({assetId:o.id,url:o.url,fileName:o.filename,mime:o.mime_type,width:o.width,height:o.height,instanceId:p})),"with-gallery"===t&&X();const l=o||N,s={crops:i,assetId:l?.id,instanceId:p,asset:l?{id:l.id,url:l.url||l.urlSigned,width:l.width,height:l.height,filename:l.filename,mime_type:l.mime_type}:null};switch(h.onCropsSaved&&h.onCropsSaved(s),window.limboCore?.events&&window.limboCore.events.emit("cropsSaved",s),t){case"with-gallery":$(null),S("gallery");break;case"upload-only":"modal"===r?window.limboCore?.modals?.closeAllModals():($(null),S("upload"));break;case"crop-only":if("modal"===r)h.onCropperComplete&&h.onCropperComplete({crops:i,instanceId:p}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:i,instanceId:p}),window.limboCore?.modals?.closeAllModals();else if(h.onCropperComplete&&h.onCropperComplete({crops:i,instanceId:p}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:i,instanceId:p}),a){const e=document.querySelector(`#limbo-instance-${p}`);e&&(e.style.display="none")}}},onCancel:()=>{const e=ae(),t=(window.limboCore?.config?.getGlobal()||{}).mode||"embed";switch(h.onCropperCancelled&&h.onCropperCancelled({assetId:N?.id,instanceId:p}),window.limboCore?.events&&window.limboCore.events.emit("cropperCancelled",{assetId:N?.id,instanceId:p}),e){case"with-gallery":$(null),S("gallery");break;case"upload-only":"modal"===t?window.limboCore?.modals?.closeAllModals():($(null),S("upload"));break;case"crop-only":"modal"===t?window.limboCore?.modals?.closeAllModals():window.limboCore?.events&&window.limboCore.events.emit("cropperClosed",{instanceId:p,reason:"cancelled"})}},onDelete:N?.id&&ee("delete")?()=>re(N.id):null,onError:e=>{h.onCropperError&&h.onCropperError(e,p),window.limboCore?.events&&window.limboCore.events.emit("cropperError",{error:e,assetId:N?.id,instanceId:p}),console.error("Cropper error:",e)},deleting:R,onVariantCreated:(e,t)=>{Z(e)},onUpload:P,uploading:M,cropperConfig:b}),"cropper"===C&&!N&&
505
+ /* @__PURE__ */s("div","crop-only"===d?{children:[M&&/* @__PURE__ */l(Zt,{text:"Subiendo imagen..."}),I&&/* @__PURE__ */s("div",{className:"alert alert-danger",children:["Error al subir imagen: ",I]}),
506
+ /* @__PURE__ */l(he,{onSelect:ne,disabled:M,apiKey:e,prod:a})]}:{className:"limbo-empty-state flex flex-col items-center justify-center py-12 px-6 text-center",children:[
505
507
  /* @__PURE__ */l("div",{className:"text-gray-400 mb-4",children:/* @__PURE__ */l("svg",{className:"w-16 h-16 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),
506
508
  /* @__PURE__ */l("p",{className:"text-gray-600 mb-4",children:"Selecciona una imagen de la galería para comenzar a recortar."})]}),
507
- /* @__PURE__ */l(Zt,{isOpen:T,onClose:A})]})}class an{constructor(e,t,n,r){this.id=e,this.config=t,this.eventManager=n,this.modalManager=r,this.root=null,this.container=null,this.modal=null,this.mounted=!1,this.destroyed=!1,this.button=null,this._validateConfig(),this._initialize()}_initialize(){"embed"===this.config.mode?this.mount():"button"===this.config.mode&&this._createButton(),this._emitDOMEvent("ready",{instance:this,config:this.config,timestamp:Date.now()})}mount(){if(this.mounted||this.destroyed)return this;if(this.container=this._resolveContainer(),!this.container)return this.eventManager.emit("error",{instanceId:this.id,error:"Container not found"}),this;try{this.root=C.createRoot(this.container),this.root.render(this._renderApp()),this.mounted=!0,this.eventManager.emit("ready",{instance:this})}catch(e){this.eventManager.emit("error",{instanceId:this.id,error:e.message})}return this}unmount(){return this.mounted?(this.root&&(this.root.unmount(),this.root=null),"button"===this.config.mode&&this.button,this.mounted=!1,this):this}open(){return"modal"!==this.config.mode&&"button"!==this.config.mode||(this.modal||this._createModal(),this.modal&&!this.modal.isOpened()&&(this.modal.open(),this.eventManager.emit("modal:open",{instance:this}))),this}close(){return this.modal&&this.modal.isOpened()&&(this.eventManager?.emit("modal:close",{instance:this}),this.modal.close()),this}updateConfig(e){return this.config={...this.config,...e},this.mounted&&this.root.render(this._renderApp()),this.eventManager.emit("config:updated",{instance:this,newConfig:e}),this}destroy(){this.destroyed||(this.unmount(),this.modal&&(this.modal.destroy(),this.modal=null),this.button&&this.button.parentNode&&(this.button.parentNode.removeChild(this.button),this.button=null),this.eventManager.emit("destroy",{instance:this}),this.container=null,this.config=null,this.eventManager=null,this.modalManager=null,this.destroyed=!0)}getId(){return this.id}getMode(){return this.config.mode}isMounted(){return this.mounted}isDestroyed(){return this.destroyed}getContainer(){return this.container}getConfig(){return{...this.config}}isContainerInDOM(){return this.container&&document.contains(this.container)}_createModal(){if(this.modalManager&&"modal"===this.config.mode&&(this.modal=this.modalManager.createModal({title:this.config.title||"Limbo Image Manager",size:this.config.modalSize||"large",onOpen:()=>{const e={instance:this,mode:"modal",timestamp:Date.now()};this._emitDOMEvent("modal:open",e),this.config.callbacks?.onOpen&&this.config.callbacks.onOpen(e)},onClose:()=>{const e={instance:this,mode:"modal",timestamp:Date.now()};this._emitDOMEvent("modal:close",e),this.config.callbacks?.onClose&&this.config.callbacks.onClose(e),this.config.autoDestroy&&this.destroy()},onDestroy:()=>{this.modal=null}}),this.modal)){const e=this.modal.getBodyContainer();this.root=C.createRoot(e),this.root.render(this._renderApp()),this.mounted=!0}}_createButton(){if(this.container||(this.container=this._resolveContainer()),!this.container)return void this.eventManager.emit("error",{instanceId:this.id,error:"Container not found for button mode"});const e=document.createElement("button");e.type="button",e.className="limbo-trigger-button",e.textContent=this.config.buttonText||"Abrir Limbo",e.style.cssText="\n background: #001978;\n color: white;\n border: none;\n padding: 10px 20px;\n border-radius: 6px;\n cursor: pointer;\n font-family: inherit;\n font-size: 14px;\n font-weight: 500;\n transition: all 0.2s ease;\n ",e.addEventListener("mouseenter",()=>{e.style.backgroundColor="#334793",e.style.transform="translateY(-1px)"}),e.addEventListener("mouseleave",()=>{e.style.backgroundColor="#001978",e.style.transform="translateY(0)"}),e.addEventListener("click",()=>{this.open()}),this.container.appendChild(e),this.button=e,this.mounted=!0}_resolveContainer(){const{container:e}=this.config;return e?"string"==typeof e?document.querySelector(e):e instanceof Element?e:null:null}_renderApp(){return e.createElement("div",{id:`limbo-component-container-${this.id}`,className:"limbo-instance limbo-component-container-wrapper h-full w-full py-2 bg-white rounded-md","data-limbo-id":this.id,"data-limbo-mode":this.config.mode,"data-limbo-version":"2.0","data-limbo-isolated":"true","aria-label":"Limbo Image Manager",role:"region"},e.createElement(rn,{apiKey:this.config.apiKey||null,publicKey:this.config.publicKey||null,token:this.config.token||null,prod:this.config.prod||!1,url:this.config.url,features:this.config.features,modeUI:this.config.modeUI||"full",ui:this.config.ui,callbacks:this._createCallbacks(),instanceId:this.id,authMode:this.config.authMode||this.config.publicKey?"session":"manual",_externalImage:this.config._externalImage||null,cropperConfig:this.config.cropper||null}))}_createCallbacks(){return{onSelect:e=>{const t=this.config?.callbacks?.onSelect,n=this._createStandardPayload(e,"select");t&&t(n),this.destroyed||this._emitDOMEvent("select",n)},onUpload:e=>{const t=this.config?.callbacks?.onUpload,n=this._createStandardPayload(e,"upload");t&&t(n),this.destroyed||this._emitDOMEvent("upload",n)},onError:e=>{const t=this.config?.callbacks?.onError,n={instance:this,error:{message:e.message||"Unknown error",code:e.code||"UNKNOWN",timestamp:Date.now()}};t&&t(n.error),this.destroyed||this._emitDOMEvent("error",n)},onClose:()=>{const e=this.config?.callbacks?.onClose,t={instance:this,timestamp:Date.now()};e&&e(),this.destroyed||this._emitDOMEvent("close",t)}}}_createStandardPayload(e,t){const n={instance:this,eventType:t,timestamp:Date.now(),instanceId:this.id,mode:this.config?.mode,features:this.config?.features};return e&&(e.assetId||e.id?(n.assetId=e.assetId||e.id,n.variants=e.variants||[],n.master=e.master||{urlSigned:e.url||e.urlSigned,width:e.width,height:e.height,mime:e.mime||e.mimeType},n.fileName=e.fileName||e.name,n.mime=e.mime||e.mimeType,n.width=e.width,n.height=e.height,n.fileBlob=e.fileBlob||e.file,n.metadata={uploadedBy:e.uploadedBy,uploadedAt:e.uploadedAt||e.timestamp,size:e.size,...e.metadata}):Object.assign(n,e)),n}_emitDOMEvent(e,t){if(this.destroyed)return;const n=new CustomEvent(`limbo:${e}`,{detail:t,bubbles:!0,cancelable:!0});(this.getContainer()||document).dispatchEvent(n),this.eventManager?.emit(e,t)}_validateConfig(){if(!(this.config.auth?.apiKey||this.config.auth?.publicKey||this.config.auth?.token||this.config.apiKey||this.config.publicKey||this.config.token))throw new Error(`LimboInstance ${this.id}: Authentication is required. Provide either auth.publicKey (recommended) or auth.apiKey (for server-side only)`);if((this.config.auth?.apiKey||this.config.apiKey)&&"undefined"!=typeof window&&console.warn("⚠️ SECURITY WARNING: API Key detected in client-side code.\nThis is a security risk! Use publicKey instead for client applications.\nAPI Keys should only be used in server-side environments."),!["embed","modal","button"].includes(this.config.mode))throw new Error(`LimboInstance ${this.id}: invalid mode ${this.config.mode}`);if("embed"===this.config.mode&&!this.config.container)throw new Error(`LimboInstance ${this.id}: container is required for embed mode`);if("button"===this.config.mode&&!this.config.container)throw new Error(`LimboInstance ${this.id}: container is required for button mode`)}}class on{constructor(){this.instances=/* @__PURE__ */new Map,this.counter=0}create(e,t,n){const r="limbo-"+ ++this.counter,a=new an(r,e,t,n);return this.instances.set(r,a),a}get(e){return this.instances.get(e)}getAll(){return Array.from(this.instances.values())}getActive(){return this.getAll().filter(e=>e.isMounted())}destroy(e){const t=this.instances.get(e);return!!t&&(t.destroy(),this.instances.delete(e),!0)}destroyAll(){this.instances.forEach(e=>e.destroy()),this.instances.clear()}cleanupOrphans(){const e=[];return this.instances.forEach((t,n)=>{t.isContainerInDOM()||e.push(n)}),e.forEach(e=>this.destroy(e)),e.length}getStats(){const e=this.getAll();return{total:e.length,active:e.filter(e=>e.isMounted()).length,embed:e.filter(e=>"embed"===e.getMode()).length,modal:e.filter(e=>"modal"===e.getMode()).length,button:e.filter(e=>"button"===e.getMode()).length}}}class ln{constructor(){this.config=null,this.instances=/* @__PURE__ */new Map,this.observer=null,this.initialized=!1}configure(e,t,n){return this.config={selector:e.selector||null,dataset:e.dataset||"data-limbo-input-file",return:e.return||e.returnType||"json",mode:e.mode||"modal",features:e.features||["gallery","upload","cropper"],crop:e.crop||"free",quality:e.quality||.9,format:e.format||"webp",modeUI:e.modeUI||"full",modalSize:e.modalSize||"fullscreen",theme:e.theme||"light",compact:e.compact||!1,maxSize:e.maxSize||"10MB",formats:e.formats||["jpg","jpeg","png","webp"],minWidth:e.minWidth||null,minHeight:e.minHeight||null,maxWidth:e.maxWidth||null,maxHeight:e.maxHeight||null,buttonText:e.buttonText||"Seleccionar Imagen",buttonClass:e.buttonClass||"limbo-auto-button",buttonStyle:e.buttonStyle||"primary",showPreview:!1!==e.showPreview,allowMultiple:e.allowMultiple||!1,autoAssign:!1!==e.autoAssign,...e},this.configManager=t,this.eventManager=n,this._initialize(),this}cleanup(){this.observer&&(this.observer.disconnect(),this.observer=null),this.instances.forEach(({input:e,button:t})=>{this._restoreInput(e,t)}),this.instances.clear(),this.config=null,this.initialized=!1}getStats(){return{configured:null!==this.config,totalInputs:this.instances.size,dataset:this.config?.dataset,returnType:this.config?.return}}_initialize(){this.initialized||(this._scanExistingInputs(),this._setupObserver(),this.initialized=!0,this.eventManager.emit("autoInputs:initialized",{config:this.config,inputsFound:this.instances.size}))}_scanExistingInputs(){const e=this.config.selector||`input[${this.config.dataset}]`;document.querySelectorAll(e).forEach(e=>this._processInput(e))}_processInput(e){const t=this._getInputId(e);if(this.instances.has(t))return;if(!this._validateInput(e))return;const n=this._createButton(e);this._hideInput(e),this._insertButton(e,n),this.instances.set(t,{input:e,button:n,config:this._getInputConfig(e)}),this.eventManager.emit("autoInputs:processed",{inputId:t,input:e,button:n})}_createButton(e){const t=document.createElement("button"),n=this._getInputConfig(e);t.type="button",t.textContent=n.buttonText||this.config.buttonText;const r=[this.config.buttonClass];return n.buttonClass&&n.buttonClass!==this.config.buttonClass&&r.push(n.buttonClass),t.className=r.join(" "),this._styleButton(t,n),this._attachButtonEvents(t,e),t.setAttribute("aria-label",n.buttonText||this.config.buttonText),t.setAttribute("data-limbo-trigger","true"),t.setAttribute("data-limbo-input-id",n.inputId),n.disabled&&(t.disabled=!0),t}_styleButton(e,t){const n=t.buttonStyle||this.config.buttonStyle,r=t.theme||this.config.theme,a=t.compact||this.config.compact,i={border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"inherit",fontSize:a?"12px":"14px",fontWeight:"500",transition:"all 0.2s ease",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:a?"6px 12px":"8px 16px",textDecoration:"none",userSelect:"none"},o={primary:{backgroundColor:"dark"===r?"#3b82f6":"#001978",color:"white",hoverBg:"dark"===r?"#2563eb":"#334793"},secondary:{backgroundColor:"dark"===r?"#374151":"#f3f4f6",color:"dark"===r?"#f9fafb":"#374151",border:"1px solid "+("dark"===r?"#4b5563":"#d1d5db"),hoverBg:"dark"===r?"#4b5563":"#e5e7eb"},outline:{backgroundColor:"transparent",color:"dark"===r?"#3b82f6":"#001978",border:"2px solid "+("dark"===r?"#3b82f6":"#001978"),hoverBg:"dark"===r?"#3b82f6":"#001978",hoverColor:"white"},ghost:{backgroundColor:"transparent",color:"dark"===r?"#f9fafb":"#374151",hoverBg:"dark"===r?"#374151":"#f3f4f6"}},l=o[n]||o.primary;Object.assign(e.style,{...i,...l});const s=l.backgroundColor,c=l.color;e.addEventListener("mouseenter",()=>{e.style.backgroundColor=l.hoverBg||l.backgroundColor,l.hoverColor&&(e.style.color=l.hoverColor),e.style.transform="translateY(-1px)",e.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),e.addEventListener("mouseleave",()=>{e.style.backgroundColor=s,e.style.color=c,e.style.transform="translateY(0)",e.style.boxShadow="none"}),t.disabled&&(e.style.opacity="0.5",e.style.cursor="not-allowed")}_attachButtonEvents(e,t){e.addEventListener("click",e=>{e.preventDefault(),this._handleButtonClick(t)})}_handleButtonClick(e){const t=this._getInputConfig(e),n=this._createModalConfig(t);this.eventManager.emit("autoInputs:modalRequest",{input:e,config:n,callback:async t=>await this._handleImageSelection(e,t)})}async _handleImageSelection(e,t){const n=this._getInputConfig(e);try{const r=await this._formatImageData(t,n);!1!==n.autoAssign&&(e.value=r),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:resultReady",{detail:{imageData:t,input:e,value:r,config:n,assignment:{format:n.return,smartAssign:!1!==n.smartAssign,autoAssign:!1!==n.autoAssign},legacy:{imageData:t,formatted:this._createFormattedResult(t,n)}},bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:t,input:e,value:r,config:n,formatted:this._createFormattedResult(t,n)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:t,value:r,config:n})}catch(r){console.error("Error handling image selection:",r),e.dispatchEvent(new CustomEvent("limbo:error",{detail:{error:r.message,input:e,imageData:t,config:n},bubbles:!0})),this._handleImageSelectionLegacy(e,t)}}_handleImageSelectionLegacy(e,t){const n=this._getInputConfig(e),r=this._formatImageData(t,n);!1!==n.autoAssign&&(e.value=r),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:t,input:e,value:r,config:n,formatted:this._createFormattedResult(t,n)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:t,value:r,config:n})}_createFormattedResult(e,t){return{url:e.url||e.path||"",base64:e.base64||e.dataUrl||"",assetId:e.assetId||e.id||"",fileName:e.fileName||e.filename||"",object:{url:e.url||e.path,assetId:e.assetId||e.id,fileName:e.fileName||e.filename,mime:e.mime||e.mime_type,width:e.width,height:e.height,size:e.size||e.file_size,created:e.created_at||e.created,metadata:e.metadata||{}},json:JSON.stringify({url:e.url||e.path,assetId:e.assetId||e.id,fileName:e.fileName||e.filename,mime:e.mime||e.mime_type,width:e.width,height:e.height,size:e.size||e.file_size}),metadata:{width:e.width,height:e.height,size:e.size||e.file_size,format:e.format||e.mime_type,quality:t.quality||this.config.quality,aspectRatio:e.width&&e.height?e.width/e.height:null}}}async _formatImageData(e,t=null){const n=(t||{}).return||this.config.return||"json",r=void 0!==e.original;switch(n){case"url":return r?e.images?.[0]?.url||e.original?.url||"":e.url||e.path||"";case"base64":return e.base64||e.dataUrl||"";case"assetId":return r?e.original?.assetId||"":e.assetId||e.id||"";case"fileName":return e.fileName||e.filename||"";default:return r?JSON.stringify(e):JSON.stringify({original:{url:e.url||e.path,width:e.width,height:e.height,assetId:e.assetId||e.id}})}}_createModalConfig(e){return{mode:e.mode||this.config.mode||"modal",modeUI:e.modeUI||this.config.modeUI||"full",features:e.features||this.config.features,modalSize:e.modalSize||this.config.modalSize||"fullscreen",title:e.description||this.config.title||"Seleccionar imagen",cropper:this._getCropperConfig(e),ui:{showActions:this._getUIActions(e),hideActions:[],showTabs:this._shouldShowTabs(e),theme:e.theme||this.config.theme,compact:e.compact||this.config.compact,showPreview:void 0!==e.showPreview?e.showPreview:this.config.showPreview},validation:{maxSize:e.maxSize||this.config.maxSize,formats:e.formats||this.config.formats,minWidth:e.minWidth||this.config.minWidth,minHeight:e.minHeight||this.config.minHeight,maxWidth:e.maxWidth||this.config.maxWidth,maxHeight:e.maxHeight||this.config.maxHeight,required:e.required||!1},behavior:{allowMultiple:e.allowMultiple||this.config.allowMultiple,closeOnSelect:!0,autoAssign:void 0!==e.autoAssign?e.autoAssign:this.config.autoAssign,allowSelectNew:!1!==e.allowSelectNew},initialImageUrl:e.initialImageUrl||null,returnConfig:{format:e.return||this.config.return,quality:e.quality||this.config.quality,outputFormat:e.format||this.config.format},inputMeta:{inputId:e.inputId,inputName:e.inputName,inputType:e.inputType,placeholder:e.placeholder}}}_getCropperConfig(e){const t=e.crop||this.config.crop,n={quality:e.quality||this.config.quality,format:e.format||this.config.format,mandatoryCrops:e.mandatoryCrops||[],allowAdditionalCrops:!1!==e.allowAdditionalCrops,maxCrops:e.maxCrops||null};if(e.mandatoryCrops&&e.mandatoryCrops.length>0)return{...n,aspectRatio:null};if(!t||"none"===t||"false"===t)return null;if("free"===t)return{...n,aspectRatio:null};const r={"1:1":1,"16:9":16/9,"4:3":4/3,"3:2":1.5,"2:1":2,square:1,landscape:16/9,portrait:3/4};if(r[t])return{...n,aspectRatio:r[t],minCropBoxWidth:e.minWidth||this.config.minWidth,minCropBoxHeight:e.minHeight||this.config.minHeight};if("string"==typeof t&&t.includes(":")){const[e,r]=t.split(":").map(Number);if(!isNaN(e)&&!isNaN(r)&&0!==r)return{...n,aspectRatio:e/r}}const a=parseFloat(t);return!isNaN(a)&&a>0?{...n,aspectRatio:a}:"object"==typeof t?{...n,...t}:null}_shouldShowTabs(e){const t=e.modeUI||this.config.modeUI||"full",n=e.features||this.config.features;return!["gallery-only","upload-only","crop-only","ia-only"].includes(t)&&(n&&n.length>1)}_getUIActions(e){const t=e.modeUI||this.config.modeUI||"full",n=e.features||this.config.features;let r=[];switch(t){case"gallery-only":case"upload-only":r=["select"];break;case"crop-only":r=["select","crop"];break;default:r=["select"],n.includes("cropper")&&r.push("crop"),n.includes("gallery")&&(r.push("download","copy"),this.config.allowDelete&&r.push("delete"))}return r}_getInputId(e){return e.id||e.name||`limbo-auto-${Date.now()}-${Math.random()}`}_validateInput(e){return e instanceof HTMLInputElement}_getInputConfig(e){const t=e=>e?e.split(",").map(e=>e.trim()):null,n=e=>{if(!e)return null;const t=e.match(/^(\d+(?:\.\d+)?)(MB|KB|B)?$/i);if(!t)return null;const n=parseFloat(t[1]);switch((t[2]||"B").toUpperCase()){case"MB":return 1024*n*1024;case"KB":return 1024*n;default:return n}},r=(e,t=!1)=>null===e?t:"true"===e||"1"===e||""===e,a=e=>e?parseFloat(e):null,i=e=>{if(!e)return null;try{return JSON.parse(e)}catch(t){return console.warn("[Limbo AutoInputManager] Error parsing JSON attribute:",t),null}},o=i(e.dataset.mandatorycrops)||i(e.dataset.mandatoryCrops)||i(e.getAttribute("data-mandatory-crops"))||i(e.getAttribute("data-limbo-mandatory-crops"))||null;return{return:e.dataset.returntype||e.getAttribute("data-limbo-return")||this.config.return,mode:e.dataset.mode||e.getAttribute("data-limbo-mode")||this.config.mode,features:t(e.dataset.features)||t(e.getAttribute("data-limbo-features"))||this.config.features,crop:e.dataset.crop||e.getAttribute("data-limbo-crop")||this.config.crop,quality:a(e.dataset.quality)||a(e.getAttribute("data-limbo-quality"))||this.config.quality,format:e.dataset.format||e.getAttribute("data-limbo-format")||this.config.format,modeUI:e.dataset.modeui||e.dataset.modeUI||e.getAttribute("data-limbo-mode-ui")||this.config.modeUI,modalSize:e.dataset.modalsize||e.getAttribute("data-limbo-modal-size")||this.config.modalSize,theme:e.dataset.theme||e.getAttribute("data-limbo-theme")||this.config.theme,compact:r(e.dataset.compact,null)??r(e.getAttribute("data-limbo-compact"),this.config.compact),maxSize:n(e.getAttribute("data-limbo-max-size"))||n(this.config.maxSize),formats:t(e.getAttribute("data-limbo-formats"))||this.config.formats,minWidth:a(e.getAttribute("data-limbo-min-width"))||this.config.minWidth,minHeight:a(e.getAttribute("data-limbo-min-height"))||this.config.minHeight,maxWidth:a(e.getAttribute("data-limbo-max-width"))||this.config.maxWidth,maxHeight:a(e.getAttribute("data-limbo-max-height"))||this.config.maxHeight,buttonText:e.getAttribute("data-limbo-button-text")||this.config.buttonText,buttonStyle:e.getAttribute("data-limbo-button-style")||this.config.buttonStyle,buttonClass:e.getAttribute("data-limbo-button-class")||this.config.buttonClass,showPreview:r(e.getAttribute("data-limbo-show-preview"),this.config.showPreview),allowMultiple:r(e.getAttribute("data-limbo-allow-multiple"),this.config.allowMultiple),autoAssign:r(e.getAttribute("data-limbo-auto-assign"),this.config.autoAssign),placeholder:e.getAttribute("data-limbo-placeholder"),description:e.getAttribute("data-limbo-description"),required:r(e.getAttribute("data-limbo-required"),!1),disabled:r(e.getAttribute("data-limbo-disabled"),!1),inputId:e.id||e.name||this._generateInputId(e),inputName:e.name,inputType:e.type,mandatoryCrops:o,allowAdditionalCrops:r(e.getAttribute("data-limbo-allow-additional-crops"),!0),maxCrops:a(e.getAttribute("data-limbo-max-crops"))||null,allowSelectNew:r(e.dataset.allowselectnew,null)??r(e.getAttribute("data-limbo-allow-select-new"),!0),initialImageUrl:e.value||null}}_generateInputId(){return`limbo-auto-input-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}_hideInput(e){e.style.display="none"}_insertButton(e,t){e.parentNode.insertBefore(t,e.nextSibling)}_restoreInput(e,t){e.style.display="",t&&t.parentNode&&t.parentNode.removeChild(t)}_setupObserver(){this.observer=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&this._scanNodeForInputs(e)})})}),this.observer.observe(document.body,{childList:!0,subtree:!0})}_scanNodeForInputs(e){const t=this.config.selector||`input[${this.config.dataset}]`;e.matches&&e.matches(t)&&this._processInput(e);const n=e.querySelectorAll&&e.querySelectorAll(t);n&&n.forEach(e=>this._processInput(e))}}class sn{constructor(){this.listeners=/* @__PURE__ */new Map}emit(e,t={}){this._emitDOMEvent(e,t),this._executeListeners(e,t)}on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>this.off(e,t)}off(e,t){const n=this.listeners.get(e);if(n){const e=n.indexOf(t);e>-1&&n.splice(e,1)}}cleanup(){this.listeners.clear()}_emitDOMEvent(e,t){const n=new CustomEvent(`limbo:${e}`,{detail:{...t,timestamp:Date.now()},bubbles:!0,cancelable:!0});(t.instance?.getContainer()||document).dispatchEvent(n)}_executeListeners(e,t){const n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(r){console.error(`Error executing listener for ${e}:`,r)}})}getStats(){const e={};return this.listeners.forEach((t,n)=>{e[n]=t.length}),e}}class cn{constructor(){this.activeModals=/* @__PURE__ */new Set,this.zIndexBase=1e4,this.focusableSelectors=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"]):not([disabled])',"a[href]"].join(", "),this.initialized=!1,this._initGlobalListeners()}createModal(e){const t=new un(this._generateModalId(),e,this);return this.activeModals.add(t),t}closeModal(e){const t=this._findModal(e);return!!t&&(t.close(),!0)}closeAllModals(){this.activeModals.forEach(e=>e.close()),this.activeModals.clear()}getActiveModal(){return Array.from(this.activeModals).pop()||null}getStats(){return{active:this.activeModals.size,nextZIndex:this._getNextZIndex()}}_generateModalId(){return`limbo-modal-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}_findModal(e){return Array.from(this.activeModals).find(t=>t.getId()===e)}_getNextZIndex(){return this.zIndexBase+10*this.activeModals.size}_removeModal(e){this.activeModals.delete(e)}_handleGlobalKeydown(e){const t=this.getActiveModal();t&&("Escape"===e.key&&(e.preventDefault(),t.close()),"Tab"===e.key&&this._handleTabTrap(e,t))}_handleTabTrap(e,t){const n=t.getFocusableElements();if(0===n.length)return;const r=n[0],a=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),r.focus())}_initGlobalListeners(){this.initialized||(this.globalKeydownHandler=e=>this._handleGlobalKeydown(e),document.addEventListener("keydown",this.globalKeydownHandler),this.initialized=!0)}destroy(){this.closeAllModals(),this.initialized&&this.globalKeydownHandler&&(document.removeEventListener("keydown",this.globalKeydownHandler),this.initialized=!1,this.globalKeydownHandler=null)}}class un{constructor(e,t,n){this.id=e,this.config={title:t.title||"Limbo",content:t.content||null,showCloseButton:!1!==t.showCloseButton,backdrop:!1!==t.backdrop,keyboard:!1!==t.keyboard,focus:!1!==t.focus,animation:!1!==t.animation,size:t.size||"large",onOpen:t.onOpen||null,onClose:t.onClose||null,onDestroy:t.onDestroy||null,...t},this.manager=n,this.element=null,this.backdrop=null,this.isOpen=!1,this.previousFocus=null,this._create()}_create(){this._createBackdrop(),this._createModal(),this._attachEvents()}_createBackdrop(){this.config.backdrop&&(this.backdrop=document.createElement("div"),this.backdrop.className="limbo-modal-backdrop",this.backdrop.style.cssText=`\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n z-index: ${this.manager._getNextZIndex()};\n opacity: 0;\n transition: opacity 0.3s ease;\n `,this.backdrop.addEventListener("click",e=>{e.target===this.backdrop&&this.close()}))}_createModal(){this.element=document.createElement("div"),this.element.className=`limbo-modal limbo-modal--${this.config.size}`,this.element.id=this.id,this.element.role="dialog",this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby",`${this.id}-title`),this.element.tabIndex=-1;const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t={small:e?"width: 100%; height: 100%;":"max-width: 500px; min-height: 400px;",medium:e?"width: 100%; height: 100%;":"max-width: 800px; min-height: 500px;",large:e?"width: 100%; height: 100%;":"max-width: 1400px; min-height: 700px;",xlarge:e?"width: 100%; height: 100%;":"max-width: 95dvw; min-height: 85vh;",fullscreen:"width: 100%; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0;"},n="fullscreen"===this.config.size,r=e||n?`\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n transform: ${e?"translateY(100%)":"scale(0.95)"};\n width: 100%;\n height: 100%;\n max-width: none;\n max-height: none;\n border-radius: 0;\n background: white;\n z-index: ${this.manager._getNextZIndex()+1};\n opacity: ${e?"1":"0"};\n transition: ${e?"transform":"all"} 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n padding-top: env(safe-area-inset-top);\n padding-left: env(safe-area-inset-left);\n padding-right: env(safe-area-inset-right);\n padding-bottom: env(safe-area-inset-bottom);\n `:`\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(0.8);\n ${t[this.config.size]}\n width: 90%;\n max-height: 90vh;\n background: white;\n border-radius: 16px;\n box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);\n z-index: ${this.manager._getNextZIndex()+1};\n opacity: 0;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n `;this.element.style.cssText=r,this._createHeader(),this._createBody(),document.body.appendChild(this.backdrop),document.body.appendChild(this.element)}_createHeader(){const e=document.createElement("div");e.className="limbo-modal-header";const t=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);e.style.cssText=`\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ${t?"16px 20px":"20px 24px"};\n border-bottom: 1px solid #e9ecef;\n background: #f8f9fa;\n ${t?"position: sticky; top: 0; z-index: 10;":""}\n min-height: ${t?"60px":"auto"};\n `;const n=document.createElement("h2");if(n.id=`${this.id}-title`,n.className="limbo-modal-title",n.textContent=this.config.title,n.style.cssText="\n margin: 0;\n font-size: 18px;\n font-weight: 600;\n color: #001978;\n flex: 1;\n margin-right: 16px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n ",e.appendChild(n),this.config.showCloseButton){const n=document.createElement("button");n.type="button",n.className="limbo-modal-close",n.innerHTML="✕",n.setAttribute("aria-label","Cerrar modal"),n.style.cssText=`\n background: none;\n border: none;\n font-size: ${t?"28px":"24px"};\n color: #6c757d;\n cursor: pointer;\n padding: ${t?"8px":"4px"};\n border-radius: 4px;\n transition: all 0.2s ease;\n min-width: ${t?"44px":"auto"};\n min-height: ${t?"44px":"auto"};\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n `,n.addEventListener("mouseenter",()=>{n.style.backgroundColor="#f8f9fa",n.style.color="#001978"}),n.addEventListener("mouseleave",()=>{n.style.backgroundColor="transparent",n.style.color="#6c757d"}),n.addEventListener("click",()=>this.close()),e.appendChild(n)}this.element.appendChild(e)}_createBody(){const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=document.createElement("div");t.className="limbo-modal-body",t.id=`${this.id}-body`,t.style.cssText=`\n flex: 1;\n overflow-y: auto;\n padding: 0;\n -webkit-overflow-scrolling: touch;\n ${e?"height: 100%; overscroll-behavior: contain;":""}\n `,this.config.content&&("string"==typeof this.config.content?t.innerHTML=this.config.content:this.config.content instanceof Element&&t.appendChild(this.config.content)),this.element.appendChild(t)}_attachEvents(){this._originalBodyOverflow=document.body.style.overflow}open(){if(this.isOpen)return this;window.limbo&&window.limbo.core&&window.limbo.core.keyboard?(window.limbo.core.keyboard.pushFocus(document.activeElement),window.limbo.core.keyboard.setActiveModal(this.element)):this.previousFocus=document.activeElement,document.body.style.overflow="hidden";const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t="fullscreen"===this.config.size;return requestAnimationFrame(()=>{this.backdrop&&(this.backdrop.style.opacity="1"),this.element.style.opacity="1",this.element.style.transform=e?"translateY(0%)":t?"scale(1)":"translate(-50%, -50%) scale(1)"}),this.isOpen=!0,this.config.focus&&setTimeout(()=>{if(window.limbo&&window.limbo.core&&window.limbo.core.keyboard)window.limbo.core.keyboard.focusFirst(this.element);else{const e=this.getFocusableElements()[0];e&&e.focus()}},300),this.config.onOpen&&this.config.onOpen(this),this}close(){if(!this.isOpen)return this;const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t="fullscreen"===this.config.size;return this.backdrop&&(this.backdrop.style.opacity="0"),this.element.style.opacity="0",this.element.style.transform=e?"translateY(100%)":t?"scale(0.95)":"translate(-50%, -50%) scale(0.8)",setTimeout(()=>{this._cleanup()},300),this.isOpen=!1,window.limbo&&window.limbo.core&&window.limbo.core.keyboard&&(window.limbo.core.keyboard.setActiveModal(null),window.limbo.core.keyboard.releaseFocus()),this.config.onClose&&this.config.onClose(this),this}destroy(){this.close(),this.manager._removeModal(this),this.config.onDestroy&&this.config.onDestroy(this)}getBodyContainer(){return this.element.querySelector(".limbo-modal-body")}getFocusableElements(){return Array.from(this.element.querySelectorAll(this.manager.focusableSelectors))}getId(){return this.id}isOpened(){return this.isOpen}getConfig(){return{...this.config}}_cleanup(){document.body.style.overflow=this._originalBodyOverflow||"",this.previousFocus&&"function"==typeof this.previousFocus.focus&&this.previousFocus.focus(),this.backdrop&&this.backdrop.parentNode&&this.backdrop.parentNode.removeChild(this.backdrop),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}class dn{constructor(){this.currentTheme=null,this.customThemes=/* @__PURE__ */new Map,this.config=this._getDefaultConfig(),this.isInitialized=!1,this.isCompactMode=!1,this.compactBreakpoint=null,this.compactObserver=null,this.mediaQueryObserver=null,this.mutationObserver=null,this.storageListener=null,this.themeCache=/* @__PURE__ */new Map,this.appliedStyles=/* @__PURE__ */new Set,this.changeCallbacks=/* @__PURE__ */new Set}_getDefaultConfig(){return{theme:{auto:!0,storage:!0,inherit:!0,smooth:!0,detectSystem:!0},compact:{enabled:!1,auto:!0,breakpoint:768,forceOnMobile:!0,persistPreference:!0},presets:{light:{name:"light",displayName:"Claro",variables:{"--limbo-primary":"#3b82f6","--limbo-primary-hover":"#2563eb","--limbo-primary-light":"#dbeafe","--limbo-primary-dark":"#1e40af","--limbo-bg-primary":"#ffffff","--limbo-bg-secondary":"#f8fafc","--limbo-bg-tertiary":"#f1f5f9","--limbo-bg-overlay":"rgba(0, 0, 0, 0.5)","--limbo-bg-card":"#ffffff","--limbo-bg-input":"#ffffff","--limbo-text-primary":"#0f172a","--limbo-text-secondary":"#475569","--limbo-text-tertiary":"#64748b","--limbo-text-inverse":"#ffffff","--limbo-text-muted":"#94a3b8","--limbo-border-light":"#e2e8f0","--limbo-border-medium":"#cbd5e1","--limbo-border-strong":"#94a3b8","--limbo-border-focus":"#3b82f6","--limbo-success":"#10b981","--limbo-success-light":"#d1fae5","--limbo-error":"#ef4444","--limbo-error-light":"#fee2e2","--limbo-warning":"#f59e0b","--limbo-warning-light":"#fef3c7","--limbo-info":"#3b82f6","--limbo-info-light":"#dbeafe","--limbo-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--limbo-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.1)","--limbo-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.1)","--limbo-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.1)","--limbo-radius-sm":"4px","--limbo-radius-md":"6px","--limbo-radius-lg":"8px","--limbo-radius-xl":"12px","--limbo-font-family":"system-ui, -apple-system, sans-serif","--limbo-font-size-xs":"12px","--limbo-font-size-sm":"14px","--limbo-font-size-md":"16px","--limbo-font-size-lg":"18px","--limbo-font-size-xl":"20px","--limbo-z-dropdown":"1000","--limbo-z-sticky":"1020","--limbo-z-fixed":"1030","--limbo-z-modal":"1050","--limbo-z-tooltip":"1070","--limbo-transition-fast":"150ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-normal":"300ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-slow":"500ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-spacing-compact":"0.5rem","--limbo-spacing-compact-sm":"0.25rem","--limbo-spacing-compact-lg":"0.75rem","--limbo-font-size-compact-xs":"11px","--limbo-font-size-compact-sm":"12px","--limbo-font-size-compact-md":"14px","--limbo-font-size-compact-lg":"16px","--limbo-radius-compact":"4px","--limbo-radius-compact-sm":"3px","--limbo-radius-compact-lg":"6px","--limbo-button-height-compact":"32px","--limbo-input-height-compact":"36px","--limbo-modal-padding-compact":"12px","--limbo-card-padding-compact":"12px","--limbo-gap-compact":"8px","--limbo-gap-compact-sm":"4px","--limbo-gap-compact-lg":"12px"}},dark:{name:"dark",displayName:"Oscuro",variables:{"--limbo-primary":"#60a5fa","--limbo-primary-hover":"#3b82f6","--limbo-primary-light":"#1e293b","--limbo-primary-dark":"#93c5fd","--limbo-bg-primary":"#0f172a","--limbo-bg-secondary":"#1e293b","--limbo-bg-tertiary":"#334155","--limbo-bg-overlay":"rgba(0, 0, 0, 0.8)","--limbo-bg-card":"#1e293b","--limbo-bg-input":"#334155","--limbo-text-primary":"#f8fafc","--limbo-text-secondary":"#cbd5e1","--limbo-text-tertiary":"#94a3b8","--limbo-text-inverse":"#0f172a","--limbo-text-muted":"#64748b","--limbo-border-light":"#334155","--limbo-border-medium":"#475569","--limbo-border-strong":"#64748b","--limbo-border-focus":"#60a5fa","--limbo-success":"#34d399","--limbo-success-light":"#064e3b","--limbo-error":"#f87171","--limbo-error-light":"#7f1d1d","--limbo-warning":"#fbbf24","--limbo-warning-light":"#78350f","--limbo-info":"#60a5fa","--limbo-info-light":"#1e3a8a","--limbo-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.2)","--limbo-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.3)","--limbo-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.4)","--limbo-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.5)","--limbo-radius-sm":"4px","--limbo-radius-md":"6px","--limbo-radius-lg":"8px","--limbo-radius-xl":"12px","--limbo-font-family":"system-ui, -apple-system, sans-serif","--limbo-font-size-xs":"12px","--limbo-font-size-sm":"14px","--limbo-font-size-md":"16px","--limbo-font-size-lg":"18px","--limbo-font-size-xl":"20px","--limbo-z-dropdown":"1000","--limbo-z-sticky":"1020","--limbo-z-fixed":"1030","--limbo-z-modal":"1050","--limbo-z-tooltip":"1070","--limbo-transition-fast":"150ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-normal":"300ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-slow":"500ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-spacing-compact":"0.5rem","--limbo-spacing-compact-sm":"0.25rem","--limbo-spacing-compact-lg":"0.75rem","--limbo-font-size-compact-xs":"11px","--limbo-font-size-compact-sm":"12px","--limbo-font-size-compact-md":"14px","--limbo-font-size-compact-lg":"16px","--limbo-radius-compact":"4px","--limbo-radius-compact-sm":"3px","--limbo-radius-compact-lg":"6px","--limbo-button-height-compact":"32px","--limbo-input-height-compact":"36px","--limbo-modal-padding-compact":"12px","--limbo-card-padding-compact":"12px","--limbo-gap-compact":"8px","--limbo-gap-compact-sm":"4px","--limbo-gap-compact-lg":"12px"}},auto:{name:"auto",displayName:"Automático",variables:{}}},inheritance:{portalSelectors:["body","[data-theme]",".theme-light",".theme-dark",".light-theme",".dark-theme"],variablePrefix:"--",fallbackTheme:"light"},transitions:{duration:"300ms",easing:"cubic-bezier(0.4, 0, 0.2, 1)",properties:["background-color","border-color","color","fill","stroke","box-shadow"]}}}initialize(e={}){this.isInitialized?console.warn("ThemeManager already initialized"):(this.config=this._deepMerge(this.config,e),this._loadCustomThemes(),this.config.theme.inherit&&this._inheritPortalTheme(),this._applyInitialTheme(),this._applyInitialCompactMode(),this._setupObservers(),this._injectBaseStyles(),this.isInitialized=!0)}_injectBaseStyles(){if(document.getElementById("limbo-theme-styles"))return;const e=`\n :root {\n /* Variables de transición para cambios de tema */\n color-scheme: light dark;\n }\n \n [data-limbo-theme] {\n transition: ${this.config.transitions.properties.map(e=>`${e} ${this.config.transitions.duration} ${this.config.transitions.easing}`).join(", ")};\n }\n \n /* Clases de utilidad para temas */\n .limbo-theme-light {\n color-scheme: light;\n }\n \n .limbo-theme-dark {\n color-scheme: dark;\n }\n \n .limbo-theme-auto {\n color-scheme: light dark;\n }\n \n /* Estilos para elementos del componente con variables CSS */\n .limbo-component {\n background-color: var(--limbo-bg-primary);\n color: var(--limbo-text-primary);\n border-color: var(--limbo-border-light);\n border-radius: var(--limbo-radius-md);\n font-family: var(--limbo-font-family);\n font-size: var(--limbo-font-size-md);\n transition: var(--limbo-transition-normal);\n }\n \n .limbo-card {\n background-color: var(--limbo-bg-card);\n border: 1px solid var(--limbo-border-light);\n border-radius: var(--limbo-radius-lg);\n box-shadow: var(--limbo-shadow-md);\n color: var(--limbo-text-primary);\n }\n \n .limbo-input {\n background-color: var(--limbo-bg-input);\n border: 1px solid var(--limbo-border-medium);\n border-radius: var(--limbo-radius-md);\n color: var(--limbo-text-primary);\n font-family: var(--limbo-font-family);\n font-size: var(--limbo-font-size-md);\n transition: var(--limbo-transition-fast);\n }\n \n .limbo-input:focus {\n border-color: var(--limbo-border-focus);\n box-shadow: 0 0 0 3px var(--limbo-primary-light);\n outline: none;\n }\n \n .limbo-button {\n background-color: var(--limbo-primary);\n border: 1px solid var(--limbo-primary);\n border-radius: var(--limbo-radius-md);\n color: var(--limbo-text-inverse);\n font-family: var(--limbo-font-family);\n font-size: var(--limbo-font-size-md);\n transition: var(--limbo-transition-fast);\n cursor: pointer;\n }\n \n .limbo-button:hover {\n background-color: var(--limbo-primary-hover);\n border-color: var(--limbo-primary-hover);\n }\n \n .limbo-button.secondary {\n background-color: var(--limbo-bg-secondary);\n border-color: var(--limbo-border-medium);\n color: var(--limbo-text-primary);\n }\n \n .limbo-button.secondary:hover {\n background-color: var(--limbo-bg-tertiary);\n }\n \n /* Estados de feedback con variables */\n .limbo-state-success {\n background-color: var(--limbo-success-light);\n border-color: var(--limbo-success);\n color: var(--limbo-success);\n }\n \n .limbo-state-error {\n background-color: var(--limbo-error-light);\n border-color: var(--limbo-error);\n color: var(--limbo-error);\n }\n \n .limbo-state-warning {\n background-color: var(--limbo-warning-light);\n border-color: var(--limbo-warning);\n color: var(--limbo-warning);\n }\n \n .limbo-state-info {\n background-color: var(--limbo-info-light);\n border-color: var(--limbo-info);\n color: var(--limbo-info);\n }\n \n /* Overlay y modal con variables */\n .limbo-overlay {\n background-color: var(--limbo-bg-overlay);\n backdrop-filter: blur(4px);\n }\n \n .limbo-modal {\n background-color: var(--limbo-bg-card);\n border-radius: var(--limbo-radius-xl);\n box-shadow: var(--limbo-shadow-xl);\n color: var(--limbo-text-primary);\n }\n \n /* Responsive design con variables */\n @media (max-width: 640px) {\n .limbo-component {\n font-size: var(--limbo-font-size-sm);\n }\n }\n \n /* Modo reducido de movimiento */\n @media (prefers-reduced-motion: reduce) {\n [data-limbo-theme] {\n transition: none;\n }\n \n .limbo-component,\n .limbo-input,\n .limbo-button {\n transition: none;\n }\n }\n \n /* Esquemas de color automático */\n @media (prefers-color-scheme: dark) {\n :root:not([data-limbo-theme]) {\n color-scheme: dark;\n }\n }\n \n @media (prefers-color-scheme: light) {\n :root:not([data-limbo-theme]) {\n color-scheme: light;\n }\n }\n \n /* ===================================\n MODO COMPACTO - ESTILOS ESPECÍFICOS \n =================================== */\n \n /* Activación del modo compacto por atributo o clase */\n [data-limbo-compact="true"],\n .limbo-compact-mode {\n /* Componentes base más pequeños */\n --limbo-font-size-md: var(--limbo-font-size-compact-md);\n --limbo-font-size-sm: var(--limbo-font-size-compact-sm);\n --limbo-font-size-lg: var(--limbo-font-size-compact-lg);\n --limbo-spacing: var(--limbo-spacing-compact);\n --limbo-radius-md: var(--limbo-radius-compact);\n --limbo-gap: var(--limbo-gap-compact);\n }\n \n /* Botones compactos */\n [data-limbo-compact="true"] .limbo-button,\n .limbo-compact-mode .limbo-button {\n height: var(--limbo-button-height-compact);\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-sm);\n border-radius: var(--limbo-radius-compact);\n min-width: auto;\n }\n \n /* Inputs compactos */\n [data-limbo-compact="true"] .limbo-input,\n .limbo-compact-mode .limbo-input {\n height: var(--limbo-input-height-compact);\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-md);\n border-radius: var(--limbo-radius-compact);\n }\n \n /* Cards compactas */\n [data-limbo-compact="true"] .limbo-card,\n .limbo-compact-mode .limbo-card {\n padding: var(--limbo-card-padding-compact);\n border-radius: var(--limbo-radius-compact-lg);\n }\n \n /* Modales compactos */\n [data-limbo-compact="true"] .limbo-modal,\n .limbo-compact-mode .limbo-modal {\n padding: var(--limbo-modal-padding-compact);\n border-radius: var(--limbo-radius-compact-lg);\n max-width: 90vw;\n max-height: 90vh;\n }\n \n /* Tabs compactas */\n [data-limbo-compact="true"] .limbo-tabs,\n .limbo-compact-mode .limbo-tabs {\n gap: var(--limbo-gap-compact-sm);\n }\n \n [data-limbo-compact="true"] .limbo-tab,\n .limbo-compact-mode .limbo-tab {\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-sm);\n border-radius: var(--limbo-radius-compact-sm);\n }\n \n /* Gallery compacta */\n [data-limbo-compact="true"] .limbo-gallery,\n .limbo-compact-mode .limbo-gallery {\n gap: var(--limbo-gap-compact-sm);\n }\n \n [data-limbo-compact="true"] .limbo-gallery-item,\n .limbo-compact-mode .limbo-gallery-item {\n border-radius: var(--limbo-radius-compact);\n min-height: 120px; /* Más pequeño para móviles */\n }\n \n /* Notificaciones compactas */\n [data-limbo-compact="true"] .limbo-notification,\n .limbo-compact-mode .limbo-notification {\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-sm);\n border-radius: var(--limbo-radius-compact);\n }\n \n /* Progress indicators compactos */\n [data-limbo-compact="true"] .limbo-progress,\n .limbo-compact-mode .limbo-progress {\n height: 3px; /* Más delgado */\n }\n \n [data-limbo-compact="true"] .limbo-progress-circular,\n .limbo-compact-mode .limbo-progress-circular {\n width: 20px;\n height: 20px;\n }\n \n /* Auto-activación en pantallas pequeñas */\n @media (max-width: 768px) {\n :root[data-limbo-compact="auto"],\n .limbo-component[data-limbo-compact="auto"] {\n /* Aplicar automáticamente estilos compactos */\n --limbo-font-size-md: var(--limbo-font-size-compact-md);\n --limbo-font-size-sm: var(--limbo-font-size-compact-sm);\n --limbo-spacing: var(--limbo-spacing-compact);\n --limbo-radius-md: var(--limbo-radius-compact);\n --limbo-gap: var(--limbo-gap-compact);\n }\n \n /* Modal full-screen en móvil cuando es compacto */\n [data-limbo-compact="auto"] .limbo-modal,\n [data-limbo-compact="true"] .limbo-modal {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n margin: 0;\n }\n \n /* Tabs en accordion en móvil */\n [data-limbo-compact="auto"] .limbo-tabs,\n [data-limbo-compact="true"] .limbo-tabs {\n flex-direction: column;\n width: 100%;\n }\n \n /* Gallery de 2 columnas en móvil */\n [data-limbo-compact="auto"] .limbo-gallery,\n [data-limbo-compact="true"] .limbo-gallery {\n grid-template-columns: 1fr 1fr;\n gap: var(--limbo-gap-compact);\n }\n }\n \n /* Touch targets más grandes en móviles */\n @media (max-width: 768px) and (pointer: coarse) {\n [data-limbo-compact="auto"] .limbo-button,\n [data-limbo-compact="true"] .limbo-button {\n min-height: 44px; /* Tamaño mínimo de toque recomendado */\n padding: var(--limbo-spacing-compact) var(--limbo-spacing-compact-lg);\n }\n \n [data-limbo-compact="auto"] .limbo-tab,\n [data-limbo-compact="true"] .limbo-tab {\n min-height: 44px;\n }\n }\n `,t=document.createElement("style");t.id="limbo-theme-styles",t.textContent=e,document.head.appendChild(t)}applyTheme(e,t={}){const n=this._getTheme(e);if(!n)return console.warn(`Theme '${e}' not found`),!1;const r=this.currentTheme;return this._applyThemeVariables(n,t.scope),this._updateThemeAttributes(n.name),this.config.theme.storage&&!t.temporary&&this._saveThemePreference(n.name),this.currentTheme=n.name,this._triggerChangeCallbacks(n.name,r),!0}toggleTheme(e="light",t="dark"){const n=this.currentTheme===e?t:e;return this.applyTheme(n)}applyAutoTheme(){const e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return this.applyTheme(e)}registerTheme(e,t){const n={name:e,displayName:t.displayName||e,variables:t.variables||{},extends:t.extends||null,...t};if(n.extends){const e=this._getTheme(n.extends);e&&(n.variables={...e.variables,...n.variables})}return this.customThemes.set(e,n),this}removeTheme(e){if(this.config.presets[e])return console.warn(`Cannot remove predefined theme: ${e}`),!1;const t=this.customThemes.delete(e);return t&&this.currentTheme===e&&this.applyTheme(this.config.inheritance.fallbackTheme),t}getAvailableThemes(){const e=Object.keys(this.config.presets),t=Array.from(this.customThemes.keys());return{presets:e,custom:t,all:[...e,...t]}}getCurrentTheme(){return{name:this.currentTheme,theme:this._getTheme(this.currentTheme),isCustom:this.customThemes.has(this.currentTheme),variables:this._getCurrentVariables()}}enableCompactMode(e={}){const t={element:document.documentElement,persist:!0,...e};return t.element.setAttribute("data-limbo-compact","true"),t.element.classList.add("limbo-compact-mode"),this.isCompactMode=!0,t.persist&&this.config.compact.persistPreference&&this._saveCompactPreference(!0),this._triggerCompactChange(!0),this}disableCompactMode(e={}){const t={element:document.documentElement,persist:!0,...e};return t.element.setAttribute("data-limbo-compact","false"),t.element.classList.remove("limbo-compact-mode"),this.isCompactMode=!1,t.persist&&this.config.compact.persistPreference&&this._saveCompactPreference(!1),this._triggerCompactChange(!1),this}toggleCompactMode(e={}){return this.isCompactMode?this.disableCompactMode(e):this.enableCompactMode(e)}applyAutoCompactMode(){const e=this._shouldUseCompactMode();return e&&!this.isCompactMode?this.enableCompactMode({persist:!1}):!e&&this.isCompactMode&&this.disableCompactMode({persist:!1}),this}getCompactState(){return{isEnabled:this.isCompactMode,isAuto:this.config.compact.auto,breakpoint:this.config.compact.breakpoint,currentViewport:window.innerWidth,shouldBeCompact:this._shouldUseCompactMode()}}_shouldUseCompactMode(){if(!this.config.compact.auto)return this.config.compact.enabled;const e=window.innerWidth<=this.config.compact.breakpoint,t=/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n="ontouchstart"in window||navigator.maxTouchPoints>0;return!(!this.config.compact.forceOnMobile||!t&&!n)||e}_saveCompactPreference(e){try{localStorage.setItem("limbo-compact-preference",e.toString())}catch(t){console.warn("Could not save compact preference:",t)}}_loadCompactPreference(){try{return"true"===localStorage.getItem("limbo-compact-preference")}catch(e){return console.warn("Could not load compact preference:",e),null}}_triggerCompactChange(e){this.changeCallbacks.forEach(t=>{try{t({type:"compact",isCompact:e,viewport:window.innerWidth,timestamp:Date.now()})}catch(n){console.error("Error in compact mode change callback:",n)}})}_inheritPortalTheme(){const e=this._detectPortalTheme();return e?(this.registerTheme("portal-inherited",e),"portal-inherited"):null}_detectPortalTheme(){const e={name:"portal-detected",displayName:"Tema del Portal",variables:{}};for(const t of this.config.inheritance.portalSelectors){const n=document.querySelector(t);if(n){const t=this._extractCSSVariables(n);Object.keys(t).length>0&&(e.variables={...e.variables,...t});const r=n.getAttribute("data-theme")||n.getAttribute("class")?.match(/theme-(\w+)/)||n.getAttribute("class")?.match(/(\w+)-theme/);r&&(e.detectedName=Array.isArray(r)?r[1]:r)}}return Object.keys(e.variables).length>0?e:null}_extractCSSVariables(e){const t={},n=getComputedStyle(e);["primary","primary-hover","primary-light","primary-dark","bg-primary","bg-secondary","bg-tertiary","bg-card","bg-input","text-primary","text-secondary","text-tertiary","text-inverse","border-light","border-medium","border-strong","border-focus","success","error","warning","info","shadow-sm","shadow-md","shadow-lg","shadow-xl","radius-sm","radius-md","radius-lg","radius-xl"].forEach(e=>{const r=`--limbo-${e}`,a=n.getPropertyValue(r).trim();a&&(t[r]=a)});return["--primary-color","--background-color","--text-color","--border-color","--accent-color","--surface-color"].forEach(e=>{const r=n.getPropertyValue(e).trim();if(r){const n=this._mapGenericToLimbo(e,r);n&&Object.assign(t,n)}}),t}_mapGenericToLimbo(e,t){return{"--primary-color":{"--limbo-primary":t},"--background-color":{"--limbo-bg-primary":t},"--text-color":{"--limbo-text-primary":t},"--border-color":{"--limbo-border-light":t},"--accent-color":{"--limbo-primary":t},"--surface-color":{"--limbo-bg-card":t}}[e]||null}_applyInitialTheme(){let e=this.config.inheritance.fallbackTheme;if(this.config.theme.storage){const t=this._loadThemePreference();t&&this._getTheme(t)&&(e=t)}const t=document.documentElement.getAttribute("data-limbo-theme");t&&this._getTheme(t)&&(e=t);const n=this._inheritPortalTheme();n&&(e=n),this.config.theme.auto&&"auto"===e&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),this.applyTheme(e,{temporary:!1})}_applyInitialCompactMode(){let e=!1;if(this.config.compact.persistPreference){const t=this._loadCompactPreference();null!==t&&(e=t)}const t=document.documentElement.getAttribute("data-limbo-compact");"true"===t?e=!0:"false"===t&&(e=!1),("auto"===t||this.config.compact.auto)&&(e=this._shouldUseCompactMode()),e?this.enableCompactMode({persist:!1}):this.disableCompactMode({persist:!1})}_applyThemeVariables(e,t=document.documentElement){const n="string"==typeof t?document.querySelector(t):t;n?(Object.entries(e.variables).forEach(([e,t])=>{n.style.setProperty(e,t),this.appliedStyles.add(`${n.tagName}:${e}`)}),this.themeCache.set(e.name,{theme:e,appliedAt:Date.now(),scope:n})):console.warn("Theme scope element not found")}_updateThemeAttributes(e){document.documentElement.setAttribute("data-limbo-theme",e),document.documentElement.classList.remove("limbo-theme-light","limbo-theme-dark","limbo-theme-auto"),document.documentElement.classList.add(`limbo-theme-${e}`),this._updateMetaThemeColor(e)}_updateMetaThemeColor(e){const t=this._getTheme(e);if(!t)return;const n=t.variables["--limbo-primary"]||"#3b82f6";let r=document.querySelector('meta[name="theme-color"]');r||(r=document.createElement("meta"),r.name="theme-color",document.head.appendChild(r)),r.content=n}_getTheme(e){return this.config.presets[e]?this.config.presets[e]:this.customThemes.has(e)?this.customThemes.get(e):null}_getCurrentVariables(){const e=this._getTheme(this.currentTheme);if(!e)return{};const t=getComputedStyle(document.documentElement),n={};return Object.keys(e.variables).forEach(e=>{n[e]=t.getPropertyValue(e).trim()}),n}_saveThemePreference(e){try{localStorage.setItem("limbo-theme-preference",e)}catch(t){console.warn("Could not save theme preference:",t)}}_loadThemePreference(){try{return localStorage.getItem("limbo-theme-preference")}catch(e){return console.warn("Could not load theme preference:",e),null}}_loadCustomThemes(){try{const e=localStorage.getItem("limbo-custom-themes");if(e){const t=JSON.parse(e);Object.entries(t).forEach(([e,t])=>{this.customThemes.set(e,t)})}}catch(e){console.warn("Could not load custom themes:",e)}}_saveCustomThemes(){try{const e=Object.fromEntries(this.customThemes);localStorage.setItem("limbo-custom-themes",JSON.stringify(e))}catch(e){console.warn("Could not save custom themes:",e)}}_setupObservers(){this.config.theme.detectSystem&&this._setupSystemObserver(),this.config.theme.storage&&this._setupStorageObserver(),this._setupMutationObserver(),this.config.compact.auto&&this._setupViewportObserver()}_setupSystemObserver(){const e=window.matchMedia("(prefers-color-scheme: dark)");e.addEventListener("change",e=>{if("auto"===this.currentTheme||this.config.theme.auto){const t=e.matches?"dark":"light";this.applyTheme(t,{temporary:!0})}}),this.mediaQueryObserver=e}_setupStorageObserver(){const e=e=>{"limbo-theme-preference"===e.key&&e.newValue!==this.currentTheme&&this._getTheme(e.newValue)&&this.applyTheme(e.newValue)};window.addEventListener("storage",e),this.storageListener=e}_setupMutationObserver(){const e=new MutationObserver(e=>{e.forEach(e=>{if("attributes"===e.type&&"data-limbo-theme"===e.attributeName){const t=e.target.getAttribute("data-limbo-theme");t&&t!==this.currentTheme&&this._getTheme(t)&&this.applyTheme(t)}})});e.observe(document.documentElement,{attributes:!0,attributeFilter:["data-limbo-theme"]}),this.mutationObserver=e}_setupViewportObserver(){const e=`(max-width: ${this.config.compact.breakpoint}px)`,t=window.matchMedia(e);t.addEventListener("change",()=>{("auto"===document.documentElement.getAttribute("data-limbo-compact")||this.config.compact.auto)&&this.applyAutoCompactMode()}),this.compactObserver=t,window.addEventListener("orientationchange",()=>{setTimeout(()=>{("auto"===document.documentElement.getAttribute("data-limbo-compact")||this.config.compact.auto)&&this.applyAutoCompactMode()},100)})}onThemeChange(e){return this.changeCallbacks.add(e),()=>this.changeCallbacks.delete(e)}_triggerChangeCallbacks(e,t){this.changeCallbacks.forEach(n=>{try{n({theme:e,previousTheme:t,themeData:this._getTheme(e),variables:this._getCurrentVariables()})}catch(r){console.error("Error in theme change callback:",r)}})}generateThemeFromColors(e,t){const n={name:e,displayName:e,variables:{}};t.primary&&(n.variables["--limbo-primary"]=t.primary,n.variables["--limbo-primary-hover"]=this._darkenColor(t.primary,10),n.variables["--limbo-primary-light"]=this._lightenColor(t.primary,40),n.variables["--limbo-primary-dark"]=this._darkenColor(t.primary,20)),t.background&&(n.variables["--limbo-bg-primary"]=t.background,n.variables["--limbo-bg-secondary"]=this._lightenColor(t.background,5),n.variables["--limbo-bg-tertiary"]=this._lightenColor(t.background,10),n.variables["--limbo-bg-card"]=t.background),t.text&&(n.variables["--limbo-text-primary"]=t.text,n.variables["--limbo-text-secondary"]=this._lightenColor(t.text,20),n.variables["--limbo-text-tertiary"]=this._lightenColor(t.text,40));const r=this._getTheme(this.config.inheritance.fallbackTheme);return r&&(n.variables={...r.variables,...n.variables}),this.registerTheme(e,n),n}_darkenColor(e,t){const n=parseInt(e.replace("#",""),16),r=Math.round(2.55*t),a=(n>>16)-r,i=(n>>8&255)-r,o=(255&n)-r;return"#"+(16777216+65536*(a<255?a<1?0:a:255)+256*(i<255?i<1?0:i:255)+(o<255?o<1?0:o:255)).toString(16).slice(1)}_lightenColor(e,t){const n=parseInt(e.replace("#",""),16),r=Math.round(2.55*t),a=(n>>16)+r,i=(n>>8&255)+r,o=(255&n)+r;return"#"+(16777216+65536*(a<255?a<1?0:a:255)+256*(i<255?i<1?0:i:255)+(o<255?o<1?0:o:255)).toString(16).slice(1)}_deepMerge(e,t){const n={...e};return Object.keys(t).forEach(r=>{t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])?n[r]=this._deepMerge(e[r]||{},t[r]):n[r]=t[r]}),n}getThemeInfo(){return{current:this.getCurrentTheme(),available:this.getAvailableThemes(),compact:this.getCompactState(),config:this.config,isInitialized:this.isInitialized,cache:{themes:this.themeCache.size,applied:this.appliedStyles.size},observers:{system:!!this.mediaQueryObserver,storage:!!this.storageListener,mutation:!!this.mutationObserver,viewport:!!this.compactObserver}}}debug(){return console.table(this.getThemeInfo()),this.getThemeInfo()}destroy(){this.mediaQueryObserver&&this.mediaQueryObserver.removeEventListener("change",this._setupSystemObserver),this.storageListener&&window.removeEventListener("storage",this.storageListener),this.mutationObserver&&this.mutationObserver.disconnect(),this.compactObserver&&this.compactObserver.removeEventListener("change",this._setupViewportObserver),this.changeCallbacks.clear(),this.themeCache.clear(),this.appliedStyles.clear(),this._saveCustomThemes();const e=document.getElementById("limbo-theme-styles");e&&e.remove(),this.isInitialized=!1}}const mn=new class{constructor(){this.config=new m,this.instances=new on,this.autoInputs=new ln,this.events=new sn,this.modals=new cn,this.theme=new dn,this.containerQueryDetector=S,this._setupInternalListeners(),this._initializeContainerQueries()}configure(e){var t;return this.config.setGlobal(e),t={publicKey:e.publicKey,apiKey:e.apiKey,token:e.token,authMode:e.authMode||"manual",tokenProvider:e.tokenProvider,prod:e.prod||!1,mode:e.mode||"embed",callbacks:e.callbacks||null},z={...z,...t},z.authMode||(z.token?z.authMode="manual":z.authMode="session"),this.config}setToken(e){return function(e){z.token=e}(e),this}create(e){const t=this.config.merge(e);return this.instances.create(t,this.events,this.modals)}configureAutoInputs(e){return this.autoInputs.configure(e,this.config,this.events)}setTheme(e){return e&&(this.config.set("theme",e),this.theme.setTheme(e),this.events.emit("theme:changed",{theme:e})),this}getTheme(){return this.theme.getCurrentTheme()}scanAndActivate(e=null){const t=this.autoInputs.config?.dataset||"data-limbo-input-file",n=e||`[${t}]`,r=document.querySelectorAll(n);if(0===r.length)return{found:0,processed:0,skipped:0};let a=0,i=0;return r.forEach(e=>{try{this.autoInputs._processInput(e),a++}catch(t){console.warn(`⚠️ Limbo: Error procesando input ${e.id||e.name}:`,t),i++}}),this.events.emit("limbo:scanCompleted",{found:r.length,processed:a,skipped:i,inputs:Array.from(r)}),{found:r.length,processed:a,skipped:i}}_initializeContainerQueries(){this.containerQueryDetector.observeResize(),setTimeout(()=>{document.querySelectorAll(".limbo-component-container-wrapper").forEach(e=>{this.containerQueryDetector.applyResponsiveClasses(e)})},100)}rescan(e=document){const t=this.autoInputs.config?.dataset||"data-limbo-input-file",n=e.querySelectorAll(`[${t}]`);let r=0;return n.forEach(e=>{if(!this.autoInputs.instances.has(this.autoInputs._getInputId(e)))try{this.autoInputs._processInput(e),r++}catch(t){console.warn("⚠️ Limbo: Error procesando nuevo input:",t)}}),r}init(e){const t=this._mapLegacyOptions(e);return this.create(t)}getInstances(){return this.instances.getAll()}destroy(){this.instances.destroyAll(),this.autoInputs.cleanup(),this.events.cleanup(),this.theme.removeTheme()}_mapLegacyOptions(e){return{container:e.container||"#image-manager",mode:"embed",features:["gallery","upload","cropper"],apiKey:e.apiKey,prod:e.prod||!1,url:void 0===e.url||e.url}}_setupInternalListeners(){this.events.on("autoInputs:modalRequest",({config:e,callback:t})=>{this._handleAutoInputModalRequest({config:e,callback:t})})}_handleAutoInputModalRequest({config:e,callback:t}){const n=e=>{let n={};if(e.crops&&e.crops.length>0){const t=e.asset||e.original;n.original={url:t?.url||t?.urlSigned||e.originalUrl,width:t?.width||e.originalWidth,height:t?.height||e.originalHeight,assetId:t?.id||e.assetId},n.images=e.crops.map(e=>({url:e.url||e.urlSigned,width:e.width,height:e.height,name:e.name||e.filename}))}else e.asset?n.original={url:e.asset.url||e.asset.urlSigned,width:e.asset.width,height:e.asset.height,assetId:e.asset.id}:e.master?.urlSigned||e.master?.url?n.original={url:e.master.urlSigned||e.master.url,width:e.master.width||e.width,height:e.master.height||e.height,assetId:e.assetId}:e.url||e.urlSigned?n.original={url:e.url||e.urlSigned,width:e.width,height:e.height,assetId:e.assetId||e.id}:(console.warn("[Limbo] handleResult: formato de datos no reconocido",e),n=e);t(n),a.close()},r={...e,mode:"modal",autoDestroy:!0,interaction:{allowSelection:!0,allowCropping:!0,...e.interaction},callbacks:{onSelect:e=>{n(e)},onCropsSaved:e=>{n(e)},onCropperComplete:e=>{n(e)},onUpload:t=>{"upload-only"!==e.modeUI||e.features?.includes("cropper")||n(t)},onClose:()=>{}}};if(e.initialImageUrl){const t=this._extractAssetIdFromUrl(e.initialImageUrl);r._externalImage={url:e.initialImageUrl,filename:e.initialImageUrl.split("/").pop()?.split("?")[0]||"image.jpg",width:1920,height:1080,mime_type:"image/jpeg",id:t}}e.cropper&&(r.cropper=e.cropper),this.config.setGlobal({interaction:{allowSelection:!0,allowCropping:!0,...e.interaction}});const a=this.create(r);a.open()}_extractAssetIdFromUrl(e){if(!e)return null;try{const t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,n=e.match(t);return n&&n.length>=2?n[1]:n&&1===n.length?n[0]:null}catch(t){return console.warn("Error extracting asset ID from URL:",t),null}}openGallery(e={}){const t=this.create({mode:"modal",modeUI:"gallery-only",features:["gallery"],autoDestroy:!0,modal:{title:e.title||"Seleccionar Imagen",size:e.size||"large"},callbacks:{onSelect:n=>{e.onSelect?.(n),!1!==e.autoClose&&t.close()}},...e});return t.open(),t}openUploader(e={}){const t=!1!==e.redirectToGallery?["upload","gallery"]:["upload"],n=this.create({mode:"modal",modeUI:!1!==e.redirectToGallery?"full":"upload-only",features:t,autoDestroy:!0,modal:{title:e.title||"Subir Imagen",size:e.size||"medium"},callbacks:{onUpload:t=>{e.onUpload?.(t),!1===e.autoClose||e.redirectToGallery||n.close()}},...e});return n.open(),n}openCropper(e,t={}){if(!e)throw new Error("Limbo.openCropper: imageUrl es requerido");const n={url:e,filename:t.filename||"image.jpg",width:t.width||1920,height:t.height||1080,mime_type:t.mimeType||"image/jpeg",id:t.assetId||`external-${Date.now()}`},r=this.create({mode:"modal",modeUI:"crop-only",features:["cropper"],autoDestroy:!0,modal:{title:t.title||"Recortar Imagen",size:"xlarge"},cropper:{mandatoryCrops:t.mandatoryCrops||[],allowCustomCrops:!1!==t.allowCustomCrops,enforceRequiredCrops:!1!==t.enforceRequiredCrops},callbacks:{onCropperComplete:e=>{t.onComplete?.(e),!1!==t.autoClose&&r.close()},onCropperCancelled:e=>{t.onCancelled?.(e),!1!==t.autoClose&&r.close()},onCropperError:e=>{t.onError?.(e)}},_externalImage:n,...t});return r.open(),r}createInlineGallery(e,t={}){return this.create({container:e,mode:"embed",modeUI:"gallery-only",features:["gallery"],callbacks:{onSelect:t.onSelect,onDelete:t.onDelete},...t})}createInlineUploader(e,t={}){return this.create({container:e,mode:"embed",modeUI:"upload-only",features:["upload"],callbacks:{onUpload:t.onUpload},...t})}createStandaloneCropper(e,t,n={}){if(!e)throw new Error("Limbo.createStandaloneCropper: container es requerido");if(!t)throw new Error("Limbo.createStandaloneCropper: imageUrl es requerido");const r={url:t,filename:n.filename||"image.jpg",width:n.width||1920,height:n.height||1080,mime_type:n.mimeType||"image/jpeg",id:n.assetId||`external-${Date.now()}`};return this.create({container:e,mode:"embed",modeUI:"crop-only",features:["cropper"],autoHideOnComplete:!1!==n.autoHideOnComplete,cropper:{mandatoryCrops:n.mandatoryCrops||[],allowCustomCrops:!1!==n.allowCustomCrops,enforceRequiredCrops:!1!==n.enforceRequiredCrops},callbacks:{onCropperComplete:n.onComplete,onCropperCancelled:n.onCancelled,onCropperError:n.onError},_externalImage:r,...n})}createFullSelector(e,t={}){return this.create({container:e,mode:t.mode||"embed",modeUI:"full",features:["gallery","upload","cropper"],callbacks:{onSelect:t.onSelect,onUpload:t.onUpload,onDelete:t.onDelete,onCropsSaved:t.onCropsSaved},...t})}};"undefined"!=typeof window&&(window.Limbo=mn,window.limboCore=mn);"undefined"!=typeof window&&document.querySelector("#root")&&(mn.configure({prod:!1,publicKey:"pk_e464fd744106b7a8d63d453c4bd02582",authMode:"session"}),mn.create({container:"#root",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],title:"Limbo Image Manager - Development",url:!0}),mn.configureAutoInputs({dataset:"data-limbo-input-file",return:"json",features:["gallery","upload","cropper"],modeUI:"full",modalSize:"large",title:"Seleccionar imagen",crops:"free",allowDelete:!1}));export{mn as default};
509
+ /* @__PURE__ */l(en,{isOpen:T,onClose:A})]})}class on{constructor(e,t,n,r){this.id=e,this.config=t,this.eventManager=n,this.modalManager=r,this.root=null,this.container=null,this.modal=null,this.mounted=!1,this.destroyed=!1,this.button=null,this._validateConfig(),this._initialize()}_initialize(){"embed"===this.config.mode?this.mount():"button"===this.config.mode&&this._createButton(),this._emitDOMEvent("ready",{instance:this,config:this.config,timestamp:Date.now()})}mount(){if(this.mounted||this.destroyed)return this;if(this.container=this._resolveContainer(),!this.container)return this.eventManager.emit("error",{instanceId:this.id,error:"Container not found"}),this;try{this.root=C.createRoot(this.container),this.root.render(this._renderApp()),this.mounted=!0,this.eventManager.emit("ready",{instance:this})}catch(e){this.eventManager.emit("error",{instanceId:this.id,error:e.message})}return this}unmount(){return this.mounted?(this.root&&(this.root.unmount(),this.root=null),"button"===this.config.mode&&this.button,this.mounted=!1,this):this}open(){return"modal"!==this.config.mode&&"button"!==this.config.mode||(this.modal||this._createModal(),this.modal&&!this.modal.isOpened()&&(this.modal.open(),this.eventManager.emit("modal:open",{instance:this}))),this}close(){return this.modal&&this.modal.isOpened()&&(this.eventManager?.emit("modal:close",{instance:this}),this.modal.close()),this}updateConfig(e){return this.config={...this.config,...e},this.mounted&&this.root.render(this._renderApp()),this.eventManager.emit("config:updated",{instance:this,newConfig:e}),this}destroy(){this.destroyed||(this.unmount(),this.modal&&(this.modal.destroy(),this.modal=null),this.button&&this.button.parentNode&&(this.button.parentNode.removeChild(this.button),this.button=null),this.eventManager.emit("destroy",{instance:this}),this.container=null,this.config=null,this.eventManager=null,this.modalManager=null,this.destroyed=!0)}getId(){return this.id}getMode(){return this.config.mode}isMounted(){return this.mounted}isDestroyed(){return this.destroyed}getContainer(){return this.container}getConfig(){return{...this.config}}isContainerInDOM(){return this.container&&document.contains(this.container)}_createModal(){if(this.modalManager&&"modal"===this.config.mode&&(this.modal=this.modalManager.createModal({title:this.config.title||"Limbo Image Manager",size:this.config.modalSize||"large",onOpen:()=>{const e={instance:this,mode:"modal",timestamp:Date.now()};this._emitDOMEvent("modal:open",e),this.config.callbacks?.onOpen&&this.config.callbacks.onOpen(e)},onClose:()=>{const e={instance:this,mode:"modal",timestamp:Date.now()};this._emitDOMEvent("modal:close",e),this.config.callbacks?.onClose&&this.config.callbacks.onClose(e),this.config.autoDestroy&&this.destroy()},onDestroy:()=>{this.modal=null}}),this.modal)){const e=this.modal.getBodyContainer();this.root=C.createRoot(e),this.root.render(this._renderApp()),this.mounted=!0}}_createButton(){if(this.container||(this.container=this._resolveContainer()),!this.container)return void this.eventManager.emit("error",{instanceId:this.id,error:"Container not found for button mode"});const e=document.createElement("button");e.type="button",e.className="limbo-trigger-button",e.textContent=this.config.buttonText||"Abrir Limbo",e.style.cssText="\n background: #001978;\n color: white;\n border: none;\n padding: 10px 20px;\n border-radius: 6px;\n cursor: pointer;\n font-family: inherit;\n font-size: 14px;\n font-weight: 500;\n transition: all 0.2s ease;\n ",e.addEventListener("mouseenter",()=>{e.style.backgroundColor="#334793",e.style.transform="translateY(-1px)"}),e.addEventListener("mouseleave",()=>{e.style.backgroundColor="#001978",e.style.transform="translateY(0)"}),e.addEventListener("click",()=>{this.open()}),this.container.appendChild(e),this.button=e,this.mounted=!0}_resolveContainer(){const{container:e}=this.config;return e?"string"==typeof e?document.querySelector(e):e instanceof Element?e:null:null}_renderApp(){return e.createElement("div",{id:`limbo-component-container-${this.id}`,className:"limbo-instance limbo-component-container-wrapper h-full w-full py-2 bg-white rounded-md","data-limbo-id":this.id,"data-limbo-mode":this.config.mode,"data-limbo-version":"2.0","data-limbo-isolated":"true","aria-label":"Limbo Image Manager",role:"region"},e.createElement(an,{apiKey:this.config.apiKey||null,publicKey:this.config.publicKey||null,token:this.config.token||null,prod:this.config.prod||!1,url:this.config.url,features:this.config.features,modeUI:this.config.modeUI||"full",ui:this.config.ui,callbacks:this._createCallbacks(),instanceId:this.id,authMode:this.config.authMode||this.config.publicKey?"session":"manual",_externalImage:this.config._externalImage||null,cropperConfig:this.config.cropper||null}))}_createCallbacks(){return{onSelect:e=>{const t=this.config?.callbacks?.onSelect,n=this._createStandardPayload(e,"select");t&&t(n),this.destroyed||this._emitDOMEvent("select",n)},onUpload:e=>{const t=this.config?.callbacks?.onUpload,n=this._createStandardPayload(e,"upload");t&&t(n),this.destroyed||this._emitDOMEvent("upload",n)},onError:e=>{const t=this.config?.callbacks?.onError,n={instance:this,error:{message:e.message||"Unknown error",code:e.code||"UNKNOWN",timestamp:Date.now()}};t&&t(n.error),this.destroyed||this._emitDOMEvent("error",n)},onClose:()=>{const e=this.config?.callbacks?.onClose,t={instance:this,timestamp:Date.now()};e&&e(),this.destroyed||this._emitDOMEvent("close",t)}}}_createStandardPayload(e,t){const n={instance:this,eventType:t,timestamp:Date.now(),instanceId:this.id,mode:this.config?.mode,features:this.config?.features};return e&&(e.assetId||e.id?(n.assetId=e.assetId||e.id,n.variants=e.variants||[],n.master=e.master||{urlSigned:e.url||e.urlSigned,width:e.width,height:e.height,mime:e.mime||e.mimeType},n.fileName=e.fileName||e.name,n.mime=e.mime||e.mimeType,n.width=e.width,n.height=e.height,n.fileBlob=e.fileBlob||e.file,n.metadata={uploadedBy:e.uploadedBy,uploadedAt:e.uploadedAt||e.timestamp,size:e.size,...e.metadata}):Object.assign(n,e)),n}_emitDOMEvent(e,t){if(this.destroyed)return;const n=new CustomEvent(`limbo:${e}`,{detail:t,bubbles:!0,cancelable:!0});(this.getContainer()||document).dispatchEvent(n),this.eventManager?.emit(e,t)}_validateConfig(){if(!(this.config.auth?.apiKey||this.config.auth?.publicKey||this.config.auth?.token||this.config.apiKey||this.config.publicKey||this.config.token))throw new Error(`LimboInstance ${this.id}: Authentication is required. Provide either auth.publicKey (recommended) or auth.apiKey (for server-side only)`);if((this.config.auth?.apiKey||this.config.apiKey)&&"undefined"!=typeof window&&console.warn("⚠️ SECURITY WARNING: API Key detected in client-side code.\nThis is a security risk! Use publicKey instead for client applications.\nAPI Keys should only be used in server-side environments."),!["embed","modal","button"].includes(this.config.mode))throw new Error(`LimboInstance ${this.id}: invalid mode ${this.config.mode}`);if("embed"===this.config.mode&&!this.config.container)throw new Error(`LimboInstance ${this.id}: container is required for embed mode`);if("button"===this.config.mode&&!this.config.container)throw new Error(`LimboInstance ${this.id}: container is required for button mode`)}}class ln{constructor(){this.instances=/* @__PURE__ */new Map,this.counter=0}create(e,t,n){const r="limbo-"+ ++this.counter,a=new on(r,e,t,n);return this.instances.set(r,a),a}get(e){return this.instances.get(e)}getAll(){return Array.from(this.instances.values())}getActive(){return this.getAll().filter(e=>e.isMounted())}destroy(e){const t=this.instances.get(e);return!!t&&(t.destroy(),this.instances.delete(e),!0)}destroyAll(){this.instances.forEach(e=>e.destroy()),this.instances.clear()}cleanupOrphans(){const e=[];return this.instances.forEach((t,n)=>{t.isContainerInDOM()||e.push(n)}),e.forEach(e=>this.destroy(e)),e.length}getStats(){const e=this.getAll();return{total:e.length,active:e.filter(e=>e.isMounted()).length,embed:e.filter(e=>"embed"===e.getMode()).length,modal:e.filter(e=>"modal"===e.getMode()).length,button:e.filter(e=>"button"===e.getMode()).length}}}class sn{constructor(){this.config=null,this.instances=/* @__PURE__ */new Map,this.observer=null,this.initialized=!1}configure(e,t,n){return this.config={selector:e.selector||null,dataset:e.dataset||"data-limbo-input-file",return:e.return||e.returnType||"json",mode:e.mode||"modal",features:e.features||["gallery","upload","cropper"],crop:e.crop||"free",quality:e.quality||.9,format:e.format||"webp",modeUI:e.modeUI||"full",modalSize:e.modalSize||"fullscreen",theme:e.theme||"light",compact:e.compact||!1,maxSize:e.maxSize||"10MB",formats:e.formats||["jpg","jpeg","png","webp"],minWidth:e.minWidth||null,minHeight:e.minHeight||null,maxWidth:e.maxWidth||null,maxHeight:e.maxHeight||null,buttonText:e.buttonText||"Seleccionar Imagen",buttonClass:e.buttonClass||"limbo-auto-button",buttonStyle:e.buttonStyle||"primary",showPreview:!1!==e.showPreview,allowMultiple:e.allowMultiple||!1,autoAssign:!1!==e.autoAssign,...e},this.configManager=t,this.eventManager=n,this._initialize(),this}cleanup(){this.observer&&(this.observer.disconnect(),this.observer=null),this.instances.forEach(({input:e,button:t})=>{this._restoreInput(e,t)}),this.instances.clear(),this.config=null,this.initialized=!1}getStats(){return{configured:null!==this.config,totalInputs:this.instances.size,dataset:this.config?.dataset,returnType:this.config?.return}}_initialize(){this.initialized||(this._scanExistingInputs(),this._setupObserver(),this.initialized=!0,this.eventManager.emit("autoInputs:initialized",{config:this.config,inputsFound:this.instances.size}))}_scanExistingInputs(){const e=this.config.selector||`input[${this.config.dataset}]`;document.querySelectorAll(e).forEach(e=>this._processInput(e))}_processInput(e){const t=this._getInputId(e);if(this.instances.has(t))return;if(!this._validateInput(e))return;const n=this._createButton(e);this._hideInput(e),this._insertButton(e,n),this.instances.set(t,{input:e,button:n,config:this._getInputConfig(e)}),this.eventManager.emit("autoInputs:processed",{inputId:t,input:e,button:n})}_createButton(e){const t=document.createElement("button"),n=this._getInputConfig(e);t.type="button",t.textContent=n.buttonText||this.config.buttonText;const r=[this.config.buttonClass];return n.buttonClass&&n.buttonClass!==this.config.buttonClass&&r.push(n.buttonClass),t.className=r.join(" "),this._styleButton(t,n),this._attachButtonEvents(t,e),t.setAttribute("aria-label",n.buttonText||this.config.buttonText),t.setAttribute("data-limbo-trigger","true"),t.setAttribute("data-limbo-input-id",n.inputId),n.disabled&&(t.disabled=!0),t}_styleButton(e,t){const n=t.buttonStyle||this.config.buttonStyle,r=t.theme||this.config.theme,a=t.compact||this.config.compact,i={border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"inherit",fontSize:a?"12px":"14px",fontWeight:"500",transition:"all 0.2s ease",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:a?"6px 12px":"8px 16px",textDecoration:"none",userSelect:"none"},o={primary:{backgroundColor:"dark"===r?"#3b82f6":"#001978",color:"white",hoverBg:"dark"===r?"#2563eb":"#334793"},secondary:{backgroundColor:"dark"===r?"#374151":"#f3f4f6",color:"dark"===r?"#f9fafb":"#374151",border:"1px solid "+("dark"===r?"#4b5563":"#d1d5db"),hoverBg:"dark"===r?"#4b5563":"#e5e7eb"},outline:{backgroundColor:"transparent",color:"dark"===r?"#3b82f6":"#001978",border:"2px solid "+("dark"===r?"#3b82f6":"#001978"),hoverBg:"dark"===r?"#3b82f6":"#001978",hoverColor:"white"},ghost:{backgroundColor:"transparent",color:"dark"===r?"#f9fafb":"#374151",hoverBg:"dark"===r?"#374151":"#f3f4f6"}},l=o[n]||o.primary;Object.assign(e.style,{...i,...l});const s=l.backgroundColor,c=l.color;e.addEventListener("mouseenter",()=>{e.style.backgroundColor=l.hoverBg||l.backgroundColor,l.hoverColor&&(e.style.color=l.hoverColor),e.style.transform="translateY(-1px)",e.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),e.addEventListener("mouseleave",()=>{e.style.backgroundColor=s,e.style.color=c,e.style.transform="translateY(0)",e.style.boxShadow="none"}),t.disabled&&(e.style.opacity="0.5",e.style.cursor="not-allowed")}_attachButtonEvents(e,t){e.addEventListener("click",e=>{e.preventDefault(),this._handleButtonClick(t)})}_handleButtonClick(e){const t=this._getInputConfig(e),n=this._createModalConfig(t);this.eventManager.emit("autoInputs:modalRequest",{input:e,config:n,callback:async t=>await this._handleImageSelection(e,t)})}async _handleImageSelection(e,t){const n=this._getInputConfig(e);try{const r=await this._formatImageData(t,n);!1!==n.autoAssign&&(e.value=r),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:resultReady",{detail:{imageData:t,input:e,value:r,config:n,assignment:{format:n.return,smartAssign:!1!==n.smartAssign,autoAssign:!1!==n.autoAssign},legacy:{imageData:t,formatted:this._createFormattedResult(t,n)}},bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:t,input:e,value:r,config:n,formatted:this._createFormattedResult(t,n)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:t,value:r,config:n})}catch(r){console.error("Error handling image selection:",r),e.dispatchEvent(new CustomEvent("limbo:error",{detail:{error:r.message,input:e,imageData:t,config:n},bubbles:!0})),this._handleImageSelectionLegacy(e,t)}}_handleImageSelectionLegacy(e,t){const n=this._getInputConfig(e),r=this._formatImageData(t,n);!1!==n.autoAssign&&(e.value=r),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:t,input:e,value:r,config:n,formatted:this._createFormattedResult(t,n)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:t,value:r,config:n})}_createFormattedResult(e,t){return{url:e.url||e.path||"",base64:e.base64||e.dataUrl||"",assetId:e.assetId||e.id||"",fileName:e.fileName||e.filename||"",object:{url:e.url||e.path,assetId:e.assetId||e.id,fileName:e.fileName||e.filename,mime:e.mime||e.mime_type,width:e.width,height:e.height,size:e.size||e.file_size,created:e.created_at||e.created,metadata:e.metadata||{}},json:JSON.stringify({url:e.url||e.path,assetId:e.assetId||e.id,fileName:e.fileName||e.filename,mime:e.mime||e.mime_type,width:e.width,height:e.height,size:e.size||e.file_size}),metadata:{width:e.width,height:e.height,size:e.size||e.file_size,format:e.format||e.mime_type,quality:t.quality||this.config.quality,aspectRatio:e.width&&e.height?e.width/e.height:null}}}async _formatImageData(e,t=null){const n=(t||{}).return||this.config.return||"json",r=void 0!==e.original;switch(n){case"url":return r?e.images?.[0]?.url||e.original?.url||"":e.url||e.path||"";case"base64":return e.base64||e.dataUrl||"";case"assetId":return r?e.original?.assetId||"":e.assetId||e.id||"";case"fileName":return e.fileName||e.filename||"";default:return r?JSON.stringify(e):JSON.stringify({original:{url:e.url||e.path,width:e.width,height:e.height,assetId:e.assetId||e.id}})}}_createModalConfig(e){return{mode:e.mode||this.config.mode||"modal",modeUI:e.modeUI||this.config.modeUI||"full",features:e.features||this.config.features,modalSize:e.modalSize||this.config.modalSize||"fullscreen",title:e.description||this.config.title||"Seleccionar imagen",cropper:this._getCropperConfig(e),ui:{showActions:this._getUIActions(e),hideActions:[],showTabs:this._shouldShowTabs(e),theme:e.theme||this.config.theme,compact:e.compact||this.config.compact,showPreview:void 0!==e.showPreview?e.showPreview:this.config.showPreview},validation:{maxSize:e.maxSize||this.config.maxSize,formats:e.formats||this.config.formats,minWidth:e.minWidth||this.config.minWidth,minHeight:e.minHeight||this.config.minHeight,maxWidth:e.maxWidth||this.config.maxWidth,maxHeight:e.maxHeight||this.config.maxHeight,required:e.required||!1},behavior:{allowMultiple:e.allowMultiple||this.config.allowMultiple,closeOnSelect:!0,autoAssign:void 0!==e.autoAssign?e.autoAssign:this.config.autoAssign,allowSelectNew:!1!==e.allowSelectNew},initialImageUrl:e.initialImageUrl||null,returnConfig:{format:e.return||this.config.return,quality:e.quality||this.config.quality,outputFormat:e.format||this.config.format},inputMeta:{inputId:e.inputId,inputName:e.inputName,inputType:e.inputType,placeholder:e.placeholder}}}_getCropperConfig(e){const t=e.crop||this.config.crop,n={quality:e.quality||this.config.quality,format:e.format||this.config.format,mandatoryCrops:e.mandatoryCrops||[],allowAdditionalCrops:!1!==e.allowAdditionalCrops,maxCrops:e.maxCrops||null};if(e.mandatoryCrops&&e.mandatoryCrops.length>0)return{...n,aspectRatio:null};if(!t||"none"===t||"false"===t)return null;if("free"===t)return{...n,aspectRatio:null};const r={"1:1":1,"16:9":16/9,"4:3":4/3,"3:2":1.5,"2:1":2,square:1,landscape:16/9,portrait:3/4};if(r[t])return{...n,aspectRatio:r[t],minCropBoxWidth:e.minWidth||this.config.minWidth,minCropBoxHeight:e.minHeight||this.config.minHeight};if("string"==typeof t&&t.includes(":")){const[e,r]=t.split(":").map(Number);if(!isNaN(e)&&!isNaN(r)&&0!==r)return{...n,aspectRatio:e/r}}const a=parseFloat(t);return!isNaN(a)&&a>0?{...n,aspectRatio:a}:"object"==typeof t?{...n,...t}:null}_shouldShowTabs(e){const t=e.modeUI||this.config.modeUI||"full",n=e.features||this.config.features;return!["gallery-only","upload-only","crop-only","ia-only"].includes(t)&&(n&&n.length>1)}_getUIActions(e){const t=e.modeUI||this.config.modeUI||"full",n=e.features||this.config.features;let r=[];switch(t){case"gallery-only":case"upload-only":r=["select"];break;case"crop-only":r=["select","crop"];break;default:r=["select"],n.includes("cropper")&&r.push("crop"),n.includes("gallery")&&(r.push("download","copy"),this.config.allowDelete&&r.push("delete"))}return r}_getInputId(e){return e.id||e.name||`limbo-auto-${Date.now()}-${Math.random()}`}_validateInput(e){return e instanceof HTMLInputElement}_getInputConfig(e){const t=e=>e?e.split(",").map(e=>e.trim()):null,n=e=>{if(!e)return null;const t=e.match(/^(\d+(?:\.\d+)?)(MB|KB|B)?$/i);if(!t)return null;const n=parseFloat(t[1]);switch((t[2]||"B").toUpperCase()){case"MB":return 1024*n*1024;case"KB":return 1024*n;default:return n}},r=(e,t=!1)=>null===e?t:"true"===e||"1"===e||""===e,a=e=>e?parseFloat(e):null,i=e=>{if(!e)return null;try{return JSON.parse(e)}catch(t){return console.warn("[Limbo AutoInputManager] Error parsing JSON attribute:",t),null}},o=i(e.dataset.mandatorycrops)||i(e.dataset.mandatoryCrops)||i(e.getAttribute("data-mandatory-crops"))||i(e.getAttribute("data-limbo-mandatory-crops"))||null;return{return:e.dataset.returntype||e.getAttribute("data-limbo-return")||this.config.return,mode:e.dataset.mode||e.getAttribute("data-limbo-mode")||this.config.mode,features:t(e.dataset.features)||t(e.getAttribute("data-limbo-features"))||this.config.features,crop:e.dataset.crop||e.getAttribute("data-limbo-crop")||this.config.crop,quality:a(e.dataset.quality)||a(e.getAttribute("data-limbo-quality"))||this.config.quality,format:e.dataset.format||e.getAttribute("data-limbo-format")||this.config.format,modeUI:e.dataset.modeui||e.dataset.modeUI||e.getAttribute("data-limbo-mode-ui")||this.config.modeUI,modalSize:e.dataset.modalsize||e.getAttribute("data-limbo-modal-size")||this.config.modalSize,theme:e.dataset.theme||e.getAttribute("data-limbo-theme")||this.config.theme,compact:r(e.dataset.compact,null)??r(e.getAttribute("data-limbo-compact"),this.config.compact),maxSize:n(e.getAttribute("data-limbo-max-size"))||n(this.config.maxSize),formats:t(e.getAttribute("data-limbo-formats"))||this.config.formats,minWidth:a(e.getAttribute("data-limbo-min-width"))||this.config.minWidth,minHeight:a(e.getAttribute("data-limbo-min-height"))||this.config.minHeight,maxWidth:a(e.getAttribute("data-limbo-max-width"))||this.config.maxWidth,maxHeight:a(e.getAttribute("data-limbo-max-height"))||this.config.maxHeight,buttonText:e.getAttribute("data-limbo-button-text")||this.config.buttonText,buttonStyle:e.getAttribute("data-limbo-button-style")||this.config.buttonStyle,buttonClass:e.getAttribute("data-limbo-button-class")||this.config.buttonClass,showPreview:r(e.getAttribute("data-limbo-show-preview"),this.config.showPreview),allowMultiple:r(e.getAttribute("data-limbo-allow-multiple"),this.config.allowMultiple),autoAssign:r(e.getAttribute("data-limbo-auto-assign"),this.config.autoAssign),placeholder:e.getAttribute("data-limbo-placeholder"),description:e.getAttribute("data-limbo-description"),required:r(e.getAttribute("data-limbo-required"),!1),disabled:r(e.getAttribute("data-limbo-disabled"),!1),inputId:e.id||e.name||this._generateInputId(e),inputName:e.name,inputType:e.type,mandatoryCrops:o,allowAdditionalCrops:r(e.getAttribute("data-limbo-allow-additional-crops"),!0),maxCrops:a(e.getAttribute("data-limbo-max-crops"))||null,allowSelectNew:r(e.dataset.allowselectnew,null)??r(e.getAttribute("data-limbo-allow-select-new"),!0),initialImageUrl:e.value||null}}_generateInputId(){return`limbo-auto-input-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}_hideInput(e){e.style.display="none"}_insertButton(e,t){e.parentNode.insertBefore(t,e.nextSibling)}_restoreInput(e,t){e.style.display="",t&&t.parentNode&&t.parentNode.removeChild(t)}_setupObserver(){this.observer=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&this._scanNodeForInputs(e)})})}),this.observer.observe(document.body,{childList:!0,subtree:!0})}_scanNodeForInputs(e){const t=this.config.selector||`input[${this.config.dataset}]`;e.matches&&e.matches(t)&&this._processInput(e);const n=e.querySelectorAll&&e.querySelectorAll(t);n&&n.forEach(e=>this._processInput(e))}}class cn{constructor(){this.listeners=/* @__PURE__ */new Map}emit(e,t={}){this._emitDOMEvent(e,t),this._executeListeners(e,t)}on(e,t){return this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>this.off(e,t)}off(e,t){const n=this.listeners.get(e);if(n){const e=n.indexOf(t);e>-1&&n.splice(e,1)}}cleanup(){this.listeners.clear()}_emitDOMEvent(e,t){const n=new CustomEvent(`limbo:${e}`,{detail:{...t,timestamp:Date.now()},bubbles:!0,cancelable:!0});(t.instance?.getContainer()||document).dispatchEvent(n)}_executeListeners(e,t){const n=this.listeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(r){console.error(`Error executing listener for ${e}:`,r)}})}getStats(){const e={};return this.listeners.forEach((t,n)=>{e[n]=t.length}),e}}class un{constructor(){this.activeModals=/* @__PURE__ */new Set,this.zIndexBase=1e4,this.focusableSelectors=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"]):not([disabled])',"a[href]"].join(", "),this.initialized=!1,this._initGlobalListeners()}createModal(e){const t=new dn(this._generateModalId(),e,this);return this.activeModals.add(t),t}closeModal(e){const t=this._findModal(e);return!!t&&(t.close(),!0)}closeAllModals(){this.activeModals.forEach(e=>e.close()),this.activeModals.clear()}getActiveModal(){return Array.from(this.activeModals).pop()||null}getStats(){return{active:this.activeModals.size,nextZIndex:this._getNextZIndex()}}_generateModalId(){return`limbo-modal-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}_findModal(e){return Array.from(this.activeModals).find(t=>t.getId()===e)}_getNextZIndex(){return this.zIndexBase+10*this.activeModals.size}_removeModal(e){this.activeModals.delete(e)}_handleGlobalKeydown(e){const t=this.getActiveModal();t&&("Escape"===e.key&&(e.preventDefault(),t.close()),"Tab"===e.key&&this._handleTabTrap(e,t))}_handleTabTrap(e,t){const n=t.getFocusableElements();if(0===n.length)return;const r=n[0],a=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),a.focus()):document.activeElement===a&&(e.preventDefault(),r.focus())}_initGlobalListeners(){this.initialized||(this.globalKeydownHandler=e=>this._handleGlobalKeydown(e),document.addEventListener("keydown",this.globalKeydownHandler),this.initialized=!0)}destroy(){this.closeAllModals(),this.initialized&&this.globalKeydownHandler&&(document.removeEventListener("keydown",this.globalKeydownHandler),this.initialized=!1,this.globalKeydownHandler=null)}}class dn{constructor(e,t,n){this.id=e,this.config={title:t.title||"Limbo",content:t.content||null,showCloseButton:!1!==t.showCloseButton,backdrop:!1!==t.backdrop,keyboard:!1!==t.keyboard,focus:!1!==t.focus,animation:!1!==t.animation,size:t.size||"large",onOpen:t.onOpen||null,onClose:t.onClose||null,onDestroy:t.onDestroy||null,...t},this.manager=n,this.element=null,this.backdrop=null,this.isOpen=!1,this.previousFocus=null,this._create()}_create(){this._createBackdrop(),this._createModal(),this._attachEvents()}_createBackdrop(){this.config.backdrop&&(this.backdrop=document.createElement("div"),this.backdrop.className="limbo-modal-backdrop",this.backdrop.style.cssText=`\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.5);\n z-index: ${this.manager._getNextZIndex()};\n opacity: 0;\n transition: opacity 0.3s ease;\n `,this.backdrop.addEventListener("click",e=>{e.target===this.backdrop&&this.close()}))}_createModal(){this.element=document.createElement("div"),this.element.className=`limbo-modal limbo-modal--${this.config.size}`,this.element.id=this.id,this.element.role="dialog",this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby",`${this.id}-title`),this.element.tabIndex=-1;const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t={small:e?"width: 100%; height: 100%;":"max-width: 500px; min-height: 400px;",medium:e?"width: 100%; height: 100%;":"max-width: 800px; min-height: 500px;",large:e?"width: 100%; height: 100%;":"max-width: 1400px; min-height: 700px;",xlarge:e?"width: 100%; height: 100%;":"max-width: 95dvw; min-height: 85vh;",fullscreen:"width: 100%; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0;"},n="fullscreen"===this.config.size,r=e||n?`\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n transform: ${e?"translateY(100%)":"scale(0.95)"};\n width: 100%;\n height: 100%;\n max-width: none;\n max-height: none;\n border-radius: 0;\n background: white;\n z-index: ${this.manager._getNextZIndex()+1};\n opacity: ${e?"1":"0"};\n transition: ${e?"transform":"all"} 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n padding-top: env(safe-area-inset-top);\n padding-left: env(safe-area-inset-left);\n padding-right: env(safe-area-inset-right);\n padding-bottom: env(safe-area-inset-bottom);\n `:`\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(0.8);\n ${t[this.config.size]}\n width: 90%;\n max-height: 90vh;\n background: white;\n border-radius: 16px;\n box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);\n z-index: ${this.manager._getNextZIndex()+1};\n opacity: 0;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n `;this.element.style.cssText=r,this._createHeader(),this._createBody(),document.body.appendChild(this.backdrop),document.body.appendChild(this.element)}_createHeader(){const e=document.createElement("div");e.className="limbo-modal-header";const t=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);e.style.cssText=`\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: ${t?"16px 20px":"20px 24px"};\n border-bottom: 1px solid #e9ecef;\n background: #f8f9fa;\n ${t?"position: sticky; top: 0; z-index: 10;":""}\n min-height: ${t?"60px":"auto"};\n `;const n=document.createElement("h2");if(n.id=`${this.id}-title`,n.className="limbo-modal-title",n.textContent=this.config.title,n.style.cssText="\n margin: 0;\n font-size: 18px;\n font-weight: 600;\n color: #001978;\n flex: 1;\n margin-right: 16px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n ",e.appendChild(n),this.config.showCloseButton){const n=document.createElement("button");n.type="button",n.className="limbo-modal-close",n.innerHTML="✕",n.setAttribute("aria-label","Cerrar modal"),n.style.cssText=`\n background: none;\n border: none;\n font-size: ${t?"28px":"24px"};\n color: #6c757d;\n cursor: pointer;\n padding: ${t?"8px":"4px"};\n border-radius: 4px;\n transition: all 0.2s ease;\n min-width: ${t?"44px":"auto"};\n min-height: ${t?"44px":"auto"};\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n `,n.addEventListener("mouseenter",()=>{n.style.backgroundColor="#f8f9fa",n.style.color="#001978"}),n.addEventListener("mouseleave",()=>{n.style.backgroundColor="transparent",n.style.color="#6c757d"}),n.addEventListener("click",()=>this.close()),e.appendChild(n)}this.element.appendChild(e)}_createBody(){const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=document.createElement("div");t.className="limbo-modal-body",t.id=`${this.id}-body`,t.style.cssText=`\n flex: 1;\n overflow-y: auto;\n padding: 0;\n -webkit-overflow-scrolling: touch;\n ${e?"height: 100%; overscroll-behavior: contain;":""}\n `,this.config.content&&("string"==typeof this.config.content?t.innerHTML=this.config.content:this.config.content instanceof Element&&t.appendChild(this.config.content)),this.element.appendChild(t)}_attachEvents(){this._originalBodyOverflow=document.body.style.overflow}open(){if(this.isOpen)return this;window.limbo&&window.limbo.core&&window.limbo.core.keyboard?(window.limbo.core.keyboard.pushFocus(document.activeElement),window.limbo.core.keyboard.setActiveModal(this.element)):this.previousFocus=document.activeElement,document.body.style.overflow="hidden";const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t="fullscreen"===this.config.size;return requestAnimationFrame(()=>{this.backdrop&&(this.backdrop.style.opacity="1"),this.element.style.opacity="1",this.element.style.transform=e?"translateY(0%)":t?"scale(1)":"translate(-50%, -50%) scale(1)"}),this.isOpen=!0,this.config.focus&&setTimeout(()=>{if(window.limbo&&window.limbo.core&&window.limbo.core.keyboard)window.limbo.core.keyboard.focusFirst(this.element);else{const e=this.getFocusableElements()[0];e&&e.focus()}},300),this.config.onOpen&&this.config.onOpen(this),this}close(){if(!this.isOpen)return this;const e=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t="fullscreen"===this.config.size;return this.backdrop&&(this.backdrop.style.opacity="0"),this.element.style.opacity="0",this.element.style.transform=e?"translateY(100%)":t?"scale(0.95)":"translate(-50%, -50%) scale(0.8)",setTimeout(()=>{this._cleanup()},300),this.isOpen=!1,window.limbo&&window.limbo.core&&window.limbo.core.keyboard&&(window.limbo.core.keyboard.setActiveModal(null),window.limbo.core.keyboard.releaseFocus()),this.config.onClose&&this.config.onClose(this),this}destroy(){this.close(),this.manager._removeModal(this),this.config.onDestroy&&this.config.onDestroy(this)}getBodyContainer(){return this.element.querySelector(".limbo-modal-body")}getFocusableElements(){return Array.from(this.element.querySelectorAll(this.manager.focusableSelectors))}getId(){return this.id}isOpened(){return this.isOpen}getConfig(){return{...this.config}}_cleanup(){document.body.style.overflow=this._originalBodyOverflow||"",this.previousFocus&&"function"==typeof this.previousFocus.focus&&this.previousFocus.focus(),this.backdrop&&this.backdrop.parentNode&&this.backdrop.parentNode.removeChild(this.backdrop),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}}class mn{constructor(){this.currentTheme=null,this.customThemes=/* @__PURE__ */new Map,this.config=this._getDefaultConfig(),this.isInitialized=!1,this.isCompactMode=!1,this.compactBreakpoint=null,this.compactObserver=null,this.mediaQueryObserver=null,this.mutationObserver=null,this.storageListener=null,this.themeCache=/* @__PURE__ */new Map,this.appliedStyles=/* @__PURE__ */new Set,this.changeCallbacks=/* @__PURE__ */new Set}_getDefaultConfig(){return{theme:{auto:!0,storage:!0,inherit:!0,smooth:!0,detectSystem:!0},compact:{enabled:!1,auto:!0,breakpoint:768,forceOnMobile:!0,persistPreference:!0},presets:{light:{name:"light",displayName:"Claro",variables:{"--limbo-primary":"#3b82f6","--limbo-primary-hover":"#2563eb","--limbo-primary-light":"#dbeafe","--limbo-primary-dark":"#1e40af","--limbo-bg-primary":"#ffffff","--limbo-bg-secondary":"#f8fafc","--limbo-bg-tertiary":"#f1f5f9","--limbo-bg-overlay":"rgba(0, 0, 0, 0.5)","--limbo-bg-card":"#ffffff","--limbo-bg-input":"#ffffff","--limbo-text-primary":"#0f172a","--limbo-text-secondary":"#475569","--limbo-text-tertiary":"#64748b","--limbo-text-inverse":"#ffffff","--limbo-text-muted":"#94a3b8","--limbo-border-light":"#e2e8f0","--limbo-border-medium":"#cbd5e1","--limbo-border-strong":"#94a3b8","--limbo-border-focus":"#3b82f6","--limbo-success":"#10b981","--limbo-success-light":"#d1fae5","--limbo-error":"#ef4444","--limbo-error-light":"#fee2e2","--limbo-warning":"#f59e0b","--limbo-warning-light":"#fef3c7","--limbo-info":"#3b82f6","--limbo-info-light":"#dbeafe","--limbo-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.05)","--limbo-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.1)","--limbo-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.1)","--limbo-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.1)","--limbo-radius-sm":"4px","--limbo-radius-md":"6px","--limbo-radius-lg":"8px","--limbo-radius-xl":"12px","--limbo-font-family":"system-ui, -apple-system, sans-serif","--limbo-font-size-xs":"12px","--limbo-font-size-sm":"14px","--limbo-font-size-md":"16px","--limbo-font-size-lg":"18px","--limbo-font-size-xl":"20px","--limbo-z-dropdown":"1000","--limbo-z-sticky":"1020","--limbo-z-fixed":"1030","--limbo-z-modal":"1050","--limbo-z-tooltip":"1070","--limbo-transition-fast":"150ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-normal":"300ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-slow":"500ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-spacing-compact":"0.5rem","--limbo-spacing-compact-sm":"0.25rem","--limbo-spacing-compact-lg":"0.75rem","--limbo-font-size-compact-xs":"11px","--limbo-font-size-compact-sm":"12px","--limbo-font-size-compact-md":"14px","--limbo-font-size-compact-lg":"16px","--limbo-radius-compact":"4px","--limbo-radius-compact-sm":"3px","--limbo-radius-compact-lg":"6px","--limbo-button-height-compact":"32px","--limbo-input-height-compact":"36px","--limbo-modal-padding-compact":"12px","--limbo-card-padding-compact":"12px","--limbo-gap-compact":"8px","--limbo-gap-compact-sm":"4px","--limbo-gap-compact-lg":"12px"}},dark:{name:"dark",displayName:"Oscuro",variables:{"--limbo-primary":"#60a5fa","--limbo-primary-hover":"#3b82f6","--limbo-primary-light":"#1e293b","--limbo-primary-dark":"#93c5fd","--limbo-bg-primary":"#0f172a","--limbo-bg-secondary":"#1e293b","--limbo-bg-tertiary":"#334155","--limbo-bg-overlay":"rgba(0, 0, 0, 0.8)","--limbo-bg-card":"#1e293b","--limbo-bg-input":"#334155","--limbo-text-primary":"#f8fafc","--limbo-text-secondary":"#cbd5e1","--limbo-text-tertiary":"#94a3b8","--limbo-text-inverse":"#0f172a","--limbo-text-muted":"#64748b","--limbo-border-light":"#334155","--limbo-border-medium":"#475569","--limbo-border-strong":"#64748b","--limbo-border-focus":"#60a5fa","--limbo-success":"#34d399","--limbo-success-light":"#064e3b","--limbo-error":"#f87171","--limbo-error-light":"#7f1d1d","--limbo-warning":"#fbbf24","--limbo-warning-light":"#78350f","--limbo-info":"#60a5fa","--limbo-info-light":"#1e3a8a","--limbo-shadow-sm":"0 1px 2px 0 rgba(0, 0, 0, 0.2)","--limbo-shadow-md":"0 4px 6px -1px rgba(0, 0, 0, 0.3)","--limbo-shadow-lg":"0 10px 15px -3px rgba(0, 0, 0, 0.4)","--limbo-shadow-xl":"0 20px 25px -5px rgba(0, 0, 0, 0.5)","--limbo-radius-sm":"4px","--limbo-radius-md":"6px","--limbo-radius-lg":"8px","--limbo-radius-xl":"12px","--limbo-font-family":"system-ui, -apple-system, sans-serif","--limbo-font-size-xs":"12px","--limbo-font-size-sm":"14px","--limbo-font-size-md":"16px","--limbo-font-size-lg":"18px","--limbo-font-size-xl":"20px","--limbo-z-dropdown":"1000","--limbo-z-sticky":"1020","--limbo-z-fixed":"1030","--limbo-z-modal":"1050","--limbo-z-tooltip":"1070","--limbo-transition-fast":"150ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-normal":"300ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-transition-slow":"500ms cubic-bezier(0.4, 0, 0.2, 1)","--limbo-spacing-compact":"0.5rem","--limbo-spacing-compact-sm":"0.25rem","--limbo-spacing-compact-lg":"0.75rem","--limbo-font-size-compact-xs":"11px","--limbo-font-size-compact-sm":"12px","--limbo-font-size-compact-md":"14px","--limbo-font-size-compact-lg":"16px","--limbo-radius-compact":"4px","--limbo-radius-compact-sm":"3px","--limbo-radius-compact-lg":"6px","--limbo-button-height-compact":"32px","--limbo-input-height-compact":"36px","--limbo-modal-padding-compact":"12px","--limbo-card-padding-compact":"12px","--limbo-gap-compact":"8px","--limbo-gap-compact-sm":"4px","--limbo-gap-compact-lg":"12px"}},auto:{name:"auto",displayName:"Automático",variables:{}}},inheritance:{portalSelectors:["body","[data-theme]",".theme-light",".theme-dark",".light-theme",".dark-theme"],variablePrefix:"--",fallbackTheme:"light"},transitions:{duration:"300ms",easing:"cubic-bezier(0.4, 0, 0.2, 1)",properties:["background-color","border-color","color","fill","stroke","box-shadow"]}}}initialize(e={}){this.isInitialized?console.warn("ThemeManager already initialized"):(this.config=this._deepMerge(this.config,e),this._loadCustomThemes(),this.config.theme.inherit&&this._inheritPortalTheme(),this._applyInitialTheme(),this._applyInitialCompactMode(),this._setupObservers(),this._injectBaseStyles(),this.isInitialized=!0)}_injectBaseStyles(){if(document.getElementById("limbo-theme-styles"))return;const e=`\n :root {\n /* Variables de transición para cambios de tema */\n color-scheme: light dark;\n }\n \n [data-limbo-theme] {\n transition: ${this.config.transitions.properties.map(e=>`${e} ${this.config.transitions.duration} ${this.config.transitions.easing}`).join(", ")};\n }\n \n /* Clases de utilidad para temas */\n .limbo-theme-light {\n color-scheme: light;\n }\n \n .limbo-theme-dark {\n color-scheme: dark;\n }\n \n .limbo-theme-auto {\n color-scheme: light dark;\n }\n \n /* Estilos para elementos del componente con variables CSS */\n .limbo-component {\n background-color: var(--limbo-bg-primary);\n color: var(--limbo-text-primary);\n border-color: var(--limbo-border-light);\n border-radius: var(--limbo-radius-md);\n font-family: var(--limbo-font-family);\n font-size: var(--limbo-font-size-md);\n transition: var(--limbo-transition-normal);\n }\n \n .limbo-card {\n background-color: var(--limbo-bg-card);\n border: 1px solid var(--limbo-border-light);\n border-radius: var(--limbo-radius-lg);\n box-shadow: var(--limbo-shadow-md);\n color: var(--limbo-text-primary);\n }\n \n .limbo-input {\n background-color: var(--limbo-bg-input);\n border: 1px solid var(--limbo-border-medium);\n border-radius: var(--limbo-radius-md);\n color: var(--limbo-text-primary);\n font-family: var(--limbo-font-family);\n font-size: var(--limbo-font-size-md);\n transition: var(--limbo-transition-fast);\n }\n \n .limbo-input:focus {\n border-color: var(--limbo-border-focus);\n box-shadow: 0 0 0 3px var(--limbo-primary-light);\n outline: none;\n }\n \n .limbo-button {\n background-color: var(--limbo-primary);\n border: 1px solid var(--limbo-primary);\n border-radius: var(--limbo-radius-md);\n color: var(--limbo-text-inverse);\n font-family: var(--limbo-font-family);\n font-size: var(--limbo-font-size-md);\n transition: var(--limbo-transition-fast);\n cursor: pointer;\n }\n \n .limbo-button:hover {\n background-color: var(--limbo-primary-hover);\n border-color: var(--limbo-primary-hover);\n }\n \n .limbo-button.secondary {\n background-color: var(--limbo-bg-secondary);\n border-color: var(--limbo-border-medium);\n color: var(--limbo-text-primary);\n }\n \n .limbo-button.secondary:hover {\n background-color: var(--limbo-bg-tertiary);\n }\n \n /* Estados de feedback con variables */\n .limbo-state-success {\n background-color: var(--limbo-success-light);\n border-color: var(--limbo-success);\n color: var(--limbo-success);\n }\n \n .limbo-state-error {\n background-color: var(--limbo-error-light);\n border-color: var(--limbo-error);\n color: var(--limbo-error);\n }\n \n .limbo-state-warning {\n background-color: var(--limbo-warning-light);\n border-color: var(--limbo-warning);\n color: var(--limbo-warning);\n }\n \n .limbo-state-info {\n background-color: var(--limbo-info-light);\n border-color: var(--limbo-info);\n color: var(--limbo-info);\n }\n \n /* Overlay y modal con variables */\n .limbo-overlay {\n background-color: var(--limbo-bg-overlay);\n backdrop-filter: blur(4px);\n }\n \n .limbo-modal {\n background-color: var(--limbo-bg-card);\n border-radius: var(--limbo-radius-xl);\n box-shadow: var(--limbo-shadow-xl);\n color: var(--limbo-text-primary);\n }\n \n /* Responsive design con variables */\n @media (max-width: 640px) {\n .limbo-component {\n font-size: var(--limbo-font-size-sm);\n }\n }\n \n /* Modo reducido de movimiento */\n @media (prefers-reduced-motion: reduce) {\n [data-limbo-theme] {\n transition: none;\n }\n \n .limbo-component,\n .limbo-input,\n .limbo-button {\n transition: none;\n }\n }\n \n /* Esquemas de color automático */\n @media (prefers-color-scheme: dark) {\n :root:not([data-limbo-theme]) {\n color-scheme: dark;\n }\n }\n \n @media (prefers-color-scheme: light) {\n :root:not([data-limbo-theme]) {\n color-scheme: light;\n }\n }\n \n /* ===================================\n MODO COMPACTO - ESTILOS ESPECÍFICOS \n =================================== */\n \n /* Activación del modo compacto por atributo o clase */\n [data-limbo-compact="true"],\n .limbo-compact-mode {\n /* Componentes base más pequeños */\n --limbo-font-size-md: var(--limbo-font-size-compact-md);\n --limbo-font-size-sm: var(--limbo-font-size-compact-sm);\n --limbo-font-size-lg: var(--limbo-font-size-compact-lg);\n --limbo-spacing: var(--limbo-spacing-compact);\n --limbo-radius-md: var(--limbo-radius-compact);\n --limbo-gap: var(--limbo-gap-compact);\n }\n \n /* Botones compactos */\n [data-limbo-compact="true"] .limbo-button,\n .limbo-compact-mode .limbo-button {\n height: var(--limbo-button-height-compact);\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-sm);\n border-radius: var(--limbo-radius-compact);\n min-width: auto;\n }\n \n /* Inputs compactos */\n [data-limbo-compact="true"] .limbo-input,\n .limbo-compact-mode .limbo-input {\n height: var(--limbo-input-height-compact);\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-md);\n border-radius: var(--limbo-radius-compact);\n }\n \n /* Cards compactas */\n [data-limbo-compact="true"] .limbo-card,\n .limbo-compact-mode .limbo-card {\n padding: var(--limbo-card-padding-compact);\n border-radius: var(--limbo-radius-compact-lg);\n }\n \n /* Modales compactos */\n [data-limbo-compact="true"] .limbo-modal,\n .limbo-compact-mode .limbo-modal {\n padding: var(--limbo-modal-padding-compact);\n border-radius: var(--limbo-radius-compact-lg);\n max-width: 90vw;\n max-height: 90vh;\n }\n \n /* Tabs compactas */\n [data-limbo-compact="true"] .limbo-tabs,\n .limbo-compact-mode .limbo-tabs {\n gap: var(--limbo-gap-compact-sm);\n }\n \n [data-limbo-compact="true"] .limbo-tab,\n .limbo-compact-mode .limbo-tab {\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-sm);\n border-radius: var(--limbo-radius-compact-sm);\n }\n \n /* Gallery compacta */\n [data-limbo-compact="true"] .limbo-gallery,\n .limbo-compact-mode .limbo-gallery {\n gap: var(--limbo-gap-compact-sm);\n }\n \n [data-limbo-compact="true"] .limbo-gallery-item,\n .limbo-compact-mode .limbo-gallery-item {\n border-radius: var(--limbo-radius-compact);\n min-height: 120px; /* Más pequeño para móviles */\n }\n \n /* Notificaciones compactas */\n [data-limbo-compact="true"] .limbo-notification,\n .limbo-compact-mode .limbo-notification {\n padding: var(--limbo-spacing-compact-sm) var(--limbo-spacing-compact);\n font-size: var(--limbo-font-size-compact-sm);\n border-radius: var(--limbo-radius-compact);\n }\n \n /* Progress indicators compactos */\n [data-limbo-compact="true"] .limbo-progress,\n .limbo-compact-mode .limbo-progress {\n height: 3px; /* Más delgado */\n }\n \n [data-limbo-compact="true"] .limbo-progress-circular,\n .limbo-compact-mode .limbo-progress-circular {\n width: 20px;\n height: 20px;\n }\n \n /* Auto-activación en pantallas pequeñas */\n @media (max-width: 768px) {\n :root[data-limbo-compact="auto"],\n .limbo-component[data-limbo-compact="auto"] {\n /* Aplicar automáticamente estilos compactos */\n --limbo-font-size-md: var(--limbo-font-size-compact-md);\n --limbo-font-size-sm: var(--limbo-font-size-compact-sm);\n --limbo-spacing: var(--limbo-spacing-compact);\n --limbo-radius-md: var(--limbo-radius-compact);\n --limbo-gap: var(--limbo-gap-compact);\n }\n \n /* Modal full-screen en móvil cuando es compacto */\n [data-limbo-compact="auto"] .limbo-modal,\n [data-limbo-compact="true"] .limbo-modal {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n border-radius: 0;\n margin: 0;\n }\n \n /* Tabs en accordion en móvil */\n [data-limbo-compact="auto"] .limbo-tabs,\n [data-limbo-compact="true"] .limbo-tabs {\n flex-direction: column;\n width: 100%;\n }\n \n /* Gallery de 2 columnas en móvil */\n [data-limbo-compact="auto"] .limbo-gallery,\n [data-limbo-compact="true"] .limbo-gallery {\n grid-template-columns: 1fr 1fr;\n gap: var(--limbo-gap-compact);\n }\n }\n \n /* Touch targets más grandes en móviles */\n @media (max-width: 768px) and (pointer: coarse) {\n [data-limbo-compact="auto"] .limbo-button,\n [data-limbo-compact="true"] .limbo-button {\n min-height: 44px; /* Tamaño mínimo de toque recomendado */\n padding: var(--limbo-spacing-compact) var(--limbo-spacing-compact-lg);\n }\n \n [data-limbo-compact="auto"] .limbo-tab,\n [data-limbo-compact="true"] .limbo-tab {\n min-height: 44px;\n }\n }\n `,t=document.createElement("style");t.id="limbo-theme-styles",t.textContent=e,document.head.appendChild(t)}applyTheme(e,t={}){const n=this._getTheme(e);if(!n)return console.warn(`Theme '${e}' not found`),!1;const r=this.currentTheme;return this._applyThemeVariables(n,t.scope),this._updateThemeAttributes(n.name),this.config.theme.storage&&!t.temporary&&this._saveThemePreference(n.name),this.currentTheme=n.name,this._triggerChangeCallbacks(n.name,r),!0}toggleTheme(e="light",t="dark"){const n=this.currentTheme===e?t:e;return this.applyTheme(n)}applyAutoTheme(){const e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return this.applyTheme(e)}registerTheme(e,t){const n={name:e,displayName:t.displayName||e,variables:t.variables||{},extends:t.extends||null,...t};if(n.extends){const e=this._getTheme(n.extends);e&&(n.variables={...e.variables,...n.variables})}return this.customThemes.set(e,n),this}removeTheme(e){if(this.config.presets[e])return console.warn(`Cannot remove predefined theme: ${e}`),!1;const t=this.customThemes.delete(e);return t&&this.currentTheme===e&&this.applyTheme(this.config.inheritance.fallbackTheme),t}getAvailableThemes(){const e=Object.keys(this.config.presets),t=Array.from(this.customThemes.keys());return{presets:e,custom:t,all:[...e,...t]}}getCurrentTheme(){return{name:this.currentTheme,theme:this._getTheme(this.currentTheme),isCustom:this.customThemes.has(this.currentTheme),variables:this._getCurrentVariables()}}enableCompactMode(e={}){const t={element:document.documentElement,persist:!0,...e};return t.element.setAttribute("data-limbo-compact","true"),t.element.classList.add("limbo-compact-mode"),this.isCompactMode=!0,t.persist&&this.config.compact.persistPreference&&this._saveCompactPreference(!0),this._triggerCompactChange(!0),this}disableCompactMode(e={}){const t={element:document.documentElement,persist:!0,...e};return t.element.setAttribute("data-limbo-compact","false"),t.element.classList.remove("limbo-compact-mode"),this.isCompactMode=!1,t.persist&&this.config.compact.persistPreference&&this._saveCompactPreference(!1),this._triggerCompactChange(!1),this}toggleCompactMode(e={}){return this.isCompactMode?this.disableCompactMode(e):this.enableCompactMode(e)}applyAutoCompactMode(){const e=this._shouldUseCompactMode();return e&&!this.isCompactMode?this.enableCompactMode({persist:!1}):!e&&this.isCompactMode&&this.disableCompactMode({persist:!1}),this}getCompactState(){return{isEnabled:this.isCompactMode,isAuto:this.config.compact.auto,breakpoint:this.config.compact.breakpoint,currentViewport:window.innerWidth,shouldBeCompact:this._shouldUseCompactMode()}}_shouldUseCompactMode(){if(!this.config.compact.auto)return this.config.compact.enabled;const e=window.innerWidth<=this.config.compact.breakpoint,t=/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n="ontouchstart"in window||navigator.maxTouchPoints>0;return!(!this.config.compact.forceOnMobile||!t&&!n)||e}_saveCompactPreference(e){try{localStorage.setItem("limbo-compact-preference",e.toString())}catch(t){console.warn("Could not save compact preference:",t)}}_loadCompactPreference(){try{return"true"===localStorage.getItem("limbo-compact-preference")}catch(e){return console.warn("Could not load compact preference:",e),null}}_triggerCompactChange(e){this.changeCallbacks.forEach(t=>{try{t({type:"compact",isCompact:e,viewport:window.innerWidth,timestamp:Date.now()})}catch(n){console.error("Error in compact mode change callback:",n)}})}_inheritPortalTheme(){const e=this._detectPortalTheme();return e?(this.registerTheme("portal-inherited",e),"portal-inherited"):null}_detectPortalTheme(){const e={name:"portal-detected",displayName:"Tema del Portal",variables:{}};for(const t of this.config.inheritance.portalSelectors){const n=document.querySelector(t);if(n){const t=this._extractCSSVariables(n);Object.keys(t).length>0&&(e.variables={...e.variables,...t});const r=n.getAttribute("data-theme")||n.getAttribute("class")?.match(/theme-(\w+)/)||n.getAttribute("class")?.match(/(\w+)-theme/);r&&(e.detectedName=Array.isArray(r)?r[1]:r)}}return Object.keys(e.variables).length>0?e:null}_extractCSSVariables(e){const t={},n=getComputedStyle(e);["primary","primary-hover","primary-light","primary-dark","bg-primary","bg-secondary","bg-tertiary","bg-card","bg-input","text-primary","text-secondary","text-tertiary","text-inverse","border-light","border-medium","border-strong","border-focus","success","error","warning","info","shadow-sm","shadow-md","shadow-lg","shadow-xl","radius-sm","radius-md","radius-lg","radius-xl"].forEach(e=>{const r=`--limbo-${e}`,a=n.getPropertyValue(r).trim();a&&(t[r]=a)});return["--primary-color","--background-color","--text-color","--border-color","--accent-color","--surface-color"].forEach(e=>{const r=n.getPropertyValue(e).trim();if(r){const n=this._mapGenericToLimbo(e,r);n&&Object.assign(t,n)}}),t}_mapGenericToLimbo(e,t){return{"--primary-color":{"--limbo-primary":t},"--background-color":{"--limbo-bg-primary":t},"--text-color":{"--limbo-text-primary":t},"--border-color":{"--limbo-border-light":t},"--accent-color":{"--limbo-primary":t},"--surface-color":{"--limbo-bg-card":t}}[e]||null}_applyInitialTheme(){let e=this.config.inheritance.fallbackTheme;if(this.config.theme.storage){const t=this._loadThemePreference();t&&this._getTheme(t)&&(e=t)}const t=document.documentElement.getAttribute("data-limbo-theme");t&&this._getTheme(t)&&(e=t);const n=this._inheritPortalTheme();n&&(e=n),this.config.theme.auto&&"auto"===e&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),this.applyTheme(e,{temporary:!1})}_applyInitialCompactMode(){let e=!1;if(this.config.compact.persistPreference){const t=this._loadCompactPreference();null!==t&&(e=t)}const t=document.documentElement.getAttribute("data-limbo-compact");"true"===t?e=!0:"false"===t&&(e=!1),("auto"===t||this.config.compact.auto)&&(e=this._shouldUseCompactMode()),e?this.enableCompactMode({persist:!1}):this.disableCompactMode({persist:!1})}_applyThemeVariables(e,t=document.documentElement){const n="string"==typeof t?document.querySelector(t):t;n?(Object.entries(e.variables).forEach(([e,t])=>{n.style.setProperty(e,t),this.appliedStyles.add(`${n.tagName}:${e}`)}),this.themeCache.set(e.name,{theme:e,appliedAt:Date.now(),scope:n})):console.warn("Theme scope element not found")}_updateThemeAttributes(e){document.documentElement.setAttribute("data-limbo-theme",e),document.documentElement.classList.remove("limbo-theme-light","limbo-theme-dark","limbo-theme-auto"),document.documentElement.classList.add(`limbo-theme-${e}`),this._updateMetaThemeColor(e)}_updateMetaThemeColor(e){const t=this._getTheme(e);if(!t)return;const n=t.variables["--limbo-primary"]||"#3b82f6";let r=document.querySelector('meta[name="theme-color"]');r||(r=document.createElement("meta"),r.name="theme-color",document.head.appendChild(r)),r.content=n}_getTheme(e){return this.config.presets[e]?this.config.presets[e]:this.customThemes.has(e)?this.customThemes.get(e):null}_getCurrentVariables(){const e=this._getTheme(this.currentTheme);if(!e)return{};const t=getComputedStyle(document.documentElement),n={};return Object.keys(e.variables).forEach(e=>{n[e]=t.getPropertyValue(e).trim()}),n}_saveThemePreference(e){try{localStorage.setItem("limbo-theme-preference",e)}catch(t){console.warn("Could not save theme preference:",t)}}_loadThemePreference(){try{return localStorage.getItem("limbo-theme-preference")}catch(e){return console.warn("Could not load theme preference:",e),null}}_loadCustomThemes(){try{const e=localStorage.getItem("limbo-custom-themes");if(e){const t=JSON.parse(e);Object.entries(t).forEach(([e,t])=>{this.customThemes.set(e,t)})}}catch(e){console.warn("Could not load custom themes:",e)}}_saveCustomThemes(){try{const e=Object.fromEntries(this.customThemes);localStorage.setItem("limbo-custom-themes",JSON.stringify(e))}catch(e){console.warn("Could not save custom themes:",e)}}_setupObservers(){this.config.theme.detectSystem&&this._setupSystemObserver(),this.config.theme.storage&&this._setupStorageObserver(),this._setupMutationObserver(),this.config.compact.auto&&this._setupViewportObserver()}_setupSystemObserver(){const e=window.matchMedia("(prefers-color-scheme: dark)");e.addEventListener("change",e=>{if("auto"===this.currentTheme||this.config.theme.auto){const t=e.matches?"dark":"light";this.applyTheme(t,{temporary:!0})}}),this.mediaQueryObserver=e}_setupStorageObserver(){const e=e=>{"limbo-theme-preference"===e.key&&e.newValue!==this.currentTheme&&this._getTheme(e.newValue)&&this.applyTheme(e.newValue)};window.addEventListener("storage",e),this.storageListener=e}_setupMutationObserver(){const e=new MutationObserver(e=>{e.forEach(e=>{if("attributes"===e.type&&"data-limbo-theme"===e.attributeName){const t=e.target.getAttribute("data-limbo-theme");t&&t!==this.currentTheme&&this._getTheme(t)&&this.applyTheme(t)}})});e.observe(document.documentElement,{attributes:!0,attributeFilter:["data-limbo-theme"]}),this.mutationObserver=e}_setupViewportObserver(){const e=`(max-width: ${this.config.compact.breakpoint}px)`,t=window.matchMedia(e);t.addEventListener("change",()=>{("auto"===document.documentElement.getAttribute("data-limbo-compact")||this.config.compact.auto)&&this.applyAutoCompactMode()}),this.compactObserver=t,window.addEventListener("orientationchange",()=>{setTimeout(()=>{("auto"===document.documentElement.getAttribute("data-limbo-compact")||this.config.compact.auto)&&this.applyAutoCompactMode()},100)})}onThemeChange(e){return this.changeCallbacks.add(e),()=>this.changeCallbacks.delete(e)}_triggerChangeCallbacks(e,t){this.changeCallbacks.forEach(n=>{try{n({theme:e,previousTheme:t,themeData:this._getTheme(e),variables:this._getCurrentVariables()})}catch(r){console.error("Error in theme change callback:",r)}})}generateThemeFromColors(e,t){const n={name:e,displayName:e,variables:{}};t.primary&&(n.variables["--limbo-primary"]=t.primary,n.variables["--limbo-primary-hover"]=this._darkenColor(t.primary,10),n.variables["--limbo-primary-light"]=this._lightenColor(t.primary,40),n.variables["--limbo-primary-dark"]=this._darkenColor(t.primary,20)),t.background&&(n.variables["--limbo-bg-primary"]=t.background,n.variables["--limbo-bg-secondary"]=this._lightenColor(t.background,5),n.variables["--limbo-bg-tertiary"]=this._lightenColor(t.background,10),n.variables["--limbo-bg-card"]=t.background),t.text&&(n.variables["--limbo-text-primary"]=t.text,n.variables["--limbo-text-secondary"]=this._lightenColor(t.text,20),n.variables["--limbo-text-tertiary"]=this._lightenColor(t.text,40));const r=this._getTheme(this.config.inheritance.fallbackTheme);return r&&(n.variables={...r.variables,...n.variables}),this.registerTheme(e,n),n}_darkenColor(e,t){const n=parseInt(e.replace("#",""),16),r=Math.round(2.55*t),a=(n>>16)-r,i=(n>>8&255)-r,o=(255&n)-r;return"#"+(16777216+65536*(a<255?a<1?0:a:255)+256*(i<255?i<1?0:i:255)+(o<255?o<1?0:o:255)).toString(16).slice(1)}_lightenColor(e,t){const n=parseInt(e.replace("#",""),16),r=Math.round(2.55*t),a=(n>>16)+r,i=(n>>8&255)+r,o=(255&n)+r;return"#"+(16777216+65536*(a<255?a<1?0:a:255)+256*(i<255?i<1?0:i:255)+(o<255?o<1?0:o:255)).toString(16).slice(1)}_deepMerge(e,t){const n={...e};return Object.keys(t).forEach(r=>{t[r]&&"object"==typeof t[r]&&!Array.isArray(t[r])?n[r]=this._deepMerge(e[r]||{},t[r]):n[r]=t[r]}),n}getThemeInfo(){return{current:this.getCurrentTheme(),available:this.getAvailableThemes(),compact:this.getCompactState(),config:this.config,isInitialized:this.isInitialized,cache:{themes:this.themeCache.size,applied:this.appliedStyles.size},observers:{system:!!this.mediaQueryObserver,storage:!!this.storageListener,mutation:!!this.mutationObserver,viewport:!!this.compactObserver}}}debug(){return console.table(this.getThemeInfo()),this.getThemeInfo()}destroy(){this.mediaQueryObserver&&this.mediaQueryObserver.removeEventListener("change",this._setupSystemObserver),this.storageListener&&window.removeEventListener("storage",this.storageListener),this.mutationObserver&&this.mutationObserver.disconnect(),this.compactObserver&&this.compactObserver.removeEventListener("change",this._setupViewportObserver),this.changeCallbacks.clear(),this.themeCache.clear(),this.appliedStyles.clear(),this._saveCustomThemes();const e=document.getElementById("limbo-theme-styles");e&&e.remove(),this.isInitialized=!1}}const hn=new class{constructor(){this.config=new m,this.instances=new ln,this.autoInputs=new sn,this.events=new cn,this.modals=new un,this.theme=new mn,this.containerQueryDetector=S,this._setupInternalListeners(),this._initializeContainerQueries()}configure(e){var t;return this.config.setGlobal(e),t={publicKey:e.publicKey,apiKey:e.apiKey,token:e.token,authMode:e.authMode||"manual",tokenProvider:e.tokenProvider,prod:e.prod||!1,mode:e.mode||"embed",callbacks:e.callbacks||null},z={...z,...t},z.authMode||(z.token?z.authMode="manual":z.authMode="session"),this.config}setToken(e){return function(e){z.token=e}(e),this}create(e){const t=this.config.merge(e);return this.instances.create(t,this.events,this.modals)}configureAutoInputs(e){return this.autoInputs.configure(e,this.config,this.events)}setTheme(e){return e&&(this.config.set("theme",e),this.theme.setTheme(e),this.events.emit("theme:changed",{theme:e})),this}getTheme(){return this.theme.getCurrentTheme()}scanAndActivate(e=null){const t=this.autoInputs.config?.dataset||"data-limbo-input-file",n=e||`[${t}]`,r=document.querySelectorAll(n);if(0===r.length)return{found:0,processed:0,skipped:0};let a=0,i=0;return r.forEach(e=>{try{this.autoInputs._processInput(e),a++}catch(t){console.warn(`⚠️ Limbo: Error procesando input ${e.id||e.name}:`,t),i++}}),this.events.emit("limbo:scanCompleted",{found:r.length,processed:a,skipped:i,inputs:Array.from(r)}),{found:r.length,processed:a,skipped:i}}_initializeContainerQueries(){this.containerQueryDetector.observeResize(),setTimeout(()=>{document.querySelectorAll(".limbo-component-container-wrapper").forEach(e=>{this.containerQueryDetector.applyResponsiveClasses(e)})},100)}rescan(e=document){const t=this.autoInputs.config?.dataset||"data-limbo-input-file",n=e.querySelectorAll(`[${t}]`);let r=0;return n.forEach(e=>{if(!this.autoInputs.instances.has(this.autoInputs._getInputId(e)))try{this.autoInputs._processInput(e),r++}catch(t){console.warn("⚠️ Limbo: Error procesando nuevo input:",t)}}),r}init(e){const t=this._mapLegacyOptions(e);return this.create(t)}getInstances(){return this.instances.getAll()}destroy(){this.instances.destroyAll(),this.autoInputs.cleanup(),this.events.cleanup(),this.theme.removeTheme()}_mapLegacyOptions(e){return{container:e.container||"#image-manager",mode:"embed",features:["gallery","upload","cropper"],apiKey:e.apiKey,prod:e.prod||!1,url:void 0===e.url||e.url}}_setupInternalListeners(){this.events.on("autoInputs:modalRequest",({config:e,callback:t})=>{this._handleAutoInputModalRequest({config:e,callback:t})})}_handleAutoInputModalRequest({config:e,callback:t}){const n=e=>{let n={};if(e.crops&&e.crops.length>0){const t=e.asset||e.original;n.original={url:t?.url||t?.urlSigned||e.originalUrl,width:t?.width||e.originalWidth,height:t?.height||e.originalHeight,assetId:t?.id||e.assetId},n.images=e.crops.map(e=>({url:e.url||e.urlSigned,width:e.width,height:e.height,name:e.name||e.filename}))}else e.asset?n.original={url:e.asset.url||e.asset.urlSigned,width:e.asset.width,height:e.asset.height,assetId:e.asset.id}:e.master?.urlSigned||e.master?.url?n.original={url:e.master.urlSigned||e.master.url,width:e.master.width||e.width,height:e.master.height||e.height,assetId:e.assetId}:e.url||e.urlSigned?n.original={url:e.url||e.urlSigned,width:e.width,height:e.height,assetId:e.assetId||e.id}:(console.warn("[Limbo] handleResult: formato de datos no reconocido",e),n=e);t(n),a.close()},r={...e,mode:"modal",autoDestroy:!0,interaction:{allowSelection:!0,allowCropping:!0,...e.interaction},callbacks:{onSelect:e=>{n(e)},onCropsSaved:e=>{n(e)},onCropperComplete:e=>{n(e)},onUpload:t=>{"upload-only"!==e.modeUI||e.features?.includes("cropper")||n(t)},onClose:()=>{}}};if(e.initialImageUrl){const t=this._extractAssetIdFromUrl(e.initialImageUrl);r._externalImage={url:e.initialImageUrl,filename:e.initialImageUrl.split("/").pop()?.split("?")[0]||"image.jpg",width:1920,height:1080,mime_type:"image/jpeg",id:t}}e.cropper&&(r.cropper=e.cropper),this.config.setGlobal({interaction:{allowSelection:!0,allowCropping:!0,...e.interaction}});const a=this.create(r);a.open()}_extractAssetIdFromUrl(e){if(!e)return null;try{const t=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi,n=e.match(t);return n&&n.length>=2?n[1]:n&&1===n.length?n[0]:null}catch(t){return console.warn("Error extracting asset ID from URL:",t),null}}openGallery(e={}){const t=this.create({mode:"modal",modeUI:"gallery-only",features:["gallery"],autoDestroy:!0,modal:{title:e.title||"Seleccionar Imagen",size:e.size||"large"},callbacks:{onSelect:n=>{e.onSelect?.(n),!1!==e.autoClose&&t.close()}},...e});return t.open(),t}openUploader(e={}){const t=!1!==e.redirectToGallery?["upload","gallery"]:["upload"],n=this.create({mode:"modal",modeUI:!1!==e.redirectToGallery?"full":"upload-only",features:t,autoDestroy:!0,modal:{title:e.title||"Subir Imagen",size:e.size||"medium"},callbacks:{onUpload:t=>{e.onUpload?.(t),!1===e.autoClose||e.redirectToGallery||n.close()}},...e});return n.open(),n}openCropper(e,t={}){if(!e)throw new Error("Limbo.openCropper: imageUrl es requerido");const n={url:e,filename:t.filename||"image.jpg",width:t.width||1920,height:t.height||1080,mime_type:t.mimeType||"image/jpeg",id:t.assetId||`external-${Date.now()}`},r=this.create({mode:"modal",modeUI:"crop-only",features:["cropper"],autoDestroy:!0,modal:{title:t.title||"Recortar Imagen",size:"xlarge"},cropper:{mandatoryCrops:t.mandatoryCrops||[],allowCustomCrops:!1!==t.allowCustomCrops,enforceRequiredCrops:!1!==t.enforceRequiredCrops},callbacks:{onCropperComplete:e=>{t.onComplete?.(e),!1!==t.autoClose&&r.close()},onCropperCancelled:e=>{t.onCancelled?.(e),!1!==t.autoClose&&r.close()},onCropperError:e=>{t.onError?.(e)}},_externalImage:n,...t});return r.open(),r}createInlineGallery(e,t={}){return this.create({container:e,mode:"embed",modeUI:"gallery-only",features:["gallery"],callbacks:{onSelect:t.onSelect,onDelete:t.onDelete},...t})}createInlineUploader(e,t={}){return this.create({container:e,mode:"embed",modeUI:"upload-only",features:["upload"],callbacks:{onUpload:t.onUpload},...t})}createStandaloneCropper(e,t,n={}){if(!e)throw new Error("Limbo.createStandaloneCropper: container es requerido");if(!t)throw new Error("Limbo.createStandaloneCropper: imageUrl es requerido");const r={url:t,filename:n.filename||"image.jpg",width:n.width||1920,height:n.height||1080,mime_type:n.mimeType||"image/jpeg",id:n.assetId||`external-${Date.now()}`};return this.create({container:e,mode:"embed",modeUI:"crop-only",features:["cropper"],autoHideOnComplete:!1!==n.autoHideOnComplete,cropper:{mandatoryCrops:n.mandatoryCrops||[],allowCustomCrops:!1!==n.allowCustomCrops,enforceRequiredCrops:!1!==n.enforceRequiredCrops},callbacks:{onCropperComplete:n.onComplete,onCropperCancelled:n.onCancelled,onCropperError:n.onError},_externalImage:r,...n})}createFullSelector(e,t={}){return this.create({container:e,mode:t.mode||"embed",modeUI:"full",features:["gallery","upload","cropper"],callbacks:{onSelect:t.onSelect,onUpload:t.onUpload,onDelete:t.onDelete,onCropsSaved:t.onCropsSaved},...t})}};"undefined"!=typeof window&&(window.Limbo=hn,window.limboCore=hn);"undefined"!=typeof window&&document.querySelector("#root")&&(hn.configure({prod:!1,publicKey:"pk_e464fd744106b7a8d63d453c4bd02582",authMode:"session"}),hn.create({container:"#root",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],title:"Limbo Image Manager - Development",url:!0}),hn.configureAutoInputs({dataset:"data-limbo-input-file",return:"json",features:["gallery","upload","cropper"],modeUI:"full",modalSize:"large",title:"Seleccionar imagen",crops:"free",allowDelete:!1}));export{hn as default};
508
510
  //# sourceMappingURL=limbo.es.map