limbo-component 4.2.1 → 4.2.3
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.cjs.js +1 -1
- package/dist/limbo.cjs.map +1 -1
- package/dist/limbo.css +1 -1
- package/dist/limbo.es.js +197 -221
- package/dist/limbo.es.map +1 -1
- package/dist/limbo.min.js +1 -1
- package/dist/limbo.min.js.map +1 -1
- package/dist/limbo.umd.js +1 -1
- package/dist/limbo.umd.js.map +1 -1
- package/dist/types/src/components/ImageCard.d.ts.map +1 -1
- package/dist/types/src/components/MoveFolderModal.d.ts +8 -0
- package/dist/types/src/components/MoveFolderModal.d.ts.map +1 -0
- package/dist/types/src/components/TabAI.d.ts +3 -1
- package/dist/types/src/components/TabAI.d.ts.map +1 -1
- package/dist/types/src/components/TabPortals.d.ts +3 -1
- package/dist/types/src/components/TabPortals.d.ts.map +1 -1
- package/dist/types/src/components/TabStock.d.ts +3 -1
- package/dist/types/src/components/TabStock.d.ts.map +1 -1
- package/dist/types/src/components/TagsInput.d.ts.map +1 -1
- package/dist/types/src/components/UploadForm.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/limbo.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as l,useRef as n,useMemo as r,useCallback as a,useId as i}from"react";import o from"react-dom";import{jsx as s,jsxs as c,Fragment as u}from"react/jsx-runtime";const d={jpg:["image/jpeg"],jpeg:["image/jpeg"],png:["image/png"],gif:["image/gif"],webp:["image/webp"],svg:["image/svg+xml"],mp4:["video/mp4"],webm:["video/webm"],mov:["video/quicktime"],avi:["video/x-msvideo"],mkv:["video/x-matroska"],pdf:["application/pdf"],doc:["application/msword"],docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],xls:["application/vnd.ms-excel"],xlsx:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],ppt:["application/vnd.ms-powerpoint"],pptx:["application/vnd.openxmlformats-officedocument.presentationml.presentation"],txt:["text/plain"],csv:["text/csv"],json:["application/json"],xml:["application/xml","text/xml"],html:["text/html"],css:["text/css"],js:["text/javascript","application/javascript"],md:["text/markdown"],mp3:["audio/mpeg"],wav:["audio/wav"],ogg:["audio/ogg"],aac:["audio/aac"],flac:["audio/flac"]},b={image:["image/jpeg","image/png","image/webp","image/svg+xml"],video:["image/gif","video/mp4","video/webm","video/quicktime","video/x-msvideo","video/x-matroska"],document:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/csv"],audio:["audio/mpeg","audio/wav","audio/ogg","audio/webm","audio/aac","audio/flac"]},m=/* @__PURE__ */new Set(["jpg","jpeg","png","webp","svg","bmp","tiff","ico"]),h=/* @__PURE__ */new Set(["mp4","webm","mov","avi","mkv","gif"]),p=Object.freeze({categories:[],extensions:[],mimeTypes:[],acceptString:"",includesImages:!0,includesVideos:!0,isAllTypes:!0,raw:null});function f(e){if(!e)return p;const t=Array.isArray(e)?e.join(","):String(e),l=t.split(",").map(e=>e.trim()).filter(Boolean);if(0===l.length)return p;const n=[],r=[],a=/* @__PURE__ */new Set;for(const s of l)if(s.endsWith("/*")){const e=s.replace("/*","");b[e]&&(n.push(e),b[e].forEach(e=>a.add(e)))}else if(s.startsWith(".")){const e=s.slice(1).toLowerCase();r.push(e),(d[e]||[]).forEach(e=>a.add(e))}else s.includes("/")&&a.add(s);const i=n.includes("image")||r.some(e=>m.has(e)),o=n.includes("video")||r.some(e=>h.has(e));return{categories:n,extensions:r,mimeTypes:[...a],acceptString:[...a].join(","),includesImages:i,includesVideos:o,isAllTypes:!1,raw:t}}function g(e){if(!e||e.isAllTypes)return"Todos los formatos";const t=/* @__PURE__ */new Set;for(const l of e.categories)switch(l){case"image":t.add("Imágenes");break;case"video":t.add("Videos");break;case"document":t.add("Documentos");break;case"audio":t.add("Audio")}for(const l of e.extensions)t.add(l.toUpperCase());return[...t].join(", ")||"Todos los formatos"}function v(e,t=!1){const l=t?"Cambiar":"Seleccionar";if(!e)return`${l} archivo`;const n=f(e);if(n.isAllTypes)return`${l} archivo`;const{includesImages:r,includesVideos:a,categories:i}=n,o=i.some(e=>"image"!==e&&"video"!==e);return!r||a||o?!a||r||o?`${l} archivo`:`${l} vídeo`:`${"Cambiar"==l?"Editar":l} imagen`}const y={es:{"button.select":"Seleccionar","button.upload":"Subir archivo","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 archivo...","message.processing":"Procesando...","message.no_images":"No hay archivos disponibles","message.upload_success":"Archivo subido correctamente","message.upload_error":"Error al subir el archivo","message.delete_confirm":"¿Estás seguro de que deseas eliminar este archivo? 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 archivos...","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","imageCard.aria.zoom":"Ampliar {filename}","imageCard.aria.zoomPreview":"Previsualizar {filename}","imageCard.aria.zoomWithCrops":"Ver {n} recortes de {filename}","imageCard.aria.crop":"Recortar {filename}","imageCard.aria.copyUrl":"Copiar URL de {filename}","imageCard.aria.copied":"URL copiada","imageCard.aria.download":"Descargar {filename}","imageCard.aria.rename":"Renombrar {filename}","imageCard.aria.delete":"Eliminar {filename}","aiStarter.label":"Instrucciones base","aiStarter.copy":"Copiar","aiStarter.copied":"Copiado","aiStarter.copyAriaLabel":"Copiar instrucciones base","aiStarter.readMore":"Leer más","aiStarter.readLess":"Leer menos","tags.input.placeholder":"Escribir etiqueta...","tags.input.labelOptional":"Etiquetas (opcional)","tags.input.label":"Etiquetas","tags.input.hint":"Pulsa espacio o coma para confirmar","tags.input.ariaLabel":"Añadir etiquetas","tags.autocomplete.empty":"Sin resultados","tags.section.label":"Etiquetas","tags.search.placeholder":"Buscar por nombre o etiqueta...","tags.pill.ariaDelete":"Eliminar etiqueta {tag}","editAssetModal.title":"Editar asset","editAssetModal.nameLabel":"Nombre","editAssetModal.close":"Cerrar","editAssetModal.save":"Guardar cambios","editAssetModal.cancel":"Cancelar","editAssetModal.saveError":"Error al guardar. Inténtalo de nuevo.","imageCard.editButton":"Editar asset"},en:{"button.select":"Select","button.upload":"Upload file","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 file...","message.processing":"Processing...","message.no_images":"No files available","message.upload_success":"File uploaded successfully","message.upload_error":"Error uploading file","message.delete_confirm":"Are you sure you want to delete this file?","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 files...","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","imageCard.aria.zoom":"Enlarge {filename}","imageCard.aria.zoomPreview":"Preview {filename}","imageCard.aria.zoomWithCrops":"View {n} crops of {filename}","imageCard.aria.crop":"Crop {filename}","imageCard.aria.copyUrl":"Copy URL of {filename}","imageCard.aria.copied":"URL copied","imageCard.aria.download":"Download {filename}","imageCard.aria.rename":"Rename {filename}","imageCard.aria.delete":"Delete {filename}","aiStarter.label":"Base instructions","aiStarter.copy":"Copy","aiStarter.copied":"Copied","aiStarter.copyAriaLabel":"Copy base instructions","aiStarter.readMore":"Read more","aiStarter.readLess":"Read less","tags.input.placeholder":"Add tag...","tags.input.labelOptional":"Tags (optional)","tags.input.label":"Tags","tags.input.hint":"Press space or comma to confirm","tags.input.ariaLabel":"Add tags","tags.autocomplete.empty":"No results","tags.section.label":"Tags","tags.search.placeholder":"Search by name or tag...","tags.pill.ariaDelete":"Remove tag {tag}","editAssetModal.title":"Edit asset","editAssetModal.nameLabel":"Name","editAssetModal.close":"Close","editAssetModal.save":"Save changes","editAssetModal.cancel":"Cancel","editAssetModal.saveError":"Error saving. Please try again.","imageCard.editButton":"Edit asset"},pt:{"imageCard.aria.zoom":"Ampliar {filename}","imageCard.aria.zoomPreview":"Pré-visualizar {filename}","imageCard.aria.zoomWithCrops":"Ver {n} recortes de {filename}","imageCard.aria.crop":"Recortar {filename}","imageCard.aria.copyUrl":"Copiar URL de {filename}","imageCard.aria.copied":"URL copiada","imageCard.aria.download":"Descarregar {filename}","imageCard.aria.rename":"Renomear {filename}","imageCard.aria.delete":"Eliminar {filename}","aiStarter.label":"Instruções base","aiStarter.copy":"Copiar","aiStarter.copied":"Copiado","aiStarter.copyAriaLabel":"Copiar instruções base","aiStarter.readMore":"Ler mais","aiStarter.readLess":"Ler menos","tags.input.placeholder":"Adicionar etiqueta...","tags.input.labelOptional":"Etiquetas (opcional)","tags.input.label":"Etiquetas","tags.input.hint":"Prima espaço ou vírgula para confirmar","tags.input.ariaLabel":"Adicionar etiquetas","tags.autocomplete.empty":"Sem resultados","tags.section.label":"Etiquetas","tags.search.placeholder":"Pesquisar por nome ou etiqueta...","tags.pill.ariaDelete":"Remover etiqueta {tag}","editAssetModal.title":"Editar asset","editAssetModal.nameLabel":"Nome","editAssetModal.close":"Fechar","editAssetModal.save":"Guardar alterações","editAssetModal.cancel":"Cancelar","editAssetModal.saveError":"Erro ao guardar. Tente novamente.","imageCard.editButton":"Editar asset"},fr:{"imageCard.aria.zoom":"Agrandir {filename}","imageCard.aria.zoomPreview":"Prévisualiser {filename}","imageCard.aria.zoomWithCrops":"Voir {n} recadrages de {filename}","imageCard.aria.crop":"Recadrer {filename}","imageCard.aria.copyUrl":"Copier l'URL de {filename}","imageCard.aria.copied":"URL copiée","imageCard.aria.download":"Télécharger {filename}","imageCard.aria.rename":"Renommer {filename}","imageCard.aria.delete":"Supprimer {filename}","aiStarter.label":"Instructions de base","aiStarter.copy":"Copier","aiStarter.copied":"Copié","aiStarter.copyAriaLabel":"Copier les instructions de base","aiStarter.readMore":"Lire plus","aiStarter.readLess":"Lire moins","tags.input.placeholder":"Ajouter un tag...","tags.input.labelOptional":"Étiquettes (optionnel)","tags.input.label":"Étiquettes","tags.input.hint":"Appuyez sur espace ou virgule pour confirmer","tags.input.ariaLabel":"Ajouter des étiquettes","tags.autocomplete.empty":"Aucun résultat","tags.section.label":"Étiquettes","tags.search.placeholder":"Rechercher par nom ou tag...","tags.pill.ariaDelete":"Supprimer l'étiquette {tag}","editAssetModal.title":"Modifier le fichier","editAssetModal.nameLabel":"Nom","editAssetModal.close":"Fermer","editAssetModal.save":"Enregistrer les modifications","editAssetModal.cancel":"Annuler","editAssetModal.saveError":"Erreur lors de l'enregistrement. Réessayez.","imageCard.editButton":"Modifier l'asset"}};class w{constructor(e="es",t={}){this.locale=e,this.messages=this._mergeMessages(t)}_mergeMessages(e){const t={...y};return Object.keys(e).forEach(l=>{t[l]={...t[l]||{},...e[l]}}),t}t(e,t={}){let l=(this.messages[this.locale]||this.messages.es)[e]||e;return Object.keys(t).forEach(e=>{l=l.replace(`{${e}}`,t[e])}),l}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)}}const x=new w;function k(e,t={}){return x.t(e,t)}class C{constructor(){this.globalConfig={},this.defaults={container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop","rename"],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,showTypeFilter:!1,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{accept:null,maxSize:"10MB",formats:["jpg","jpeg","png","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,allowedCategories:null},folders:{include:[],exclude:[],includeNoFolder:!0,showFolderSelector:!0,showFolderFilter:!0,showFolderInfo:!0,allowMoveFolder:!0,allowCreateFolder:!0,defaultFolder:null},downloadFormat:"webp",return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar archivo",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,aiStarterPrompt:"Editorial corporate photography, authentic human moments, warm cinematic lighting, natural professional interaction, premium contemporary aesthetic, subtle shadows, asymmetrical editorial composition, intentional negative space, non-stock photography style, refined warm-neutral color palette with beige, soft whites, warm browns, deep burgundy and navy blue tones, understated sophistication, realistic office atmosphere. Avoid: fake smiles, corporate posing, flat lighting, overly clean scenes, oversaturated colors, generic stock photo aesthetic."}}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(l=>{e[l]&&"object"==typeof e[l]&&!Array.isArray(e[l])?t[l]=this._deepMerge(t[l]||{},e[l]):t[l]=e[l]})}),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 l=t||this.merge();return this._getValueByPath(l,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,l){const n=t.split("."),r=n.pop();n.reduce((e,t)=>(e[t]&&"object"==typeof e[t]||(e[t]={}),e[t]),e)[r]=l}_getOriginalDefaults(){return{container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop","rename"],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,showTypeFilter:!1,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{accept:null,maxSize:"10MB",formats:["jpg","jpeg","png","svg","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,allowedCategories:null},folders:{include:[],exclude:[],includeNoFolder:!0,showFolderSelector:!1,showFolderFilter:!1,showFolderInfo:!0,allowMoveFolder:!0,allowCreateFolder:!0,defaultFolder:null},return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar archivo",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,l)=>{e.name&&e.ratio||t.push(`Aspect preset ${l}: 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,l)=>{e.name&&e.width||t.push(`Size preset ${l}: 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 l=[...e.aspects?.map(e=>e.name)||[],...e.sizes?.map(e=>e.name)||[]];e.required.forEach(e=>{l.includes(e)||t.push(`Required preset "${e}" not found in available presets`)})}return t}getPreset(e,t,l="aspect"){const n=e.presets||this.defaults.presets;return"aspect"===l?n.aspects?.find(e=>e.name===t):"size"===l?n.sizes?.find(e=>e.name===t):null}isPresetRequired(e,t){const l=e.presets||this.defaults.presets;return l.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 l=t.locale;if(t.autoDetect&&"auto"===l){const e=(navigator.language||navigator.userLanguage).split("-")[0];l=["es","en"].includes(e)?e:"es"}else t.autoDetect&&!l&&(l="es");return new w(l,t.messages)}validate(e){const t=[],l=this._deepMerge(this.globalConfig.auth||{},e.auth||{}),n=e.apiKey||this.globalConfig.apiKey;if("jwt"!==l.authMode&&n||l.apiKey||t.push("auth.apiKey es requerido para autenticación JWT"),"legacy"!==l.authMode||n||t.push("apiKey es requerido para modo legacy"),l.apiKey||n||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 l=this._validatePresets(e.presets);t.push(...l)}return{isValid:0===t.length,errors:t}}setJWTAuth(e,t=null,l={}){const n={apiKey:e,publicKey:t,authMode:"jwt",tokenStorage:l.tokenStorage||"memory",autoRefresh:!1!==l.autoRefresh,refreshBuffer:l.refreshBuffer||30,portal:l.portal||null,...l};return this.set("auth",n),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 l=this.getGalleryFilters(t);return l.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}getFolderConfig(e=null){return(e||this.merge()).folders||this.defaults.folders}hasFolderFilters(e=null){const t=this.getFolderConfig(e);return t.include?.length>0||t.exclude?.length>0}getFolderApiParams(e=null){const t=this.getFolderConfig(e),l={};return t.include?.length>0?l.folders_include=t.include.join(","):t.exclude?.length>0&&(l.folders_exclude=t.exclude.join(",")),this.hasFolderFilters(e)&&void 0!==t.includeNoFolder&&(l.include_no_folder=t.includeNoFolder?"1":"0"),l}showFolderSelectorInUpload(e=null){const t=e||this.merge();return!0===t.folders?.showFolderSelector}showFolderFilterInGallery(e=null){const t=e||this.merge();return!0===t.folders?.showFolderFilter}canCreateFolder(e=null){const t=e||this.merge();return!1!==t.folders?.allowCreateFolder}getDefaultUploadFolder(e=null){const t=e||this.merge();return t.folders?.defaultFolder||null}getAllowedFolderSlugs(e=null){const t=e||this.merge(),l=t.folders?.include;return l&&l.length>0?l:null}getAllowedCategories(e=null){const t=e||this.merge();return t.validation?.allowedCategories||null}isCategoryAllowed(e,t=null){const l=this.getAllowedCategories(t);return null===l||l.includes(e)}isMultiTypeEnabled(e=null){const t=this.getAllowedCategories(e);return null===t||(t.length>1||1===t.length&&"image"!==t[0])}showTypeFilter(e=null){const t=e||this.merge();return!0===t.gallery?.filters?.showTypeFilter}getTypeFilterOptions(e=null){const t=this.getAllowedCategories(e),l=[{value:"",label:"Todos los tipos"},{value:"image",label:"Imágenes"},{value:"video",label:"Videos"},{value:"document",label:"Documentos"},{value:"audio",label:"Audio"}];return null===t?l:l.filter(e=>""===e.value||t.includes(e.value))}getResolvedAccept(e=null){const t=e||this.merge();return t.validation?.accept?f(t.validation.accept):t.validation?.allowedCategories?f(t.validation.allowedCategories.map(e=>`${e}/*`).join(",")):f(null)}}var S,N,E,$,_={exports:{}},T={},A={exports:{}},z={};function L(){return N||(N=1,A.exports=(S||(S=1,function(e){function t(e,t){var l=e.length;e.push(t);e:for(;0<l;){var n=l-1>>>1,a=e[n];if(!(0<r(a,t)))break e;e[n]=t,e[l]=a,l=n}}function l(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],l=e.pop();if(l!==t){e[0]=l;e:for(var n=0,a=e.length,i=a>>>1;n<i;){var o=2*(n+1)-1,s=e[o],c=o+1,u=e[c];if(0>r(s,l))c<a&&0>r(u,s)?(e[n]=u,e[c]=l,n=c):(e[n]=s,e[o]=l,n=o);else{if(!(c<a&&0>r(u,l)))break e;e[n]=u,e[c]=l,n=c}}}return t}function r(e,t){var l=e.sortIndex-t.sortIndex;return 0!==l?l:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var s=[],c=[],u=1,d=null,b=3,m=!1,h=!1,p=!1,f=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var r=l(c);null!==r;){if(null===r.callback)n(c);else{if(!(r.startTime<=e))break;n(c),r.sortIndex=r.expirationTime,t(s,r)}r=l(c)}}function x(e){if(p=!1,w(e),!h)if(null!==l(s))h=!0,C||(C=!0,k());else{var t=l(c);null!==t&&z(x,t.startTime-e)}}var k,C=!1,S=-1,N=5,E=-1;function $(){return!(!f&&e.unstable_now()-E<N)}function _(){if(f=!1,C){var t=e.unstable_now();E=t;var r=!0;try{e:{h=!1,p&&(p=!1,v(S),S=-1),m=!0;var a=b;try{t:{for(w(t),d=l(s);null!==d&&!(d.expirationTime>t&&$());){var i=d.callback;if("function"==typeof i){d.callback=null,b=d.priorityLevel;var o=i(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof o){d.callback=o,w(t),r=!0;break t}d===l(s)&&n(s),w(t)}else n(s);d=l(s)}if(null!==d)r=!0;else{var u=l(c);null!==u&&z(x,u.startTime-t),r=!1}}break e}finally{d=null,b=a,m=!1}r=void 0}}finally{r?k():C=!1}}}if("function"==typeof y)k=function(){y(_)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,A=T.port2;T.port1.onmessage=_,k=function(){A.postMessage(null)}}else k=function(){g(_,0)};function z(t,l){S=g(function(){t(e.unstable_now())},l)}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 b},e.unstable_next=function(e){switch(b){case 1:case 2:case 3:var t=3;break;default:t=b}var l=b;b=t;try{return e()}finally{b=l}},e.unstable_requestPaint=function(){f=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var l=b;b=e;try{return t()}finally{b=l}},e.unstable_scheduleCallback=function(n,r,a){var i=e.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?i+a:i,n){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return n={id:u++,callback:r,priorityLevel:n,startTime:a,expirationTime:o=a+o,sortIndex:-1},a>i?(n.sortIndex=a,t(c,n),null===l(s)&&n===l(c)&&(p?(v(S),S=-1):p=!0,z(x,a-i))):(n.sortIndex=o,t(s,n),h||m||(h=!0,C||(C=!0,k()))),n},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(e){var t=b;return function(){var l=b;b=t;try{return e.apply(this,arguments)}finally{b=l}}}}(z)),z)),A.exports}function I(){if(E)return T;E=1;var t=L(),l=e,n=o;function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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 a(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function i(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(l=t.return),e=t.return}while(e)}return 3===t.tag?l: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(i(e)!==e)throw Error(r(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 b=Object.assign,m=/* @__PURE__ */Symbol.for("react.element"),h=/* @__PURE__ */Symbol.for("react.transitional.element"),p=/* @__PURE__ */Symbol.for("react.portal"),f=/* @__PURE__ */Symbol.for("react.fragment"),g=/* @__PURE__ */Symbol.for("react.strict_mode"),v=/* @__PURE__ */Symbol.for("react.profiler"),y=/* @__PURE__ */Symbol.for("react.consumer"),w=/* @__PURE__ */Symbol.for("react.context"),x=/* @__PURE__ */Symbol.for("react.forward_ref"),k=/* @__PURE__ */Symbol.for("react.suspense"),C=/* @__PURE__ */Symbol.for("react.suspense_list"),S=/* @__PURE__ */Symbol.for("react.memo"),N=/* @__PURE__ */Symbol.for("react.lazy"),$=/* @__PURE__ */Symbol.for("react.activity"),_=/* @__PURE__ */Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function z(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=A&&e[A]||e["@@iterator"])?e:null}var I=/* @__PURE__ */Symbol.for("react.client.reference");function M(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===I?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case f:return"Fragment";case v:return"Profiler";case g:return"StrictMode";case k:return"Suspense";case C:return"SuspenseList";case $:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case p:return"Portal";case w:return e.displayName||"Context";case y:return(e._context.displayName||"Context")+".Consumer";case x:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case S:return null!==(t=e.displayName||null)?t:M(e.type)||"Memo";case N:t=e._payload,e=e._init;try{return M(e(t))}catch(l){}}return null}var P=Array.isArray,D=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},j=[],F=-1;function U(e){return{current:e}}function B(e){0>F||(e.current=j[F],j[F]=null,F--)}function q(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 X(e,t){switch(q(G,t),q(K,e),q(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=wd(t=yd(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(H),q(H,e)}function Y(){B(H),B(K),B(G)}function J(e){null!==e.memoizedState&&q(Q,e);var t=H.current,l=wd(t,e.type);t!==l&&(q(K,e),q(H,l))}function Z(e){K.current===e&&(B(H),B(K)),Q.current===e&&(B(Q),bb._currentValue=O)}function ee(e){if(void 0===W)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);W=t&&t[1]||"",V=-1<l.stack.indexOf("\n at")?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+W+e+V}var te=!1;function le(e,t){if(!e||te)return"";te=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(l,[])}catch(r){var n=r}Reflect.construct(e,[],l)}else{try{l.call()}catch(a){n=a}e.call(l.prototype)}}else{try{throw Error()}catch(i){n=i}(l=e())&&"function"==typeof l.catch&&l.catch(function(){})}}catch(o){if(o&&n&&"string"==typeof o.stack)return[o.stack,n.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=n.DetermineComponentFrameRoot(),i=a[0],o=a[1];if(i&&o){var s=i.split("\n"),c=o.split("\n");for(r=n=0;n<s.length&&!s[n].includes("DetermineComponentFrameRoot");)n++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(n===s.length||r===c.length)for(n=s.length-1,r=c.length-1;1<=n&&0<=r&&s[n]!==c[r];)r--;for(;1<=n&&0<=r;n--,r--)if(s[n]!==c[r]){if(1!==n||1!==r)do{if(n--,0>--r||s[n]!==c[r]){var u="\n"+s[n].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}}while(1<=n&&0<=r);break}}}finally{te=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ee(l):""}function ne(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 le(e.type,!1);case 11:return le(e.type.render,!1);case 1:return le(e.type,!0);case 31:return ee("Activity");default:return""}}function re(e){try{var t="",l=null;do{t+=ne(e,l),l=e,e=e.return}while(e);return t}catch(n){return"\nError generating stack: "+n.message+"\n"+n.stack}}var ae=Object.prototype.hasOwnProperty,ie=t.unstable_scheduleCallback,oe=t.unstable_cancelCallback,se=t.unstable_shouldYield,ce=t.unstable_requestPaint,ue=t.unstable_now,de=t.unstable_getCurrentPriorityLevel,be=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,he=t.unstable_NormalPriority,pe=t.unstable_LowPriority,fe=t.unstable_IdlePriority,ge=t.log,ve=t.unstable_setDisableYieldValue,ye=null,we=null;function xe(e){if("function"==typeof ge&&ve(e),we&&"function"==typeof we.setStrictMode)try{we.setStrictMode(ye,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 Te(e,t,l){var n=e.pendingLanes;if(0===n)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=134217727&n;return 0!==o?0!==(n=o&~a)?r=_e(n):0!==(i&=o)?r=_e(i):l||0!==(l=o&~e)&&(r=_e(l)):0!==(o=n&~a)?r=_e(o):0!==i?r=_e(i):l||0!==(l=n&~e)&&(r=_e(l)),0===r?0:0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(l=t&-t)||32===a&&4194048&l)?t:r}function Ae(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function ze(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 Le(){var e=$e;return!(62914560&($e<<=1))&&($e=4194304),e}function Ie(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Me(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Pe(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-ke(t);e.entangledLanes|=t,e.entanglements[n]=1073741824|e.entanglements[n]|261930&l}function De(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var n=31-ke(l),r=1<<n;r&t|e[n]&t&&(e[n]|=t),l&=~r}}function Re(e,t){var l=t&-t;return 0!==((l=42&l?1:Oe(l))&(e.suspendedLanes|t))?0:l}function Oe(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=R.p;return 0!==e?e:void 0===(e=window.event)?32:_b(e.type)}function Ue(e,t){var l=R.p;try{return R.p=e,t()}finally{R.p=l}}var Be=Math.random().toString(36).slice(2),qe="__reactFiber$"+Be,We="__reactProps$"+Be,Ve="__reactContainer$"+Be,He="__reactEvents$"+Be,Ke="__reactListeners$"+Be,Ge="__reactHandles$"+Be,Qe="__reactResources$"+Be,Xe="__reactMarker$"+Be;function Ye(e){delete e[qe],delete e[We],delete e[He],delete e[Ke],delete e[Ge]}function Je(e){var t=e[qe];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Ve]||l[qe]){if(l=t.alternate,null!==t.child||null!==l&&null!==l.child)for(e=Od(e);null!==e;){if(l=e[qe])return l;e=Od(e)}return t}l=(e=l).parentNode}return null}function Ze(e){if(e=e[qe]||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(r(33))}function tt(e){var t=e[Qe];return t||(t=e[Qe]={hoistableStyles:/* @__PURE__ */new Map,hoistableScripts:/* @__PURE__ */new Map}),t}function lt(e){e[Xe]=!0}var nt=/* @__PURE__ */new Set,rt={};function at(e,t){it(e,t),it(e+"Capture",t)}function it(e,t){for(rt[e]=t,e=0;e<t.length;e++)nt.add(t[e])}var ot=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,l){if(r=t,ae.call(ct,r)||!ae.call(st,r)&&(ot.test(r)?ct[r]=!0:(st[r]=!0,0)))if(null===l)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var n=t.toLowerCase().slice(0,5);if("data-"!==n&&"aria-"!==n)return void e.removeAttribute(t)}e.setAttribute(t,""+l)}var r}function dt(e,t,l){if(null===l)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+l)}}function bt(e,t,l,n){if(null===n)e.removeAttribute(l);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(l)}e.setAttributeNS(t,l,""+n)}}function mt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function ht(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function pt(e){if(!e._valueTracker){var t=ht(e)?"checked":"value";e._valueTracker=function(e,t,l){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var r=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){l=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(e){l=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),n="";return e&&(n=ht(e)?e.checked?"true":"false":e.value),(e=n)!==l&&(t.setValue(e),!0)}function gt(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 vt=/[\n"\\]/g;function yt(e){return e.replace(vt,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function wt(e,t,l,n,r,a,i,o){e.name="",null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.type=i:e.removeAttribute("type"),null!=t?"number"===i?(0===t&&""===e.value||e.value!=t)&&(e.value=""+mt(t)):e.value!==""+mt(t)&&(e.value=""+mt(t)):"submit"!==i&&"reset"!==i||e.removeAttribute("value"),null!=t?kt(e,i,mt(t)):null!=l?kt(e,i,mt(l)):null!=n&&e.removeAttribute("value"),null==r&&null!=a&&(e.defaultChecked=!!a),null!=r&&(e.checked=r&&"function"!=typeof r&&"symbol"!=typeof r),null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.name=""+mt(o):e.removeAttribute("name")}function xt(e,t,l,n,r,a,i,o){if(null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.type=a),null!=t||null!=l){if(("submit"===a||"reset"===a)&&null==t)return void pt(e);l=null!=l?""+mt(l):"",t=null!=t?""+mt(t):l,o||t===e.value||(e.value=t),e.defaultValue=t}n="function"!=typeof(n=null!=n?n:r)&&"symbol"!=typeof n&&!!n,e.checked=o?e.checked:!!n,e.defaultChecked=!!n,null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.name=i),pt(e)}function kt(e,t,l){"number"===t&>(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Ct(e,t,l,n){if(e=e.options,t){t={};for(var r=0;r<l.length;r++)t["$"+l[r]]=!0;for(l=0;l<e.length;l++)r=t.hasOwnProperty("$"+e[l].value),e[l].selected!==r&&(e[l].selected=r),r&&n&&(e[l].defaultSelected=!0)}else{for(l=""+mt(l),t=null,r=0;r<e.length;r++){if(e[r].value===l)return e[r].selected=!0,void(n&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function St(e,t,l){null==t||((t=""+mt(t))!==e.value&&(e.value=t),null!=l)?e.defaultValue=null!=l?""+mt(l):"":e.defaultValue!==t&&(e.defaultValue=t)}function Nt(e,t,l,n){if(null==t){if(null!=n){if(null!=l)throw Error(r(92));if(P(n)){if(1<n.length)throw Error(r(93));n=n[0]}l=n}null==l&&(l=""),t=l}l=mt(t),e.defaultValue=l,(n=e.textContent)===l&&""!==n&&null!==n&&(e.value=n),pt(e)}function Et(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&3===l.nodeType)return void(l.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,l){var n=0===t.indexOf("--");null==l||"boolean"==typeof l||""===l?n?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":n?e.setProperty(t,l):"number"!=typeof l||0===l||$t.has(t)?"float"===t?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Tt(e,t,l){if(null!=t&&"object"!=typeof t)throw Error(r(62));if(e=e.style,null!=l){for(var n in l)!l.hasOwnProperty(n)||null!=t&&t.hasOwnProperty(n)||(0===n.indexOf("--")?e.setProperty(n,""):"float"===n?e.cssFloat="":e[n]="");for(var a in t)n=t[a],t.hasOwnProperty(a)&&l[a]!==n&&_t(e,a,n)}else for(var i in t)t.hasOwnProperty(i)&&_t(e,i,t[i])}function At(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 zt=/* @__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"]]),Lt=/^[\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 It(e){return Lt.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Mt(){}var Pt=null;function Dt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Rt=null,Ot=null;function jt(e){var t=Ze(e);if(t&&(e=t.stateNode)){var l=e[We]||null;e:switch(e=t.stateNode,t.type){case"input":if(wt(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,"radio"===l.type&&null!=t){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+yt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var n=l[t];if(n!==e&&n.form===e.form){var a=n[We]||null;if(!a)throw Error(r(90));wt(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<l.length;t++)(n=l[t]).form===e.form&&ft(n)}break e;case"textarea":St(e,l.value,l.defaultValue);break e;case"select":null!=(t=l.value)&&Ct(e,!!l.multiple,t,!1)}}}var Ft=!1;function Ut(e,t,l){if(Ft)return e(t,l);Ft=!0;try{return e(t)}finally{if(Ft=!1,(null!==Rt||null!==Ot)&&(tu(),Rt&&(t=Rt,e=Ot,Ot=Rt=null,jt(t),e)))for(t=0;t<e.length;t++)jt(e[t])}}function Bt(e,t){var l=e.stateNode;if(null===l)return null;var n=l[We]||null;if(null===n)return null;l=n[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":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(l&&"function"!=typeof l)throw Error(r(231,t,typeof l));return l}var qt=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Wt=!1;if(qt)try{var Vt={};Object.defineProperty(Vt,"passive",{get:function(){Wt=!0}}),window.addEventListener("test",Vt,Vt),window.removeEventListener("test",Vt,Vt)}catch(Zb){Wt=!1}var Ht=null,Kt=null,Gt=null;function Qt(){if(Gt)return Gt;var e,t,l=Kt,n=l.length,r="value"in Ht?Ht.value:Ht.textContent,a=r.length;for(e=0;e<n&&l[e]===r[e];e++);var i=n-e;for(t=1;t<=i&&l[n-t]===r[a-t];t++);return Gt=r.slice(e,1<t?1-t:void 0)}function Xt(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 Yt(){return!0}function Jt(){return!1}function Zt(e){function t(t,l,n,r,a){for(var i in this._reactName=t,this._targetInst=n,this.type=l,this.nativeEvent=r,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(r):r[i]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?Yt:Jt,this.isPropagationStopped=Jt,this}return b(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=Yt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Yt)},persist:function(){},isPersistent:Yt}),t}var el,tl,ll,nl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rl=Zt(nl),al=b({},nl,{view:0,detail:0}),il=Zt(al),ol=b({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vl,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!==ll&&(ll&&"mousemove"===e.type?(el=e.screenX-ll.screenX,tl=e.screenY-ll.screenY):tl=el=0,ll=e),el)},movementY:function(e){return"movementY"in e?e.movementY:tl}}),sl=Zt(ol),cl=Zt(b({},ol,{dataTransfer:0})),ul=Zt(b({},al,{relatedTarget:0})),dl=Zt(b({},nl,{animationName:0,elapsedTime:0,pseudoElement:0})),bl=Zt(b({},nl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),ml=Zt(b({},nl,{data:0})),hl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pl={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"},fl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gl(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=fl[e])&&!!t[e]}function vl(){return gl}var yl=Zt(b({},al,{key:function(e){if(e.key){var t=hl[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Xt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?pl[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vl,charCode:function(e){return"keypress"===e.type?Xt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Xt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),wl=Zt(b({},ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),xl=Zt(b({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vl})),kl=Zt(b({},nl,{propertyName:0,elapsedTime:0,pseudoElement:0})),Cl=Zt(b({},ol,{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})),Sl=Zt(b({},nl,{newState:0,oldState:0})),Nl=[9,13,27,32],El=qt&&"CompositionEvent"in window,$l=null;qt&&"documentMode"in document&&($l=document.documentMode);var _l=qt&&"TextEvent"in window&&!$l,Tl=qt&&(!El||$l&&8<$l&&11>=$l),Al=String.fromCharCode(32),zl=!1;function Ll(e,t){switch(e){case"keyup":return-1!==Nl.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Il(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ml=!1;var Pl={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 Dl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Pl[e.type]:"textarea"===t}function Rl(e,t,l,n){Rt?Ot?Ot.push(n):Ot=[n]:Rt=n,0<(t=ad(t,"onChange")).length&&(l=new rl("onChange","change",null,l,n),e.push({event:l,listeners:t}))}var Ol=null,jl=null;function Fl(e){Yu(e,0)}function Ul(e){if(ft(et(e)))return e}function Bl(e,t){if("change"===e)return t}var ql=!1;if(qt){var Wl;if(qt){var Vl="oninput"in document;if(!Vl){var Hl=document.createElement("div");Hl.setAttribute("oninput","return;"),Vl="function"==typeof Hl.oninput}Wl=Vl}else Wl=!1;ql=Wl&&(!document.documentMode||9<document.documentMode)}function Kl(){Ol&&(Ol.detachEvent("onpropertychange",Gl),jl=Ol=null)}function Gl(e){if("value"===e.propertyName&&Ul(jl)){var t=[];Rl(t,jl,e,Dt(e)),Ut(Fl,t)}}function Ql(e,t,l){"focusin"===e?(Kl(),jl=l,(Ol=t).attachEvent("onpropertychange",Gl)):"focusout"===e&&Kl()}function Xl(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Ul(jl)}function Yl(e,t){if("click"===e)return Ul(t)}function Jl(e,t){if("input"===e||"change"===e)return Ul(t)}var Zl="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function en(e,t){if(Zl(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var l=Object.keys(e),n=Object.keys(t);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var r=l[n];if(!ae.call(t,r)||!Zl(e[r],t[r]))return!1}return!0}function tn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ln(e,t){var l,n=tn(e);for(e=0;n;){if(3===n.nodeType){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=tn(n)}}function nn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?nn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function rn(e){for(var t=gt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var l="string"==typeof t.contentWindow.location.href}catch(n){l=!1}if(!l)break;t=gt((e=t.contentWindow).document)}return t}function an(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 on=qt&&"documentMode"in document&&11>=document.documentMode,sn=null,cn=null,un=null,dn=!1;function bn(e,t,l){var n=l.window===l?l.document:9===l.nodeType?l:l.ownerDocument;dn||null==sn||sn!==gt(n)||("selectionStart"in(n=sn)&&an(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},un&&en(un,n)||(un=n,0<(n=ad(cn,"onSelect")).length&&(t=new rl("onSelect","select",null,t,l),e.push({event:t,listeners:n}),t.target=sn)))}function mn(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var hn={animationend:mn("Animation","AnimationEnd"),animationiteration:mn("Animation","AnimationIteration"),animationstart:mn("Animation","AnimationStart"),transitionrun:mn("Transition","TransitionRun"),transitionstart:mn("Transition","TransitionStart"),transitioncancel:mn("Transition","TransitionCancel"),transitionend:mn("Transition","TransitionEnd")},pn={},fn={};function gn(e){if(pn[e])return pn[e];if(!hn[e])return e;var t,l=hn[e];for(t in l)if(l.hasOwnProperty(t)&&t in fn)return pn[e]=l[t];return e}qt&&(fn=document.createElement("div").style,"AnimationEvent"in window||(delete hn.animationend.animation,delete hn.animationiteration.animation,delete hn.animationstart.animation),"TransitionEvent"in window||delete hn.transitionend.transition);var vn=gn("animationend"),yn=gn("animationiteration"),wn=gn("animationstart"),xn=gn("transitionrun"),kn=gn("transitionstart"),Cn=gn("transitioncancel"),Sn=gn("transitionend"),Nn=/* @__PURE__ */new Map,En="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 $n(e,t){Nn.set(e,t),at(t,[e])}En.push("scrollEnd");var _n="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)},Tn=[],An=0,zn=0;function Ln(){for(var e=An,t=zn=An=0;t<e;){var l=Tn[t];Tn[t++]=null;var n=Tn[t];Tn[t++]=null;var r=Tn[t];Tn[t++]=null;var a=Tn[t];if(Tn[t++]=null,null!==n&&null!==r){var i=n.pending;null===i?r.next=r:(r.next=i.next,i.next=r),n.pending=r}0!==a&&Dn(l,r,a)}}function In(e,t,l,n){Tn[An++]=e,Tn[An++]=t,Tn[An++]=l,Tn[An++]=n,zn|=n,e.lanes|=n,null!==(e=e.alternate)&&(e.lanes|=n)}function Mn(e,t,l,n){return In(e,t,l,n),Rn(e)}function Pn(e,t){return In(e,null,null,t),Rn(e)}function Dn(e,t,l){e.lanes|=l;var n=e.alternate;null!==n&&(n.lanes|=l);for(var r=!1,a=e.return;null!==a;)a.childLanes|=l,null!==(n=a.alternate)&&(n.childLanes|=l),22===a.tag&&(null===(e=a.stateNode)||1&e._visibility||(r=!0)),e=a,a=a.return;return 3===e.tag?(a=e.stateNode,r&&null!==t&&(r=31-ke(l),null===(n=(e=a.hiddenUpdates)[r])?e[r]=[t]:n.push(t),t.lane=536870912|l),a):null}function Rn(e){if(50<Hc)throw Hc=0,Kc=null,Error(r(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var On={};function jn(e,t,l,n){this.tag=e,this.key=l,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fn(e,t,l,n){return new jn(e,t,l,n)}function Un(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Bn(e,t){var l=e.alternate;return null===l?((l=Fn(e.tag,t,e.key,e.mode)).elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=65011712&e.flags,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function qn(e,t){e.flags&=65011714;var l=e.alternate;return null===l?(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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Wn(e,t,l,n,a,i){var o=0;if(n=e,"function"==typeof e)Un(e)&&(o=1);else if("string"==typeof e)o=function(e,t,l){if(1===l||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,l,H.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case $:return(e=Fn(31,l,t,a)).elementType=$,e.lanes=i,e;case f:return Vn(l.children,a,i,t);case g:o=8,a|=24;break;case v:return(e=Fn(12,l,t,2|a)).elementType=v,e.lanes=i,e;case k:return(e=Fn(13,l,t,a)).elementType=k,e.lanes=i,e;case C:return(e=Fn(19,l,t,a)).elementType=C,e.lanes=i,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case w:o=10;break e;case y:o=9;break e;case x:o=11;break e;case S:o=14;break e;case N:o=16,n=null;break e}o=29,l=Error(r(130,null===e?"null":typeof e,"")),n=null}return(t=Fn(o,l,t,a)).elementType=e,t.type=n,t.lanes=i,t}function Vn(e,t,l,n){return(e=Fn(7,e,n,t)).lanes=l,e}function Hn(e,t,l){return(e=Fn(6,e,null,t)).lanes=l,e}function Kn(e){var t=Fn(18,null,null,0);return t.stateNode=e,t}function Gn(e,t,l){return(t=Fn(4,null!==e.children?e.children:[],e.key,t)).lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Qn=/* @__PURE__ */new WeakMap;function Xn(e,t){if("object"==typeof e&&null!==e){var l=Qn.get(e);return void 0!==l?l:(t={value:e,source:t,stack:re(t)},Qn.set(e,t),t)}return{value:e,source:t,stack:re(t)}}var Yn=[],Jn=0,Zn=null,er=0,tr=[],lr=0,nr=null,rr=1,ar="";function ir(e,t){Yn[Jn++]=er,Yn[Jn++]=Zn,Zn=e,er=t}function or(e,t,l){tr[lr++]=rr,tr[lr++]=ar,tr[lr++]=nr,nr=e;var n=rr;e=ar;var r=32-ke(n)-1;n&=~(1<<r),l+=1;var a=32-ke(t)+r;if(30<a){var i=r-r%5;a=(n&(1<<i)-1).toString(32),n>>=i,r-=i,rr=1<<32-ke(t)+r|l<<r|n,ar=a+e}else rr=1<<a|l<<r|n,ar=e}function sr(e){null!==e.return&&(ir(e,1),or(e,1,0))}function cr(e){for(;e===Zn;)Zn=Yn[--Jn],Yn[Jn]=null,er=Yn[--Jn],Yn[Jn]=null;for(;e===nr;)nr=tr[--lr],tr[lr]=null,ar=tr[--lr],tr[lr]=null,rr=tr[--lr],tr[lr]=null}function ur(e,t){tr[lr++]=rr,tr[lr++]=ar,tr[lr++]=nr,rr=t.id,ar=t.overflow,nr=e}var dr=null,br=null,mr=!1,hr=null,pr=!1,fr=Error(r(519));function gr(e){throw Cr(Xn(Error(r(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),fr}function vr(e){var t=e.stateNode,l=e.type,n=e.memoizedProps;switch(t[qe]=e,t[We]=n,l){case"dialog":Ju("cancel",t),Ju("close",t);break;case"iframe":case"object":case"embed":Ju("load",t);break;case"video":case"audio":for(l=0;l<Qu.length;l++)Ju(Qu[l],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,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":Ju("invalid",t);break;case"textarea":Ju("invalid",t),Nt(t,n.value,n.defaultValue,n.children)}"string"!=typeof(l=n.children)&&"number"!=typeof l&&"bigint"!=typeof l||t.textContent===""+l||!0===n.suppressHydrationWarning||dd(t.textContent,l)?(null!=n.popover&&(Ju("beforetoggle",t),Ju("toggle",t)),null!=n.onScroll&&Ju("scroll",t),null!=n.onScrollEnd&&Ju("scrollend",t),null!=n.onClick&&(t.onclick=Mt),t=!0):t=!1,t||gr(e,!0)}function yr(e){for(dr=e.return;dr;)switch(dr.tag){case 5:case 31:case 13:return void(pr=!1);case 27:case 3:return void(pr=!0);default:dr=dr.return}}function wr(e){if(e!==dr)return!1;if(!mr)return yr(e),mr=!0,!1;var t,l=e.tag;if((t=3!==l&&27!==l)&&((t=5===l)&&(t=!("form"!==(t=e.type)&&"button"!==t)||xd(e.type,e.memoizedProps)),t=!t),t&&br&&gr(e),yr(e),13===l){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));br=Rd(e)}else if(31===l){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));br=Rd(e)}else 27===l?(l=br,_d(e.type)?(e=Dd,Dd=null,br=e):br=l):br=dr?Pd(e.stateNode.nextSibling):null;return!0}function xr(){br=dr=null,mr=!1}function kr(){var e=hr;return null!==e&&(null===Lc?Lc=e:Lc.push.apply(Lc,e),hr=null),e}function Cr(e){null===hr?hr=[e]:hr.push(e)}var Sr=U(null),Nr=null,Er=null;function $r(e,t,l){q(Sr,t._currentValue),t._currentValue=l}function _r(e){e._currentValue=Sr.current,B(Sr)}function Tr(e,t,l){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==n&&(n.childLanes|=t)):null!==n&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===l)break;e=e.return}}function Ar(e,t,l,n){var a=e.child;for(null!==a&&(a.return=e);null!==a;){var i=a.dependencies;if(null!==i){var o=a.child;i=i.firstContext;e:for(;null!==i;){var s=i;i=a;for(var c=0;c<t.length;c++)if(s.context===t[c]){i.lanes|=l,null!==(s=i.alternate)&&(s.lanes|=l),Tr(i.return,l,e),n||(o=null);break e}i=s.next}}else if(18===a.tag){if(null===(o=a.return))throw Error(r(341));o.lanes|=l,null!==(i=o.alternate)&&(i.lanes|=l),Tr(o,l,e),o=null}else o=a.child;if(null!==o)o.return=a;else for(o=a;null!==o;){if(o===e){o=null;break}if(null!==(a=o.sibling)){a.return=o.return,o=a;break}o=o.return}a=o}}function zr(e,t,l,n){e=null;for(var a=t,i=!1;null!==a;){if(!i)if(524288&a.flags)i=!0;else if(262144&a.flags)break;if(10===a.tag){var o=a.alternate;if(null===o)throw Error(r(387));if(null!==(o=o.memoizedProps)){var s=a.type;Zl(a.pendingProps.value,o.value)||(null!==e?e.push(s):e=[s])}}else if(a===Q.current){if(null===(o=a.alternate))throw Error(r(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(null!==e?e.push(bb):e=[bb])}a=a.return}null!==e&&Ar(t,e,l,n),t.flags|=262144}function Lr(e){for(e=e.firstContext;null!==e;){if(!Zl(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ir(e){Nr=e,Er=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Mr(e){return Dr(Nr,e)}function Pr(e,t){return null===Nr&&Ir(e),Dr(e,t)}function Dr(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},null===Er){if(null===e)throw Error(r(308));Er=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Er=Er.next=t;return l}var Rr="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Or=t.unstable_scheduleCallback,jr=t.unstable_NormalPriority,Fr={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ur(){return{controller:new Rr,data:/* @__PURE__ */new Map,refCount:0}}function Br(e){e.refCount--,0===e.refCount&&Or(jr,function(){e.controller.abort()})}var qr=null,Wr=0,Vr=0,Hr=null;function Kr(){if(0===--Wr&&null!==qr){null!==Hr&&(Hr.status="fulfilled");var e=qr;qr=null,Vr=0,Hr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Gr=D.S;D.S=function(e,t){Pc=ue(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===qr){var l=qr=[];Wr=0,Vr=Wu(),Hr={status:"pending",value:void 0,then:function(e){l.push(e)}}}Wr++,t.then(Kr,Kr)}(0,t),null!==Gr&&Gr(e,t)};var Qr=U(null);function Xr(){var e=Qr.current;return null!==e?e:fc.pooledCache}function Yr(e,t){q(Qr,null===t?Qr.current:t.pool)}function Jr(){var e=Xr();return null===e?null:{parent:Fr._currentValue,pool:e}}var Zr=Error(r(460)),ea=Error(r(474)),ta=Error(r(542)),la={then:function(){}};function na(e){return"fulfilled"===(e=e.status)||"rejected"===e}function ra(e,t,l){switch(void 0===(l=e[l])?e.push(t):l!==t&&(t.then(Mt,Mt),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw sa(e=t.reason),e;default:if("string"==typeof t.status)t.then(Mt,Mt);else{if(null!==(e=fc)&&100<e.shellSuspendCounter)throw Error(r(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var l=t;l.status="fulfilled",l.value=e}},function(e){if("pending"===t.status){var l=t;l.status="rejected",l.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw sa(e=t.reason),e}throw ia=t,Zr}}function aa(e){try{return(0,e._init)(e._payload)}catch(t){if(null!==t&&"object"==typeof t&&"function"==typeof t.then)throw ia=t,Zr;throw t}}var ia=null;function oa(){if(null===ia)throw Error(r(459));var e=ia;return ia=null,e}function sa(e){if(e===Zr||e===ta)throw Error(r(483))}var ca=null,ua=0;function da(e){var t=ua;return ua+=1,null===ca&&(ca=[]),ra(ca,e,t)}function ba(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function ma(e,t){if(t.$$typeof===m)throw Error(r(525));throw e=Object.prototype.toString.call(t),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ha(e){function t(t,l){if(e){var n=t.deletions;null===n?(t.deletions=[l],t.flags|=16):n.push(l)}}function l(l,n){if(!e)return null;for(;null!==n;)t(l,n),n=n.sibling;return null}function n(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 a(e,t){return(e=Bn(e,t)).index=0,e.sibling=null,e}function i(t,l,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<l?(t.flags|=67108866,l):n:(t.flags|=67108866,l):(t.flags|=1048576,l)}function o(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,l,n){return null===t||6!==t.tag?((t=Hn(l,e.mode,n)).return=e,t):((t=a(t,l)).return=e,t)}function c(e,t,l,n){var r=l.type;return r===f?d(e,t,l.props.children,n,l.key):null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===N&&aa(r)===t.type)?(ba(t=a(t,l.props),l),t.return=e,t):(ba(t=Wn(l.type,l.key,l.props,null,e.mode,n),l),t.return=e,t)}function u(e,t,l,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==l.containerInfo||t.stateNode.implementation!==l.implementation?((t=Gn(l,e.mode,n)).return=e,t):((t=a(t,l.children||[])).return=e,t)}function d(e,t,l,n,r){return null===t||7!==t.tag?((t=Vn(l,e.mode,n,r)).return=e,t):((t=a(t,l)).return=e,t)}function b(e,t,l){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Hn(""+t,e.mode,l)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case h:return ba(l=Wn(t.type,t.key,t.props,null,e.mode,l),t),l.return=e,l;case p:return(t=Gn(t,e.mode,l)).return=e,t;case N:return b(e,t=aa(t),l)}if(P(t)||z(t))return(t=Vn(t,e.mode,l,null)).return=e,t;if("function"==typeof t.then)return b(e,da(t),l);if(t.$$typeof===w)return b(e,Pr(e,t),l);ma(e,t)}return null}function m(e,t,l,n){var r=null!==t?t.key:null;if("string"==typeof l&&""!==l||"number"==typeof l||"bigint"==typeof l)return null!==r?null:s(e,t,""+l,n);if("object"==typeof l&&null!==l){switch(l.$$typeof){case h:return l.key===r?c(e,t,l,n):null;case p:return l.key===r?u(e,t,l,n):null;case N:return m(e,t,l=aa(l),n)}if(P(l)||z(l))return null!==r?null:d(e,t,l,n,null);if("function"==typeof l.then)return m(e,t,da(l),n);if(l.$$typeof===w)return m(e,t,Pr(e,l),n);ma(e,l)}return null}function g(e,t,l,n,r){if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return s(t,e=e.get(l)||null,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case h:return c(t,e=e.get(null===n.key?l:n.key)||null,n,r);case p:return u(t,e=e.get(null===n.key?l:n.key)||null,n,r);case N:return g(e,t,l,n=aa(n),r)}if(P(n)||z(n))return d(t,e=e.get(l)||null,n,r,null);if("function"==typeof n.then)return g(e,t,l,da(n),r);if(n.$$typeof===w)return g(e,t,l,Pr(t,n),r);ma(t,n)}return null}function v(s,c,u,d){if("object"==typeof u&&null!==u&&u.type===f&&null===u.key&&(u=u.props.children),"object"==typeof u&&null!==u){switch(u.$$typeof){case h:e:{for(var y=u.key;null!==c;){if(c.key===y){if((y=u.type)===f){if(7===c.tag){l(s,c.sibling),(d=a(c,u.props.children)).return=s,s=d;break e}}else if(c.elementType===y||"object"==typeof y&&null!==y&&y.$$typeof===N&&aa(y)===c.type){l(s,c.sibling),ba(d=a(c,u.props),u),d.return=s,s=d;break e}l(s,c);break}t(s,c),c=c.sibling}u.type===f?((d=Vn(u.props.children,s.mode,d,u.key)).return=s,s=d):(ba(d=Wn(u.type,u.key,u.props,null,s.mode,d),u),d.return=s,s=d)}return o(s);case p:e:{for(y=u.key;null!==c;){if(c.key===y){if(4===c.tag&&c.stateNode.containerInfo===u.containerInfo&&c.stateNode.implementation===u.implementation){l(s,c.sibling),(d=a(c,u.children||[])).return=s,s=d;break e}l(s,c);break}t(s,c),c=c.sibling}(d=Gn(u,s.mode,d)).return=s,s=d}return o(s);case N:return v(s,c,u=aa(u),d)}if(P(u))return function(r,a,o,s){for(var c=null,u=null,d=a,h=a=0,p=null;null!==d&&h<o.length;h++){d.index>h?(p=d,d=null):p=d.sibling;var f=m(r,d,o[h],s);if(null===f){null===d&&(d=p);break}e&&d&&null===f.alternate&&t(r,d),a=i(f,a,h),null===u?c=f:u.sibling=f,u=f,d=p}if(h===o.length)return l(r,d),mr&&ir(r,h),c;if(null===d){for(;h<o.length;h++)null!==(d=b(r,o[h],s))&&(a=i(d,a,h),null===u?c=d:u.sibling=d,u=d);return mr&&ir(r,h),c}for(d=n(d);h<o.length;h++)null!==(p=g(d,r,h,o[h],s))&&(e&&null!==p.alternate&&d.delete(null===p.key?h:p.key),a=i(p,a,h),null===u?c=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return t(r,e)}),mr&&ir(r,h),c}(s,c,u,d);if(z(u)){if("function"!=typeof(y=z(u)))throw Error(r(150));return function(a,o,s,c){if(null==s)throw Error(r(151));for(var u=null,d=null,h=o,p=o=0,f=null,v=s.next();null!==h&&!v.done;p++,v=s.next()){h.index>p?(f=h,h=null):f=h.sibling;var y=m(a,h,v.value,c);if(null===y){null===h&&(h=f);break}e&&h&&null===y.alternate&&t(a,h),o=i(y,o,p),null===d?u=y:d.sibling=y,d=y,h=f}if(v.done)return l(a,h),mr&&ir(a,p),u;if(null===h){for(;!v.done;p++,v=s.next())null!==(v=b(a,v.value,c))&&(o=i(v,o,p),null===d?u=v:d.sibling=v,d=v);return mr&&ir(a,p),u}for(h=n(h);!v.done;p++,v=s.next())null!==(v=g(h,a,p,v.value,c))&&(e&&null!==v.alternate&&h.delete(null===v.key?p:v.key),o=i(v,o,p),null===d?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),mr&&ir(a,p),u}(s,c,u=y.call(u),d)}if("function"==typeof u.then)return v(s,c,da(u),d);if(u.$$typeof===w)return v(s,c,Pr(s,u),d);ma(s,u)}return"string"==typeof u&&""!==u||"number"==typeof u||"bigint"==typeof u?(u=""+u,null!==c&&6===c.tag?(l(s,c.sibling),(d=a(c,u)).return=s,s=d):(l(s,c),(d=Hn(u,s.mode,d)).return=s,s=d),o(s)):l(s,c)}return function(e,t,l,n){try{ua=0;var r=v(e,t,l,n);return ca=null,r}catch(i){if(i===Zr||i===ta)throw i;var a=Fn(29,i,null,e.mode);return a.lanes=n,a.return=e,a}}}var pa=ha(!0),fa=ha(!1),ga=!1;function va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ya(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 wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,t,l){var n=e.updateQueue;if(null===n)return null;if(n=n.shared,2&pc){var r=n.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Rn(e),Dn(e,null,l),t}return In(e,n,t,l),Rn(e)}function ka(e,t,l){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&l)){var n=t.lanes;l|=n&=e.pendingLanes,t.lanes=l,De(e,l)}}function Ca(e,t){var l=e.updateQueue,n=e.alternate;if(null!==n&&l===(n=n.updateQueue)){var r=null,a=null;if(null!==(l=l.firstBaseUpdate)){do{var i={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};null===a?r=a=i:a=a.next=i,l=l.next}while(null!==l);null===a?r=a=t:a=a.next=t}else r=a=t;return l={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:a,shared:n.shared,callbacks:n.callbacks},void(e.updateQueue=l)}null===(e=l.lastBaseUpdate)?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Sa=!1;function Na(){if(Sa){if(null!==Hr)throw Hr}}function Ea(e,t,l,n){Sa=!1;var r=e.updateQueue;ga=!1;var a=r.firstBaseUpdate,i=r.lastBaseUpdate,o=r.shared.pending;if(null!==o){r.shared.pending=null;var s=o,c=s.next;s.next=null,null===i?a=c:i.next=c,i=s;var u=e.alternate;null!==u&&((o=(u=u.updateQueue).lastBaseUpdate)!==i&&(null===o?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=s))}if(null!==a){var d=r.baseState;for(i=0,u=c=s=null,o=a;;){var m=-536870913&o.lane,h=m!==o.lane;if(h?(vc&m)===m:(n&m)===m){0!==m&&m===Vr&&(Sa=!0),null!==u&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var p=e,f=o;m=t;var g=l;switch(f.tag){case 1:if("function"==typeof(p=f.payload)){d=p.call(g,d,m);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(m="function"==typeof(p=f.payload)?p.call(g,d,m):p))break e;d=b({},d,m);break e;case 2:ga=!0}}null!==(m=o.callback)&&(e.flags|=64,h&&(e.flags|=8192),null===(h=r.callbacks)?r.callbacks=[m]:h.push(m))}else h={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===u?(c=u=h,s=d):u=u.next=h,i|=m;if(null===(o=o.next)){if(null===(o=r.shared.pending))break;o=(h=o).next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}null===u&&(s=d),r.baseState=s,r.firstBaseUpdate=c,r.lastBaseUpdate=u,null===a&&(r.shared.lanes=0),Ec|=i,e.lanes=i,e.memoizedState=d}}function $a(e,t){if("function"!=typeof e)throw Error(r(191,e));e.call(t)}function _a(e,t){var l=e.callbacks;if(null!==l)for(e.callbacks=null,e=0;e<l.length;e++)$a(l[e],t)}var Ta=U(null),Aa=U(0);function za(e,t){q(Aa,e=Sc),q(Ta,t),Sc=e|t.baseLanes}function La(){q(Aa,Sc),q(Ta,Ta.current)}function Ia(){Sc=Aa.current,B(Ta),B(Aa)}var Ma=U(null),Pa=null;function Da(e){var t=e.alternate;q(Ua,1&Ua.current),q(Ma,e),null===Pa&&(null===t||null!==Ta.current||null!==t.memoizedState)&&(Pa=e)}function Ra(e){q(Ua,Ua.current),q(Ma,e),null===Pa&&(Pa=e)}function Oa(e){22===e.tag?(q(Ua,Ua.current),q(Ma,e),null===Pa&&(Pa=e)):ja()}function ja(){q(Ua,Ua.current),q(Ma,Ma.current)}function Fa(e){B(Ma),Pa===e&&(Pa=null),B(Ua)}var Ua=U(0);function Ba(e){for(var t=e;null!==t;){if(13===t.tag){var l=t.memoizedState;if(null!==l&&(null===(l=l.dehydrated)||Id(l)||Md(l)))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 qa=0,Wa=null,Va=null,Ha=null,Ka=!1,Ga=!1,Qa=!1,Xa=0,Ya=0,Ja=null,Za=0;function ei(){throw Error(r(321))}function ti(e,t){if(null===t)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!Zl(e[l],t[l]))return!1;return!0}function li(e,t,l,n,r,a){return qa=a,Wa=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=null===e||null===e.memoizedState?vo:yo,Qa=!1,a=l(n,r),Qa=!1,Ga&&(a=ri(t,l,n,r)),ni(e),a}function ni(e){D.H=go;var t=null!==Va&&null!==Va.next;if(qa=0,Ha=Va=Wa=null,Ka=!1,Ya=0,Ja=null,t)throw Error(r(300));null===e||Po||null!==(e=e.dependencies)&&Lr(e)&&(Po=!0)}function ri(e,t,l,n){Wa=e;var a=0;do{if(Ga&&(Ja=null),Ya=0,Ga=!1,25<=a)throw Error(r(301));if(a+=1,Ha=Va=null,null!=e.updateQueue){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,null!=i.memoCache&&(i.memoCache.index=0)}D.H=wo,i=t(l,n)}while(Ga);return i}function ai(){var e=D.H,t=e.useState()[0];return t="function"==typeof t.then?di(t):t,e=e.useState()[0],(null!==Va?Va.memoizedState:null)!==e&&(Wa.flags|=1024),t}function ii(){var e=0!==Xa;return Xa=0,e}function oi(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function si(e){if(Ka){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Ka=!1}qa=0,Ha=Va=Wa=null,Ga=!1,Ya=Xa=0,Ja=null}function ci(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ha?Wa.memoizedState=Ha=e:Ha=Ha.next=e,Ha}function ui(){if(null===Va){var e=Wa.alternate;e=null!==e?e.memoizedState:null}else e=Va.next;var t=null===Ha?Wa.memoizedState:Ha.next;if(null!==t)Ha=t,Va=e;else{if(null===e){if(null===Wa.alternate)throw Error(r(467));throw Error(r(310))}e={memoizedState:(Va=e).memoizedState,baseState:Va.baseState,baseQueue:Va.baseQueue,queue:Va.queue,next:null},null===Ha?Wa.memoizedState=Ha=e:Ha=Ha.next=e}return Ha}function di(e){var t=Ya;return Ya+=1,null===Ja&&(Ja=[]),e=ra(Ja,e,t),t=Wa,null===(null===Ha?t.memoizedState:Ha.next)&&(t=t.alternate,D.H=null===t||null===t.memoizedState?vo:yo),e}function bi(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return di(e);if(e.$$typeof===w)return Mr(e)}throw Error(r(438,String(e)))}function mi(e){var t=null,l=Wa.updateQueue;if(null!==l&&(t=l.memoCache),null==t){var n=Wa.alternate;null!==n&&(null!==(n=n.updateQueue)&&(null!=(n=n.memoCache)&&(t={data:n.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===l&&(l={lastEffect:null,events:null,stores:null,memoCache:null},Wa.updateQueue=l),l.memoCache=t,void 0===(l=t.data[t.index]))for(l=t.data[t.index]=Array(e),n=0;n<e;n++)l[n]=_;return t.index++,l}function hi(e,t){return"function"==typeof t?t(e):t}function pi(e){return fi(ui(),Va,e)}function fi(e,t,l){var n=e.queue;if(null===n)throw Error(r(311));n.lastRenderedReducer=l;var a=e.baseQueue,i=n.pending;if(null!==i){if(null!==a){var o=a.next;a.next=i.next,i.next=o}t.baseQueue=a=i,n.pending=null}if(i=e.baseState,null===a)e.memoizedState=i;else{var s=o=null,c=null,u=t=a.next,d=!1;do{var b=-536870913&u.lane;if(b!==u.lane?(vc&b)===b:(qa&b)===b){var m=u.revertLane;if(0===m)null!==c&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),b===Vr&&(d=!0);else{if((qa&m)===m){u=u.next,m===Vr&&(d=!0);continue}b={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=b,o=i):c=c.next=b,Wa.lanes|=m,Ec|=m}b=u.action,Qa&&l(i,b),i=u.hasEagerState?u.eagerState:l(i,b)}else m={lane:b,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=m,o=i):c=c.next=m,Wa.lanes|=b,Ec|=b;u=u.next}while(null!==u&&u!==t);if(null===c?o=i:c.next=s,!Zl(i,e.memoizedState)&&(Po=!0,d&&null!==(l=Hr)))throw l;e.memoizedState=i,e.baseState=o,e.baseQueue=c,n.lastRenderedState=i}return null===a&&(n.lanes=0),[e.memoizedState,n.dispatch]}function gi(e){var t=ui(),l=t.queue;if(null===l)throw Error(r(311));l.lastRenderedReducer=e;var n=l.dispatch,a=l.pending,i=t.memoizedState;if(null!==a){l.pending=null;var o=a=a.next;do{i=e(i,o.action),o=o.next}while(o!==a);Zl(i,t.memoizedState)||(Po=!0),t.memoizedState=i,null===t.baseQueue&&(t.baseState=i),l.lastRenderedState=i}return[i,n]}function vi(e,t,l){var n=Wa,a=ui(),i=mr;if(i){if(void 0===l)throw Error(r(407));l=l()}else l=t();var o=!Zl((Va||a).memoizedState,l);if(o&&(a.memoizedState=l,Po=!0),a=a.queue,qi(xi.bind(null,n,a,e),[e]),a.getSnapshot!==t||o||null!==Ha&&1&Ha.memoizedState.tag){if(n.flags|=2048,Oi(9,{destroy:void 0},wi.bind(null,n,a,l,t),null),null===fc)throw Error(r(349));i||127&qa||yi(n,t,l)}return l}function yi(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},null===(t=Wa.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Wa.updateQueue=t,t.stores=[e]):null===(l=t.stores)?t.stores=[e]:l.push(e)}function wi(e,t,l,n){t.value=l,t.getSnapshot=n,ki(t)&&Ci(e)}function xi(e,t,l){return l(function(){ki(t)&&Ci(e)})}function ki(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!Zl(e,l)}catch(n){return!0}}function Ci(e){var t=Pn(e,2);null!==t&&Xc(t,e,2)}function Si(e){var t=ci();if("function"==typeof e){var l=e;if(e=l(),Qa){xe(!0);try{l()}finally{xe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:e},t}function Ni(e,t,l,n){return e.baseState=l,fi(e,Va,"function"==typeof n?n:hi)}function Ei(e,t,l,n,a){if(ho(e))throw Error(r(485));if(null!==(e=t.action)){var i={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){i.listeners.push(e)}};null!==D.T?l(!0):i.isTransition=!1,n(i),null===(l=t.pending)?(i.next=t.pending=i,$i(t,i)):(i.next=l.next,t.pending=l.next=i)}}function $i(e,t){var l=t.action,n=t.payload,r=e.state;if(t.isTransition){var a=D.T,i={};D.T=i;try{var o=l(r,n),s=D.S;null!==s&&s(i,o),_i(e,t,o)}catch(c){Ai(e,t,c)}finally{null!==a&&null!==i.types&&(a.types=i.types),D.T=a}}else try{_i(e,t,a=l(r,n))}catch(u){Ai(e,t,u)}}function _i(e,t,l){null!==l&&"object"==typeof l&&"function"==typeof l.then?l.then(function(l){Ti(e,t,l)},function(l){return Ai(e,t,l)}):Ti(e,t,l)}function Ti(e,t,l){t.status="fulfilled",t.value=l,zi(t),e.state=l,null!==(t=e.pending)&&((l=t.next)===t?e.pending=null:(l=l.next,t.next=l,$i(e,l)))}function Ai(e,t,l){var n=e.pending;if(e.pending=null,null!==n){n=n.next;do{t.status="rejected",t.reason=l,zi(t),t=t.next}while(t!==n)}e.action=null}function zi(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Li(e,t){return t}function Ii(e,t){if(mr){var l=fc.formState;if(null!==l){e:{var n=Wa;if(mr){if(br){t:{for(var r=br,a=pr;8!==r.nodeType;){if(!a){r=null;break t}if(null===(r=Pd(r.nextSibling))){r=null;break t}}r="F!"===(a=r.data)||"F"===a?r:null}if(r){br=Pd(r.nextSibling),n="F!"===r.data;break e}}gr(n)}n=!1}n&&(t=l[0])}}return(l=ci()).memoizedState=l.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:t},l.queue=n,l=uo.bind(null,Wa,n),n.dispatch=l,n=Si(!1),a=mo.bind(null,Wa,!1,n.queue),r={state:t,dispatch:null,action:e,pending:null},(n=ci()).queue=r,l=Ei.bind(null,Wa,r,a,l),r.dispatch=l,n.memoizedState=e,[t,l,!1]}function Mi(e){return Pi(ui(),Va,e)}function Pi(e,t,l){if(t=fi(e,t,Li)[0],e=pi(hi)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var n=di(t)}catch(i){if(i===Zr)throw ta;throw i}else n=t;var r=(t=ui()).queue,a=r.dispatch;return l!==t.memoizedState&&(Wa.flags|=2048,Oi(9,{destroy:void 0},Di.bind(null,r,l),null)),[n,a,e]}function Di(e,t){e.action=t}function Ri(e){var t=ui(),l=Va;if(null!==l)return Pi(t,l,e);ui(),t=t.memoizedState;var n=(l=ui()).queue.dispatch;return l.memoizedState=e,[t,n,!1]}function Oi(e,t,l,n){return e={tag:e,create:l,deps:n,inst:t,next:null},null===(t=Wa.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Wa.updateQueue=t),null===(l=t.lastEffect)?t.lastEffect=e.next=e:(n=l.next,l.next=e,e.next=n,t.lastEffect=e),e}function ji(){return ui().memoizedState}function Fi(e,t,l,n){var r=ci();Wa.flags|=e,r.memoizedState=Oi(1|t,{destroy:void 0},l,void 0===n?null:n)}function Ui(e,t,l,n){var r=ui();n=void 0===n?null:n;var a=r.memoizedState.inst;null!==Va&&null!==n&&ti(n,Va.memoizedState.deps)?r.memoizedState=Oi(t,a,l,n):(Wa.flags|=e,r.memoizedState=Oi(1|t,a,l,n))}function Bi(e,t){Fi(8390656,8,e,t)}function qi(e,t){Ui(2048,8,e,t)}function Wi(e){var t=ui().memoizedState;return function(e){Wa.flags|=4;var t=Wa.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Wa.updateQueue=t,t.events=[e];else{var l=t.events;null===l?t.events=[e]:l.push(e)}}({ref:t,nextImpl:e}),function(){if(2&pc)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Vi(e,t){return Ui(4,2,e,t)}function Hi(e,t){return Ui(4,4,e,t)}function Ki(e,t){if("function"==typeof t){e=e();var l=t(e);return function(){"function"==typeof l?l():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function Gi(e,t,l){l=null!=l?l.concat([e]):null,Ui(4,4,Ki.bind(null,t,e),l)}function Qi(){}function Xi(e,t){var l=ui();t=void 0===t?null:t;var n=l.memoizedState;return null!==t&&ti(t,n[1])?n[0]:(l.memoizedState=[e,t],e)}function Yi(e,t){var l=ui();t=void 0===t?null:t;var n=l.memoizedState;if(null!==t&&ti(t,n[1]))return n[0];if(n=e(),Qa){xe(!0);try{e()}finally{xe(!1)}}return l.memoizedState=[n,t],n}function Ji(e,t,l){return void 0===l||1073741824&qa&&!(261930&vc)?e.memoizedState=t:(e.memoizedState=l,e=Qc(),Wa.lanes|=e,Ec|=e,l)}function Zi(e,t,l,n){return Zl(l,t)?l:null!==Ta.current?(e=Ji(e,l,n),Zl(e,t)||(Po=!0),e):42&qa&&(!(1073741824&qa)||261930&vc)?(e=Qc(),Wa.lanes|=e,Ec|=e,t):(Po=!0,e.memoizedState=l)}function eo(e,t,l,n,r){var a=R.p;R.p=0!==a&&8>a?a:8;var i,o,s,c=D.T,u={};D.T=u,mo(e,!1,t,l);try{var d=r(),b=D.S;if(null!==b&&b(u,d),null!==d&&"object"==typeof d&&"function"==typeof d.then)bo(e,t,(i=n,o=[],s={status:"pending",value:null,reason:null,then:function(e){o.push(e)}},d.then(function(){s.status="fulfilled",s.value=i;for(var e=0;e<o.length;e++)(0,o[e])(i)},function(e){for(s.status="rejected",s.reason=e,e=0;e<o.length;e++)(0,o[e])(void 0)}),s),Gc());else bo(e,t,n,Gc())}catch(m){bo(e,t,{then:function(){},status:"rejected",reason:m},Gc())}finally{R.p=a,null!==c&&null!==u.types&&(c.types=u.types),D.T=c}}function to(){}function lo(e,t,l,n){if(5!==e.tag)throw Error(r(476));var a=no(e).queue;eo(e,a,t,O,null===l?to:function(){return ro(e),l(n)})}function no(e){var t=e.memoizedState;if(null!==t)return t;var l={};return(t={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:O},next:null}).next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:l},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function ro(e){var t=no(e);null===t.next&&(t=e.alternate.memoizedState),bo(e,t.next.queue,{},Gc())}function ao(){return Mr(bb)}function io(){return ui().memoizedState}function oo(){return ui().memoizedState}function so(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var l=Gc(),n=xa(t,e=wa(l),l);return null!==n&&(Xc(n,t,l),ka(n,t,l)),t={cache:Ur()},void(e.payload=t)}t=t.return}}function co(e,t,l){var n=Gc();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ho(e)?po(t,l):null!==(l=Mn(e,t,l,n))&&(Xc(l,e,n),fo(l,t,n))}function uo(e,t,l){bo(e,t,l,Gc())}function bo(e,t,l,n){var r={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ho(e))po(t,r);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var i=t.lastRenderedState,o=a(i,l);if(r.hasEagerState=!0,r.eagerState=o,Zl(o,i))return In(e,t,r,0),null===fc&&Ln(),!1}catch(s){}if(null!==(l=Mn(e,t,r,n)))return Xc(l,e,n),fo(l,t,n),!0}return!1}function mo(e,t,l,n){if(n={lane:2,revertLane:Wu(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ho(e)){if(t)throw Error(r(479))}else null!==(t=Mn(e,l,n,2))&&Xc(t,e,2)}function ho(e){var t=e.alternate;return e===Wa||null!==t&&t===Wa}function po(e,t){Ga=Ka=!0;var l=e.pending;null===l?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function fo(e,t,l){if(4194048&l){var n=t.lanes;l|=n&=e.pendingLanes,t.lanes=l,De(e,l)}}var go={readContext:Mr,use:bi,useCallback:ei,useContext:ei,useEffect:ei,useImperativeHandle:ei,useLayoutEffect:ei,useInsertionEffect:ei,useMemo:ei,useReducer:ei,useRef:ei,useState:ei,useDebugValue:ei,useDeferredValue:ei,useTransition:ei,useSyncExternalStore:ei,useId:ei,useHostTransitionStatus:ei,useFormState:ei,useActionState:ei,useOptimistic:ei,useMemoCache:ei,useCacheRefresh:ei};go.useEffectEvent=ei;var vo={readContext:Mr,use:bi,useCallback:function(e,t){return ci().memoizedState=[e,void 0===t?null:t],e},useContext:Mr,useEffect:Bi,useImperativeHandle:function(e,t,l){l=null!=l?l.concat([e]):null,Fi(4194308,4,Ki.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Fi(4194308,4,e,t)},useInsertionEffect:function(e,t){Fi(4,2,e,t)},useMemo:function(e,t){var l=ci();t=void 0===t?null:t;var n=e();if(Qa){xe(!0);try{e()}finally{xe(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=ci();if(void 0!==l){var r=l(t);if(Qa){xe(!0);try{l(t)}finally{xe(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=co.bind(null,Wa,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},ci().memoizedState=e},useState:function(e){var t=(e=Si(e)).queue,l=uo.bind(null,Wa,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Qi,useDeferredValue:function(e,t){return Ji(ci(),e,t)},useTransition:function(){var e=Si(!1);return e=eo.bind(null,Wa,e.queue,!0,!1),ci().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=Wa,a=ci();if(mr){if(void 0===l)throw Error(r(407));l=l()}else{if(l=t(),null===fc)throw Error(r(349));127&vc||yi(n,t,l)}a.memoizedState=l;var i={value:l,getSnapshot:t};return a.queue=i,Bi(xi.bind(null,n,i,e),[e]),n.flags|=2048,Oi(9,{destroy:void 0},wi.bind(null,n,i,l,t),null),l},useId:function(){var e=ci(),t=fc.identifierPrefix;if(mr){var l=ar;t="_"+t+"R_"+(l=(rr&~(1<<32-ke(rr)-1)).toString(32)+l),0<(l=Xa++)&&(t+="H"+l.toString(32)),t+="_"}else t="_"+t+"r_"+(l=Za++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ao,useFormState:Ii,useActionState:Ii,useOptimistic:function(e){var t=ci();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=mo.bind(null,Wa,!0,l),l.dispatch=t,[e,t]},useMemoCache:mi,useCacheRefresh:function(){return ci().memoizedState=so.bind(null,Wa)},useEffectEvent:function(e){var t=ci(),l={impl:e};return t.memoizedState=l,function(){if(2&pc)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},yo={readContext:Mr,use:bi,useCallback:Xi,useContext:Mr,useEffect:qi,useImperativeHandle:Gi,useInsertionEffect:Vi,useLayoutEffect:Hi,useMemo:Yi,useReducer:pi,useRef:ji,useState:function(){return pi(hi)},useDebugValue:Qi,useDeferredValue:function(e,t){return Zi(ui(),Va.memoizedState,e,t)},useTransition:function(){var e=pi(hi)[0],t=ui().memoizedState;return["boolean"==typeof e?e:di(e),t]},useSyncExternalStore:vi,useId:io,useHostTransitionStatus:ao,useFormState:Mi,useActionState:Mi,useOptimistic:function(e,t){return Ni(ui(),0,e,t)},useMemoCache:mi,useCacheRefresh:oo};yo.useEffectEvent=Wi;var wo={readContext:Mr,use:bi,useCallback:Xi,useContext:Mr,useEffect:qi,useImperativeHandle:Gi,useInsertionEffect:Vi,useLayoutEffect:Hi,useMemo:Yi,useReducer:gi,useRef:ji,useState:function(){return gi(hi)},useDebugValue:Qi,useDeferredValue:function(e,t){var l=ui();return null===Va?Ji(l,e,t):Zi(l,Va.memoizedState,e,t)},useTransition:function(){var e=gi(hi)[0],t=ui().memoizedState;return["boolean"==typeof e?e:di(e),t]},useSyncExternalStore:vi,useId:io,useHostTransitionStatus:ao,useFormState:Ri,useActionState:Ri,useOptimistic:function(e,t){var l=ui();return null!==Va?Ni(l,0,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:mi,useCacheRefresh:oo};function xo(e,t,l,n){l=null==(l=l(n,t=e.memoizedState))?t:b({},t,l),e.memoizedState=l,0===e.lanes&&(e.updateQueue.baseState=l)}wo.useEffectEvent=Wi;var ko={enqueueSetState:function(e,t,l){e=e._reactInternals;var n=Gc(),r=wa(n);r.payload=t,null!=l&&(r.callback=l),null!==(t=xa(e,r,n))&&(Xc(t,e,n),ka(t,e,n))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var n=Gc(),r=wa(n);r.tag=1,r.payload=t,null!=l&&(r.callback=l),null!==(t=xa(e,r,n))&&(Xc(t,e,n),ka(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=Gc(),n=wa(l);n.tag=2,null!=t&&(n.callback=t),null!==(t=xa(e,n,l))&&(Xc(t,e,l),ka(t,e,l))}};function Co(e,t,l,n,r,a,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,a,i):!t.prototype||!t.prototype.isPureReactComponent||(!en(l,n)||!en(r,a))}function So(e,t,l,n){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(l,n),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(l,n),t.state!==e&&ko.enqueueReplaceState(t,t.state,null)}function No(e,t){var l=t;if("ref"in t)for(var n in l={},t)"ref"!==n&&(l[n]=t[n]);if(e=e.defaultProps)for(var r in l===t&&(l=b({},l)),e)void 0===l[r]&&(l[r]=e[r]);return l}function Eo(e){_n(e)}function $o(e){console.error(e)}function _o(e){_n(e)}function To(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Ao(e,t,l){try{(0,e.onCaughtError)(l.value,{componentStack:l.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function zo(e,t,l){return(l=wa(l)).tag=3,l.payload={element:null},l.callback=function(){To(e,t)},l}function Lo(e){return(e=wa(e)).tag=3,e}function Io(e,t,l,n){var r=l.type.getDerivedStateFromError;if("function"==typeof r){var a=n.value;e.payload=function(){return r(a)},e.callback=function(){Ao(t,l,n)}}var i=l.stateNode;null!==i&&"function"==typeof i.componentDidCatch&&(e.callback=function(){Ao(t,l,n),"function"!=typeof r&&(null===Oc?Oc=/* @__PURE__ */new Set([this]):Oc.add(this));var e=n.stack;this.componentDidCatch(n.value,{componentStack:null!==e?e:""})})}var Mo=Error(r(461)),Po=!1;function Do(e,t,l,n){t.child=null===e?fa(t,null,l,n):pa(t,e.child,l,n)}function Ro(e,t,l,n,r){l=l.render;var a=t.ref;if("ref"in n){var i={};for(var o in n)"ref"!==o&&(i[o]=n[o])}else i=n;return Ir(t),n=li(e,t,l,i,a,r),o=ii(),null===e||Po?(mr&&o&&sr(t),t.flags|=1,Do(e,t,n,r),t.child):(oi(e,t,r),is(e,t,r))}function Oo(e,t,l,n,r){if(null===e){var a=l.type;return"function"!=typeof a||Un(a)||void 0!==a.defaultProps||null!==l.compare?((e=Wn(l.type,null,n,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,jo(e,t,a,n,r))}if(a=e.child,!os(e,r)){var i=a.memoizedProps;if((l=null!==(l=l.compare)?l:en)(i,n)&&e.ref===t.ref)return is(e,t,r)}return t.flags|=1,(e=Bn(a,n)).ref=t.ref,e.return=t,t.child=e}function jo(e,t,l,n,r){if(null!==e){var a=e.memoizedProps;if(en(a,n)&&e.ref===t.ref){if(Po=!1,t.pendingProps=n=a,!os(e,r))return t.lanes=e.lanes,is(e,t,r);131072&e.flags&&(Po=!0)}}return Ho(e,t,l,n,r)}function Fo(e,t,l,n){var r=n.children,a=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===n.mode){if(128&t.flags){if(a=null!==a?a.baseLanes|l:l,null!==e){for(n=t.child=e.child,r=0;null!==n;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~a}else n=0,t.child=null;return Bo(e,t,a,l,n)}if(!(536870912&l))return n=t.lanes=536870912,Bo(e,t,null!==a?a.baseLanes|l:l,l,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Yr(0,null!==a?a.cachePool:null),null!==a?za(t,a):La(),Oa(t)}else null!==a?(Yr(0,a.cachePool),za(t,a),ja(),t.memoizedState=null):(null!==e&&Yr(0,null),La(),ja());return Do(e,t,r,l),t.child}function Uo(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bo(e,t,l,n,r){var a=Xr();return a=null===a?null:{parent:Fr._currentValue,pool:a},t.memoizedState={baseLanes:l,cachePool:a},null!==e&&Yr(0,null),La(),Oa(t),null!==e&&zr(e,t,n,!0),t.childLanes=r,null}function qo(e,t){return(t=ts({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Wo(e,t,l){return pa(t,e.child,null,l),(e=qo(t,t.pendingProps)).flags|=2,Fa(t),t.memoizedState=null,e}function Vo(e,t){var l=t.ref;if(null===l)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof l&&"object"!=typeof l)throw Error(r(284));null!==e&&e.ref===l||(t.flags|=4194816)}}function Ho(e,t,l,n,r){return Ir(t),l=li(e,t,l,n,void 0,r),n=ii(),null===e||Po?(mr&&n&&sr(t),t.flags|=1,Do(e,t,l,r),t.child):(oi(e,t,r),is(e,t,r))}function Ko(e,t,l,n,r,a){return Ir(t),t.updateQueue=null,l=ri(t,n,l,r),ni(e),n=ii(),null===e||Po?(mr&&n&&sr(t),t.flags|=1,Do(e,t,l,a),t.child):(oi(e,t,a),is(e,t,a))}function Go(e,t,l,n,r){if(Ir(t),null===t.stateNode){var a=On,i=l.contextType;"object"==typeof i&&null!==i&&(a=Mr(i)),a=new l(n,a),t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,a.updater=ko,t.stateNode=a,a._reactInternals=t,(a=t.stateNode).props=n,a.state=t.memoizedState,a.refs={},va(t),i=l.contextType,a.context="object"==typeof i&&null!==i?Mr(i):On,a.state=t.memoizedState,"function"==typeof(i=l.getDerivedStateFromProps)&&(xo(t,l,i,n),a.state=t.memoizedState),"function"==typeof l.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(i=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),i!==a.state&&ko.enqueueReplaceState(a,a.state,null),Ea(t,n,a,r),Na(),a.state=t.memoizedState),"function"==typeof a.componentDidMount&&(t.flags|=4194308),n=!0}else if(null===e){a=t.stateNode;var o=t.memoizedProps,s=No(l,o);a.props=s;var c=a.context,u=l.contextType;i=On,"object"==typeof u&&null!==u&&(i=Mr(u));var d=l.getDerivedStateFromProps;u="function"==typeof d||"function"==typeof a.getSnapshotBeforeUpdate,o=t.pendingProps!==o,u||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o||c!==i)&&So(t,a,n,i),ga=!1;var b=t.memoizedState;a.state=b,Ea(t,n,a,r),Na(),c=t.memoizedState,o||b!==c||ga?("function"==typeof d&&(xo(t,l,d,n),c=t.memoizedState),(s=ga||Co(t,l,s,n,b,c,i))?(u||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),a.props=n,a.state=c,a.context=i,n=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,ya(e,t),u=No(l,i=t.memoizedProps),a.props=u,d=t.pendingProps,b=a.context,c=l.contextType,s=On,"object"==typeof c&&null!==c&&(s=Mr(c)),(c="function"==typeof(o=l.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(i!==d||b!==s)&&So(t,a,n,s),ga=!1,b=t.memoizedState,a.state=b,Ea(t,n,a,r),Na();var m=t.memoizedState;i!==d||b!==m||ga||null!==e&&null!==e.dependencies&&Lr(e.dependencies)?("function"==typeof o&&(xo(t,l,o,n),m=t.memoizedState),(u=ga||Co(t,l,u,n,b,m,s)||null!==e&&null!==e.dependencies&&Lr(e.dependencies))?(c||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(n,m,s),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(n,m,s)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),a.props=n,a.state=m,a.context=s,n=u):("function"!=typeof a.componentDidUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=1024),n=!1)}return a=n,Vo(e,t),n=!!(128&t.flags),a||n?(a=t.stateNode,l=n&&"function"!=typeof l.getDerivedStateFromError?null:a.render(),t.flags|=1,null!==e&&n?(t.child=pa(t,e.child,null,r),t.child=pa(t,null,l,r)):Do(e,t,l,r),t.memoizedState=a.state,e=t.child):e=is(e,t,r),e}function Qo(e,t,l,n){return xr(),t.flags|=256,Do(e,t,l,n),t.child}var Xo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yo(e){return{baseLanes:e,cachePool:Jr()}}function Jo(e,t,l){return e=null!==e?e.childLanes&~l:0,t&&(e|=Tc),e}function Zo(e,t,l){var n,a=t.pendingProps,i=!1,o=!!(128&t.flags);if((n=o)||(n=(null===e||null!==e.memoizedState)&&!!(2&Ua.current)),n&&(i=!0,t.flags&=-129),n=!!(32&t.flags),t.flags&=-33,null===e){if(mr){if(i?Da(t):ja(),(e=br)?null!==(e=null!==(e=Ld(e,pr))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==nr?{id:rr,overflow:ar}:null,retryLane:536870912,hydrationErrors:null},(l=Kn(e)).return=t,t.child=l,dr=t,br=null):e=null,null===e)throw gr(t);return Md(e)?t.lanes=32:t.lanes=536870912,null}var s=a.children;return a=a.fallback,i?(ja(),s=ts({mode:"hidden",children:s},i=t.mode),a=Vn(a,i,l,null),s.return=t,a.return=t,s.sibling=a,t.child=s,(a=t.child).memoizedState=Yo(l),a.childLanes=Jo(e,n,l),t.memoizedState=Xo,Uo(null,a)):(Da(t),es(t,s))}var c=e.memoizedState;if(null!==c&&null!==(s=c.dehydrated)){if(o)256&t.flags?(Da(t),t.flags&=-257,t=ls(e,t,l)):null!==t.memoizedState?(ja(),t.child=e.child,t.flags|=128,t=null):(ja(),s=a.fallback,i=t.mode,a=ts({mode:"visible",children:a.children},i),(s=Vn(s,i,l,null)).flags|=2,a.return=t,s.return=t,a.sibling=s,t.child=a,pa(t,e.child,null,l),(a=t.child).memoizedState=Yo(l),a.childLanes=Jo(e,n,l),t.memoizedState=Xo,t=Uo(null,a));else if(Da(t),Md(s)){if(n=s.nextSibling&&s.nextSibling.dataset)var u=n.dgst;n=u,(a=Error(r(419))).stack="",a.digest=n,Cr({value:a,source:null,stack:null}),t=ls(e,t,l)}else if(Po||zr(e,t,l,!1),n=0!==(l&e.childLanes),Po||n){if(null!==(n=fc)&&(0!==(a=Re(n,l))&&a!==c.retryLane))throw c.retryLane=a,Pn(e,a),Xc(n,e,a),Mo;Id(s)||su(),t=ls(e,t,l)}else Id(s)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,br=Pd(s.nextSibling),dr=t,mr=!0,hr=null,pr=!1,null!==e&&ur(t,e),(t=es(t,a.children)).flags|=4096);return t}return i?(ja(),s=a.fallback,i=t.mode,u=(c=e.child).sibling,(a=Bn(c,{mode:"hidden",children:a.children})).subtreeFlags=65011712&c.subtreeFlags,null!==u?s=Bn(u,s):(s=Vn(s,i,l,null)).flags|=2,s.return=t,a.return=t,a.sibling=s,t.child=a,Uo(null,a),a=t.child,null===(s=e.child.memoizedState)?s=Yo(l):(null!==(i=s.cachePool)?(c=Fr._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=Jr(),s={baseLanes:s.baseLanes|l,cachePool:i}),a.memoizedState=s,a.childLanes=Jo(e,n,l),t.memoizedState=Xo,Uo(e.child,a)):(Da(t),e=(l=e.child).sibling,(l=Bn(l,{mode:"visible",children:a.children})).return=t,l.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=l,t.memoizedState=null,l)}function es(e,t){return(t=ts({mode:"visible",children:t},e.mode)).return=e,e.child=t}function ts(e,t){return(e=Fn(22,e,null,t)).lanes=0,e}function ls(e,t,l){return pa(t,e.child,null,l),(e=es(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function ns(e,t,l){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),Tr(e.return,t,l)}function rs(e,t,l,n,r,a){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:r,treeForkCount:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=l,i.tailMode=r,i.treeForkCount=a)}function as(e,t,l){var n=t.pendingProps,r=n.revealOrder,a=n.tail;n=n.children;var i=Ua.current,o=!!(2&i);if(o?(i=1&i|2,t.flags|=128):i&=1,q(Ua,i),Do(e,t,n,l),n=mr?er:0,!o&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ns(e,l,t);else if(19===e.tag)ns(e,l,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(r){case"forwards":for(l=t.child,r=null;null!==l;)null!==(e=l.alternate)&&null===Ba(e)&&(r=l),l=l.sibling;null===(l=r)?(r=t.child,t.child=null):(r=l.sibling,l.sibling=null),rs(t,!1,r,l,a,n);break;case"backwards":case"unstable_legacy-backwards":for(l=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===Ba(e)){t.child=r;break}e=r.sibling,r.sibling=l,l=r,r=e}rs(t,!0,l,null,a,n);break;case"together":rs(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function is(e,t,l){if(null!==e&&(t.dependencies=e.dependencies),Ec|=t.lanes,0===(l&t.childLanes)){if(null===e)return null;if(zr(e,t,l,!1),0===(l&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(r(153));if(null!==t.child){for(l=Bn(e=t.child,e.pendingProps),t.child=l,l.return=t;null!==e.sibling;)e=e.sibling,(l=l.sibling=Bn(e,e.pendingProps)).return=t;l.sibling=null}return t.child}function os(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Lr(e))}function ss(e,t,l){if(null!==e)if(e.memoizedProps!==t.pendingProps)Po=!0;else{if(!(os(e,l)||128&t.flags))return Po=!1,function(e,t,l){switch(t.tag){case 3:X(t,t.stateNode.containerInfo),$r(0,Fr,e.memoizedState.cache),xr();break;case 27:case 5:J(t);break;case 4:X(t,t.stateNode.containerInfo);break;case 10:$r(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Ra(t),null;break;case 13:var n=t.memoizedState;if(null!==n)return null!==n.dehydrated?(Da(t),t.flags|=128,null):0!==(l&t.child.childLanes)?Zo(e,t,l):(Da(t),null!==(e=is(e,t,l))?e.sibling:null);Da(t);break;case 19:var r=!!(128&e.flags);if((n=0!==(l&t.childLanes))||(zr(e,t,l,!1),n=0!==(l&t.childLanes)),r){if(n)return as(e,t,l);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),q(Ua,Ua.current),n)break;return null;case 22:return t.lanes=0,Fo(e,t,l,t.pendingProps);case 24:$r(0,Fr,e.memoizedState.cache)}return is(e,t,l)}(e,t,l);Po=!!(131072&e.flags)}else Po=!1,mr&&1048576&t.flags&&or(t,er,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=aa(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var a=e.$$typeof;if(a===x){t.tag=11,t=Ro(null,t,e,n,l);break e}if(a===S){t.tag=14,t=Oo(null,t,e,n,l);break e}}throw t=M(e)||e,Error(r(306,t,""))}Un(e)?(n=No(e,n),t.tag=1,t=Go(null,t,e,n,l)):(t.tag=0,t=Ho(null,t,e,n,l))}return t;case 0:return Ho(e,t,t.type,t.pendingProps,l);case 1:return Go(e,t,n=t.type,a=No(n,t.pendingProps),l);case 3:e:{if(X(t,t.stateNode.containerInfo),null===e)throw Error(r(387));n=t.pendingProps;var i=t.memoizedState;a=i.element,ya(e,t),Ea(t,n,null,l);var o=t.memoizedState;if(n=o.cache,$r(0,Fr,n),n!==i.cache&&Ar(t,[Fr],l,!0),Na(),n=o.element,i.isDehydrated){if(i={element:n,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=Qo(e,t,n,l);break e}if(n!==a){Cr(a=Xn(Error(r(424)),t)),t=Qo(e,t,n,l);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(br=Pd(e.firstChild),dr=t,mr=!0,hr=null,pr=!0,l=fa(t,null,n,l),t.child=l;l;)l.flags=-3&l.flags|4096,l=l.sibling}else{if(xr(),n===a){t=is(e,t,l);break e}Do(e,t,n,l)}t=t.child}return t;case 26:return Vo(e,t),null===e?(l=Kd(t.type,null,t.pendingProps,null))?t.memoizedState=l:mr||(l=t.type,e=t.pendingProps,(n=vd(G.current).createElement(l))[qe]=t,n[We]=e,hd(n,l,e),lt(n),t.stateNode=n):t.memoizedState=Kd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return J(t),null===e&&mr&&(n=t.stateNode=jd(t.type,t.pendingProps,G.current),dr=t,pr=!0,a=br,_d(t.type)?(Dd=a,br=Pd(n.firstChild)):br=a),Do(e,t,t.pendingProps.children,l),Vo(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&mr&&((a=n=br)&&(null!==(n=function(e,t,l,n){for(;1===e.nodeType;){var r=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(n){if(!e[Xe])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(a=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(a!==r.rel||e.getAttribute("href")!==(null==r.href||""===r.href?null:r.href)||e.getAttribute("crossorigin")!==(null==r.crossOrigin?null:r.crossOrigin)||e.getAttribute("title")!==(null==r.title?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((a=e.getAttribute("src"))!==(null==r.src?null:r.src)||e.getAttribute("type")!==(null==r.type?null:r.type)||e.getAttribute("crossorigin")!==(null==r.crossOrigin?null:r.crossOrigin))&&a&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var a=null==r.name?null:""+r.name;if("hidden"===r.type&&e.getAttribute("name")===a)return e}if(null===(e=Pd(e.nextSibling)))break}return null}(n,t.type,t.pendingProps,pr))?(t.stateNode=n,dr=t,br=Pd(n.firstChild),pr=!1,a=!0):a=!1),a||gr(t)),J(t),a=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,n=i.children,xd(a,i)?n=null:null!==o&&xd(a,o)&&(t.flags|=32),null!==t.memoizedState&&(a=li(e,t,ai,null,null,l),bb._currentValue=a),Vo(e,t),Do(e,t,n,l),t.child;case 6:return null===e&&mr&&((e=l=br)&&(null!==(l=function(e,t,l){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!l)return null;if(null===(e=Pd(e.nextSibling)))return null}return e}(l,t.pendingProps,pr))?(t.stateNode=l,dr=t,br=null,e=!0):e=!1),e||gr(t)),null;case 13:return Zo(e,t,l);case 4:return X(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=pa(t,null,n,l):Do(e,t,n,l),t.child;case 11:return Ro(e,t,t.type,t.pendingProps,l);case 7:return Do(e,t,t.pendingProps,l),t.child;case 8:case 12:return Do(e,t,t.pendingProps.children,l),t.child;case 10:return n=t.pendingProps,$r(0,t.type,n.value),Do(e,t,n.children,l),t.child;case 9:return a=t.type._context,n=t.pendingProps.children,Ir(t),n=n(a=Mr(a)),t.flags|=1,Do(e,t,n,l),t.child;case 14:return Oo(e,t,t.type,t.pendingProps,l);case 15:return jo(e,t,t.type,t.pendingProps,l);case 19:return as(e,t,l);case 31:return function(e,t,l){var n=t.pendingProps,a=!!(128&t.flags);if(t.flags&=-129,null===e){if(mr){if("hidden"===n.mode)return e=qo(t,n),t.lanes=536870912,Uo(null,e);if(Ra(t),(e=br)?null!==(e=null!==(e=Ld(e,pr))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==nr?{id:rr,overflow:ar}:null,retryLane:536870912,hydrationErrors:null},(l=Kn(e)).return=t,t.child=l,dr=t,br=null):e=null,null===e)throw gr(t);return t.lanes=536870912,null}return qo(t,n)}var i=e.memoizedState;if(null!==i){var o=i.dehydrated;if(Ra(t),a)if(256&t.flags)t.flags&=-257,t=Wo(e,t,l);else{if(null===t.memoizedState)throw Error(r(558));t.child=e.child,t.flags|=128,t=null}else if(Po||zr(e,t,l,!1),a=0!==(l&e.childLanes),Po||a){if(null!==(n=fc)&&0!==(o=Re(n,l))&&o!==i.retryLane)throw i.retryLane=o,Pn(e,o),Xc(n,e,o),Mo;su(),t=Wo(e,t,l)}else e=i.treeContext,br=Pd(o.nextSibling),dr=t,mr=!0,hr=null,pr=!1,null!==e&&ur(t,e),(t=qo(t,n)).flags|=4096;return t}return(e=Bn(e.child,{mode:n.mode,children:n.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,l);case 22:return Fo(e,t,l,t.pendingProps);case 24:return Ir(t),n=Mr(Fr),null===e?(null===(a=Xr())&&(a=fc,i=Ur(),a.pooledCache=i,i.refCount++,null!==i&&(a.pooledCacheLanes|=l),a=i),t.memoizedState={parent:n,cache:a},va(t),$r(0,Fr,a)):(0!==(e.lanes&l)&&(ya(e,t),Ea(t,null,null,l),Na()),a=e.memoizedState,i=t.memoizedState,a.parent!==n?(a={parent:n,cache:n},t.memoizedState=a,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=a),$r(0,Fr,n)):(n=i.cache,$r(0,Fr,n),n!==a.cache&&Ar(t,[Fr],l,!0))),Do(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function cs(e){e.flags|=4}function us(e,t,l,n,r){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&r)===r)if(e.stateNode.complete)e.flags|=8192;else{if(!au())throw ia=la,ea;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,!ib(t)){if(!au())throw ia=la,ea;e.flags|=8192}}function bs(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Le():536870912,e.lanes|=t,Ac|=t)}function ms(e,t){if(!mr)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;null!==t;)null!==t.alternate&&(l=t),t=t.sibling;null===l?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var n=null;null!==l;)null!==l.alternate&&(n=l),l=l.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function hs(e){var t=null!==e.alternate&&e.alternate.child===e.child,l=0,n=0;if(t)for(var r=e.child;null!==r;)l|=r.lanes|r.childLanes,n|=65011712&r.subtreeFlags,n|=65011712&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)l|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=l,t}function ps(e,t,l){var n=t.pendingProps;switch(cr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return hs(t),null;case 3:return l=t.stateNode,n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),_r(Fr),Y(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),null!==e&&null!==e.child||(wr(t)?cs(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,kr())),hs(t),null;case 26:var a=t.type,i=t.memoizedState;return null===e?(cs(t),null!==i?(hs(t),ds(t,i)):(hs(t),us(t,a,0,0,l))):i?i!==e.memoizedState?(cs(t),hs(t),ds(t,i)):(hs(t),t.flags&=-16777217):((e=e.memoizedProps)!==n&&cs(t),hs(t),us(t,a,0,0,l)),null;case 27:if(Z(t),l=G.current,a=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==n&&cs(t);else{if(!n){if(null===t.stateNode)throw Error(r(166));return hs(t),null}e=H.current,wr(t)?vr(t):(e=jd(a,n,l),t.stateNode=e,cs(t))}return hs(t),null;case 5:if(Z(t),a=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==n&&cs(t);else{if(!n){if(null===t.stateNode)throw Error(r(166));return hs(t),null}if(i=H.current,wr(t))vr(t);else{var o=vd(G.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":(i=o.createElement("div")).innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i="string"==typeof n.is?o.createElement("select",{is:n.is}):o.createElement("select"),n.multiple?i.multiple=!0:n.size&&(i.size=n.size);break;default:i="string"==typeof n.is?o.createElement(a,{is:n.is}):o.createElement(a)}}i[qe]=t,i[We]=n;e:for(o=t.child;null!==o;){if(5===o.tag||6===o.tag)i.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;null===o.sibling;){if(null===o.return||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(hd(i,a,n),a){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&cs(t)}}return hs(t),us(t,t.type,null===e||e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==n&&cs(t);else{if("string"!=typeof n&&null===t.stateNode)throw Error(r(166));if(e=G.current,wr(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,null!==(a=dr))switch(a.tag){case 27:case 5:n=a.memoizedProps}e[qe]=t,(e=!!(e.nodeValue===l||null!==n&&!0===n.suppressHydrationWarning||dd(e.nodeValue,l)))||gr(t,!0)}else(e=vd(e).createTextNode(n))[qe]=t,t.stateNode=e}return hs(t),null;case 31:if(l=t.memoizedState,null===e||null!==e.memoizedState){if(n=wr(t),null!==l){if(null===e){if(!n)throw Error(r(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(r(557));e[qe]=t}else xr(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;hs(t),e=!1}else l=kr(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return 256&t.flags?(Fa(t),t):(Fa(t),null);if(128&t.flags)throw Error(r(558))}return hs(t),null;case 13:if(n=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(a=wr(t),null!==n&&null!==n.dehydrated){if(null===e){if(!a)throw Error(r(318));if(!(a=null!==(a=t.memoizedState)?a.dehydrated:null))throw Error(r(317));a[qe]=t}else xr(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;hs(t),a=!1}else a=kr(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return 256&t.flags?(Fa(t),t):(Fa(t),null)}return Fa(t),128&t.flags?(t.lanes=l,t):(l=null!==n,e=null!==e&&null!==e.memoizedState,l&&(a=null,null!==(n=t.child).alternate&&null!==n.alternate.memoizedState&&null!==n.alternate.memoizedState.cachePool&&(a=n.alternate.memoizedState.cachePool.pool),i=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(i=n.memoizedState.cachePool.pool),i!==a&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),bs(t,t.updateQueue),hs(t),null);case 4:return Y(),null===e&&td(t.stateNode.containerInfo),hs(t),null;case 10:return _r(t.type),hs(t),null;case 19:if(B(Ua),null===(n=t.memoizedState))return hs(t),null;if(a=!!(128&t.flags),null===(i=n.rendering))if(a)ms(n,!1);else{if(0!==Nc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(i=Ba(e))){for(t.flags|=128,ms(n,!1),e=i.updateQueue,t.updateQueue=e,bs(t,e),t.subtreeFlags=0,e=l,l=t.child;null!==l;)qn(l,e),l=l.sibling;return q(Ua,1&Ua.current|2),mr&&ir(t,n.treeForkCount),t.child}e=e.sibling}null!==n.tail&&ue()>Dc&&(t.flags|=128,a=!0,ms(n,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=Ba(i))){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,bs(t,e),ms(n,!0),null===n.tail&&"hidden"===n.tailMode&&!i.alternate&&!mr)return hs(t),null}else 2*ue()-n.renderingStartTime>Dc&&536870912!==l&&(t.flags|=128,a=!0,ms(n,!1),t.lanes=4194304);n.isBackwards?(i.sibling=t.child,t.child=i):(null!==(e=n.last)?e.sibling=i:t.child=i,n.last=i)}return null!==n.tail?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=ue(),e.sibling=null,l=Ua.current,q(Ua,a?1&l|2:1&l),mr&&ir(t,n.treeForkCount),e):(hs(t),null);case 22:case 23:return Fa(t),Ia(),n=null!==t.memoizedState,null!==e?null!==e.memoizedState!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?!!(536870912&l)&&!(128&t.flags)&&(hs(t),6&t.subtreeFlags&&(t.flags|=8192)):hs(t),null!==(l=t.updateQueue)&&bs(t,l.retryQueue),l=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(l=e.memoizedState.cachePool.pool),n=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),null!==e&&B(Qr),null;case 24:return l=null,null!==e&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),_r(Fr),hs(t),null;case 25:case 30:return null}throw Error(r(156,t.tag))}function fs(e,t){switch(cr(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return _r(Fr),Y(),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(Fa(t),null===t.alternate)throw Error(r(340));xr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Fa(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(r(340));xr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return B(Ua),null;case 4:return Y(),null;case 10:return _r(t.type),null;case 22:case 23:return Fa(t),Ia(),null!==e&&B(Qr),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return _r(Fr),null;default:return null}}function gs(e,t){switch(cr(t),t.tag){case 3:_r(Fr),Y();break;case 26:case 27:case 5:Z(t);break;case 4:Y();break;case 31:null!==t.memoizedState&&Fa(t);break;case 13:Fa(t);break;case 19:B(Ua);break;case 10:_r(t.type);break;case 22:case 23:Fa(t),Ia(),null!==e&&B(Qr);break;case 24:_r(Fr)}}function vs(e,t){try{var l=t.updateQueue,n=null!==l?l.lastEffect:null;if(null!==n){var r=n.next;l=r;do{if((l.tag&e)===e){n=void 0;var a=l.create,i=l.inst;n=a(),i.destroy=n}l=l.next}while(l!==r)}}catch(o){Nu(t,t.return,o)}}function ys(e,t,l){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){var i=n.inst,o=i.destroy;if(void 0!==o){i.destroy=void 0,r=t;var s=l,c=o;try{c()}catch(u){Nu(r,s,u)}}}n=n.next}while(n!==a)}}catch(u){Nu(t,t.return,u)}}function ws(e){var t=e.updateQueue;if(null!==t){var l=e.stateNode;try{_a(t,l)}catch(n){Nu(e,e.return,n)}}}function xs(e,t,l){l.props=No(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){Nu(e,t,n)}}function ks(e,t){try{var l=e.ref;if(null!==l){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;default:n=e.stateNode}"function"==typeof l?e.refCleanup=l(n):l.current=n}}catch(r){Nu(e,t,r)}}function Cs(e,t){var l=e.ref,n=e.refCleanup;if(null!==l)if("function"==typeof n)try{n()}catch(r){Nu(e,t,r)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof l)try{l(null)}catch(a){Nu(e,t,a)}else l.current=null}function Ss(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(r){Nu(e,e.return,r)}}function Ns(e,t,l){try{var n=e.stateNode;!function(e,t,l,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,i=null,o=null,s=null,c=null,u=null,d=null;for(h in l){var b=l[h];if(l.hasOwnProperty(h)&&null!=b)switch(h){case"checked":case"value":break;case"defaultValue":c=b;default:n.hasOwnProperty(h)||bd(e,t,h,null,n,b)}}for(var m in n){var h=n[m];if(b=l[m],n.hasOwnProperty(m)&&(null!=h||null!=b))switch(m){case"type":i=h;break;case"name":a=h;break;case"checked":u=h;break;case"defaultChecked":d=h;break;case"value":o=h;break;case"defaultValue":s=h;break;case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(r(137,t));break;default:h!==b&&bd(e,t,m,h,n,b)}}return void wt(e,o,s,c,u,d,i,a);case"select":for(i in h=o=s=m=null,l)if(c=l[i],l.hasOwnProperty(i)&&null!=c)switch(i){case"value":break;case"multiple":h=c;default:n.hasOwnProperty(i)||bd(e,t,i,null,n,c)}for(a in n)if(i=n[a],c=l[a],n.hasOwnProperty(a)&&(null!=i||null!=c))switch(a){case"value":m=i;break;case"defaultValue":s=i;break;case"multiple":o=i;default:i!==c&&bd(e,t,a,i,n,c)}return t=s,l=o,n=h,void(null!=m?Ct(e,!!l,m,!1):!!n!=!!l&&(null!=t?Ct(e,!!l,t,!0):Ct(e,!!l,l?[]:"",!1)));case"textarea":for(s in h=m=null,l)if(a=l[s],l.hasOwnProperty(s)&&null!=a&&!n.hasOwnProperty(s))switch(s){case"value":case"children":break;default:bd(e,t,s,null,n,a)}for(o in n)if(a=n[o],i=l[o],n.hasOwnProperty(o)&&(null!=a||null!=i))switch(o){case"value":m=a;break;case"defaultValue":h=a;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=a)throw Error(r(91));break;default:a!==i&&bd(e,t,o,a,n,i)}return void St(e,m,h);case"option":for(var p in l)if(m=l[p],l.hasOwnProperty(p)&&null!=m&&!n.hasOwnProperty(p))if("selected"===p)e.selected=!1;else bd(e,t,p,null,n,m);for(c in n)if(m=n[c],h=l[c],n.hasOwnProperty(c)&&m!==h&&(null!=m||null!=h))if("selected"===c)e.selected=m&&"function"!=typeof m&&"symbol"!=typeof m;else bd(e,t,c,m,n,h);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 f in l)m=l[f],l.hasOwnProperty(f)&&null!=m&&!n.hasOwnProperty(f)&&bd(e,t,f,null,n,m);for(u in n)if(m=n[u],h=l[u],n.hasOwnProperty(u)&&m!==h&&(null!=m||null!=h))switch(u){case"children":case"dangerouslySetInnerHTML":if(null!=m)throw Error(r(137,t));break;default:bd(e,t,u,m,n,h)}return;default:if(At(t)){for(var g in l)m=l[g],l.hasOwnProperty(g)&&void 0!==m&&!n.hasOwnProperty(g)&&md(e,t,g,void 0,n,m);for(d in n)m=n[d],h=l[d],!n.hasOwnProperty(d)||m===h||void 0===m&&void 0===h||md(e,t,d,m,n,h);return}}for(var v in l)m=l[v],l.hasOwnProperty(v)&&null!=m&&!n.hasOwnProperty(v)&&bd(e,t,v,null,n,m);for(b in n)m=n[b],h=l[b],!n.hasOwnProperty(b)||m===h||null==m&&null==h||bd(e,t,b,m,n,h)}(n,e.type,l,t),n[We]=t}catch(a){Nu(e,e.return,a)}}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,l){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?(9===l.nodeType?l.body:"HTML"===l.nodeName?l.ownerDocument.body:l).insertBefore(e,t):((t=9===l.nodeType?l.body:"HTML"===l.nodeName?l.ownerDocument.body:l).appendChild(e),null!=(l=l._reactRootContainer)||null!==t.onclick||(t.onclick=Mt));else if(4!==n&&(27===n&&_d(e.type)&&(l=e.stateNode,t=null),null!==(e=e.child)))for(_s(e,t,l),e=e.sibling;null!==e;)_s(e,t,l),e=e.sibling}function Ts(e,t,l){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(4!==n&&(27===n&&_d(e.type)&&(l=e.stateNode),null!==(e=e.child)))for(Ts(e,t,l),e=e.sibling;null!==e;)Ts(e,t,l),e=e.sibling}function As(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);hd(t,n,l),t[qe]=e,t[We]=l}catch(a){Nu(e,e.return,a)}}var zs=!1,Ls=!1,Is=!1,Ms="function"==typeof WeakSet?WeakSet:Set,Ps=null;function Ds(e,t,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:Xs(e,l),4&n&&vs(5,l);break;case 1:if(Xs(e,l),4&n)if(e=l.stateNode,null===t)try{e.componentDidMount()}catch(i){Nu(l,l.return,i)}else{var r=No(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Nu(l,l.return,o)}}64&n&&ws(l),512&n&&ks(l,l.return);break;case 3:if(Xs(e,l),64&n&&null!==(e=l.updateQueue)){if(t=null,null!==l.child)switch(l.child.tag){case 27:case 5:case 1:t=l.child.stateNode}try{_a(e,t)}catch(i){Nu(l,l.return,i)}}break;case 27:null===t&&4&n&&As(l);case 26:case 5:Xs(e,l),null===t&&4&n&&Ss(l),512&n&&ks(l,l.return);break;case 12:Xs(e,l);break;case 31:Xs(e,l),4&n&&Bs(e,l);break;case 13:Xs(e,l),4&n&&qs(e,l),64&n&&(null!==(e=l.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var l=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==l.readyState)t();else{var n=function(){t(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}(e,l=Tu.bind(null,l))));break;case 22:if(!(n=null!==l.memoizedState||zs)){t=null!==t&&null!==t.memoizedState||Ls,r=zs;var a=Ls;zs=n,(Ls=t)&&!a?Js(e,l,!!(8772&l.subtreeFlags)):Xs(e,l),zs=r,Ls=a}break;case 30:break;default:Xs(e,l)}}function Rs(e){var t=e.alternate;null!==t&&(e.alternate=null,Rs(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&Ye(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 Os=null,js=!1;function Fs(e,t,l){for(l=l.child;null!==l;)Us(e,t,l),l=l.sibling}function Us(e,t,l){if(we&&"function"==typeof we.onCommitFiberUnmount)try{we.onCommitFiberUnmount(ye,l)}catch(a){}switch(l.tag){case 26:Ls||Cs(l,t),Fs(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode).parentNode.removeChild(l);break;case 27:Ls||Cs(l,t);var n=Os,r=js;_d(l.type)&&(Os=l.stateNode,js=!1),Fs(e,t,l),Fd(l.stateNode),Os=n,js=r;break;case 5:Ls||Cs(l,t);case 6:if(n=Os,r=js,Os=null,Fs(e,t,l),js=r,null!==(Os=n))if(js)try{(9===Os.nodeType?Os.body:"HTML"===Os.nodeName?Os.ownerDocument.body:Os).removeChild(l.stateNode)}catch(i){Nu(l,t,i)}else try{Os.removeChild(l.stateNode)}catch(i){Nu(l,t,i)}break;case 18:null!==Os&&(js?(Td(9===(e=Os).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,l.stateNode),Hb(e)):Td(Os,l.stateNode));break;case 4:n=Os,r=js,Os=l.stateNode.containerInfo,js=!0,Fs(e,t,l),Os=n,js=r;break;case 0:case 11:case 14:case 15:ys(2,l,t),Ls||ys(4,l,t),Fs(e,t,l);break;case 1:Ls||(Cs(l,t),"function"==typeof(n=l.stateNode).componentWillUnmount&&xs(l,t,n)),Fs(e,t,l);break;case 21:Fs(e,t,l);break;case 22:Ls=(n=Ls)||null!==l.memoizedState,Fs(e,t,l),Ls=n;break;default:Fs(e,t,l)}}function Bs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Hb(e)}catch(l){Nu(t,t.return,l)}}}function qs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Hb(e)}catch(l){Nu(t,t.return,l)}}function Ws(e,t){var l=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Ms),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Ms),t;default:throw Error(r(435,e.tag))}}(e);t.forEach(function(t){if(!l.has(t)){l.add(t);var n=Au.bind(null,e,t);t.then(n,n)}})}function Vs(e,t){var l=t.deletions;if(null!==l)for(var n=0;n<l.length;n++){var a=l[n],i=e,o=t,s=o;e:for(;null!==s;){switch(s.tag){case 27:if(_d(s.type)){Os=s.stateNode,js=!1;break e}break;case 5:Os=s.stateNode,js=!1;break e;case 3:case 4:Os=s.stateNode.containerInfo,js=!0;break e}s=s.return}if(null===Os)throw Error(r(160));Us(i,o,a),Os=null,js=!1,null!==(i=a.alternate)&&(i.return=null),a.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 l=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vs(t,e),Gs(e),4&n&&(ys(3,e,e.return),vs(3,e),ys(5,e,e.return));break;case 1:Vs(t,e),Gs(e),512&n&&(Ls||null===l||Cs(l,l.return)),64&n&&zs&&(null!==(e=e.updateQueue)&&(null!==(n=e.callbacks)&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===l?n:l.concat(n))));break;case 26:var a=Hs;if(Vs(t,e),Gs(e),512&n&&(Ls||null===l||Cs(l,l.return)),4&n){var i=null!==l?l.memoizedState:null;if(n=e.memoizedState,null===l)if(null===n)if(null===e.stateNode){e:{n=e.type,l=e.memoizedProps,a=a.ownerDocument||a;t:switch(n){case"title":(!(i=a.getElementsByTagName("title")[0])||i[Xe]||i[qe]||"http://www.w3.org/2000/svg"===i.namespaceURI||i.hasAttribute("itemprop"))&&(i=a.createElement(n),a.head.insertBefore(i,a.querySelector("head > title"))),hd(i,n,l),i[qe]=e,lt(i),n=i;break e;case"link":var o=rb("link","href",a).get(n+(l.href||""));if(o)for(var s=0;s<o.length;s++)if((i=o[s]).getAttribute("href")===(null==l.href||""===l.href?null:l.href)&&i.getAttribute("rel")===(null==l.rel?null:l.rel)&&i.getAttribute("title")===(null==l.title?null:l.title)&&i.getAttribute("crossorigin")===(null==l.crossOrigin?null:l.crossOrigin)){o.splice(s,1);break t}hd(i=a.createElement(n),n,l),a.head.appendChild(i);break;case"meta":if(o=rb("meta","content",a).get(n+(l.content||"")))for(s=0;s<o.length;s++)if((i=o[s]).getAttribute("content")===(null==l.content?null:""+l.content)&&i.getAttribute("name")===(null==l.name?null:l.name)&&i.getAttribute("property")===(null==l.property?null:l.property)&&i.getAttribute("http-equiv")===(null==l.httpEquiv?null:l.httpEquiv)&&i.getAttribute("charset")===(null==l.charSet?null:l.charSet)){o.splice(s,1);break t}hd(i=a.createElement(n),n,l),a.head.appendChild(i);break;default:throw Error(r(468,n))}i[qe]=e,lt(i),n=i}e.stateNode=n}else ab(a,e.type,e.stateNode);else e.stateNode=Zd(a,n,e.memoizedProps);else i!==n?(null===i?null!==l.stateNode&&(l=l.stateNode).parentNode.removeChild(l):i.count--,null===n?ab(a,e.type,e.stateNode):Zd(a,n,e.memoizedProps)):null===n&&null!==e.stateNode&&Ns(e,e.memoizedProps,l.memoizedProps)}break;case 27:Vs(t,e),Gs(e),512&n&&(Ls||null===l||Cs(l,l.return)),null!==l&&4&n&&Ns(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Vs(t,e),Gs(e),512&n&&(Ls||null===l||Cs(l,l.return)),32&e.flags){a=e.stateNode;try{Et(a,"")}catch(p){Nu(e,e.return,p)}}4&n&&null!=e.stateNode&&Ns(e,a=e.memoizedProps,null!==l?l.memoizedProps:a),1024&n&&(Is=!0);break;case 6:if(Vs(t,e),Gs(e),4&n){if(null===e.stateNode)throw Error(r(162));n=e.memoizedProps,l=e.stateNode;try{l.nodeValue=n}catch(p){Nu(e,e.return,p)}}break;case 3:if(nb=null,a=Hs,Hs=qd(t.containerInfo),Vs(t,e),Hs=a,Gs(e),4&n&&null!==l&&l.memoizedState.isDehydrated)try{Hb(t.containerInfo)}catch(p){Nu(e,e.return,p)}Is&&(Is=!1,Qs(e));break;case 4:n=Hs,Hs=qd(e.stateNode.containerInfo),Vs(t,e),Gs(e),Hs=n;break;case 12:default:Vs(t,e),Gs(e);break;case 31:case 19:Vs(t,e),Gs(e),4&n&&(null!==(n=e.updateQueue)&&(e.updateQueue=null,Ws(e,n)));break;case 13:Vs(t,e),Gs(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==l&&null!==l.memoizedState)&&(Mc=ue()),4&n&&(null!==(n=e.updateQueue)&&(e.updateQueue=null,Ws(e,n)));break;case 22:a=null!==e.memoizedState;var c=null!==l&&null!==l.memoizedState,u=zs,d=Ls;if(zs=u||a,Ls=d||c,Vs(t,e),Ls=d,zs=u,Gs(e),8192&n)e:for(t=e.stateNode,t._visibility=a?-2&t._visibility:1|t._visibility,a&&(null===l||c||zs||Ls||Ys(e)),l=null,t=e;;){if(5===t.tag||26===t.tag){if(null===l){c=l=t;try{if(i=c.stateNode,a)"function"==typeof(o=i.style).setProperty?o.setProperty("display","none","important"):o.display="none";else{s=c.stateNode;var b=c.memoizedProps.style,m=null!=b&&b.hasOwnProperty("display")?b.display:null;s.style.display=null==m||"boolean"==typeof m?"":(""+m).trim()}}catch(p){Nu(c,c.return,p)}}}else if(6===t.tag){if(null===l){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(p){Nu(c,c.return,p)}}}else if(18===t.tag){if(null===l){c=t;try{var h=c.stateNode;a?Ad(h,!0):Ad(c.stateNode,!1)}catch(p){Nu(c,c.return,p)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}4&n&&(null!==(n=e.updateQueue)&&(null!==(l=n.retryQueue)&&(n.retryQueue=null,Ws(e,l))));case 30:case 21:}}function Gs(e){var t=e.flags;if(2&t){try{for(var l,n=e.return;null!==n;){if(Es(n)){l=n;break}n=n.return}if(null==l)throw Error(r(160));switch(l.tag){case 27:var a=l.stateNode;Ts(e,$s(e),a);break;case 5:var i=l.stateNode;32&l.flags&&(Et(i,""),l.flags&=-33),Ts(e,$s(e),i);break;case 3:case 4:var o=l.stateNode.containerInfo;_s(e,$s(e),o);break;default:throw Error(r(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 Xs(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Ds(e,t.alternate,t),t=t.sibling}function Ys(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ys(4,t,t.return),Ys(t);break;case 1:Cs(t,t.return);var l=t.stateNode;"function"==typeof l.componentWillUnmount&&xs(t,t.return,l),Ys(t);break;case 27:Fd(t.stateNode);case 26:case 5:Cs(t,t.return),Ys(t);break;case 22:null===t.memoizedState&&Ys(t);break;default:Ys(t)}e=e.sibling}}function Js(e,t,l){for(l=l&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var n=t.alternate,r=e,a=t,i=a.flags;switch(a.tag){case 0:case 11:case 15:Js(r,a,l),vs(4,a);break;case 1:if(Js(r,a,l),"function"==typeof(r=(n=a).stateNode).componentDidMount)try{r.componentDidMount()}catch(c){Nu(n,n.return,c)}if(null!==(r=(n=a).updateQueue)){var o=n.stateNode;try{var s=r.shared.hiddenCallbacks;if(null!==s)for(r.shared.hiddenCallbacks=null,r=0;r<s.length;r++)$a(s[r],o)}catch(c){Nu(n,n.return,c)}}l&&64&i&&ws(a),ks(a,a.return);break;case 27:As(a);case 26:case 5:Js(r,a,l),l&&null===n&&4&i&&Ss(a),ks(a,a.return);break;case 12:Js(r,a,l);break;case 31:Js(r,a,l),l&&4&i&&Bs(r,a);break;case 13:Js(r,a,l),l&&4&i&&qs(r,a);break;case 22:null===a.memoizedState&&Js(r,a,l),ks(a,a.return);break;case 30:break;default:Js(r,a,l)}t=t.sibling}}function Zs(e,t){var l=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(l=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==l&&(null!=e&&e.refCount++,null!=l&&Br(l))}function ec(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Br(e))}function tc(e,t,l,n){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)lc(e,t,l,n),t=t.sibling}function lc(e,t,l,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:tc(e,t,l,n),2048&r&&vs(9,t);break;case 1:case 31:case 13:default:tc(e,t,l,n);break;case 3:tc(e,t,l,n),2048&r&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Br(e)));break;case 12:if(2048&r){tc(e,t,l,n),e=t.stateNode;try{var a=t.memoizedProps,i=a.id,o=a.onPostCommit;"function"==typeof o&&o(i,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(s){Nu(t,t.return,s)}}else tc(e,t,l,n);break;case 23:break;case 22:a=t.stateNode,i=t.alternate,null!==t.memoizedState?2&a._visibility?tc(e,t,l,n):rc(e,t):2&a._visibility?tc(e,t,l,n):(a._visibility|=2,nc(e,t,l,n,!!(10256&t.subtreeFlags)||!1)),2048&r&&Zs(i,t);break;case 24:tc(e,t,l,n),2048&r&&ec(t.alternate,t)}}function nc(e,t,l,n,r){for(r=r&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var a=e,i=t,o=l,s=n,c=i.flags;switch(i.tag){case 0:case 11:case 15:nc(a,i,o,s,r),vs(8,i);break;case 23:break;case 22:var u=i.stateNode;null!==i.memoizedState?2&u._visibility?nc(a,i,o,s,r):rc(a,i):(u._visibility|=2,nc(a,i,o,s,r)),r&&2048&c&&Zs(i.alternate,i);break;case 24:nc(a,i,o,s,r),r&&2048&c&&ec(i.alternate,i);break;default:nc(a,i,o,s,r)}t=t.sibling}}function rc(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var l=e,n=t,r=n.flags;switch(n.tag){case 22:rc(l,n),2048&r&&Zs(n.alternate,n);break;case 24:rc(l,n),2048&r&&ec(n.alternate,n);break;default:rc(l,n)}t=t.sibling}}var ac=8192;function ic(e,t,l){if(e.subtreeFlags&ac)for(e=e.child;null!==e;)oc(e,t,l),e=e.sibling}function oc(e,t,l){switch(e.tag){case 26:ic(e,t,l),e.flags&ac&&null!==e.memoizedState&&function(e,t,l,n){if(!("stylesheet"!==l.type||"string"==typeof n.media&&!1===matchMedia(n.media).matches||4&l.state.loading)){if(null===l.instance){var r=Gd(n.href),a=t.querySelector(Qd(r));if(a)return null!==(t=a._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=sb.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=a,void lt(a);a=t.ownerDocument||t,n=Xd(n),(r=Ud.get(r))&&tb(n,r),lt(a=a.createElement("link"));var i=a;i._p=new Promise(function(e,t){i.onload=e,i.onerror=t}),hd(a,"link",n),l.instance=a}null===e.stylesheets&&(e.stylesheets=/* @__PURE__ */new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&!(3&l.state.loading)&&(e.count++,l=sb.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}(l,Hs,e.memoizedState,e.memoizedProps);break;case 5:default:ic(e,t,l);break;case 3:case 4:var n=Hs;Hs=qd(e.stateNode.containerInfo),ic(e,t,l),Hs=n;break;case 22:null===e.memoizedState&&(null!==(n=e.alternate)&&null!==n.memoizedState?(n=ac,ac=16777216,ic(e,t,l),ac=n):ic(e,t,l))}}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 l=0;l<t.length;l++){var n=t[l];Ps=n,bc(n,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&&ys(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 l=0;l<t.length;l++){var n=t[l];Ps=n,bc(n,e)}sc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:ys(8,t,t.return),dc(t);break;case 22:2&(l=t.stateNode)._visibility&&(l._visibility&=-3,dc(t));break;default:dc(t)}e=e.sibling}}function bc(e,t){for(;null!==Ps;){var l=Ps;switch(l.tag){case 0:case 11:case 15:ys(8,l,t);break;case 23:case 22:if(null!==l.memoizedState&&null!==l.memoizedState.cachePool){var n=l.memoizedState.cachePool.pool;null!=n&&n.refCount++}break;case 24:Br(l.memoizedState.cache)}if(null!==(n=l.child))n.return=l,Ps=n;else e:for(l=e;null!==Ps;){var r=(n=Ps).sibling,a=n.return;if(Rs(n),n===l){Ps=null;break e}if(null!==r){r.return=a,Ps=r;break e}Ps=a}}}var mc={getCacheForType:function(e){var t=Mr(Fr),l=t.data.get(e);return void 0===l&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Mr(Fr).controller.signal}},hc="function"==typeof WeakMap?WeakMap:Map,pc=0,fc=null,gc=null,vc=0,yc=0,wc=null,xc=!1,kc=!1,Cc=!1,Sc=0,Nc=0,Ec=0,$c=0,_c=0,Tc=0,Ac=0,zc=null,Lc=null,Ic=!1,Mc=0,Pc=0,Dc=1/0,Rc=null,Oc=null,jc=0,Fc=null,Uc=null,Bc=0,qc=0,Wc=null,Vc=null,Hc=0,Kc=null;function Gc(){return 2&pc&&0!==vc?vc&-vc:null!==D.T?Wu():Fe()}function Qc(){if(0===Tc)if(536870912&vc&&!mr)Tc=536870912;else{var e=Ee;!(3932160&(Ee<<=1))&&(Ee=262144),Tc=e}return null!==(e=Ma.current)&&(e.flags|=32),Tc}function Xc(e,t,l){(e!==fc||2!==yc&&9!==yc)&&null===e.cancelPendingCommit||(nu(e,0),eu(e,vc,Tc,!1)),Me(e,l),2&pc&&e===fc||(e===fc&&(!(2&pc)&&($c|=l),4===Nc&&eu(e,vc,Tc,!1)),Ru(e))}function Yc(e,t,l){if(6&pc)throw Error(r(327));for(var n=!l&&!(127&t)&&0===(t&e.expiredLanes)||Ae(e,t),a=n?function(e,t){var l=pc;pc|=2;var n=iu(),a=ou();fc!==e||vc!==t?(Rc=null,Dc=ue()+500,nu(e,t)):kc=Ae(e,t);e:for(;;)try{if(0!==yc&&null!==gc){t=gc;var i=wc;t:switch(yc){case 1:yc=0,wc=null,hu(e,t,i,1);break;case 2:case 9:if(na(i)){yc=0,wc=null,mu(t);break}t=function(){2!==yc&&9!==yc||fc!==e||(yc=7),Ru(e)},i.then(t,t);break e;case 3:yc=7;break e;case 4:yc=5;break e;case 7:na(i)?(yc=0,wc=null,mu(t)):(yc=0,wc=null,hu(e,t,i,7));break;case 5:var o=null;switch(gc.tag){case 26:o=gc.memoizedState;case 5:case 27:var s=gc;if(o?ib(o):s.stateNode.complete){yc=0,wc=null;var c=s.sibling;if(null!==c)gc=c;else{var u=s.return;null!==u?(gc=u,pu(u)):gc=null}break t}}yc=0,wc=null,hu(e,t,i,5);break;case 6:yc=0,wc=null,hu(e,t,i,6);break;case 8:lu(),Nc=6;break e;default:throw Error(r(462))}}du();break}catch(d){ru(e,d)}return Er=Nr=null,D.H=n,D.A=a,pc=l,null!==gc?0:(fc=null,vc=0,Ln(),Nc)}(e,t):cu(e,t,!0),i=n;;){if(0===a){kc&&!n&&eu(e,t,0,!1);break}if(l=e.current.alternate,!i||Zc(l)){if(2===a){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=0!==(o=-536870913&e.pendingLanes)?o:536870912&o?536870912:0;if(0!==o){t=o;e:{var s=e;a=zc;var c=s.current.memoizedState.isDehydrated;if(c&&(nu(s,o).flags|=256),2!==(o=cu(s,o,!1))){if(Cc&&!c){s.errorRecoveryDisabledLanes|=i,$c|=i,a=4;break e}i=Lc,Lc=a,null!==i&&(null===Lc?Lc=i:Lc.push.apply(Lc,i))}a=o}if(i=!1,2!==a)continue}}if(1===a){nu(e,0),eu(e,t,0,!0);break}e:{switch(n=e,i=a){case 0:case 1:throw Error(r(345));case 4:if((4194048&t)!==t)break;case 6:eu(n,t,Tc,!xc);break e;case 2:Lc=null;break;case 3:case 5:break;default:throw Error(r(329))}if((62914560&t)===t&&10<(a=Mc+300-ue())){if(eu(n,t,Tc,!xc),0!==Te(n,0,!0))break e;Bc=t,n.timeoutHandle=Cd(Jc.bind(null,n,l,Lc,Rc,Ic,t,Tc,$c,Ac,xc,i,"Throttled",-0,0),a)}else Jc(n,l,Lc,Rc,Ic,t,Tc,$c,Ac,xc,i,null,-0,0)}break}a=cu(e,t,!1),i=!1}Ru(e)}function Jc(e,t,l,n,r,a,i,o,s,c,u,d,b,m){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){oc(t,a,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Mt});var h=(62914560&a)===a?Mc-ue():(4194048&a)===a?Pc-ue():0;if(null!==(h=function(e,t){return e.stylesheets&&0===e.count&&ub(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var n=setTimeout(function(){if(e.stylesheets&&ub(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===ob&&(ob=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,l=performance.getEntriesByType("resource"),n=0;n<l.length;n++){var r=l[n],a=r.transferSize,i=r.initiatorType,o=r.duration;if(a&&o&&pd(i)){for(i=0,o=r.responseEnd,n+=1;n<l.length;n++){var s=l[n],c=s.startTime;if(c>o)break;var u=s.transferSize,d=s.initiatorType;u&&pd(d)&&(i+=u*((s=s.responseEnd)<o?1:(o-c)/(s-c)))}if(--n,t+=8*(a+i)/(r.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var r=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&ub(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ob?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}(d,h)))return Bc=a,e.cancelPendingCommit=h(gu.bind(null,e,t,a,l,n,r,i,o,s,u,d,null,b,m)),void eu(e,a,i,!c)}gu(e,t,a,l,n,r,i,o,s)}function Zc(e){for(var t=e;;){var l=t.tag;if((0===l||11===l||15===l)&&16384&t.flags&&(null!==(l=t.updateQueue)&&null!==(l=l.stores)))for(var n=0;n<l.length;n++){var r=l[n],a=r.getSnapshot;r=r.value;try{if(!Zl(a(),r))return!1}catch(i){return!1}}if(l=t.child,16384&t.subtreeFlags&&null!==l)l.return=t,t=l;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,l,n){t&=~_c,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var a=31-ke(r),i=1<<a;n[a]=-1,r&=~i}0!==l&&Pe(e,l,t)}function tu(){return!!(6&pc)||(Ou(0),!1)}function lu(){if(null!==gc){if(0===yc)var e=gc.return;else Er=Nr=null,si(e=gc),ca=null,ua=0,e=gc;for(;null!==e;)gs(e.alternate,e),e=e.return;gc=null}}function nu(e,t){var l=e.timeoutHandle;-1!==l&&(e.timeoutHandle=-1,Sd(l)),null!==(l=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,l()),Bc=0,lu(),fc=e,gc=l=Bn(e.current,null),vc=t,yc=0,wc=null,xc=!1,kc=Ae(e,t),Cc=!1,Ac=Tc=_c=$c=Ec=Nc=0,Lc=zc=null,Ic=!1,8&t&&(t|=32&t);var n=e.entangledLanes;if(0!==n)for(e=e.entanglements,n&=t;0<n;){var r=31-ke(n),a=1<<r;t|=e[r],n&=~a}return Sc=t,Ln(),l}function ru(e,t){Wa=null,D.H=go,t===Zr||t===ta?(t=oa(),yc=3):t===ea?(t=oa(),yc=4):yc=t===Mo?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,wc=t,null===gc&&(Nc=1,To(e,Xn(t,e.current)))}function au(){var e=Ma.current;return null===e||((4194048&vc)===vc?null===Pa:!!((62914560&vc)===vc||536870912&vc)&&e===Pa)}function iu(){var e=D.H;return D.H=go,null===e?go:e}function ou(){var e=D.A;return D.A=mc,e}function su(){Nc=4,xc||(4194048&vc)!==vc&&null!==Ma.current||(kc=!0),!(134217727&Ec)&&!(134217727&$c)||null===fc||eu(fc,vc,Tc,!1)}function cu(e,t,l){var n=pc;pc|=2;var r=iu(),a=ou();fc===e&&vc===t||(Rc=null,nu(e,t)),t=!1;var i=Nc;e:for(;;)try{if(0!==yc&&null!==gc){var o=gc,s=wc;switch(yc){case 8:lu(),i=6;break e;case 3:case 2:case 9:case 6:null===Ma.current&&(t=!0);var c=yc;if(yc=0,wc=null,hu(e,o,s,c),l&&kc){i=0;break e}break;default:c=yc,yc=0,wc=null,hu(e,o,s,c)}}uu(),i=Nc;break}catch(u){ru(e,u)}return t&&e.shellSuspendCounter++,Er=Nr=null,pc=n,D.H=r,D.A=a,null===gc&&(fc=null,vc=0,Ln()),i}function uu(){for(;null!==gc;)bu(gc)}function du(){for(;null!==gc&&!se();)bu(gc)}function bu(e){var t=ss(e.alternate,e,Sc);e.memoizedProps=e.pendingProps,null===t?pu(e):gc=t}function mu(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Ko(l,t,t.pendingProps,t.type,void 0,vc);break;case 11:t=Ko(l,t,t.pendingProps,t.type.render,t.ref,vc);break;case 5:si(t);default:gs(l,t),t=ss(l,t=gc=qn(t,Sc),Sc)}e.memoizedProps=e.pendingProps,null===t?pu(e):gc=t}function hu(e,t,l,n){Er=Nr=null,si(t),ca=null,ua=0;var a=t.return;try{if(function(e,t,l,n,a){if(l.flags|=32768,null!==n&&"object"==typeof n&&"function"==typeof n.then){if(null!==(t=l.alternate)&&zr(t,l,a,!0),null!==(l=Ma.current)){switch(l.tag){case 31:case 13:return null===Pa?su():null===l.alternate&&0===Nc&&(Nc=3),l.flags&=-257,l.flags|=65536,l.lanes=a,n===la?l.flags|=16384:(null===(t=l.updateQueue)?l.updateQueue=/* @__PURE__ */new Set([n]):t.add(n),Eu(e,n,a)),!1;case 22:return l.flags|=65536,n===la?l.flags|=16384:(null===(t=l.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:/* @__PURE__ */new Set([n])},l.updateQueue=t):null===(l=t.retryQueue)?t.retryQueue=/* @__PURE__ */new Set([n]):l.add(n),Eu(e,n,a)),!1}throw Error(r(435,l.tag))}return Eu(e,n,a),su(),!1}if(mr)return null!==(t=Ma.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=a,n!==fr&&Cr(Xn(e=Error(r(422),{cause:n}),l))):(n!==fr&&Cr(Xn(t=Error(r(423),{cause:n}),l)),(e=e.current.alternate).flags|=65536,a&=-a,e.lanes|=a,n=Xn(n,l),Ca(e,a=zo(e.stateNode,n,a)),4!==Nc&&(Nc=2)),!1;var i=Error(r(520),{cause:n});if(i=Xn(i,l),null===zc?zc=[i]:zc.push(i),4!==Nc&&(Nc=2),null===t)return!0;n=Xn(n,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=a&-a,l.lanes|=e,Ca(l,e=zo(l.stateNode,n,e)),!1;case 1:if(t=l.type,i=l.stateNode,!(128&l.flags||"function"!=typeof t.getDerivedStateFromError&&(null===i||"function"!=typeof i.componentDidCatch||null!==Oc&&Oc.has(i))))return l.flags|=65536,a&=-a,l.lanes|=a,Io(a=Lo(a),e,l,n),Ca(l,a),!1}l=l.return}while(null!==l);return!1}(e,a,t,l,vc))return Nc=1,To(e,Xn(l,e.current)),void(gc=null)}catch(i){if(null!==a)throw gc=a,i;return Nc=1,To(e,Xn(l,e.current)),void(gc=null)}32768&t.flags?(mr||1===n?e=!0:kc||536870912&vc?e=!1:(xc=e=!0,(2===n||9===n||3===n||6===n)&&(null!==(n=Ma.current)&&13===n.tag&&(n.flags|=16384))),fu(t,e)):pu(t)}function pu(e){var t=e;do{if(32768&t.flags)return void fu(t,xc);e=t.return;var l=ps(t.alternate,t,Sc);if(null!==l)return void(gc=l);if(null!==(t=t.sibling))return void(gc=t);gc=t=e}while(null!==t);0===Nc&&(Nc=5)}function fu(e,t){do{var l=fs(e.alternate,e);if(null!==l)return l.flags&=32767,void(gc=l);if(null!==(l=e.return)&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&null!==(e=e.sibling))return void(gc=e);gc=e=l}while(null!==e);Nc=6,gc=null}function gu(e,t,l,n,a,i,o,s,c){e.cancelPendingCommit=null;do{ku()}while(0!==jc);if(6&pc)throw Error(r(327));if(null!==t){if(t===e.current)throw Error(r(177));if(i=t.lanes|t.childLanes,function(e,t,l,n,r,a){var i=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var o=e.entanglements,s=e.expirationTimes,c=e.hiddenUpdates;for(l=i&~l;0<l;){var u=31-ke(l),d=1<<u;o[u]=0,s[u]=-1;var b=c[u];if(null!==b)for(c[u]=null,u=0;u<b.length;u++){var m=b[u];null!==m&&(m.lane&=-536870913)}l&=~d}0!==n&&Pe(e,n,0),0!==a&&0===r&&0!==e.tag&&(e.suspendedLanes|=a&~(i&~t))}(e,l,i|=zn,o,s,c),e===fc&&(gc=fc=null,vc=0),Uc=t,Fc=e,Bc=l,qc=i,Wc=a,Vc=n,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,ie(he,function(){return Cu(),null})):(e.callbackNode=null,e.callbackPriority=0),n=!!(13878&t.flags),13878&t.subtreeFlags||n){n=D.T,D.T=null,a=R.p,R.p=2,o=pc,pc|=4;try{!function(e,t){if(e=e.containerInfo,fd=xb,an(e=rn(e))){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{var n=(l=(l=e.ownerDocument)&&l.defaultView||window).getSelection&&l.getSelection();if(n&&0!==n.rangeCount){l=n.anchorNode;var a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{l.nodeType,i.nodeType}catch(f){l=null;break e}var o=0,s=-1,c=-1,u=0,d=0,b=e,m=null;t:for(;;){for(var h;b!==l||0!==a&&3!==b.nodeType||(s=o+a),b!==i||0!==n&&3!==b.nodeType||(c=o+n),3===b.nodeType&&(o+=b.nodeValue.length),null!==(h=b.firstChild);)m=b,b=h;for(;;){if(b===e)break t;if(m===l&&++u===a&&(s=o),m===i&&++d===n&&(c=o),null!==(h=b.nextSibling))break;m=(b=m).parentNode}b=h}l=-1===s||-1===c?null:{start:s,end:c}}else l=null}l=l||{start:0,end:0}}else l=null;for(gd={focusedElem:e,selectionRange:l},xb=!1,Ps=t;null!==Ps;)if(e=(t=Ps).child,1028&t.subtreeFlags&&null!==e)e.return=t,Ps=e;else for(;null!==Ps;){switch(i=(t=Ps).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(l=0;l<e.length;l++)(a=e[l]).ref.impl=a.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!==i){e=void 0,l=t,a=i.memoizedProps,i=i.memoizedState,n=l.stateNode;try{var p=No(l.type,a);e=n.getSnapshotBeforeUpdate(p,i),n.__reactInternalSnapshotBeforeUpdate=e}catch(g){Nu(l,l.return,g)}}break;case 3:if(1024&e)if(9===(l=(e=t.stateNode.containerInfo).nodeType))zd(e);else if(1===l)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zd(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(r(163))}if(null!==(e=t.sibling)){e.return=t.return,Ps=e;break}Ps=t.return}}(e,t)}finally{pc=o,R.p=a,D.T=n}}jc=1,vu(),yu(),wu()}}function vu(){if(1===jc){jc=0;var e=Fc,t=Uc,l=!!(13878&t.flags);if(13878&t.subtreeFlags||l){l=D.T,D.T=null;var n=R.p;R.p=2;var r=pc;pc|=4;try{Ks(t,e);var a=gd,i=rn(e.containerInfo),o=a.focusedElem,s=a.selectionRange;if(i!==o&&o&&o.ownerDocument&&nn(o.ownerDocument.documentElement,o)){if(null!==s&&an(o)){var c=s.start,u=s.end;if(void 0===u&&(u=c),"selectionStart"in o)o.selectionStart=c,o.selectionEnd=Math.min(u,o.value.length);else{var d=o.ownerDocument||document,b=d&&d.defaultView||window;if(b.getSelection){var m=b.getSelection(),h=o.textContent.length,p=Math.min(s.start,h),f=void 0===s.end?p:Math.min(s.end,h);!m.extend&&p>f&&(i=f,f=p,p=i);var g=ln(o,p),v=ln(o,f);if(g&&v&&(1!==m.rangeCount||m.anchorNode!==g.node||m.anchorOffset!==g.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var y=d.createRange();y.setStart(g.node,g.offset),m.removeAllRanges(),p>f?(m.addRange(y),m.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),m.addRange(y))}}}}for(d=[],m=o;m=m.parentNode;)1===m.nodeType&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for("function"==typeof o.focus&&o.focus(),o=0;o<d.length;o++){var w=d[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}xb=!!fd,gd=fd=null}finally{pc=r,R.p=n,D.T=l}}e.current=t,jc=2}}function yu(){if(2===jc){jc=0;var e=Fc,t=Uc,l=!!(8772&t.flags);if(8772&t.subtreeFlags||l){l=D.T,D.T=null;var n=R.p;R.p=2;var r=pc;pc|=4;try{Ds(e,t.alternate,t)}finally{pc=r,R.p=n,D.T=l}}jc=3}}function wu(){if(4===jc||3===jc){jc=0,ce();var e=Fc,t=Uc,l=Bc,n=Vc;10256&t.subtreeFlags||10256&t.flags?jc=5:(jc=0,Uc=Fc=null,xu(e,e.pendingLanes));var r=e.pendingLanes;if(0===r&&(Oc=null),je(l),t=t.stateNode,we&&"function"==typeof we.onCommitFiberRoot)try{we.onCommitFiberRoot(ye,t,void 0,!(128&~t.current.flags))}catch(s){}if(null!==n){t=D.T,r=R.p,R.p=2,D.T=null;try{for(var a=e.onRecoverableError,i=0;i<n.length;i++){var o=n[i];a(o.value,{componentStack:o.stack})}}finally{D.T=t,R.p=r}}3&Bc&&ku(),Ru(e),r=e.pendingLanes,261930&l&&42&r?e===Kc?Hc++:(Hc=0,Kc=e):Hc=0,Ou(0)}}function xu(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,Br(t)))}function ku(){return vu(),yu(),wu(),Cu()}function Cu(){if(5!==jc)return!1;var e=Fc,t=qc;qc=0;var l=je(Bc),n=D.T,a=R.p;try{R.p=32>l?32:l,D.T=null,l=Wc,Wc=null;var i=Fc,o=Bc;if(jc=0,Uc=Fc=null,Bc=0,6&pc)throw Error(r(331));var s=pc;if(pc|=4,uc(i.current),lc(i,i.current,o,l),pc=s,Ou(0,!1),we&&"function"==typeof we.onPostCommitFiberRoot)try{we.onPostCommitFiberRoot(ye,i)}catch(c){}return!0}finally{R.p=a,D.T=n,xu(e,t)}}function Su(e,t,l){t=Xn(l,t),null!==(e=xa(e,t=zo(e.stateNode,t,2),2))&&(Me(e,2),Ru(e))}function Nu(e,t,l){if(3===e.tag)Su(e,e,l);else for(;null!==t;){if(3===t.tag){Su(t,e,l);break}if(1===t.tag){var n=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof n.componentDidCatch&&(null===Oc||!Oc.has(n))){e=Xn(l,e),null!==(n=xa(t,l=Lo(2),2))&&(Io(l,n,t,e),Me(n,2),Ru(n));break}}t=t.return}}function Eu(e,t,l){var n=e.pingCache;if(null===n){n=e.pingCache=new hc;var r=/* @__PURE__ */new Set;n.set(t,r)}else void 0===(r=n.get(t))&&(r=/* @__PURE__ */new Set,n.set(t,r));r.has(l)||(Cc=!0,r.add(l),e=$u.bind(null,e,t,l),t.then(e,e))}function $u(e,t,l){var n=e.pingCache;null!==n&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,fc===e&&(vc&l)===l&&(4===Nc||3===Nc&&(62914560&vc)===vc&&300>ue()-Mc?!(2&pc)&&nu(e,0):_c|=l,Ac===vc&&(Ac=0)),Ru(e)}function _u(e,t){0===t&&(t=Le()),null!==(e=Pn(e,t))&&(Me(e,t),Ru(e))}function Tu(e){var t=e.memoizedState,l=0;null!==t&&(l=t.retryLane),_u(e,l)}function Au(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,a=e.memoizedState;null!==a&&(l=a.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(r(314))}null!==n&&n.delete(t),_u(e,l)}var zu=null,Lu=null,Iu=!1,Mu=!1,Pu=!1,Du=0;function Ru(e){e!==Lu&&null===e.next&&(null===Lu?zu=Lu=e:Lu=Lu.next=e),Mu=!0,Iu||(Iu=!0,Ed(function(){6&pc?ie(be,ju):Fu()}))}function Ou(e,t){if(!Pu&&Mu){Pu=!0;do{for(var l=!1,n=zu;null!==n;){if(0!==e){var r=n.pendingLanes;if(0===r)var a=0;else{var i=n.suspendedLanes,o=n.pingedLanes;a=(1<<31-ke(42|e)+1)-1,a=201326741&(a&=r&~(i&~o))?201326741&a|1:a?2|a:0}0!==a&&(l=!0,qu(n,a))}else a=vc,!(3&(a=Te(n,n===fc?a:0,null!==n.cancelPendingCommit||-1!==n.timeoutHandle)))||Ae(n,a)||(l=!0,qu(n,a));n=n.next}}while(l);Pu=!1}}function ju(){Fu()}function Fu(){Mu=Iu=!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(),l=null,n=zu;null!==n;){var r=n.next,a=Uu(n,t);0===a?(n.next=null,null===l?zu=r:l.next=r,null===r&&(Lu=l)):(l=n,(0!==e||3&a)&&(Mu=!0)),n=r}0!==jc&&5!==jc||Ou(e),0!==Du&&(Du=0)}function Uu(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,a=-62914561&e.pendingLanes;0<a;){var i=31-ke(a),o=1<<i,s=r[i];-1===s?0!==(o&l)&&0===(o&n)||(r[i]=ze(o,t)):s<=t&&(e.expiredLanes|=o),a&=~o}if(l=vc,l=Te(e,e===(t=fc)?l:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),n=e.callbackNode,0===l||e===t&&(2===yc||9===yc)||null!==e.cancelPendingCommit)return null!==n&&null!==n&&oe(n),e.callbackNode=null,e.callbackPriority=0;if(!(3&l)||Ae(e,l)){if((t=l&-l)===e.callbackPriority)return t;switch(null!==n&&oe(n),je(l)){case 2:case 8:l=me;break;case 32:default:l=he;break;case 268435456:l=fe}return n=Bu.bind(null,e),l=ie(l,n),e.callbackPriority=t,e.callbackNode=l,t}return null!==n&&null!==n&&oe(n),e.callbackPriority=2,e.callbackNode=null,2}function Bu(e,t){if(0!==jc&&5!==jc)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(ku()&&e.callbackNode!==l)return null;var n=vc;return 0===(n=Te(e,e===fc?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Yc(e,n,t),Uu(e,ue()),null!=e.callbackNode&&e.callbackNode===l?Bu.bind(null,e):null)}function qu(e,t){if(ku())return null;Yc(e,t,!0)}function Wu(){if(0===Du){var e=Vr;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:It(""+e)}function Hu(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}for(var Ku=0;Ku<En.length;Ku++){var Gu=En[Ku];$n(Gu.toLowerCase(),"on"+(Gu[0].toUpperCase()+Gu.slice(1)))}$n(vn,"onAnimationEnd"),$n(yn,"onAnimationIteration"),$n(wn,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(xn,"onTransitionRun"),$n(kn,"onTransitionStart"),$n(Cn,"onTransitionCancel"),$n(Sn,"onTransitionEnd"),it("onMouseEnter",["mouseout","mouseover"]),it("onMouseLeave",["mouseout","mouseover"]),it("onPointerEnter",["pointerout","pointerover"]),it("onPointerLeave",["pointerout","pointerover"]),at("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),at("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),at("onBeforeInput",["compositionend","keypress","textInput","paste"]),at("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),at("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),at("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(" "),Xu=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qu));function Yu(e,t){t=!!(4&t);for(var l=0;l<e.length;l++){var n=e[l],r=n.event;n=n.listeners;e:{var a=void 0;if(t)for(var i=n.length-1;0<=i;i--){var o=n[i],s=o.instance,c=o.currentTarget;if(o=o.listener,s!==a&&r.isPropagationStopped())break e;a=o,r.currentTarget=c;try{a(r)}catch(u){_n(u)}r.currentTarget=null,a=s}else for(i=0;i<n.length;i++){if(s=(o=n[i]).instance,c=o.currentTarget,o=o.listener,s!==a&&r.isPropagationStopped())break e;a=o,r.currentTarget=c;try{a(r)}catch(u){_n(u)}r.currentTarget=null,a=s}}}}function Ju(e,t){var l=t[He];void 0===l&&(l=t[He]=/* @__PURE__ */new Set);var n=e+"__bubble";l.has(n)||(ld(t,e,2,!1),l.add(n))}function Zu(e,t,l){var n=0;t&&(n|=4),ld(l,e,n,t)}var ed="_reactListening"+Math.random().toString(36).slice(2);function td(e){if(!e[ed]){e[ed]=!0,nt.forEach(function(t){"selectionchange"!==t&&(Xu.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 ld(e,t,l,n){switch(_b(t)){case 2:var r=kb;break;case 8:r=Cb;break;default:r=Sb}l=r.bind(null,t,l,e),r=void 0,!Wt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),n?void 0!==r?e.addEventListener(t,l,{capture:!0,passive:r}):e.addEventListener(t,l,!0):void 0!==r?e.addEventListener(t,l,{passive:r}):e.addEventListener(t,l,!1)}function nd(e,t,l,n,r){var a=n;if(!(1&t||2&t||null===n))e:for(;;){if(null===n)return;var o=n.tag;if(3===o||4===o){var s=n.stateNode.containerInfo;if(s===r)break;if(4===o)for(o=n.return;null!==o;){var c=o.tag;if((3===c||4===c)&&o.stateNode.containerInfo===r)return;o=o.return}for(;null!==s;){if(null===(o=Je(s)))return;if(5===(c=o.tag)||6===c||26===c||27===c){n=a=o;continue e}s=s.parentNode}}n=n.return}Ut(function(){var n=a,r=Dt(l),o=[];e:{var s=Nn.get(e);if(void 0!==s){var c=rl,u=e;switch(e){case"keypress":if(0===Xt(l))break e;case"keydown":case"keyup":c=yl;break;case"focusin":u="focus",c=ul;break;case"focusout":u="blur",c=ul;break;case"beforeblur":case"afterblur":c=ul;break;case"click":if(2===l.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=sl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=cl;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=xl;break;case vn:case yn:case wn:c=dl;break;case Sn:c=kl;break;case"scroll":case"scrollend":c=il;break;case"wheel":c=Cl;break;case"copy":case"cut":case"paste":c=bl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=wl;break;case"toggle":case"beforetoggle":c=Sl}var d=!!(4&t),b=!d&&("scroll"===e||"scrollend"===e),m=d?null!==s?s+"Capture":null:s;d=[];for(var h,p=n;null!==p;){var f=p;if(h=f.stateNode,5!==(f=f.tag)&&26!==f&&27!==f||null===h||null===m||null!=(f=Bt(p,m))&&d.push(rd(p,f,h)),b)break;p=p.return}0<d.length&&(s=new c(s,u,null,l,r),o.push({event:s,listeners:d}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||l===Pt||!(u=l.relatedTarget||l.fromElement)||!Je(u)&&!u[Ve])&&(c||s)&&(s=r.window===r?r:(s=r.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=n,null!==(u=(u=l.relatedTarget||l.toElement)?Je(u):null)&&(b=i(u),d=u.tag,u!==b||5!==d&&27!==d&&6!==d)&&(u=null)):(c=null,u=n),c!==u)){if(d=sl,f="onMouseLeave",m="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(d=wl,f="onPointerLeave",m="onPointerEnter",p="pointer"),b=null==c?s:et(c),h=null==u?s:et(u),(s=new d(f,p+"leave",c,l,r)).target=b,s.relatedTarget=h,f=null,Je(r)===n&&((d=new d(m,p+"enter",u,l,r)).target=h,d.relatedTarget=b,f=d),b=f,c&&u)e:{for(d=id,p=u,h=0,f=m=c;f;f=d(f))h++;f=0;for(var g=p;g;g=d(g))f++;for(;0<h-f;)m=d(m),h--;for(;0<f-h;)p=d(p),f--;for(;h--;){if(m===p||null!==p&&m===p.alternate){d=m;break e}m=d(m),p=d(p)}d=null}else d=null;null!==c&&od(o,s,c,d,!1),null!==u&&null!==b&&od(o,b,u,d,!0)}if("select"===(c=(s=n?et(n):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var v=Bl;else if(Dl(s))if(ql)v=Jl;else{v=Xl;var y=Ql}else!(c=s.nodeName)||"input"!==c.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?n&&At(n.elementType)&&(v=Bl):v=Yl;switch(v&&(v=v(e,n))?Rl(o,v,l,r):(y&&y(e,s,n),"focusout"===e&&n&&"number"===s.type&&null!=n.memoizedProps.value&&kt(s,"number",s.value)),y=n?et(n):window,e){case"focusin":(Dl(y)||"true"===y.contentEditable)&&(sn=y,cn=n,un=null);break;case"focusout":un=cn=sn=null;break;case"mousedown":dn=!0;break;case"contextmenu":case"mouseup":case"dragend":dn=!1,bn(o,l,r);break;case"selectionchange":if(on)break;case"keydown":case"keyup":bn(o,l,r)}var w;if(El)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 Ml?Ll(e,l)&&(x="onCompositionEnd"):"keydown"===e&&229===l.keyCode&&(x="onCompositionStart");x&&(Tl&&"ko"!==l.locale&&(Ml||"onCompositionStart"!==x?"onCompositionEnd"===x&&Ml&&(w=Qt()):(Kt="value"in(Ht=r)?Ht.value:Ht.textContent,Ml=!0)),0<(y=ad(n,x)).length&&(x=new ml(x,e,null,l,r),o.push({event:x,listeners:y}),w?x.data=w:null!==(w=Il(l))&&(x.data=w))),(w=_l?function(e,t){switch(e){case"compositionend":return Il(t);case"keypress":return 32!==t.which?null:(zl=!0,Al);case"textInput":return(e=t.data)===Al&&zl?null:e;default:return null}}(e,l):function(e,t){if(Ml)return"compositionend"===e||!El&&Ll(e,t)?(e=Qt(),Gt=Kt=Ht=null,Ml=!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 Tl&&"ko"!==t.locale?null:t.data}}(e,l))&&(0<(x=ad(n,"onBeforeInput")).length&&(y=new ml("onBeforeInput","beforeinput",null,l,r),o.push({event:y,listeners:x}),y.data=w)),function(e,t,l,n,r){if("submit"===t&&l&&l.stateNode===r){var a=Vu((r[We]||null).action),i=n.submitter;i&&null!==(t=(t=i[We]||null)?Vu(t.formAction):i.getAttribute("formAction"))&&(a=t,i=null);var o=new rl("action","action",null,n,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(0!==Du){var e=i?Hu(r,i):new FormData(r);lo(l,{pending:!0,data:e,method:r.method,action:a},null,e)}}else"function"==typeof a&&(o.preventDefault(),e=i?Hu(r,i):new FormData(r),lo(l,{pending:!0,data:e,method:r.method,action:a},a,e))},currentTarget:r}]})}}(o,e,n,l,r)}Yu(o,t)})}function rd(e,t,l){return{instance:e,listener:t,currentTarget:l}}function ad(e,t){for(var l=t+"Capture",n=[];null!==e;){var r=e,a=r.stateNode;if(5!==(r=r.tag)&&26!==r&&27!==r||null===a||(null!=(r=Bt(e,l))&&n.unshift(rd(e,r,a)),null!=(r=Bt(e,t))&&n.push(rd(e,r,a))),3===e.tag)return n;e=e.return}return[]}function id(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function od(e,t,l,n,r){for(var a=t._reactName,i=[];null!==l&&l!==n;){var o=l,s=o.alternate,c=o.stateNode;if(o=o.tag,null!==s&&s===n)break;5!==o&&26!==o&&27!==o||null===c||(s=c,r?null!=(c=Bt(l,a))&&i.unshift(rd(l,c,s)):r||null!=(c=Bt(l,a))&&i.push(rd(l,c,s))),l=l.return}0!==i.length&&e.push({event:t,listeners:i})}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 bd(e,t,l,n,a,i){switch(l){case"children":"string"==typeof n?"body"===t||"textarea"===t&&""===n||Et(e,n):("number"==typeof n||"bigint"==typeof n)&&"body"!==t&&Et(e,""+n);break;case"className":dt(e,"class",n);break;case"tabIndex":dt(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":dt(e,l,n);break;case"style":Tt(e,n,i);break;case"data":if("object"!==t){dt(e,"data",n);break}case"src":case"href":if(""===n&&("a"!==t||"href"!==l)){e.removeAttribute(l);break}if(null==n||"function"==typeof n||"symbol"==typeof n||"boolean"==typeof n){e.removeAttribute(l);break}n=It(""+n),e.setAttribute(l,n);break;case"action":case"formAction":if("function"==typeof n){e.setAttribute(l,"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 i&&("formAction"===l?("input"!==t&&bd(e,t,"name",a.name,a,null),bd(e,t,"formEncType",a.formEncType,a,null),bd(e,t,"formMethod",a.formMethod,a,null),bd(e,t,"formTarget",a.formTarget,a,null)):(bd(e,t,"encType",a.encType,a,null),bd(e,t,"method",a.method,a,null),bd(e,t,"target",a.target,a,null))),null==n||"symbol"==typeof n||"boolean"==typeof n){e.removeAttribute(l);break}n=It(""+n),e.setAttribute(l,n);break;case"onClick":null!=n&&(e.onclick=Mt);break;case"onScroll":null!=n&&Ju("scroll",e);break;case"onScrollEnd":null!=n&&Ju("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=n){if("object"!=typeof n||!("__html"in n))throw Error(r(61));if(null!=(l=n.__html)){if(null!=a.children)throw Error(r(60));e.innerHTML=l}}break;case"multiple":e.multiple=n&&"function"!=typeof n&&"symbol"!=typeof n;break;case"muted":e.muted=n&&"function"!=typeof n&&"symbol"!=typeof n;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==n||"function"==typeof n||"boolean"==typeof n||"symbol"==typeof n){e.removeAttribute("xlink:href");break}l=It(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=n&&"function"!=typeof n&&"symbol"!=typeof n?e.setAttribute(l,""+n):e.removeAttribute(l);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":n&&"function"!=typeof n&&"symbol"!=typeof n?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":!0===n?e.setAttribute(l,""):!1!==n&&null!=n&&"function"!=typeof n&&"symbol"!=typeof n?e.setAttribute(l,n):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":null!=n&&"function"!=typeof n&&"symbol"!=typeof n&&!isNaN(n)&&1<=n?e.setAttribute(l,n):e.removeAttribute(l);break;case"rowSpan":case"start":null==n||"function"==typeof n||"symbol"==typeof n||isNaN(n)?e.removeAttribute(l):e.setAttribute(l,n);break;case"popover":Ju("beforetoggle",e),Ju("toggle",e),ut(e,"popover",n);break;case"xlinkActuate":bt(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":bt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":bt(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":bt(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":bt(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":bt(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":bt(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":bt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":bt(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":ut(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||"o"!==l[0]&&"O"!==l[0]||"n"!==l[1]&&"N"!==l[1])&&ut(e,l=zt.get(l)||l,n)}}function md(e,t,l,n,a,i){switch(l){case"style":Tt(e,n,i);break;case"dangerouslySetInnerHTML":if(null!=n){if("object"!=typeof n||!("__html"in n))throw Error(r(61));if(null!=(l=n.__html)){if(null!=a.children)throw Error(r(60));e.innerHTML=l}}break;case"children":"string"==typeof n?Et(e,n):("number"==typeof n||"bigint"==typeof n)&&Et(e,""+n);break;case"onScroll":null!=n&&Ju("scroll",e);break;case"onScrollEnd":null!=n&&Ju("scrollend",e);break;case"onClick":null!=n&&(e.onclick=Mt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:rt.hasOwnProperty(l)||("o"!==l[0]||"n"!==l[1]||(a=l.endsWith("Capture"),t=l.slice(2,a?l.length-7:void 0),"function"==typeof(i=null!=(i=e[We]||null)?i[l]:null)&&e.removeEventListener(t,i,a),"function"!=typeof n)?l in e?e[l]=n:!0===n?e.setAttribute(l,""):ut(e,l,n):("function"!=typeof i&&null!==i&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,n,a)))}}function hd(e,t,l){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 n,a=!1,i=!1;for(n in l)if(l.hasOwnProperty(n)){var o=l[n];if(null!=o)switch(n){case"src":a=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:bd(e,t,n,o,l,null)}}return i&&bd(e,t,"srcSet",l.srcSet,l,null),void(a&&bd(e,t,"src",l.src,l,null));case"input":Ju("invalid",e);var s=n=o=i=null,c=null,u=null;for(a in l)if(l.hasOwnProperty(a)){var d=l[a];if(null!=d)switch(a){case"name":i=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":n=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(null!=d)throw Error(r(137,t));break;default:bd(e,t,a,d,l,null)}}return void xt(e,n,s,c,u,o,i,!1);case"select":for(i in Ju("invalid",e),a=o=n=null,l)if(l.hasOwnProperty(i)&&null!=(s=l[i]))switch(i){case"value":n=s;break;case"defaultValue":o=s;break;case"multiple":a=s;default:bd(e,t,i,s,l,null)}return t=n,l=o,e.multiple=!!a,void(null!=t?Ct(e,!!a,t,!1):null!=l&&Ct(e,!!a,l,!0));case"textarea":for(o in Ju("invalid",e),n=i=a=null,l)if(l.hasOwnProperty(o)&&null!=(s=l[o]))switch(o){case"value":a=s;break;case"defaultValue":i=s;break;case"children":n=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(r(91));break;default:bd(e,t,o,s,l,null)}return void Nt(e,a,i,n);case"option":for(c in l)if(l.hasOwnProperty(c)&&null!=(a=l[c]))if("selected"===c)e.selected=a&&"function"!=typeof a&&"symbol"!=typeof a;else bd(e,t,c,a,l,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(a=0;a<Qu.length;a++)Ju(Qu[a],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 l)if(l.hasOwnProperty(u)&&null!=(a=l[u]))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:bd(e,t,u,a,l,null)}return;default:if(At(t)){for(d in l)l.hasOwnProperty(d)&&(void 0!==(a=l[d])&&md(e,t,d,a,l,void 0));return}}for(s in l)l.hasOwnProperty(s)&&(null!=(a=l[s])&&bd(e,t,s,a,l,null))}function pd(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var fd=null,gd=null;function vd(e){return 9===e.nodeType?e:e.ownerDocument}function yd(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 Td(e,t){var l=t,n=0;do{var r=l.nextSibling;if(e.removeChild(l),r&&8===r.nodeType)if("/$"===(l=r.data)||"/&"===l){if(0===n)return e.removeChild(r),void Hb(t);n--}else if("$"===l||"$?"===l||"$~"===l||"$!"===l||"&"===l)n++;else if("html"===l)Fd(e.ownerDocument.documentElement);else if("head"===l){Fd(l=e.ownerDocument.head);for(var a=l.firstChild;a;){var i=a.nextSibling,o=a.nodeName;a[Xe]||"SCRIPT"===o||"STYLE"===o||"LINK"===o&&"stylesheet"===a.rel.toLowerCase()||l.removeChild(a),a=i}}else"body"===l&&Fd(e.ownerDocument.body);l=r}while(l);Hb(t)}function Ad(e,t){var l=e;e=0;do{var n=l.nextSibling;if(1===l.nodeType?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",""===l.getAttribute("style")&&l.removeAttribute("style")):3===l.nodeType&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),n&&8===n.nodeType)if("/$"===(l=n.data)){if(0===e)break;e--}else"$"!==l&&"$?"!==l&&"$~"!==l&&"$!"!==l||e++;l=n}while(l)}function zd(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":zd(l),Ye(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===l.rel.toLowerCase())continue}e.removeChild(l)}}function Ld(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=Pd(e.nextSibling)))return null}return e}function Id(e){return"$?"===e.data||"$~"===e.data}function Md(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function Pd(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 Rd(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var l=e.data;if("/$"===l||"/&"===l){if(0===t)return Pd(e.nextSibling);t--}else"$"!==l&&"$!"!==l&&"$?"!==l&&"$~"!==l&&"&"!==l||t++}e=e.nextSibling}return null}function Od(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var l=e.data;if("$"===l||"$!"===l||"$?"===l||"$~"===l||"&"===l){if(0===t)return e;t--}else"/$"!==l&&"/&"!==l||t++}e=e.previousSibling}return null}function jd(e,t,l){switch(t=vd(l),e){case"html":if(!(e=t.documentElement))throw Error(r(452));return e;case"head":if(!(e=t.head))throw Error(r(453));return e;case"body":if(!(e=t.body))throw Error(r(454));return e;default:throw Error(r(451))}}function Fd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ye(e)}var Ud=/* @__PURE__ */new Map,Bd=/* @__PURE__ */new Set;function qd(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Wd=R.d;R.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?ro(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,l){Wd.L(e,t,l);var n=Vd;if(n&&e&&t){var r='link[rel="preload"][as="'+yt(t)+'"]';"image"===t&&l&&l.imageSrcSet?(r+='[imagesrcset="'+yt(l.imageSrcSet)+'"]',"string"==typeof l.imageSizes&&(r+='[imagesizes="'+yt(l.imageSizes)+'"]')):r+='[href="'+yt(e)+'"]';var a=r;switch(t){case"style":a=Gd(e);break;case"script":a=Yd(e)}Ud.has(a)||(e=b({rel:"preload",href:"image"===t&&l&&l.imageSrcSet?void 0:e,as:t},l),Ud.set(a,e),null!==n.querySelector(r)||"style"===t&&n.querySelector(Qd(a))||"script"===t&&n.querySelector(Jd(a))||(hd(t=n.createElement("link"),"link",e),lt(t),n.head.appendChild(t)))}},m:function(e,t){Wd.m(e,t);var l=Vd;if(l&&e){var n=t&&"string"==typeof t.as?t.as:"script",r='link[rel="modulepreload"][as="'+yt(n)+'"][href="'+yt(e)+'"]',a=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=Yd(e)}if(!Ud.has(a)&&(e=b({rel:"modulepreload",href:e},t),Ud.set(a,e),null===l.querySelector(r))){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Jd(a)))return}hd(n=l.createElement("link"),"link",e),lt(n),l.head.appendChild(n)}}},X:function(e,t){Wd.X(e,t);var l=Vd;if(l&&e){var n=tt(l).hoistableScripts,r=Yd(e),a=n.get(r);a||((a=l.querySelector(Jd(r)))||(e=b({src:e,async:!0},t),(t=Ud.get(r))&&lb(e,t),lt(a=l.createElement("script")),hd(a,"link",e),l.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},n.set(r,a))}},S:function(e,t,l){Wd.S(e,t,l);var n=Vd;if(n&&e){var r=tt(n).hoistableStyles,a=Gd(e);t=t||"default";var i=r.get(a);if(!i){var o={loading:0,preload:null};if(i=n.querySelector(Qd(a)))o.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ud.get(a))&&tb(e,l);var s=i=n.createElement("link");lt(s),hd(s,"link",e),s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),s.addEventListener("load",function(){o.loading|=1}),s.addEventListener("error",function(){o.loading|=2}),o.loading|=4,eb(i,t,n)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(a,i)}}},M:function(e,t){Wd.M(e,t);var l=Vd;if(l&&e){var n=tt(l).hoistableScripts,r=Yd(e),a=n.get(r);a||((a=l.querySelector(Jd(r)))||(e=b({src:e,async:!0,type:"module"},t),(t=Ud.get(r))&&lb(e,t),lt(a=l.createElement("script")),hd(a,"link",e),l.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},n.set(r,a))}}};var Vd="undefined"==typeof document?null:document;function Hd(e,t,l){var n=Vd;if(n&&"string"==typeof t&&t){var r=yt(t);r='link[rel="'+e+'"][href="'+r+'"]',"string"==typeof l&&(r+='[crossorigin="'+l+'"]'),Bd.has(r)||(Bd.add(r),e={rel:e,crossOrigin:l,href:t},null===n.querySelector(r)&&(hd(t=n.createElement("link"),"link",e),lt(t),n.head.appendChild(t)))}}function Kd(e,t,l,n){var a,i,o,s,c=(c=G.current)?qd(c):null;if(!c)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof l.precedence&&"string"==typeof l.href?(t=Gd(l.href),(n=(l=tt(c).hoistableStyles).get(t))||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===l.rel&&"string"==typeof l.href&&"string"==typeof l.precedence){e=Gd(l.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)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ud.set(e,l),u||(a=c,i=e,o=l,s=d.state,a.querySelector('link[rel="preload"][as="style"]['+i+"]")?s.loading=1:(i=a.createElement("link"),s.preload=i,i.addEventListener("load",function(){return s.loading|=1}),i.addEventListener("error",function(){return s.loading|=2}),hd(i,"link",o),lt(i),a.head.appendChild(i))))),t&&null===n)throw Error(r(528,""));return d}if(t&&null!==n)throw Error(r(529,""));return null;case"script":return t=l.async,"string"==typeof(l=l.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Yd(l),(n=(l=tt(c).hoistableScripts).get(t))||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Gd(e){return'href="'+yt(e)+'"'}function Qd(e){return'link[rel="stylesheet"]['+e+"]"}function Xd(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Yd(e){return'[src="'+yt(e)+'"]'}function Jd(e){return"script[async]"+e}function Zd(e,t,l){if(t.count++,null===t.instance)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+yt(l.href)+'"]');if(n)return t.instance=n,lt(n),n;var a=b({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return lt(n=(e.ownerDocument||e).createElement("style")),hd(n,"style",a),eb(n,l.precedence,e),t.instance=n;case"stylesheet":a=Gd(l.href);var i=e.querySelector(Qd(a));if(i)return t.state.loading|=4,t.instance=i,lt(i),i;n=Xd(l),(a=Ud.get(a))&&tb(n,a),lt(i=(e.ownerDocument||e).createElement("link"));var o=i;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),hd(i,"link",n),t.state.loading|=4,eb(i,l.precedence,e),t.instance=i;case"script":return i=Yd(l.src),(a=e.querySelector(Jd(i)))?(t.instance=a,lt(a),a):(n=l,(a=Ud.get(i))&&lb(n=b({},l),a),lt(a=(e=e.ownerDocument||e).createElement("script")),hd(a,"link",n),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(r(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(n=t.instance,t.state.loading|=4,eb(n,l.precedence,e));return t.instance}function eb(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,a=r,i=0;i<n.length;i++){var o=n[i];if(o.dataset.precedence===t)a=o;else if(a!==r)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=9===l.nodeType?l.head:l).insertBefore(e,t.firstChild)}function tb(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function lb(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var nb=null;function rb(e,t,l){if(null===nb){var n=/* @__PURE__ */new Map,r=nb=/* @__PURE__ */new Map;r.set(l,n)}else(n=(r=nb).get(l))||(n=/* @__PURE__ */new Map,r.set(l,n));if(n.has(e))return n;for(n.set(e,null),l=l.getElementsByTagName(e),r=0;r<l.length;r++){var a=l[r];if(!(a[Xe]||a[qe]||"link"===e&&"stylesheet"===a.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==a.namespaceURI){var i=a.getAttribute(t)||"";i=e+i;var o=n.get(i);o?o.push(a):n.set(i,[a])}}return n}function ab(e,t,l){(e=e.ownerDocument||e).head.insertBefore(l,"title"===t?e.querySelector("head > title"):null)}function ib(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var ob=0;function sb(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)ub(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var cb=null;function ub(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,cb=/* @__PURE__ */new Map,t.forEach(db,e),cb=null,sb.call(e))}function db(e,t){if(!(4&t.state.loading)){var l=cb.get(e);if(l)var n=l.get(null);else{l=/* @__PURE__ */new Map,cb.set(e,l);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a<r.length;a++){var i=r[a];"LINK"!==i.nodeName&&"not all"===i.getAttribute("media")||(l.set(i.dataset.precedence,i),n=i)}n&&l.set(null,n)}i=(r=t.instance).getAttribute("data-precedence"),(a=l.get(i)||n)===n&&l.set(null,r),l.set(i,r),this.count++,n=sb.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),a?a.parentNode.insertBefore(r,a.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(r,e.firstChild),t.state.loading|=4}}var bb={$$typeof:w,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function mb(e,t,l,n,r,a,i,o,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=Ie(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ie(0),this.hiddenUpdates=Ie(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=a,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=/* @__PURE__ */new Map}function hb(e,t,l,n,r,a,i,o,s,c,u,d){return e=new mb(e,t,l,i,s,c,u,d,o),t=1,!0===a&&(t|=24),a=Fn(3,null,null,t),e.current=a,a.stateNode=e,(t=Ur()).refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:n,isDehydrated:l,cache:t},va(a),e}function pb(e){return e?e=On:On}function fb(e,t,l,n,r,a){r=pb(r),null===n.context?n.context=r:n.pendingContext=r,(n=wa(t)).payload={element:l},null!==(a=void 0===a?null:a)&&(n.callback=a),null!==(l=xa(e,n,t))&&(Xc(l,0,t),ka(l,e,t))}function gb(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var l=e.retryLane;e.retryLane=0!==l&&l<t?l:t}}function vb(e,t){gb(e,t),(e=e.alternate)&&gb(e,t)}function yb(e){if(13===e.tag||31===e.tag){var t=Pn(e,67108864);null!==t&&Xc(t,0,67108864),vb(e,67108864)}}function wb(e){if(13===e.tag||31===e.tag){var t=Gc(),l=Pn(e,t=Oe(t));null!==l&&Xc(l,0,t),vb(e,t)}}var xb=!0;function kb(e,t,l,n){var r=D.T;D.T=null;var a=R.p;try{R.p=2,Sb(e,t,l,n)}finally{R.p=a,D.T=r}}function Cb(e,t,l,n){var r=D.T;D.T=null;var a=R.p;try{R.p=8,Sb(e,t,l,n)}finally{R.p=a,D.T=r}}function Sb(e,t,l,n){if(xb){var r=Nb(n);if(null===r)nd(e,t,n,Eb,l),Rb(e,n);else if(function(e,t,l,n,r){switch(t){case"focusin":return Ab=Ob(Ab,e,t,l,n,r),!0;case"dragenter":return zb=Ob(zb,e,t,l,n,r),!0;case"mouseover":return Lb=Ob(Lb,e,t,l,n,r),!0;case"pointerover":var a=r.pointerId;return Ib.set(a,Ob(Ib.get(a)||null,e,t,l,n,r)),!0;case"gotpointercapture":return a=r.pointerId,Mb.set(a,Ob(Mb.get(a)||null,e,t,l,n,r)),!0}return!1}(r,e,t,l,n))n.stopPropagation();else if(Rb(e,n),4&t&&-1<Db.indexOf(e)){for(;null!==r;){var a=Ze(r);if(null!==a)switch(a.tag){case 3:if((a=a.stateNode).current.memoizedState.isDehydrated){var i=_e(a.pendingLanes);if(0!==i){var o=a;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var s=1<<31-ke(i);o.entanglements[1]|=s,i&=~s}Ru(a),!(6&pc)&&(Dc=ue()+500,Ou(0))}}break;case 31:case 13:null!==(o=Pn(a,2))&&Xc(o,0,2),tu(),vb(a,2)}if(null===(a=Nb(n))&&nd(e,t,n,Eb,l),a===r)break;r=a}null!==r&&n.stopPropagation()}else nd(e,t,n,null,l)}}function Nb(e){return $b(e=Dt(e))}var Eb=null;function $b(e){if(Eb=null,null!==(e=Je(e))){var t=i(e);if(null===t)e=null;else{var l=t.tag;if(13===l){if(null!==(e=s(t)))return e;e=null}else if(31===l){if(null!==(e=c(t)))return e;e=null}else if(3===l){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Eb=e,null}function _b(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 be:return 2;case me:return 8;case he:case pe:return 32;case fe:return 268435456;default:return 32}default:return 32}}var Tb=!1,Ab=null,zb=null,Lb=null,Ib=/* @__PURE__ */new Map,Mb=/* @__PURE__ */new Map,Pb=[],Db="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 Rb(e,t){switch(e){case"focusin":case"focusout":Ab=null;break;case"dragenter":case"dragleave":zb=null;break;case"mouseover":case"mouseout":Lb=null;break;case"pointerover":case"pointerout":Ib.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mb.delete(t.pointerId)}}function Ob(e,t,l,n,r,a){return null===e||e.nativeEvent!==a?(e={blockedOn:t,domEventName:l,eventSystemFlags:n,nativeEvent:a,targetContainers:[r]},null!==t&&(null!==(t=Ze(t))&&yb(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function jb(e){var t=Je(e.target);if(null!==t){var l=i(t);if(null!==l)if(13===(t=l.tag)){if(null!==(t=s(l)))return e.blockedOn=t,void Ue(e.priority,function(){wb(l)})}else if(31===t){if(null!==(t=c(l)))return e.blockedOn=t,void Ue(e.priority,function(){wb(l)})}else if(3===t&&l.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===l.tag?l.stateNode.containerInfo:null)}e.blockedOn=null}function Fb(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var l=Nb(e.nativeEvent);if(null!==l)return null!==(t=Ze(l))&&yb(t),e.blockedOn=l,!1;var n=new(l=e.nativeEvent).constructor(l.type,l);Pt=n,l.target.dispatchEvent(n),Pt=null,t.shift()}return!0}function Ub(e,t,l){Fb(e)&&l.delete(t)}function Bb(){Tb=!1,null!==Ab&&Fb(Ab)&&(Ab=null),null!==zb&&Fb(zb)&&(zb=null),null!==Lb&&Fb(Lb)&&(Lb=null),Ib.forEach(Ub),Mb.forEach(Ub)}function qb(e,l){e.blockedOn===l&&(e.blockedOn=null,Tb||(Tb=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bb)))}var Wb=null;function Vb(e){Wb!==e&&(Wb=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wb===e&&(Wb=null);for(var t=0;t<e.length;t+=3){var l=e[t],n=e[t+1],r=e[t+2];if("function"!=typeof n){if(null===$b(n||l))continue;break}var a=Ze(l);null!==a&&(e.splice(t,3),t-=3,lo(a,{pending:!0,data:r,method:l.method,action:n},n,r))}}))}function Hb(e){function t(t){return qb(t,e)}null!==Ab&&qb(Ab,e),null!==zb&&qb(zb,e),null!==Lb&&qb(Lb,e),Ib.forEach(t),Mb.forEach(t);for(var l=0;l<Pb.length;l++){var n=Pb[l];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Pb.length&&null===(l=Pb[0]).blockedOn;)jb(l),null===l.blockedOn&&Pb.shift();if(null!=(l=(e.ownerDocument||e).$$reactFormReplay))for(n=0;n<l.length;n+=3){var r=l[n],a=l[n+1],i=r[We]||null;if("function"==typeof a)i||Vb(l);else if(i){var o=null;if(a&&a.hasAttribute("formAction")){if(r=a,i=a[We]||null)o=i.formAction;else if(null!==$b(r))continue}else o=i.action;"function"==typeof o?l[n+1]=o:(l.splice(n,3),n-=3),Vb(l)}}}function Kb(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return r=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==r&&(r(),r=null),n||setTimeout(l,20)}function l(){if(!n&&!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 n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==r&&(r(),r=null)}}}function Gb(e){this._internalRoot=e}function Qb(e){this._internalRoot=e}Qb.prototype.render=Gb.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(r(409));fb(t.current,Gc(),e,t,null,null)},Qb.prototype.unmount=Gb.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;fb(e.current,2,null,e,null,null),tu(),t[Ve]=null}},Qb.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fe();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Pb.length&&0!==t&&t<Pb[l].priority;l++);Pb.splice(l,0,e),0===l&&jb(e)}};var Xb=l.version;if("19.2.3"!==Xb)throw Error(r(527,Xb,"19.2.3"));R.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(r(188));throw e=Object.keys(e).join(","),Error(r(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=i(e)))throw Error(r(188));return t!==e?null:e}for(var l=e,n=t;;){var a=l.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(n=a.return)){l=n;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===l)return u(a),e;if(o===n)return u(a),t;o=o.sibling}throw Error(r(188))}if(l.return!==n.return)l=a,n=o;else{for(var s=!1,c=a.child;c;){if(c===l){s=!0,l=a,n=o;break}if(c===n){s=!0,n=a,l=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===l){s=!0,l=o,n=a;break}if(c===n){s=!0,n=o,l=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(l.alternate!==n)throw Error(r(190))}if(3!==l.tag)throw Error(r(188));return l.stateNode.current===l?e:t}(t),e=null===(e=null!==e?d(e):null)?null:e.stateNode};var Yb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.3"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Jb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jb.isDisabled&&Jb.supportsFiber)try{ye=Jb.inject(Yb),we=Jb}catch(em){}}return T.createRoot=function(e,t){if(!a(e))throw Error(r(299));var l=!1,n="",i=Eo,o=$o,s=_o;return null!=t&&(!0===t.unstable_strictMode&&(l=!0),void 0!==t.identifierPrefix&&(n=t.identifierPrefix),void 0!==t.onUncaughtError&&(i=t.onUncaughtError),void 0!==t.onCaughtError&&(o=t.onCaughtError),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=hb(e,1,!1,null,0,l,n,null,i,o,s,Kb),e[Ve]=t.current,td(e),new Gb(t)},T.hydrateRoot=function(e,t,l){if(!a(e))throw Error(r(299));var n=!1,i="",o=Eo,s=$o,c=_o,u=null;return null!=l&&(!0===l.unstable_strictMode&&(n=!0),void 0!==l.identifierPrefix&&(i=l.identifierPrefix),void 0!==l.onUncaughtError&&(o=l.onUncaughtError),void 0!==l.onCaughtError&&(s=l.onCaughtError),void 0!==l.onRecoverableError&&(c=l.onRecoverableError),void 0!==l.formState&&(u=l.formState)),(t=hb(e,1,!0,t,0,n,i,u,o,s,c,Kb)).context=pb(null),l=t.current,(i=wa(n=Oe(n=Gc()))).callback=null,xa(l,i,n),l=n,t.current.lanes=l,Me(t,l),Ru(t),e[Ve]=t.current,td(e),new Qb(t)},T.version="19.2.3",T}var M=($||($=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)}}(),_.exports=I()),_.exports);const P=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),l=this.shouldUseMobileStyles(e,1024)&&!t;e.classList.toggle("limbo-mobile-fallback",t),e.classList.toggle("limbo-tablet-fallback",l),e.classList.toggle("limbo-desktop-fallback",!t&&!l)}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 D(e={}){const{useContainerQuery:n=!1,containerElement:r=null}=e,[a,i]=t(()=>{const e=n&&r?P.getContainerWidth(r):"undefined"!=typeof window?window.innerWidth:0,t="undefined"!=typeof window&&(e<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)),l="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);return{isMobile:t,isTouch:l,isTablet:"undefined"!=typeof window&&(e>768&&e<=1024&&l),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:P.supportsContainerQueries}}});l(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,l=n&&r?P.getContainerWidth(r):e,a=l<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),o="ontouchstart"in window||navigator.maxTouchPoints>0;i({isMobile:a,isTouch:o,isTablet:l>768&&l<=1024&&o,orientation:t>e?"portrait":"landscape",viewport:{width:e,height:t},container:{width:l,supportsContainerQueries:P.supportsContainerQueries}})};let t;const l=()=>{clearTimeout(t),t=setTimeout(e,150)};return window.addEventListener("resize",l),window.addEventListener("orientationchange",()=>{setTimeout(e,100)}),()=>{clearTimeout(t),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",e)}},[n,r]);const o="portrait"===a.orientation,s="landscape"===a.orientation,c=a.isMobile||a.isTablet&&o;return{...a,isPortrait:o,isLandscape:s,isCompactMode:c,isMobileSize:a.viewport.width<=640,isTabletSize:a.viewport.width>640&&a.viewport.width<=1024,isDesktopSize:a.viewport.width>1024,deviceClass:a.isMobile?"mobile":a.isTablet?"tablet":"desktop"}}function R({tabs:e,active:t,onChange:l}){const{isMobile:n,isTouch:r}=D(),a=["limbo-tabs","lb:flex","lb:gap-4","lb:border-b-2","lb:border-brand-blue-200","lb:mb-6",n&&"lb:overflow-x-auto lb:scrollbar-none"].filter(Boolean).join(" "),i=e=>{const t=["limbo-tab","lb:relative","lb:px-6","lb:py-2","lb:font-medium","lb:text-brand-blue-1000","lb:bg-transparent","lb:border-0","lb:border-b-2","lb:cursor-pointer","lb:transition-all","lb:duration-200","lb:hover:text-pink-1000","lb:focus:outline-none","lb:focus-visible:ring-2","lb:focus-visible:ring-brand-blue-400","lb:focus-visible:ring-offset-2","lb:min-h-[44px]","lb:min-w-[44px]"];return e?t.push("lb:border-b-brand-blue-1000","lb:font-semibold","limbo-active"):t.push("lb:border-b-transparent"),n&&t.push("lb:min-w-[120px]","lb:text-base","lb:shrink-0"),r&&t.push("lb:touch-manipulation"),t.join(" ")};/* @__PURE__ */
|
|
2
|
-
return s("div",{className:a,role:"tablist","aria-label":"Opciones de navegación",style:
|
|
1
|
+
import e,{useState as t,useEffect as n,useRef as l,useMemo as r,useCallback as a,useId as i}from"react";import o from"react-dom";import{jsx as s,jsxs as c,Fragment as u}from"react/jsx-runtime";const d={jpg:["image/jpeg"],jpeg:["image/jpeg"],png:["image/png"],gif:["image/gif"],webp:["image/webp"],svg:["image/svg+xml"],mp4:["video/mp4"],webm:["video/webm"],mov:["video/quicktime"],avi:["video/x-msvideo"],mkv:["video/x-matroska"],pdf:["application/pdf"],doc:["application/msword"],docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],xls:["application/vnd.ms-excel"],xlsx:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],ppt:["application/vnd.ms-powerpoint"],pptx:["application/vnd.openxmlformats-officedocument.presentationml.presentation"],txt:["text/plain"],csv:["text/csv"],json:["application/json"],xml:["application/xml","text/xml"],html:["text/html"],css:["text/css"],js:["text/javascript","application/javascript"],md:["text/markdown"],mp3:["audio/mpeg"],wav:["audio/wav"],ogg:["audio/ogg"],aac:["audio/aac"],flac:["audio/flac"]},b={image:["image/jpeg","image/png","image/webp","image/svg+xml"],video:["image/gif","video/mp4","video/webm","video/quicktime","video/x-msvideo","video/x-matroska"],document:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/csv"],audio:["audio/mpeg","audio/wav","audio/ogg","audio/webm","audio/aac","audio/flac"]},m=/* @__PURE__ */new Set(["jpg","jpeg","png","webp","svg","bmp","tiff","ico"]),h=/* @__PURE__ */new Set(["mp4","webm","mov","avi","mkv","gif"]),p=Object.freeze({categories:[],extensions:[],mimeTypes:[],acceptString:"",includesImages:!0,includesVideos:!0,isAllTypes:!0,raw:null});function f(e){if(!e)return p;const t=Array.isArray(e)?e.join(","):String(e),n=t.split(",").map(e=>e.trim()).filter(Boolean);if(0===n.length)return p;const l=[],r=[],a=/* @__PURE__ */new Set;for(const s of n)if(s.endsWith("/*")){const e=s.replace("/*","");b[e]&&(l.push(e),b[e].forEach(e=>a.add(e)))}else if(s.startsWith(".")){const e=s.slice(1).toLowerCase();r.push(e),(d[e]||[]).forEach(e=>a.add(e))}else s.includes("/")&&a.add(s);const i=l.includes("image")||r.some(e=>m.has(e)),o=l.includes("video")||r.some(e=>h.has(e));return{categories:l,extensions:r,mimeTypes:[...a],acceptString:[...a].join(","),includesImages:i,includesVideos:o,isAllTypes:!1,raw:t}}function g(e){if(!e||e.isAllTypes)return"Todos los formatos";const t=/* @__PURE__ */new Set;for(const n of e.categories)switch(n){case"image":t.add("Imágenes");break;case"video":t.add("Videos");break;case"document":t.add("Documentos");break;case"audio":t.add("Audio")}for(const n of e.extensions)t.add(n.toUpperCase());return[...t].join(", ")||"Todos los formatos"}function v(e,t=!1){const n=t?"Cambiar":"Seleccionar";if(!e)return`${n} archivo`;const l=f(e);if(l.isAllTypes)return`${n} archivo`;const{includesImages:r,includesVideos:a,categories:i}=l,o=i.some(e=>"image"!==e&&"video"!==e);return!r||a||o?!a||r||o?`${n} archivo`:`${n} vídeo`:`${"Cambiar"==n?"Editar":n} imagen`}const y={es:{"button.select":"Seleccionar","button.upload":"Subir archivo","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 archivo...","message.processing":"Procesando...","message.no_images":"No hay archivos disponibles","message.upload_success":"Archivo subido correctamente","message.upload_error":"Error al subir el archivo","message.delete_confirm":"¿Estás seguro de que deseas eliminar este archivo? 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 archivos...","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","imageCard.aria.zoom":"Ampliar {filename}","imageCard.aria.zoomPreview":"Previsualizar {filename}","imageCard.aria.zoomWithCrops":"Ver {n} recortes de {filename}","imageCard.aria.crop":"Recortar {filename}","imageCard.aria.copyUrl":"Copiar URL de {filename}","imageCard.aria.copied":"URL copiada","imageCard.aria.download":"Descargar {filename}","imageCard.aria.rename":"Renombrar {filename}","imageCard.aria.delete":"Eliminar {filename}","aiStarter.label":"Instrucciones base","aiStarter.copy":"Copiar","aiStarter.copied":"Copiado","aiStarter.copyAriaLabel":"Copiar instrucciones base","aiStarter.readMore":"Leer más","aiStarter.readLess":"Leer menos","tags.input.placeholder":"Escribir etiqueta...","tags.input.labelOptional":"Etiquetas (opcional)","tags.input.label":"Etiquetas","tags.input.hint":"Pulsa espacio o coma para confirmar","tags.input.ariaLabel":"Añadir etiquetas","tags.autocomplete.empty":"Sin resultados","tags.section.label":"Etiquetas","tags.search.placeholder":"Buscar por nombre o etiqueta...","tags.pill.ariaDelete":"Eliminar etiqueta {tag}","editAssetModal.title":"Editar asset","editAssetModal.nameLabel":"Nombre","editAssetModal.close":"Cerrar","editAssetModal.save":"Guardar cambios","editAssetModal.cancel":"Cancelar","editAssetModal.saveError":"Error al guardar. Inténtalo de nuevo.","imageCard.editButton":"Editar asset"},en:{"button.select":"Select","button.upload":"Upload file","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 file...","message.processing":"Processing...","message.no_images":"No files available","message.upload_success":"File uploaded successfully","message.upload_error":"Error uploading file","message.delete_confirm":"Are you sure you want to delete this file?","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 files...","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","imageCard.aria.zoom":"Enlarge {filename}","imageCard.aria.zoomPreview":"Preview {filename}","imageCard.aria.zoomWithCrops":"View {n} crops of {filename}","imageCard.aria.crop":"Crop {filename}","imageCard.aria.copyUrl":"Copy URL of {filename}","imageCard.aria.copied":"URL copied","imageCard.aria.download":"Download {filename}","imageCard.aria.rename":"Rename {filename}","imageCard.aria.delete":"Delete {filename}","aiStarter.label":"Base instructions","aiStarter.copy":"Copy","aiStarter.copied":"Copied","aiStarter.copyAriaLabel":"Copy base instructions","aiStarter.readMore":"Read more","aiStarter.readLess":"Read less","tags.input.placeholder":"Add tag...","tags.input.labelOptional":"Tags (optional)","tags.input.label":"Tags","tags.input.hint":"Press space or comma to confirm","tags.input.ariaLabel":"Add tags","tags.autocomplete.empty":"No results","tags.section.label":"Tags","tags.search.placeholder":"Search by name or tag...","tags.pill.ariaDelete":"Remove tag {tag}","editAssetModal.title":"Edit asset","editAssetModal.nameLabel":"Name","editAssetModal.close":"Close","editAssetModal.save":"Save changes","editAssetModal.cancel":"Cancel","editAssetModal.saveError":"Error saving. Please try again.","imageCard.editButton":"Edit asset"},pt:{"imageCard.aria.zoom":"Ampliar {filename}","imageCard.aria.zoomPreview":"Pré-visualizar {filename}","imageCard.aria.zoomWithCrops":"Ver {n} recortes de {filename}","imageCard.aria.crop":"Recortar {filename}","imageCard.aria.copyUrl":"Copiar URL de {filename}","imageCard.aria.copied":"URL copiada","imageCard.aria.download":"Descarregar {filename}","imageCard.aria.rename":"Renomear {filename}","imageCard.aria.delete":"Eliminar {filename}","aiStarter.label":"Instruções base","aiStarter.copy":"Copiar","aiStarter.copied":"Copiado","aiStarter.copyAriaLabel":"Copiar instruções base","aiStarter.readMore":"Ler mais","aiStarter.readLess":"Ler menos","tags.input.placeholder":"Adicionar etiqueta...","tags.input.labelOptional":"Etiquetas (opcional)","tags.input.label":"Etiquetas","tags.input.hint":"Prima espaço ou vírgula para confirmar","tags.input.ariaLabel":"Adicionar etiquetas","tags.autocomplete.empty":"Sem resultados","tags.section.label":"Etiquetas","tags.search.placeholder":"Pesquisar por nome ou etiqueta...","tags.pill.ariaDelete":"Remover etiqueta {tag}","editAssetModal.title":"Editar asset","editAssetModal.nameLabel":"Nome","editAssetModal.close":"Fechar","editAssetModal.save":"Guardar alterações","editAssetModal.cancel":"Cancelar","editAssetModal.saveError":"Erro ao guardar. Tente novamente.","imageCard.editButton":"Editar asset"},fr:{"imageCard.aria.zoom":"Agrandir {filename}","imageCard.aria.zoomPreview":"Prévisualiser {filename}","imageCard.aria.zoomWithCrops":"Voir {n} recadrages de {filename}","imageCard.aria.crop":"Recadrer {filename}","imageCard.aria.copyUrl":"Copier l'URL de {filename}","imageCard.aria.copied":"URL copiée","imageCard.aria.download":"Télécharger {filename}","imageCard.aria.rename":"Renommer {filename}","imageCard.aria.delete":"Supprimer {filename}","aiStarter.label":"Instructions de base","aiStarter.copy":"Copier","aiStarter.copied":"Copié","aiStarter.copyAriaLabel":"Copier les instructions de base","aiStarter.readMore":"Lire plus","aiStarter.readLess":"Lire moins","tags.input.placeholder":"Ajouter un tag...","tags.input.labelOptional":"Étiquettes (optionnel)","tags.input.label":"Étiquettes","tags.input.hint":"Appuyez sur espace ou virgule pour confirmer","tags.input.ariaLabel":"Ajouter des étiquettes","tags.autocomplete.empty":"Aucun résultat","tags.section.label":"Étiquettes","tags.search.placeholder":"Rechercher par nom ou tag...","tags.pill.ariaDelete":"Supprimer l'étiquette {tag}","editAssetModal.title":"Modifier le fichier","editAssetModal.nameLabel":"Nom","editAssetModal.close":"Fermer","editAssetModal.save":"Enregistrer les modifications","editAssetModal.cancel":"Annuler","editAssetModal.saveError":"Erreur lors de l'enregistrement. Réessayez.","imageCard.editButton":"Modifier l'asset"}};class w{constructor(e="es",t={}){this.locale=e,this.messages=this._mergeMessages(t)}_mergeMessages(e){const t={...y};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)}}const x=new w;function k(e,t={}){return x.t(e,t)}class C{constructor(){this.globalConfig={},this.defaults={container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop","rename"],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,showTypeFilter:!1,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{accept:null,maxSize:"10MB",formats:["jpg","jpeg","png","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,allowedCategories:null},folders:{include:[],exclude:[],includeNoFolder:!0,showFolderSelector:!0,showFolderFilter:!0,showFolderInfo:!0,allowMoveFolder:!0,allowCreateFolder:!0,defaultFolder:null},downloadFormat:"webp",return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar archivo",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,aiStarterPrompt:"Editorial corporate photography, authentic human moments, warm cinematic lighting, natural professional interaction, premium contemporary aesthetic, subtle shadows, asymmetrical editorial composition, intentional negative space, non-stock photography style, refined warm-neutral color palette with beige, soft whites, warm browns, deep burgundy and navy blue tones, understated sophistication, realistic office atmosphere. Avoid: fake smiles, corporate posing, flat lighting, overly clean scenes, oversaturated colors, generic stock photo aesthetic."}}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 l=t.split("."),r=l.pop();l.reduce((e,t)=>(e[t]&&"object"==typeof e[t]||(e[t]={}),e[t]),e)[r]=n}_getOriginalDefaults(){return{container:"#limbo-default",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],ui:{showActions:["select","download","copy","delete","crop","rename"],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,showTypeFilter:!1,enabledFilters:["name","date"],customFilters:[]},loading:{showPlaceholders:!0,placeholderCount:10,showSpinner:!0},pagination:{itemsPerPage:20,showPageSize:!0}},validation:{accept:null,maxSize:"10MB",formats:["jpg","jpeg","png","svg","webp","gif"],minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,allowedCategories:null},folders:{include:[],exclude:[],includeNoFolder:!0,showFolderSelector:!1,showFolderFilter:!1,showFolderInfo:!0,allowMoveFolder:!0,allowCreateFolder:!0,defaultFolder:null},return:{format:"url",autoAssign:!0,includeMetadata:!1},autoInputs:{dataset:"data-limbo-input-file",buttonText:"Seleccionar archivo",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 l=e.presets||this.defaults.presets;return"aspect"===n?l.aspects?.find(e=>e.name===t):"size"===n?l.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 w(n,t.messages)}validate(e){const t=[],n=this._deepMerge(this.globalConfig.auth||{},e.auth||{}),l=e.apiKey||this.globalConfig.apiKey;if("jwt"!==n.authMode&&l||n.apiKey||t.push("auth.apiKey es requerido para autenticación JWT"),"legacy"!==n.authMode||l||t.push("apiKey es requerido para modo legacy"),n.apiKey||l||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 l={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",l),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}getFolderConfig(e=null){return(e||this.merge()).folders||this.defaults.folders}hasFolderFilters(e=null){const t=this.getFolderConfig(e);return t.include?.length>0||t.exclude?.length>0}getFolderApiParams(e=null){const t=this.getFolderConfig(e),n={};return t.include?.length>0?n.folders_include=t.include.join(","):t.exclude?.length>0&&(n.folders_exclude=t.exclude.join(",")),this.hasFolderFilters(e)&&void 0!==t.includeNoFolder&&(n.include_no_folder=t.includeNoFolder?"1":"0"),n}showFolderSelectorInUpload(e=null){const t=e||this.merge();return!0===t.folders?.showFolderSelector}showFolderFilterInGallery(e=null){const t=e||this.merge();return!0===t.folders?.showFolderFilter}canCreateFolder(e=null){const t=e||this.merge();return!1!==t.folders?.allowCreateFolder}getDefaultUploadFolder(e=null){const t=e||this.merge();return t.folders?.defaultFolder||null}getAllowedFolderSlugs(e=null){const t=e||this.merge(),n=t.folders?.include;return n&&n.length>0?n:null}getAllowedCategories(e=null){const t=e||this.merge();return t.validation?.allowedCategories||null}isCategoryAllowed(e,t=null){const n=this.getAllowedCategories(t);return null===n||n.includes(e)}isMultiTypeEnabled(e=null){const t=this.getAllowedCategories(e);return null===t||(t.length>1||1===t.length&&"image"!==t[0])}showTypeFilter(e=null){const t=e||this.merge();return!0===t.gallery?.filters?.showTypeFilter}getTypeFilterOptions(e=null){const t=this.getAllowedCategories(e),n=[{value:"",label:"Todos los tipos"},{value:"image",label:"Imágenes"},{value:"video",label:"Videos"},{value:"document",label:"Documentos"},{value:"audio",label:"Audio"}];return null===t?n:n.filter(e=>""===e.value||t.includes(e.value))}getResolvedAccept(e=null){const t=e||this.merge();return t.validation?.accept?f(t.validation.accept):t.validation?.allowedCategories?f(t.validation.allowedCategories.map(e=>`${e}/*`).join(",")):f(null)}}var S,N,E,$,_={exports:{}},T={},A={exports:{}},z={};function L(){return N||(N=1,A.exports=(S||(S=1,function(e){function t(e,t){var n=e.length;e.push(t);e:for(;0<n;){var l=n-1>>>1,a=e[l];if(!(0<r(a,t)))break e;e[l]=t,e[n]=a,n=l}}function n(e){return 0===e.length?null:e[0]}function l(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var l=0,a=e.length,i=a>>>1;l<i;){var o=2*(l+1)-1,s=e[o],c=o+1,u=e[c];if(0>r(s,n))c<a&&0>r(u,s)?(e[l]=u,e[c]=n,l=c):(e[l]=s,e[o]=n,l=o);else{if(!(c<a&&0>r(u,n)))break e;e[l]=u,e[c]=n,l=c}}}return t}function r(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 a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var s=[],c=[],u=1,d=null,b=3,m=!1,h=!1,p=!1,f=!1,g="function"==typeof setTimeout?setTimeout:null,v="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var r=n(c);null!==r;){if(null===r.callback)l(c);else{if(!(r.startTime<=e))break;l(c),r.sortIndex=r.expirationTime,t(s,r)}r=n(c)}}function x(e){if(p=!1,w(e),!h)if(null!==n(s))h=!0,C||(C=!0,k());else{var t=n(c);null!==t&&z(x,t.startTime-e)}}var k,C=!1,S=-1,N=5,E=-1;function $(){return!(!f&&e.unstable_now()-E<N)}function _(){if(f=!1,C){var t=e.unstable_now();E=t;var r=!0;try{e:{h=!1,p&&(p=!1,v(S),S=-1),m=!0;var a=b;try{t:{for(w(t),d=n(s);null!==d&&!(d.expirationTime>t&&$());){var i=d.callback;if("function"==typeof i){d.callback=null,b=d.priorityLevel;var o=i(d.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof o){d.callback=o,w(t),r=!0;break t}d===n(s)&&l(s),w(t)}else l(s);d=n(s)}if(null!==d)r=!0;else{var u=n(c);null!==u&&z(x,u.startTime-t),r=!1}}break e}finally{d=null,b=a,m=!1}r=void 0}}finally{r?k():C=!1}}}if("function"==typeof y)k=function(){y(_)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,A=T.port2;T.port1.onmessage=_,k=function(){A.postMessage(null)}}else k=function(){g(_,0)};function z(t,n){S=g(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 b},e.unstable_next=function(e){switch(b){case 1:case 2:case 3:var t=3;break;default:t=b}var n=b;b=t;try{return e()}finally{b=n}},e.unstable_requestPaint=function(){f=!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=b;b=e;try{return t()}finally{b=n}},e.unstable_scheduleCallback=function(l,r,a){var i=e.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?i+a:i,l){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return l={id:u++,callback:r,priorityLevel:l,startTime:a,expirationTime:o=a+o,sortIndex:-1},a>i?(l.sortIndex=a,t(c,l),null===n(s)&&l===n(c)&&(p?(v(S),S=-1):p=!0,z(x,a-i))):(l.sortIndex=o,t(s,l),h||m||(h=!0,C||(C=!0,k()))),l},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(e){var t=b;return function(){var n=b;b=t;try{return e.apply(this,arguments)}finally{b=n}}}}(z)),z)),A.exports}function M(){if(E)return T;E=1;var t=L(),n=e,l=o;function r(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 a(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function i(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(i(e)!==e)throw Error(r(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 b=Object.assign,m=/* @__PURE__ */Symbol.for("react.element"),h=/* @__PURE__ */Symbol.for("react.transitional.element"),p=/* @__PURE__ */Symbol.for("react.portal"),f=/* @__PURE__ */Symbol.for("react.fragment"),g=/* @__PURE__ */Symbol.for("react.strict_mode"),v=/* @__PURE__ */Symbol.for("react.profiler"),y=/* @__PURE__ */Symbol.for("react.consumer"),w=/* @__PURE__ */Symbol.for("react.context"),x=/* @__PURE__ */Symbol.for("react.forward_ref"),k=/* @__PURE__ */Symbol.for("react.suspense"),C=/* @__PURE__ */Symbol.for("react.suspense_list"),S=/* @__PURE__ */Symbol.for("react.memo"),N=/* @__PURE__ */Symbol.for("react.lazy"),$=/* @__PURE__ */Symbol.for("react.activity"),_=/* @__PURE__ */Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function z(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 P(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 f:return"Fragment";case v:return"Profiler";case g:return"StrictMode";case k:return"Suspense";case C:return"SuspenseList";case $:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case p:return"Portal";case w:return e.displayName||"Context";case y:return(e._context.displayName||"Context")+".Consumer";case x:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case S:return null!==(t=e.displayName||null)?t:P(e.type)||"Memo";case N:t=e._payload,e=e._init;try{return P(e(t))}catch(n){}}return null}var I=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},F=[],j=-1;function U(e){return{current:e}}function B(e){0>j||(e.current=F[j],F[j]=null,j--)}function q(e,t){j++,F[j]=e.current,e.current=t}var W,V,H=U(null),K=U(null),G=U(null),Q=U(null);function X(e,t){switch(q(G,t),q(K,e),q(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=wd(t=yd(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(H),q(H,e)}function Y(){B(H),B(K),B(G)}function J(e){null!==e.memoizedState&&q(Q,e);var t=H.current,n=wd(t,e.type);t!==n&&(q(K,e),q(H,n))}function Z(e){K.current===e&&(B(H),B(K)),Q.current===e&&(B(Q),bb._currentValue=O)}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 l={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(r){var l=r}Reflect.construct(e,[],n)}else{try{n.call()}catch(a){l=a}e.call(n.prototype)}}else{try{throw Error()}catch(i){l=i}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(o){if(o&&l&&"string"==typeof o.stack)return[o.stack,l.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=l.DetermineComponentFrameRoot(),i=a[0],o=a[1];if(i&&o){var s=i.split("\n"),c=o.split("\n");for(r=l=0;l<s.length&&!s[l].includes("DetermineComponentFrameRoot");)l++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(l===s.length||r===c.length)for(l=s.length-1,r=c.length-1;1<=l&&0<=r&&s[l]!==c[r];)r--;for(;1<=l&&0<=r;l--,r--)if(s[l]!==c[r]){if(1!==l||1!==r)do{if(l--,0>--r||s[l]!==c[r]){var u="\n"+s[l].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}}while(1<=l&&0<=r);break}}}finally{te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ee(n):""}function le(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 re(e){try{var t="",n=null;do{t+=le(e,n),n=e,e=e.return}while(e);return t}catch(l){return"\nError generating stack: "+l.message+"\n"+l.stack}}var ae=Object.prototype.hasOwnProperty,ie=t.unstable_scheduleCallback,oe=t.unstable_cancelCallback,se=t.unstable_shouldYield,ce=t.unstable_requestPaint,ue=t.unstable_now,de=t.unstable_getCurrentPriorityLevel,be=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,he=t.unstable_NormalPriority,pe=t.unstable_LowPriority,fe=t.unstable_IdlePriority,ge=t.log,ve=t.unstable_setDisableYieldValue,ye=null,we=null;function xe(e){if("function"==typeof ge&&ve(e),we&&"function"==typeof we.setStrictMode)try{we.setStrictMode(ye,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 Te(e,t,n){var l=e.pendingLanes;if(0===l)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=134217727&l;return 0!==o?0!==(l=o&~a)?r=_e(l):0!==(i&=o)?r=_e(i):n||0!==(n=o&~e)&&(r=_e(n)):0!==(o=l&~a)?r=_e(o):0!==i?r=_e(i):n||0!==(n=l&~e)&&(r=_e(n)),0===r?0:0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(n=t&-t)||32===a&&4194048&n)?t:r}function Ae(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function ze(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 Le(){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 Pe(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ie(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-ke(t);e.entangledLanes|=t,e.entanglements[l]=1073741824|e.entanglements[l]|261930&n}function De(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-ke(n),r=1<<l;r&t|e[l]&t&&(e[l]|=t),n&=~r}}function Re(e,t){var n=t&-t;return 0!==((n=42&n?1:Oe(n))&(e.suspendedLanes|t))?0:n}function Oe(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 Fe(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function je(){var e=R.p;return 0!==e?e:void 0===(e=window.event)?32:_b(e.type)}function Ue(e,t){var n=R.p;try{return R.p=e,t()}finally{R.p=n}}var Be=Math.random().toString(36).slice(2),qe="__reactFiber$"+Be,We="__reactProps$"+Be,Ve="__reactContainer$"+Be,He="__reactEvents$"+Be,Ke="__reactListeners$"+Be,Ge="__reactHandles$"+Be,Qe="__reactResources$"+Be,Xe="__reactMarker$"+Be;function Ye(e){delete e[qe],delete e[We],delete e[He],delete e[Ke],delete e[Ge]}function Je(e){var t=e[qe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ve]||n[qe]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Od(e);null!==e;){if(n=e[qe])return n;e=Od(e)}return t}n=(e=n).parentNode}return null}function Ze(e){if(e=e[qe]||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(r(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[Xe]=!0}var lt=/* @__PURE__ */new Set,rt={};function at(e,t){it(e,t),it(e+"Capture",t)}function it(e,t){for(rt[e]=t,e=0;e<t.length;e++)lt.add(t[e])}var ot=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(r=t,ae.call(ct,r)||!ae.call(st,r)&&(ot.test(r)?ct[r]=!0:(st[r]=!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 l=t.toLowerCase().slice(0,5);if("data-"!==l&&"aria-"!==l)return void e.removeAttribute(t)}e.setAttribute(t,""+n)}var r}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 bt(e,t,n,l){if(null===l)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(n)}e.setAttributeNS(t,n,""+l)}}function mt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function ht(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function pt(e){if(!e._valueTracker){var t=ht(e)?"checked":"value";e._valueTracker=function(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==l&&"function"==typeof l.get&&"function"==typeof l.set){var r=l.get,a=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){n=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function ft(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=ht(e)?e.checked?"true":"false":e.value),(e=l)!==n&&(t.setValue(e),!0)}function gt(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 vt=/[\n"\\]/g;function yt(e){return e.replace(vt,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function wt(e,t,n,l,r,a,i,o){e.name="",null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.type=i:e.removeAttribute("type"),null!=t?"number"===i?(0===t&&""===e.value||e.value!=t)&&(e.value=""+mt(t)):e.value!==""+mt(t)&&(e.value=""+mt(t)):"submit"!==i&&"reset"!==i||e.removeAttribute("value"),null!=t?kt(e,i,mt(t)):null!=n?kt(e,i,mt(n)):null!=l&&e.removeAttribute("value"),null==r&&null!=a&&(e.defaultChecked=!!a),null!=r&&(e.checked=r&&"function"!=typeof r&&"symbol"!=typeof r),null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.name=""+mt(o):e.removeAttribute("name")}function xt(e,t,n,l,r,a,i,o){if(null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.type=a),null!=t||null!=n){if(("submit"===a||"reset"===a)&&null==t)return void pt(e);n=null!=n?""+mt(n):"",t=null!=t?""+mt(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}l="function"!=typeof(l=null!=l?l:r)&&"symbol"!=typeof l&&!!l,e.checked=o?e.checked:!!l,e.defaultChecked=!!l,null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.name=i),pt(e)}function kt(e,t,n){"number"===t&>(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ct(e,t,n,l){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&l&&(e[n].defaultSelected=!0)}else{for(n=""+mt(n),t=null,r=0;r<e.length;r++){if(e[r].value===n)return e[r].selected=!0,void(l&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function St(e,t,n){null==t||((t=""+mt(t))!==e.value&&(e.value=t),null!=n)?e.defaultValue=null!=n?""+mt(n):"":e.defaultValue!==t&&(e.defaultValue=t)}function Nt(e,t,n,l){if(null==t){if(null!=l){if(null!=n)throw Error(r(92));if(I(l)){if(1<l.length)throw Error(r(93));l=l[0]}n=l}null==n&&(n=""),t=n}n=mt(t),e.defaultValue=n,(l=e.textContent)===n&&""!==l&&null!==l&&(e.value=l),pt(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 l=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?l?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":l?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 Tt(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(r(62));if(e=e.style,null!=n){for(var l in n)!n.hasOwnProperty(l)||null!=t&&t.hasOwnProperty(l)||(0===l.indexOf("--")?e.setProperty(l,""):"float"===l?e.cssFloat="":e[l]="");for(var a in t)l=t[a],t.hasOwnProperty(a)&&n[a]!==l&&_t(e,a,l)}else for(var i in t)t.hasOwnProperty(i)&&_t(e,i,t[i])}function At(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 zt=/* @__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"]]),Lt=/^[\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 Lt.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Pt(){}var It=null;function Dt(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Rt=null,Ot=null;function Ft(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="'+yt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var a=l[We]||null;if(!a)throw Error(r(90));wt(l,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)(l=n[t]).form===e.form&&ft(l)}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 jt=!1;function Ut(e,t,n){if(jt)return e(t,n);jt=!0;try{return e(t)}finally{if(jt=!1,(null!==Rt||null!==Ot)&&(tu(),Rt&&(t=Rt,e=Ot,Ot=Rt=null,Ft(t),e)))for(t=0;t<e.length;t++)Ft(e[t])}}function Bt(e,t){var n=e.stateNode;if(null===n)return null;var l=n[We]||null;if(null===l)return null;n=l[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":(l=!l.disabled)||(l=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!l;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(r(231,t,typeof n));return n}var qt=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),Wt=!1;if(qt)try{var Vt={};Object.defineProperty(Vt,"passive",{get:function(){Wt=!0}}),window.addEventListener("test",Vt,Vt),window.removeEventListener("test",Vt,Vt)}catch(Zb){Wt=!1}var Ht=null,Kt=null,Gt=null;function Qt(){if(Gt)return Gt;var e,t,n=Kt,l=n.length,r="value"in Ht?Ht.value:Ht.textContent,a=r.length;for(e=0;e<l&&n[e]===r[e];e++);var i=l-e;for(t=1;t<=i&&n[l-t]===r[a-t];t++);return Gt=r.slice(e,1<t?1-t:void 0)}function Xt(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 Yt(){return!0}function Jt(){return!1}function Zt(e){function t(t,n,l,r,a){for(var i in this._reactName=t,this._targetInst=l,this.type=n,this.nativeEvent=r,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(r):r[i]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?Yt:Jt,this.isPropagationStopped=Jt,this}return b(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=Yt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Yt)},persist:function(){},isPersistent:Yt}),t}var en,tn,nn,ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rn=Zt(ln),an=b({},ln,{view:0,detail:0}),on=Zt(an),sn=b({},an,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yn,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(b({},sn,{dataTransfer:0})),dn=Zt(b({},an,{relatedTarget:0})),bn=Zt(b({},ln,{animationName:0,elapsedTime:0,pseudoElement:0})),mn=Zt(b({},ln,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),hn=Zt(b({},ln,{data:0})),pn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fn={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"},gn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=gn[e])&&!!t[e]}function yn(){return vn}var wn=Zt(b({},an,{key:function(e){if(e.key){var t=pn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Xt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?fn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:yn,charCode:function(e){return"keypress"===e.type?Xt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Xt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),xn=Zt(b({},sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=Zt(b({},an,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yn})),Cn=Zt(b({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),Sn=Zt(b({},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(b({},ln,{newState:0,oldState:0})),En=[9,13,27,32],$n=qt&&"CompositionEvent"in window,_n=null;qt&&"documentMode"in document&&(_n=document.documentMode);var Tn=qt&&"TextEvent"in window&&!_n,An=qt&&(!$n||_n&&8<_n&&11>=_n),zn=String.fromCharCode(32),Ln=!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 Pn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var In=!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 Rn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Dn[e.type]:"textarea"===t}function On(e,t,n,l){Rt?Ot?Ot.push(l):Ot=[l]:Rt=l,0<(t=ad(t,"onChange")).length&&(n=new rn("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Fn=null,jn=null;function Un(e){Yu(e,0)}function Bn(e){if(ft(et(e)))return e}function qn(e,t){if("change"===e)return t}var Wn=!1;if(qt){var Vn;if(qt){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(){Fn&&(Fn.detachEvent("onpropertychange",Qn),jn=Fn=null)}function Qn(e){if("value"===e.propertyName&&Bn(jn)){var t=[];On(t,jn,e,Dt(e)),Ut(Un,t)}}function Xn(e,t,n){"focusin"===e?(Gn(),jn=n,(Fn=t).attachEvent("onpropertychange",Qn)):"focusout"===e&&Gn()}function Yn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Bn(jn)}function Jn(e,t){if("click"===e)return Bn(t)}function Zn(e,t){if("input"===e||"change"===e)return Bn(t)}var el="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function tl(e,t){if(el(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var r=n[l];if(!ae.call(t,r)||!el(e[r],t[r]))return!1}return!0}function nl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ll(e,t){var n,l=nl(e);for(e=0;l;){if(3===l.nodeType){if(n=e+l.textContent.length,e<=t&&n>=t)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=nl(l)}}function rl(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?rl(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function al(e){for(var t=gt((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(l){n=!1}if(!n)break;t=gt((e=t.contentWindow).document)}return t}function il(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 ol=qt&&"documentMode"in document&&11>=document.documentMode,sl=null,cl=null,ul=null,dl=!1;function bl(e,t,n){var l=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;dl||null==sl||sl!==gt(l)||("selectionStart"in(l=sl)&&il(l)?l={start:l.selectionStart,end:l.selectionEnd}:l={anchorNode:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset},ul&&tl(ul,l)||(ul=l,0<(l=ad(cl,"onSelect")).length&&(t=new rn("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=sl)))}function ml(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var hl={animationend:ml("Animation","AnimationEnd"),animationiteration:ml("Animation","AnimationIteration"),animationstart:ml("Animation","AnimationStart"),transitionrun:ml("Transition","TransitionRun"),transitionstart:ml("Transition","TransitionStart"),transitioncancel:ml("Transition","TransitionCancel"),transitionend:ml("Transition","TransitionEnd")},pl={},fl={};function gl(e){if(pl[e])return pl[e];if(!hl[e])return e;var t,n=hl[e];for(t in n)if(n.hasOwnProperty(t)&&t in fl)return pl[e]=n[t];return e}qt&&(fl=document.createElement("div").style,"AnimationEvent"in window||(delete hl.animationend.animation,delete hl.animationiteration.animation,delete hl.animationstart.animation),"TransitionEvent"in window||delete hl.transitionend.transition);var vl=gl("animationend"),yl=gl("animationiteration"),wl=gl("animationstart"),xl=gl("transitionrun"),kl=gl("transitionstart"),Cl=gl("transitioncancel"),Sl=gl("transitionend"),Nl=/* @__PURE__ */new Map,El="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 $l(e,t){Nl.set(e,t),at(t,[e])}El.push("scrollEnd");var _l="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)},Tl=[],Al=0,zl=0;function Ll(){for(var e=Al,t=zl=Al=0;t<e;){var n=Tl[t];Tl[t++]=null;var l=Tl[t];Tl[t++]=null;var r=Tl[t];Tl[t++]=null;var a=Tl[t];if(Tl[t++]=null,null!==l&&null!==r){var i=l.pending;null===i?r.next=r:(r.next=i.next,i.next=r),l.pending=r}0!==a&&Dl(n,r,a)}}function Ml(e,t,n,l){Tl[Al++]=e,Tl[Al++]=t,Tl[Al++]=n,Tl[Al++]=l,zl|=l,e.lanes|=l,null!==(e=e.alternate)&&(e.lanes|=l)}function Pl(e,t,n,l){return Ml(e,t,n,l),Rl(e)}function Il(e,t){return Ml(e,null,null,t),Rl(e)}function Dl(e,t,n){e.lanes|=n;var l=e.alternate;null!==l&&(l.lanes|=n);for(var r=!1,a=e.return;null!==a;)a.childLanes|=n,null!==(l=a.alternate)&&(l.childLanes|=n),22===a.tag&&(null===(e=a.stateNode)||1&e._visibility||(r=!0)),e=a,a=a.return;return 3===e.tag?(a=e.stateNode,r&&null!==t&&(r=31-ke(n),null===(l=(e=a.hiddenUpdates)[r])?e[r]=[t]:l.push(t),t.lane=536870912|n),a):null}function Rl(e){if(50<Hc)throw Hc=0,Kc=null,Error(r(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var Ol={};function Fl(e,t,n,l){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=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jl(e,t,n,l){return new Fl(e,t,n,l)}function Ul(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Bl(e,t){var n=e.alternate;return null===n?((n=jl(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 ql(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 Wl(e,t,n,l,a,i){var o=0;if(l=e,"function"==typeof e)Ul(e)&&(o=1);else if("string"==typeof e)o=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 $:return(e=jl(31,n,t,a)).elementType=$,e.lanes=i,e;case f:return Vl(n.children,a,i,t);case g:o=8,a|=24;break;case v:return(e=jl(12,n,t,2|a)).elementType=v,e.lanes=i,e;case k:return(e=jl(13,n,t,a)).elementType=k,e.lanes=i,e;case C:return(e=jl(19,n,t,a)).elementType=C,e.lanes=i,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case w:o=10;break e;case y:o=9;break e;case x:o=11;break e;case S:o=14;break e;case N:o=16,l=null;break e}o=29,n=Error(r(130,null===e?"null":typeof e,"")),l=null}return(t=jl(o,n,t,a)).elementType=e,t.type=l,t.lanes=i,t}function Vl(e,t,n,l){return(e=jl(7,e,l,t)).lanes=n,e}function Hl(e,t,n){return(e=jl(6,e,null,t)).lanes=n,e}function Kl(e){var t=jl(18,null,null,0);return t.stateNode=e,t}function Gl(e,t,n){return(t=jl(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ql=/* @__PURE__ */new WeakMap;function Xl(e,t){if("object"==typeof e&&null!==e){var n=Ql.get(e);return void 0!==n?n:(t={value:e,source:t,stack:re(t)},Ql.set(e,t),t)}return{value:e,source:t,stack:re(t)}}var Yl=[],Jl=0,Zl=null,er=0,tr=[],nr=0,lr=null,rr=1,ar="";function ir(e,t){Yl[Jl++]=er,Yl[Jl++]=Zl,Zl=e,er=t}function or(e,t,n){tr[nr++]=rr,tr[nr++]=ar,tr[nr++]=lr,lr=e;var l=rr;e=ar;var r=32-ke(l)-1;l&=~(1<<r),n+=1;var a=32-ke(t)+r;if(30<a){var i=r-r%5;a=(l&(1<<i)-1).toString(32),l>>=i,r-=i,rr=1<<32-ke(t)+r|n<<r|l,ar=a+e}else rr=1<<a|n<<r|l,ar=e}function sr(e){null!==e.return&&(ir(e,1),or(e,1,0))}function cr(e){for(;e===Zl;)Zl=Yl[--Jl],Yl[Jl]=null,er=Yl[--Jl],Yl[Jl]=null;for(;e===lr;)lr=tr[--nr],tr[nr]=null,ar=tr[--nr],tr[nr]=null,rr=tr[--nr],tr[nr]=null}function ur(e,t){tr[nr++]=rr,tr[nr++]=ar,tr[nr++]=lr,rr=t.id,ar=t.overflow,lr=e}var dr=null,br=null,mr=!1,hr=null,pr=!1,fr=Error(r(519));function gr(e){throw Cr(Xl(Error(r(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),fr}function vr(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[qe]=e,t[We]=l,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,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ju("invalid",t);break;case"textarea":Ju("invalid",t),Nt(t,l.value,l.defaultValue,l.children)}"string"!=typeof(n=l.children)&&"number"!=typeof n&&"bigint"!=typeof n||t.textContent===""+n||!0===l.suppressHydrationWarning||dd(t.textContent,n)?(null!=l.popover&&(Ju("beforetoggle",t),Ju("toggle",t)),null!=l.onScroll&&Ju("scroll",t),null!=l.onScrollEnd&&Ju("scrollend",t),null!=l.onClick&&(t.onclick=Pt),t=!0):t=!1,t||gr(e,!0)}function yr(e){for(dr=e.return;dr;)switch(dr.tag){case 5:case 31:case 13:return void(pr=!1);case 27:case 3:return void(pr=!0);default:dr=dr.return}}function wr(e){if(e!==dr)return!1;if(!mr)return yr(e),mr=!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&&br&&gr(e),yr(e),13===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));br=Rd(e)}else if(31===n){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));br=Rd(e)}else 27===n?(n=br,_d(e.type)?(e=Dd,Dd=null,br=e):br=n):br=dr?Id(e.stateNode.nextSibling):null;return!0}function xr(){br=dr=null,mr=!1}function kr(){var e=hr;return null!==e&&(null===Lc?Lc=e:Lc.push.apply(Lc,e),hr=null),e}function Cr(e){null===hr?hr=[e]:hr.push(e)}var Sr=U(null),Nr=null,Er=null;function $r(e,t,n){q(Sr,t._currentValue),t._currentValue=n}function _r(e){e._currentValue=Sr.current,B(Sr)}function Tr(e,t,n){for(;null!==e;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==l&&(l.childLanes|=t)):null!==l&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function Ar(e,t,n,l){var a=e.child;for(null!==a&&(a.return=e);null!==a;){var i=a.dependencies;if(null!==i){var o=a.child;i=i.firstContext;e:for(;null!==i;){var s=i;i=a;for(var c=0;c<t.length;c++)if(s.context===t[c]){i.lanes|=n,null!==(s=i.alternate)&&(s.lanes|=n),Tr(i.return,n,e),l||(o=null);break e}i=s.next}}else if(18===a.tag){if(null===(o=a.return))throw Error(r(341));o.lanes|=n,null!==(i=o.alternate)&&(i.lanes|=n),Tr(o,n,e),o=null}else o=a.child;if(null!==o)o.return=a;else for(o=a;null!==o;){if(o===e){o=null;break}if(null!==(a=o.sibling)){a.return=o.return,o=a;break}o=o.return}a=o}}function zr(e,t,n,l){e=null;for(var a=t,i=!1;null!==a;){if(!i)if(524288&a.flags)i=!0;else if(262144&a.flags)break;if(10===a.tag){var o=a.alternate;if(null===o)throw Error(r(387));if(null!==(o=o.memoizedProps)){var s=a.type;el(a.pendingProps.value,o.value)||(null!==e?e.push(s):e=[s])}}else if(a===Q.current){if(null===(o=a.alternate))throw Error(r(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(null!==e?e.push(bb):e=[bb])}a=a.return}null!==e&&Ar(t,e,n,l),t.flags|=262144}function Lr(e){for(e=e.firstContext;null!==e;){if(!el(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Mr(e){Nr=e,Er=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Pr(e){return Dr(Nr,e)}function Ir(e,t){return null===Nr&&Mr(e),Dr(e,t)}function Dr(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},null===Er){if(null===e)throw Error(r(308));Er=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Er=Er.next=t;return n}var Rr="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()})}},Or=t.unstable_scheduleCallback,Fr=t.unstable_NormalPriority,jr={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ur(){return{controller:new Rr,data:/* @__PURE__ */new Map,refCount:0}}function Br(e){e.refCount--,0===e.refCount&&Or(Fr,function(){e.controller.abort()})}var qr=null,Wr=0,Vr=0,Hr=null;function Kr(){if(0===--Wr&&null!==qr){null!==Hr&&(Hr.status="fulfilled");var e=qr;qr=null,Vr=0,Hr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Gr=D.S;D.S=function(e,t){Ic=ue(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===qr){var n=qr=[];Wr=0,Vr=Wu(),Hr={status:"pending",value:void 0,then:function(e){n.push(e)}}}Wr++,t.then(Kr,Kr)}(0,t),null!==Gr&&Gr(e,t)};var Qr=U(null);function Xr(){var e=Qr.current;return null!==e?e:fc.pooledCache}function Yr(e,t){q(Qr,null===t?Qr.current:t.pool)}function Jr(){var e=Xr();return null===e?null:{parent:jr._currentValue,pool:e}}var Zr=Error(r(460)),ea=Error(r(474)),ta=Error(r(542)),na={then:function(){}};function la(e){return"fulfilled"===(e=e.status)||"rejected"===e}function ra(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(Pt,Pt),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw sa(e=t.reason),e;default:if("string"==typeof t.status)t.then(Pt,Pt);else{if(null!==(e=fc)&&100<e.shellSuspendCounter)throw Error(r(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 sa(e=t.reason),e}throw ia=t,Zr}}function aa(e){try{return(0,e._init)(e._payload)}catch(t){if(null!==t&&"object"==typeof t&&"function"==typeof t.then)throw ia=t,Zr;throw t}}var ia=null;function oa(){if(null===ia)throw Error(r(459));var e=ia;return ia=null,e}function sa(e){if(e===Zr||e===ta)throw Error(r(483))}var ca=null,ua=0;function da(e){var t=ua;return ua+=1,null===ca&&(ca=[]),ra(ca,e,t)}function ba(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function ma(e,t){if(t.$$typeof===m)throw Error(r(525));throw e=Object.prototype.toString.call(t),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ha(e){function t(t,n){if(e){var l=t.deletions;null===l?(t.deletions=[n],t.flags|=16):l.push(n)}}function n(n,l){if(!e)return null;for(;null!==l;)t(n,l),l=l.sibling;return null}function l(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 a(e,t){return(e=Bl(e,t)).index=0,e.sibling=null,e}function i(t,n,l){return t.index=l,e?null!==(l=t.alternate)?(l=l.index)<n?(t.flags|=67108866,n):l:(t.flags|=67108866,n):(t.flags|=1048576,n)}function o(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function s(e,t,n,l){return null===t||6!==t.tag?((t=Hl(n,e.mode,l)).return=e,t):((t=a(t,n)).return=e,t)}function c(e,t,n,l){var r=n.type;return r===f?d(e,t,n.props.children,l,n.key):null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===N&&aa(r)===t.type)?(ba(t=a(t,n.props),n),t.return=e,t):(ba(t=Wl(n.type,n.key,n.props,null,e.mode,l),n),t.return=e,t)}function u(e,t,n,l){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Gl(n,e.mode,l)).return=e,t):((t=a(t,n.children||[])).return=e,t)}function d(e,t,n,l,r){return null===t||7!==t.tag?((t=Vl(n,e.mode,l,r)).return=e,t):((t=a(t,n)).return=e,t)}function b(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Hl(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case h:return ba(n=Wl(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case p:return(t=Gl(t,e.mode,n)).return=e,t;case N:return b(e,t=aa(t),n)}if(I(t)||z(t))return(t=Vl(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return b(e,da(t),n);if(t.$$typeof===w)return b(e,Ir(e,t),n);ma(e,t)}return null}function m(e,t,n,l){var r=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==r?null:s(e,t,""+n,l);if("object"==typeof n&&null!==n){switch(n.$$typeof){case h:return n.key===r?c(e,t,n,l):null;case p:return n.key===r?u(e,t,n,l):null;case N:return m(e,t,n=aa(n),l)}if(I(n)||z(n))return null!==r?null:d(e,t,n,l,null);if("function"==typeof n.then)return m(e,t,da(n),l);if(n.$$typeof===w)return m(e,t,Ir(e,n),l);ma(e,n)}return null}function g(e,t,n,l,r){if("string"==typeof l&&""!==l||"number"==typeof l||"bigint"==typeof l)return s(t,e=e.get(n)||null,""+l,r);if("object"==typeof l&&null!==l){switch(l.$$typeof){case h:return c(t,e=e.get(null===l.key?n:l.key)||null,l,r);case p:return u(t,e=e.get(null===l.key?n:l.key)||null,l,r);case N:return g(e,t,n,l=aa(l),r)}if(I(l)||z(l))return d(t,e=e.get(n)||null,l,r,null);if("function"==typeof l.then)return g(e,t,n,da(l),r);if(l.$$typeof===w)return g(e,t,n,Ir(t,l),r);ma(t,l)}return null}function v(s,c,u,d){if("object"==typeof u&&null!==u&&u.type===f&&null===u.key&&(u=u.props.children),"object"==typeof u&&null!==u){switch(u.$$typeof){case h:e:{for(var y=u.key;null!==c;){if(c.key===y){if((y=u.type)===f){if(7===c.tag){n(s,c.sibling),(d=a(c,u.props.children)).return=s,s=d;break e}}else if(c.elementType===y||"object"==typeof y&&null!==y&&y.$$typeof===N&&aa(y)===c.type){n(s,c.sibling),ba(d=a(c,u.props),u),d.return=s,s=d;break e}n(s,c);break}t(s,c),c=c.sibling}u.type===f?((d=Vl(u.props.children,s.mode,d,u.key)).return=s,s=d):(ba(d=Wl(u.type,u.key,u.props,null,s.mode,d),u),d.return=s,s=d)}return o(s);case p:e:{for(y=u.key;null!==c;){if(c.key===y){if(4===c.tag&&c.stateNode.containerInfo===u.containerInfo&&c.stateNode.implementation===u.implementation){n(s,c.sibling),(d=a(c,u.children||[])).return=s,s=d;break e}n(s,c);break}t(s,c),c=c.sibling}(d=Gl(u,s.mode,d)).return=s,s=d}return o(s);case N:return v(s,c,u=aa(u),d)}if(I(u))return function(r,a,o,s){for(var c=null,u=null,d=a,h=a=0,p=null;null!==d&&h<o.length;h++){d.index>h?(p=d,d=null):p=d.sibling;var f=m(r,d,o[h],s);if(null===f){null===d&&(d=p);break}e&&d&&null===f.alternate&&t(r,d),a=i(f,a,h),null===u?c=f:u.sibling=f,u=f,d=p}if(h===o.length)return n(r,d),mr&&ir(r,h),c;if(null===d){for(;h<o.length;h++)null!==(d=b(r,o[h],s))&&(a=i(d,a,h),null===u?c=d:u.sibling=d,u=d);return mr&&ir(r,h),c}for(d=l(d);h<o.length;h++)null!==(p=g(d,r,h,o[h],s))&&(e&&null!==p.alternate&&d.delete(null===p.key?h:p.key),a=i(p,a,h),null===u?c=p:u.sibling=p,u=p);return e&&d.forEach(function(e){return t(r,e)}),mr&&ir(r,h),c}(s,c,u,d);if(z(u)){if("function"!=typeof(y=z(u)))throw Error(r(150));return function(a,o,s,c){if(null==s)throw Error(r(151));for(var u=null,d=null,h=o,p=o=0,f=null,v=s.next();null!==h&&!v.done;p++,v=s.next()){h.index>p?(f=h,h=null):f=h.sibling;var y=m(a,h,v.value,c);if(null===y){null===h&&(h=f);break}e&&h&&null===y.alternate&&t(a,h),o=i(y,o,p),null===d?u=y:d.sibling=y,d=y,h=f}if(v.done)return n(a,h),mr&&ir(a,p),u;if(null===h){for(;!v.done;p++,v=s.next())null!==(v=b(a,v.value,c))&&(o=i(v,o,p),null===d?u=v:d.sibling=v,d=v);return mr&&ir(a,p),u}for(h=l(h);!v.done;p++,v=s.next())null!==(v=g(h,a,p,v.value,c))&&(e&&null!==v.alternate&&h.delete(null===v.key?p:v.key),o=i(v,o,p),null===d?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),mr&&ir(a,p),u}(s,c,u=y.call(u),d)}if("function"==typeof u.then)return v(s,c,da(u),d);if(u.$$typeof===w)return v(s,c,Ir(s,u),d);ma(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=a(c,u)).return=s,s=d):(n(s,c),(d=Hl(u,s.mode,d)).return=s,s=d),o(s)):n(s,c)}return function(e,t,n,l){try{ua=0;var r=v(e,t,n,l);return ca=null,r}catch(i){if(i===Zr||i===ta)throw i;var a=jl(29,i,null,e.mode);return a.lanes=l,a.return=e,a}}}var pa=ha(!0),fa=ha(!1),ga=!1;function va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ya(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 wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,t,n){var l=e.updateQueue;if(null===l)return null;if(l=l.shared,2&pc){var r=l.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),l.pending=t,t=Rl(e),Dl(e,null,n),t}return Ml(e,l,t,n),Rl(e)}function ka(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&n)){var l=t.lanes;n|=l&=e.pendingLanes,t.lanes=n,De(e,n)}}function Ca(e,t){var n=e.updateQueue,l=e.alternate;if(null!==l&&n===(l=l.updateQueue)){var r=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===a?r=a=i:a=a.next=i,n=n.next}while(null!==n);null===a?r=a=t:a=a.next=t}else r=a=t;return n={baseState:l.baseState,firstBaseUpdate:r,lastBaseUpdate:a,shared:l.shared,callbacks:l.callbacks},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Sa=!1;function Na(){if(Sa){if(null!==Hr)throw Hr}}function Ea(e,t,n,l){Sa=!1;var r=e.updateQueue;ga=!1;var a=r.firstBaseUpdate,i=r.lastBaseUpdate,o=r.shared.pending;if(null!==o){r.shared.pending=null;var s=o,c=s.next;s.next=null,null===i?a=c:i.next=c,i=s;var u=e.alternate;null!==u&&((o=(u=u.updateQueue).lastBaseUpdate)!==i&&(null===o?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=s))}if(null!==a){var d=r.baseState;for(i=0,u=c=s=null,o=a;;){var m=-536870913&o.lane,h=m!==o.lane;if(h?(vc&m)===m:(l&m)===m){0!==m&&m===Vr&&(Sa=!0),null!==u&&(u=u.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var p=e,f=o;m=t;var g=n;switch(f.tag){case 1:if("function"==typeof(p=f.payload)){d=p.call(g,d,m);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(m="function"==typeof(p=f.payload)?p.call(g,d,m):p))break e;d=b({},d,m);break e;case 2:ga=!0}}null!==(m=o.callback)&&(e.flags|=64,h&&(e.flags|=8192),null===(h=r.callbacks)?r.callbacks=[m]:h.push(m))}else h={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===u?(c=u=h,s=d):u=u.next=h,i|=m;if(null===(o=o.next)){if(null===(o=r.shared.pending))break;o=(h=o).next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}null===u&&(s=d),r.baseState=s,r.firstBaseUpdate=c,r.lastBaseUpdate=u,null===a&&(r.shared.lanes=0),Ec|=i,e.lanes=i,e.memoizedState=d}}function $a(e,t){if("function"!=typeof e)throw Error(r(191,e));e.call(t)}function _a(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)$a(n[e],t)}var Ta=U(null),Aa=U(0);function za(e,t){q(Aa,e=Sc),q(Ta,t),Sc=e|t.baseLanes}function La(){q(Aa,Sc),q(Ta,Ta.current)}function Ma(){Sc=Aa.current,B(Ta),B(Aa)}var Pa=U(null),Ia=null;function Da(e){var t=e.alternate;q(Ua,1&Ua.current),q(Pa,e),null===Ia&&(null===t||null!==Ta.current||null!==t.memoizedState)&&(Ia=e)}function Ra(e){q(Ua,Ua.current),q(Pa,e),null===Ia&&(Ia=e)}function Oa(e){22===e.tag?(q(Ua,Ua.current),q(Pa,e),null===Ia&&(Ia=e)):Fa()}function Fa(){q(Ua,Ua.current),q(Pa,Pa.current)}function ja(e){B(Pa),Ia===e&&(Ia=null),B(Ua)}var Ua=U(0);function Ba(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||Md(n)||Pd(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 qa=0,Wa=null,Va=null,Ha=null,Ka=!1,Ga=!1,Qa=!1,Xa=0,Ya=0,Ja=null,Za=0;function ei(){throw Error(r(321))}function ti(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!el(e[n],t[n]))return!1;return!0}function ni(e,t,n,l,r,a){return qa=a,Wa=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=null===e||null===e.memoizedState?vo:yo,Qa=!1,a=n(l,r),Qa=!1,Ga&&(a=ri(t,n,l,r)),li(e),a}function li(e){D.H=go;var t=null!==Va&&null!==Va.next;if(qa=0,Ha=Va=Wa=null,Ka=!1,Ya=0,Ja=null,t)throw Error(r(300));null===e||Io||null!==(e=e.dependencies)&&Lr(e)&&(Io=!0)}function ri(e,t,n,l){Wa=e;var a=0;do{if(Ga&&(Ja=null),Ya=0,Ga=!1,25<=a)throw Error(r(301));if(a+=1,Ha=Va=null,null!=e.updateQueue){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,null!=i.memoCache&&(i.memoCache.index=0)}D.H=wo,i=t(n,l)}while(Ga);return i}function ai(){var e=D.H,t=e.useState()[0];return t="function"==typeof t.then?di(t):t,e=e.useState()[0],(null!==Va?Va.memoizedState:null)!==e&&(Wa.flags|=1024),t}function ii(){var e=0!==Xa;return Xa=0,e}function oi(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function si(e){if(Ka){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Ka=!1}qa=0,Ha=Va=Wa=null,Ga=!1,Ya=Xa=0,Ja=null}function ci(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ha?Wa.memoizedState=Ha=e:Ha=Ha.next=e,Ha}function ui(){if(null===Va){var e=Wa.alternate;e=null!==e?e.memoizedState:null}else e=Va.next;var t=null===Ha?Wa.memoizedState:Ha.next;if(null!==t)Ha=t,Va=e;else{if(null===e){if(null===Wa.alternate)throw Error(r(467));throw Error(r(310))}e={memoizedState:(Va=e).memoizedState,baseState:Va.baseState,baseQueue:Va.baseQueue,queue:Va.queue,next:null},null===Ha?Wa.memoizedState=Ha=e:Ha=Ha.next=e}return Ha}function di(e){var t=Ya;return Ya+=1,null===Ja&&(Ja=[]),e=ra(Ja,e,t),t=Wa,null===(null===Ha?t.memoizedState:Ha.next)&&(t=t.alternate,D.H=null===t||null===t.memoizedState?vo:yo),e}function bi(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return di(e);if(e.$$typeof===w)return Pr(e)}throw Error(r(438,String(e)))}function mi(e){var t=null,n=Wa.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var l=Wa.alternate;null!==l&&(null!==(l=l.updateQueue)&&(null!=(l=l.memoCache)&&(t={data:l.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},Wa.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=_;return t.index++,n}function hi(e,t){return"function"==typeof t?t(e):t}function pi(e){return fi(ui(),Va,e)}function fi(e,t,n){var l=e.queue;if(null===l)throw Error(r(311));l.lastRenderedReducer=n;var a=e.baseQueue,i=l.pending;if(null!==i){if(null!==a){var o=a.next;a.next=i.next,i.next=o}t.baseQueue=a=i,l.pending=null}if(i=e.baseState,null===a)e.memoizedState=i;else{var s=o=null,c=null,u=t=a.next,d=!1;do{var b=-536870913&u.lane;if(b!==u.lane?(vc&b)===b:(qa&b)===b){var m=u.revertLane;if(0===m)null!==c&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),b===Vr&&(d=!0);else{if((qa&m)===m){u=u.next,m===Vr&&(d=!0);continue}b={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=b,o=i):c=c.next=b,Wa.lanes|=m,Ec|=m}b=u.action,Qa&&n(i,b),i=u.hasEagerState?u.eagerState:n(i,b)}else m={lane:b,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(s=c=m,o=i):c=c.next=m,Wa.lanes|=b,Ec|=b;u=u.next}while(null!==u&&u!==t);if(null===c?o=i:c.next=s,!el(i,e.memoizedState)&&(Io=!0,d&&null!==(n=Hr)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=c,l.lastRenderedState=i}return null===a&&(l.lanes=0),[e.memoizedState,l.dispatch]}function gi(e){var t=ui(),n=t.queue;if(null===n)throw Error(r(311));n.lastRenderedReducer=e;var l=n.dispatch,a=n.pending,i=t.memoizedState;if(null!==a){n.pending=null;var o=a=a.next;do{i=e(i,o.action),o=o.next}while(o!==a);el(i,t.memoizedState)||(Io=!0),t.memoizedState=i,null===t.baseQueue&&(t.baseState=i),n.lastRenderedState=i}return[i,l]}function vi(e,t,n){var l=Wa,a=ui(),i=mr;if(i){if(void 0===n)throw Error(r(407));n=n()}else n=t();var o=!el((Va||a).memoizedState,n);if(o&&(a.memoizedState=n,Io=!0),a=a.queue,qi(xi.bind(null,l,a,e),[e]),a.getSnapshot!==t||o||null!==Ha&&1&Ha.memoizedState.tag){if(l.flags|=2048,Oi(9,{destroy:void 0},wi.bind(null,l,a,n,t),null),null===fc)throw Error(r(349));i||127&qa||yi(l,t,n)}return n}function yi(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=Wa.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Wa.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function wi(e,t,n,l){t.value=n,t.getSnapshot=l,ki(t)&&Ci(e)}function xi(e,t,n){return n(function(){ki(t)&&Ci(e)})}function ki(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!el(e,n)}catch(l){return!0}}function Ci(e){var t=Il(e,2);null!==t&&Xc(t,e,2)}function Si(e){var t=ci();if("function"==typeof e){var n=e;if(e=n(),Qa){xe(!0);try{n()}finally{xe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:e},t}function Ni(e,t,n,l){return e.baseState=n,fi(e,Va,"function"==typeof l?l:hi)}function Ei(e,t,n,l,a){if(ho(e))throw Error(r(485));if(null!==(e=t.action)){var i={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){i.listeners.push(e)}};null!==D.T?n(!0):i.isTransition=!1,l(i),null===(n=t.pending)?(i.next=t.pending=i,$i(t,i)):(i.next=n.next,t.pending=n.next=i)}}function $i(e,t){var n=t.action,l=t.payload,r=e.state;if(t.isTransition){var a=D.T,i={};D.T=i;try{var o=n(r,l),s=D.S;null!==s&&s(i,o),_i(e,t,o)}catch(c){Ai(e,t,c)}finally{null!==a&&null!==i.types&&(a.types=i.types),D.T=a}}else try{_i(e,t,a=n(r,l))}catch(u){Ai(e,t,u)}}function _i(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){Ti(e,t,n)},function(n){return Ai(e,t,n)}):Ti(e,t,n)}function Ti(e,t,n){t.status="fulfilled",t.value=n,zi(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,$i(e,n)))}function Ai(e,t,n){var l=e.pending;if(e.pending=null,null!==l){l=l.next;do{t.status="rejected",t.reason=n,zi(t),t=t.next}while(t!==l)}e.action=null}function zi(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Li(e,t){return t}function Mi(e,t){if(mr){var n=fc.formState;if(null!==n){e:{var l=Wa;if(mr){if(br){t:{for(var r=br,a=pr;8!==r.nodeType;){if(!a){r=null;break t}if(null===(r=Id(r.nextSibling))){r=null;break t}}r="F!"===(a=r.data)||"F"===a?r:null}if(r){br=Id(r.nextSibling),l="F!"===r.data;break e}}gr(l)}l=!1}l&&(t=n[0])}}return(n=ci()).memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:t},n.queue=l,n=uo.bind(null,Wa,l),l.dispatch=n,l=Si(!1),a=mo.bind(null,Wa,!1,l.queue),r={state:t,dispatch:null,action:e,pending:null},(l=ci()).queue=r,n=Ei.bind(null,Wa,r,a,n),r.dispatch=n,l.memoizedState=e,[t,n,!1]}function Pi(e){return Ii(ui(),Va,e)}function Ii(e,t,n){if(t=fi(e,t,Li)[0],e=pi(hi)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var l=di(t)}catch(i){if(i===Zr)throw ta;throw i}else l=t;var r=(t=ui()).queue,a=r.dispatch;return n!==t.memoizedState&&(Wa.flags|=2048,Oi(9,{destroy:void 0},Di.bind(null,r,n),null)),[l,a,e]}function Di(e,t){e.action=t}function Ri(e){var t=ui(),n=Va;if(null!==n)return Ii(t,n,e);ui(),t=t.memoizedState;var l=(n=ui()).queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Oi(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},null===(t=Wa.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Wa.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function Fi(){return ui().memoizedState}function ji(e,t,n,l){var r=ci();Wa.flags|=e,r.memoizedState=Oi(1|t,{destroy:void 0},n,void 0===l?null:l)}function Ui(e,t,n,l){var r=ui();l=void 0===l?null:l;var a=r.memoizedState.inst;null!==Va&&null!==l&&ti(l,Va.memoizedState.deps)?r.memoizedState=Oi(t,a,n,l):(Wa.flags|=e,r.memoizedState=Oi(1|t,a,n,l))}function Bi(e,t){ji(8390656,8,e,t)}function qi(e,t){Ui(2048,8,e,t)}function Wi(e){var t=ui().memoizedState;return function(e){Wa.flags|=4;var t=Wa.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Wa.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&pc)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Vi(e,t){return Ui(4,2,e,t)}function Hi(e,t){return Ui(4,4,e,t)}function Ki(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 Gi(e,t,n){n=null!=n?n.concat([e]):null,Ui(4,4,Ki.bind(null,t,e),n)}function Qi(){}function Xi(e,t){var n=ui();t=void 0===t?null:t;var l=n.memoizedState;return null!==t&&ti(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Yi(e,t){var n=ui();t=void 0===t?null:t;var l=n.memoizedState;if(null!==t&&ti(t,l[1]))return l[0];if(l=e(),Qa){xe(!0);try{e()}finally{xe(!1)}}return n.memoizedState=[l,t],l}function Ji(e,t,n){return void 0===n||1073741824&qa&&!(261930&vc)?e.memoizedState=t:(e.memoizedState=n,e=Qc(),Wa.lanes|=e,Ec|=e,n)}function Zi(e,t,n,l){return el(n,t)?n:null!==Ta.current?(e=Ji(e,n,l),el(e,t)||(Io=!0),e):42&qa&&(!(1073741824&qa)||261930&vc)?(e=Qc(),Wa.lanes|=e,Ec|=e,t):(Io=!0,e.memoizedState=n)}function eo(e,t,n,l,r){var a=R.p;R.p=0!==a&&8>a?a:8;var i,o,s,c=D.T,u={};D.T=u,mo(e,!1,t,n);try{var d=r(),b=D.S;if(null!==b&&b(u,d),null!==d&&"object"==typeof d&&"function"==typeof d.then)bo(e,t,(i=l,o=[],s={status:"pending",value:null,reason:null,then:function(e){o.push(e)}},d.then(function(){s.status="fulfilled",s.value=i;for(var e=0;e<o.length;e++)(0,o[e])(i)},function(e){for(s.status="rejected",s.reason=e,e=0;e<o.length;e++)(0,o[e])(void 0)}),s),Gc());else bo(e,t,l,Gc())}catch(m){bo(e,t,{then:function(){},status:"rejected",reason:m},Gc())}finally{R.p=a,null!==c&&null!==u.types&&(c.types=u.types),D.T=c}}function to(){}function no(e,t,n,l){if(5!==e.tag)throw Error(r(476));var a=lo(e).queue;eo(e,a,t,O,null===n?to:function(){return ro(e),n(l)})}function lo(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:O},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:hi,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function ro(e){var t=lo(e);null===t.next&&(t=e.alternate.memoizedState),bo(e,t.next.queue,{},Gc())}function ao(){return Pr(bb)}function io(){return ui().memoizedState}function oo(){return ui().memoizedState}function so(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=Gc(),l=xa(t,e=wa(n),n);return null!==l&&(Xc(l,t,n),ka(l,t,n)),t={cache:Ur()},void(e.payload=t)}t=t.return}}function co(e,t,n){var l=Gc();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ho(e)?po(t,n):null!==(n=Pl(e,t,n,l))&&(Xc(n,e,l),fo(n,t,l))}function uo(e,t,n){bo(e,t,n,Gc())}function bo(e,t,n,l){var r={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ho(e))po(t,r);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var i=t.lastRenderedState,o=a(i,n);if(r.hasEagerState=!0,r.eagerState=o,el(o,i))return Ml(e,t,r,0),null===fc&&Ll(),!1}catch(s){}if(null!==(n=Pl(e,t,r,l)))return Xc(n,e,l),fo(n,t,l),!0}return!1}function mo(e,t,n,l){if(l={lane:2,revertLane:Wu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ho(e)){if(t)throw Error(r(479))}else null!==(t=Pl(e,n,l,2))&&Xc(t,e,2)}function ho(e){var t=e.alternate;return e===Wa||null!==t&&t===Wa}function po(e,t){Ga=Ka=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fo(e,t,n){if(4194048&n){var l=t.lanes;n|=l&=e.pendingLanes,t.lanes=n,De(e,n)}}var go={readContext:Pr,use:bi,useCallback:ei,useContext:ei,useEffect:ei,useImperativeHandle:ei,useLayoutEffect:ei,useInsertionEffect:ei,useMemo:ei,useReducer:ei,useRef:ei,useState:ei,useDebugValue:ei,useDeferredValue:ei,useTransition:ei,useSyncExternalStore:ei,useId:ei,useHostTransitionStatus:ei,useFormState:ei,useActionState:ei,useOptimistic:ei,useMemoCache:ei,useCacheRefresh:ei};go.useEffectEvent=ei;var vo={readContext:Pr,use:bi,useCallback:function(e,t){return ci().memoizedState=[e,void 0===t?null:t],e},useContext:Pr,useEffect:Bi,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,ji(4194308,4,Ki.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ji(4194308,4,e,t)},useInsertionEffect:function(e,t){ji(4,2,e,t)},useMemo:function(e,t){var n=ci();t=void 0===t?null:t;var l=e();if(Qa){xe(!0);try{e()}finally{xe(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=ci();if(void 0!==n){var r=n(t);if(Qa){xe(!0);try{n(t)}finally{xe(!1)}}}else r=t;return l.memoizedState=l.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},l.queue=e,e=e.dispatch=co.bind(null,Wa,e),[l.memoizedState,e]},useRef:function(e){return e={current:e},ci().memoizedState=e},useState:function(e){var t=(e=Si(e)).queue,n=uo.bind(null,Wa,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Qi,useDeferredValue:function(e,t){return Ji(ci(),e,t)},useTransition:function(){var e=Si(!1);return e=eo.bind(null,Wa,e.queue,!0,!1),ci().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Wa,a=ci();if(mr){if(void 0===n)throw Error(r(407));n=n()}else{if(n=t(),null===fc)throw Error(r(349));127&vc||yi(l,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,Bi(xi.bind(null,l,i,e),[e]),l.flags|=2048,Oi(9,{destroy:void 0},wi.bind(null,l,i,n,t),null),n},useId:function(){var e=ci(),t=fc.identifierPrefix;if(mr){var n=ar;t="_"+t+"R_"+(n=(rr&~(1<<32-ke(rr)-1)).toString(32)+n),0<(n=Xa++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=Za++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ao,useFormState:Mi,useActionState:Mi,useOptimistic:function(e){var t=ci();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=mo.bind(null,Wa,!0,n),n.dispatch=t,[e,t]},useMemoCache:mi,useCacheRefresh:function(){return ci().memoizedState=so.bind(null,Wa)},useEffectEvent:function(e){var t=ci(),n={impl:e};return t.memoizedState=n,function(){if(2&pc)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},yo={readContext:Pr,use:bi,useCallback:Xi,useContext:Pr,useEffect:qi,useImperativeHandle:Gi,useInsertionEffect:Vi,useLayoutEffect:Hi,useMemo:Yi,useReducer:pi,useRef:Fi,useState:function(){return pi(hi)},useDebugValue:Qi,useDeferredValue:function(e,t){return Zi(ui(),Va.memoizedState,e,t)},useTransition:function(){var e=pi(hi)[0],t=ui().memoizedState;return["boolean"==typeof e?e:di(e),t]},useSyncExternalStore:vi,useId:io,useHostTransitionStatus:ao,useFormState:Pi,useActionState:Pi,useOptimistic:function(e,t){return Ni(ui(),0,e,t)},useMemoCache:mi,useCacheRefresh:oo};yo.useEffectEvent=Wi;var wo={readContext:Pr,use:bi,useCallback:Xi,useContext:Pr,useEffect:qi,useImperativeHandle:Gi,useInsertionEffect:Vi,useLayoutEffect:Hi,useMemo:Yi,useReducer:gi,useRef:Fi,useState:function(){return gi(hi)},useDebugValue:Qi,useDeferredValue:function(e,t){var n=ui();return null===Va?Ji(n,e,t):Zi(n,Va.memoizedState,e,t)},useTransition:function(){var e=gi(hi)[0],t=ui().memoizedState;return["boolean"==typeof e?e:di(e),t]},useSyncExternalStore:vi,useId:io,useHostTransitionStatus:ao,useFormState:Ri,useActionState:Ri,useOptimistic:function(e,t){var n=ui();return null!==Va?Ni(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:mi,useCacheRefresh:oo};function xo(e,t,n,l){n=null==(n=n(l,t=e.memoizedState))?t:b({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}wo.useEffectEvent=Wi;var ko={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=Gc(),r=wa(l);r.payload=t,null!=n&&(r.callback=n),null!==(t=xa(e,r,l))&&(Xc(t,e,l),ka(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=Gc(),r=wa(l);r.tag=1,r.payload=t,null!=n&&(r.callback=n),null!==(t=xa(e,r,l))&&(Xc(t,e,l),ka(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Gc(),l=wa(n);l.tag=2,null!=t&&(l.callback=t),null!==(t=xa(e,l,n))&&(Xc(t,e,n),ka(t,e,n))}};function Co(e,t,n,l,r,a,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(l,a,i):!t.prototype||!t.prototype.isPureReactComponent||(!tl(n,l)||!tl(r,a))}function So(e,t,n,l){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,l),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&ko.enqueueReplaceState(t,t.state,null)}function No(e,t){var n=t;if("ref"in t)for(var l in n={},t)"ref"!==l&&(n[l]=t[l]);if(e=e.defaultProps)for(var r in n===t&&(n=b({},n)),e)void 0===n[r]&&(n[r]=e[r]);return n}function Eo(e){_l(e)}function $o(e){console.error(e)}function _o(e){_l(e)}function To(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function Ao(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(l){setTimeout(function(){throw l})}}function zo(e,t,n){return(n=wa(n)).tag=3,n.payload={element:null},n.callback=function(){To(e,t)},n}function Lo(e){return(e=wa(e)).tag=3,e}function Mo(e,t,n,l){var r=n.type.getDerivedStateFromError;if("function"==typeof r){var a=l.value;e.payload=function(){return r(a)},e.callback=function(){Ao(t,n,l)}}var i=n.stateNode;null!==i&&"function"==typeof i.componentDidCatch&&(e.callback=function(){Ao(t,n,l),"function"!=typeof r&&(null===Oc?Oc=/* @__PURE__ */new Set([this]):Oc.add(this));var e=l.stack;this.componentDidCatch(l.value,{componentStack:null!==e?e:""})})}var Po=Error(r(461)),Io=!1;function Do(e,t,n,l){t.child=null===e?fa(t,null,n,l):pa(t,e.child,n,l)}function Ro(e,t,n,l,r){n=n.render;var a=t.ref;if("ref"in l){var i={};for(var o in l)"ref"!==o&&(i[o]=l[o])}else i=l;return Mr(t),l=ni(e,t,n,i,a,r),o=ii(),null===e||Io?(mr&&o&&sr(t),t.flags|=1,Do(e,t,l,r),t.child):(oi(e,t,r),is(e,t,r))}function Oo(e,t,n,l,r){if(null===e){var a=n.type;return"function"!=typeof a||Ul(a)||void 0!==a.defaultProps||null!==n.compare?((e=Wl(n.type,null,l,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Fo(e,t,a,l,r))}if(a=e.child,!os(e,r)){var i=a.memoizedProps;if((n=null!==(n=n.compare)?n:tl)(i,l)&&e.ref===t.ref)return is(e,t,r)}return t.flags|=1,(e=Bl(a,l)).ref=t.ref,e.return=t,t.child=e}function Fo(e,t,n,l,r){if(null!==e){var a=e.memoizedProps;if(tl(a,l)&&e.ref===t.ref){if(Io=!1,t.pendingProps=l=a,!os(e,r))return t.lanes=e.lanes,is(e,t,r);131072&e.flags&&(Io=!0)}}return Ho(e,t,n,l,r)}function jo(e,t,n,l){var r=l.children,a=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===l.mode){if(128&t.flags){if(a=null!==a?a.baseLanes|n:n,null!==e){for(l=t.child=e.child,r=0;null!==l;)r=r|l.lanes|l.childLanes,l=l.sibling;l=r&~a}else l=0,t.child=null;return Bo(e,t,a,n,l)}if(!(536870912&n))return l=t.lanes=536870912,Bo(e,t,null!==a?a.baseLanes|n:n,n,l);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Yr(0,null!==a?a.cachePool:null),null!==a?za(t,a):La(),Oa(t)}else null!==a?(Yr(0,a.cachePool),za(t,a),Fa(),t.memoizedState=null):(null!==e&&Yr(0,null),La(),Fa());return Do(e,t,r,n),t.child}function Uo(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Bo(e,t,n,l,r){var a=Xr();return a=null===a?null:{parent:jr._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},null!==e&&Yr(0,null),La(),Oa(t),null!==e&&zr(e,t,l,!0),t.childLanes=r,null}function qo(e,t){return(t=ts({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function Wo(e,t,n){return pa(t,e.child,null,n),(e=qo(t,t.pendingProps)).flags|=2,ja(t),t.memoizedState=null,e}function Vo(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(r(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Ho(e,t,n,l,r){return Mr(t),n=ni(e,t,n,l,void 0,r),l=ii(),null===e||Io?(mr&&l&&sr(t),t.flags|=1,Do(e,t,n,r),t.child):(oi(e,t,r),is(e,t,r))}function Ko(e,t,n,l,r,a){return Mr(t),t.updateQueue=null,n=ri(t,l,n,r),li(e),l=ii(),null===e||Io?(mr&&l&&sr(t),t.flags|=1,Do(e,t,n,a),t.child):(oi(e,t,a),is(e,t,a))}function Go(e,t,n,l,r){if(Mr(t),null===t.stateNode){var a=Ol,i=n.contextType;"object"==typeof i&&null!==i&&(a=Pr(i)),a=new n(l,a),t.memoizedState=null!==a.state&&void 0!==a.state?a.state:null,a.updater=ko,t.stateNode=a,a._reactInternals=t,(a=t.stateNode).props=l,a.state=t.memoizedState,a.refs={},va(t),i=n.contextType,a.context="object"==typeof i&&null!==i?Pr(i):Ol,a.state=t.memoizedState,"function"==typeof(i=n.getDerivedStateFromProps)&&(xo(t,n,i,l),a.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(i=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),i!==a.state&&ko.enqueueReplaceState(a,a.state,null),Ea(t,l,a,r),Na(),a.state=t.memoizedState),"function"==typeof a.componentDidMount&&(t.flags|=4194308),l=!0}else if(null===e){a=t.stateNode;var o=t.memoizedProps,s=No(n,o);a.props=s;var c=a.context,u=n.contextType;i=Ol,"object"==typeof u&&null!==u&&(i=Pr(u));var d=n.getDerivedStateFromProps;u="function"==typeof d||"function"==typeof a.getSnapshotBeforeUpdate,o=t.pendingProps!==o,u||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o||c!==i)&&So(t,a,l,i),ga=!1;var b=t.memoizedState;a.state=b,Ea(t,l,a,r),Na(),c=t.memoizedState,o||b!==c||ga?("function"==typeof d&&(xo(t,n,d,l),c=t.memoizedState),(s=ga||Co(t,n,s,l,b,c,i))?(u||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=c),a.props=l,a.state=c,a.context=i,l=s):("function"==typeof a.componentDidMount&&(t.flags|=4194308),l=!1)}else{a=t.stateNode,ya(e,t),u=No(n,i=t.memoizedProps),a.props=u,d=t.pendingProps,b=a.context,c=n.contextType,s=Ol,"object"==typeof c&&null!==c&&(s=Pr(c)),(c="function"==typeof(o=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(i!==d||b!==s)&&So(t,a,l,s),ga=!1,b=t.memoizedState,a.state=b,Ea(t,l,a,r),Na();var m=t.memoizedState;i!==d||b!==m||ga||null!==e&&null!==e.dependencies&&Lr(e.dependencies)?("function"==typeof o&&(xo(t,n,o,l),m=t.memoizedState),(u=ga||Co(t,n,u,l,b,m,s)||null!==e&&null!==e.dependencies&&Lr(e.dependencies))?(c||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(l,m,s),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(l,m,s)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=m),a.props=l,a.state=m,a.context=s,l=u):("function"!=typeof a.componentDidUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||i===e.memoizedProps&&b===e.memoizedState||(t.flags|=1024),l=!1)}return a=l,Vo(e,t),l=!!(128&t.flags),a||l?(a=t.stateNode,n=l&&"function"!=typeof n.getDerivedStateFromError?null:a.render(),t.flags|=1,null!==e&&l?(t.child=pa(t,e.child,null,r),t.child=pa(t,null,n,r)):Do(e,t,n,r),t.memoizedState=a.state,e=t.child):e=is(e,t,r),e}function Qo(e,t,n,l){return xr(),t.flags|=256,Do(e,t,n,l),t.child}var Xo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yo(e){return{baseLanes:e,cachePool:Jr()}}function Jo(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=Tc),e}function Zo(e,t,n){var l,a=t.pendingProps,i=!1,o=!!(128&t.flags);if((l=o)||(l=(null===e||null!==e.memoizedState)&&!!(2&Ua.current)),l&&(i=!0,t.flags&=-129),l=!!(32&t.flags),t.flags&=-33,null===e){if(mr){if(i?Da(t):Fa(),(e=br)?null!==(e=null!==(e=Ld(e,pr))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==lr?{id:rr,overflow:ar}:null,retryLane:536870912,hydrationErrors:null},(n=Kl(e)).return=t,t.child=n,dr=t,br=null):e=null,null===e)throw gr(t);return Pd(e)?t.lanes=32:t.lanes=536870912,null}var s=a.children;return a=a.fallback,i?(Fa(),s=ts({mode:"hidden",children:s},i=t.mode),a=Vl(a,i,n,null),s.return=t,a.return=t,s.sibling=a,t.child=s,(a=t.child).memoizedState=Yo(n),a.childLanes=Jo(e,l,n),t.memoizedState=Xo,Uo(null,a)):(Da(t),es(t,s))}var c=e.memoizedState;if(null!==c&&null!==(s=c.dehydrated)){if(o)256&t.flags?(Da(t),t.flags&=-257,t=ns(e,t,n)):null!==t.memoizedState?(Fa(),t.child=e.child,t.flags|=128,t=null):(Fa(),s=a.fallback,i=t.mode,a=ts({mode:"visible",children:a.children},i),(s=Vl(s,i,n,null)).flags|=2,a.return=t,s.return=t,a.sibling=s,t.child=a,pa(t,e.child,null,n),(a=t.child).memoizedState=Yo(n),a.childLanes=Jo(e,l,n),t.memoizedState=Xo,t=Uo(null,a));else if(Da(t),Pd(s)){if(l=s.nextSibling&&s.nextSibling.dataset)var u=l.dgst;l=u,(a=Error(r(419))).stack="",a.digest=l,Cr({value:a,source:null,stack:null}),t=ns(e,t,n)}else if(Io||zr(e,t,n,!1),l=0!==(n&e.childLanes),Io||l){if(null!==(l=fc)&&(0!==(a=Re(l,n))&&a!==c.retryLane))throw c.retryLane=a,Il(e,a),Xc(l,e,a),Po;Md(s)||su(),t=ns(e,t,n)}else Md(s)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,br=Id(s.nextSibling),dr=t,mr=!0,hr=null,pr=!1,null!==e&&ur(t,e),(t=es(t,a.children)).flags|=4096);return t}return i?(Fa(),s=a.fallback,i=t.mode,u=(c=e.child).sibling,(a=Bl(c,{mode:"hidden",children:a.children})).subtreeFlags=65011712&c.subtreeFlags,null!==u?s=Bl(u,s):(s=Vl(s,i,n,null)).flags|=2,s.return=t,a.return=t,a.sibling=s,t.child=a,Uo(null,a),a=t.child,null===(s=e.child.memoizedState)?s=Yo(n):(null!==(i=s.cachePool)?(c=jr._currentValue,i=i.parent!==c?{parent:c,pool:c}:i):i=Jr(),s={baseLanes:s.baseLanes|n,cachePool:i}),a.memoizedState=s,a.childLanes=Jo(e,l,n),t.memoizedState=Xo,Uo(e.child,a)):(Da(t),e=(n=e.child).sibling,(n=Bl(n,{mode:"visible",children:a.children})).return=t,n.sibling=null,null!==e&&(null===(l=t.deletions)?(t.deletions=[e],t.flags|=16):l.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=jl(22,e,null,t)).lanes=0,e}function ns(e,t,n){return pa(t,e.child,null,n),(e=es(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function ls(e,t,n){e.lanes|=t;var l=e.alternate;null!==l&&(l.lanes|=t),Tr(e.return,t,n)}function rs(e,t,n,l,r,a){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:r,treeForkCount:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=l,i.tail=n,i.tailMode=r,i.treeForkCount=a)}function as(e,t,n){var l=t.pendingProps,r=l.revealOrder,a=l.tail;l=l.children;var i=Ua.current,o=!!(2&i);if(o?(i=1&i|2,t.flags|=128):i&=1,q(Ua,i),Do(e,t,l,n),l=mr?er:0,!o&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ls(e,n,t);else if(19===e.tag)ls(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(r){case"forwards":for(n=t.child,r=null;null!==n;)null!==(e=n.alternate)&&null===Ba(e)&&(r=n),n=n.sibling;null===(n=r)?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),rs(t,!1,r,n,a,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===Ba(e)){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}rs(t,!0,n,null,a,l);break;case"together":rs(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function is(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Ec|=t.lanes,0===(n&t.childLanes)){if(null===e)return null;if(zr(e,t,n,!1),0===(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(r(153));if(null!==t.child){for(n=Bl(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Bl(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function os(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Lr(e))}function ss(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Io=!0;else{if(!(os(e,n)||128&t.flags))return Io=!1,function(e,t,n){switch(t.tag){case 3:X(t,t.stateNode.containerInfo),$r(0,jr,e.memoizedState.cache),xr();break;case 27:case 5:J(t);break;case 4:X(t,t.stateNode.containerInfo);break;case 10:$r(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,Ra(t),null;break;case 13:var l=t.memoizedState;if(null!==l)return null!==l.dehydrated?(Da(t),t.flags|=128,null):0!==(n&t.child.childLanes)?Zo(e,t,n):(Da(t),null!==(e=is(e,t,n))?e.sibling:null);Da(t);break;case 19:var r=!!(128&e.flags);if((l=0!==(n&t.childLanes))||(zr(e,t,n,!1),l=0!==(n&t.childLanes)),r){if(l)return as(e,t,n);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),q(Ua,Ua.current),l)break;return null;case 22:return t.lanes=0,jo(e,t,n,t.pendingProps);case 24:$r(0,jr,e.memoizedState.cache)}return is(e,t,n)}(e,t,n);Io=!!(131072&e.flags)}else Io=!1,mr&&1048576&t.flags&&or(t,er,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=aa(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var a=e.$$typeof;if(a===x){t.tag=11,t=Ro(null,t,e,l,n);break e}if(a===S){t.tag=14,t=Oo(null,t,e,l,n);break e}}throw t=P(e)||e,Error(r(306,t,""))}Ul(e)?(l=No(e,l),t.tag=1,t=Go(null,t,e,l,n)):(t.tag=0,t=Ho(null,t,e,l,n))}return t;case 0:return Ho(e,t,t.type,t.pendingProps,n);case 1:return Go(e,t,l=t.type,a=No(l,t.pendingProps),n);case 3:e:{if(X(t,t.stateNode.containerInfo),null===e)throw Error(r(387));l=t.pendingProps;var i=t.memoizedState;a=i.element,ya(e,t),Ea(t,l,null,n);var o=t.memoizedState;if(l=o.cache,$r(0,jr,l),l!==i.cache&&Ar(t,[jr],n,!0),Na(),l=o.element,i.isDehydrated){if(i={element:l,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=Qo(e,t,l,n);break e}if(l!==a){Cr(a=Xl(Error(r(424)),t)),t=Qo(e,t,l,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(br=Id(e.firstChild),dr=t,mr=!0,hr=null,pr=!0,n=fa(t,null,l,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(xr(),l===a){t=is(e,t,n);break e}Do(e,t,l,n)}t=t.child}return t;case 26:return Vo(e,t),null===e?(n=Kd(t.type,null,t.pendingProps,null))?t.memoizedState=n:mr||(n=t.type,e=t.pendingProps,(l=vd(G.current).createElement(n))[qe]=t,l[We]=e,hd(l,n,e),nt(l),t.stateNode=l):t.memoizedState=Kd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return J(t),null===e&&mr&&(l=t.stateNode=Fd(t.type,t.pendingProps,G.current),dr=t,pr=!0,a=br,_d(t.type)?(Dd=a,br=Id(l.firstChild)):br=a),Do(e,t,t.pendingProps.children,n),Vo(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&mr&&((a=l=br)&&(null!==(l=function(e,t,n,l){for(;1===e.nodeType;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(l){if(!e[Xe])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(a=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(a!==r.rel||e.getAttribute("href")!==(null==r.href||""===r.href?null:r.href)||e.getAttribute("crossorigin")!==(null==r.crossOrigin?null:r.crossOrigin)||e.getAttribute("title")!==(null==r.title?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((a=e.getAttribute("src"))!==(null==r.src?null:r.src)||e.getAttribute("type")!==(null==r.type?null:r.type)||e.getAttribute("crossorigin")!==(null==r.crossOrigin?null:r.crossOrigin))&&a&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var a=null==r.name?null:""+r.name;if("hidden"===r.type&&e.getAttribute("name")===a)return e}if(null===(e=Id(e.nextSibling)))break}return null}(l,t.type,t.pendingProps,pr))?(t.stateNode=l,dr=t,br=Id(l.firstChild),pr=!1,a=!0):a=!1),a||gr(t)),J(t),a=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,l=i.children,xd(a,i)?l=null:null!==o&&xd(a,o)&&(t.flags|=32),null!==t.memoizedState&&(a=ni(e,t,ai,null,null,n),bb._currentValue=a),Vo(e,t),Do(e,t,l,n),t.child;case 6:return null===e&&mr&&((e=n=br)&&(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=Id(e.nextSibling)))return null}return e}(n,t.pendingProps,pr))?(t.stateNode=n,dr=t,br=null,e=!0):e=!1),e||gr(t)),null;case 13:return Zo(e,t,n);case 4:return X(t,t.stateNode.containerInfo),l=t.pendingProps,null===e?t.child=pa(t,null,l,n):Do(e,t,l,n),t.child;case 11:return Ro(e,t,t.type,t.pendingProps,n);case 7:return Do(e,t,t.pendingProps,n),t.child;case 8:case 12:return Do(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,$r(0,t.type,l.value),Do(e,t,l.children,n),t.child;case 9:return a=t.type._context,l=t.pendingProps.children,Mr(t),l=l(a=Pr(a)),t.flags|=1,Do(e,t,l,n),t.child;case 14:return Oo(e,t,t.type,t.pendingProps,n);case 15:return Fo(e,t,t.type,t.pendingProps,n);case 19:return as(e,t,n);case 31:return function(e,t,n){var l=t.pendingProps,a=!!(128&t.flags);if(t.flags&=-129,null===e){if(mr){if("hidden"===l.mode)return e=qo(t,l),t.lanes=536870912,Uo(null,e);if(Ra(t),(e=br)?null!==(e=null!==(e=Ld(e,pr))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==lr?{id:rr,overflow:ar}:null,retryLane:536870912,hydrationErrors:null},(n=Kl(e)).return=t,t.child=n,dr=t,br=null):e=null,null===e)throw gr(t);return t.lanes=536870912,null}return qo(t,l)}var i=e.memoizedState;if(null!==i){var o=i.dehydrated;if(Ra(t),a)if(256&t.flags)t.flags&=-257,t=Wo(e,t,n);else{if(null===t.memoizedState)throw Error(r(558));t.child=e.child,t.flags|=128,t=null}else if(Io||zr(e,t,n,!1),a=0!==(n&e.childLanes),Io||a){if(null!==(l=fc)&&0!==(o=Re(l,n))&&o!==i.retryLane)throw i.retryLane=o,Il(e,o),Xc(l,e,o),Po;su(),t=Wo(e,t,n)}else e=i.treeContext,br=Id(o.nextSibling),dr=t,mr=!0,hr=null,pr=!1,null!==e&&ur(t,e),(t=qo(t,l)).flags|=4096;return t}return(e=Bl(e.child,{mode:l.mode,children:l.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,n);case 22:return jo(e,t,n,t.pendingProps);case 24:return Mr(t),l=Pr(jr),null===e?(null===(a=Xr())&&(a=fc,i=Ur(),a.pooledCache=i,i.refCount++,null!==i&&(a.pooledCacheLanes|=n),a=i),t.memoizedState={parent:l,cache:a},va(t),$r(0,jr,a)):(0!==(e.lanes&n)&&(ya(e,t),Ea(t,null,null,n),Na()),a=e.memoizedState,i=t.memoizedState,a.parent!==l?(a={parent:l,cache:l},t.memoizedState=a,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=a),$r(0,jr,l)):(l=i.cache,$r(0,jr,l),l!==a.cache&&Ar(t,[jr],n,!0))),Do(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function cs(e){e.flags|=4}function us(e,t,n,l,r){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&r)===r)if(e.stateNode.complete)e.flags|=8192;else{if(!au())throw ia=na,ea;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,!ib(t)){if(!au())throw ia=na,ea;e.flags|=8192}}function bs(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Le():536870912,e.lanes|=t,Ac|=t)}function ms(e,t){if(!mr)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 l=null;null!==n;)null!==n.alternate&&(l=n),n=n.sibling;null===l?t||null===e.tail?e.tail=null:e.tail.sibling=null:l.sibling=null}}function hs(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,l=0;if(t)for(var r=e.child;null!==r;)n|=r.lanes|r.childLanes,l|=65011712&r.subtreeFlags,l|=65011712&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)n|=r.lanes|r.childLanes,l|=r.subtreeFlags,l|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function ps(e,t,n){var l=t.pendingProps;switch(cr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return hs(t),null;case 3:return n=t.stateNode,l=null,null!==e&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),_r(jr),Y(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(wr(t)?cs(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,kr())),hs(t),null;case 26:var a=t.type,i=t.memoizedState;return null===e?(cs(t),null!==i?(hs(t),ds(t,i)):(hs(t),us(t,a,0,0,n))):i?i!==e.memoizedState?(cs(t),hs(t),ds(t,i)):(hs(t),t.flags&=-16777217):((e=e.memoizedProps)!==l&&cs(t),hs(t),us(t,a,0,0,n)),null;case 27:if(Z(t),n=G.current,a=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==l&&cs(t);else{if(!l){if(null===t.stateNode)throw Error(r(166));return hs(t),null}e=H.current,wr(t)?vr(t):(e=Fd(a,l,n),t.stateNode=e,cs(t))}return hs(t),null;case 5:if(Z(t),a=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==l&&cs(t);else{if(!l){if(null===t.stateNode)throw Error(r(166));return hs(t),null}if(i=H.current,wr(t))vr(t);else{var o=vd(G.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":(i=o.createElement("div")).innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i="string"==typeof l.is?o.createElement("select",{is:l.is}):o.createElement("select"),l.multiple?i.multiple=!0:l.size&&(i.size=l.size);break;default:i="string"==typeof l.is?o.createElement(a,{is:l.is}):o.createElement(a)}}i[qe]=t,i[We]=l;e:for(o=t.child;null!==o;){if(5===o.tag||6===o.tag)i.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;null===o.sibling;){if(null===o.return||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(hd(i,a,l),a){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&cs(t)}}return hs(t),us(t,t.type,null===e||e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==l&&cs(t);else{if("string"!=typeof l&&null===t.stateNode)throw Error(r(166));if(e=G.current,wr(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,null!==(a=dr))switch(a.tag){case 27:case 5:l=a.memoizedProps}e[qe]=t,(e=!!(e.nodeValue===n||null!==l&&!0===l.suppressHydrationWarning||dd(e.nodeValue,n)))||gr(t,!0)}else(e=vd(e).createTextNode(l))[qe]=t,t.stateNode=e}return hs(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(l=wr(t),null!==n){if(null===e){if(!l)throw Error(r(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(r(557));e[qe]=t}else xr(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;hs(t),e=!1}else n=kr(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(ja(t),t):(ja(t),null);if(128&t.flags)throw Error(r(558))}return hs(t),null;case 13:if(l=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(a=wr(t),null!==l&&null!==l.dehydrated){if(null===e){if(!a)throw Error(r(318));if(!(a=null!==(a=t.memoizedState)?a.dehydrated:null))throw Error(r(317));a[qe]=t}else xr(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;hs(t),a=!1}else a=kr(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return 256&t.flags?(ja(t),t):(ja(t),null)}return ja(t),128&t.flags?(t.lanes=n,t):(n=null!==l,e=null!==e&&null!==e.memoizedState,n&&(a=null,null!==(l=t.child).alternate&&null!==l.alternate.memoizedState&&null!==l.alternate.memoizedState.cachePool&&(a=l.alternate.memoizedState.cachePool.pool),i=null,null!==l.memoizedState&&null!==l.memoizedState.cachePool&&(i=l.memoizedState.cachePool.pool),i!==a&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),bs(t,t.updateQueue),hs(t),null);case 4:return Y(),null===e&&td(t.stateNode.containerInfo),hs(t),null;case 10:return _r(t.type),hs(t),null;case 19:if(B(Ua),null===(l=t.memoizedState))return hs(t),null;if(a=!!(128&t.flags),null===(i=l.rendering))if(a)ms(l,!1);else{if(0!==Nc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(i=Ba(e))){for(t.flags|=128,ms(l,!1),e=i.updateQueue,t.updateQueue=e,bs(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)ql(n,e),n=n.sibling;return q(Ua,1&Ua.current|2),mr&&ir(t,l.treeForkCount),t.child}e=e.sibling}null!==l.tail&&ue()>Dc&&(t.flags|=128,a=!0,ms(l,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=Ba(i))){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,bs(t,e),ms(l,!0),null===l.tail&&"hidden"===l.tailMode&&!i.alternate&&!mr)return hs(t),null}else 2*ue()-l.renderingStartTime>Dc&&536870912!==n&&(t.flags|=128,a=!0,ms(l,!1),t.lanes=4194304);l.isBackwards?(i.sibling=t.child,t.child=i):(null!==(e=l.last)?e.sibling=i:t.child=i,l.last=i)}return null!==l.tail?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=ue(),e.sibling=null,n=Ua.current,q(Ua,a?1&n|2:1&n),mr&&ir(t,l.treeForkCount),e):(hs(t),null);case 22:case 23:return ja(t),Ma(),l=null!==t.memoizedState,null!==e?null!==e.memoizedState!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?!!(536870912&n)&&!(128&t.flags)&&(hs(t),6&t.subtreeFlags&&(t.flags|=8192)):hs(t),null!==(n=t.updateQueue)&&bs(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),l=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),null!==e&&B(Qr),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),_r(jr),hs(t),null;case 25:case 30:return null}throw Error(r(156,t.tag))}function fs(e,t){switch(cr(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return _r(jr),Y(),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(ja(t),null===t.alternate)throw Error(r(340));xr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(ja(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(r(340));xr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return B(Ua),null;case 4:return Y(),null;case 10:return _r(t.type),null;case 22:case 23:return ja(t),Ma(),null!==e&&B(Qr),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return _r(jr),null;default:return null}}function gs(e,t){switch(cr(t),t.tag){case 3:_r(jr),Y();break;case 26:case 27:case 5:Z(t);break;case 4:Y();break;case 31:null!==t.memoizedState&&ja(t);break;case 13:ja(t);break;case 19:B(Ua);break;case 10:_r(t.type);break;case 22:case 23:ja(t),Ma(),null!==e&&B(Qr);break;case 24:_r(jr)}}function vs(e,t){try{var n=t.updateQueue,l=null!==n?n.lastEffect:null;if(null!==l){var r=l.next;n=r;do{if((n.tag&e)===e){l=void 0;var a=n.create,i=n.inst;l=a(),i.destroy=l}n=n.next}while(n!==r)}}catch(o){Nu(t,t.return,o)}}function ys(e,t,n){try{var l=t.updateQueue,r=null!==l?l.lastEffect:null;if(null!==r){var a=r.next;l=a;do{if((l.tag&e)===e){var i=l.inst,o=i.destroy;if(void 0!==o){i.destroy=void 0,r=t;var s=n,c=o;try{c()}catch(u){Nu(r,s,u)}}}l=l.next}while(l!==a)}}catch(u){Nu(t,t.return,u)}}function ws(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{_a(t,n)}catch(l){Nu(e,e.return,l)}}}function xs(e,t,n){n.props=No(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){Nu(e,t,l)}}function ks(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;default:l=e.stateNode}"function"==typeof n?e.refCleanup=n(l):n.current=l}}catch(r){Nu(e,t,r)}}function Cs(e,t){var n=e.ref,l=e.refCleanup;if(null!==n)if("function"==typeof l)try{l()}catch(r){Nu(e,t,r)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(a){Nu(e,t,a)}else n.current=null}function Ss(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(r){Nu(e,e.return,r)}}function Ns(e,t,n){try{var l=e.stateNode;!function(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,i=null,o=null,s=null,c=null,u=null,d=null;for(h in n){var b=n[h];if(n.hasOwnProperty(h)&&null!=b)switch(h){case"checked":case"value":break;case"defaultValue":c=b;default:l.hasOwnProperty(h)||bd(e,t,h,null,l,b)}}for(var m in l){var h=l[m];if(b=n[m],l.hasOwnProperty(m)&&(null!=h||null!=b))switch(m){case"type":i=h;break;case"name":a=h;break;case"checked":u=h;break;case"defaultChecked":d=h;break;case"value":o=h;break;case"defaultValue":s=h;break;case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(r(137,t));break;default:h!==b&&bd(e,t,m,h,l,b)}}return void wt(e,o,s,c,u,d,i,a);case"select":for(i in h=o=s=m=null,n)if(c=n[i],n.hasOwnProperty(i)&&null!=c)switch(i){case"value":break;case"multiple":h=c;default:l.hasOwnProperty(i)||bd(e,t,i,null,l,c)}for(a in l)if(i=l[a],c=n[a],l.hasOwnProperty(a)&&(null!=i||null!=c))switch(a){case"value":m=i;break;case"defaultValue":s=i;break;case"multiple":o=i;default:i!==c&&bd(e,t,a,i,l,c)}return t=s,n=o,l=h,void(null!=m?Ct(e,!!n,m,!1):!!l!=!!n&&(null!=t?Ct(e,!!n,t,!0):Ct(e,!!n,n?[]:"",!1)));case"textarea":for(s in h=m=null,n)if(a=n[s],n.hasOwnProperty(s)&&null!=a&&!l.hasOwnProperty(s))switch(s){case"value":case"children":break;default:bd(e,t,s,null,l,a)}for(o in l)if(a=l[o],i=n[o],l.hasOwnProperty(o)&&(null!=a||null!=i))switch(o){case"value":m=a;break;case"defaultValue":h=a;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=a)throw Error(r(91));break;default:a!==i&&bd(e,t,o,a,l,i)}return void St(e,m,h);case"option":for(var p in n)if(m=n[p],n.hasOwnProperty(p)&&null!=m&&!l.hasOwnProperty(p))if("selected"===p)e.selected=!1;else bd(e,t,p,null,l,m);for(c in l)if(m=l[c],h=n[c],l.hasOwnProperty(c)&&m!==h&&(null!=m||null!=h))if("selected"===c)e.selected=m&&"function"!=typeof m&&"symbol"!=typeof m;else bd(e,t,c,m,l,h);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 f in n)m=n[f],n.hasOwnProperty(f)&&null!=m&&!l.hasOwnProperty(f)&&bd(e,t,f,null,l,m);for(u in l)if(m=l[u],h=n[u],l.hasOwnProperty(u)&&m!==h&&(null!=m||null!=h))switch(u){case"children":case"dangerouslySetInnerHTML":if(null!=m)throw Error(r(137,t));break;default:bd(e,t,u,m,l,h)}return;default:if(At(t)){for(var g in n)m=n[g],n.hasOwnProperty(g)&&void 0!==m&&!l.hasOwnProperty(g)&&md(e,t,g,void 0,l,m);for(d in l)m=l[d],h=n[d],!l.hasOwnProperty(d)||m===h||void 0===m&&void 0===h||md(e,t,d,m,l,h);return}}for(var v in n)m=n[v],n.hasOwnProperty(v)&&null!=m&&!l.hasOwnProperty(v)&&bd(e,t,v,null,l,m);for(b in l)m=l[b],h=n[b],!l.hasOwnProperty(b)||m===h||null==m&&null==h||bd(e,t,b,m,l,h)}(l,e.type,n,t),l[We]=t}catch(a){Nu(e,e.return,a)}}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 l=e.tag;if(5===l||6===l)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=Pt));else if(4!==l&&(27===l&&_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 Ts(e,t,n){var l=e.tag;if(5===l||6===l)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==l&&(27===l&&_d(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(Ts(e,t,n),e=e.sibling;null!==e;)Ts(e,t,n),e=e.sibling}function As(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);hd(t,l,n),t[qe]=e,t[We]=n}catch(a){Nu(e,e.return,a)}}var zs=!1,Ls=!1,Ms=!1,Ps="function"==typeof WeakSet?WeakSet:Set,Is=null;function Ds(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:Xs(e,n),4&l&&vs(5,n);break;case 1:if(Xs(e,n),4&l)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(i){Nu(n,n.return,i)}else{var r=No(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Nu(n,n.return,o)}}64&l&&ws(n),512&l&&ks(n,n.return);break;case 3:if(Xs(e,n),64&l&&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{_a(e,t)}catch(i){Nu(n,n.return,i)}}break;case 27:null===t&&4&l&&As(n);case 26:case 5:Xs(e,n),null===t&&4&l&&Ss(n),512&l&&ks(n,n.return);break;case 12:Xs(e,n);break;case 31:Xs(e,n),4&l&&Bs(e,n);break;case 13:Xs(e,n),4&l&&qs(e,n),64&l&&(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 l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}(e,n=Tu.bind(null,n))));break;case 22:if(!(l=null!==n.memoizedState||zs)){t=null!==t&&null!==t.memoizedState||Ls,r=zs;var a=Ls;zs=l,(Ls=t)&&!a?Js(e,n,!!(8772&n.subtreeFlags)):Xs(e,n),zs=r,Ls=a}break;case 30:break;default:Xs(e,n)}}function Rs(e){var t=e.alternate;null!==t&&(e.alternate=null,Rs(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&Ye(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 Os=null,Fs=!1;function js(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(ye,n)}catch(a){}switch(n.tag){case 26:Ls||Cs(n,t),js(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode).parentNode.removeChild(n);break;case 27:Ls||Cs(n,t);var l=Os,r=Fs;_d(n.type)&&(Os=n.stateNode,Fs=!1),js(e,t,n),jd(n.stateNode),Os=l,Fs=r;break;case 5:Ls||Cs(n,t);case 6:if(l=Os,r=Fs,Os=null,js(e,t,n),Fs=r,null!==(Os=l))if(Fs)try{(9===Os.nodeType?Os.body:"HTML"===Os.nodeName?Os.ownerDocument.body:Os).removeChild(n.stateNode)}catch(i){Nu(n,t,i)}else try{Os.removeChild(n.stateNode)}catch(i){Nu(n,t,i)}break;case 18:null!==Os&&(Fs?(Td(9===(e=Os).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,n.stateNode),Hb(e)):Td(Os,n.stateNode));break;case 4:l=Os,r=Fs,Os=n.stateNode.containerInfo,Fs=!0,js(e,t,n),Os=l,Fs=r;break;case 0:case 11:case 14:case 15:ys(2,n,t),Ls||ys(4,n,t),js(e,t,n);break;case 1:Ls||(Cs(n,t),"function"==typeof(l=n.stateNode).componentWillUnmount&&xs(n,t,l)),js(e,t,n);break;case 21:js(e,t,n);break;case 22:Ls=(l=Ls)||null!==n.memoizedState,js(e,t,n),Ls=l;break;default:js(e,t,n)}}function Bs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Hb(e)}catch(n){Nu(t,t.return,n)}}}function qs(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Hb(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 Ps),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Ps),t;default:throw Error(r(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var l=Au.bind(null,e,t);t.then(l,l)}})}function Vs(e,t){var n=t.deletions;if(null!==n)for(var l=0;l<n.length;l++){var a=n[l],i=e,o=t,s=o;e:for(;null!==s;){switch(s.tag){case 27:if(_d(s.type)){Os=s.stateNode,Fs=!1;break e}break;case 5:Os=s.stateNode,Fs=!1;break e;case 3:case 4:Os=s.stateNode.containerInfo,Fs=!0;break e}s=s.return}if(null===Os)throw Error(r(160));Us(i,o,a),Os=null,Fs=!1,null!==(i=a.alternate)&&(i.return=null),a.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,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Vs(t,e),Gs(e),4&l&&(ys(3,e,e.return),vs(3,e),ys(5,e,e.return));break;case 1:Vs(t,e),Gs(e),512&l&&(Ls||null===n||Cs(n,n.return)),64&l&&zs&&(null!==(e=e.updateQueue)&&(null!==(l=e.callbacks)&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===n?l:n.concat(l))));break;case 26:var a=Hs;if(Vs(t,e),Gs(e),512&l&&(Ls||null===n||Cs(n,n.return)),4&l){var i=null!==n?n.memoizedState:null;if(l=e.memoizedState,null===n)if(null===l)if(null===e.stateNode){e:{l=e.type,n=e.memoizedProps,a=a.ownerDocument||a;t:switch(l){case"title":(!(i=a.getElementsByTagName("title")[0])||i[Xe]||i[qe]||"http://www.w3.org/2000/svg"===i.namespaceURI||i.hasAttribute("itemprop"))&&(i=a.createElement(l),a.head.insertBefore(i,a.querySelector("head > title"))),hd(i,l,n),i[qe]=e,nt(i),l=i;break e;case"link":var o=rb("link","href",a).get(l+(n.href||""));if(o)for(var s=0;s<o.length;s++)if((i=o[s]).getAttribute("href")===(null==n.href||""===n.href?null:n.href)&&i.getAttribute("rel")===(null==n.rel?null:n.rel)&&i.getAttribute("title")===(null==n.title?null:n.title)&&i.getAttribute("crossorigin")===(null==n.crossOrigin?null:n.crossOrigin)){o.splice(s,1);break t}hd(i=a.createElement(l),l,n),a.head.appendChild(i);break;case"meta":if(o=rb("meta","content",a).get(l+(n.content||"")))for(s=0;s<o.length;s++)if((i=o[s]).getAttribute("content")===(null==n.content?null:""+n.content)&&i.getAttribute("name")===(null==n.name?null:n.name)&&i.getAttribute("property")===(null==n.property?null:n.property)&&i.getAttribute("http-equiv")===(null==n.httpEquiv?null:n.httpEquiv)&&i.getAttribute("charset")===(null==n.charSet?null:n.charSet)){o.splice(s,1);break t}hd(i=a.createElement(l),l,n),a.head.appendChild(i);break;default:throw Error(r(468,l))}i[qe]=e,nt(i),l=i}e.stateNode=l}else ab(a,e.type,e.stateNode);else e.stateNode=Zd(a,l,e.memoizedProps);else i!==l?(null===i?null!==n.stateNode&&(n=n.stateNode).parentNode.removeChild(n):i.count--,null===l?ab(a,e.type,e.stateNode):Zd(a,l,e.memoizedProps)):null===l&&null!==e.stateNode&&Ns(e,e.memoizedProps,n.memoizedProps)}break;case 27:Vs(t,e),Gs(e),512&l&&(Ls||null===n||Cs(n,n.return)),null!==n&&4&l&&Ns(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Vs(t,e),Gs(e),512&l&&(Ls||null===n||Cs(n,n.return)),32&e.flags){a=e.stateNode;try{Et(a,"")}catch(p){Nu(e,e.return,p)}}4&l&&null!=e.stateNode&&Ns(e,a=e.memoizedProps,null!==n?n.memoizedProps:a),1024&l&&(Ms=!0);break;case 6:if(Vs(t,e),Gs(e),4&l){if(null===e.stateNode)throw Error(r(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(p){Nu(e,e.return,p)}}break;case 3:if(lb=null,a=Hs,Hs=qd(t.containerInfo),Vs(t,e),Hs=a,Gs(e),4&l&&null!==n&&n.memoizedState.isDehydrated)try{Hb(t.containerInfo)}catch(p){Nu(e,e.return,p)}Ms&&(Ms=!1,Qs(e));break;case 4:l=Hs,Hs=qd(e.stateNode.containerInfo),Vs(t,e),Gs(e),Hs=l;break;case 12:default:Vs(t,e),Gs(e);break;case 31:case 19:Vs(t,e),Gs(e),4&l&&(null!==(l=e.updateQueue)&&(e.updateQueue=null,Ws(e,l)));break;case 13:Vs(t,e),Gs(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==n&&null!==n.memoizedState)&&(Pc=ue()),4&l&&(null!==(l=e.updateQueue)&&(e.updateQueue=null,Ws(e,l)));break;case 22:a=null!==e.memoizedState;var c=null!==n&&null!==n.memoizedState,u=zs,d=Ls;if(zs=u||a,Ls=d||c,Vs(t,e),Ls=d,zs=u,Gs(e),8192&l)e:for(t=e.stateNode,t._visibility=a?-2&t._visibility:1|t._visibility,a&&(null===n||c||zs||Ls||Ys(e)),n=null,t=e;;){if(5===t.tag||26===t.tag){if(null===n){c=n=t;try{if(i=c.stateNode,a)"function"==typeof(o=i.style).setProperty?o.setProperty("display","none","important"):o.display="none";else{s=c.stateNode;var b=c.memoizedProps.style,m=null!=b&&b.hasOwnProperty("display")?b.display:null;s.style.display=null==m||"boolean"==typeof m?"":(""+m).trim()}}catch(p){Nu(c,c.return,p)}}}else if(6===t.tag){if(null===n){c=t;try{c.stateNode.nodeValue=a?"":c.memoizedProps}catch(p){Nu(c,c.return,p)}}}else if(18===t.tag){if(null===n){c=t;try{var h=c.stateNode;a?Ad(h,!0):Ad(c.stateNode,!1)}catch(p){Nu(c,c.return,p)}}}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&l&&(null!==(l=e.updateQueue)&&(null!==(n=l.retryQueue)&&(l.retryQueue=null,Ws(e,n))));case 30:case 21:}}function Gs(e){var t=e.flags;if(2&t){try{for(var n,l=e.return;null!==l;){if(Es(l)){n=l;break}l=l.return}if(null==n)throw Error(r(160));switch(n.tag){case 27:var a=n.stateNode;Ts(e,$s(e),a);break;case 5:var i=n.stateNode;32&n.flags&&(Et(i,""),n.flags&=-33),Ts(e,$s(e),i);break;case 3:case 4:var o=n.stateNode.containerInfo;_s(e,$s(e),o);break;default:throw Error(r(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 Xs(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Ds(e,t.alternate,t),t=t.sibling}function Ys(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ys(4,t,t.return),Ys(t);break;case 1:Cs(t,t.return);var n=t.stateNode;"function"==typeof n.componentWillUnmount&&xs(t,t.return,n),Ys(t);break;case 27:jd(t.stateNode);case 26:case 5:Cs(t,t.return),Ys(t);break;case 22:null===t.memoizedState&&Ys(t);break;default:Ys(t)}e=e.sibling}}function Js(e,t,n){for(n=n&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var l=t.alternate,r=e,a=t,i=a.flags;switch(a.tag){case 0:case 11:case 15:Js(r,a,n),vs(4,a);break;case 1:if(Js(r,a,n),"function"==typeof(r=(l=a).stateNode).componentDidMount)try{r.componentDidMount()}catch(c){Nu(l,l.return,c)}if(null!==(r=(l=a).updateQueue)){var o=l.stateNode;try{var s=r.shared.hiddenCallbacks;if(null!==s)for(r.shared.hiddenCallbacks=null,r=0;r<s.length;r++)$a(s[r],o)}catch(c){Nu(l,l.return,c)}}n&&64&i&&ws(a),ks(a,a.return);break;case 27:As(a);case 26:case 5:Js(r,a,n),n&&null===l&&4&i&&Ss(a),ks(a,a.return);break;case 12:Js(r,a,n);break;case 31:Js(r,a,n),n&&4&i&&Bs(r,a);break;case 13:Js(r,a,n),n&&4&i&&qs(r,a);break;case 22:null===a.memoizedState&&Js(r,a,n),ks(a,a.return);break;case 30:break;default:Js(r,a,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&&Br(n))}function ec(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Br(e))}function tc(e,t,n,l){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)nc(e,t,n,l),t=t.sibling}function nc(e,t,n,l){var r=t.flags;switch(t.tag){case 0:case 11:case 15:tc(e,t,n,l),2048&r&&vs(9,t);break;case 1:case 31:case 13:default:tc(e,t,n,l);break;case 3:tc(e,t,n,l),2048&r&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Br(e)));break;case 12:if(2048&r){tc(e,t,n,l),e=t.stateNode;try{var a=t.memoizedProps,i=a.id,o=a.onPostCommit;"function"==typeof o&&o(i,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(s){Nu(t,t.return,s)}}else tc(e,t,n,l);break;case 23:break;case 22:a=t.stateNode,i=t.alternate,null!==t.memoizedState?2&a._visibility?tc(e,t,n,l):rc(e,t):2&a._visibility?tc(e,t,n,l):(a._visibility|=2,lc(e,t,n,l,!!(10256&t.subtreeFlags)||!1)),2048&r&&Zs(i,t);break;case 24:tc(e,t,n,l),2048&r&&ec(t.alternate,t)}}function lc(e,t,n,l,r){for(r=r&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var a=e,i=t,o=n,s=l,c=i.flags;switch(i.tag){case 0:case 11:case 15:lc(a,i,o,s,r),vs(8,i);break;case 23:break;case 22:var u=i.stateNode;null!==i.memoizedState?2&u._visibility?lc(a,i,o,s,r):rc(a,i):(u._visibility|=2,lc(a,i,o,s,r)),r&&2048&c&&Zs(i.alternate,i);break;case 24:lc(a,i,o,s,r),r&&2048&c&&ec(i.alternate,i);break;default:lc(a,i,o,s,r)}t=t.sibling}}function rc(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=e,l=t,r=l.flags;switch(l.tag){case 22:rc(n,l),2048&r&&Zs(l.alternate,l);break;case 24:rc(n,l),2048&r&&ec(l.alternate,l);break;default:rc(n,l)}t=t.sibling}}var ac=8192;function ic(e,t,n){if(e.subtreeFlags&ac)for(e=e.child;null!==e;)oc(e,t,n),e=e.sibling}function oc(e,t,n){switch(e.tag){case 26:ic(e,t,n),e.flags&ac&&null!==e.memoizedState&&function(e,t,n,l){if(!("stylesheet"!==n.type||"string"==typeof l.media&&!1===matchMedia(l.media).matches||4&n.state.loading)){if(null===n.instance){var r=Gd(l.href),a=t.querySelector(Qd(r));if(a)return null!==(t=a._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=sb.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,void nt(a);a=t.ownerDocument||t,l=Xd(l),(r=Ud.get(r))&&tb(l,r),nt(a=a.createElement("link"));var i=a;i._p=new Promise(function(e,t){i.onload=e,i.onerror=t}),hd(a,"link",l),n.instance=a}null===e.stylesheets&&(e.stylesheets=/* @__PURE__ */new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(3&n.state.loading)&&(e.count++,n=sb.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}(n,Hs,e.memoizedState,e.memoizedProps);break;case 5:default:ic(e,t,n);break;case 3:case 4:var l=Hs;Hs=qd(e.stateNode.containerInfo),ic(e,t,n),Hs=l;break;case 22:null===e.memoizedState&&(null!==(l=e.alternate)&&null!==l.memoizedState?(l=ac,ac=16777216,ic(e,t,n),ac=l):ic(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 l=t[n];Is=l,bc(l,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&&ys(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 l=t[n];Is=l,bc(l,e)}sc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:ys(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 bc(e,t){for(;null!==Is;){var n=Is;switch(n.tag){case 0:case 11:case 15:ys(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var l=n.memoizedState.cachePool.pool;null!=l&&l.refCount++}break;case 24:Br(n.memoizedState.cache)}if(null!==(l=n.child))l.return=n,Is=l;else e:for(n=e;null!==Is;){var r=(l=Is).sibling,a=l.return;if(Rs(l),l===n){Is=null;break e}if(null!==r){r.return=a,Is=r;break e}Is=a}}}var mc={getCacheForType:function(e){var t=Pr(jr),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Pr(jr).controller.signal}},hc="function"==typeof WeakMap?WeakMap:Map,pc=0,fc=null,gc=null,vc=0,yc=0,wc=null,xc=!1,kc=!1,Cc=!1,Sc=0,Nc=0,Ec=0,$c=0,_c=0,Tc=0,Ac=0,zc=null,Lc=null,Mc=!1,Pc=0,Ic=0,Dc=1/0,Rc=null,Oc=null,Fc=0,jc=null,Uc=null,Bc=0,qc=0,Wc=null,Vc=null,Hc=0,Kc=null;function Gc(){return 2&pc&&0!==vc?vc&-vc:null!==D.T?Wu():je()}function Qc(){if(0===Tc)if(536870912&vc&&!mr)Tc=536870912;else{var e=Ee;!(3932160&(Ee<<=1))&&(Ee=262144),Tc=e}return null!==(e=Pa.current)&&(e.flags|=32),Tc}function Xc(e,t,n){(e!==fc||2!==yc&&9!==yc)&&null===e.cancelPendingCommit||(lu(e,0),eu(e,vc,Tc,!1)),Pe(e,n),2&pc&&e===fc||(e===fc&&(!(2&pc)&&($c|=n),4===Nc&&eu(e,vc,Tc,!1)),Ru(e))}function Yc(e,t,n){if(6&pc)throw Error(r(327));for(var l=!n&&!(127&t)&&0===(t&e.expiredLanes)||Ae(e,t),a=l?function(e,t){var n=pc;pc|=2;var l=iu(),a=ou();fc!==e||vc!==t?(Rc=null,Dc=ue()+500,lu(e,t)):kc=Ae(e,t);e:for(;;)try{if(0!==yc&&null!==gc){t=gc;var i=wc;t:switch(yc){case 1:yc=0,wc=null,hu(e,t,i,1);break;case 2:case 9:if(la(i)){yc=0,wc=null,mu(t);break}t=function(){2!==yc&&9!==yc||fc!==e||(yc=7),Ru(e)},i.then(t,t);break e;case 3:yc=7;break e;case 4:yc=5;break e;case 7:la(i)?(yc=0,wc=null,mu(t)):(yc=0,wc=null,hu(e,t,i,7));break;case 5:var o=null;switch(gc.tag){case 26:o=gc.memoizedState;case 5:case 27:var s=gc;if(o?ib(o):s.stateNode.complete){yc=0,wc=null;var c=s.sibling;if(null!==c)gc=c;else{var u=s.return;null!==u?(gc=u,pu(u)):gc=null}break t}}yc=0,wc=null,hu(e,t,i,5);break;case 6:yc=0,wc=null,hu(e,t,i,6);break;case 8:nu(),Nc=6;break e;default:throw Error(r(462))}}du();break}catch(d){ru(e,d)}return Er=Nr=null,D.H=l,D.A=a,pc=n,null!==gc?0:(fc=null,vc=0,Ll(),Nc)}(e,t):cu(e,t,!0),i=l;;){if(0===a){kc&&!l&&eu(e,t,0,!1);break}if(n=e.current.alternate,!i||Zc(n)){if(2===a){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=0!==(o=-536870913&e.pendingLanes)?o:536870912&o?536870912:0;if(0!==o){t=o;e:{var s=e;a=zc;var c=s.current.memoizedState.isDehydrated;if(c&&(lu(s,o).flags|=256),2!==(o=cu(s,o,!1))){if(Cc&&!c){s.errorRecoveryDisabledLanes|=i,$c|=i,a=4;break e}i=Lc,Lc=a,null!==i&&(null===Lc?Lc=i:Lc.push.apply(Lc,i))}a=o}if(i=!1,2!==a)continue}}if(1===a){lu(e,0),eu(e,t,0,!0);break}e:{switch(l=e,i=a){case 0:case 1:throw Error(r(345));case 4:if((4194048&t)!==t)break;case 6:eu(l,t,Tc,!xc);break e;case 2:Lc=null;break;case 3:case 5:break;default:throw Error(r(329))}if((62914560&t)===t&&10<(a=Pc+300-ue())){if(eu(l,t,Tc,!xc),0!==Te(l,0,!0))break e;Bc=t,l.timeoutHandle=Cd(Jc.bind(null,l,n,Lc,Rc,Mc,t,Tc,$c,Ac,xc,i,"Throttled",-0,0),a)}else Jc(l,n,Lc,Rc,Mc,t,Tc,$c,Ac,xc,i,null,-0,0)}break}a=cu(e,t,!1),i=!1}Ru(e)}function Jc(e,t,n,l,r,a,i,o,s,c,u,d,b,m){if(e.timeoutHandle=-1,8192&(d=t.subtreeFlags)||!(16785408&~d)){oc(t,a,d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Pt});var h=(62914560&a)===a?Pc-ue():(4194048&a)===a?Ic-ue():0;if(null!==(h=function(e,t){return e.stylesheets&&0===e.count&&ub(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&ub(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===ob&&(ob=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var r=n[l],a=r.transferSize,i=r.initiatorType,o=r.duration;if(a&&o&&pd(i)){for(i=0,o=r.responseEnd,l+=1;l<n.length;l++){var s=n[l],c=s.startTime;if(c>o)break;var u=s.transferSize,d=s.initiatorType;u&&pd(d)&&(i+=u*((s=s.responseEnd)<o?1:(o-c)/(s-c)))}if(--l,t+=8*(a+i)/(r.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var r=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&ub(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ob?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(r)}}:null}(d,h)))return Bc=a,e.cancelPendingCommit=h(gu.bind(null,e,t,a,n,l,r,i,o,s,u,d,null,b,m)),void eu(e,a,i,!c)}gu(e,t,a,n,l,r,i,o,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 l=0;l<n.length;l++){var r=n[l],a=r.getSnapshot;r=r.value;try{if(!el(a(),r))return!1}catch(i){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,l){t&=~_c,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var r=t;0<r;){var a=31-ke(r),i=1<<a;l[a]=-1,r&=~i}0!==n&&Ie(e,n,t)}function tu(){return!!(6&pc)||(Ou(0),!1)}function nu(){if(null!==gc){if(0===yc)var e=gc.return;else Er=Nr=null,si(e=gc),ca=null,ua=0,e=gc;for(;null!==e;)gs(e.alternate,e),e=e.return;gc=null}}function lu(e,t){var n=e.timeoutHandle;-1!==n&&(e.timeoutHandle=-1,Sd(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),Bc=0,nu(),fc=e,gc=n=Bl(e.current,null),vc=t,yc=0,wc=null,xc=!1,kc=Ae(e,t),Cc=!1,Ac=Tc=_c=$c=Ec=Nc=0,Lc=zc=null,Mc=!1,8&t&&(t|=32&t);var l=e.entangledLanes;if(0!==l)for(e=e.entanglements,l&=t;0<l;){var r=31-ke(l),a=1<<r;t|=e[r],l&=~a}return Sc=t,Ll(),n}function ru(e,t){Wa=null,D.H=go,t===Zr||t===ta?(t=oa(),yc=3):t===ea?(t=oa(),yc=4):yc=t===Po?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,wc=t,null===gc&&(Nc=1,To(e,Xl(t,e.current)))}function au(){var e=Pa.current;return null===e||((4194048&vc)===vc?null===Ia:!!((62914560&vc)===vc||536870912&vc)&&e===Ia)}function iu(){var e=D.H;return D.H=go,null===e?go:e}function ou(){var e=D.A;return D.A=mc,e}function su(){Nc=4,xc||(4194048&vc)!==vc&&null!==Pa.current||(kc=!0),!(134217727&Ec)&&!(134217727&$c)||null===fc||eu(fc,vc,Tc,!1)}function cu(e,t,n){var l=pc;pc|=2;var r=iu(),a=ou();fc===e&&vc===t||(Rc=null,lu(e,t)),t=!1;var i=Nc;e:for(;;)try{if(0!==yc&&null!==gc){var o=gc,s=wc;switch(yc){case 8:nu(),i=6;break e;case 3:case 2:case 9:case 6:null===Pa.current&&(t=!0);var c=yc;if(yc=0,wc=null,hu(e,o,s,c),n&&kc){i=0;break e}break;default:c=yc,yc=0,wc=null,hu(e,o,s,c)}}uu(),i=Nc;break}catch(u){ru(e,u)}return t&&e.shellSuspendCounter++,Er=Nr=null,pc=l,D.H=r,D.A=a,null===gc&&(fc=null,vc=0,Ll()),i}function uu(){for(;null!==gc;)bu(gc)}function du(){for(;null!==gc&&!se();)bu(gc)}function bu(e){var t=ss(e.alternate,e,Sc);e.memoizedProps=e.pendingProps,null===t?pu(e):gc=t}function mu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ko(n,t,t.pendingProps,t.type,void 0,vc);break;case 11:t=Ko(n,t,t.pendingProps,t.type.render,t.ref,vc);break;case 5:si(t);default:gs(n,t),t=ss(n,t=gc=ql(t,Sc),Sc)}e.memoizedProps=e.pendingProps,null===t?pu(e):gc=t}function hu(e,t,n,l){Er=Nr=null,si(t),ca=null,ua=0;var a=t.return;try{if(function(e,t,n,l,a){if(n.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){if(null!==(t=n.alternate)&&zr(t,n,a,!0),null!==(n=Pa.current)){switch(n.tag){case 31:case 13:return null===Ia?su():null===n.alternate&&0===Nc&&(Nc=3),n.flags&=-257,n.flags|=65536,n.lanes=a,l===na?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=/* @__PURE__ */new Set([l]):t.add(l),Eu(e,l,a)),!1;case 22:return n.flags|=65536,l===na?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:/* @__PURE__ */new Set([l])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=/* @__PURE__ */new Set([l]):n.add(l),Eu(e,l,a)),!1}throw Error(r(435,n.tag))}return Eu(e,l,a),su(),!1}if(mr)return null!==(t=Pa.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=a,l!==fr&&Cr(Xl(e=Error(r(422),{cause:l}),n))):(l!==fr&&Cr(Xl(t=Error(r(423),{cause:l}),n)),(e=e.current.alternate).flags|=65536,a&=-a,e.lanes|=a,l=Xl(l,n),Ca(e,a=zo(e.stateNode,l,a)),4!==Nc&&(Nc=2)),!1;var i=Error(r(520),{cause:l});if(i=Xl(i,n),null===zc?zc=[i]:zc.push(i),4!==Nc&&(Nc=2),null===t)return!0;l=Xl(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,Ca(n,e=zo(n.stateNode,l,e)),!1;case 1:if(t=n.type,i=n.stateNode,!(128&n.flags||"function"!=typeof t.getDerivedStateFromError&&(null===i||"function"!=typeof i.componentDidCatch||null!==Oc&&Oc.has(i))))return n.flags|=65536,a&=-a,n.lanes|=a,Mo(a=Lo(a),e,n,l),Ca(n,a),!1}n=n.return}while(null!==n);return!1}(e,a,t,n,vc))return Nc=1,To(e,Xl(n,e.current)),void(gc=null)}catch(i){if(null!==a)throw gc=a,i;return Nc=1,To(e,Xl(n,e.current)),void(gc=null)}32768&t.flags?(mr||1===l?e=!0:kc||536870912&vc?e=!1:(xc=e=!0,(2===l||9===l||3===l||6===l)&&(null!==(l=Pa.current)&&13===l.tag&&(l.flags|=16384))),fu(t,e)):pu(t)}function pu(e){var t=e;do{if(32768&t.flags)return void fu(t,xc);e=t.return;var n=ps(t.alternate,t,Sc);if(null!==n)return void(gc=n);if(null!==(t=t.sibling))return void(gc=t);gc=t=e}while(null!==t);0===Nc&&(Nc=5)}function fu(e,t){do{var n=fs(e.alternate,e);if(null!==n)return n.flags&=32767,void(gc=n);if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&null!==(e=e.sibling))return void(gc=e);gc=e=n}while(null!==e);Nc=6,gc=null}function gu(e,t,n,l,a,i,o,s,c){e.cancelPendingCommit=null;do{ku()}while(0!==Fc);if(6&pc)throw Error(r(327));if(null!==t){if(t===e.current)throw Error(r(177));if(i=t.lanes|t.childLanes,function(e,t,n,l,r,a){var i=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 o=e.entanglements,s=e.expirationTimes,c=e.hiddenUpdates;for(n=i&~n;0<n;){var u=31-ke(n),d=1<<u;o[u]=0,s[u]=-1;var b=c[u];if(null!==b)for(c[u]=null,u=0;u<b.length;u++){var m=b[u];null!==m&&(m.lane&=-536870913)}n&=~d}0!==l&&Ie(e,l,0),0!==a&&0===r&&0!==e.tag&&(e.suspendedLanes|=a&~(i&~t))}(e,n,i|=zl,o,s,c),e===fc&&(gc=fc=null,vc=0),Uc=t,jc=e,Bc=n,qc=i,Wc=a,Vc=l,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,ie(he,function(){return Cu(),null})):(e.callbackNode=null,e.callbackPriority=0),l=!!(13878&t.flags),13878&t.subtreeFlags||l){l=D.T,D.T=null,a=R.p,R.p=2,o=pc,pc|=4;try{!function(e,t){if(e=e.containerInfo,fd=xb,il(e=al(e))){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var l=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(l&&0!==l.rangeCount){n=l.anchorNode;var a=l.anchorOffset,i=l.focusNode;l=l.focusOffset;try{n.nodeType,i.nodeType}catch(f){n=null;break e}var o=0,s=-1,c=-1,u=0,d=0,b=e,m=null;t:for(;;){for(var h;b!==n||0!==a&&3!==b.nodeType||(s=o+a),b!==i||0!==l&&3!==b.nodeType||(c=o+l),3===b.nodeType&&(o+=b.nodeValue.length),null!==(h=b.firstChild);)m=b,b=h;for(;;){if(b===e)break t;if(m===n&&++u===a&&(s=o),m===i&&++d===l&&(c=o),null!==(h=b.nextSibling))break;m=(b=m).parentNode}b=h}n=-1===s||-1===c?null:{start:s,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(gd={focusedElem:e,selectionRange:n},xb=!1,Is=t;null!==Is;)if(e=(t=Is).child,1028&t.subtreeFlags&&null!==e)e.return=t,Is=e;else for(;null!==Is;){switch(i=(t=Is).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++)(a=e[n]).ref.impl=a.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!==i){e=void 0,n=t,a=i.memoizedProps,i=i.memoizedState,l=n.stateNode;try{var p=No(n.type,a);e=l.getSnapshotBeforeUpdate(p,i),l.__reactInternalSnapshotBeforeUpdate=e}catch(g){Nu(n,n.return,g)}}break;case 3:if(1024&e)if(9===(n=(e=t.stateNode.containerInfo).nodeType))zd(e);else if(1===n)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zd(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(r(163))}if(null!==(e=t.sibling)){e.return=t.return,Is=e;break}Is=t.return}}(e,t)}finally{pc=o,R.p=a,D.T=l}}Fc=1,vu(),yu(),wu()}}function vu(){if(1===Fc){Fc=0;var e=jc,t=Uc,n=!!(13878&t.flags);if(13878&t.subtreeFlags||n){n=D.T,D.T=null;var l=R.p;R.p=2;var r=pc;pc|=4;try{Ks(t,e);var a=gd,i=al(e.containerInfo),o=a.focusedElem,s=a.selectionRange;if(i!==o&&o&&o.ownerDocument&&rl(o.ownerDocument.documentElement,o)){if(null!==s&&il(o)){var c=s.start,u=s.end;if(void 0===u&&(u=c),"selectionStart"in o)o.selectionStart=c,o.selectionEnd=Math.min(u,o.value.length);else{var d=o.ownerDocument||document,b=d&&d.defaultView||window;if(b.getSelection){var m=b.getSelection(),h=o.textContent.length,p=Math.min(s.start,h),f=void 0===s.end?p:Math.min(s.end,h);!m.extend&&p>f&&(i=f,f=p,p=i);var g=ll(o,p),v=ll(o,f);if(g&&v&&(1!==m.rangeCount||m.anchorNode!==g.node||m.anchorOffset!==g.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var y=d.createRange();y.setStart(g.node,g.offset),m.removeAllRanges(),p>f?(m.addRange(y),m.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),m.addRange(y))}}}}for(d=[],m=o;m=m.parentNode;)1===m.nodeType&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for("function"==typeof o.focus&&o.focus(),o=0;o<d.length;o++){var w=d[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}xb=!!fd,gd=fd=null}finally{pc=r,R.p=l,D.T=n}}e.current=t,Fc=2}}function yu(){if(2===Fc){Fc=0;var e=jc,t=Uc,n=!!(8772&t.flags);if(8772&t.subtreeFlags||n){n=D.T,D.T=null;var l=R.p;R.p=2;var r=pc;pc|=4;try{Ds(e,t.alternate,t)}finally{pc=r,R.p=l,D.T=n}}Fc=3}}function wu(){if(4===Fc||3===Fc){Fc=0,ce();var e=jc,t=Uc,n=Bc,l=Vc;10256&t.subtreeFlags||10256&t.flags?Fc=5:(Fc=0,Uc=jc=null,xu(e,e.pendingLanes));var r=e.pendingLanes;if(0===r&&(Oc=null),Fe(n),t=t.stateNode,we&&"function"==typeof we.onCommitFiberRoot)try{we.onCommitFiberRoot(ye,t,void 0,!(128&~t.current.flags))}catch(s){}if(null!==l){t=D.T,r=R.p,R.p=2,D.T=null;try{for(var a=e.onRecoverableError,i=0;i<l.length;i++){var o=l[i];a(o.value,{componentStack:o.stack})}}finally{D.T=t,R.p=r}}3&Bc&&ku(),Ru(e),r=e.pendingLanes,261930&n&&42&r?e===Kc?Hc++:(Hc=0,Kc=e):Hc=0,Ou(0)}}function xu(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,Br(t)))}function ku(){return vu(),yu(),wu(),Cu()}function Cu(){if(5!==Fc)return!1;var e=jc,t=qc;qc=0;var n=Fe(Bc),l=D.T,a=R.p;try{R.p=32>n?32:n,D.T=null,n=Wc,Wc=null;var i=jc,o=Bc;if(Fc=0,Uc=jc=null,Bc=0,6&pc)throw Error(r(331));var s=pc;if(pc|=4,uc(i.current),nc(i,i.current,o,n),pc=s,Ou(0,!1),we&&"function"==typeof we.onPostCommitFiberRoot)try{we.onPostCommitFiberRoot(ye,i)}catch(c){}return!0}finally{R.p=a,D.T=l,xu(e,t)}}function Su(e,t,n){t=Xl(n,t),null!==(e=xa(e,t=zo(e.stateNode,t,2),2))&&(Pe(e,2),Ru(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 l=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof l.componentDidCatch&&(null===Oc||!Oc.has(l))){e=Xl(n,e),null!==(l=xa(t,n=Lo(2),2))&&(Mo(n,l,t,e),Pe(l,2),Ru(l));break}}t=t.return}}function Eu(e,t,n){var l=e.pingCache;if(null===l){l=e.pingCache=new hc;var r=/* @__PURE__ */new Set;l.set(t,r)}else void 0===(r=l.get(t))&&(r=/* @__PURE__ */new Set,l.set(t,r));r.has(n)||(Cc=!0,r.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var l=e.pingCache;null!==l&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,fc===e&&(vc&n)===n&&(4===Nc||3===Nc&&(62914560&vc)===vc&&300>ue()-Pc?!(2&pc)&&lu(e,0):_c|=n,Ac===vc&&(Ac=0)),Ru(e)}function _u(e,t){0===t&&(t=Le()),null!==(e=Il(e,t))&&(Pe(e,t),Ru(e))}function Tu(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),_u(e,n)}function Au(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}null!==l&&l.delete(t),_u(e,n)}var zu=null,Lu=null,Mu=!1,Pu=!1,Iu=!1,Du=0;function Ru(e){e!==Lu&&null===e.next&&(null===Lu?zu=Lu=e:Lu=Lu.next=e),Pu=!0,Mu||(Mu=!0,Ed(function(){6&pc?ie(be,Fu):ju()}))}function Ou(e,t){if(!Iu&&Pu){Iu=!0;do{for(var n=!1,l=zu;null!==l;){if(0!==e){var r=l.pendingLanes;if(0===r)var a=0;else{var i=l.suspendedLanes,o=l.pingedLanes;a=(1<<31-ke(42|e)+1)-1,a=201326741&(a&=r&~(i&~o))?201326741&a|1:a?2|a:0}0!==a&&(n=!0,qu(l,a))}else a=vc,!(3&(a=Te(l,l===fc?a:0,null!==l.cancelPendingCommit||-1!==l.timeoutHandle)))||Ae(l,a)||(n=!0,qu(l,a));l=l.next}}while(n);Iu=!1}}function Fu(){ju()}function ju(){Pu=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,l=zu;null!==l;){var r=l.next,a=Uu(l,t);0===a?(l.next=null,null===n?zu=r:n.next=r,null===r&&(Lu=n)):(n=l,(0!==e||3&a)&&(Pu=!0)),l=r}0!==Fc&&5!==Fc||Ou(e),0!==Du&&(Du=0)}function Uu(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,r=e.expirationTimes,a=-62914561&e.pendingLanes;0<a;){var i=31-ke(a),o=1<<i,s=r[i];-1===s?0!==(o&n)&&0===(o&l)||(r[i]=ze(o,t)):s<=t&&(e.expiredLanes|=o),a&=~o}if(n=vc,n=Te(e,e===(t=fc)?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),l=e.callbackNode,0===n||e===t&&(2===yc||9===yc)||null!==e.cancelPendingCommit)return null!==l&&null!==l&&oe(l),e.callbackNode=null,e.callbackPriority=0;if(!(3&n)||Ae(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==l&&oe(l),Fe(n)){case 2:case 8:n=me;break;case 32:default:n=he;break;case 268435456:n=fe}return l=Bu.bind(null,e),n=ie(n,l),e.callbackPriority=t,e.callbackNode=n,t}return null!==l&&null!==l&&oe(l),e.callbackPriority=2,e.callbackNode=null,2}function Bu(e,t){if(0!==Fc&&5!==Fc)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ku()&&e.callbackNode!==n)return null;var l=vc;return 0===(l=Te(e,e===fc?l:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Yc(e,l,t),Uu(e,ue()),null!=e.callbackNode&&e.callbackNode===n?Bu.bind(null,e):null)}function qu(e,t){if(ku())return null;Yc(e,t,!0)}function Wu(){if(0===Du){var e=Vr;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<El.length;Ku++){var Gu=El[Ku];$l(Gu.toLowerCase(),"on"+(Gu[0].toUpperCase()+Gu.slice(1)))}$l(vl,"onAnimationEnd"),$l(yl,"onAnimationIteration"),$l(wl,"onAnimationStart"),$l("dblclick","onDoubleClick"),$l("focusin","onFocus"),$l("focusout","onBlur"),$l(xl,"onTransitionRun"),$l(kl,"onTransitionStart"),$l(Cl,"onTransitionCancel"),$l(Sl,"onTransitionEnd"),it("onMouseEnter",["mouseout","mouseover"]),it("onMouseLeave",["mouseout","mouseover"]),it("onPointerEnter",["pointerout","pointerover"]),it("onPointerLeave",["pointerout","pointerover"]),at("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),at("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),at("onBeforeInput",["compositionend","keypress","textInput","paste"]),at("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),at("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),at("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(" "),Xu=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Qu));function Yu(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var l=e[n],r=l.event;l=l.listeners;e:{var a=void 0;if(t)for(var i=l.length-1;0<=i;i--){var o=l[i],s=o.instance,c=o.currentTarget;if(o=o.listener,s!==a&&r.isPropagationStopped())break e;a=o,r.currentTarget=c;try{a(r)}catch(u){_l(u)}r.currentTarget=null,a=s}else for(i=0;i<l.length;i++){if(s=(o=l[i]).instance,c=o.currentTarget,o=o.listener,s!==a&&r.isPropagationStopped())break e;a=o,r.currentTarget=c;try{a(r)}catch(u){_l(u)}r.currentTarget=null,a=s}}}}function Ju(e,t){var n=t[He];void 0===n&&(n=t[He]=/* @__PURE__ */new Set);var l=e+"__bubble";n.has(l)||(nd(t,e,2,!1),n.add(l))}function Zu(e,t,n){var l=0;t&&(l|=4),nd(n,e,l,t)}var ed="_reactListening"+Math.random().toString(36).slice(2);function td(e){if(!e[ed]){e[ed]=!0,lt.forEach(function(t){"selectionchange"!==t&&(Xu.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,l){switch(_b(t)){case 2:var r=kb;break;case 8:r=Cb;break;default:r=Sb}n=r.bind(null,t,n,e),r=void 0,!Wt||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),l?void 0!==r?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):void 0!==r?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function ld(e,t,n,l,r){var a=l;if(!(1&t||2&t||null===l))e:for(;;){if(null===l)return;var o=l.tag;if(3===o||4===o){var s=l.stateNode.containerInfo;if(s===r)break;if(4===o)for(o=l.return;null!==o;){var c=o.tag;if((3===c||4===c)&&o.stateNode.containerInfo===r)return;o=o.return}for(;null!==s;){if(null===(o=Je(s)))return;if(5===(c=o.tag)||6===c||26===c||27===c){l=a=o;continue e}s=s.parentNode}}l=l.return}Ut(function(){var l=a,r=Dt(n),o=[];e:{var s=Nl.get(e);if(void 0!==s){var c=rn,u=e;switch(e){case"keypress":if(0===Xt(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 vl:case yl:case wl:c=bn;break;case Sl:c=Cn;break;case"scroll":case"scrollend":c=on;break;case"wheel":c=Sn;break;case"copy":case"cut":case"paste":c=mn;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),b=!d&&("scroll"===e||"scrollend"===e),m=d?null!==s?s+"Capture":null:s;d=[];for(var h,p=l;null!==p;){var f=p;if(h=f.stateNode,5!==(f=f.tag)&&26!==f&&27!==f||null===h||null===m||null!=(f=Bt(p,m))&&d.push(rd(p,f,h)),b)break;p=p.return}0<d.length&&(s=new c(s,u,null,n,r),o.push({event:s,listeners:d}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===It||!(u=n.relatedTarget||n.fromElement)||!Je(u)&&!u[Ve])&&(c||s)&&(s=r.window===r?r:(s=r.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=l,null!==(u=(u=n.relatedTarget||n.toElement)?Je(u):null)&&(b=i(u),d=u.tag,u!==b||5!==d&&27!==d&&6!==d)&&(u=null)):(c=null,u=l),c!==u)){if(d=cn,f="onMouseLeave",m="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(d=xn,f="onPointerLeave",m="onPointerEnter",p="pointer"),b=null==c?s:et(c),h=null==u?s:et(u),(s=new d(f,p+"leave",c,n,r)).target=b,s.relatedTarget=h,f=null,Je(r)===l&&((d=new d(m,p+"enter",u,n,r)).target=h,d.relatedTarget=b,f=d),b=f,c&&u)e:{for(d=id,p=u,h=0,f=m=c;f;f=d(f))h++;f=0;for(var g=p;g;g=d(g))f++;for(;0<h-f;)m=d(m),h--;for(;0<f-h;)p=d(p),f--;for(;h--;){if(m===p||null!==p&&m===p.alternate){d=m;break e}m=d(m),p=d(p)}d=null}else d=null;null!==c&&od(o,s,c,d,!1),null!==u&&null!==b&&od(o,b,u,d,!0)}if("select"===(c=(s=l?et(l):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var v=qn;else if(Rn(s))if(Wn)v=Zn;else{v=Yn;var y=Xn}else!(c=s.nodeName)||"input"!==c.toLowerCase()||"checkbox"!==s.type&&"radio"!==s.type?l&&At(l.elementType)&&(v=qn):v=Jn;switch(v&&(v=v(e,l))?On(o,v,n,r):(y&&y(e,s,l),"focusout"===e&&l&&"number"===s.type&&null!=l.memoizedProps.value&&kt(s,"number",s.value)),y=l?et(l):window,e){case"focusin":(Rn(y)||"true"===y.contentEditable)&&(sl=y,cl=l,ul=null);break;case"focusout":ul=cl=sl=null;break;case"mousedown":dl=!0;break;case"contextmenu":case"mouseup":case"dragend":dl=!1,bl(o,n,r);break;case"selectionchange":if(ol)break;case"keydown":case"keyup":bl(o,n,r)}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 In?Mn(e,n)&&(x="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(x="onCompositionStart");x&&(An&&"ko"!==n.locale&&(In||"onCompositionStart"!==x?"onCompositionEnd"===x&&In&&(w=Qt()):(Kt="value"in(Ht=r)?Ht.value:Ht.textContent,In=!0)),0<(y=ad(l,x)).length&&(x=new hn(x,e,null,n,r),o.push({event:x,listeners:y}),w?x.data=w:null!==(w=Pn(n))&&(x.data=w))),(w=Tn?function(e,t){switch(e){case"compositionend":return Pn(t);case"keypress":return 32!==t.which?null:(Ln=!0,zn);case"textInput":return(e=t.data)===zn&&Ln?null:e;default:return null}}(e,n):function(e,t){if(In)return"compositionend"===e||!$n&&Mn(e,t)?(e=Qt(),Gt=Kt=Ht=null,In=!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 An&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(x=ad(l,"onBeforeInput")).length&&(y=new hn("onBeforeInput","beforeinput",null,n,r),o.push({event:y,listeners:x}),y.data=w)),function(e,t,n,l,r){if("submit"===t&&n&&n.stateNode===r){var a=Vu((r[We]||null).action),i=l.submitter;i&&null!==(t=(t=i[We]||null)?Vu(t.formAction):i.getAttribute("formAction"))&&(a=t,i=null);var o=new rn("action","action",null,l,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(0!==Du){var e=i?Hu(r,i):new FormData(r);no(n,{pending:!0,data:e,method:r.method,action:a},null,e)}}else"function"==typeof a&&(o.preventDefault(),e=i?Hu(r,i):new FormData(r),no(n,{pending:!0,data:e,method:r.method,action:a},a,e))},currentTarget:r}]})}}(o,e,l,n,r)}Yu(o,t)})}function rd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ad(e,t){for(var n=t+"Capture",l=[];null!==e;){var r=e,a=r.stateNode;if(5!==(r=r.tag)&&26!==r&&27!==r||null===a||(null!=(r=Bt(e,n))&&l.unshift(rd(e,r,a)),null!=(r=Bt(e,t))&&l.push(rd(e,r,a))),3===e.tag)return l;e=e.return}return[]}function id(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function od(e,t,n,l,r){for(var a=t._reactName,i=[];null!==n&&n!==l;){var o=n,s=o.alternate,c=o.stateNode;if(o=o.tag,null!==s&&s===l)break;5!==o&&26!==o&&27!==o||null===c||(s=c,r?null!=(c=Bt(n,a))&&i.unshift(rd(n,c,s)):r||null!=(c=Bt(n,a))&&i.push(rd(n,c,s))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}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 bd(e,t,n,l,a,i){switch(n){case"children":"string"==typeof l?"body"===t||"textarea"===t&&""===l||Et(e,l):("number"==typeof l||"bigint"==typeof l)&&"body"!==t&&Et(e,""+l);break;case"className":dt(e,"class",l);break;case"tabIndex":dt(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":dt(e,n,l);break;case"style":Tt(e,l,i);break;case"data":if("object"!==t){dt(e,"data",l);break}case"src":case"href":if(""===l&&("a"!==t||"href"!==n)){e.removeAttribute(n);break}if(null==l||"function"==typeof l||"symbol"==typeof l||"boolean"==typeof l){e.removeAttribute(n);break}l=Mt(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if("function"==typeof l){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 i&&("formAction"===n?("input"!==t&&bd(e,t,"name",a.name,a,null),bd(e,t,"formEncType",a.formEncType,a,null),bd(e,t,"formMethod",a.formMethod,a,null),bd(e,t,"formTarget",a.formTarget,a,null)):(bd(e,t,"encType",a.encType,a,null),bd(e,t,"method",a.method,a,null),bd(e,t,"target",a.target,a,null))),null==l||"symbol"==typeof l||"boolean"==typeof l){e.removeAttribute(n);break}l=Mt(""+l),e.setAttribute(n,l);break;case"onClick":null!=l&&(e.onclick=Pt);break;case"onScroll":null!=l&&Ju("scroll",e);break;case"onScrollEnd":null!=l&&Ju("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=l){if("object"!=typeof l||!("__html"in l))throw Error(r(61));if(null!=(n=l.__html)){if(null!=a.children)throw Error(r(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&"function"!=typeof l&&"symbol"!=typeof l;break;case"muted":e.muted=l&&"function"!=typeof l&&"symbol"!=typeof l;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==l||"function"==typeof l||"boolean"==typeof l||"symbol"==typeof l){e.removeAttribute("xlink:href");break}n=Mt(""+l),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!=l&&"function"!=typeof l&&"symbol"!=typeof l?e.setAttribute(n,""+l):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":l&&"function"!=typeof l&&"symbol"!=typeof l?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":!0===l?e.setAttribute(n,""):!1!==l&&null!=l&&"function"!=typeof l&&"symbol"!=typeof l?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":null==l||"function"==typeof l||"symbol"==typeof l||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":Ju("beforetoggle",e),Ju("toggle",e),ut(e,"popover",l);break;case"xlinkActuate":bt(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":bt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":bt(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":bt(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":bt(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":bt(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":bt(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":bt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":bt(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ut(e,"is",l);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=zt.get(n)||n,l)}}function md(e,t,n,l,a,i){switch(n){case"style":Tt(e,l,i);break;case"dangerouslySetInnerHTML":if(null!=l){if("object"!=typeof l||!("__html"in l))throw Error(r(61));if(null!=(n=l.__html)){if(null!=a.children)throw Error(r(60));e.innerHTML=n}}break;case"children":"string"==typeof l?Et(e,l):("number"==typeof l||"bigint"==typeof l)&&Et(e,""+l);break;case"onScroll":null!=l&&Ju("scroll",e);break;case"onScrollEnd":null!=l&&Ju("scrollend",e);break;case"onClick":null!=l&&(e.onclick=Pt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:rt.hasOwnProperty(n)||("o"!==n[0]||"n"!==n[1]||(a=n.endsWith("Capture"),t=n.slice(2,a?n.length-7:void 0),"function"==typeof(i=null!=(i=e[We]||null)?i[n]:null)&&e.removeEventListener(t,i,a),"function"!=typeof l)?n in e?e[n]=l:!0===l?e.setAttribute(n,""):ut(e,n,l):("function"!=typeof i&&null!==i&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,a)))}}function hd(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 l,a=!1,i=!1;for(l in n)if(n.hasOwnProperty(l)){var o=n[l];if(null!=o)switch(l){case"src":a=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:bd(e,t,l,o,n,null)}}return i&&bd(e,t,"srcSet",n.srcSet,n,null),void(a&&bd(e,t,"src",n.src,n,null));case"input":Ju("invalid",e);var s=l=o=i=null,c=null,u=null;for(a in n)if(n.hasOwnProperty(a)){var d=n[a];if(null!=d)switch(a){case"name":i=d;break;case"type":o=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":l=d;break;case"defaultValue":s=d;break;case"children":case"dangerouslySetInnerHTML":if(null!=d)throw Error(r(137,t));break;default:bd(e,t,a,d,n,null)}}return void xt(e,l,s,c,u,o,i,!1);case"select":for(i in Ju("invalid",e),a=o=l=null,n)if(n.hasOwnProperty(i)&&null!=(s=n[i]))switch(i){case"value":l=s;break;case"defaultValue":o=s;break;case"multiple":a=s;default:bd(e,t,i,s,n,null)}return t=l,n=o,e.multiple=!!a,void(null!=t?Ct(e,!!a,t,!1):null!=n&&Ct(e,!!a,n,!0));case"textarea":for(o in Ju("invalid",e),l=i=a=null,n)if(n.hasOwnProperty(o)&&null!=(s=n[o]))switch(o){case"value":a=s;break;case"defaultValue":i=s;break;case"children":l=s;break;case"dangerouslySetInnerHTML":if(null!=s)throw Error(r(91));break;default:bd(e,t,o,s,n,null)}return void Nt(e,a,i,l);case"option":for(c in n)if(n.hasOwnProperty(c)&&null!=(a=n[c]))if("selected"===c)e.selected=a&&"function"!=typeof a&&"symbol"!=typeof a;else bd(e,t,c,a,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(a=0;a<Qu.length;a++)Ju(Qu[a],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!=(a=n[u]))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:bd(e,t,u,a,n,null)}return;default:if(At(t)){for(d in n)n.hasOwnProperty(d)&&(void 0!==(a=n[d])&&md(e,t,d,a,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(null!=(a=n[s])&&bd(e,t,s,a,n,null))}function pd(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var fd=null,gd=null;function vd(e){return 9===e.nodeType?e:e.ownerDocument}function yd(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 Td(e,t){var n=t,l=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&8===r.nodeType)if("/$"===(n=r.data)||"/&"===n){if(0===l)return e.removeChild(r),void Hb(t);l--}else if("$"===n||"$?"===n||"$~"===n||"$!"===n||"&"===n)l++;else if("html"===n)jd(e.ownerDocument.documentElement);else if("head"===n){jd(n=e.ownerDocument.head);for(var a=n.firstChild;a;){var i=a.nextSibling,o=a.nodeName;a[Xe]||"SCRIPT"===o||"STYLE"===o||"LINK"===o&&"stylesheet"===a.rel.toLowerCase()||n.removeChild(a),a=i}}else"body"===n&&jd(e.ownerDocument.body);n=r}while(n);Hb(t)}function Ad(e,t){var n=e;e=0;do{var l=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||""),l&&8===l.nodeType)if("/$"===(n=l.data)){if(0===e)break;e--}else"$"!==n&&"$?"!==n&&"$~"!==n&&"$!"!==n||e++;n=l}while(n)}function zd(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":zd(n),Ye(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===n.rel.toLowerCase())continue}e.removeChild(n)}}function Ld(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=Id(e.nextSibling)))return null}return e}function Md(e){return"$?"===e.data||"$~"===e.data}function Pd(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function Id(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 Rd(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n||"/&"===n){if(0===t)return Id(e.nextSibling);t--}else"$"!==n&&"$!"!==n&&"$?"!==n&&"$~"!==n&&"&"!==n||t++}e=e.nextSibling}return null}function Od(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 Fd(e,t,n){switch(t=vd(n),e){case"html":if(!(e=t.documentElement))throw Error(r(452));return e;case"head":if(!(e=t.head))throw Error(r(453));return e;case"body":if(!(e=t.body))throw Error(r(454));return e;default:throw Error(r(451))}}function jd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ye(e)}var Ud=/* @__PURE__ */new Map,Bd=/* @__PURE__ */new Set;function qd(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var Wd=R.d;R.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?ro(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 l=Vd;if(l&&e&&t){var r='link[rel="preload"][as="'+yt(t)+'"]';"image"===t&&n&&n.imageSrcSet?(r+='[imagesrcset="'+yt(n.imageSrcSet)+'"]',"string"==typeof n.imageSizes&&(r+='[imagesizes="'+yt(n.imageSizes)+'"]')):r+='[href="'+yt(e)+'"]';var a=r;switch(t){case"style":a=Gd(e);break;case"script":a=Yd(e)}Ud.has(a)||(e=b({rel:"preload",href:"image"===t&&n&&n.imageSrcSet?void 0:e,as:t},n),Ud.set(a,e),null!==l.querySelector(r)||"style"===t&&l.querySelector(Qd(a))||"script"===t&&l.querySelector(Jd(a))||(hd(t=l.createElement("link"),"link",e),nt(t),l.head.appendChild(t)))}},m:function(e,t){Wd.m(e,t);var n=Vd;if(n&&e){var l=t&&"string"==typeof t.as?t.as:"script",r='link[rel="modulepreload"][as="'+yt(l)+'"][href="'+yt(e)+'"]',a=r;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=Yd(e)}if(!Ud.has(a)&&(e=b({rel:"modulepreload",href:e},t),Ud.set(a,e),null===n.querySelector(r))){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Jd(a)))return}hd(l=n.createElement("link"),"link",e),nt(l),n.head.appendChild(l)}}},X:function(e,t){Wd.X(e,t);var n=Vd;if(n&&e){var l=tt(n).hoistableScripts,r=Yd(e),a=l.get(r);a||((a=n.querySelector(Jd(r)))||(e=b({src:e,async:!0},t),(t=Ud.get(r))&&nb(e,t),nt(a=n.createElement("script")),hd(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},l.set(r,a))}},S:function(e,t,n){Wd.S(e,t,n);var l=Vd;if(l&&e){var r=tt(l).hoistableStyles,a=Gd(e);t=t||"default";var i=r.get(a);if(!i){var o={loading:0,preload:null};if(i=l.querySelector(Qd(a)))o.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ud.get(a))&&tb(e,n);var s=i=l.createElement("link");nt(s),hd(s,"link",e),s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),s.addEventListener("load",function(){o.loading|=1}),s.addEventListener("error",function(){o.loading|=2}),o.loading|=4,eb(i,t,l)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(a,i)}}},M:function(e,t){Wd.M(e,t);var n=Vd;if(n&&e){var l=tt(n).hoistableScripts,r=Yd(e),a=l.get(r);a||((a=n.querySelector(Jd(r)))||(e=b({src:e,async:!0,type:"module"},t),(t=Ud.get(r))&&nb(e,t),nt(a=n.createElement("script")),hd(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},l.set(r,a))}}};var Vd="undefined"==typeof document?null:document;function Hd(e,t,n){var l=Vd;if(l&&"string"==typeof t&&t){var r=yt(t);r='link[rel="'+e+'"][href="'+r+'"]',"string"==typeof n&&(r+='[crossorigin="'+n+'"]'),Bd.has(r)||(Bd.add(r),e={rel:e,crossOrigin:n,href:t},null===l.querySelector(r)&&(hd(t=l.createElement("link"),"link",e),nt(t),l.head.appendChild(t)))}}function Kd(e,t,n,l){var a,i,o,s,c=(c=G.current)?qd(c):null;if(!c)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof n.precedence&&"string"==typeof n.href?(t=Gd(n.href),(l=(n=tt(c).hoistableStyles).get(t))||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{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||(a=c,i=e,o=n,s=d.state,a.querySelector('link[rel="preload"][as="style"]['+i+"]")?s.loading=1:(i=a.createElement("link"),s.preload=i,i.addEventListener("load",function(){return s.loading|=1}),i.addEventListener("error",function(){return s.loading|=2}),hd(i,"link",o),nt(i),a.head.appendChild(i))))),t&&null===l)throw Error(r(528,""));return d}if(t&&null!==l)throw Error(r(529,""));return null;case"script":return t=n.async,"string"==typeof(n=n.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Yd(n),(l=(n=tt(c).hoistableScripts).get(t))||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function Gd(e){return'href="'+yt(e)+'"'}function Qd(e){return'link[rel="stylesheet"]['+e+"]"}function Xd(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Yd(e){return'[src="'+yt(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 l=e.querySelector('style[data-href~="'+yt(n.href)+'"]');if(l)return t.instance=l,nt(l),l;var a=b({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return nt(l=(e.ownerDocument||e).createElement("style")),hd(l,"style",a),eb(l,n.precedence,e),t.instance=l;case"stylesheet":a=Gd(n.href);var i=e.querySelector(Qd(a));if(i)return t.state.loading|=4,t.instance=i,nt(i),i;l=Xd(n),(a=Ud.get(a))&&tb(l,a),nt(i=(e.ownerDocument||e).createElement("link"));var o=i;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),hd(i,"link",l),t.state.loading|=4,eb(i,n.precedence,e),t.instance=i;case"script":return i=Yd(n.src),(a=e.querySelector(Jd(i)))?(t.instance=a,nt(a),a):(l=n,(a=Ud.get(i))&&nb(l=b({},n),a),nt(a=(e=e.ownerDocument||e).createElement("script")),hd(a,"link",l),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(r(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(l=t.instance,t.state.loading|=4,eb(l,n.precedence,e));return t.instance}function eb(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=l.length?l[l.length-1]:null,a=r,i=0;i<l.length;i++){var o=l[i];if(o.dataset.precedence===t)a=o;else if(a!==r)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=9===n.nodeType?n.head:n).insertBefore(e,t.firstChild)}function tb(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function nb(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var lb=null;function rb(e,t,n){if(null===lb){var l=/* @__PURE__ */new Map,r=lb=/* @__PURE__ */new Map;r.set(n,l)}else(l=(r=lb).get(n))||(l=/* @__PURE__ */new Map,r.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var a=n[r];if(!(a[Xe]||a[qe]||"link"===e&&"stylesheet"===a.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==a.namespaceURI){var i=a.getAttribute(t)||"";i=e+i;var o=l.get(i);o?o.push(a):l.set(i,[a])}}return l}function ab(e,t,n){(e=e.ownerDocument||e).head.insertBefore(n,"title"===t?e.querySelector("head > title"):null)}function ib(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var ob=0;function sb(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)ub(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var cb=null;function ub(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,cb=/* @__PURE__ */new Map,t.forEach(db,e),cb=null,sb.call(e))}function db(e,t){if(!(4&t.state.loading)){var n=cb.get(e);if(n)var l=n.get(null);else{n=/* @__PURE__ */new Map,cb.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a<r.length;a++){var i=r[a];"LINK"!==i.nodeName&&"not all"===i.getAttribute("media")||(n.set(i.dataset.precedence,i),l=i)}l&&n.set(null,l)}i=(r=t.instance).getAttribute("data-precedence"),(a=n.get(i)||l)===l&&n.set(null,r),n.set(i,r),this.count++,l=sb.bind(this),r.addEventListener("load",l),r.addEventListener("error",l),a?a.parentNode.insertBefore(r,a.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(r,e.firstChild),t.state.loading|=4}}var bb={$$typeof:w,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function mb(e,t,n,l,r,a,i,o,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=l,this.onUncaughtError=r,this.onCaughtError=a,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=/* @__PURE__ */new Map}function hb(e,t,n,l,r,a,i,o,s,c,u,d){return e=new mb(e,t,n,i,s,c,u,d,o),t=1,!0===a&&(t|=24),a=jl(3,null,null,t),e.current=a,a.stateNode=e,(t=Ur()).refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:l,isDehydrated:n,cache:t},va(a),e}function pb(e){return e?e=Ol:Ol}function fb(e,t,n,l,r,a){r=pb(r),null===l.context?l.context=r:l.pendingContext=r,(l=wa(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(l.callback=a),null!==(n=xa(e,l,t))&&(Xc(n,0,t),ka(n,e,t))}function gb(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function vb(e,t){gb(e,t),(e=e.alternate)&&gb(e,t)}function yb(e){if(13===e.tag||31===e.tag){var t=Il(e,67108864);null!==t&&Xc(t,0,67108864),vb(e,67108864)}}function wb(e){if(13===e.tag||31===e.tag){var t=Gc(),n=Il(e,t=Oe(t));null!==n&&Xc(n,0,t),vb(e,t)}}var xb=!0;function kb(e,t,n,l){var r=D.T;D.T=null;var a=R.p;try{R.p=2,Sb(e,t,n,l)}finally{R.p=a,D.T=r}}function Cb(e,t,n,l){var r=D.T;D.T=null;var a=R.p;try{R.p=8,Sb(e,t,n,l)}finally{R.p=a,D.T=r}}function Sb(e,t,n,l){if(xb){var r=Nb(l);if(null===r)ld(e,t,l,Eb,n),Rb(e,l);else if(function(e,t,n,l,r){switch(t){case"focusin":return Ab=Ob(Ab,e,t,n,l,r),!0;case"dragenter":return zb=Ob(zb,e,t,n,l,r),!0;case"mouseover":return Lb=Ob(Lb,e,t,n,l,r),!0;case"pointerover":var a=r.pointerId;return Mb.set(a,Ob(Mb.get(a)||null,e,t,n,l,r)),!0;case"gotpointercapture":return a=r.pointerId,Pb.set(a,Ob(Pb.get(a)||null,e,t,n,l,r)),!0}return!1}(r,e,t,n,l))l.stopPropagation();else if(Rb(e,l),4&t&&-1<Db.indexOf(e)){for(;null!==r;){var a=Ze(r);if(null!==a)switch(a.tag){case 3:if((a=a.stateNode).current.memoizedState.isDehydrated){var i=_e(a.pendingLanes);if(0!==i){var o=a;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var s=1<<31-ke(i);o.entanglements[1]|=s,i&=~s}Ru(a),!(6&pc)&&(Dc=ue()+500,Ou(0))}}break;case 31:case 13:null!==(o=Il(a,2))&&Xc(o,0,2),tu(),vb(a,2)}if(null===(a=Nb(l))&&ld(e,t,l,Eb,n),a===r)break;r=a}null!==r&&l.stopPropagation()}else ld(e,t,l,null,n)}}function Nb(e){return $b(e=Dt(e))}var Eb=null;function $b(e){if(Eb=null,null!==(e=Je(e))){var t=i(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 Eb=e,null}function _b(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 be:return 2;case me:return 8;case he:case pe:return 32;case fe:return 268435456;default:return 32}default:return 32}}var Tb=!1,Ab=null,zb=null,Lb=null,Mb=/* @__PURE__ */new Map,Pb=/* @__PURE__ */new Map,Ib=[],Db="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 Rb(e,t){switch(e){case"focusin":case"focusout":Ab=null;break;case"dragenter":case"dragleave":zb=null;break;case"mouseover":case"mouseout":Lb=null;break;case"pointerover":case"pointerout":Mb.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pb.delete(t.pointerId)}}function Ob(e,t,n,l,r,a){return null===e||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:a,targetContainers:[r]},null!==t&&(null!==(t=Ze(t))&&yb(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function Fb(e){var t=Je(e.target);if(null!==t){var n=i(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=s(n)))return e.blockedOn=t,void Ue(e.priority,function(){wb(n)})}else if(31===t){if(null!==(t=c(n)))return e.blockedOn=t,void Ue(e.priority,function(){wb(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 jb(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Nb(e.nativeEvent);if(null!==n)return null!==(t=Ze(n))&&yb(t),e.blockedOn=n,!1;var l=new(n=e.nativeEvent).constructor(n.type,n);It=l,n.target.dispatchEvent(l),It=null,t.shift()}return!0}function Ub(e,t,n){jb(e)&&n.delete(t)}function Bb(){Tb=!1,null!==Ab&&jb(Ab)&&(Ab=null),null!==zb&&jb(zb)&&(zb=null),null!==Lb&&jb(Lb)&&(Lb=null),Mb.forEach(Ub),Pb.forEach(Ub)}function qb(e,n){e.blockedOn===n&&(e.blockedOn=null,Tb||(Tb=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bb)))}var Wb=null;function Vb(e){Wb!==e&&(Wb=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Wb===e&&(Wb=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],r=e[t+2];if("function"!=typeof l){if(null===$b(l||n))continue;break}var a=Ze(n);null!==a&&(e.splice(t,3),t-=3,no(a,{pending:!0,data:r,method:n.method,action:l},l,r))}}))}function Hb(e){function t(t){return qb(t,e)}null!==Ab&&qb(Ab,e),null!==zb&&qb(zb,e),null!==Lb&&qb(Lb,e),Mb.forEach(t),Pb.forEach(t);for(var n=0;n<Ib.length;n++){var l=Ib[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ib.length&&null===(n=Ib[0]).blockedOn;)Fb(n),null===n.blockedOn&&Ib.shift();if(null!=(n=(e.ownerDocument||e).$$reactFormReplay))for(l=0;l<n.length;l+=3){var r=n[l],a=n[l+1],i=r[We]||null;if("function"==typeof a)i||Vb(n);else if(i){var o=null;if(a&&a.hasAttribute("formAction")){if(r=a,i=a[We]||null)o=i.formAction;else if(null!==$b(r))continue}else o=i.action;"function"==typeof o?n[l+1]=o:(n.splice(l,3),l-=3),Vb(n)}}}function Kb(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return r=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==r&&(r(),r=null),l||setTimeout(n,20)}function n(){if(!l&&!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 l=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==r&&(r(),r=null)}}}function Gb(e){this._internalRoot=e}function Qb(e){this._internalRoot=e}Qb.prototype.render=Gb.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(r(409));fb(t.current,Gc(),e,t,null,null)},Qb.prototype.unmount=Gb.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;fb(e.current,2,null,e,null,null),tu(),t[Ve]=null}},Qb.prototype.unstable_scheduleHydration=function(e){if(e){var t=je();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ib.length&&0!==t&&t<Ib[n].priority;n++);Ib.splice(n,0,e),0===n&&Fb(e)}};var Xb=n.version;if("19.2.3"!==Xb)throw Error(r(527,Xb,"19.2.3"));R.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(r(188));throw e=Object.keys(e).join(","),Error(r(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=i(e)))throw Error(r(188));return t!==e?null:e}for(var n=e,l=t;;){var a=n.return;if(null===a)break;var o=a.alternate;if(null===o){if(null!==(l=a.return)){n=l;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return u(a),e;if(o===l)return u(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==l.return)n=a,l=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,l=o;break}if(c===l){s=!0,l=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,l=a;break}if(c===l){s=!0,l=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(3!==n.tag)throw Error(r(188));return n.stateNode.current===n?e:t}(t),e=null===(e=null!==e?d(e):null)?null:e.stateNode};var Yb={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.3"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var Jb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jb.isDisabled&&Jb.supportsFiber)try{ye=Jb.inject(Yb),we=Jb}catch(em){}}return T.createRoot=function(e,t){if(!a(e))throw Error(r(299));var n=!1,l="",i=Eo,o=$o,s=_o;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(l=t.identifierPrefix),void 0!==t.onUncaughtError&&(i=t.onUncaughtError),void 0!==t.onCaughtError&&(o=t.onCaughtError),void 0!==t.onRecoverableError&&(s=t.onRecoverableError)),t=hb(e,1,!1,null,0,n,l,null,i,o,s,Kb),e[Ve]=t.current,td(e),new Gb(t)},T.hydrateRoot=function(e,t,n){if(!a(e))throw Error(r(299));var l=!1,i="",o=Eo,s=$o,c=_o,u=null;return null!=n&&(!0===n.unstable_strictMode&&(l=!0),void 0!==n.identifierPrefix&&(i=n.identifierPrefix),void 0!==n.onUncaughtError&&(o=n.onUncaughtError),void 0!==n.onCaughtError&&(s=n.onCaughtError),void 0!==n.onRecoverableError&&(c=n.onRecoverableError),void 0!==n.formState&&(u=n.formState)),(t=hb(e,1,!0,t,0,l,i,u,o,s,c,Kb)).context=pb(null),n=t.current,(i=wa(l=Oe(l=Gc()))).callback=null,xa(n,i,l),n=l,t.current.lanes=n,Pe(t,n),Ru(t),e[Ve]=t.current,td(e),new Qb(t)},T.version="19.2.3",T}var P=($||($=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)}}(),_.exports=M()),_.exports);const I=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 D(e={}){const{useContainerQuery:l=!1,containerElement:r=null}=e,[a,i]=t(()=>{const e=l&&r?I.getContainerWidth(r):"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:I.supportsContainerQueries}}});n(()=>{if("undefined"==typeof window)return;const e=()=>{const e=window.innerWidth,t=window.innerHeight,n=l&&r?I.getContainerWidth(r):e,a=n<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),o="ontouchstart"in window||navigator.maxTouchPoints>0;i({isMobile:a,isTouch:o,isTablet:n>768&&n<=1024&&o,orientation:t>e?"portrait":"landscape",viewport:{width:e,height:t},container:{width:n,supportsContainerQueries:I.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)}},[l,r]);const o="portrait"===a.orientation,s="landscape"===a.orientation,c=a.isMobile||a.isTablet&&o;return{...a,isPortrait:o,isLandscape:s,isCompactMode:c,isMobileSize:a.viewport.width<=640,isTabletSize:a.viewport.width>640&&a.viewport.width<=1024,isDesktopSize:a.viewport.width>1024,deviceClass:a.isMobile?"mobile":a.isTablet?"tablet":"desktop"}}function R({tabs:e,active:t,onChange:n}){const{isMobile:l,isTouch:r}=D(),a=["limbo-tabs","lb:flex","lb:gap-4","lb:border-b-2","lb:border-brand-blue-200","lb:mb-6",l&&"lb:overflow-x-auto lb:scrollbar-none"].filter(Boolean).join(" "),i=e=>{const t=["limbo-tab","lb:relative","lb:px-6","lb:py-2","lb:font-medium","lb:text-brand-blue-1000","lb:bg-transparent","lb:border-0","lb:border-b-2","lb:cursor-pointer","lb:transition-all","lb:duration-200","lb:hover:text-pink-1000","lb:focus:outline-none","lb:focus-visible:ring-2","lb:focus-visible:ring-brand-blue-400","lb:focus-visible:ring-offset-2","lb:min-h-[44px]","lb:min-w-[44px]"];return e?t.push("lb:border-b-brand-blue-1000","lb:font-semibold","limbo-active"):t.push("lb:border-b-transparent"),l&&t.push("lb:min-w-[120px]","lb:text-base","lb:shrink-0"),r&&t.push("lb:touch-manipulation"),t.join(" ")};/* @__PURE__ */
|
|
2
|
+
return s("div",{className:a,role:"tablist","aria-label":"Opciones de navegación",style:l?{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"}:void 0,children:e.map(l=>{const a=t===l.id;return!a&&l.hideNonActive?null:/* @__PURE__ */s("button",{"data-tab-id":l.id,onClick:()=>n(l.id),onKeyDown:t=>((t,l)=>{const r=e.findIndex(e=>e.id===l);let a=r;switch(t.key){case"ArrowLeft":case"ArrowUp":t.preventDefault(),a=r>0?r-1:e.length-1;break;case"ArrowRight":case"ArrowDown":t.preventDefault(),a=r<e.length-1?r+1:0;break;case"Home":t.preventDefault(),a=0;break;case"End":t.preventDefault(),a=e.length-1;break;case"Enter":case" ":return t.preventDefault(),void n(l);default:return}const i=e[a];i&&!i.hideNonActive&&(n(i.id),setTimeout(()=>{const e=document.querySelector(`[data-tab-id="${i.id}"]`);e&&e.focus()},0))})(t,l.id),className:i(a),role:"tab","aria-selected":a,"aria-controls":`tabpanel-${l.id}`,tabIndex:a?0:-1,id:`tab-${l.id}`,style:r?{WebkitTapHighlightColor:"transparent"}:void 0,children:l.label},l.id)})})}function O({isOpen:e,onReload:t,onClose:n}){return e?/* @__PURE__ */s("div",{className:"lb:fixed lb:inset-0 lb:bg-black/50 lb:flex lb:items-center lb:justify-center lb:z-[9999]",onClick:e=>{e.target===e.currentTarget&&n?.()},children:/* @__PURE__ */c("div",{className:"lb:bg-white lb:rounded-lg lb:p-6 lb:max-w-sm lb:w-full lb:mx-4 lb:shadow-xl",children:[
|
|
3
3
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-start lb:gap-3 lb:mb-4",children:[
|
|
4
4
|
/* @__PURE__ */s("div",{className:"lb:flex-shrink-0 lb:w-10 lb:h-10 lb:bg-amber-100 lb:rounded-full lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5 lb:text-amber-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"})})}),
|
|
5
5
|
/* @__PURE__ */c("div",{children:[
|
|
@@ -10,13 +10,12 @@ return s("div",{className:a,role:"tablist","aria-label":"Opciones de navegación
|
|
|
10
10
|
/* @__PURE__ */c("ul",{className:"lb:list-disc lb:list-inside lb:space-y-1 lb:text-amber-700",children:[
|
|
11
11
|
/* @__PURE__ */s("li",{children:"Recarga la página para continuar con tu trabajo."}),
|
|
12
12
|
/* @__PURE__ */s("li",{children:"Si el problema persiste, cierra sesión y vuelve a entrar."})]})]}),
|
|
13
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:justify-end lb:gap-2",children:[
|
|
14
|
-
/* @__PURE__ */s("button",{type:"button",onClick:t,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-medium lb:bg-brand-blue-800 lb:text-white lb:rounded-md lb:hover:bg-brand-blue-1000 lb:transition-colors",children:"Recargar página"})]})]})}):null}function j(e,n=500){const[r,a]=t(e);return l(()=>{const t=setTimeout(()=>{a(e)},n);return()=>{clearTimeout(t)}},[e,n]),r}const F="https://led-dev-limbo-dev.eu.els.local",U="https://limbo.lefebvre.es";let B={publicKey:null,token:null,authMode:null,tokenEndpoint:null,tokenProvider:null,prod:!1},q=!1,W=null,V=null;function H(e){W="number"==typeof e&&e>0?Date.now()+1e3*e-3e4:null}async function K(){if(V)return V;V=(async()=>{if("jwt"===B.authMode&&B.tokenProvider){console.log("🔑 Calling tokenProvider...");const e=await B.tokenProvider(),t="string"==typeof e?e:e?.token,l="object"==typeof e?e?.expires_in:null;if(!t)throw new Error("tokenProvider returned no token");return B.token=t,H(l),console.log("✅ Token obtained from tokenProvider"),t}if("session"===B.authMode){const e=G(B),t=B.tokenEndpoint||"/auth/token",l=await fetch(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({public_key:B.publicKey}),credentials:"include"});if(!l.ok)throw new Error(`Session auth failed: ${l.status}`);const n=await l.json();if(!n.token)throw new Error("Session auth returned no token");return B.token=n.token,H(n.expires_in),n.token}throw new Error(`Cannot refresh token in authMode='${B.authMode}'`)})();try{return await V}finally{V=null}}function G({prod:e=!1}={}){return e?U:F}async function Q({isFormData:e=!1,useJWT:t=!0,customHeaders:l={}}={}){const n={};if(e||(n["Content-Type"]="application/json"),t){B.token&&null!==W&&Date.now()>=W&&(console.log("⏰ Token caducado por TTL, refrescando proactivamente"),B.token=null,W=null);let e=B.token;if(!e&&("jwt"===B.authMode&&B.tokenProvider||"session"===B.authMode))try{e=await K()}catch(r){throw console.error("❌ Token acquisition failed:",r),new Error("Failed to obtain token: "+r.message)}e?n.Authorization=`Bearer ${e}`:console.warn("⚠️ No JWT token available:",{authMode:B.authMode,hasPublicKey:!!B.publicKey,hasTokenProvider:!!B.tokenProvider})}return e&&delete n["Content-Type"],{...n,...l}}function X(e,t=null){e!==B.token&&(q=!1),B.token=e,H(t)}function Y(){return{...B}}async function J({endpoint:e,method:t="GET",body:l=null,prod:n=!1,basePath:r="",customHeaders:a={},isFormData:i=!1,useJWT:o=!0,_isRetry:s=!1}){try{const c=n||B.prod,u=await Q({isFormData:i,useJWT:o,customHeaders:a});"GET"===t&&!l&&u["Content-Type"]&&delete u["Content-Type"];const d=await fetch(`${G({prod:c})}${r}${e}`,{method:t,headers:u,body:l?i?l:JSON.stringify(l):void 0,credentials:"include"});if(204===d.status)return{success:!0,data:null,message:"No content",httpCode:204,timestamp:/* @__PURE__ */(new Date).toISOString()};if(!d.ok){let c=`HTTP ${d.status}: ${d.statusText}`,u=null;try{const e=await d.json();u=e,e.error?c=`${e.error.code}: ${e.error.message}`:e.message&&(c=e.message)}catch{}if(401===d.status){let c=!1;if("jwt"===B.authMode&&B.tokenProvider&&!s&&q){c=!0,B.token=null,W=null;try{return await K(),J({endpoint:e,method:t,body:l,prod:n,basePath:r,isFormData:i,useJWT:o,customHeaders:a,_isRetry:!0})}catch{}}window.dispatchEvent(new CustomEvent("tokenExpiredError",{detail:{error:{response:{status:401,data:u}},refreshAttempted:c}}))}throw new Error(c)}return o&&(q=!0),d.json()}catch(c){throw new Error(`API Error: ${c.message}`)}}function Z(){const e=Y();return e?.prod||!1?"https://limbo.lefebvre.es":"https://led-dev-limbo-dev.eu.els.local"}function ee(e){if(!e?.id)return null;return`${Z()}/api/assets/${e.id}/download`}function te(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("/")){return`${Z()}${e}`}return e}function le(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;return{result:{id:t.id,filename:t.filename||t.original_filename,mime_type:t.mime_type,file_size:t.file_size,width:t.width,height:t.height,upload_date:t.upload_date||t.created_at,processed_date:t.processed_date,processing_status:t.processing_status||t.status,url:te(t.url)||ee(t),url_webp:te(t.url_webp),url_original:te(t.url_original),format:t.format,format_original:t.format_original,permanent:t.permanent??!0,expires_at:t.expires_at,metadata:t.metadata||{},asset_type:t.asset_type||null,asset_subtype:t.asset_subtype||null,thumbnail_url:te(t.thumbnail_url)||null,folder:t.folder||null,tags:t.tags||[],variants:ne(t.variants||[]),variants_count:t.variants_count||t.variants?.length||0}}}function ne(e){return Array.isArray(e)?e.map(e=>({id:e.id,name:e.name,width:e.width,height:e.height,format:e.format||e.output_format,file_size:e.file_size,crop_params:e.crop_params,url:te(e.url),permanent:e.permanent??!0,expires_at:e.expires_at,created_at:e.created_at})):[]}function re(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;if(t.id&&t.url&&t.name&&!t.processing_mode&&!t.variants)return console.log("[adaptVariantGenerationFromV2] Detectado formato de /variants/upload"),{result:{id:t.id,name:t.name,width:t.width,height:t.height,format:t.format,file_size:t.file_size,url:t.url,urlSigned:t.url,status:"completed",created_at:t.created_at||/* @__PURE__ */(new Date).toISOString()}};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,urlSigned: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 ae(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 ie="/api";async function oe(e={}){try{const t={url_expires:"0",...e},l=`/assets?${new URLSearchParams(t).toString()}`;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&&(ne(e.variants)||ne(e.image_variants))||[],url:te(e.url)||ee(e),url_webp:te(e.url_webp),format:e.format,permanent:e.permanent??!0,expires_at:e.expires_at,folder:e.folder||null,tags:e.tags||[],asset_type:e.asset_type||null,asset_subtype:e.asset_subtype||null,thumbnail_url:te(e.thumbnail_url)||null,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 J({endpoint:l,method:"GET",basePath:ie,useJWT:!0}))}catch(t){throw ae(t)}}async function se(e,t=null,l=!1,n=null,r=null){try{const a=new FormData;a.append("file",e),t&&a.append("uploaded_by",t),l&&a.append("store_original",l.toString()),n&&a.append("folder",n),r&&Array.isArray(r)&&r.length>0&&r.forEach(e=>a.append("tags[]",e));return function(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;return{result:{id:t.id,filename:t.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:te(t.url),url_webp:te(t.url_webp),url_original:te(t.url_original),format:t.format,format_original:t.format_original,permanent:t.permanent??!0,folder:t.folder||null,tags:t.tags||[],processing:t.processing||{master_webp:"processing"===t.status?"queued":"completed",variants:"processing"===t.status?"queued":"completed"},asset_type:t.asset_type||null,asset_subtype:t.asset_subtype||null,thumbnail_url:te(t.thumbnail_url)||null,checksum:t.checksum,storage_path:t.storage_path_base,metadata:t.metadata||{}}}}(await J({endpoint:"/assets",method:"POST",body:a,basePath:ie,isFormData:!0,useJWT:!0}))}catch(a){throw ae(a)}}async function ce(e,t){try{return le(await J({endpoint:`/assets/${e}`,method:"PATCH",body:t,basePath:ie,useJWT:!0}))}catch(l){throw ae(l)}}async function ue(e,t=0){try{const n=new URLSearchParams({url_expires:t.toString()}),r=await J({endpoint:`/assets/${e}/variants?${n}`,method:"GET",basePath:ie,useJWT:!0});return l=r,l?.success&&Array.isArray(l?.data?.variants)?{result:l.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.format||e.output_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:te(e.url)||ee(e),permanent:e.permanent??!0,expires_at:e.expires_at,metadata:e.metadata||{},crop_data:e.crop_data||{},crop_params:e.crop_params||e.crop_data||{},parent_asset_id:e.parent_asset_id||l.data.asset_id,variant_type:e.variant_type||"crop"}))}:{result:[]}}catch(n){throw ae(n)}var l}function de({value:e=[],onChange:r,placeholder:a,disabled:i=!1,id:o,ariaLabel:u}){const d=Array.isArray(e)?e:[],[b,m]=t(""),[h,p]=t([]),[f,g]=t(!1),[v,y]=t(-1),w=n(null),x=n(null),C=j(b,400);function S(e){const t=e.trim();t&&(d.includes(t)||r?.([...d,t]),m(""))}function N(e){r?.(d.filter(t=>t!==e))}return l(()=>{if(C.length<1)return void p([]);let e=!1;return async function({search:e="",limit:t=10}={}){try{const l=new URLSearchParams;e&&l.set("search",e),l.set("limit",String(t));const n=`/tags?${l.toString()}`,r=await J({endpoint:n,method:"GET",basePath:ie,useJWT:!0});return(r?.data?.tags||[]).map(e=>({tag:e,count:null}))}catch{return[]}}({search:C,limit:10}).then(t=>{console.log("[TagsInput] listTags response:",t),e||p(Array.isArray(t)?t:[])}).catch(t=>{console.error("[TagsInput] listTags error:",t),e||p([])}),()=>{e=!0}},[C]),l(()=>{h.length>0&&C.length>=1&&g(!0)},[h,C]),l(()=>{function e(e){if(!w.current)return;x.current&&x.current.contains(e.target)?g(!0):w.current.contains(e.target)||(g(!1),y(-1))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:flex lb:flex-col lb:gap-2",children:[
|
|
15
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-wrap lb:gap-2 lb:p-2 lb:border lb:border-neutral-gray-200 lb:rounded-md lb:bg-brand-purple-050 lb:max-h-[88px] lb:overflow-y-auto",children:d.map(e=>/* @__PURE__ */c("span",{className:"lb:inline-flex lb:items-center lb:gap-1 lb:px-2 lb:py-1 lb:bg-brand-purple-050 lb:text-brand-purple-1000 lb:text-xs lb:font-semibold lb:rounded-full lb:border lb:border-brand-purple-200",children:[e,
|
|
13
|
+
/* @__PURE__ */c("div",{className:"lb:flex lb:justify-end lb:gap-2",children:[n&&/* @__PURE__ */s("button",{type:"button",onClick:n,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-medium lb:text-gray-700 lb:border lb:border-gray-300 lb:rounded-md lb:hover:bg-gray-50 lb:transition-colors",children:"Ignorar"}),
|
|
14
|
+
/* @__PURE__ */s("button",{type:"button",onClick:t,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-medium lb:bg-brand-blue-800 lb:text-white lb:rounded-md lb:hover:bg-brand-blue-1000 lb:transition-colors",children:"Recargar página"})]})]})}):null}function F(e,l=500){const[r,a]=t(e);return n(()=>{const t=setTimeout(()=>{a(e)},l);return()=>{clearTimeout(t)}},[e,l]),r}const j="https://led-dev-limbo-dev.eu.els.local",U="https://limbo.lefebvre.es";let B={publicKey:null,token:null,authMode:null,tokenEndpoint:null,tokenProvider:null,prod:!1},q=!1,W=null,V=null;function H(e){W="number"==typeof e&&e>0?Date.now()+1e3*e-3e4:null}async function K(){if(V)return V;V=(async()=>{if("jwt"===B.authMode&&B.tokenProvider){console.log("🔑 Calling tokenProvider...");const e=await B.tokenProvider(),t="string"==typeof e?e:e?.token,n="object"==typeof e?e?.expires_in:null;if(!t)throw new Error("tokenProvider returned no token");return B.token=t,H(n),console.log("✅ Token obtained from tokenProvider"),t}if("session"===B.authMode){const e=G(B),t=B.tokenEndpoint||"/auth/token",n=await fetch(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({public_key:B.publicKey}),credentials:"include"});if(!n.ok)throw new Error(`Session auth failed: ${n.status}`);const l=await n.json();if(!l.token)throw new Error("Session auth returned no token");return B.token=l.token,H(l.expires_in),l.token}throw new Error(`Cannot refresh token in authMode='${B.authMode}'`)})();try{return await V}finally{V=null}}function G({prod:e=!1}={}){return e?U:j}async function Q({isFormData:e=!1,useJWT:t=!0,customHeaders:n={}}={}){const l={};if(e||(l["Content-Type"]="application/json"),t){B.token&&null!==W&&Date.now()>=W&&(console.log("⏰ Token caducado por TTL, refrescando proactivamente"),B.token=null,W=null);let e=B.token;if(!e&&("jwt"===B.authMode&&B.tokenProvider||"session"===B.authMode))try{e=await K()}catch(r){throw console.error("❌ Token acquisition failed:",r),new Error("Failed to obtain token: "+r.message)}e?l.Authorization=`Bearer ${e}`:console.warn("⚠️ No JWT token available:",{authMode:B.authMode,hasPublicKey:!!B.publicKey,hasTokenProvider:!!B.tokenProvider})}return e&&delete l["Content-Type"],{...l,...n}}function X(e,t=null){e!==B.token&&(q=!1),B.token=e,H(t)}function Y(){return{...B}}async function J({endpoint:e,method:t="GET",body:n=null,prod:l=!1,basePath:r="",customHeaders:a={},isFormData:i=!1,useJWT:o=!0,_isRetry:s=!1}){try{const c=l||B.prod,u=await Q({isFormData:i,useJWT:o,customHeaders:a});"GET"===t&&!n&&u["Content-Type"]&&delete u["Content-Type"];const d=await fetch(`${G({prod:c})}${r}${e}`,{method:t,headers:u,body:n?i?n:JSON.stringify(n):void 0,credentials:"include"});if(204===d.status)return{success:!0,data:null,message:"No content",httpCode:204,timestamp:/* @__PURE__ */(new Date).toISOString()};if(!d.ok){let c=`HTTP ${d.status}: ${d.statusText}`,u=null;try{const e=await d.json();u=e,e.error?c=`${e.error.code}: ${e.error.message}`:e.message&&(c=e.message)}catch{}if(401===d.status){let c=!1;if("jwt"===B.authMode&&B.tokenProvider&&!s&&q){c=!0,B.token=null,W=null;try{return await K(),J({endpoint:e,method:t,body:n,prod:l,basePath:r,isFormData:i,useJWT:o,customHeaders:a,_isRetry:!0})}catch{}}window.dispatchEvent(new CustomEvent("tokenExpiredError",{detail:{error:{response:{status:401,data:u}},refreshAttempted:c}}))}throw new Error(c)}return o&&(q=!0),d.json()}catch(c){throw new Error(`API Error: ${c.message}`)}}function Z(){const e=Y();return e?.prod||!1?"https://limbo.lefebvre.es":"https://led-dev-limbo-dev.eu.els.local"}function ee(e){if(!e?.id)return null;return`${Z()}/api/assets/${e.id}/download`}function te(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("/")){return`${Z()}${e}`}return e}function ne(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;return{result:{id:t.id,filename:t.filename||t.original_filename,mime_type:t.mime_type,file_size:t.file_size,width:t.width,height:t.height,upload_date:t.upload_date||t.created_at,processed_date:t.processed_date,processing_status:t.processing_status||t.status,url:te(t.url)||ee(t),url_webp:te(t.url_webp),url_original:te(t.url_original),format:t.format,format_original:t.format_original,permanent:t.permanent??!0,expires_at:t.expires_at,metadata:t.metadata||{},asset_type:t.asset_type||null,asset_subtype:t.asset_subtype||null,thumbnail_url:te(t.thumbnail_url)||null,folder:t.folder||null,tags:t.tags||[],variants:le(t.variants||[]),variants_count:t.variants_count||t.variants?.length||0}}}function le(e){return Array.isArray(e)?e.map(e=>({id:e.id,name:e.name,width:e.width,height:e.height,format:e.format||e.output_format,file_size:e.file_size,crop_params:e.crop_params,url:te(e.url),permanent:e.permanent??!0,expires_at:e.expires_at,created_at:e.created_at})):[]}function re(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;if(t.id&&t.url&&t.name&&!t.processing_mode&&!t.variants)return console.log("[adaptVariantGenerationFromV2] Detectado formato de /variants/upload"),{result:{id:t.id,name:t.name,width:t.width,height:t.height,format:t.format,file_size:t.file_size,url:t.url,urlSigned:t.url,status:"completed",created_at:t.created_at||/* @__PURE__ */(new Date).toISOString()}};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,urlSigned: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 ae(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 ie="/api";async function oe(e={}){try{const t={url_expires:"0",...e},n=`/assets?${new URLSearchParams(t).toString()}`;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&&(le(e.variants)||le(e.image_variants))||[],url:te(e.url)||ee(e),url_webp:te(e.url_webp),format:e.format,permanent:e.permanent??!0,expires_at:e.expires_at,folder:e.folder||null,tags:e.tags||[],asset_type:e.asset_type||null,asset_subtype:e.asset_subtype||null,thumbnail_url:te(e.thumbnail_url)||null,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 J({endpoint:n,method:"GET",basePath:ie,useJWT:!0}))}catch(t){throw ae(t)}}async function se(e,t=null,n=!1,l=null,r=null){try{const a=new FormData;a.append("file",e),t&&a.append("uploaded_by",t),n&&a.append("store_original",n.toString()),l&&a.append("folder",l),r&&Array.isArray(r)&&r.length>0&&r.forEach(e=>a.append("tags[]",e));return function(e){if(!e?.success||!e?.data)return{result:null};const t=e.data;return{result:{id:t.id,filename:t.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:te(t.url),url_webp:te(t.url_webp),url_original:te(t.url_original),format:t.format,format_original:t.format_original,permanent:t.permanent??!0,folder:t.folder||null,tags:t.tags||[],processing:t.processing||{master_webp:"processing"===t.status?"queued":"completed",variants:"processing"===t.status?"queued":"completed"},asset_type:t.asset_type||null,asset_subtype:t.asset_subtype||null,thumbnail_url:te(t.thumbnail_url)||null,checksum:t.checksum,storage_path:t.storage_path_base,metadata:t.metadata||{}}}}(await J({endpoint:"/assets",method:"POST",body:a,basePath:ie,isFormData:!0,useJWT:!0}))}catch(a){throw ae(a)}}async function ce(e,t){try{return ne(await J({endpoint:`/assets/${e}`,method:"PATCH",body:t,basePath:ie,useJWT:!0}))}catch(n){throw ae(n)}}async function ue(e,t=0){try{const l=new URLSearchParams({url_expires:t.toString()}),r=await J({endpoint:`/assets/${e}/variants?${l}`,method:"GET",basePath:ie,useJWT:!0});return n=r,n?.success&&Array.isArray(n?.data?.variants)?{result:n.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.format||e.output_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:te(e.url)||ee(e),permanent:e.permanent??!0,expires_at:e.expires_at,metadata:e.metadata||{},crop_data:e.crop_data||{},crop_params:e.crop_params||e.crop_data||{},parent_asset_id:e.parent_asset_id||n.data.asset_id,variant_type:e.variant_type||"crop"}))}:{result:[]}}catch(l){throw ae(l)}var n}function de({value:e=[],onChange:r,placeholder:a,disabled:i=!1,id:o,ariaLabel:u}){const d=Array.isArray(e)?e:[],[b,m]=t(""),[h,p]=t([]),[f,g]=t(!1),[v,y]=t(-1),w=l(null),x=l(null),C=F(b,400);function S(e){const t=e.trim();t&&(d.includes(t)||r?.([...d,t]),m(""))}function N(e){r?.(d.filter(t=>t!==e))}return n(()=>{if(C.length<1)return void p([]);let e=!1;return async function({search:e="",limit:t=10}={}){try{const n=new URLSearchParams;e&&n.set("search",e),n.set("limit",String(t));const l=`/tags?${n.toString()}`,r=await J({endpoint:l,method:"GET",basePath:ie,useJWT:!0});return(r?.data?.tags||[]).map(e=>({tag:e,count:null}))}catch{return[]}}({search:C,limit:10}).then(t=>{console.log("[TagsInput] listTags response:",t),e||p(Array.isArray(t)?t:[])}).catch(t=>{console.error("[TagsInput] listTags error:",t),e||p([])}),()=>{e=!0}},[C]),n(()=>{h.length>0&&C.length>=1&&g(!0)},[h,C]),n(()=>{function e(e){if(!w.current)return;x.current&&x.current.contains(e.target)?g(!0):w.current.contains(e.target)||(g(!1),y(-1))}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:flex lb:flex-col lb:gap-2",children:[d.length>0&&/* @__PURE__ */s("div",{className:"lb:flex lb:flex-wrap lb:gap-2 lb:p-2 lb:border lb:border-neutral-gray-200 lb:rounded-md lb:bg-brand-purple-050 lb:max-h-[88px] lb:overflow-y-auto",children:d.map(e=>/* @__PURE__ */c("span",{className:"lb:inline-flex lb:items-center lb:gap-1 lb:px-2 lb:py-1 lb:bg-brand-purple-050 lb:text-brand-purple-1000 lb:text-xs lb:font-semibold lb:rounded-full lb:border lb:border-brand-purple-200",children:[e,
|
|
16
15
|
/* @__PURE__ */s("button",{type:"button","aria-label":k("tags.pill.ariaDelete",{tag:e}),onClick:t=>{t.stopPropagation(),N(e)},className:"lb:text-brand-purple-400 lb:hover:text-brand-purple-1000 lb:leading-none lb:cursor-pointer lb:ml-1 lb:w-3 lb:h-3 lb:flex lb:items-center lb:justify-center",children:"×"})]},e))}),
|
|
17
|
-
/* @__PURE__ */s("div",{role:"combobox","aria-expanded":f,"aria-haspopup":"listbox","aria-label":u||k("tags.input.ariaLabel"),onClick:function(){x.current?.focus()},className:"lb:flex lb:flex-wrap lb:gap-2 lb:p-2 lb:min-h-[42px] lb:border lb:border-neutral-gray-200 lb:rounded-md lb:bg-white lb:focus-within:ring-2 lb:focus-within:ring-brand-purple-400 lb:focus-within:border-brand-purple-400 lb:cursor-text"+(i?" lb:opacity-50 lb:pointer-events-none":""),children:/* @__PURE__ */s("input",{type:"text",id:o,ref:x,value:b,onChange:function(e){m(e.target.value),y(-1)},onKeyDown:function(e){" "!==e.key&&","!==e.key||b.trim()&&(e.preventDefault(),S(b.trim()),m("")),"Enter"===e.key&&v>=0&&h[v]&&(e.preventDefault(),S(h[v].tag),m(""),g(!1),y(-1)),"Backspace"===e.key&&""===b&&d.length>0&&N(d[d.length-1]),"ArrowDown"===e.key&&(e.preventDefault(),y(e=>Math.min(e+1,h.length-1))),"ArrowUp"===e.key&&(e.preventDefault(),y(e=>Math.max(e-1,-1))),"Escape"===e.key&&(g(!1),y(-1))},onFocus:()=>{g(!0)},disabled:i,"aria-autocomplete":"list","aria-controls":"tags-input-listbox",className:"lb:outline-none lb:border-0 lb:bg-transparent lb:text-sm lb:text-neutral-gray-900 lb:placeholder-neutral-gray-300 lb:flex-1 lb:min-w-[80px] lb:py-1",placeholder:a||k("tags.input.placeholder")})}),f&&C.length>=1&&/* @__PURE__ */s("div",{role:"listbox",id:"tags-input-listbox",className:"lb:absolute lb:z-50 lb:mt-1 lb:w-full lb:max-h-48 lb:overflow-y-auto lb:bg-white lb:border lb:border-neutral-gray-100 lb:rounded-md lb:shadow-md lb:top-
|
|
16
|
+
/* @__PURE__ */s("div",{role:"combobox","aria-expanded":f,"aria-haspopup":"listbox","aria-label":u||k("tags.input.ariaLabel"),onClick:function(){x.current?.focus()},className:"lb:flex lb:flex-wrap lb:gap-2 lb:p-2 lb:min-h-[42px] lb:border lb:border-neutral-gray-200 lb:rounded-md lb:bg-white lb:focus-within:ring-2 lb:focus-within:ring-brand-purple-400 lb:focus-within:border-brand-purple-400 lb:cursor-text"+(i?" lb:opacity-50 lb:pointer-events-none":""),children:/* @__PURE__ */s("input",{type:"text",id:o,ref:x,value:b,onChange:function(e){m(e.target.value),y(-1)},onKeyDown:function(e){" "!==e.key&&","!==e.key||b.trim()&&(e.preventDefault(),S(b.trim()),m("")),"Enter"===e.key&&v>=0&&h[v]&&(e.preventDefault(),S(h[v].tag),m(""),g(!1),y(-1)),"Backspace"===e.key&&""===b&&d.length>0&&N(d[d.length-1]),"ArrowDown"===e.key&&(e.preventDefault(),y(e=>Math.min(e+1,h.length-1))),"ArrowUp"===e.key&&(e.preventDefault(),y(e=>Math.max(e-1,-1))),"Escape"===e.key&&(g(!1),y(-1))},onFocus:()=>{g(!0)},disabled:i,"aria-autocomplete":"list","aria-controls":"tags-input-listbox",className:"lb:outline-none lb:border-0 lb:bg-transparent lb:text-sm lb:text-neutral-gray-900 lb:placeholder-neutral-gray-300 lb:flex-1 lb:min-w-[80px] lb:py-1",placeholder:a||k("tags.input.placeholder")})}),f&&C.length>=1&&/* @__PURE__ */s("div",{role:"listbox",id:"tags-input-listbox",className:"lb:absolute lb:z-50 lb:mt-1 lb:w-full lb:max-h-48 lb:overflow-y-auto lb:bg-white lb:border lb:border-neutral-gray-100 lb:rounded-md lb:shadow-md lb:top-full lb:float-end",children:0===h.length?/* @__PURE__ */s("div",{className:"lb:px-3 lb:py-2 lb:text-sm lb:text-neutral-gray-500 lb:italic",children:k("tags.autocomplete.empty")}):h.map((e,t)=>/* @__PURE__ */c("div",{role:"option","aria-selected":t===v,onMouseDown:t=>{t.preventDefault(),function(e){S(e.tag),m(""),g(!1),y(-1)}(e)},className:"lb:px-3 lb:py-2 lb:text-sm lb:text-neutral-gray-900 lb:cursor-pointer lb:hover:bg-brand-purple-050 lb:flex lb:items-center lb:justify-between"+(t===v?" lb:bg-brand-purple-050":""),children:[
|
|
18
17
|
/* @__PURE__ */s("span",{children:e.tag}),
|
|
19
|
-
/* @__PURE__ */s("span",{className:"lb:text-xs lb:text-neutral-gray-500",children:e.count})]},e.tag))})]})}const be=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"]):not([disabled])',"a[href]"].join(", "),me=e=>{if("true"===e.getAttribute("aria-hidden"))return!1;if(e.hasAttribute("inert"))return!1;if(e.hasAttribute("hidden"))return!1;let t=e.parentElement;for(;t;){if(t.hasAttribute("inert"))return!1;if("true"===t.getAttribute("aria-hidden"))return!1;t=t.parentElement}return!0};function he(e,{onClose:t,isActive:
|
|
18
|
+
/* @__PURE__ */s("span",{className:"lb:text-xs lb:text-neutral-gray-500",children:e.count})]},e.tag))})]})}const be=["button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"]):not([disabled])',"a[href]"].join(", "),me=e=>{if("true"===e.getAttribute("aria-hidden"))return!1;if(e.hasAttribute("inert"))return!1;if(e.hasAttribute("hidden"))return!1;let t=e.parentElement;for(;t;){if(t.hasAttribute("inert"))return!1;if("true"===t.getAttribute("aria-hidden"))return!1;t=t.parentElement}return!0};function he(e,{onClose:t,isActive:l=!0}={}){n(()=>{if(!l)return;const n=e?.current;if(!n)return;const r=e=>{if("Escape"===e.key)return e.preventDefault(),void t?.();if("Tab"!==e.key)return;const l=(r=n,Array.from(r.querySelectorAll(be)).filter(me));var r;if(0===l.length)return void e.preventDefault();const a=l[0],i=l[l.length-1],o=document.activeElement;e.shiftKey?o!==a&&n.contains(o)||(e.preventDefault(),i.focus()):o===i&&(e.preventDefault(),a.focus())};return n.addEventListener("keydown",r),()=>n.removeEventListener("keydown",r)},[e,t,l])}function pe({isOpen:e,asset:r,onClose:a,onSave:i}){const[o,u]=t(""),[d,b]=t([]),[m,h]=t(!1),[p,f]=t(null),g=l(null),v=l(null);if(n(()=>{r?.id&&(u(r.filename??r.original_filename??""),b(Array.isArray(r.tags)?r.tags:[]))},[r?.id]),he(g,{onClose:a,isActive:e}),n(()=>{e&&setTimeout(()=>v.current?.focus(),0)},[e]),!e||!r)return null;/* @__PURE__ */
|
|
20
19
|
return s("div",{className:"lb:fixed lb:inset-0 lb:bg-black/50 lb:flex lb:items-center lb:justify-center lb:z-[9999]",onClick:function(e){e.target===e.currentTarget&&a()},children:/* @__PURE__ */c("div",{ref:g,role:"dialog","aria-modal":"true","aria-labelledby":"edit-asset-modal-title",className:"lb:bg-white lb:rounded-lg lb:p-6 lb:max-w-md lb:w-full lb:mx-4 lb:shadow-xl",children:[
|
|
21
20
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:mb-5",children:[
|
|
22
21
|
/* @__PURE__ */s("h2",{id:"edit-asset-modal-title",className:"lb:text-base lb:font-semibold lb:text-neutral-gray-900",children:k("editAssetModal.title")}),
|
|
@@ -30,21 +29,21 @@ return s("div",{className:"lb:fixed lb:inset-0 lb:bg-black/50 lb:flex lb:items-c
|
|
|
30
29
|
/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-neutral-gray-500 lb:mt-2",children:k("tags.input.hint")})]}),p&&/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-red-800 lb:mt-3",children:p}),
|
|
31
30
|
/* @__PURE__ */c("div",{className:"lb:flex lb:justify-end lb:gap-2 lb:mt-6",children:[
|
|
32
31
|
/* @__PURE__ */s("button",{type:"button",onClick:a,disabled:m,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-semibold lb:text-neutral-gray-700 lb:border lb:border-neutral-gray-300 lb:rounded-md lb:hover:bg-neutral-gray-050 lb:transition-colors",children:k("editAssetModal.cancel")}),
|
|
33
|
-
/* @__PURE__ */s("button",{type:"button",onClick:async function(){h(!0),f(null);try{await i({name:o,tags:d}),a()}catch(e){f(e.message||k("editAssetModal.saveError"))}finally{h(!1)}},disabled:m,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-semibold lb:bg-brand-blue-800 lb:text-white lb:rounded-md lb:hover:bg-brand-blue-1000 lb:transition-colors"+(m?" lb:opacity-70 lb:cursor-not-allowed":""),children:k("editAssetModal.save")})]})]})})}function fe(){const[e,
|
|
32
|
+
/* @__PURE__ */s("button",{type:"button",onClick:async function(){h(!0),f(null);try{await i({name:o,tags:d}),a()}catch(e){f(e.message||k("editAssetModal.saveError"))}finally{h(!1)}},disabled:m,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-semibold lb:bg-brand-blue-800 lb:text-white lb:rounded-md lb:hover:bg-brand-blue-1000 lb:transition-colors"+(m?" lb:opacity-70 lb:cursor-not-allowed":""),children:k("editAssetModal.save")})]})]})})}function fe(){const[e,n]=t(!1),[l,r]=t(null);return{deleteImg:async e=>{if(!e)return r("ID de imagen no proporcionado"),!1;n(!0),r(null);try{const t=await async function(e){try{return await J({endpoint:`/assets/${e}`,method:"DELETE",basePath:ie,useJWT:!0})}catch(l){throw ae(l)}}(e);return!1!==t.success}catch(t){return r(t.message),!1}finally{n(!1)}},loading:e,error:l,reset:()=>{r(null)}}}const ge=/* @__PURE__ */new Map,ve=6e5,ye="limbo_gallery_cache";(()=>{try{const e=sessionStorage.getItem(ye);if(e){const t=JSON.parse(e),n=Date.now();let l=!1;if(Object.entries(t).forEach(([e,t])=>{t.timestamp&&n-t.timestamp<ve?ge.set(e,t):l=!0}),l)if(0===ge.size)sessionStorage.removeItem(ye);else{const e={};ge.forEach((t,n)=>{e[n]=t}),sessionStorage.setItem(ye,JSON.stringify(e))}}}catch{}})();const we=()=>{ge.clear();try{sessionStorage.removeItem(ye)}catch{}};function xe(e,a=!1,i={},o=!0){const s=r(()=>JSON.stringify(i),[i]),c=l((()=>{const e=s,t=ge.get(e),n=Date.now();return t&&n-t.timestamp<ve?{images:t.data,pagination:t.pagination||null,loading:!1}:{images:[],pagination:null,loading:o}})()),[u,d]=t(c.current.images),[b,m]=t(c.current.loading),[h,p]=t(null),[f,g]=t(c.current.pagination),[v,y]=t(0),[w,x]=t(0);n(()=>{if(!o)return void m(!1);const e=`${s}`,t=ge.get(e),n=Date.now();if(t&&n-t.timestamp<ve)return d(t.data),g(t.pagination||null),void m(!1);m(!0);let l=!0;return(async()=>{if(v>=3)l&&(p("Error de autenticación: Verifica tus credenciales API"),m(!1));else try{const t=await oe(i);if(!l)return;const r=t.result||t.data||[],a=t.pagination||null;d(r),g(a),p(null),y(0),ge.set(e,{data:r,pagination:a,timestamp:n}),(()=>{try{const e={};ge.forEach((t,n)=>{e[n]=t}),sessionStorage.setItem(ye,JSON.stringify(e))}catch{}})()}catch(t){l&&(p(t.message),y(e=>e+1))}finally{l&&m(!1)}})(),()=>{l=!1}},[e,a,s,v,o,w]);return{images:u,loading:b,error:h,pagination:f,setImages:d,invalidateCache:()=>{ge.clear();try{sessionStorage.removeItem(ye)}catch{}},refetch:()=>{ge.clear();try{sessionStorage.removeItem(ye)}catch{}m(!0),x(e=>e+1)}}}function ke(){const[e,n]=t({}),[l,r]=t({}),[i,o]=t({});return{loadVariants:a(async(t,a=!1)=>{if(t&&!l[t]){if(!a&&e[t])return e[t];r(e=>({...e,[t]:!0})),o(e=>({...e,[t]:null}));try{const e=await ue(t),l=e?.result||[];return n(e=>({...e,[t]:l})),l}catch(i){return console.error("Error loading variants:",i),o(e=>({...e,[t]:i.message})),[]}finally{r(e=>({...e,[t]:!1}))}}},[e,l]),getVariants:a(t=>e[t]||[],[e]),isLoading:a(e=>l[e]||!1,[l]),getError:a(e=>i[e]||null,[i]),clearVariants:a(e=>{n(t=>{const n={...t};return delete n[e],n}),r(t=>{const n={...t};return delete n[e],n}),o(t=>{const n={...t};return delete n[e],n})},[]),refreshVariants:a(async e=>{if(e){r(t=>({...t,[e]:!0})),o(t=>({...t,[e]:null}));try{const t=await ue(e),l=t?.result||[];return n(t=>({...t,[e]:l})),l}catch(t){return console.error("Error refreshing variants:",t),o(n=>({...n,[e]:t.message})),[]}finally{r(t=>({...t,[e]:!1}))}}},[]),removeVariant:a(async(e,t)=>{try{return await async function(e,t){try{return await J({endpoint:`/assets/${e}/variants/${t}`,method:"DELETE",basePath:ie,useJWT:!0})}catch(n){throw ae(n)}}(e,t),n(n=>{const l=n[e]||[];return{...n,[e]:l.filter(e=>e.id!==t)}}),{success:!0}}catch(l){return console.error("Error deleting variant:",l),{success:!1,error:l.message}}},[])}}function Ce(){/* @__PURE__ */
|
|
34
33
|
return c("div",{className:"lb:flex lb:items-center lb:justify-center lb:gap-2 lb:py-2 lb:px-4 lb:border-t lb:h-8 lb:border-brand-purple-200 lb:bg-brand-purple-50 lb:rounded-b-md lb:mt-3",style:{background:"linear-gradient(90deg,#001978,#2134f1 50%,#f81bbd 95%)",color:"white"},children:[
|
|
35
34
|
/* @__PURE__ */c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 52",fill:"currentColor",className:"lb:w-5 lb:h-5 lb:text-white","aria-hidden":"true",children:[
|
|
36
35
|
/* @__PURE__ */s("path",{d:"M29.0863 15.2704H24.9419V36.7321H37.5259V33.1048H29.0863V15.2704Z"}),
|
|
37
36
|
/* @__PURE__ */s("path",{d:"M18.1601 33.1048H9.72056V36.7321H22.3045V15.2704H18.1601V33.1048Z"}),
|
|
38
37
|
/* @__PURE__ */s("path",{d:"M44.0063 51.846L3.16483 50.1834C1.35636 50.1834 0 48.5965 0 46.8584V4.99294C0 3.33041 1.65777 1.8946 3.31554 1.81903L44.157 0.1565C46.2669 0.0809304 48 1.74346 48 3.8594V47.8408C48 50.0323 46.1915 51.846 43.9309 51.7704H44.0063V51.846ZM4.89796 46.405L42.9513 47.4629C43.4788 47.4629 44.0063 47.0095 44.0063 46.4805V5.21965C44.0063 4.69066 43.6295 4.31282 43.102 4.31282L4.82261 5.67307C4.14443 5.67307 3.61695 6.27762 3.61695 6.95775V45.1203C3.61695 45.8004 4.14443 46.3294 4.82261 46.405H4.89796Z"})]}),
|
|
39
38
|
/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-neutral-50",children:["Powered by ",
|
|
40
|
-
/* @__PURE__ */s("span",{className:"lb:font-semibold lb:text-white",children:"Limbo"})]})]})}function Se({variant:e="info",toast:
|
|
41
|
-
return c("div",{className:`${
|
|
42
|
-
/* @__PURE__ */s("button",{type:"button",onClick:e=>{e.stopPropagation(),a?a():b(!0)},className:"lb:absolute lb:top-1/2 lb:-translate-y-1/2 lb:right-2 lb:p-1 lb:rounded-full lb:opacity-60 lb:hover:opacity-100 lb:transition-opacity lb:cursor-pointer","aria-label":"Cerrar",children:/* @__PURE__ */s("span",{className:"icon icon-close-small-white icon--sm","aria-hidden":"true"})})]})}"undefined"!=typeof window&&window.addEventListener("pageshow",e=>{e.persisted&&we()});const Ne=/* @__PURE__ */new Map,Ee=/* @__PURE__ */new Map,$e=18e5;if("undefined"!=typeof document){const e=18e5;let t=null;document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?t=Date.now():"visible"===document.visibilityState&&null!==t&&(Date.now()-t>e&&(Ne.forEach(({blobUrl:e})=>{try{URL.revokeObjectURL(e)}catch{}}),Ne.clear(),Ee.clear()),t=null)}),window.addEventListener("pageshow",e=>{e.persisted&&(Ne.forEach(({blobUrl:e})=>{try{URL.revokeObjectURL(e)}catch{}}),Ne.clear(),Ee.clear())})}const _e=async(e,{bypassHttpCache:t=!1}={})=>{if(!e)return Promise.reject(new Error("No URL provided"));const
|
|
39
|
+
/* @__PURE__ */s("span",{className:"lb:font-semibold lb:text-white",children:"Limbo"})]})]})}function Se({variant:e="info",toast:l=!1,fixed:r=!1,onClose:a,className:i="",children:o,role:u}){const[d,b]=t(!1);if(n(()=>{b(!1)},[o]),d)return null;/* @__PURE__ */
|
|
40
|
+
return c("div",{className:`${l||r?`${r?"lb:fixed lb:top-4 lb:right-4 lb:z-10000":l?"lb:absolute lb:top-5 lb:right-5 lb:w-fit lb:m-4 lb:z-50":""} ${{success:"lb:bg-green-600",danger:"lb:bg-red-500",warning:"lb:bg-yellow-500",info:"lb:bg-blue-500"}[e]||"lb:bg-gray-600"} lb:text-white lb:px-5 lb:py-3 lb:rounded-lg lb:shadow-lg lb:transition-all lb:duration-300 lb:animate-fade-in`:`limbo-alert limbo-alert-${e}`} lb:pr-8 ${i}`,role:u||"alert",children:[o,
|
|
41
|
+
/* @__PURE__ */s("button",{type:"button",onClick:e=>{e.stopPropagation(),a?a():b(!0)},className:"lb:absolute lb:top-1/2 lb:-translate-y-1/2 lb:right-2 lb:p-1 lb:rounded-full lb:opacity-60 lb:hover:opacity-100 lb:transition-opacity lb:cursor-pointer","aria-label":"Cerrar",children:/* @__PURE__ */s("span",{className:"icon icon-close-small-white icon--sm","aria-hidden":"true"})})]})}"undefined"!=typeof window&&window.addEventListener("pageshow",e=>{e.persisted&&we()});const Ne=/* @__PURE__ */new Map,Ee=/* @__PURE__ */new Map,$e=18e5;if("undefined"!=typeof document){const e=18e5;let t=null;document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?t=Date.now():"visible"===document.visibilityState&&null!==t&&(Date.now()-t>e&&(Ne.forEach(({blobUrl:e})=>{try{URL.revokeObjectURL(e)}catch{}}),Ne.clear(),Ee.clear()),t=null)}),window.addEventListener("pageshow",e=>{e.persisted&&(Ne.forEach(({blobUrl:e})=>{try{URL.revokeObjectURL(e)}catch{}}),Ne.clear(),Ee.clear())})}const _e=async(e,{bypassHttpCache:t=!1}={})=>{if(!e)return Promise.reject(new Error("No URL provided"));const n=Ne.get(e);if(n&&Date.now()-n.timestamp<$e)return n.blobUrl;if(Ee.has(e))return Ee.get(e);const l=(async()=>{try{let l,r,a=0;const i=t?{cache:"reload"}:{};for(;a<2;)try{if(l=await fetch(e,i),!l.ok)throw new Error(`Failed to fetch image: ${l.status}`);break}catch(n){if(r=n,a+=1,a>=2)throw r}const o=await l.blob(),s=URL.createObjectURL(o);return Ne.set(e,{blobUrl:s,timestamp:Date.now(),size:o.size}),s}finally{Ee.delete(e)}})();return Ee.set(e,l),l},Te=e=>{const t=Ne.get(e);return t&&Date.now()-t.timestamp<$e?t.blobUrl:e},Ae=e=>{const t=Ne.get(e);return t&&Date.now()-t.timestamp<$e},ze=async(e,t=4)=>{const n=/* @__PURE__ */new Map,l=e.filter(e=>!Ae(e));if(0===l.length)return e.forEach(e=>{n.set(e,Te(e))}),n;const r=[];for(let a=0;a<l.length;a+=t)r.push(l.slice(a,a+t));for(const a of r){(await Promise.allSettled(a.map(async e=>({url:e,blobUrl:await _e(e)})))).forEach(e=>{"fulfilled"===e.status&&n.set(e.value.url,e.value.blobUrl)})}return n},Le=e=>{if(!e)return;const t=Ne.get(e);if(t){try{URL.revokeObjectURL(t.blobUrl)}catch{}Ne.delete(e)}Ee.delete(e)},Me=()=>{Ne.forEach(({blobUrl:e})=>{try{URL.revokeObjectURL(e)}catch{}}),Ne.clear(),Ee.clear()};function Pe({isOpen:e=!1,onClose:t,title:r="",subtitle:i="",headerActions:o=null,footerHints:u=null,ariaLabel:d="Visor de archivo",children:b}){const m=l(null),h=a(e=>{"Escape"===e.key&&(e.preventDefault(),t?.())},[t]);return n(()=>{if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,h]),n(()=>(document.body.style.overflow=e?"hidden":"",()=>{document.body.style.overflow=""}),[e]),e?/* @__PURE__ */c("div",{className:"lb:fixed lb:inset-0 lb:bg-black/95 lb:z-[10000] lb:flex lb:flex-col",role:"dialog","aria-modal":"true","aria-label":d,children:[
|
|
43
42
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:px-4 lb:py-3 lb:bg-black/50 lb:backdrop-blur-sm",children:[
|
|
44
43
|
/* @__PURE__ */c("div",{className:"lb:flex-1 lb:min-w-0",children:[r&&/* @__PURE__ */s("h2",{className:"lb:text-white lb:font-medium lb:text-sm lb:truncate",children:r.includes(".")?r.split(".").slice(0,-1).join("."):r}),i&&/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-xs lb:mt-0.5 lb:truncate",children:i})]}),o&&/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:gap-2 lb:mx-4",children:o}),
|
|
45
44
|
/* @__PURE__ */s("button",{type:"button",onClick:t,className:"lb:w-10 lb:h-10 lb:flex lb:items-center lb:justify-center lb:rounded-lg lb:bg-white/10 lb:hover:bg-red-1000/80 lb:text-white lb:transition-colors","aria-label":"Cerrar visor (ESC)",title:"Cerrar (ESC)",children:/* @__PURE__ */s("svg",{className:"lb:w-6 lb:h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),
|
|
46
|
-
/* @__PURE__ */s("div",{ref:m,className:"lb:flex-1 lb:overflow-hidden lb:flex lb:items-center lb:justify-center",onClick:e=>{e.target===m.current&&t?.()},children:b}),u&&/* @__PURE__ */s("div",{className:"lb:px-4 lb:py-2 lb:bg-black/50 lb:backdrop-blur-sm lb:text-center",children:/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-xs",children:u})})]}):null}function
|
|
47
|
-
return s(
|
|
45
|
+
/* @__PURE__ */s("div",{ref:m,className:"lb:flex-1 lb:overflow-hidden lb:flex lb:items-center lb:justify-center",onClick:e=>{e.target===m.current&&t?.()},children:b}),u&&/* @__PURE__ */s("div",{className:"lb:px-4 lb:py-2 lb:bg-black/50 lb:backdrop-blur-sm lb:text-center",children:/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-xs",children:u})})]}):null}function Ie({isOpen:e=!1,src:r,title:i="",subtitle:o="",onClose:u}){const[d,b]=t(!1),[m,h]=t(!0),p=l(null);n(()=>{e&&(b(!1),h(!0))},[e]);const f=a(e=>{" "===e.key&&p.current&&(e.preventDefault(),p.current.paused?p.current.play():p.current.pause())},[]);n(()=>{if(e)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,f]);/* @__PURE__ */
|
|
46
|
+
return s(Pe,{isOpen:e,onClose:u,title:i,subtitle:o,ariaLabel:"Visor de video",headerActions:/* @__PURE__ */c("button",{type:"button",onClick:async()=>{if(r)try{const e=await fetch(r,{mode:"cors"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.blob(),n=URL.createObjectURL(t),l=document.createElement("a");l.href=n,l.download=i||"video",l.style.display="none",document.body.appendChild(l),l.click(),setTimeout(()=>{URL.revokeObjectURL(n),document.body.removeChild(l)},100)}catch{window.open(r,"_blank")}},className:"lb:flex lb:items-center lb:gap-2 lb:px-3 lb:py-1.5 lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:text-sm lb:transition-colors","aria-label":"Descargar video",title:"Descargar video",children:[
|
|
48
47
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),
|
|
49
48
|
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Descargar"})]}),footerHints:/* @__PURE__ */c("span",{children:[
|
|
50
49
|
/* @__PURE__ */c("span",{className:"lb:hidden lb:sm:inline",children:[
|
|
@@ -53,8 +52,8 @@ return s(Me,{isOpen:e,onClose:u,title:i,subtitle:o,ariaLabel:"Visor de video",he
|
|
|
53
52
|
/* @__PURE__ */s("svg",{className:"lb:w-16 lb:h-16 lb:mx-auto lb:mb-4 lb:text-red-800",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("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"})}),
|
|
54
53
|
/* @__PURE__ */s("p",{className:"lb:text-lg lb:font-medium",children:"No se puede reproducir el video"}),
|
|
55
54
|
/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-sm lb:mt-2",children:i})]}:{className:"lb:relative lb:w-full lb:max-w-5xl lb:max-h-full lb:flex lb:items-center lb:justify-center lb:px-4",children:[m&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("div",{className:"lb:w-12 lb:h-12 lb:border-4 lb:border-white/20 lb:border-t-white lb:rounded-full lb:animate-spin"})}),
|
|
56
|
-
/* @__PURE__ */s("video",{ref:p,src:r,className:"lb:max-w-full lb:max-h-[calc(100vh-140px)] lb:h-full lb:w-full lb:rounded-lg",controls:!0,autoPlay:!0,preload:"metadata",onCanPlay:()=>h(!1),onError:()=>{b(!0),h(!1)},children:"Tu navegador no soporta la reproduccion de video."})]})})}function De({isOpen:e=!1,src:r,title:i="",subtitle:o="",onClose:u}){const[d,b]=t(!1),[m,h]=t(!1),[p,f]=t(0),[g,v]=t(0),y=
|
|
57
|
-
return s(
|
|
55
|
+
/* @__PURE__ */s("video",{ref:p,src:r,className:"lb:max-w-full lb:max-h-[calc(100vh-140px)] lb:h-full lb:w-full lb:rounded-lg",controls:!0,autoPlay:!0,preload:"metadata",onCanPlay:()=>h(!1),onError:()=>{b(!0),h(!1)},children:"Tu navegador no soporta la reproduccion de video."})]})})}function De({isOpen:e=!1,src:r,title:i="",subtitle:o="",onClose:u}){const[d,b]=t(!1),[m,h]=t(!1),[p,f]=t(0),[g,v]=t(0),y=l(null);n(()=>{e&&(h(!1),b(!1),f(0),v(0))},[e]);const w=a(()=>{y.current&&(y.current.paused?y.current.play():y.current.pause())},[]),x=a(e=>{" "===e.key&&(e.preventDefault(),w())},[w]);n(()=>{if(e)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,x]);const k=e=>{if(!e||isNaN(e))return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`};/* @__PURE__ */
|
|
56
|
+
return s(Pe,{isOpen:e,onClose:u,title:i,subtitle:o,ariaLabel:"Visor de audio",headerActions:/* @__PURE__ */c("button",{type:"button",onClick:async()=>{if(r)try{const e=await fetch(r,{mode:"cors"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.blob(),n=URL.createObjectURL(t),l=document.createElement("a");l.href=n,l.download=i||"audio",l.style.display="none",document.body.appendChild(l),l.click(),setTimeout(()=>{URL.revokeObjectURL(n),document.body.removeChild(l)},100)}catch{window.open(r,"_blank")}},className:"lb:flex lb:items-center lb:gap-2 lb:px-3 lb:py-1.5 lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:text-sm lb:transition-colors","aria-label":"Descargar audio",title:"Descargar audio",children:[
|
|
58
57
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),
|
|
59
58
|
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Descargar"})]}),footerHints:/* @__PURE__ */c("span",{children:[
|
|
60
59
|
/* @__PURE__ */c("span",{className:"lb:hidden lb:sm:inline",children:[
|
|
@@ -68,33 +67,33 @@ return s(Me,{isOpen:e,onClose:u,title:i,subtitle:o,ariaLabel:"Visor de audio",he
|
|
|
68
67
|
/* @__PURE__ */s("button",{type:"button",onClick:w,className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center lb:rounded-full lb:bg-black/0 lb:hover:bg-white/10 lb:transition-colors lb:cursor-pointer","aria-label":d?"Pausar":"Reproducir",children:/* @__PURE__ */s("div",{className:"lb:w-14 lb:h-14 lb:rounded-full lb:bg-white/90 lb:flex lb:items-center lb:justify-center lb:shadow-lg",children:/* @__PURE__ */s("span",{className:`icon ${d?"icon-pause":"icon-play"} icon--lg lb:text-gray-800 ${d?"":"lb:ml-0.5"}`})})})]}),
|
|
69
68
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-3 lb:text-white lb:text-sm",children:[
|
|
70
69
|
/* @__PURE__ */s("span",{className:"lb:font-mono lb:min-w-[3ch] lb:text-right",children:k(g)}),
|
|
71
|
-
/* @__PURE__ */s("div",{className:"lb:w-64 lb:h-2 lb:bg-white/20 lb:rounded-full lb:cursor-pointer lb:relative",onClick:e=>{if(!y.current||!p)return;const t=e.currentTarget.getBoundingClientRect(),
|
|
70
|
+
/* @__PURE__ */s("div",{className:"lb:w-64 lb:h-2 lb:bg-white/20 lb:rounded-full lb:cursor-pointer lb:relative",onClick:e=>{if(!y.current||!p)return;const t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width;y.current.currentTime=n*p},role:"slider","aria-label":"Progreso de audio","aria-valuenow":g,"aria-valuemin":0,"aria-valuemax":p,tabIndex:0,children:/* @__PURE__ */s("div",{className:"lb:h-full lb:bg-purple-500 lb:rounded-full lb:transition-all lb:duration-100",style:{width:p>0?g/p*100+"%":"0%"}})}),
|
|
72
71
|
/* @__PURE__ */s("span",{className:"lb:font-mono lb:min-w-[3ch] lb:text-gray-400",children:k(p)})]}),
|
|
73
|
-
/* @__PURE__ */s("audio",{ref:y,src:r,onPlay:()=>b(!0),onPause:()=>b(!1),onTimeUpdate:()=>v(y.current?.currentTime||0),onLoadedMetadata:()=>f(y.current?.duration||0),onEnded:()=>{b(!1),v(0)},onError:()=>h(!0),preload:"metadata"})]})})}function Re({isOpen:e=!1,src:r,title:a="",subtitle:i="",onClose:o}){const[u,d]=t(!0),[b,m]=t(!1),[h,p]=t(null),f=
|
|
74
|
-
return s(
|
|
72
|
+
/* @__PURE__ */s("audio",{ref:y,src:r,onPlay:()=>b(!0),onPause:()=>b(!1),onTimeUpdate:()=>v(y.current?.currentTime||0),onLoadedMetadata:()=>f(y.current?.duration||0),onEnded:()=>{b(!1),v(0)},onError:()=>h(!0),preload:"metadata"})]})})}function Re({isOpen:e=!1,src:r,title:a="",subtitle:i="",onClose:o}){const[u,d]=t(!0),[b,m]=t(!1),[h,p]=t(null),f=l(null);n(()=>{if(!e||!r)return;let t=!1;return d(!0),m(!1),fetch(r).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.blob()}).then(e=>{if(t)return;f.current&&URL.revokeObjectURL(f.current);const n=URL.createObjectURL(e);f.current=n,p(n)}).catch(()=>{t||(m(!0),d(!1))}),()=>{t=!0}},[r,e]),n(()=>()=>{f.current&&(URL.revokeObjectURL(f.current),f.current=null)},[]);const g=()=>{if(!r)return;const e=document.createElement("a");e.href=r,e.download=a||"document.pdf",e.target="_blank",document.body.appendChild(e),e.click(),document.body.removeChild(e)};/* @__PURE__ */
|
|
73
|
+
return s(Pe,{isOpen:e,onClose:o,title:a,subtitle:i,ariaLabel:"Visor de PDF",headerActions:/* @__PURE__ */c("button",{type:"button",onClick:g,className:"lb:flex lb:items-center lb:gap-2 lb:px-3 lb:py-1.5 lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:text-sm lb:transition-colors","aria-label":"Abrir PDF en nueva pestaña",title:"Abrir PDF en nueva pestaña",children:[
|
|
75
74
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left-white lb:rotate-40 lb:me-0 lb:pe-0 icon--sm"}),
|
|
76
75
|
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Abrir en nueva pestaña"})]}),footerHints:/* @__PURE__ */c("span",{children:[
|
|
77
76
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"ESC"})," ","cerrar"]}),children:/* @__PURE__ */c("div",b?{className:"lb:text-center lb:text-white",children:[
|
|
78
77
|
/* @__PURE__ */s("svg",{className:"lb:w-16 lb:h-16 lb:mx-auto lb:mb-4 lb:text-red-800",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("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"})}),
|
|
79
78
|
/* @__PURE__ */s("p",{className:"lb:text-lg lb:font-medium",children:"No se puede mostrar el PDF"}),
|
|
80
79
|
/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-sm lb:mt-2",children:a}),
|
|
81
|
-
/* @__PURE__ */s("button",{type:"button",onClick:g,className:"lb:mt-4 lb:px-6 lb:py-2.5 lb:bg-white lb:text-gray-900 lb:rounded-lg lb:font-medium lb:text-sm lb:hover:bg-gray-100 lb:transition-colors",children:"Descargar PDF"})]}:{className:"lb:relative lb:w-full lb:h-full lb:px-4 lb:py-2",children:[u&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center lb:z-10",children:/* @__PURE__ */s("div",{className:"lb:w-12 lb:h-12 lb:border-4 lb:border-white/20 lb:border-t-white lb:rounded-full lb:animate-spin"})}),h&&/* @__PURE__ */s("iframe",{src:h,title:a||"PDF Viewer",className:"lb:w-full lb:h-full lb:rounded-lg lb:bg-white",onLoad:()=>d(!1),onError:()=>{m(!0),d(!1)}})]})})}const Oe={"application/pdf":{symbol:"icon-doc-pdf",label:"PDF",color:"#dc2626"},"application/msword":{symbol:"icon-doc-word",label:"DOC",color:"#2563eb"},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{symbol:"icon-doc-word",label:"DOCX",color:"#2563eb"},"application/vnd.ms-excel":{symbol:"icon-doc-xls",label:"XLS",color:"#16a34a"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{symbol:"icon-doc-xls",label:"XLSX",color:"#16a34a"},"application/vnd.ms-powerpoint":{symbol:"icon-doc-ppt",label:"PPT",color:"#ea580c"},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{symbol:"icon-doc-ppt",label:"PPTX",color:"#ea580c"},"text/plain":{symbol:"icon-doc-text",label:"TXT",color:"#6b7280"},"text/csv":{symbol:"icon-doc-report",label:"CSV",color:"#16a34a"},"audio/mp3":{symbol:"icon-support-person",label:"MP3",color:"#0891b2"},"audio/mpeg":{symbol:"icon-support-person",label:"MP3",color:"#0891b2"},"audio/wav":{symbol:"icon-support-person",label:"WAV",color:"#0891b2"},"audio/ogg":{symbol:"icon-support-person",label:"OGG",color:"#0891b2"},"video/mp4":{symbol:"icon-video",label:"MP4",color:"#7c3aed"},"video/x-msvideo":{symbol:"icon-video",label:"AVI",color:"#7c3aed"},"video/x-matroska":{symbol:"icon-video",label:"MKV",color:"#7c3aed"},default:{symbol:"icon-clip",label:"FILE",color:"#6b7280"}},
|
|
80
|
+
/* @__PURE__ */s("button",{type:"button",onClick:g,className:"lb:mt-4 lb:px-6 lb:py-2.5 lb:bg-white lb:text-gray-900 lb:rounded-lg lb:font-medium lb:text-sm lb:hover:bg-gray-100 lb:transition-colors",children:"Descargar PDF"})]}:{className:"lb:relative lb:w-full lb:h-full lb:px-4 lb:py-2",children:[u&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center lb:z-10",children:/* @__PURE__ */s("div",{className:"lb:w-12 lb:h-12 lb:border-4 lb:border-white/20 lb:border-t-white lb:rounded-full lb:animate-spin"})}),h&&/* @__PURE__ */s("iframe",{src:h,title:a||"PDF Viewer",className:"lb:w-full lb:h-full lb:rounded-lg lb:bg-white",onLoad:()=>d(!1),onError:()=>{m(!0),d(!1)}})]})})}const Oe={"application/pdf":{symbol:"icon-doc-pdf",label:"PDF",color:"#dc2626"},"application/msword":{symbol:"icon-doc-word",label:"DOC",color:"#2563eb"},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{symbol:"icon-doc-word",label:"DOCX",color:"#2563eb"},"application/vnd.ms-excel":{symbol:"icon-doc-xls",label:"XLS",color:"#16a34a"},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{symbol:"icon-doc-xls",label:"XLSX",color:"#16a34a"},"application/vnd.ms-powerpoint":{symbol:"icon-doc-ppt",label:"PPT",color:"#ea580c"},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{symbol:"icon-doc-ppt",label:"PPTX",color:"#ea580c"},"text/plain":{symbol:"icon-doc-text",label:"TXT",color:"#6b7280"},"text/csv":{symbol:"icon-doc-report",label:"CSV",color:"#16a34a"},"audio/mp3":{symbol:"icon-support-person",label:"MP3",color:"#0891b2"},"audio/mpeg":{symbol:"icon-support-person",label:"MP3",color:"#0891b2"},"audio/wav":{symbol:"icon-support-person",label:"WAV",color:"#0891b2"},"audio/ogg":{symbol:"icon-support-person",label:"OGG",color:"#0891b2"},"video/mp4":{symbol:"icon-video",label:"MP4",color:"#7c3aed"},"video/x-msvideo":{symbol:"icon-video",label:"AVI",color:"#7c3aed"},"video/x-matroska":{symbol:"icon-video",label:"MKV",color:"#7c3aed"},default:{symbol:"icon-clip",label:"FILE",color:"#6b7280"}},Fe={video:{symbol:"🎬",label:"VIDEO",color:"#7c3aed"},audio:{symbol:"🎵",label:"AUDIO",color:"#0891b2"},document:{symbol:"📄",label:"DOC",color:"#6b7280"},image:{symbol:"🖼️",label:"IMG",color:"#0ea5e9"}};function je(e,t){return Oe[e]?Oe[e]:t&&Fe[t]?Fe[t]:e?.startsWith("video/")?Fe.video:e?.startsWith("audio/")?Fe.audio:e?.startsWith("image/")?Fe.image:Oe.default}function Ue(e){if(!e||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]}function Be({file:e,mimeType:t,category:n}){const l=je(t,n),r=e?.name||"archivo",a=Ue(e?.size);/* @__PURE__ */
|
|
82
81
|
return c("div",{className:"lb:flex lb:flex-col lb:items-center lb:justify-center lb:min-h-50",children:[
|
|
83
|
-
/* @__PURE__ */s("div",{className:"lb:w-24 lb:h-24 lb:flex lb:items-center lb:justify-center lb:bg-gray-100 lb:rounded-xl lb:mb-4",children:/* @__PURE__ */s("span",{className:`icon ${
|
|
82
|
+
/* @__PURE__ */s("div",{className:"lb:w-24 lb:h-24 lb:flex lb:items-center lb:justify-center lb:bg-gray-100 lb:rounded-xl lb:mb-4",children:/* @__PURE__ */s("span",{className:`icon ${l.symbol} lb:h-[55%] lb:w-[55%] lb:max-h-50 lb:max-w-50`,"aria-hidden":"true"})}),
|
|
84
83
|
/* @__PURE__ */s("p",{className:"lb:text-sm lb:font-medium lb:text-gray-800 lb:text-center lb:max-w-full lb:truncate lb:px-4",children:r}),
|
|
85
84
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2 lb:mt-3",children:[
|
|
86
85
|
/* @__PURE__ */s("span",{className:"lb:text-xs lb:text-gray-500",children:a}),
|
|
87
|
-
/* @__PURE__ */s("span",{className:"lb:text-xs lb:font-bold lb:uppercase lb:px-2 lb:py-0.5 lb:rounded",style:{backgroundColor:
|
|
88
|
-
return s(
|
|
86
|
+
/* @__PURE__ */s("span",{className:"lb:text-xs lb:font-bold lb:uppercase lb:px-2 lb:py-0.5 lb:rounded",style:{backgroundColor:l.color,color:"white"},children:l.label})]})]})}function qe({isOpen:e=!1,src:t,title:n="",subtitle:l="",mimeType:r="",fileSize:a=0,onClose:i}){const o=je(r);/* @__PURE__ */
|
|
87
|
+
return s(Pe,{isOpen:e,onClose:i,title:n,subtitle:l,ariaLabel:"Visor de documento",footerHints:/* @__PURE__ */c("span",{children:[
|
|
89
88
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"ESC"})," ","cerrar"]}),children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:items-center lb:gap-6 lb:text-center lb:px-4",children:[
|
|
90
89
|
/* @__PURE__ */s("div",{className:"lb:w-32 lb:h-32 lb:flex lb:items-center lb:justify-center lb:bg-white/5 lb:rounded-2xl lb:border lb:border-white/10",children:/* @__PURE__ */s("span",{className:`icon ${o.symbol}-white lb:min-w-16 lb:min-h-16`,"aria-hidden":"true"})}),
|
|
91
90
|
/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-bold lb:uppercase lb:px-4 lb:py-1.5 lb:rounded-full",style:{backgroundColor:o.color,color:"white"},children:o.label}),
|
|
92
91
|
/* @__PURE__ */c("div",{children:[
|
|
93
|
-
/* @__PURE__ */s("p",{className:"lb:text-white lb:font-medium lb:text-lg lb:max-w-md lb:truncate",children:
|
|
92
|
+
/* @__PURE__ */s("p",{className:"lb:text-white lb:font-medium lb:text-lg lb:max-w-md lb:truncate",children:n}),a>0&&/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-sm lb:mt-1",children:Ue(a)})]}),
|
|
94
93
|
/* @__PURE__ */s("p",{className:"lb:text-gray-500 lb:text-sm",children:"Este tipo de archivo no se puede previsualizar"}),
|
|
95
|
-
/* @__PURE__ */c("button",{type:"button",onClick:async()=>{if(t)try{const e=await fetch(t,{mode:"cors"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const
|
|
96
|
-
/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Descargar archivo"]})]})})}const We=2097152;function Ve({isOpen:e=!1,src:
|
|
97
|
-
return s(
|
|
94
|
+
/* @__PURE__ */c("button",{type:"button",onClick:async()=>{if(t)try{const e=await fetch(t,{mode:"cors"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const l=await e.blob(),r=URL.createObjectURL(l),a=document.createElement("a");a.href=r,a.download=n||"document",a.style.display="none",document.body.appendChild(a),a.click(),setTimeout(()=>{URL.revokeObjectURL(r),document.body.removeChild(a)},100)}catch{window.open(t,"_blank")}},className:"lb:flex lb:items-center lb:gap-2 lb:px-8 lb:py-3 lb:bg-white lb:text-gray-900 lb:rounded-lg lb:font-medium lb:text-sm lb:hover:bg-gray-100 lb:transition-colors lb:shadow-lg","aria-label":"Descargar archivo",children:[
|
|
95
|
+
/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Descargar archivo"]})]})})}const We=2097152;function Ve({isOpen:e=!1,src:l,title:r="",subtitle:a="",mimeType:i="",onClose:o}){const[u,d]=t(!0),[b,m]=t(!1),[h,p]=t(""),[f,g]=t(!1);n(()=>{if(!e||!l)return;let t=!1;return d(!0),m(!1),p(""),g(!1),fetch(l).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.blob()}).then(e=>{if(t)return;const n=e.size>We?e.slice(0,We):e;return e.size>We&&g(!0),n.text()}).then(e=>{if(!t){if("application/json"===i||r.endsWith(".json"))try{const t=JSON.parse(e);e=JSON.stringify(t,null,2)}catch{}p(e),d(!1)}}).catch(()=>{t||(m(!0),d(!1))}),()=>{t=!0}},[l,e,i,r]);const v=async()=>{if(l)try{const e=await fetch(l,{mode:"cors"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.blob(),n=URL.createObjectURL(t),a=document.createElement("a");a.href=n,a.download=r||"file.txt",a.style.display="none",document.body.appendChild(a),a.click(),setTimeout(()=>{URL.revokeObjectURL(n),document.body.removeChild(a)},100)}catch{window.open(l,"_blank")}},y=h?h.split("\n").length:0;/* @__PURE__ */
|
|
96
|
+
return s(Pe,{isOpen:e,onClose:o,title:r,subtitle:a,ariaLabel:"Visor de texto",headerActions:/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2",children:[y>0&&/* @__PURE__ */c("span",{className:"lb:text-gray-400 lb:text-xs",children:[y," ",1===y?"linea":"lineas"]}),
|
|
98
97
|
/* @__PURE__ */c("button",{type:"button",onClick:v,className:"lb:flex lb:items-center lb:gap-2 lb:px-3 lb:py-1.5 lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:text-sm lb:transition-colors","aria-label":"Descargar archivo",title:"Descargar archivo",children:[
|
|
99
98
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),
|
|
100
99
|
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Descargar"})]})]}),footerHints:/* @__PURE__ */c("span",{children:[
|
|
@@ -105,23 +104,23 @@ return s(Me,{isOpen:e,onClose:o,title:r,subtitle:a,ariaLabel:"Visor de texto",he
|
|
|
105
104
|
/* @__PURE__ */s("button",{type:"button",onClick:v,className:"lb:mt-4 lb:px-6 lb:py-2.5 lb:bg-white lb:text-gray-900 lb:rounded-lg lb:font-medium lb:text-sm lb:hover:bg-gray-100 lb:transition-colors",children:"Descargar archivo"})]}):u?/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("div",{className:"lb:w-12 lb:h-12 lb:border-4 lb:border-white/20 lb:border-t-white lb:rounded-full lb:animate-spin"})}):/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:h-full lb:px-4 lb:py-2 lb:overflow-hidden lb:flex lb:flex-col",children:[f&&/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2 lb:px-4 lb:py-2 lb:bg-yellow-900/50 lb:border lb:border-yellow-700/50 lb:rounded-lg lb:mb-2 lb:shrink-0",children:[
|
|
106
105
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4 lb:text-yellow-400 lb:shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01"})}),
|
|
107
106
|
/* @__PURE__ */s("span",{className:"lb:text-yellow-300 lb:text-xs",children:"Archivo truncado (mostrando primeros 2MB). Descarga el archivo completo para ver todo el contenido."})]}),
|
|
108
|
-
/* @__PURE__ */s("div",{className:"lb:flex-1 lb:overflow-auto lb:rounded-lg lb:bg-gray-900/80 lb:border lb:border-white/10",children:/* @__PURE__ */s("pre",{className:"lb:p-4 lb:text-sm lb:text-gray-200 lb:font-mono lb:whitespace-pre-wrap lb:break-words lb:leading-relaxed lb:m-0",children:h})})]})})}function He({src:e,alt:r="Imagen",title:i="",subtitle:o="",onClose:d,isOpen:b=!1,tags:m=[]}){const[h,p]=t(1),[f,g]=t({x:0,y:0}),[v,y]=t(!1),[w,x]=t(!1),[k,C]=t({x:0,y:0}),[S,N]=t(!1),[E,$]=t(!1),_=
|
|
109
|
-
return s(
|
|
107
|
+
/* @__PURE__ */s("div",{className:"lb:flex-1 lb:overflow-auto lb:rounded-lg lb:bg-gray-900/80 lb:border lb:border-white/10",children:/* @__PURE__ */s("pre",{className:"lb:p-4 lb:text-sm lb:text-gray-200 lb:font-mono lb:whitespace-pre-wrap lb:break-words lb:leading-relaxed lb:m-0",children:h})})]})})}function He({src:e,alt:r="Imagen",title:i="",subtitle:o="",onClose:d,isOpen:b=!1,tags:m=[]}){const[h,p]=t(1),[f,g]=t({x:0,y:0}),[v,y]=t(!1),[w,x]=t(!1),[k,C]=t({x:0,y:0}),[S,N]=t(!1),[E,$]=t(!1),_=l(null),T=l(null);n(()=>{b&&(p(1),g({x:0,y:0}),N(!1),$(!1))},[b]);const A=a(()=>{p(e=>Math.min(e+.25,5)),g({x:0,y:0})},[]),z=a(()=>{p(e=>Math.max(e-.25,.25)),g({x:0,y:0})},[]),L=a(()=>{p(1),g({x:0,y:0})},[]),M=a(()=>{p(1),g({x:0,y:0})},[]),P=a(e=>{if((e.ctrlKey||e.metaKey)&&("+"===e.key||"="===e.key))return e.preventDefault(),void A();if((e.ctrlKey||e.metaKey)&&"-"===e.key)return e.preventDefault(),void z();if((e.ctrlKey||e.metaKey)&&"0"===e.key)return e.preventDefault(),void L();if(h>1){const t=50;switch(e.key){case"ArrowUp":e.preventDefault(),g(e=>({...e,y:e.y+t}));break;case"ArrowDown":e.preventDefault(),g(e=>({...e,y:e.y-t}));break;case"ArrowLeft":e.preventDefault(),g(e=>({...e,x:e.x+t}));break;case"ArrowRight":e.preventDefault(),g(e=>({...e,x:e.x-t}))}}},[A,z,L,h]),I=a(e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.deltaY<0?A():z())},[A,z]),D=a(e=>{h>1&&0===e.button&&(e.preventDefault(),y(!0),x(!1),C({x:e.clientX-f.x,y:e.clientY-f.y}))},[h,f]),R=a(e=>{v&&(x(!0),g({x:e.clientX-k.x,y:e.clientY-k.y}))},[v,k]),O=a(()=>{y(!1)},[]),F=a(e=>{e.stopPropagation(),1!==h||w||(p(2),g({x:0,y:0})),x(!1)},[h,w]),j=a(e=>{e.stopPropagation(),1===h?(p(2),g({x:0,y:0})):L()},[h,L]);n(()=>{if(!b)return;document.addEventListener("keydown",P),document.addEventListener("mouseup",O),document.addEventListener("mousemove",R);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",O),document.removeEventListener("mousemove",R),document.removeEventListener("keydown",e)}},[b,P,O,R]);const U=Math.round(100*h);/* @__PURE__ */
|
|
108
|
+
return s(Pe,{isOpen:b,onClose:d,title:i,subtitle:o,ariaLabel:"Visor de imagen",headerActions:/* @__PURE__ */c(u,{children:[
|
|
110
109
|
/* @__PURE__ */s("button",{type:"button",onClick:z,disabled:h<=.25,className:"lb:w-8 lb:h-8 lb:flex lb:items-center lb:justify-center lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:disabled:opacity-30 lb:disabled:cursor-not-allowed lb:transition-colors","aria-label":"Reducir zoom",title:"Reducir zoom (Ctrl -)",children:/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})}),
|
|
111
110
|
/* @__PURE__ */c("div",{className:"lb:w-20 lb:text-center lb:text-white lb:text-sm lb:font-medium lb:bg-white/10 lb:rounded-lg lb:px-2 lb:py-1.5 lb:cursor-pointer lb:hover:bg-white/20 lb:transition-colors",onClick:L,title:"Click para restablecer zoom",role:"button",tabIndex:0,onKeyDown:e=>"Enter"===e.key&&L(),children:[U,"%"]}),
|
|
112
111
|
/* @__PURE__ */s("button",{type:"button",onClick:A,disabled:h>=5,className:"lb:w-8 lb:h-8 lb:flex lb:items-center lb:justify-center lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:disabled:opacity-30 lb:disabled:cursor-not-allowed lb:transition-colors","aria-label":"Aumentar zoom",title:"Aumentar zoom (Ctrl +)",children:/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),
|
|
113
|
-
/* @__PURE__ */s("button",{type:"button",onClick:
|
|
112
|
+
/* @__PURE__ */s("button",{type:"button",onClick:M,className:"lb:w-8 lb:h-8 lb:flex lb:items-center lb:justify-center lb:rounded-lg lb:bg-white/10 lb:hover:bg-white/20 lb:text-white lb:transition-colors lb:ml-2","aria-label":"Ajustar a pantalla",title:"Ajustar a pantalla (Ctrl 0)",children:/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("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"})})})]}),footerHints:/* @__PURE__ */c(u,{children:[
|
|
114
113
|
/* @__PURE__ */c("span",{className:"lb:hidden lb:sm:inline",children:[
|
|
115
114
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"Ctrl"})," ","+ rueda para zoom •"," ",
|
|
116
115
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"Ctrl"})," ","+"," ",
|
|
117
116
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"+"})," ","/"," ",
|
|
118
117
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"-"})," ","zoom • Click para zoom • Doble click para restablecer • Flechas para mover •"," ",
|
|
119
118
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"ESC"})," ","cerrar"]}),
|
|
120
|
-
/* @__PURE__ */s("span",{className:"lb:sm:hidden",children:"Click para zoom • Doble click para restablecer • ESC para cerrar"})]}),children:/* @__PURE__ */c("div",{ref:_,className:`lb:w-full lb:h-full lb:overflow-hidden lb:flex lb:items-center lb:justify-center ${h>1?"lb:cursor-grab":"lb:cursor-zoom-in"} ${v?"lb:cursor-grabbing":""}`,onClick:e=>{e.target===_.current&&d?.()},onWheel:
|
|
119
|
+
/* @__PURE__ */s("span",{className:"lb:sm:hidden",children:"Click para zoom • Doble click para restablecer • ESC para cerrar"})]}),children:/* @__PURE__ */c("div",{ref:_,className:`lb:w-full lb:h-full lb:overflow-hidden lb:flex lb:items-center lb:justify-center ${h>1?"lb:cursor-grab":"lb:cursor-zoom-in"} ${v?"lb:cursor-grabbing":""}`,onClick:e=>{e.target===_.current&&d?.()},onWheel:I,onMouseDown:D,children:[!S&&!E&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("div",{className:"lb:w-12 lb:h-12 lb:border-4 lb:border-white/20 lb:border-t-white lb:rounded-full lb:animate-spin"})}),E&&/* @__PURE__ */c("div",{className:"lb:text-center lb:text-white",children:[
|
|
121
120
|
/* @__PURE__ */s("svg",{className:"lb:w-16 lb:h-16 lb:mx-auto lb:mb-4 lb:text-red-800",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("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"})}),
|
|
122
121
|
/* @__PURE__ */s("p",{className:"lb:text-lg lb:font-medium",children:"Error al cargar la imagen"}),
|
|
123
122
|
/* @__PURE__ */s("p",{className:"lb:text-gray-400 lb:text-sm lb:mt-2",children:"No se pudo cargar la imagen"})]}),
|
|
124
|
-
/* @__PURE__ */s("img",{ref:T,src:e,alt:r,className:"lb:max-w-full lb:max-h-full lb:object-contain lb:transition-opacity lb:duration-200 lb:select-none "+(S?"lb:opacity-100":"lb:opacity-0"),style:{transform:`scale(${h}) translate(${f.x/h}px, ${f.y/h}px)`,transition:v?"none":"transform 0.2s ease-out"},onLoad:()=>N(!0),onError:()=>$(!0),onClick:
|
|
123
|
+
/* @__PURE__ */s("img",{ref:T,src:e,alt:r,className:"lb:max-w-full lb:max-h-full lb:object-contain lb:transition-opacity lb:duration-200 lb:select-none "+(S?"lb:opacity-100":"lb:opacity-0"),style:{transform:`scale(${h}) translate(${f.x/h}px, ${f.y/h}px)`,transition:v?"none":"transform 0.2s ease-out"},onLoad:()=>N(!0),onError:()=>$(!0),onClick:F,onDoubleClick:j,draggable:!1}),m&&m.length>0&&/* @__PURE__ */c("div",{className:"lb:absolute lb:top-4 lb:left-1/2 lb:-translate-x-1/2 lb:flex lb:flex-wrap lb:gap-2 lb:justify-center lb:max-w-[90%] lb:px-4 lb:max-h-24 lb:overflow-y-auto",children:[m.slice(0,20).map(e=>/* @__PURE__ */s("span",{className:"lb:inline-flex lb:items-center lb:px-2 lb:py-0.5 lb:bg-white/20 lb:text-white lb:text-xs lb:font-semibold lb:rounded-full lb:whitespace-nowrap",children:e},e)),m.length>20&&/* @__PURE__ */c("span",{className:"lb:inline-flex lb:items-center lb:px-2 lb:py-0.5 lb:bg-white/20 lb:text-white lb:text-xs lb:font-semibold lb:rounded-full",children:["+",m.length-20]})]})]})})}function Ke({image:r,isOpen:i,onClose:o,onSelect:d,onDelete:b,onCrop:m,onVariantDeleted:h,allowedActions:p={select:!0,download:!0,copy:!0,delete:!0,crop:!0}}){const{loadVariants:f,getVariants:g,isLoading:v,getError:y,removeVariant:w}=ke(),x=window.limboCore?.accessibilityManager,[k,C]=e.useState(null),[S,N]=e.useState(null),[E,$]=t(null),[_,T]=t(null),[A,z]=t({}),[L,M]=t({}),P=(window.limboCore?.config?.getGlobal()||{}).interaction||{allowSelection:!1,allowCropping:!0},I=P.allowSelection&&p.select&&d,D=P.allowCropping&&p.crop&&m,R=p.download,O=p.copy,F=p.delete,[j,U]=e.useState(/* @__PURE__ */new Set),[B,q]=e.useState(/* @__PURE__ */new Set),[W,V]=t({}),[H,K]=t(!1),G=l(null),Q=l(null),X=a(e=>{if("Escape"===e.key){if(E)return;e.preventDefault(),o?.()}if("Tab"===e.key&&G.current){const t=G.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=t[0],l=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),l?.focus()):e.shiftKey||document.activeElement!==l||(e.preventDefault(),n?.focus())}},[o,E]);n(()=>{if(i)return Q.current?.focus(),document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[i,X]);const Y=e.useMemo(()=>r?.variants||[],[r?.variants]),J=g(r?.id),Z=(J.length>0?J:Y).filter(e=>!B.has(e.id)),ee=v(r?.id),te=y(r?.id);n(()=>{i&&r?.id&&f(r.id,!0)},[i,r?.id]),e.useEffect(()=>{i&&(U(/* @__PURE__ */new Set),q(/* @__PURE__ */new Set),V({}),z({}),M({}))},[i]),e.useEffect(()=>{if(i&&B.size>0&&0===Z.length){const e=setTimeout(()=>{document.dispatchEvent(new CustomEvent("limbo:variantsCleared",{detail:{assetId:r?.id}})),o?.()},1200);return()=>clearTimeout(e)}},[i,B.size,Z.length,r?.id,o]);const ne=Z.map(e=>e.id).join(",");n(()=>{if(!i||!r?.url)return;let e=!1;return(async()=>{const t={},n={},l={},a="original",i=Ae(r.url);if(i?(n[a]=!0,t[a]=!1,l.original=Te(r.url)):(t[a]=!0,n[a]=!1),Z.forEach(e=>{Ae(e.url)?(n[e.id]=!0,t[e.id]=!1,l[e.id]=Te(e.url)):(t[e.id]=!0,n[e.id]=!1)}),z(t),M(n),Object.keys(l).length>0&&V(l),!i){const t=await _e(r.url);if(e)return;t&&(V(e=>({...e,original:t})),z(e=>({...e,[a]:!1})),M(e=>({...e,[a]:!0})))}if(Z.length>0){const t=Z.filter(e=>!Ae(e.url));if(t.length>0){const n=t.map(e=>e.url),l=await ze(n,4);if(e)return;const r={},a={},i={};t.forEach((e,t)=>{l[t]&&(r[e.id]=l[t],a[e.id]=!1,i[e.id]=!0)}),Object.keys(r).length>0&&(V(e=>({...e,...r})),z(e=>({...e,...a})),M(e=>({...e,...i})))}}})(),()=>{e=!0}},[i,r?.url,ne]);if(!i)return null;const le=e=>{x?.announce(`Abriendo visor de imagen: ${e.name}`);const t=W[e.id]||Te(e.url);$({src:t,title:e.name||e.filename||"Recorte",subtitle:`${e.width}×${e.height} · ${Math.round((e.file_size||0)/1024)}KB`})},re=()=>{x?.announce(`Abriendo visor de imagen: ${r.filename}`);const e=W.original||Te(r.url);$({src:e,title:r.filename||"Original",subtitle:`${r.width}×${r.height} · ${Math.round((r.file_size||0)/1024)}KB`})},ae=[{...r,isOriginal:!0},...Z.map(e=>({...e,isOriginal:!1}))];/* @__PURE__ */
|
|
125
124
|
return c("div",{className:"lb:fixed lb:inset-0 lb:bg-black/85 lb:flex lb:items-center lb:justify-center lb:z-[1000] lb:p-4",onClick:()=>{E||o?.()},role:"dialog","aria-modal":"true","aria-labelledby":"variants-modal-title","aria-describedby":"variants-modal-description",children:[
|
|
126
125
|
/* @__PURE__ */c("div",{ref:G,className:"lb:relative lb:bg-white lb:rounded-xl lb:max-w-[95vw] lb:max-h-[90vh] lb:overflow-hidden lb:shadow-2xl lb:flex lb:flex-col lb:w-[900px]",onClick:e=>e.stopPropagation(),children:[
|
|
127
126
|
/* @__PURE__ */c("div",{className:"lb:px-5 lb:py-4 lb:border-b lb:border-gray-200 lb:flex lb:justify-between lb:items-center lb:bg-gray-50",children:[
|
|
@@ -138,21 +137,21 @@ return c("div",{className:"lb:fixed lb:inset-0 lb:bg-black/85 lb:flex lb:items-c
|
|
|
138
137
|
/* @__PURE__ */c("p",{className:"lb:text-base lb:font-medium",children:["Error: ",te]}),
|
|
139
138
|
/* @__PURE__ */s("button",{onClick:()=>f(r.id,!0),className:"lb:mt-4 lb:text-sm lb:px-5 lb:py-2.5 lb:rounded-lg lb:bg-brand-blue-800 lb:text-white lb:hover:bg-brand-blue-1000 lb:focus:outline-none lb:focus:ring-2 lb:focus:ring-brand-blue-400 lb:focus:ring-offset-2",children:"Reintentar"})]}):0===Z.length?/* @__PURE__ */c("div",{className:"lb:text-center lb:py-16 lb:text-gray-500",children:[
|
|
140
139
|
/* @__PURE__ */s("svg",{className:"lb:w-12 lb:h-12 lb:mx-auto lb:mb-4 lb:text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("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"})}),
|
|
141
|
-
/* @__PURE__ */s("p",{className:"lb:text-base",children:"No hay recortes disponibles"})]}):/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:lg:grid-cols-3 lb:gap-5",role:"list","aria-label":"Lista de imágenes",children:ae.map((e,t)=>{const
|
|
142
|
-
return c("article",{role:"listitem","aria-label":`${i} - ${p}×${f} píxeles`,className:`lb:rounded-xl lb:overflow-hidden lb:transition-all lb:shadow-sm lb:hover:shadow-lg ${
|
|
143
|
-
/* @__PURE__ */c("button",{type:"button",title:
|
|
140
|
+
/* @__PURE__ */s("p",{className:"lb:text-base",children:"No hay recortes disponibles"})]}):/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:lg:grid-cols-3 lb:gap-5",role:"list","aria-label":"Lista de imágenes",children:ae.map((e,t)=>{const n=e.isOriginal,l=!n&&j.has(e.id),a=n?W.original||Te(e.url):W[e.id]||Te(e.url),i=n?"Original":e.name||e.filename||`Recorte ${t}`,p=n?r.width:e.width,f=n?r.height:e.height,g=n?r.file_size:e.file_size||0,v=n?"original":e.id,y=A[v]&&!l,k=L[v];/* @__PURE__ */
|
|
141
|
+
return c("article",{role:"listitem","aria-label":`${i} - ${p}×${f} píxeles`,className:`lb:rounded-xl lb:overflow-hidden lb:transition-all lb:shadow-sm lb:hover:shadow-lg ${n?"lb:ring-2 lb:ring-brand-blue-800 lb:ring-offset-2 lb:bg-white":"lb:border lb:border-gray-200 lb:bg-white lb:hover:border-brand-blue-400"} lb:focus-within:ring-2 lb:focus-within:ring-brand-blue-400`,children:[
|
|
142
|
+
/* @__PURE__ */c("button",{type:"button",title:I?"Click para seleccionar":"Click para ampliar con zoom",className:"lb:relative lb:w-full lb:cursor-pointer lb:aspect-square lb:flex lb:items-center lb:justify-center lb:overflow-hidden lb:bg-gray-100 lb:focus:outline-none lb:group",onClick:l?void 0:()=>{I?n?(d?.(r),o?.()):(e=>{const t={id:e.id,filename:`${r.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:r.id,variant_info:e};x?.announce(`Recorte seleccionado: ${e.name}`),d?.(t),o?.()})(e):n?re():le(e)},"aria-label":I?`Seleccionar ${i}`:`Ver ${i} en tamaño completo con zoom`,disabled:l,children:[y&&!l&&/* @__PURE__ */s("div",{className:"lb:w-full lb:aspect-square lb:rounded lb:bg-neutral-gray-200 lb:animate-pulse lb:flex lb:items-center lb:justify-center lb:absolute lb:inset-0 lb:z-10",children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:w-8 lb:h-8 lb:animate-spin"})}),l?/* @__PURE__ */c("div",{className:"lb:text-center lb:text-gray-400",children:[
|
|
144
143
|
/* @__PURE__ */s("svg",{className:"lb:w-10 lb:h-10 lb:mx-auto lb:mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),
|
|
145
144
|
/* @__PURE__ */s("span",{className:"lb:text-sm",children:"Error al cargar"})]}):/* @__PURE__ */c(u,{children:[
|
|
146
|
-
/* @__PURE__ */s("img",{src:a,alt:`${i} - ${p}×${f}px`,loading:
|
|
147
|
-
/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-black/0 lb:group-hover:bg-black/10 lb:transition-colors lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"lb:opacity-0 lb:group-hover:opacity-100 lb:transition-opacity lb:bg-black/60 lb:text-white lb:px-3 lb:py-1.5 lb:rounded-full lb:text-xs lb:font-medium lb:flex lb:items-center lb:gap-1.5",children:/* @__PURE__ */c(u,
|
|
145
|
+
/* @__PURE__ */s("img",{src:a,alt:`${i} - ${p}×${f}px`,loading:n?"eager":"lazy",onLoad:()=>{M(e=>e[v]?e:{...e,[v]:!0}),z(e=>e[v]?{...e,[v]:!1}:e)},onError:n?void 0:()=>{return t=e.id,void U(e=>/* @__PURE__ */new Set([...e,t]));var t},className:"lb:w-full lb:h-full lb:object-contain lb:p-3 lb:transition-all lb:duration-300 lb:group-hover:scale-105 "+(k?"lb:opacity-100":"lb:opacity-0")}),
|
|
146
|
+
/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-black/0 lb:group-hover:bg-black/10 lb:transition-colors lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"lb:opacity-0 lb:group-hover:opacity-100 lb:transition-opacity lb:bg-black/60 lb:text-white lb:px-3 lb:py-1.5 lb:rounded-full lb:text-xs lb:font-medium lb:flex lb:items-center lb:gap-1.5",children:/* @__PURE__ */c(u,I?{children:[
|
|
148
147
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Seleccionar"]}:{children:[
|
|
149
|
-
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})}),"Ampliar"]})})})]}),
|
|
148
|
+
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})}),"Ampliar"]})})})]}),n&&/* @__PURE__ */s("span",{className:"lb:absolute lb:top-3 lb:left-3 lb:bg-brand-blue-800 lb:text-white lb:text-xs lb:font-bold lb:px-3 lb:py-1.5 lb:rounded-lg lb:shadow-lg lb:z-20",children:"ORIGINAL"})]}),
|
|
150
149
|
/* @__PURE__ */c("div",{className:"lb:px-4 lb:py-3 lb:border-t lb:border-gray-100 lb:bg-white",children:[
|
|
151
150
|
/* @__PURE__ */s("h3",{className:"lb:text-sm lb:font-semibold lb:text-gray-900 lb:truncate lb:mb-2",title:i,children:i}),
|
|
152
151
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between",children:[
|
|
153
152
|
/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-gray-500 lb:font-medium",children:[p,"×",f," ·"," ",Math.round(g/1024),"KB"]}),
|
|
154
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:gap-2",role:"group","aria-label":`Acciones para ${i}`,children:[
|
|
155
|
-
/* @__PURE__ */s(He,{isOpen:!!E,src:E?.src||"",alt:E?.title||"Imagen",title:E?.title,subtitle:E?.subtitle,onClose:()=>$(null)})]})}const Ge="/api";let Qe={data:null,timestamp:0,pending:null};const Xe=/* @__PURE__ */new Set;function Ye(){Qe.data=null,Qe.timestamp=0,Qe.pending=null,Xe.forEach(e=>e())}async function Je(e={}){return Qe.data&&Date.now()-Qe.timestamp<3e5?Qe.data:(Qe.pending||(Qe.pending=async function(e={}){try{const t={include_counts:"true",...e},
|
|
153
|
+
/* @__PURE__ */c("div",{className:"lb:flex lb:gap-2",role:"group","aria-label":`Acciones para ${i}`,children:[n&&D&&/* @__PURE__ */s("button",{type:"button",className:"lb:w-8 lb:h-8 lb:rounded-lg lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:cursor-pointer lb:text-white lb:flex lb:items-center lb:justify-center lb:focus:outline-none lb:focus:ring-2 lb:focus:ring-brand-blue-400 lb:focus:ring-offset-1 lb:transition-colors lb:shadow-sm",onClick:e=>{e.stopPropagation(),m&&(x?.announce(`Abriendo herramienta de recorte para ${r.filename}`),m(r),o?.())},"aria-label":"Crear nuevo recorte",title:"Recortar",children:/* @__PURE__ */s("span",{className:"icon icon-scissors-white icon--sm"})}),O&&/* @__PURE__ */s("button",{type:"button",className:"lb:w-8 lb:h-8 lb:rounded-lg lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:cursor-pointer lb:text-white lb:flex lb:items-center lb:justify-center lb:focus:outline-none lb:focus:ring-2 lb:focus:ring-brand-blue-400 lb:focus:ring-offset-1 lb:transition-colors lb:shadow-sm",onClick:t=>{t.stopPropagation();(async(e,t,n)=>{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)}T(e),x?.announce(`URL de ${n} copiada al portapapeles`),setTimeout(()=>T(null),2e3)}catch(l){console.error("Error al copiar URL:",l),x?.announceError(`Error al copiar URL de ${n}. Inténtalo de nuevo.`)}})(n?"original":e.id,n?r.url||r.path:e.url,i)},"aria-label":_===(n?"original":e.id)?"¡Copiado!":`Copiar URL de ${i}`,title:_===(n?"original":e.id)?"¡Copiado!":"Copiar URL",children:/* @__PURE__ */s("span",{className:`icon ${_===(n?"original":e.id)?"icon-copied-white":"icon-copy-white"} icon--sm`})}),R&&/* @__PURE__ */s("button",{type:"button",className:"lb:w-8 lb:h-8 lb:rounded-lg lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:cursor-pointer lb:text-white lb:flex lb:items-center lb:justify-center lb:focus:outline-none lb:focus:ring-2 lb:focus:ring-brand-blue-400 lb:focus:ring-offset-1 lb:transition-colors lb:shadow-sm",onClick:t=>{t.stopPropagation(),n?(async()=>{const{downloadImage:e}=await Promise.resolve().then(()=>_l);await e(r.url||r.path,r.filename||"limbo-image",{originalFormat:r.format,accessibilityManager:x})})():(async e=>{const{downloadImage:t}=await Promise.resolve().then(()=>_l);await t(e.url,e.name||"limbo-variant",{originalFormat:e.format||e.output_format,accessibilityManager:x})})(e)},"aria-label":`Descargar ${i}`,title:"Descargar",children:/* @__PURE__ */s("span",{className:"icon icon-download-white icon--sm"})}),F&&(!n||b)&&/* @__PURE__ */s("button",{type:"button",className:"lb:w-8 lb:h-8 lb:rounded-lg lb:bg-red-1000 lb:hover:bg-red-800 lb:cursor-pointer lb:text-white lb:flex lb:items-center lb:justify-center lb:focus:outline-none lb:focus:ring-2 lb:focus:ring-red-800 lb:focus:ring-offset-1 lb:transition-colors lb:shadow-sm",onClick:t=>{t.stopPropagation(),n?(async()=>{if(!b)return;window.confirm(`¿Estás seguro de que deseas eliminar "${r.filename}"? Esta acción también eliminará todos sus recortes.`)&&(x?.announce(`Eliminando imagen ${r.filename}`),await b(r.id),o?.())})():(async e=>{if(window.confirm(`¿Estás seguro de que deseas eliminar el recorte "${e.name||e.filename}"?`)){K(!0),x?.announce(`Eliminando recorte ${e.name||e.filename}`);try{const t=await w(r.id,e.id);t.success?(q(t=>/* @__PURE__ */new Set([...t,e.id])),e.url&&Le(e.url),C("Recorte eliminado correctamente"),N("success"),x?.announce("Recorte eliminado correctamente"),h?.(),document.dispatchEvent(new CustomEvent("limbo:variantDeleted",{detail:{assetId:r?.id,variantId:e.id}})),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))}finally{K(!1)}}})(e)},"aria-label":`Eliminar ${i}`,title:"Eliminar",children:/* @__PURE__ */s("span",{className:"icon icon-delete-white icon--2sm"})}),I&&/* @__PURE__ */s("button",{type:"button",className:"lb:w-8 lb:h-8 lb:cursor-pointer lb:rounded-lg lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:text-white lb:flex lb:items-center lb:justify-center lb:focus:outline-none lb:focus:ring-2 lb:focus:ring-brand-blue-400 lb:focus:ring-offset-1 lb:transition-colors lb:shadow-sm",onClick:t=>{t.stopPropagation(),n?re():le(e)},"aria-label":`Ampliar ${i}`,title:"Ampliar",children:/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})})})]})]})]})]},n?"original":e.id)})})})]}),
|
|
154
|
+
/* @__PURE__ */s(He,{isOpen:!!E,src:E?.src||"",alt:E?.title||"Imagen",title:E?.title,subtitle:E?.subtitle,onClose:()=>$(null)})]})}const Ge="/api";let Qe={data:null,timestamp:0,pending:null};const Xe=/* @__PURE__ */new Set;function Ye(){Qe.data=null,Qe.timestamp=0,Qe.pending=null,Xe.forEach(e=>e())}async function Je(e={}){return Qe.data&&Date.now()-Qe.timestamp<3e5?Qe.data:(Qe.pending||(Qe.pending=async function(e={}){try{const t={include_counts:"true",...e},n=`/folders?${new URLSearchParams(t).toString()}`;return function(e){if(!e?.success||!e?.data)return{folders:[],total:0};const t=(e.data.folders||[]).map(e=>({id:e.id,name:e.name,slug:e.slug,description:e.description,visibility:e.visibility||"public",sort_order:e.sort_order||0,assets_count:e.assets_count||0,created_at:e.created_at,updated_at:e.updated_at}));return{folders:t,total:e.data.total||t.length}}(await J({endpoint:n,method:"GET",basePath:Ge,useJWT:!0}))}catch(t){throw ae(t)}}(e).then(e=>(Qe.data=e,Qe.timestamp=Date.now(),Qe.pending=null,e)).catch(e=>{throw Qe.pending=null,e})),Qe.pending)}function Ze(e={}){const{autoFetch:r=!0,visibility:i=null,allowedSlugs:o=null,excludeSlugs:s=null}=e,[c,u]=t([]),[d,b]=t(!1),[m,h]=t(null),[p,f]=t(!1),g=l(null),v=a(e=>{let t=[...e];return o&&o.length>0&&(t=t.filter(e=>o.includes(e.slug))),s&&s.length>0&&(t=t.filter(e=>!s.includes(e.slug))),t.sort((e,t)=>e.sort_order!==t.sort_order?e.sort_order-t.sort_order:e.name.localeCompare(t.name)),t},[o,s]),y=a(async(e={})=>{b(!0),h(null);try{const t={...i&&{visibility:i},...e},n=await Je(t),l=v(n.folders||[]);return u(l),l}catch(t){return h(t.message),[]}finally{b(!1)}},[i,v]),w=a(()=>(Ye(),y()),[y]),x=a(async e=>{f(!0),h(null);try{const t=await async function(e){try{return function(e){if(!e?.success||!e?.data)return{folder:null};const t=e.data;return{folder:{id:t.id,name:t.name,slug:t.slug,description:t.description,visibility:t.visibility||"public",sort_order:t.sort_order||0,assets_count:t.assets_count||0,created_at:t.created_at,updated_at:t.updated_at}}}(await J({endpoint:"/folders",method:"POST",body:{name:e.name,...e.slug&&{slug:e.slug},...e.description&&{description:e.description},...e.visibility&&{visibility:e.visibility}},basePath:Ge,useJWT:!0}))}catch(m){throw ae(m)}}(e),n=t.folder;return n&&(Ye(),u(e=>{const t=[...e,n];return t.sort((e,t)=>e.sort_order!==t.sort_order?e.sort_order-t.sort_order:e.name.localeCompare(t.name)),t})),n}catch(t){return h(t.message),null}finally{f(!1)}},[]),k=a(e=>c.find(t=>t.slug===e)||null,[c]),C=a(e=>c.find(t=>t.id===e)||null,[c]);return g.current=y,n(()=>{const e=()=>g.current?.();return Xe.add(e),()=>Xe.delete(e)},[]),n(()=>{r&&y()},[r,y]),{folders:c,loading:d,error:m,creating:p,fetchFolders:y,create:x,refresh:w,findBySlug:k,findById:C,hasLoaded:!d&&c.length>=0}}function et({value:e=null,onChange:n,allowCreate:l=!0,placeholder:r="Sin carpeta",label:a=null,disabled:o=!1,className:d="",showAssetCount:b=!1,includeNoFolder:m=!0,allowedSlugs:h=null,excludeSlugs:p=null,mode:f="upload"}){const g=i(),[v,y]=t(!1),[w,x]=t(""),[k,C]=t(null),{folders:S,loading:N,error:E,creating:$,create:_,refresh:T}=Ze({autoFetch:!0,allowedSlugs:h,excludeSlugs:p}),A=async e=>{if(e.preventDefault(),C(null),!w.trim())return void C("El nombre es requerido");const t=await _({name:w.trim()});t?(n?.(t),y(!1),x("")):C("Error al crear la carpeta")},z=()=>{y(!1),x(""),C(null)};if(v)/* @__PURE__ */
|
|
156
155
|
return c("div",{className:`limbo-folder-selector limbo-folder-selector--creating ${d}`,children:[a&&/* @__PURE__ */c("label",{className:"limbo-filter-label lb:block lb:mb-1 lb:text-white lb:ms-6",children:[a," ",$&&/* @__PURE__ */s("span",{className:"limbo-filter-searching","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:animate-spin lb:w-3 lb:h-3"})})]}),
|
|
157
156
|
/* @__PURE__ */c("form",{onSubmit:A,className:"lb:flex lb:gap-2 lb:items-center lb:flex-col",children:[
|
|
158
157
|
/* @__PURE__ */s("div",{children:/* @__PURE__ */s("input",{type:"text",value:w,onChange:e=>x(e.target.value),placeholder:"Nombre de la carpeta...",className:"limbo-filter-input lb:flex-1",autoFocus:!0,disabled:$})}),
|
|
@@ -160,50 +159,56 @@ return c("div",{className:`limbo-folder-selector limbo-folder-selector--creating
|
|
|
160
159
|
/* @__PURE__ */s("button",{type:"submit",disabled:$||!w.trim(),className:"limbo-btn limbo-btn--primary lb:px-3 lb:py-1.5 lb:text-sm lb:rounded lb:bg-brand-blue-1000 lb:text-white lb:border-0 lb:cursor-pointer disabled:lb:opacity-50 disabled:lb:cursor-not-allowed lb:hover:bg-brand-blue-800",children:$?"...":"Crear"}),
|
|
161
160
|
/* @__PURE__ */s("button",{type:"button",onClick:z,disabled:$,className:"limbo-btn limbo-btn--ghost lb:px-2 lb:py-1.5 lb:text-sm lb:rounded lb:hover:bg-gray-200 lb:bg-gray-300 lb:border lb:border-gray-300 lb:cursor-pointer",children:"Cancelar"})]})]}),k&&/* @__PURE__ */s("p",{className:"lb:text-red-600 lb:text-xs lb:mt-1",children:k})]});const L="filter"===f?"Todas las carpetas":r;/* @__PURE__ */
|
|
162
161
|
return c("div",{className:`limbo-folder-selector ${d}`,children:[a&&/* @__PURE__ */c("label",{htmlFor:g,className:"limbo-filter-label lb:block lb:mb-1 lb:text-white",children:[a,N&&/* @__PURE__ */s("span",{className:"limbo-filter-searching","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:animate-spin lb:w-3 lb:h-3"})})]}),
|
|
163
|
-
/* @__PURE__ */s("div",{className:"lb:relative",children:/* @__PURE__ */c("select",{id:g,value:e||"",onChange:e=>{const t=e.target.value;if("__create__"===t)return void y(!0);if(""===t||"__none__"===t)return void
|
|
162
|
+
/* @__PURE__ */s("div",{className:"lb:relative",children:/* @__PURE__ */c("select",{id:g,value:e||"",onChange:e=>{const t=e.target.value;if("__create__"===t)return void y(!0);if(""===t||"__none__"===t)return void n?.(null);const l=S.find(e=>e.slug===t);n?.(l||null)},disabled:o||N,className:"limbo-filter-input limbo-filter-select lb:w-full",children:[m&&/* @__PURE__ */s("option",{value:"",children:L}),N&&/* @__PURE__ */s("option",{value:"",disabled:!0,children:"Cargando carpetas..."}),E&&!N&&/* @__PURE__ */s("option",{value:"",disabled:!0,children:"Error al cargar carpetas"}),!N&&!E&&S.map(e=>/* @__PURE__ */c("option",{value:e.slug,children:[e.name,b&&` (${e.assets_count})`]},e.id)),l&&!N&&!E&&/* @__PURE__ */c(u,{children:[
|
|
164
163
|
/* @__PURE__ */s("option",{disabled:!0,children:"──────────────"}),
|
|
165
164
|
/* @__PURE__ */s("option",{value:"__create__",children:"+ Crear nueva carpeta..."})]})]})}),E&&/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2 lb:mt-1",children:[
|
|
166
165
|
/* @__PURE__ */s("p",{className:"lb:text-red-600 lb:text-xs",children:E}),
|
|
167
|
-
/* @__PURE__ */s("button",{type:"button",onClick:T,className:"lb:text-xs lb:text-brand-blue-1000 lb:underline lb:cursor-pointer",children:"Reintentar"})]})]})}
|
|
166
|
+
/* @__PURE__ */s("button",{type:"button",onClick:T,className:"lb:text-xs lb:text-brand-blue-1000 lb:underline lb:cursor-pointer",children:"Reintentar"})]})]})}function tt({isOpen:e,asset:r,onClose:a,onSave:i,folderConfig:o}){const[u,d]=t(null),[b,m]=t(!1),[h,p]=t(null),f=l(null);if(n(()=>{r&&d(r.folder?.slug||null)},[r]),he(f,{onClose:a,isActive:e}),!e||!r)return null;/* @__PURE__ */
|
|
167
|
+
return s("div",{className:"lb:fixed lb:inset-0 lb:bg-black/50 lb:flex lb:items-center lb:justify-center lb:z-[9999]",onClick:function(e){e.target===e.currentTarget&&a()},children:/* @__PURE__ */c("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"move-folder-modal-title",className:"lb:bg-white lb:rounded-lg lb:p-6 lb:max-w-md lb:w-full lb:mx-4 lb:shadow-xl",children:[
|
|
168
|
+
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:mb-5",children:[
|
|
169
|
+
/* @__PURE__ */s("h2",{id:"move-folder-modal-title",className:"lb:text-base lb:font-semibold lb:text-neutral-gray-900",children:"Mover de carpeta"}),
|
|
170
|
+
/* @__PURE__ */s("button",{type:"button","aria-label":k("editAssetModal.close"),onClick:a,className:"lb:text-neutral-gray-400 lb:hover:text-neutral-gray-700 lb:p-1 lb:rounded",children:"×"})]}),
|
|
171
|
+
/* @__PURE__ */s("div",{className:"lb:mb-4",children:/* @__PURE__ */s(et,{value:u,onChange:d,allowCreate:!1!==o?.allowCreateFolder,label:"Mover a carpeta",includeNoFolder:!0,allowedSlugs:o?.include?.length>0?o.include:null,excludeSlugs:o?.exclude?.length>0?o.exclude:null,disabled:b,mode:"upload"})}),h&&/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-red-800 lb:mt-3",children:h}),
|
|
172
|
+
/* @__PURE__ */c("div",{className:"lb:flex lb:justify-end lb:gap-2 lb:mt-6",children:[
|
|
173
|
+
/* @__PURE__ */s("button",{type:"button",onClick:a,disabled:b,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-semibold lb:text-neutral-gray-700 lb:border lb:border-neutral-gray-300 lb:rounded-md lb:hover:bg-neutral-gray-050 lb:transition-colors",children:k("editAssetModal.cancel")}),
|
|
174
|
+
/* @__PURE__ */s("button",{type:"button",onClick:async function(){m(!0),p(null);try{const e=u?{slug:u}:null;await i(r,e),a()}catch(e){p(e.message||k("editAssetModal.saveError"))}finally{m(!1)}},disabled:b,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-semibold lb:bg-brand-blue-800 lb:text-white lb:rounded-md lb:hover:bg-brand-blue-1000 lb:transition-colors"+(b?" lb:opacity-70 lb:cursor-not-allowed":""),children:k("editAssetModal.save")})]})]})})}const nt={pdf:{symbol:"icon-doc-pdf",color:"#dc2626"},doc:{symbol:"icon-doc-word",color:"#2563eb"},docx:{symbol:"icon-doc-word",color:"#2563eb"},xls:{symbol:"icon-doc-xls",color:"#16a34a"},xlsx:{symbol:"icon-doc-xls",color:"#16a34a"},ppt:{symbol:"icon-doc-ppt",color:"#ea580c"},pptx:{symbol:"icon-doc-ppt",color:"#ea580c"},txt:{symbol:"icon-doc-text",color:"#6b7280"},csv:{symbol:"icon-doc-report",color:"#16a34a"},mp4:{symbol:"icon-video",color:"#7c3aed"},webm:{symbol:"icon-video",color:"#7c3aed"},mov:{symbol:"icon-video",color:"#7c3aed"},avi:{symbol:"icon-video",color:"#7c3aed"},mkv:{symbol:"icon-video",color:"#7c3aed"},gif:{symbol:"icon-video",color:"#7a3f2d"},mp3:{symbol:"icon-support-person",color:"#0891b2"},mpeg:{symbol:"icon-support-person",color:"#0891b2"},wav:{symbol:"icon-support-person",color:"#0891b2"},ogg:{symbol:"icon-support-person",color:"#0891b2"},aac:{symbol:"icon-support-person",color:"#0891b2"},flac:{symbol:"icon-support-person",color:"#0891b2"},default:{symbol:"icon-clip",color:"#6b7280"}},lt=(e,t)=>0===t?e:lt(t,e%t),rt=/* @__PURE__ */new Set(["text/plain","text/csv","text/html","text/xml","text/css","text/javascript","text/markdown","application/json","application/xml","application/javascript"]);const at=e.memo(function({image:i,onDelete:o,onCrop:d,onSelect:b,onFolderChange:m,thumbnailSize:h=32,isDeleting:p=!1,showFolderInfo:f=!0,allowMoveFolder:g=!0,allowedFolderSlugs:v=null,excludedFolderSlugs:y=null,allowCreateFolder:w=!1,allowedActions:x={select:!0,download:!0,copy:!0,delete:!0,crop:!0,variants:!0,rename:!0},onEdit:C=null}){const[S,N]=t(!1),[E,$]=t(!1),[_,T]=t(!1),[A,z]=t(i.variants_count||0),[L,M]=t(!1),P=r(()=>(e=>{if(e.asset_type)return e.asset_type;const t=e.mime_type||e.original_mime||"";return"image/gif"===t?"video":t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.includes("pdf")||t.includes("document")||t.includes("spreadsheet")||t.includes("presentation")||t.includes("text/")?"document":"unknown"})(i),[i]),I="image"===P,R=(i.mime_type||i.original_mime||"").includes("image/gif"),O=I||R,F=r(()=>(e=>{if(!e)return"";const t=e.split(".");return t.length>1?t.pop().toLowerCase():""})(i.filename),[i.filename]),j=nt[F]||nt.default,U=r(()=>((e,t)=>{if(!e||!t||e<=0||t<=0)return null;const n=lt(Math.round(e),Math.round(t)),l=Math.round(e)/n,r=Math.round(t)/n;return l>20||r>20?null:`${l}:${r}`})(i.width,i.height),[i.width,i.height]),B=i.url||i.path,q=O&&i.thumbnail_url?i.thumbnail_url:B,[W,V]=t(()=>Te(q)),[H,K]=t(()=>!Ae(q)),[G,Q]=t(!1),[X,Y]=t(()=>Ae(q)),J=l(null),{isMobile:Z,isTouch:ee}=D(),te=window.limboCore?.accessibilityManager,ne=(window.limboCore?.config?.getGlobal()||{}).interaction||{allowSelection:!1,allowCropping:!0},le=async e=>{e.stopPropagation();let t=i.url||i.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)}N(!0),te?.announce(`URL de ${i.filename} copiada al portapapeles. Nota: La URL puede tener un tiempo de validez limitado.`),setTimeout(()=>N(!1),2e3)}catch(n){console.error("Error al copiar URL:",n),te?.announce(`Error al copiar URL de ${i.filename}. Inténtalo de nuevo.`),alert(`Error al copiar URL de ${i.filename}. Por favor, inténtalo de nuevo.`)}},re=async e=>{e.preventDefault(),e.stopPropagation();const t=i.url||i.path,n=i.filename||"limbo-file";if(!I){try{te?.announce(`Descargando ${n}`);const e=await fetch(t,{mode:"cors"});if(!e.ok)throw new Error(`HTTP error: ${e.status}`);const l=await e.blob(),r=window.URL.createObjectURL(l),a=document.createElement("a");a.href=r,a.download=n,a.style.display="none",document.body.appendChild(a),a.click(),setTimeout(()=>{window.URL.revokeObjectURL(r),document.body.removeChild(a)},100),te?.announce(`${n} descargado correctamente`)}catch(r){console.error("Error downloading file:",r),te?.announce(`Error al descargar ${n}`)}return}const{downloadImage:l}=await Promise.resolve().then(()=>_l);await l(t,n,{originalFormat:i.format,accessibilityManager:te})},ae=e=>{e.stopPropagation(),te?.announce(`Editando imagen ${i.filename}`),d?.(i)},ie=a(e=>{e.stopPropagation(),o?.(i.id)},[i.id,o]),oe=I&&(i.variants&&i.variants.length>0||i.variants_count>0||A>0),se=A,ce=e.useCallback(()=>{z(e=>Math.max(0,e-1))},[]);e.useEffect(()=>{z(i.variants_count||0)},[i.variants_count]),n(()=>{if(!O)return K(!1),void Y(!0);if(i.thumbnail_url){if(Ae(i.thumbnail_url)){const e=Te(i.thumbnail_url);return V(e),K(!1),Q(!1),void Y(!0)}return V(i.thumbnail_url),K(!0),Q(!1),void Y(!1)}const e=i.url||i.path;if(Ae(e))return V(Te(e)),K(!1),Q(!1),void Y(!0);K(!0),Q(!1),Y(!1),_e(e).then(e=>{V(e),K(!1),Y(!0)}).catch(()=>{V(e),K(!1),Q(!0)})},[i.url,i.path,i.thumbnail_url,O]),n(()=>{if(!O||!H)return;const e=J.current;e&&e.complete&&e.naturalWidth>0&&(K(!1),Y(!0),Q(!1))},[O,H,W]);const ue=ne.allowSelection&&x.select&&b,de=R?B:null,be=I&&!R&&ne.allowCropping&&x.crop&&d,me=()=>{oe?(te?.announce(`Mostrando recortes de ${i.filename}`),$(!0)):ue?(te?.announce(`Seleccionando ${i.filename} para el portal`),b?.(i)):(te?.announce(`Abriendo visor de ${i.filename}`),T(!0))};/* @__PURE__ */
|
|
168
175
|
return c(u,{children:[
|
|
169
|
-
/* @__PURE__ */c("div",{className:`limbo-image-card-wrapper lb:relative lb:cursor-pointer lb:focus:outline-0 ${p?"lb:opacity-50":""} ${
|
|
170
|
-
/* @__PURE__ */s("span",{className:"icon icon-
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */c("div",{className
|
|
173
|
-
/* @__PURE__ */c("div",{className:"limbo-image-actions__buttons",children:[(be||!F)&&/* @__PURE__ */s("button",{type:"button",title:ce?`Ver ${ue} recortes`:F?"Ampliar imagen":"Previsualizar archivo","aria-label":ce?k("imageCard.aria.zoomWithCrops",{n:ue,filename:i.filename}):k(F?"imageCard.aria.zoom":"imageCard.aria.zoomPreview",{filename:i.filename}),className:"limbo-action-btn lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(te?"lb:btn--touch":""),onClick:e=>{e?.stopPropagation(),ne?.announce(`Abriendo visor de ${i.filename}`),T(!0)},tabIndex:0,children:/* @__PURE__ */s("span",{className:`icon ${F?"icon-zoom-in-white":"icon-search-white"} icon--sm`,"aria-hidden":"true"})}),he&&/* @__PURE__ */s("button",{type:"button",title:"Nuevo recorte","aria-label":k("imageCard.aria.crop",{filename:i.filename}),className:"limbo-action-btn limbo-btn-crop lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(te?"lb:btn--touch":""),onClick:oe,tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-scissors-white icon--sm","aria-hidden":"true"})}),x.copy&&/* @__PURE__ */s("button",{type:"button",title:S?"¡Copiado!":"Copiar URL","aria-label":S?k("imageCard.aria.copied"):k("imageCard.aria.copyUrl",{filename:i.filename}),className:"limbo-action-btn limbo-btn-copy lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(te?"lb:btn--touch":""),onClick:ae,tabIndex:0,children:/* @__PURE__ */s("span",{className:`icon ${S?"icon-copied-white":"icon-copy-white"} icon--sm`,"aria-hidden":"true"})}),x.download&&/* @__PURE__ */s("button",{type:"button",title:"Descargar","aria-label":k("imageCard.aria.download",{filename:i.filename}),className:"limbo-action-btn limbo-btn-download lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(te?"lb:btn--touch":""),onClick:ie,tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-download-white icon--sm","aria-hidden":"true"})}),g&&m&&/* @__PURE__ */s("button",{type:"button",title:i.folder?`Mover de carpeta (${i.folder?.name||i.folder?.slug||""})`:"Asignar a carpeta",className:`limbo-action-btn limbo-btn-folder lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 ${te?"lb:btn--touch":""} ${L?"limbo-action-btn--active":""}`,onClick:e=>{e.stopPropagation();const t=!L;I(t),t&&document.dispatchEvent(new CustomEvent("limbo:folder-dropdown-open",{detail:{id:i.id}}))},"aria-expanded":L,"aria-label":L?"Cerrar selector de carpeta":i.folder?`Mover de carpeta (${i.folder?.name||i.folder?.slug||""})`:"Asignar a carpeta",tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-folder-white icon--sm","aria-hidden":"true"})}),x.rename&&C&&/* @__PURE__ */s("button",{type:"button",title:"Editar archivo","aria-label":k("imageCard.aria.rename",{filename:i.filename}),className:"limbo-action-btn limbo-btn-rename lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(te?"lb:btn--touch":""),onClick:e=>{e.stopPropagation(),C(i)},tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-edit-white icon--sm","aria-hidden":"true"})}),x.delete&&o&&/* @__PURE__ */s("button",{onClick:se,disabled:p,className:"limbo-action-btn limbo-btn-delete lb:bg-red-800 lb:hover:bg-red-700 lb:border lb:border-red-700 "+(te?"lb:btn--touch lb:active:lb:bg-red-800":""),title:"Eliminar archivo","aria-label":k("imageCard.aria.delete",{filename:i.filename}),tabIndex:0,children:p?"…":/* @__PURE__ */s("span",{className:"icon icon-delete-white icon--1sm","aria-hidden":"true"})})]}),L&&g&&m&&/* @__PURE__ */s("div",{className:"limbo-image-actions__folder",onClick:e=>e.stopPropagation(),children:/* @__PURE__ */s(et,{value:i.folder?.slug||null,onChange:async e=>{if(!M){P(!0);try{await(m?.(i,e??null)),Ye(),ne?.announce(e?`${i.filename} movido a carpeta ${e.name}`:`${i.filename} movido a Sin carpeta`)}catch(t){console.error("Error moving to folder:",t),ne?.announce(`Error al mover ${i.filename}`)}finally{P(!1),I(!1)}}},allowCreate:w,placeholder:"Sin carpeta",label:"Mover a carpeta",includeNoFolder:!0,allowedSlugs:v,excludeSlugs:y,disabled:M,mode:"upload"})})]}),
|
|
174
|
-
/* @__PURE__ */c("div",{className:"limbo-image-card "+(te?"limbo-image-card--mobile":""),children:[!F&&(i.thumbnail_url?
|
|
175
|
-
/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:h-full lb:rounded lb:overflow-hidden lb:border lb:border-neutral-300",style:{...te&&{minHeight:`${Math.max(3*h,80)}px`}},children:[
|
|
176
|
+
/* @__PURE__ */c("div",{className:`limbo-image-card-wrapper lb:relative lb:cursor-pointer lb:focus:outline-0 ${p?"lb:opacity-50":""} ${Z?"limbo-image-card-wrapper--mobile":""}`,onClick:me,onKeyDown:e=>{if("INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName)switch(e.key){case"Enter":case" ":e.preventDefault(),me();break;case"d":case"D":x.download&&(e.preventDefault(),re(e));break;case"c":case"C":x.copy&&(e.preventDefault(),le(e));break;case"Delete":case"Backspace":x.delete&&o&&(e.preventDefault(),ie(e));break;case"x":case"X":x.crop&&d&&(e.preventDefault(),ae(e));break;case"v":case"V":x.variants&&(e.preventDefault(),(e=>{e.stopPropagation(),te?.announce(`Mostrando recortes de ${i.filename}`),$(!0)})(e))}},onMouseEnter:de?()=>{de&&i.thumbnail_url&&V(de)}:void 0,onMouseLeave:de?()=>{de&&i.thumbnail_url&&V(i.thumbnail_url)}:void 0,title:oe?`Ver ${se} recorte${1!==se?"s":""} de ${i.filename}`:O?Z?"Toque para ampliar imagen":"Click para ampliar imagen con zoom":Z?"Toque para previsualizar":"Click para previsualizar",role:"button",tabIndex:0,"aria-label":O?`${R?"GIF":"Imagen"} ${i.filename}. ${i.width}x${i.height} px`:`Archivo ${i.filename}. Tipo: ${P}`,style:{...ee&&{touchAction:"manipulation",WebkitTapHighlightColor:"transparent"}},children:[
|
|
177
|
+
/* @__PURE__ */s("div",{className:"limbo-image-actions "+(Z?"limbo-image-actions--mobile":""),children:/* @__PURE__ */c("div",{className:"limbo-image-actions__buttons",children:[(ue||!O)&&/* @__PURE__ */s("button",{type:"button",title:oe?`Ver ${se} recortes`:O?"Ampliar imagen":"Previsualizar archivo","aria-label":oe?k("imageCard.aria.zoomWithCrops",{n:se,filename:i.filename}):k(O?"imageCard.aria.zoom":"imageCard.aria.zoomPreview",{filename:i.filename}),className:"limbo-action-btn lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(Z?"lb:btn--touch":""),onClick:e=>{e?.stopPropagation(),te?.announce(`Abriendo visor de ${i.filename}`),T(!0)},tabIndex:0,children:/* @__PURE__ */s("span",{className:`icon ${O?"icon-zoom-in-white":"icon-search-white"} icon--sm`,"aria-hidden":"true"})}),be&&/* @__PURE__ */s("button",{type:"button",title:"Nuevo recorte","aria-label":k("imageCard.aria.crop",{filename:i.filename}),className:"limbo-action-btn limbo-btn-crop lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(Z?"lb:btn--touch":""),onClick:ae,tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-scissors-white icon--sm","aria-hidden":"true"})}),x.copy&&/* @__PURE__ */s("button",{type:"button",title:S?"¡Copiado!":"Copiar URL","aria-label":S?k("imageCard.aria.copied"):k("imageCard.aria.copyUrl",{filename:i.filename}),className:"limbo-action-btn limbo-btn-copy lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(Z?"lb:btn--touch":""),onClick:le,tabIndex:0,children:/* @__PURE__ */s("span",{className:`icon ${S?"icon-copied-white":"icon-copy-white"} icon--sm`,"aria-hidden":"true"})}),x.download&&/* @__PURE__ */s("button",{type:"button",title:"Descargar","aria-label":k("imageCard.aria.download",{filename:i.filename}),className:"limbo-action-btn limbo-btn-download lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(Z?"lb:btn--touch":""),onClick:re,tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-download-white icon--sm","aria-hidden":"true"})}),g&&m&&/* @__PURE__ */s("button",{type:"button",title:i.folder?`Mover de carpeta (${i.folder?.name||i.folder?.slug||""})`:"Asignar a carpeta",className:"limbo-action-btn limbo-btn-folder lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(Z?"lb:btn--touch":""),onClick:e=>{e.stopPropagation(),M(!0)},"aria-label":i.folder?`Mover de carpeta (${i.folder?.name||i.folder?.slug||""})`:"Asignar a carpeta",tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-folder-white icon--sm","aria-hidden":"true"})}),x.rename&&C&&/* @__PURE__ */s("button",{type:"button",title:"Editar archivo","aria-label":k("imageCard.aria.rename",{filename:i.filename}),className:"limbo-action-btn limbo-btn-rename lb:bg-brand-blue-400 lb:hover:bg-brand-blue-800 lb:border lb:border-brand-blue-1000 "+(Z?"lb:btn--touch":""),onClick:e=>{e.stopPropagation(),C(i)},tabIndex:0,children:/* @__PURE__ */s("span",{className:"icon icon-edit-white icon--sm","aria-hidden":"true"})}),x.delete&&o&&/* @__PURE__ */s("button",{onClick:ie,disabled:p,className:"limbo-action-btn limbo-btn-delete lb:bg-red-800 lb:hover:bg-red-700 lb:border lb:border-red-700 "+(Z?"lb:btn--touch lb:active:lb:bg-red-800":""),title:"Eliminar archivo","aria-label":k("imageCard.aria.delete",{filename:i.filename}),tabIndex:0,children:p?"…":/* @__PURE__ */s("span",{className:"icon icon-delete-white icon--1sm","aria-hidden":"true"})})]})}),
|
|
178
|
+
/* @__PURE__ */c("div",{className:"limbo-image-card "+(Z?"limbo-image-card--mobile":""),children:[!O&&(i.thumbnail_url?
|
|
179
|
+
/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:h-full lb:rounded lb:overflow-hidden lb:border lb:border-neutral-300",style:{...Z&&{minHeight:`${Math.max(3*h,80)}px`}},children:[
|
|
176
180
|
/* @__PURE__ */s("img",{src:i.thumbnail_url,alt:i.name||i.filename,className:"lb:w-full lb:h-full lb:object-cover lb:aspect-square",loading:"lazy",decoding:"async",draggable:!1,onError:e=>{e.target.style.display="none",e.target.nextElementSibling?.classList.remove("lb:hidden")}}),
|
|
177
|
-
/* @__PURE__ */s("div",{className:(i.thumbnail_url?"lb:flex":"lb:hidden")+"lb:absolute lb:inset-0 lb:bg-linear-to-br lb:from-neutral-100 lb:to-neutral-200 lb:flex-col lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"lb:mb-2 lb:h-[25%] lb:w-[25%]","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:`icon ${
|
|
178
|
-
/* @__PURE__ */s("span",{className:"lb:absolute lb:bottom-1.5 lb:right-1.5 lb:text-[10px] lb:uppercase lb:font-bold lb:tracking-wide lb:px-1.5 lb:py-0.5 lb:rounded lb:shadow-sm",style:{backgroundColor:
|
|
179
|
-
/* @__PURE__ */c("div",{className:"lb:w-full lb:h-full lb:rounded lb:bg-linear-to-br lb:from-neutral-100 lb:to-neutral-200 lb:flex lb:flex-col lb:items-center lb:justify-center lb:border lb:border-neutral-300",style:{...
|
|
180
|
-
/* @__PURE__ */s("span",{className:"lb:mb-2 lb:h-[25%] lb:w-[25%]","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:`icon ${
|
|
181
|
-
/* @__PURE__ */s("span",{className:"lb:text-xs lb:uppercase lb:font-bold lb:tracking-wide lb:px-2 lb:py-0.5 lb:rounded",style:{backgroundColor:
|
|
181
|
+
/* @__PURE__ */s("div",{className:(i.thumbnail_url?"lb:flex":"lb:hidden")+"lb:absolute lb:inset-0 lb:bg-linear-to-br lb:from-neutral-100 lb:to-neutral-200 lb:flex-col lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"lb:mb-2 lb:h-[25%] lb:w-[25%]","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:`icon ${j.symbol} lb:min-w-full lb:min-h-full`})})}),
|
|
182
|
+
/* @__PURE__ */s("span",{className:"lb:absolute lb:bottom-1.5 lb:right-1.5 lb:text-[10px] lb:uppercase lb:font-bold lb:tracking-wide lb:px-1.5 lb:py-0.5 lb:rounded lb:shadow-sm",style:{backgroundColor:j.color,color:"white"},children:F||P})]}):
|
|
183
|
+
/* @__PURE__ */c("div",{className:"lb:w-full lb:h-full lb:rounded lb:bg-linear-to-br lb:from-neutral-100 lb:to-neutral-200 lb:flex lb:flex-col lb:items-center lb:justify-center lb:border lb:border-neutral-300",style:{...Z&&{minHeight:`${Math.max(3*h,80)}px`}},children:[
|
|
184
|
+
/* @__PURE__ */s("span",{className:"lb:mb-2 lb:h-[25%] lb:w-[25%]","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:`icon ${j.symbol} lb:min-w-full lb:min-h-full`})}),
|
|
185
|
+
/* @__PURE__ */s("span",{className:"lb:text-xs lb:uppercase lb:font-bold lb:tracking-wide lb:px-2 lb:py-0.5 lb:rounded",style:{backgroundColor:j.color,color:"white"},children:F||P})]})),O&&/* @__PURE__ */c(u,{children:[H&&!G&&/* @__PURE__ */s("div",{className:"lb:w-full lb:aspect-square lb:rounded lb:bg-neutral-200 lb:animate-pulse lb:flex lb:items-center lb:justify-center lb:absolute lb:inset-0 lb:z-10 "+(oe?"lb:ring-2 lb:ring-brand-blue-400 lb:ring-offset-2":""),style:{...Z&&{minHeight:`${Math.max(3*h,80)}px`}},children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:w-8 lb:h-8 lb:animate-spin"})}),G&&!X&&/* @__PURE__ */c("div",{className:"lb:z-0 lb:absolute lb:top-0 lb:left-0 lb:w-full lb:aspect-square lb:rounded lb:bg-neutral-100 lb:flex lb:flex-col lb:items-center lb:justify-center lb:text-neutral-400",style:{...Z&&{minHeight:`${Math.max(3*h,80)}px`}},children:[
|
|
182
186
|
/* @__PURE__ */s("span",{className:"icon icon-close icon--lg lb:mb-1","aria-hidden":"true"}),
|
|
183
187
|
/* @__PURE__ */s("span",{className:"lb:text-xs",children:"Error al cargar"})]}),
|
|
184
|
-
/* @__PURE__ */s("img",{ref:
|
|
185
|
-
/* @__PURE__ */c("span",{children:[i.width,"×",i.height]}),
|
|
186
|
-
/* @__PURE__ */c("div",{className:"limbo-card-info-overlay lb:z-9 "+(
|
|
187
|
-
/* @__PURE__ */c("span",{className:"limbo-card-info-name lb:truncate lb:max-w-full",children:[i.filename.split(".")[0]??i.filename,
|
|
188
|
+
/* @__PURE__ */s("img",{ref:J,src:W,loading:"lazy",decoding:"async",alt:i.name||(i.filename.split(".")[0]??i.filename),className:`lb:z-1 lb:w-full lb:object-cover lb:rounded lb:aspect-square lb:transition-opacity lb:duration-300 ${oe?"lb:ring-2 lb:ring-brand-blue-400 lb:ring-offset-2":""} ${X?"lb:opacity-100":"lb:opacity-0"}`,sizes:`height: ${6*h}px,width: ${6*h}px`,draggable:!1,onLoad:()=>{K(!1),Y(!0),Q(!1)},onError:()=>{K(!1),Q(!0)},style:{...Z&&{minHeight:`${Math.max(3*h,80)}px`,height:"auto",aspectRatio:"1 / 1",objectFit:"cover"}}}),R&&/* @__PURE__ */s("span",{className:"lb:absolute lb:bottom-1.5 lb:right-1.5 lb:text-[10px] lb:uppercase lb:font-bold lb:tracking-wide lb:px-1.5 lb:py-0.5 lb:rounded lb:shadow-sm",style:{backgroundColor:j.color,color:"white"},children:F||P}),I&&!oe&&i.width&&i.height&&/* @__PURE__ */c("span",{className:"lb:absolute lb:bottom-1.5 lb:right-1.5 lb:text-[10px] lb:font-bold lb:tracking-wide lb:px-1.5 lb:py-0.5 lb:rounded lb:shadow-sm lb:leading-tight lb:text-center lb:flex lb:flex-col lb:items-center",style:{backgroundColor:"rgba(15,23,42,0.72)",color:"white"},title:`${i.width} × ${i.height} px`,children:[
|
|
189
|
+
/* @__PURE__ */c("span",{children:[i.width,"×",i.height]}),U&&/* @__PURE__ */s("span",{style:{opacity:.85},children:U})]})]}),
|
|
190
|
+
/* @__PURE__ */c("div",{className:"limbo-card-info-overlay lb:z-9 "+(Z?"limbo-card-info-overlay--mobile":""),children:[
|
|
191
|
+
/* @__PURE__ */c("span",{className:"limbo-card-info-name lb:truncate lb:max-w-full",children:[i.filename.split(".")[0]??i.filename,oe&&/* @__PURE__ */s("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:`${se} recorte${1!==se?"s":""}`,children:se})]}),f&&i.folder&&/* @__PURE__ */c("span",{className:"limbo-card-info-folder lb:flex lb:items-center lb:gap-1 lb:bg-brand-blue-50 lb:rounded-md lb:px-1",title:`Carpeta: ${i.folder?.name||i.folder?.slug||i.folder}`,children:[
|
|
188
192
|
/* @__PURE__ */s("span",{className:"icon icon-folder icon--sm"}),
|
|
189
193
|
/* @__PURE__ */s("span",{className:"lb:truncate lb:max-w-20",children:i.folder?.name||i.folder?.slug||("string"==typeof i.folder?i.folder:"Sin carpeta")})]})]})]})]}),
|
|
190
|
-
/* @__PURE__ */s(Ke,{image:i,isOpen:E,onClose:()=>$(!1),onSelect:b,onDelete:o,onCrop:d,onVariantDeleted:
|
|
194
|
+
/* @__PURE__ */s(Ke,{image:i,isOpen:E,onClose:()=>$(!1),onSelect:b,onDelete:o,onCrop:d,onVariantDeleted:ce,allowedActions:{select:x.select,download:x.download,copy:x.copy,delete:x.delete,crop:x.crop}}),
|
|
195
|
+
/* @__PURE__ */s(tt,{isOpen:L,asset:i,onClose:()=>M(!1),onSave:async(e,t)=>{try{await(m?.(e,t??null)),Ye(),te?.announce(t?`${e.filename} movido a carpeta ${t.name}`:`${e.filename} movido a Sin carpeta`)}catch(n){throw console.error("Error moving to folder:",n),te?.announce(`Error al mover ${e.filename}`),n}},folderConfig:void 0!==w||v||y?{allowCreateFolder:w,include:v,exclude:y}:null}),_&&(()=>{const e=i.url||i.path,t=()=>T(!1),n=i.file_size?`${Math.round(i.file_size/1024)}KB`:"",l=i.mime_type||"";return O?/* @__PURE__ */s(He,{isOpen:!0,src:e,alt:i.name||i.filename,title:i.filename,subtitle:`${i.width||"?"}×${i.height||"?"} · ${n}`,onClose:t,tags:i.tags||[]}):"video"===P?/* @__PURE__ */s(Ie,{isOpen:!0,src:e,title:i.filename,subtitle:`${F.toUpperCase()} · ${n}`,onClose:t}):"audio"===P?/* @__PURE__ */s(De,{isOpen:!0,src:e,title:i.filename,subtitle:`${F.toUpperCase()} · ${n}`,onClose:t}):l.includes("pdf")?/* @__PURE__ */s(Re,{isOpen:!0,src:e,title:i.filename,subtitle:n,onClose:t}):(e=>!(!e||!rt.has(e)&&!e.startsWith("text/")))(l)?/* @__PURE__ */s(Ve,{isOpen:!0,src:e,title:i.filename,subtitle:`${F.toUpperCase()} · ${n}`,mimeType:l,fileSize:i.file_size||0,onClose:t}):/* @__PURE__ */s(qe,{isOpen:!0,src:e,title:i.filename,subtitle:`${F.toUpperCase()} · ${n}`,mimeType:l,fileSize:i.file_size||0,onClose:t})})()]})});function it(){/* @__PURE__ */
|
|
191
196
|
return c("div",{className:"limbo-image-card lb:animate-pulse",role:"status","aria-label":"Cargando imágen...",children:[
|
|
192
197
|
/* @__PURE__ */s("div",{className:"lb:w-full lb:aspect-square lb:bg-neutral-gray-200 lb:rounded-md lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"icon icon-spinner"})}),
|
|
193
198
|
/* @__PURE__ */s("div",{className:"limbo-image-card-name lb:opacity-100 position-relative lb:bottom-0 lb:p-2",children:/* @__PURE__ */s("div",{className:"lb:h-4 lb:bg-neutral-gray-200 lb:rounded lb:w-3/4"})}),
|
|
194
|
-
/* @__PURE__ */s("span",{className:"sr-only",children:"Cargando imágen..."})]})}const
|
|
199
|
+
/* @__PURE__ */s("span",{className:"sr-only",children:"Cargando imágen..."})]})}const ot=[{value:"",label:"Todos los tipos"},{value:"image",label:"Imágenes"},{value:"video",label:"Videos"},{value:"document",label:"Documentos"},{value:"audio",label:"Audio"}];function st({onSelect:e,onCrop:a,onDelete:i,deletingId:o,images:u,loading:m,error:h,filters:p={name:"",dateFrom:"",dateTo:"",uploadedBy:"",assetType:"",folder:""},debouncedFilters:f=null,onFiltersChange:g,filterConfig:v={showNameFilter:!0,showUploadedByFilter:!1,showDateFilter:!0,showTypeFilter:!1},loadingConfig:y={showPlaceholders:!0,placeholderCount:10,showSpinner:!0},allowedActions:w={select:!0,download:!0,copy:!0,delete:!0,crop:!0,variants:!0},allowedCategories:x=null,resolvedAccept:C=null,folderConfig:S=null,onFolderChange:N=null,onRename:E=null,onEdit:$=null}){const{isSearching:_,searchPending:T}=function(e,r,a){const[i,o]=t(!1),s=l(null);return n(()=>(Object.keys(e).some(t=>e[t]!==r[t])?s.current=setTimeout(()=>{o(!0)},150):(s.current&&clearTimeout(s.current),o(!1)),()=>{s.current&&clearTimeout(s.current)}),[e,r]),{isSearching:i||a,searchPending:i}}(p,f||p,m),A=!1!==v.showNameFilter,z=!0===v.showUploadedByFilter,L=!1!==v.showDateFilter,M=!1!==v.showTypeFilter,P=!0===S?.showFolderFilter,I=S?.include?.length>0?S.include:null,D=S?.exclude?.length>0?S.exclude:null,R=!1!==S?.showFolderInfo,O=!1!==S?.allowMoveFolder&&!!N,F=!0===S?.allowCreateFolder,j=r(()=>{const e=C&&!C.isAllTypes?function(e){if(!e||e.isAllTypes)return null;const t=new Set(e.categories);for(const n of e.extensions){const e=d[n]||[];for(const n of e)for(const[e,l]of Object.entries(b))l.includes(n)&&t.add(e)}for(const n of e.mimeTypes)for(const[e,l]of Object.entries(b))(l.includes(n)||n.startsWith(e+"/"))&&t.add(e);return t.size>0?[...t]:null}(C):x;return e?ot.filter(t=>""===t.value||e.includes(t.value)):ot},[C,x]),U=l(null),B=window.limboCore?.accessibilityManager;n(()=>{if(U.current&&window.limboCore?.keyboardManager){const e="gallery-grid";U.current.setAttribute("data-grid-id",e),window.limboCore.keyboardManager.setupGridNavigation(U.current,{itemSelector:".limbo-image-card",gridId:e,columns:"auto"})}},[u]),n(()=>{if(!m&&u.length>0){const e=u.slice(0,12).map(e=>e.url||e.path).filter(Boolean);e.length>0&&ze(e,4)}},[m,u]);const q=r(()=>{if(!p.assetType)return"archivos";return{image:"imágenes",video:"videos",document:"documentos",audio:"archivos de audio"}[p.assetType]||"archivos"},[p.assetType]);n(()=>{m?B?.announceLoading(!0,"galería"):m||h?h&&B?.announceError(h,"galería"):(B?.announceLoading(!1,"galería"),u.length>0&&B?.announce(`Se encontraron ${u.length} ${q} en la galería`))},[m,h,u.length,B,q]),n(()=>{T&&B?.announce("Buscando...","polite")},[T,B]);const W=e=>{const{name:t,value:n}=e.target;g&&g({...p,[t]:n})},V=p.name||p.dateFrom||p.dateTo||p.uploadedBy||p.assetType||p.folder,H=_&&u.length>0&&!m;/* @__PURE__ */
|
|
195
200
|
return c("div",{className:"lb:w-full lb:max-w-full lb:py-2 lb:overflow-x-hidden lb:box-border",children:[
|
|
196
201
|
/* @__PURE__ */s("div",{className:"lb:px-2 lb:mb-3 lb:mx-2 lb:max-w-full lb:overflow-x-hidden lb:box-border",children:/* @__PURE__ */c("form",{className:"limbo-filters flex items-stretch content-stretch flex-row",onSubmit:e=>e.preventDefault(),role:"search","aria-label":"Filtrar archivos",children:[A&&/* @__PURE__ */c("div",{className:"limbo-filter-group limbo-filter-group--name",children:[
|
|
197
|
-
/* @__PURE__ */c("label",{htmlFor:"name",className:"limbo-filter-label",children:["
|
|
202
|
+
/* @__PURE__ */c("label",{htmlFor:"name",className:"limbo-filter-label",children:["Buscar",T&&/* @__PURE__ */s("span",{className:"limbo-filter-searching","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:animate-spin lb:w-3 lb:h-3"})})]}),
|
|
198
203
|
/* @__PURE__ */s("input",{type:"text",name:"name",id:"name",placeholder:k("tags.search.placeholder"),value:p.name,onChange:W,className:"limbo-filter-input",autoComplete:"off"})]}),L&&/* @__PURE__ */c("div",{className:"limbo-filter-dates lb:flex-row lb:md:flex ",children:[
|
|
199
204
|
/* @__PURE__ */c("div",{className:"limbo-filter-group limbo-filter-group--date",children:[
|
|
200
205
|
/* @__PURE__ */s("label",{htmlFor:"dateFrom",className:"limbo-filter-label",children:"Desde"}),
|
|
201
206
|
/* @__PURE__ */s("input",{type:"date",name:"dateFrom",id:"dateFrom",value:p.dateFrom,onChange:W,className:"limbo-filter-input"})]}),
|
|
202
207
|
/* @__PURE__ */c("div",{className:"limbo-filter-group limbo-filter-group--date",children:[
|
|
203
208
|
/* @__PURE__ */s("label",{htmlFor:"dateTo",className:"limbo-filter-label",children:"Hasta"}),
|
|
204
|
-
/* @__PURE__ */s("input",{type:"date",name:"dateTo",id:"dateTo",value:p.dateTo,onChange:W,className:"limbo-filter-input"})]})]}),
|
|
209
|
+
/* @__PURE__ */s("input",{type:"date",name:"dateTo",id:"dateTo",value:p.dateTo,onChange:W,className:"limbo-filter-input"})]})]}),M&&j.length>1&&/* @__PURE__ */c("div",{className:"limbo-filter-group limbo-filter-group--type",children:[
|
|
205
210
|
/* @__PURE__ */s("label",{htmlFor:"assetType",className:"limbo-filter-label",children:"Tipo"}),
|
|
206
|
-
/* @__PURE__ */s("select",{name:"assetType",id:"assetType",value:p.assetType||"",onChange:W,className:"limbo-filter-input limbo-filter-select",children:
|
|
211
|
+
/* @__PURE__ */s("select",{name:"assetType",id:"assetType",value:p.assetType||"",onChange:W,className:"limbo-filter-input limbo-filter-select",children:j.map(e=>/* @__PURE__ */s("option",{value:e.value,children:e.label},e.value))})]}),P&&/* @__PURE__ */s("div",{className:"limbo-filter-group limbo-filter-group--folder",children:/* @__PURE__ */s(et,{value:p.folder||"",onChange:e=>W({target:{name:"folder",value:e?.slug||""}}),allowCreate:!1,label:"Carpeta",showAssetCount:!0,includeNoFolder:!0,allowedSlugs:I,excludeSlugs:D,mode:"filter"})}),z&&/* @__PURE__ */c("div",{className:"limbo-filter-group",children:[
|
|
207
212
|
/* @__PURE__ */s("label",{htmlFor:"uploadedBy",className:"limbo-filter-label",children:"Subido por"}),
|
|
208
213
|
/* @__PURE__ */s("input",{type:"text",name:"uploadedBy",id:"uploadedBy",placeholder:"Usuario...",value:p.uploadedBy,onChange:W,className:"limbo-filter-input",style:{minWidth:"100px",maxWidth:"140px"}})]}),
|
|
209
214
|
/* @__PURE__ */c("div",{children:[
|
|
@@ -212,46 +217,46 @@ return c("div",{className:"lb:w-full lb:max-w-full lb:py-2 lb:overflow-x-hidden
|
|
|
212
217
|
/* @__PURE__ */s("span",{className:"icon icon-close-small"}),"Limpiar"]})]})]})}),m?/* @__PURE__ */c("div",{className:"lb:relative",children:[
|
|
213
218
|
/* @__PURE__ */s("div",{className:"lb:relative lb:inset-0 lb:flex lb:items-center lb:justify-center lb:bg-white/80 lb:z-10 lb:min-h-75",children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:items-center lb:gap-3",children:[
|
|
214
219
|
/* @__PURE__ */s("span",{className:"icon icon-spinner lb:p-4 lb:animate-spin"}),
|
|
215
|
-
/* @__PURE__ */c("span",{className:"lb:text-sm lb:text-gray-600 lb:font-medium",children:["Cargando ",q,"..."]})]})}),y.showPlaceholders&&/* @__PURE__ */s("div",{ref:U,className:"limbo-gallery lb:opacity-30","data-limbo-responsive":!0,role:"grid","aria-label":`Cargando ${q} de la galería`,"aria-busy":"true",children:Array.from({length:y.placeholderCount}).map((e,t)=>/* @__PURE__ */s("div",{role:"gridcell","aria-posinset":t+1,"aria-setsize":y.placeholderCount,className:"lb:min-w-0",children:/* @__PURE__ */s(
|
|
220
|
+
/* @__PURE__ */c("span",{className:"lb:text-sm lb:text-gray-600 lb:font-medium",children:["Cargando ",q,"..."]})]})}),y.showPlaceholders&&/* @__PURE__ */s("div",{ref:U,className:"limbo-gallery lb:opacity-30","data-limbo-responsive":!0,role:"grid","aria-label":`Cargando ${q} de la galería`,"aria-busy":"true",children:Array.from({length:y.placeholderCount}).map((e,t)=>/* @__PURE__ */s("div",{role:"gridcell","aria-posinset":t+1,"aria-setsize":y.placeholderCount,className:"lb:min-w-0",children:/* @__PURE__ */s(it,{})},`skeleton-${t}`))})]}):h?/* @__PURE__ */s(Se,{variant:"danger",className:"lb:text-center",children:h}):/* @__PURE__ */c("div",{className:"lb:relative",children:[H&&/* @__PURE__ */s("div",{className:"limbo-search-overlay",role:"status","aria-live":"polite","aria-label":"Buscando archivos",children:/* @__PURE__ */c("div",{className:"limbo-search-overlay__content",children:[
|
|
216
221
|
/* @__PURE__ */s("span",{className:"icon icon-spinner lb:animate-spin"}),
|
|
217
222
|
/* @__PURE__ */s("span",{children:"Buscando..."})]})}),
|
|
218
|
-
/* @__PURE__ */s("div",{ref:U,className:"limbo-gallery lb:px-3 lb:pt-4 lb:box-border lb:max-w-full "+(H?"lb:opacity-50 lb:pointer-events-none":""),"data-limbo-responsive":!0,"data-grid-id":"gallery-grid",role:"grid","aria-label":`Galería de ${q}. Use las flechas para navegar`,"aria-busy":H,children:u.length>0?u.map((t,
|
|
223
|
+
/* @__PURE__ */s("div",{ref:U,className:"limbo-gallery lb:px-3 lb:pt-4 lb:box-border lb:max-w-full "+(H?"lb:opacity-50 lb:pointer-events-none":""),"data-limbo-responsive":!0,"data-grid-id":"gallery-grid",role:"grid","aria-label":`Galería de ${q}. Use las flechas para navegar`,"aria-busy":H,children:u.length>0?u.map((t,n)=>/* @__PURE__ */s("div",{role:"gridcell","aria-posinset":n+1,"aria-setsize":u.length,className:"lb:min-w-0",children:/* @__PURE__ */s(at,{image:t,onSelect:e,onCrop:a,onDelete:w.delete&&i?()=>i(t.id):null,onFolderChange:N,onRename:E,onEdit:$,thumbnailSize:32,isDeleting:o===t.id,showFolderInfo:R,allowMoveFolder:O,allowedFolderSlugs:I,excludedFolderSlugs:D,allowCreateFolder:F,allowedActions:w})},t.id)):/* @__PURE__ */s("div",{className:"lb:col-span-full lb:text-center lb:text-gray-500 lb:py-8",role:"status","aria-live":"polite",children:/* @__PURE__ */c("p",{children:["No se han encontrado ",q]})})})]})]})}function ct({currentPage:t,totalPages:n,onPageChange:l,disabled:r=!1}){if(!n||n<=1)return null;const a=(()=>{const e=[],l=[],r=Math.max(1,t-2),a=Math.min(n,t+2);for(let t=r;t<=a;t++)e.push(t);return r>1&&(l.push(1),r>2&&l.push("...")),l.push(...e),a<n&&(a<n-1&&l.push("..."),l.push(n)),l})();/* @__PURE__ */
|
|
219
224
|
return s("div",{className:"lb:flex lb:flex-col lb:items-center lb:justify-center lb:space-x-2 lb:py-4",children:/* @__PURE__ */c("div",{className:"lb:flex lb:space-x-2 lb:mt-2",children:[
|
|
220
|
-
/* @__PURE__ */c("button",{onClick:()=>{t>1&&
|
|
225
|
+
/* @__PURE__ */c("button",{onClick:()=>{t>1&&l(t-1)},disabled:r||t<=1,className:` lb:px-3 lb:py-2 lb:text-sm lb:font-medium lb:rounded-md lb:transition-colors lb:disabled:cursor-default lb:cursor-pointer ${r||t<=1?"lb:text-gray-400 lb:bg-gray-100 lb:cursor-not-allowed":"lb:text-gray-700 lb:bg-white lb:border lb:border-gray-300 lb:hover:bg-gray-50 lb:focus:ring-2 lb:focus:ring-blue-500"} `,children:[
|
|
221
226
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left icon--sm"})," Anterior"]}),
|
|
222
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:space-x-1",children:a.map((
|
|
223
|
-
/* @__PURE__ */c("button",{onClick:()=>{t<l
|
|
224
|
-
/* @__PURE__ */s("span",{className:"icon icon-arrow-right icon--sm"})]})]})})}function
|
|
227
|
+
/* @__PURE__ */s("div",{className:"lb:flex lb:space-x-1",children:a.map((n,a)=>/* @__PURE__ */s(e.Fragment,{children:"..."===n?/* @__PURE__ */s("span",{className:"lb:px-3 lb:py-2 lb:text-sm lb:text-gray-500",children:"..."}):/* @__PURE__ */s("button",{onClick:()=>(e=>{e!==t&&l(e)})(n),disabled:r,className:` lb:px-3 lb:py-2 lb:text-sm lb:font-medium lb:rounded-md lb:transition-colors lb:disabled:cursor-default lb:cursor-pointer ${n===t?"lb:bg-brand-blue-800 lb:text-white lb:border lb:border-brand-blue-1000":r?"lb:text-gray-400 lb:bg-gray-100 lb:cursor-not-allowed":"lb:text-gray-700 lb:bg-white lb:border lb:border-gray-300 lb:hover:bg-gray-50 lb:focus:ring-2 lb:focus:ring-blue-500"} `,children:n})},`page-${n}-${a}`))}),
|
|
228
|
+
/* @__PURE__ */c("button",{onClick:()=>{t<n&&l(t+1)},disabled:r||t>=n,className:` lb:px-3 lb:py-2 lb:text-sm lb:font-medium lb:rounded-md lb:transition-colors lb:disabled:cursor-default lb:cursor-pointer ${r||t>=n?"lb:text-gray-400 lb:bg-gray-100 lb:cursor-not-allowed":"lb:text-gray-700 lb:bg-white lb:border lb:border-gray-300 lb:hover:bg-gray-50 lb:focus:ring-2 lb:focus:ring-blue-500"} `,children:["Siguiente ",
|
|
229
|
+
/* @__PURE__ */s("span",{className:"icon icon-arrow-right icon--sm"})]})]})})}function ut({text:e="Cargando..."}){/* @__PURE__ */
|
|
225
230
|
return c("div",{className:"lb:absolute lb:inset-0 lb:bg-neutral-gray-1000/20 lb:z-10 lb:flex lb:flex-col lb:items-center lb:justify-center lb:py-8 lb:text-gray-600",role:"status","aria-live":"polite","aria-label":e,children:[
|
|
226
231
|
/* @__PURE__ */s("span",{className:"limbo-filter-searching","aria-hidden":"true",children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:animate-spin lb:min-w-7 lb:min-h-7"})}),
|
|
227
|
-
/* @__PURE__ */s("p",{className:"lb:text-sm",id:"loader-text",children:e})]})}function
|
|
228
|
-
return c(u,{children:[h&&/* @__PURE__ */s(
|
|
232
|
+
/* @__PURE__ */s("p",{className:"lb:text-sm",id:"loader-text",children:e})]})}function dt({onSelect:e,onCrop:t,onDelete:n,onFolderChange:l,onRename:r,onEdit:a,onPageChange:i,onFiltersChange:o,images:d,loadingImages:b,imagesError:m,deleting:h,uploadedImage:p,pagination:f,currentPage:g,galleryFilters:v,debouncedFilters:y,allowedActions:w,resolvedAccept:x,allowedCategories:k,folderConfig:C,filterConfig:S,loadingConfig:N,resetUpload:E}){/* @__PURE__ */
|
|
233
|
+
return c(u,{children:[h&&/* @__PURE__ */s(ut,{text:"Eliminando archivo..."}),p&&/* @__PURE__ */c(Se,{variant:"success",toast:!0,onClose:E,children:[
|
|
229
234
|
/* @__PURE__ */s("span",{className:"icon icon-tick-white icon--2sm"})," Archivo subido correctamente: ",p.filename]}),
|
|
230
|
-
/* @__PURE__ */s(
|
|
235
|
+
/* @__PURE__ */s(st,{onSelect:e,onCrop:t,onDelete:n,deletingId:h,images:d,loading:b,error:m,filters:v,debouncedFilters:y,onFiltersChange:o,filterConfig:S,loadingConfig:N,allowedActions:w,resolvedAccept:x,allowedCategories:k,folderConfig:C,onFolderChange:l,onRename:r,onEdit:a}),f&&!b&&/* @__PURE__ */s(ct,{currentPage:f.page||g,totalPages:f.pages||1,onPageChange:i,disabled:b||h})]})}function bt({previewUrl:e,fileName:n}){const[r,a]=t(!1),[i,o]=t(!1),u=l(null);/* @__PURE__ */
|
|
231
236
|
return c("div",i?{className:"lb:flex lb:flex-col lb:items-center lb:justify-center lb:p-8 lb:min-h-[200px] lb:bg-gray-100 lb:rounded-lg",children:[
|
|
232
237
|
/* @__PURE__ */s("span",{className:"icon icon-video icon--xl lb:text-gray-400 lb:mb-4"}),
|
|
233
238
|
/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-gray-600",children:"No se puede reproducir el video"}),
|
|
234
|
-
/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-500 lb:mt-1",children:
|
|
239
|
+
/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-500 lb:mt-1",children:n})]}:{className:"lb:relative lb:w-full lb:min-w-65 lb:max-w-md lb:aspect-video lb:bg-black lb:rounded-lg lb:overflow-hidden",children:[
|
|
235
240
|
/* @__PURE__ */s("video",{ref:u,src:e,className:"lb:absolute lb:inset-0 lb:w-full lb:h-full lb:object-contain",onEnded:()=>{a(!1)},onError:()=>{o(!0)},onPlay:()=>a(!0),onPause:()=>a(!1),controls:!0,preload:"metadata",children:"Tu navegador no soporta la reproduccion de video."}),!r&&/* @__PURE__ */s("button",{type:"button",onClick:()=>{u.current&&(r?u.current.pause():u.current.play(),a(!r))},className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center lb:bg-black/30 lb:hover:bg-black/40 lb:transition-colors lb:cursor-pointer","aria-label":"Reproducir video",children:/* @__PURE__ */s("div",{className:"lb:w-16 lb:h-16 lb:rounded-full lb:bg-white/90 lb:flex lb:items-center lb:justify-center lb:shadow-lg",children:/* @__PURE__ */s("span",{className:"icon icon-play icon--lg lb:text-gray-800 lb:ml-1"})})}),
|
|
236
241
|
/* @__PURE__ */c("div",{className:"lb:absolute lb:top-2 lb:right-2 lb:bg-black/60 lb:text-white lb:px-2 lb:py-1 lb:rounded lb:text-xs lb:flex lb:items-center lb:gap-1",children:[
|
|
237
242
|
/* @__PURE__ */s("span",{className:"icon icon-video icon--xs"}),
|
|
238
|
-
/* @__PURE__ */s("span",{children:"VIDEO"})]})]})}function
|
|
243
|
+
/* @__PURE__ */s("span",{children:"VIDEO"})]})]})}function mt({previewUrl:e,fileName:n,fileSize:r}){const[a,i]=t(!1),[o,d]=t(!1),[b,m]=t(0),[h,p]=t(0),f=l(null),g=e=>{if(!e||isNaN(e))return"0:00";return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`};/* @__PURE__ */
|
|
239
244
|
return c("div",o?{className:"lb:flex lb:flex-col lb:items-center lb:justify-center lb:p-8 lb:min-h-50 lb:bg-gray-100 lb:rounded-lg",children:[
|
|
240
245
|
/* @__PURE__ */s("span",{className:"icon icon-audio icon--xl lb:text-gray-400 lb:mb-4"}),
|
|
241
246
|
/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-gray-600",children:"No se puede reproducir el audio"}),
|
|
242
|
-
/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-500 lb:mt-1",children:
|
|
247
|
+
/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-500 lb:mt-1",children:n})]}:{className:"lb:flex lb:flex-col lb:items-center lb:justify-center lb:p-6 lb:min-h-50",children:[
|
|
243
248
|
/* @__PURE__ */c("div",{className:"lb:relative lb:mb-4",children:[
|
|
244
249
|
/* @__PURE__ */s("div",{className:"lb:w-24 lb:h-24 lb:flex lb:items-center lb:justify-center lb:bg-linear-to-br lb:from-purple-100 lb:to-blue-100 lb:rounded-full",children:/* @__PURE__ */s("span",{className:"icon icon-audio icon--xl lb:text-purple-600"})}),
|
|
245
250
|
/* @__PURE__ */s("button",{type:"button",onClick:()=>{f.current&&(a?f.current.pause():f.current.play())},className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center lb:rounded-full lb:bg-black/0 lb:hover:bg-black/10 lb:transition-colors lb:cursor-pointer","aria-label":a?"Pausar":"Reproducir",children:/* @__PURE__ */s("div",{className:"lb:w-10 lb:h-10 lb:rounded-full lb:bg-white lb:shadow-md lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:`icon ${a?"icon-pause":"icon-play"} icon--md lb:text-gray-800 ${a?"":"lb:ml-0.5"}`})})})]}),
|
|
246
|
-
/* @__PURE__ */s("p",{className:"lb:text-sm lb:font-medium lb:text-gray-800 lb:text-center lb:max-w-full lb:truncate lb:px-4",children:
|
|
251
|
+
/* @__PURE__ */s("p",{className:"lb:text-sm lb:font-medium lb:text-gray-800 lb:text-center lb:max-w-full lb:truncate lb:px-4",children:n}),
|
|
247
252
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2 lb:mt-2 lb:text-xs lb:text-gray-500",children:[
|
|
248
253
|
/* @__PURE__ */s("span",{children:g(h)}),
|
|
249
254
|
/* @__PURE__ */s("span",{children:"/"}),
|
|
250
255
|
/* @__PURE__ */s("span",{children:g(b)}),r&&/* @__PURE__ */c(u,{children:[
|
|
251
256
|
/* @__PURE__ */s("span",{children:"•"}),
|
|
252
257
|
/* @__PURE__ */s("span",{children:Ue(r)})]})]}),
|
|
253
|
-
/* @__PURE__ */s("div",{className:"lb:w-full lb:max-w-xs lb:mt-3",children:/* @__PURE__ */s("div",{className:"lb:h-1.5 lb:bg-gray-200 lb:rounded-full lb:overflow-hidden lb:cursor-pointer",onClick:e=>{if(!f.current||!b)return;const t=e.currentTarget.getBoundingClientRect(),
|
|
254
|
-
/* @__PURE__ */s("audio",{ref:f,src:e,onPlay:()=>i(!0),onPause:()=>i(!1),onTimeUpdate:()=>{f.current&&p(f.current.currentTime)},onLoadedMetadata:()=>{f.current&&m(f.current.duration)},onEnded:()=>{i(!1),p(0)},onError:()=>{d(!0)},preload:"metadata"})]})}function
|
|
258
|
+
/* @__PURE__ */s("div",{className:"lb:w-full lb:max-w-xs lb:mt-3",children:/* @__PURE__ */s("div",{className:"lb:h-1.5 lb:bg-gray-200 lb:rounded-full lb:overflow-hidden lb:cursor-pointer",onClick:e=>{if(!f.current||!b)return;const t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left;f.current.currentTime=n/t.width*b},role:"slider","aria-label":"Progreso de audio","aria-valuenow":h,"aria-valuemin":0,"aria-valuemax":b,tabIndex:0,children:/* @__PURE__ */s("div",{className:"lb:h-full lb:bg-purple-500 lb:rounded-full lb:transition-all lb:duration-100 lb:pointer-events-none",style:{width:b>0?h/b*100+"%":"0%"}})})}),
|
|
259
|
+
/* @__PURE__ */s("audio",{ref:f,src:e,onPlay:()=>i(!0),onPause:()=>i(!1),onTimeUpdate:()=>{f.current&&p(f.current.currentTime)},onLoadedMetadata:()=>{f.current&&m(f.current.duration)},onEnded:()=>{i(!1),p(0)},onError:()=>{d(!0)},preload:"metadata"})]})}function ht({file:e,image:l,onDiscard:r,onRetry:a,onDownload:i,onSelect:o,showRetry:u=!1,disabled:d=!1,showCropButton:b,onTagsChange:m=null,tags:h=[],selectedFolder:p=null,onFolderChange:f=null,folderConfig:g=null}){const v=e||l,[y,w]=t(null),[x,k]=t({name:"",size:"",type:"",category:"unknown"}),[C,S]=t(!1),[N,E]=t(!1),[$,_]=t(""),T="image"===x.category,A="video"===x.category,z="audio"===x.category,L=void 0!==b?b:T;n(()=>{if(!v)return void w(null);const e=URL.createObjectURL(v);w(e);const t=v.name||"archivo",n=v.type||"",l=(e=>e?e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":"application/pdf"===e||e.includes("document")||e.includes("msword")||e.includes("spreadsheet")||e.includes("presentation")||e.startsWith("text/")?"document":"unknown":"unknown")(n),r=(e=>{const t=e?.split(".")[0]?.toLowerCase()||"";return["ai-image","ai_image","generated","imagen-ia","imagen_ia"].some(e=>t.startsWith(e))})(t);if(k({name:t,size:Ue(v.size||0),type:n,category:l}),r)_(""),E(!1);else{const e=t.split(".")[0];_(e)}return()=>{URL.revokeObjectURL(e)}},[v]);if(!v||!y)return null;/* @__PURE__ */
|
|
255
260
|
return c("div",{className:"lb:w-full lb:max-w-full lb:bg-white lb:border lb:border-gray-200 lb:rounded-lg lb:px-1 lb:sm:px-3 lb:py-2 lb:m-0 lb:shadow-sm lb:overflow-hidden lb:box-border",children:[
|
|
256
261
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:mb-4 lb:px-1",children:[
|
|
257
262
|
/* @__PURE__ */s("h3",{className:"lb:text-sm lb:font-medium lb:text-gray-700",children:(()=>{switch(x.category){case"image":return"Vista previa de imagen";case"video":return"Vista previa de video";case"audio":return"Vista previa de audio";case"document":return"Vista previa de documento";default:return"Vista previa de archivo"}})()}),
|
|
@@ -265,7 +270,7 @@ return c("div",{className:"lb:w-full lb:max-w-full lb:bg-white lb:border lb:bord
|
|
|
265
270
|
/* @__PURE__ */s("img",{src:y,alt:"Vista previa",className:"lb:absolute lb:inset-0 lb:w-full lb:h-full lb:object-contain"}),
|
|
266
271
|
/* @__PURE__ */c("div",{className:"lb:absolute lb:top-2 lb:right-2 lb:bg-black/50 lb:text-white lb:px-2 lb:py-1 lb:rounded lb:text-xs lb:flex lb:items-center lb:gap-1",children:[
|
|
267
272
|
/* @__PURE__ */s("span",{className:"icon icon-search-white icon--xs"}),
|
|
268
|
-
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Ampliar"})]})]}):A?/* @__PURE__ */s(
|
|
273
|
+
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Ampliar"})]})]}):A?/* @__PURE__ */s(bt,{previewUrl:y,fileName:x.name}):z?/* @__PURE__ */s(mt,{previewUrl:y,fileName:x.name,fileSize:v?.size}):/* @__PURE__ */s(Be,{file:v,mimeType:x.type,category:x.category}),T&&/* @__PURE__ */s("div",{className:"lb:mt-3 lb:text-center lb:space-y-1 lb:w-full",children:/* @__PURE__ */s("div",{className:"lb:rounded-sm lb:w-fit lb:gap-0.5 lb:p-0.5 lb:min-w-fit lb:mx-auto",children:/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-center lb:gap-3 lb:text-xs lb:text-gray-500",children:[
|
|
269
274
|
/* @__PURE__ */s("span",{children:x.size}),
|
|
270
275
|
/* @__PURE__ */s("span",{children:"•"}),
|
|
271
276
|
/* @__PURE__ */s("span",{children:x.type.split("/")[1]?.toUpperCase()||"FILE"})]})})})]}),
|
|
@@ -273,7 +278,7 @@ return c("div",{className:"lb:w-full lb:max-w-full lb:bg-white lb:border lb:bord
|
|
|
273
278
|
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:gap-1",children:[
|
|
274
279
|
/* @__PURE__ */c("label",{htmlFor:"assetPreviewNameInput",className:"lb:flex lb:items-center lb:w-fit",children:[
|
|
275
280
|
/* @__PURE__ */s("span",{className:"lb:me-1 lb:text-sm",children:"Nombre:"}),
|
|
276
|
-
/* @__PURE__ */s("input",{id:"assetPreviewNameInput",onChange:e=>(e=>{const t=e.target.value.trim();_(e.target.value),t.length>0&&E(!1);const
|
|
281
|
+
/* @__PURE__ */s("input",{id:"assetPreviewNameInput",onChange:e=>(e=>{const t=e.target.value.trim();_(e.target.value),t.length>0&&E(!1);const n=x.name,l=n.lastIndexOf("."),r=-1!==l?n.substring(l):"";k(e=>({...e,name:t?t+r:r}))})(e),value:$,className:"limbo-input-image-name lb:w-fit lb:px-1 lb:text-sm lb:font-medium lb:text-gray-800 lb:border lb:rounded lb:truncate lb:focus:outline lb:focus:outline-neutral-gray-100 lb:focus:transform-none lb:focus:shadow-none lb:focus:opacity-100 "+(N?"lb:border-red-1000 lb:bg-red-50":"lb:border-gray-300"),placeholder:"Escribe un nombre...",title:"El nombre es obligatorio",required:!0})]}),N&&/* @__PURE__ */s("span",{className:"lb:text-xs lb:text-red-1000 lb:ml-1",children:"El nombre es obligatorio"})]}),u&&a&&/* @__PURE__ */c("button",{type:"button",onClick:a,disabled:d,className:"lb:flex-1 lb:md:flex-none lb:flex lb:items-center lb:justify-center lb:gap-2 lb:px-4 lb:py-2.5 lb:bg-white lb:border lb:border-gray-300 lb:text-gray-700 lb:rounded-lg lb:hover:bg-gray-50 lb:cursor-pointer lb:hover:border-gray-400 lb:transition-colors lb:disabled:opacity-50 lb:disabled:cursor-not-allowed lb:text-sm lb:font-medium","aria-label":"Intentarlo de nuevo",title:"Generar de nuevo con el mismo prompt",children:[
|
|
277
282
|
/* @__PURE__ */s("span",{className:"icon icon-refresh icon--sm"}),
|
|
278
283
|
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Reintentar"}),
|
|
279
284
|
/* @__PURE__ */s("span",{className:"lb:sm:hidden",children:"Retry"})]}),
|
|
@@ -282,45 +287,16 @@ return c("div",{className:"lb:w-full lb:max-w-full lb:bg-white lb:border lb:bord
|
|
|
282
287
|
/* @__PURE__ */s("span",{children:"Descargar"})]}),
|
|
283
288
|
/* @__PURE__ */c("button",{type:"button",onClick:()=>{$.trim()?(E(!1),o&&o(x.name,h)):E(!0)},disabled:d,className:"lb:flex-1 lb:md:flex-none lb:flex lb:items-center lb:justify-center lb:gap-2 lb:px-4 lb:py-2.5 lb:bg-brand-blue-800 lb:border lb:border-brand-blue-800 lb:text-white lb:rounded-lg lb:hover:bg-brand-blue-1000 lb:cursor-pointer lb:hover:border-brand-blue-1000 lb:transition-colors lb:disabled:opacity-50 lb:disabled:cursor-not-allowed lb:text-sm lb:font-medium lb:shadow-sm","aria-label":L?"Seleccionar para recortar":"Seleccionar archivo",children:[
|
|
284
289
|
/* @__PURE__ */s("span",{className:"icon icon-tick-white icon--sm"}),
|
|
285
|
-
/* @__PURE__ */s("span",{children:"Seleccionar"})]})]})]})]})}),T&&/* @__PURE__ */s(He,{isOpen:C,src:y,alt:x.name,title:x.name,subtitle:`${x.size} • ${x.type.split("/")[1]?.toUpperCase()||"IMAGE"}`,onClose:()=>S(!1)})]})}const
|
|
290
|
+
/* @__PURE__ */s("span",{children:"Seleccionar"})]})]})]})]})}),T&&/* @__PURE__ */s(He,{isOpen:C,src:y,alt:x.name,title:x.name,subtitle:`${x.size} • ${x.type.split("/")[1]?.toUpperCase()||"IMAGE"}`,onClose:()=>S(!1)})]})}const pt={image:["image/jpeg","image/png","image/webp","image/svg+xml"],video:["image/gif","video/mp4","video/webm","video/quicktime","video/x-msvideo"],document:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/plain","text/csv","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"],audio:["audio/mpeg","audio/wav","audio/ogg","audio/webm"]},ft={image:"JPG, PNG, SVG, WebP, GIF",video:"GIF, MP4, WebM, MOV, AVI",document:"PDF, DOC, DOCX, XLS, XLSX, TXT, PPT, PPTX",audio:"MP3, WAV, OGG"},gt=["image","video","document","audio"];function vt({file:e,setFile:n,setPreviewUrl:l,fileInputRef:a,onSelect:i,disabled:o,allowedCategories:u=null,resolvedAccept:d=null,selectedFolder:b=null,onFolderChange:m=null,folderConfig:h=null,tags:p=[],onTagsChange:f=null}){const[v,y]=t(!1),{acceptAttribute:w,allowedMimeTypes:x,formatLabels:k,categories:C}=r(()=>{if(d&&!d.isAllTypes)return{acceptAttribute:d.acceptString,allowedMimeTypes:new Set(d.mimeTypes),formatLabels:g(d),categories:d.categories.length>0?d.categories:gt};const e=null===u?gt:u,t=[],n=[];return e.forEach(e=>{pt[e]&&(t.push(...pt[e]),ft[e]&&n.push(ft[e]))}),{acceptAttribute:t.join(","),allowedMimeTypes:new Set(t),formatLabels:n.join(", "),categories:e}},[u,d]),S=d&&!d.isAllTypes?d.includesImages&&1===d.categories.length&&"image"===d.categories[0]:1===C.length&&"image"===C[0],N=e=>{if(n(e),e){const t=URL.createObjectURL(e);l(t)}else l(null)};/* @__PURE__ */
|
|
286
291
|
return c("div",{className:"lb:flex lb:flex-col lb:items-center lb:gap-6","aria-label":S?"Subir imagen desde dispositivo":"Subir archivo desde dispositivo",children:[
|
|
287
|
-
/* @__PURE__ */c("label",{htmlFor:"file-input",className:"lb:w-full lb:max-w-full lb:flex lb:flex-col lb:items-center lb:justify-center lb:border-2 lb:border-dashed lb:rounded-xl lb:p-8 lb:cursor-pointer lb:transition lb:box-border "+(v?"lb:border-brand-blue-1000 lb:bg-brand-blue-100 lb:scale-[1.02]":"lb:border-brand-blue-200 lb:hover:border-brand-blue-1000 lb:hover:to-bright-blue-200 lb:hover:from-brand-blue-50 lb:focus-within:border-brand-blue-800 lb:from-bright-blue-50 lb:to-brand-blue-50 lb:bg-linear-to-br"),tabIndex:0,style:{outline:"none"},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o||y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||y(!1)},onDrop:e=>{if(e.preventDefault(),e.stopPropagation(),y(!1),o)return;const t=e.dataTransfer?.files;if(t&&t.length>0){const e=t[0];(e=>{if(!e||!e.type)return!1;if(d&&!d.isAllTypes)return function(e,t){if(!t||t.isAllTypes)return!0;if(!e)return!1;if(t.mimeTypes.includes(e))return!0;for(const
|
|
292
|
+
/* @__PURE__ */c("label",{htmlFor:"file-input",className:"lb:w-full lb:max-w-full lb:flex lb:flex-col lb:items-center lb:justify-center lb:border-2 lb:border-dashed lb:rounded-xl lb:p-8 lb:cursor-pointer lb:transition lb:box-border "+(v?"lb:border-brand-blue-1000 lb:bg-brand-blue-100 lb:scale-[1.02]":"lb:border-brand-blue-200 lb:hover:border-brand-blue-1000 lb:hover:to-bright-blue-200 lb:hover:from-brand-blue-50 lb:focus-within:border-brand-blue-800 lb:from-bright-blue-50 lb:to-brand-blue-50 lb:bg-linear-to-br"),tabIndex:0,style:{outline:"none"},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},onDragEnter:e=>{e.preventDefault(),e.stopPropagation(),o||y(!0)},onDragLeave:e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.contains(e.relatedTarget)||y(!1)},onDrop:e=>{if(e.preventDefault(),e.stopPropagation(),y(!1),o)return;const t=e.dataTransfer?.files;if(t&&t.length>0){const e=t[0];(e=>{if(!e||!e.type)return!1;if(d&&!d.isAllTypes)return function(e,t){if(!t||t.isAllTypes)return!0;if(!e)return!1;if(t.mimeTypes.includes(e))return!0;for(const n of t.categories)if(e.startsWith(n+"/"))return!0;return!1}(e.type,d);if(x.has(e.type))return!0;for(const t of C)if("image"===t&&e.type.startsWith("image/")||"video"===t&&e.type.startsWith("video/")||"audio"===t&&e.type.startsWith("audio/"))return!0;return!1})(e)&&N(e)}},children:[
|
|
288
293
|
/* @__PURE__ */s("span",{className:"icon icon-upload icon--lg lb:mb-2","aria-hidden":"true"}),
|
|
289
294
|
/* @__PURE__ */s("span",{className:"lb:font-medium lb:text-brand-blue-1000 lb:mb-1",children:S?"Haz clic o arrastra una imagen aqui":"Haz clic o arrastra un archivo aqui"}),
|
|
290
295
|
/* @__PURE__ */c("span",{className:"lb:text-sm lb:text-neutral-700",children:["Formatos permitidos: ",
|
|
291
296
|
/* @__PURE__ */s("span",{className:"lb:wrap-break-word",children:k})]}),
|
|
292
|
-
/* @__PURE__ */s("input",{id:"file-input",ref:a,type:"file",accept:w,onChange:e=>{const t=e.target.files[0];N(t)},disabled:o,className:"lb:sr-only","aria-label":S?"Seleccionar imagen":"Seleccionar archivo"})]}),e&&/* @__PURE__ */s(
|
|
297
|
+
/* @__PURE__ */s("input",{id:"file-input",ref:a,type:"file",accept:w,onChange:e=>{const t=e.target.files[0];N(t)},disabled:o,className:"lb:sr-only","aria-label":S?"Seleccionar imagen":"Seleccionar archivo"})]}),e&&/* @__PURE__ */s(ht,{file:e,onDiscard:()=>{n(null),l(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,p)}else i(e,p)},showRetry:!1,disabled:o,selectedFolder:b,onFolderChange:m,folderConfig:h,tags:p,onTagsChange:f})]})}const yt="/api";const wt=/* @__PURE__ */new Map;function xt(e=!1){const[l,r]=t([]),[a,i]=t(!0),[o,s]=t(null);n(()=>{const t=`ai-services-${e}`,n=wt.get(t),l=Date.now();if(n&&l-n.timestamp<864e5)return r(n.data),void i(!1);let a=!0;return(async()=>{try{const n=await function(e=!1){return J({endpoint:"/ai/services",prod:e,basePath:yt})}(e);if(!a)return;const i=n?.data||n?.result||[],o=Array.isArray(i)?i.map(e=>({label:e.name||e.label,slug:e.slug,type:e.type,description:e.description,image:e.image,costInfo:e.cost_info||null,supportsImageInput:e.supports_image_input||!1})):Object.entries(i).map(([e,t])=>({label:e,slug:t,type:"image_generation",description:null,image:null,costInfo:null,supportsImageInput:!1}));r(o),wt.set(t,{data:o,timestamp:l})}catch(n){a&&s(n.message)}finally{a&&i(!1)}})(),()=>{a=!1}},[e]);return{services:l,loading:a,error:o,invalidateCache:()=>{wt.delete(`ai-services-${e}`)}}}const kt=/* @__PURE__ */new Map;function Ct(e=!1){const[n,l]=t(null),[r,a]=t(!1),[i,o]=t(null);return{params:n,loading:r,error:i,fetchParams:async t=>{a(!0),o(null);const n=`${e}-${t}`,r=Date.now(),i=kt.get(n);if(i&&r-i.timestamp<864e5)return l(i.data),a(!1),i.data;try{const a=await function({services:e=null,form:t=!1}={},n=!1){const l={};return e&&(l.services=e),!1!==t&&(l.form=t),J({endpoint:"/ai/params"+(Object.keys(l).length?"?"+new URLSearchParams(l).toString():""),method:"GET",prod:n,basePath:"/api/atenea"})}({services:t,form:!1},e),i=a?.result?.data||a?.data||a?.result||a;return l(i),kt.set(n,{data:i,timestamp:r}),i}catch(s){return o(s.message),l(null),null}finally{a(!1)}},reset:()=>{o(null),l(null)}}}function St({show:e=!1,message:t="Cargando...",className:n=""}){return e?/* @__PURE__ */s("div",{className:`lb:absolute lb:inset-0 lb:min-h-50 lb:bg-white/80 lb:backdrop-blur-sm lb:z-50 lb:flex lb:flex-col lb:items-center lb:justify-center ${n}`,"aria-live":"polite","aria-busy":"true",role:"status",children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:items-center lb:gap-4",children:[
|
|
293
298
|
/* @__PURE__ */s("span",{className:"icon icon-spinner lb:p-4 lb:animate-spin"}),
|
|
294
|
-
/* @__PURE__ */s("p",{className:"lb:text-brand-blue-1000 lb:font-medium lb:text-lg",children:t})]})}):null}
|
|
295
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:mb-4 lb:px-1",children:[
|
|
296
|
-
/* @__PURE__ */s("h3",{className:"lb:text-sm lb:font-medium lb:text-gray-700",children:"Vista previa de imagen"}),
|
|
297
|
-
/* @__PURE__ */s("button",{type:"button",onClick:n,disabled:u,className:"lb:p-1.5 lb:text-gray-400 lb:cursor-pointer lb:hover:text-gray-600 lb:hover:bg-red-300 lb:rounded lb:transition-colors lb:disabled:opacity-50 lb:disabled:cursor-not-allowed","aria-label":"Descartar imagen",title:"Descartar imagen",children:/* @__PURE__ */s("span",{className:"icon icon-close-small icon--md"})})]}),m?.showFolderSelector&&b&&/* @__PURE__ */s("div",{className:"lb:mb-4 lb:px-1",children:/* @__PURE__ */s(et,{value:d?.slug||d,onChange:b,allowCreate:!1!==m?.allowCreateFolder,label:"Guardar en carpeta",showAssetCount:!0,allowedSlugs:m?.include?.length>0?m.include:null,mode:"upload",disabled:u})}),
|
|
298
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:justify-center lb:md:flex-row lb:gap-2 lb:md:gap-6",children:[
|
|
299
|
-
/* @__PURE__ */c("div",{className:"lb:flex-1 lb:md:flex-[0.4] lb:flex lb:flex-col lb:items-center lb:justify-center",children:[
|
|
300
|
-
/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:max-w-md lb:aspect-video lb:bg-gray-100 lb:rounded-lg lb:overflow-hidden lb:cursor-zoom-in lb:hover:ring-2 lb:hover:ring-brand-blue-800 lb:transition-all",onClick:()=>y(!0),role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y(!0))},"aria-label":"Click para ver imagen en tamaño completo",title:"Click para ver en tamaño completo",children:[
|
|
301
|
-
/* @__PURE__ */s("img",{src:h,alt:"Vista previa",className:"lb:absolute lb:inset-0 lb:w-full lb:h-full lb:object-contain"}),
|
|
302
|
-
/* @__PURE__ */c("div",{className:"lb:absolute lb:top-2 lb:right-2 lb:bg-black/50 lb:text-white lb:px-2 lb:py-1 lb:rounded lb:text-xs lb:flex lb:items-center lb:gap-1",children:[
|
|
303
|
-
/* @__PURE__ */s("span",{className:"icon icon-search-white icon--xs"}),
|
|
304
|
-
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Ampliar"})]})]}),
|
|
305
|
-
/* @__PURE__ */s("div",{className:"lb:mt-3 lb:text-center lb:space-y-1 lb:w-full",children:/* @__PURE__ */s("div",{className:"lb:rounded-sm lb:w-fit lb:gap-0.5 lb:p-0.5 lb:min-w-fit lb:mx-auto",children:/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-center lb:gap-3 lb:text-xs lb:text-gray-500",children:[
|
|
306
|
-
/* @__PURE__ */s("span",{children:f.size}),
|
|
307
|
-
/* @__PURE__ */s("span",{children:"•"}),
|
|
308
|
-
/* @__PURE__ */s("span",{children:f.type.split("/")[1]?.toUpperCase()||"IMAGE"})]})})})]}),
|
|
309
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-row lb:md:flex-col lb:gap-2 lb:justify-items-stretch lb:justify-center lb:md:justify-start lb:items-stretch lb:md:min-w-35",children:[
|
|
310
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:gap-1",children:[
|
|
311
|
-
/* @__PURE__ */c("label",{htmlFor:"uploadImageId",className:"lb:flex lb:items-center lb:w-fit",children:[
|
|
312
|
-
/* @__PURE__ */s("span",{className:"lb:me-1 lb:text-sm",children:"Nombre:"}),
|
|
313
|
-
/* @__PURE__ */s("input",{id:"uploadImageId",onChange:e=>(e=>{const t=e.target.value.trim();C(e.target.value);const l=zt(t||"_");l.valid?t.length>0&&x(!1):x(l.error);const n=f.name,r=n.lastIndexOf("."),a=-1!==r?n.substring(r):".webp";g(e=>({...e,name:t?t+a:a}))})(e),value:k,className:"limbo-input-image-name lb:w-fit lb:px-1 lb:text-sm lb:font-medium lb:text-gray-800 lb:border lb:rounded lb:truncate lb:focus:outline lb:focus:outline-neutral-gray-100 lb:focus:transform-none lb:focus:shadow-none lb:focus:opacity-100 "+(w?"lb:border-red-1000 lb:bg-red-50":"lb:border-gray-300"),placeholder:"Escribe un nombre...",title:"El nombre es obligatorio",required:!0})]}),w&&/* @__PURE__ */s("span",{className:"lb:text-xs lb:text-red-1000 lb:ml-1",children:"string"==typeof w?w:"El nombre es obligatorio"})]}),o&&r&&/* @__PURE__ */c("button",{type:"button",onClick:r,disabled:u,className:"lb:flex-1 lb:md:flex-none lb:flex lb:items-center lb:justify-center lb:gap-2 lb:px-4 lb:py-2.5 lb:bg-white lb:border lb:border-gray-300 lb:text-gray-700 lb:rounded-lg lb:hover:bg-gray-50 lb:cursor-pointer lb:hover:border-gray-400 lb:transition-colors lb:disabled:opacity-50 lb:disabled:cursor-not-allowed lb:text-sm lb:font-medium","aria-label":"Intentarlo de nuevo",title:"Generar de nuevo con el mismo prompt",children:[
|
|
314
|
-
/* @__PURE__ */s("span",{className:"icon icon-refresh icon--sm"}),
|
|
315
|
-
/* @__PURE__ */s("span",{className:"lb:hidden lb:sm:inline",children:"Reintentar"}),
|
|
316
|
-
/* @__PURE__ */s("span",{className:"lb:sm:hidden",children:"Retry"})]}),
|
|
317
|
-
/* @__PURE__ */c("button",{type:"button",onClick:()=>{if(!h||u)return;const e=document.createElement("a");e.href=h,e.download=f.name,document.body.appendChild(e),e.click(),document.body.removeChild(e),a&&a()},disabled:u,className:"lb:flex-1 lb:cursor-pointer lb:md:flex-none lb:flex lb:items-center lb:justify-center lb:gap-2 lb:px-4 lb:py-2.5 lb:bg-white lb:border lb:border-gray-300 lb:text-gray-700 lb:rounded-lg lb:hover:bg-gray-50 lb:hover:border-gray-400 lb:transition-colors lb:disabled:opacity-50 lb:disabled:cursor-not-allowed lb:text-sm lb:font-medium","aria-label":"Descargar imagen",children:[
|
|
318
|
-
/* @__PURE__ */s("span",{className:"icon icon-download icon--sm"}),
|
|
319
|
-
/* @__PURE__ */s("span",{children:"Descargar"})]}),
|
|
320
|
-
/* @__PURE__ */c("button",{type:"button",onClick:()=>{const e=k.trim();if(!e)return void x("El nombre no puede estar vacío");const t=zt(e);t.valid?(x(!1),i&&i(f.name)):x(t.error)},disabled:u,className:"lb:flex-1 lb:md:flex-none lb:flex lb:items-center lb:justify-center lb:gap-2 lb:px-4 lb:py-2.5 lb:bg-brand-blue-800 lb:border lb:border-brand-blue-800 lb:text-white lb:rounded-lg lb:hover:bg-brand-blue-1000 lb:cursor-pointer lb:hover:border-brand-blue-1000 lb:transition-colors lb:disabled:opacity-50 lb:disabled:cursor-not-allowed lb:text-sm lb:font-medium lb:shadow-sm","aria-label":"Seleccionar imagen para recortar",children:[
|
|
321
|
-
/* @__PURE__ */s("span",{className:"icon icon-tick-white icon--sm"}),
|
|
322
|
-
/* @__PURE__ */s("span",{children:"Seleccionar"})]})]})]}),
|
|
323
|
-
/* @__PURE__ */s(He,{isOpen:v,src:h,alt:f.name,title:f.name,subtitle:`${f.size} • ${f.type.split("/")[1]?.toUpperCase()||"IMAGE"}`,onClose:()=>y(!1)})]}):null}function Pt({aiStarterPrompt:e,useStarter:r,onUseStarterChange:a}){const[o,u]=t(!1),[d,b]=t(!1),m=n(null),h=i();if(l(()=>()=>{m.current&&clearTimeout(m.current)},[]),null==e||""===e)return null;const p=r?"lb:rounded-md lb:border lb:border-brand-blue-1000 lb:bg-brand-blue-50 lb:p-4 lb:cursor-pointer lb:transition-all lb:duration-150 lb:mb-6 lb:w-full":"lb:rounded-md lb:border lb:border-neutral-gray-100 lb:bg-neutral-gray-25 lb:p-4 lb:cursor-pointer lb:opacity-55 lb:transition-all lb:duration-150 lb:mb-6 lb:w-full",f=o?"lb:text-[13px] lb:leading-[1.4] lb:text-neutral-gray-800 lb:whitespace-pre-wrap lb:break-words":"lb:text-[13px] lb:leading-[1.4] lb:text-neutral-gray-800 lb:truncate",g=d?"lb:text-xs lb:font-normal lb:text-green-1000 lb:px-2 lb:py-1 lb:rounded lb:bg-green-50":"lb:text-xs lb:font-normal lb:text-neutral-gray-700 lb:px-2 lb:py-1 lb:rounded lb:hover:bg-neutral-gray-50 lb:transition-colors";/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */s("p",{className:"lb:text-brand-blue-1000 lb:font-medium lb:text-lg",children:t})]})}):null}function Nt({aiStarterPrompt:e,useStarter:r,onUseStarterChange:a}){const[o,u]=t(!1),[d,b]=t(!1),m=l(null),h=i();if(n(()=>()=>{m.current&&clearTimeout(m.current)},[]),null==e||""===e)return null;const p=r?"lb:rounded-md lb:border lb:border-brand-blue-1000 lb:bg-brand-blue-50 lb:p-4 lb:cursor-pointer lb:transition-all lb:duration-150 lb:mb-6 lb:w-full":"lb:rounded-md lb:border lb:border-neutral-gray-100 lb:bg-neutral-gray-25 lb:p-4 lb:cursor-pointer lb:opacity-55 lb:transition-all lb:duration-150 lb:mb-6 lb:w-full",f=o?"lb:text-[13px] lb:leading-[1.4] lb:text-neutral-gray-800 lb:whitespace-pre-wrap lb:break-words":"lb:text-[13px] lb:leading-[1.4] lb:text-neutral-gray-800 lb:truncate",g=d?"lb:text-xs lb:font-normal lb:text-green-1000 lb:px-2 lb:py-1 lb:rounded lb:bg-green-50":"lb:text-xs lb:font-normal lb:text-neutral-gray-700 lb:px-2 lb:py-1 lb:rounded lb:hover:bg-neutral-gray-50 lb:transition-colors";/* @__PURE__ */
|
|
324
300
|
return c("div",{role:"region","aria-label":k("aiStarter.label"),onClick:()=>{a(!r)},className:p,children:[
|
|
325
301
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:gap-2 lb:mb-2",children:[
|
|
326
302
|
/* @__PURE__ */c("label",{className:"lb:flex lb:items-center lb:gap-2 lb:cursor-pointer",onClick:e=>e.stopPropagation(),children:[
|
|
@@ -329,90 +305,90 @@ return c("div",{role:"region","aria-label":k("aiStarter.label"),onClick:()=>{a(!
|
|
|
329
305
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-1 lb:shrink-0",role:"group","aria-label":k("aiStarter.label"),children:[
|
|
330
306
|
/* @__PURE__ */s("button",{type:"button",onClick:t=>{t.stopPropagation(),"undefined"!=typeof navigator&&navigator.clipboard?.writeText&&navigator.clipboard.writeText(e).catch(()=>{}),b(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(function(){b(!1),m.current=null},2e3)},"aria-label":k(d?"aiStarter.copied":"aiStarter.copyAriaLabel"),"aria-live":"polite","aria-atomic":"true",className:g,children:k(d?"aiStarter.copied":"aiStarter.copy")}),
|
|
331
307
|
/* @__PURE__ */s("button",{type:"button",onClick:e=>{e.stopPropagation(),u(e=>!e)},"aria-expanded":o,"aria-controls":h,"aria-label":k(o?"aiStarter.readLess":"aiStarter.readMore"),className:"lb:text-xs lb:font-normal lb:text-neutral-gray-700 lb:px-2 lb:py-1 lb:rounded lb:hover:bg-neutral-gray-50 lb:transition-colors",children:k(o?"aiStarter.readLess":"aiStarter.readMore")})]})]}),
|
|
332
|
-
/* @__PURE__ */s("div",{id:h,className:f,children:e})]})}function
|
|
333
|
-
/* @__PURE__ */s("span",{className:"limbo-loader lb:mr-2"})," Cargando servicios IA..."]}):
|
|
334
|
-
/* @__PURE__ */s("h3",{id:"aiSelectDescription",className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000 lb:mb-3",children:"Selecciona el modelo IA"}),
|
|
335
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-row lb:flex-wrap lb:justify-around lb:items-stretch lb:justify-items-stretch lb:content-stretch lb:gap-3 lb:w-full lb:max-w-7xl",children:
|
|
308
|
+
/* @__PURE__ */s("div",{id:h,className:f,children:e})]})}function Et(e){return new Promise((t,n)=>{const l=new FileReader;l.onload=()=>t(l.result),l.onerror=n,l.readAsDataURL(e)})}function $t({prod:n,disabled:l,onSelect:r,selectedFolder:a,onFolderChange:i,folderConfig:o,aiStarterPrompt:d,tags:b=[],onTagsChange:m=null}){const h=xt(n),p=Ct(n),[f,g]=t(""),[v,y]=t(""),[w,x]=t({}),[k,C]=t(!1),[S,N]=t(null),[E,$]=t(null),[_,T]=t(null),[A,z]=t(!0),[L,M]=t(!1),[P,I]=t([null,null]),[D,R]=t([null,null]),[O,F]=t(null),[j,U]=t(!0),B=[e.useRef(null),e.useRef(null)],q=e.useRef([0,0]);e.useEffect(()=>{if(!h.loading&&1===h.services.length){const e=h.services[0];y(e.slug),z(!1),p.fetchParams(e.slug,!0)}},[h.loading,h.services]),e.useEffect(()=>{if(!v)return;const e=p.params?.[v]?.parameters;if(e){const t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default??""]));t.service=v,x(t)}},[v,p.params]);const W=e.useMemo(()=>{const e=h.services.find(e=>e.slug===v);if(e?.supportsImageInput)return!0;const t=p.params?.[v]?.parameters;return!!t&&Object.entries(t).some(([e,t])=>"image"===t.type||"file"===t.type||"image_data"===e||"image"===e||"reference_image"===e)},[v,h.services,p.params]),V=(e,t)=>{e&&(["image/jpeg","image/png","image/webp","image/svg+xml"].includes(e.type)?e.size>4194304?N("La imagen de referencia no puede superar los 4MB."):(I(n=>{const l=[...n];return l[t]=e,l}),R(n=>{const l=[...n];return l[t]&&URL.revokeObjectURL(l[t]),l[t]=URL.createObjectURL(e),l}),N(null)):N("Formato no soportado. Usa JPG, PNG, SVG o WebP."))},H=e=>t=>{V(t.target.files?.[0],e)},K=e=>t=>{t.preventDefault(),t.stopPropagation(),q.current[e]++,F(e)},G=e=>t=>{t.preventDefault(),t.stopPropagation(),q.current[e]--,0===q.current[e]&&F(null)},Q=e=>{e.preventDefault(),e.stopPropagation()},X=e=>t=>{t.preventDefault(),t.stopPropagation(),q.current[e]=0,F(null),V(t.dataTransfer?.files?.[0],e)},Y=e=>{I(t=>{const n=[...t];return n[e]=null,n}),R(t=>{const n=[...t];return n[e]&&URL.revokeObjectURL(n[e]),n[e]=null,n}),B[e]?.current&&(B[e].current.value="")};e.useEffect(()=>{const e=D;return()=>{e.forEach(e=>{e&&URL.revokeObjectURL(e)})}},[]);const Z=e=>{const{name:t,value:n}=e.target;x(e=>({...e,[t]:n}))},ee=async(e,t=!1)=>{e.preventDefault(),C(!0),N(null),$(null);try{t?w.prompt=f:g(w.prompt||"");const{image_data:e,...r}=w;let a={...r};a.prompt=function({starter:e,user:t,useStarter:n}){const l=null==e?"":String(e),r=null==t?"":String(t);return n&&""!==l?"Follow this instructions prompt: ```"+l+"``` to complete this request prompt: ```"+r+"```":r}({starter:d,user:a.prompt,useStarter:j}),P[0]&&(a.image=await Et(P[0])),P[1]&&(a.image2=await Et(P[1]));const i=await function(e,t=!1){return J({endpoint:"/ai/generate",method:"POST",body:e,prod:t,basePath:yt})}(a,n);let o=null;if(i?.data?.images&&Array.isArray(i.data.images)&&i.data.images.length>0?o=i.data.images[0]:i?.result?.images&&Array.isArray(i.result.images)&&i.result.images.length>0?o=i.result.images[0]:Array.isArray(i)&&i.length>0?o=i[0]:"string"==typeof i&&(o=i),!o)throw new Error("No se pudo extraer la imagen de la respuesta");if(o.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(o)}`,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(),l=new File([n],"ai-image.webp",{type:n.type||"image/webp"});T(l)}catch(l){throw new Error(`Error downloading image via proxy: ${l.message}`)}else{const e=o.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 l=new Uint8Array(n),r=new File([l],"ai-image.webp",{type:"image/webp"});T(r)}$(i?.data?.images||i?.result?.images||null)}catch(r){N(r.message||"Error al generar la imagen")}finally{C(!1)}};return h.loading?/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-center lb:py-8",children:[
|
|
309
|
+
/* @__PURE__ */s("span",{className:"limbo-loader lb:mr-2"})," Cargando servicios IA..."]}):h.services.length?/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:mx-4 lb:pb-2",children:/* @__PURE__ */c(u,A?{children:[
|
|
310
|
+
/* @__PURE__ */s("h3",{id:"aiSelectDescription",className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000 lb:mb-3",children:"Selecciona el modelo IA"}),h.error&&/* @__PURE__ */s(Se,{variant:"danger",children:h.error}),
|
|
311
|
+
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-row lb:flex-wrap lb:justify-around lb:items-stretch lb:justify-items-stretch lb:content-stretch lb:gap-3 lb:w-full lb:max-w-7xl",children:h.services.map(e=>/* @__PURE__ */c("button",{type:"button",onClick:()=>{y(e.slug),z(!1),x({}),$(null),N(null),T(null),p.fetchParams(e.slug,!0)},disabled:h.loading||l,className:`lb:group lb:relative lb:p-4 lb:rounded-lg lb:border-2 lb:transition-all lb:duration-200 lb:overflow-hidden lb:flex lb:flex-col lb:items-center lb:justify-center lb:min-h-30 lb:grow basis-sm lb:min-w-70 lb:border-gray-200 lb:hover:border-brand-blue-800 lb:hover:shadow-md lb:hover:text-black lb:lg:w-min ${h.loading||l?"lb:opacity-50 lb:cursor-not-allowed":"lb:cursor-pointer"} `,style:{position:"relative"},children:[e.image&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-cover lb:bg-center lb:transition-opacity lb:duration-200 lb:group-hover:opacity-35",style:{backgroundImage:`url(${e.image})`,opacity:.2}}),
|
|
336
312
|
/* @__PURE__ */c("div",{className:"lb:relative lb:z-10 lb:flex lb:flex-col lb:items-center lb:justify-center lb:gap-2 lb:text-center",children:[
|
|
337
313
|
/* @__PURE__ */s("span",{className:"lb:text-base lb:font-semibold lb:text-neutral-black-000",children:e.label}),e.description&&/* @__PURE__ */s("span",{className:"lb:text-sm lb:text-gray-950 lb:line-clamp-2 lb:drop-shadow lb:drop-shadow-neutral-white-000",children:e.description})]}),e.costInfo&&/* @__PURE__ */s("span",{className:"lb:absolute lb:top-0 lb:left-1 lb:inline-flex lb:items-center lb:gap-1 lb:py-0 lb:px-1 lb:mt-1 lb:text-xs lb:font-medium lb:text-warning-1000 lb:rounded-md lb:group-hover:bg-white/90",style:{zoom:"82%"},children:e.costInfo})]},e.slug))})]}:{children:[
|
|
338
314
|
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-wrap lb:items-center lb:gap-3 lb:mb-2",children:[
|
|
339
|
-
/* @__PURE__ */s("h3",{className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000",children:
|
|
315
|
+
/* @__PURE__ */s("h3",{className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000",children:h.services.find(e=>e.slug===v)?.label||"Generación IA"}),h.services.find(e=>e.slug===v)?.costInfo&&/* @__PURE__ */c("div",{title:"Coste estimado por imagen que le cuesta a la empresa, este coste depende de la calidad de la imagen generada y puede variar según el proveedor IA, ten en cuenta este coste para hacer un uso más responsable del servicio IA",className:"lb:flex lb:items-center lb:gap-1","aria-description":"Coste estimado por imagen que le cuesta a la empresa, este coste depende de la calidad de la imagen generada y puede variar según el proveedor IA, ten en cuenta este coste para hacer un uso más responsable del servicio IA",children:[
|
|
340
316
|
/* @__PURE__ */c("span",{className:"lb:inline-flex lb:items-center lb:gap-1 lb:px-2 lb:py-0.5 lb:text-xs lb:font-medium lb:text-warning-1000 lb:bg-yellow-200/60 lb:rounded-full lb:border lb:border-warning-1000 lb:select-none",children:[
|
|
341
|
-
/* @__PURE__ */s("span",{className:"icon icon-euro-blue icon--2sm icon--warning",style:{filter:"var(--limbo-icon-warning-dark)"}}),"Coste:"," ",
|
|
342
|
-
/* @__PURE__ */s("span",{className:"icon icon-info lb:cursor-help"})]})]}),
|
|
317
|
+
/* @__PURE__ */s("span",{className:"icon icon-euro-blue icon--2sm icon--warning",style:{filter:"var(--limbo-icon-warning-dark)"}}),"Coste:"," ",h.services.find(e=>e.slug===v)?.costInfo]}),
|
|
318
|
+
/* @__PURE__ */s("span",{className:"icon icon-info lb:cursor-help"})]})]}),p.loading&&/* @__PURE__ */s("div",{children:"Cargando parámetros..."}),p.error&&/* @__PURE__ */s(Se,{variant:"danger",children:p.error}),v&&(()=>{const e=p.params?.[v]?.parameters;if(!e)return null;const t=Object.entries(e).filter(([e,t])=>!t.hidden&&"image"!==t.type&&"file"!==t.type),n=t.filter(([e])=>e.toLowerCase().includes("prompt")||e.toLowerCase().includes("query")),r=t.filter(([e])=>!e.toLowerCase().includes("prompt")&&!e.toLowerCase().includes("query")),a=(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("prompt")?"Describe la imagen que deseas generar...":e.toLowerCase().includes("negative")?"Elementos a evitar en la imagen...":`Introduce ${(t.label||e).toLowerCase()}`);const r=e.toLowerCase().includes("prompt")||e.toLowerCase().includes("query");/* @__PURE__ */
|
|
343
319
|
return c("div",{className:"lb:flex lb:flex-col lb:gap-1",children:[
|
|
344
|
-
/* @__PURE__ */c("label",{htmlFor:`ai-${e}`,className:"lb:text-xs lb:font-medium lb:text-brand-blue-1000",children:[t.label||e,t.required&&/* @__PURE__ */s("span",{className:"lb:text-red-1000 lb:ml-1",children:"*"})]}),t.options?/* @__PURE__ */s("select",{id:`ai-${e}`,name:e,value:
|
|
345
|
-
return c("div",{className:"lb:h-fit lb:w-full",children:[
|
|
320
|
+
/* @__PURE__ */c("label",{htmlFor:`ai-${e}`,className:"lb:text-xs lb:font-medium lb:text-brand-blue-1000",children:[t.label||e,t.required&&/* @__PURE__ */s("span",{className:"lb:text-red-1000 lb:ml-1",children:"*"})]}),t.options?/* @__PURE__ */s("select",{id:`ai-${e}`,name:e,value:w[e]??"",onChange:Z,className:"limbo-input",disabled:l,title:t.label||e,children:t.options.map(e=>/* @__PURE__ */s("option",{value:e,children:e},e))}):r?/* @__PURE__ */s("textarea",{id:`ai-${e}`,name:e,value:w[e]??"",onChange:Z,className:"limbo-input lb:resize-none lb:overflow-y-auto",disabled:l,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__ */s("input",{id:`ai-${e}`,type:"integer"===t.type?"number":"text",name:e,value:w[e]??"",onChange:Z,className:"limbo-input",disabled:l,required:t.required,min:t.minValue,max:t.maxValue,placeholder:n,title:t.label||e})]},e)};/* @__PURE__ */
|
|
321
|
+
return c("div",{className:"lb:h-fit lb:w-full",children:[h.services.length>1&&/* @__PURE__ */c("button",{type:"button",onClick:()=>{z(!0),y(""),x({}),$(null),N(null),T(null),Y()},className:"lb:flex lb:cursor-pointer lb:items-center lb:gap-2 lb:text-brand-blue-800 lb:hover:text-brand-blue-1000 lb:mb-4 lb:font-medium",children:[
|
|
346
322
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left"}),"Volver al menú de servicios"]}),
|
|
347
323
|
/* @__PURE__ */c("div",{className:"lb:relative lb:max-w-[89dvw]",children:[
|
|
348
|
-
/* @__PURE__ */c("form",{onSubmit:
|
|
349
|
-
/* @__PURE__ */s(
|
|
350
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:gap-3",children:
|
|
324
|
+
/* @__PURE__ */c("form",{onSubmit:ee,"data-type":"ai",className:"lb:flex lb:flex-col lb:gap-3 lb:mt-4 lb:border-t lb:pt-4 lb:border-brand-blue-200","aria-label":"Formulario generación IA",children:[S&&/* @__PURE__ */s(Se,{variant:"danger",className:"lb:mb-2",children:S}),
|
|
325
|
+
/* @__PURE__ */s(Nt,{aiStarterPrompt:d,useStarter:j,onUseStarterChange:U}),
|
|
326
|
+
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:gap-3",children:n.map(([e,t])=>a(e,t))}),W&&/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:gap-2 lb:mt-1",children:[
|
|
351
327
|
/* @__PURE__ */c("label",{className:"lb:text-xs lb:font-medium lb:text-brand-blue-1000",children:["Imágenes de referencia",
|
|
352
328
|
/* @__PURE__ */s("span",{className:"lb:text-neutral-gray-500 lb:ml-1 lb:font-normal",children:"(opcional, máx. 2)"})]}),
|
|
353
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:gap-2",children:[0,1].map(e=>
|
|
354
|
-
/* @__PURE__ */s("div",{className:"lb:w-16 lb:h-16 lb:rounded lb:overflow-hidden lb:shrink-0 lb:bg-neutral-gray-100",children:/* @__PURE__ */s("img",{src:
|
|
329
|
+
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:gap-2",children:[0,1].map(e=>P[e]?/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-3 lb:p-2 lb:bg-neutral-gray-50 lb:border lb:border-neutral-gray-200 lb:rounded-lg",children:[
|
|
330
|
+
/* @__PURE__ */s("div",{className:"lb:w-16 lb:h-16 lb:rounded lb:overflow-hidden lb:shrink-0 lb:bg-neutral-gray-100",children:/* @__PURE__ */s("img",{src:D[e],alt:`Referencia ${e+1}`,className:"lb:w-full lb:h-full lb:object-cover"})}),
|
|
355
331
|
/* @__PURE__ */c("div",{className:"lb:flex-1 lb:min-w-0",children:[
|
|
356
332
|
/* @__PURE__ */c("p",{className:"lb:text-xs lb:text-neutral-gray-500 lb:mb-0.5",children:["Imagen ",e+1]}),
|
|
357
|
-
/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-neutral-gray-700 lb:truncate",children:
|
|
358
|
-
/* @__PURE__ */c("p",{className:"lb:text-xs lb:text-neutral-gray-500",children:[(
|
|
359
|
-
/* @__PURE__ */s("button",{type:"button",onClick:()=>
|
|
333
|
+
/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-neutral-gray-700 lb:truncate",children:P[e].name}),
|
|
334
|
+
/* @__PURE__ */c("p",{className:"lb:text-xs lb:text-neutral-gray-500",children:[(P[e].size/1024).toFixed(0)," KB"]})]}),
|
|
335
|
+
/* @__PURE__ */s("button",{type:"button",onClick:()=>Y(e),disabled:l||k,className:"lb:p-1.5 lb:text-neutral-gray-500 lb:cursor-pointer lb:hover:text-red-1000 lb:hover:bg-red-50 lb:rounded lb:transition-colors",title:`Quitar imagen ${e+1}`,children:/* @__PURE__ */c("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[
|
|
360
336
|
/* @__PURE__ */s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),
|
|
361
|
-
/* @__PURE__ */s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},e):(0===e||
|
|
337
|
+
/* @__PURE__ */s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},e):(0===e||P[0])&&/* @__PURE__ */c("label",{className:"lb:flex lb:items-center lb:justify-center lb:gap-2 lb:px-3 lb:py-2.5 lb:border lb:border-dashed lb:rounded-lg lb:cursor-pointer lb:transition-colors lb:text-sm "+(O===e?"lb:border-brand-blue-800 lb:bg-brand-blue-50/50 lb:text-brand-blue-800":"lb:border-neutral-gray-300 lb:text-neutral-gray-700 lb:hover:border-brand-blue-800 lb:hover:bg-brand-blue-50/30"),onDragEnter:K(e),onDragLeave:G(e),onDragOver:Q,onDrop:X(e),children:[
|
|
362
338
|
/* @__PURE__ */c("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[
|
|
363
339
|
/* @__PURE__ */s("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),
|
|
364
340
|
/* @__PURE__ */s("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),
|
|
365
|
-
/* @__PURE__ */s("polyline",{points:"21 15 16 10 5 21"})]}),
|
|
366
|
-
/* @__PURE__ */s("input",{ref:
|
|
367
|
-
/* @__PURE__ */c("button",{type:"button",onClick:()=>
|
|
368
|
-
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4 lb:transition-transform "+(
|
|
369
|
-
return s("button",{type:"submit",disabled:t,title:
|
|
370
|
-
/* @__PURE__ */s(
|
|
341
|
+
/* @__PURE__ */s("polyline",{points:"21 15 16 10 5 21"})]}),O===e?"Suelta la imagen aquí":0===e?"Subir imagen de referencia":"Añadir segunda imagen",
|
|
342
|
+
/* @__PURE__ */s("input",{ref:B[e],type:"file",accept:"image/jpeg,image/png,image/webp,image/svg+xml",onChange:H(e),disabled:l||k,className:"lb:sr-only"})]},e))})]}),r.length>0&&/* @__PURE__ */c("div",{className:"lb:border-t lb:border-gray-200 lb:pt-3",children:[
|
|
343
|
+
/* @__PURE__ */c("button",{type:"button",onClick:()=>M(!L),className:"lb:flex lb:items-center lb:gap-2 lb:text-sm lb:font-medium lb:text-brand-blue-800 lb:hover:text-brand-blue-1000 lb:mb-3 lb:transition-colors",children:[
|
|
344
|
+
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4 lb:transition-transform "+(L?"lb:rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),"Opciones avanzadas",!L&&/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-gray-500",children:["(",r.length," opciones)"]})]}),L&&/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:lg:grid-cols-3 lb:xl:grid-cols-4 lb:gap-3 lb:animate-fadeIn",children:r.map(([e,t])=>a(e,t))})]}),(()=>{const e=Object.entries(w).some(([e,t])=>(e.toLowerCase().includes("prompt")||e.toLowerCase().includes("query"))&&"string"==typeof t&&t.trim().length>=5),t=k||l||!e;/* @__PURE__ */
|
|
345
|
+
return s("button",{type:"submit",disabled:t,title:k?"Generando imagen...":e?_?"Generar otra imagen":"Generar imagen":"Escribe al menos 5 caracteres en el prompt",className:"limbo-btn lb:w-full lb:mt-2 "+(t?"lb:cursor-not-allowed limbo-btn-disabled":"limbo-btn-primary"),style:{minHeight:44},children:k?"Generando imagen...":_?"Generar otra imagen":"Generar imagen"})})()]}),
|
|
346
|
+
/* @__PURE__ */s(St,{show:k,message:"Generando imagen con IA..."})]})]})})(),_&&/* @__PURE__ */s("div",{className:"lb:mt-6 lb:md:w-full lb:mx-auto",children:/* @__PURE__ */s(ht,{image:_,onDiscard:()=>{T(null),$(null),N(null)},onRetry:e=>ee(e,!0),onDownload:()=>{},onSelect:e=>{if(r){const t=_||E;if(e&&t&&e!==t.name){const n=new File([t],e,{type:t.type});r(n)}else r(t)}},showRetry:!0,disabled:k||l,selectedFolder:a,onFolderChange:i,folderConfig:o,tags:b,onTagsChange:m})})]})}):/* @__PURE__ */s(Se,{variant:"warning",children:"No hay servicios IA disponibles."})}const _t="/api";const Tt=/* @__PURE__ */new Map;function At(e=!1){const[l,r]=t([]),[a,i]=t(!0),[o,s]=t(null);n(()=>{const t=`stock-services-${e}`,n=Tt.get(t),l=Date.now();if(n&&l-n.timestamp<864e5)return r(n.data),void i(!1);let a=!0;return(async()=>{try{const n=await function(e=!1){return J({endpoint:"/stock/services",prod:e,basePath:_t})}(e);if(!a)return;if(204===n?.httpCode||null===n?.data)return r([]),s("No hay servicios de stock disponibles en este momento"),void Tt.set(t,{data:[],timestamp:l});const i=n?.data||n?.result||[],o=Array.isArray(i)?i.map(e=>({label:e.name||e.label,slug:e.slug,type:e.type,description:e.description,image:e.image})):Object.entries(i).map(([e,t])=>({label:e,slug:t,type:"stock_image",description:null,image:null}));r(o),Tt.set(t,{data:o,timestamp:l})}catch(n){a&&s(n.message)}finally{a&&i(!1)}})(),()=>{a=!1}},[e]);return{services:l,loading:a,error:o,invalidateCache:()=>{Tt.delete(`stock-services-${e}`)}}}function zt({isOpen:e,image:l,onSelect:r,onCancel:a}){const[i,o]=t(null),[d,b]=t(!1),[m,h]=t(!1),[p,f]=t(!1);n(()=>{e&&l&&(o(l.previewUrl),b(!1),h(!1),f(!1))},[e,l]);const g=/* @__PURE__ */c("div",{className:"lb:flex lb:gap-2 lb:ml-4 lb:shrink-0",children:[
|
|
371
347
|
/* @__PURE__ */s("button",{type:"button",onClick:a,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-medium lb:text-white lb:border lb:border-white/30 lb:rounded-md lb:hover:bg-white/10 lb:transition-colors lb:cursor-pointer",children:"Cancelar"}),
|
|
372
348
|
/* @__PURE__ */s("button",{type:"button",onClick:r,className:"lb:px-4 lb:py-2 lb:text-sm lb:font-medium lb:bg-brand-blue-800 lb:text-white lb:rounded-md lb:hover:bg-brand-blue-1000 lb:transition-colors lb:cursor-pointer",children:"Seleccionar"})]});/* @__PURE__ */
|
|
373
|
-
return s(
|
|
349
|
+
return s(Pe,{isOpen:e,onClose:a,title:l?.title||"Previsualizar imagen",ariaLabel:"Previsualización de imagen externa",headerActions:g,children:/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center lb:w-full lb:h-full lb:p-4",children:p?/* @__PURE__ */c("div",{className:"lb:text-white/70 lb:text-sm lb:text-center",children:[
|
|
374
350
|
/* @__PURE__ */s("p",{children:"No se pudo cargar la imagen."}),
|
|
375
351
|
/* @__PURE__ */s("p",{className:"lb:text-xs lb:mt-1 lb:text-white/50",children:"Puedes seleccionarla igualmente para continuar."})]}):/* @__PURE__ */c(u,{children:[!m&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"limbo-loader"})}),
|
|
376
|
-
/* @__PURE__ */s("img",{src:i,alt:
|
|
352
|
+
/* @__PURE__ */s("img",{src:i,alt:l?.title||"Imagen",onLoad:()=>h(!0),onError:()=>{!d&&l?.proxyUrl&&l.proxyUrl!==i?(b(!0),o(l.proxyUrl)):f(!0)},className:"lb:max-w-full lb:object-contain lb:rounded lb:transition-opacity lb:duration-300 "+(m?"lb:opacity-100":"lb:opacity-0"),style:{maxHeight:"calc(100vh - 130px)"}},i)]})})})}function Lt({src:t,fallbackSrc:n,alt:l}){const[r,a]=e.useState(t),[i,o]=e.useState(!1),[u,d]=e.useState(!1);e.useEffect(()=>{a(t),o(!1),d(!1)},[t]);/* @__PURE__ */
|
|
377
353
|
return c("div",{className:"lb:relative lb:w-full lb:h-full",children:[!u&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-linear-to-r lb:from-gray-200 lb:via-gray-100 lb:to-gray-200 lb:animate-pulse"}),
|
|
378
|
-
/* @__PURE__ */s("img",{src:r,alt:
|
|
379
|
-
/* @__PURE__ */s("span",{className:"limbo-loader lb:mr-2"})," Cargando servicios de Stock..."]}):
|
|
380
|
-
/* @__PURE__ */s("h3",{className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000 lb:mb-3",children:"Selecciona el servicio de Stock"}),
|
|
381
|
-
/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:gap-3",children:
|
|
354
|
+
/* @__PURE__ */s("img",{src:r,alt:l,onLoad:()=>d(!0),onError:()=>{!i&&n&&n!==r&&(o(!0),a(n))},className:"lb:object-cover lb:w-full lb:h-full lb:transition-opacity lb:duration-300 "+(u?"lb:opacity-100":"lb:opacity-0"),loading:"lazy"})]})}function Mt({prod:n,disabled:l,onSelect:r,selectedFolder:a,onFolderChange:i,folderConfig:o,tags:d=[],onTagsChange:b=null}){const m=e.useRef(null),h=At(n),p=(e,t)=>{try{const n=sessionStorage.getItem(`limbo_stock_${e}`);return n?JSON.parse(n):t}catch{return t}},[f,g]=t(()=>p("selectedService","")),[v,y]=t(()=>p("dynamicForm",{})),[w,x]=t(()=>p("stockImages",[])),[k,C]=t(()=>p("currentPage",1)),[S,N]=t(()=>p("paginationInfo",null)),[E,$]=t(null),_=Ct(n),[T,A]=t(!1),[z,L]=t(null),[M,P]=t(null),[I,D]=t(!0),[R,O]=t(!1),[F,j]=t(null),[U,B]=t(null);e.useEffect(()=>{sessionStorage.setItem("limbo_stock_selectedService",JSON.stringify(f))},[f]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_dynamicForm",JSON.stringify(v))},[v]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_stockImages",JSON.stringify(w))},[w]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_currentPage",JSON.stringify(k))},[k]),e.useEffect(()=>{sessionStorage.setItem("limbo_stock_paginationInfo",JSON.stringify(S))},[S]),e.useEffect(()=>{if(!h.loading&&1===h.services.length){const e=h.services[0];g(e.slug),D(!1),_.fetchParams(e.slug,!0)}},[h.loading,h.services]),e.useEffect(()=>{if(!f)return;const e=_.params?.[f]?.parameters;if(e){const t=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default??""]));t.service=f,y(t)}},[f,_.params]);const q=e=>{const{name:t,value:n}=e.target;y(e=>({...e,[t]:n}))},W=async(e=1)=>{A(!0),L(null),1===e&&x([]);try{let t;if(1===e){const n=_.params?.[f]?.parameters,l={...v};Object.entries(n||{}).forEach(([e,t])=>{e in l||(l[e]=t.default??"")}),l.per_page=parseInt(l.per_page),l.service=f,l.page=e,t=l,m.current={...l}}else t={...m.current,page:e};const l=await function(e,t=!1){return J({endpoint:"/stock/search",method:"POST",body:e,prod:t,basePath:_t})}(t,n),r=l?.data?.images||[];let a=l?.data?.pagination||null,i=null;a&&(i={total:a.total_count??a.total??r.length,per_page:a.per_page??(Array.isArray(r)?r.length:0),current_page:a.page??a.current_page??e}),x(V(Array.isArray(r)?r:[])),N(i),C(i?.current_page||e)}catch(t){L(t.message||"Error al buscar imágenes")}finally{A(!1)}},V=e=>{const t=/* @__PURE__ */new Set,n=[];return(e||[]).forEach((e,l)=>{const r=e.url||e.preview_url||e.full||e.preview;r&&!t.has(r)&&(t.add(r),n.push({...e,preview:e.preview_url||e.preview||e.url||e.full,full:e.url||e.full||e.preview_url,id:e.id||l,title:e.title||e.filename||`Imagen ${l+1}`,source:e.service||f,sourceTitle:h.services.find(e=>e.slug===f)?.label||f}))}),n},H=async e=>{e.preventDefault();const t=v.query||v.search||v.term||"";t.trim().length<5?L("La búsqueda debe tener al menos 5 caracteres"):($(t),await W(1))},K=e=>{e<1||W(e)},Q=async e=>{P(e.id),L(null);try{const t={service:f,image_id:e.id},l=await function(e,t=!1){return J({endpoint:"/stock/download",method:"POST",body:e,prod:t,basePath:_t})}(t,n),r=l?.result?.url||l?.result?.download_url||l?.data?.images?.url||l?.data?.url||l?.images?.url||l?.url;if(!r)throw console.error("Download response structure:",l),new Error("No se pudo obtener la URL de descarga");{const t=`${G({prod:n})}/api/atenea/proxy?url=${encodeURIComponent(r)}`,a=await fetch(t,{credentials:"include",headers:{Authorization:`Bearer ${Y().token||""}`}});if(!a.ok)throw new Error(`Error al descargar imagen: ${a.status}`);const i=await a.blob(),o=l?.result?.filename||l?.data?.images?.filename||l?.data?.filename||`stock-${e.id}.jpg`,s=new File([i],o,{type:i.type||"image/jpeg"});j(s)}}catch(t){L(t.message||"No se pudo recuperar la imagen seleccionada")}finally{P(null)}};return h.loading?/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-center lb:py-8",children:[
|
|
355
|
+
/* @__PURE__ */s("span",{className:"limbo-loader lb:mr-2"})," Cargando servicios de Stock..."]}):h.services.length?/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:mx-4 lb:pb-2",children:/* @__PURE__ */c(u,I?{children:[
|
|
356
|
+
/* @__PURE__ */s("h3",{className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000 lb:mb-3",children:"Selecciona el servicio de Stock"}),h.error&&/* @__PURE__ */s(Se,{variant:"danger",children:h.error}),
|
|
357
|
+
/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:gap-3",children:h.services.map(e=>/* @__PURE__ */c("button",{type:"button",onClick:()=>{g(e.slug),D(!1),y({}),x([]),C(1),N(null),L(null),_.fetchParams(e.slug,!0)},disabled:h.loading||l,className:`lb:group lb:relative lb:p-4 lb:rounded-lg lb:border-2 lb:transition-all lb:duration-200 lb:overflow-hidden lb:flex lb:flex-col lb:items-center lb:justify-center lb:min-h-30 lb:border-gray-200 lb:hover:border-brand-blue-300 lb:hover:shadow-md lb:lg:w-min ${h.loading||l?"lb:opacity-50 lb:cursor-not-allowed":"lb:cursor-pointer"} `,style:{position:"relative"},children:[e.image&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-cover lb:bg-center lb:transition-opacity lb:duration-200 lb:group-hover:opacity-35",style:{backgroundImage:`url(${e.image})`,opacity:.2}}),
|
|
382
358
|
/* @__PURE__ */c("div",{className:"lb:relative lb:z-10 lb:flex lb:flex-col lb:items-center lb:justify-center lb:gap-2 lb:text-center",children:[
|
|
383
359
|
/* @__PURE__ */s("span",{className:"lb:text-base lb:font-semibold lb:text-neutral-black-000",children:e.label}),e.description&&/* @__PURE__ */s("span",{className:"lb:text-sm lb:text-gray-950 lb:line-clamp-2 lb:drop-shadow lb:drop-shadow-neutral-white-000",children:e.description})]})]},e.slug))})]}:{children:[
|
|
384
|
-
/* @__PURE__ */s("h3",{className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000",children:
|
|
360
|
+
/* @__PURE__ */s("h3",{className:"lb:text-2xl lb:font-semibold lb:text-brand-blue-1000",children:h.services.find(e=>e.slug===f)?.label||"Búsqueda Stock"}),_.loading&&/* @__PURE__ */s("div",{children:"Cargando parámetros..."}),_.error&&/* @__PURE__ */s(Se,{variant:"danger",children:_.error}),f&&(()=>{const e=_.params?.[f]?.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")),r=t.filter(([e])=>!e.toLowerCase().includes("query")&&!e.toLowerCase().includes("search")&&!e.toLowerCase().includes("term")),a=(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 r=e.toLowerCase().includes("query")||e.toLowerCase().includes("search")||e.toLowerCase().includes("term");/* @__PURE__ */
|
|
385
361
|
return c("div",{className:"lb:flex lb:flex-col lb:gap-1",children:[
|
|
386
362
|
/* @__PURE__ */c("label",{htmlFor:`stock-${e}`,className:"lb:text-xs lb:font-medium lb:text-brand-blue-1000",children:[t.label||e,t.required&&/* @__PURE__ */s("span",{className:"lb:text-red-1000 lb:ml-1",children:"*"})]}),t.options&&t.multiple?/* @__PURE__ */s("div",{className:"lb:flex lb:flex-wrap lb:gap-2 lb:min-h-[50px] lb:px-2 lb:justify-between lb:border-2 lb:border-gray-transparent-500 lb:rounded-lg",children:t.options.map(t=>/* @__PURE__ */c("label",{className:"lb:flex lb:items-center lb:gap-1",children:[
|
|
387
|
-
/* @__PURE__ */s("input",{type:"checkbox",name:`stock-${e}`,value:t,checked:Array.isArray(
|
|
388
|
-
/* @__PURE__ */s("span",{className:"lb:text-xs",children:t})]},t))}):t.options?/* @__PURE__ */s("select",{id:`stock-${e}`,name:e,value:
|
|
389
|
-
return c("div",{children:[
|
|
363
|
+
/* @__PURE__ */s("input",{type:"checkbox",name:`stock-${e}`,value:t,checked:Array.isArray(v[e])&&v[e].includes(t),onChange:()=>((e,t)=>{y(n=>{const l=Array.isArray(n[e])?n[e]:[];return l.includes(t)?{...n,[e]:l.filter(e=>e!==t)}:{...n,[e]:[...l,t]}})})(e,t),disabled:l}),
|
|
364
|
+
/* @__PURE__ */s("span",{className:"lb:text-xs",children:t})]},t))}):t.options?/* @__PURE__ */s("select",{id:`stock-${e}`,name:e,value:v[e]??"",onChange:q,className:"limbo-input",disabled:l,title:t.label||e,children:t.options.map(e=>/* @__PURE__ */s("option",{value:e,children:e},e))}):r?/* @__PURE__ */s("textarea",{id:`stock-${e}`,name:e,value:v[e]??"",onChange:q,className:"limbo-input lb:resize-none lb:overflow-y-auto",disabled:l,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__ */s("input",{id:`stock-${e}`,type:"integer"===t.type?"number":"text",name:e,value:v[e]??"",onChange:q,className:"limbo-input",disabled:l,required:t.required,min:t.minValue,max:t.maxValue,placeholder:n,title:t.label||e})]},e)};/* @__PURE__ */
|
|
365
|
+
return c("div",{children:[h.services.length>1&&/* @__PURE__ */c("button",{type:"button",onClick:()=>{D(!0),g(""),y({}),x([]),C(1),N(null),L(null)},className:"lb:flex lb:cursor-pointer lb:items-center lb:gap-2 lb:text-brand-blue-800 lb:hover:text-brand-blue-1000 lb:mb-4 lb:font-medium",children:[
|
|
390
366
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left"}),"Volver al menú de servicios"]}),
|
|
391
367
|
/* @__PURE__ */c("div",{className:"lb:relative lb:max-w-[89dvw]",children:[
|
|
392
|
-
/* @__PURE__ */c("form",{onSubmit:
|
|
393
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:gap-3",children:
|
|
394
|
-
/* @__PURE__ */c("button",{type:"button",onClick:()=>
|
|
395
|
-
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4 lb:transition-transform "+(
|
|
396
|
-
/* @__PURE__ */s("button",{type:"submit",disabled
|
|
397
|
-
/* @__PURE__ */s(
|
|
368
|
+
/* @__PURE__ */c("form",{onSubmit:H,"data-type":"stock",className:"lb:flex lb:flex-col lb:gap-3 lb:mt-4 lb:border-t-1 lb:pt-4 lb:border-brand-blue-200","aria-label":"Formulario búsqueda de imágenes de Stock",children:[z&&/* @__PURE__ */s(Se,{variant:"danger",className:"lb:mt-4",children:z}),
|
|
369
|
+
/* @__PURE__ */s("div",{className:"lb:flex lb:flex-col lb:gap-3",children:n.map(([e,t])=>a(e,t))}),r.length>0&&/* @__PURE__ */c("div",{className:"lb:border-t lb:border-gray-200 lb:pt-3",children:[
|
|
370
|
+
/* @__PURE__ */c("button",{type:"button",onClick:()=>O(!R),className:"lb:flex lb:items-center lb:gap-2 lb:text-sm lb:font-medium lb:text-brand-blue-800 lb:hover:text-brand-blue-1000 lb:mb-3 lb:transition-colors",children:[
|
|
371
|
+
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4 lb:transition-transform "+(R?"lb:rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),"Opciones avanzadas",!R&&/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-gray-500",children:["(",r.length," opciones)"]})]}),R&&/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-1 lb:md:grid-cols-2 lb:gap-3 lb:animate-fadeIn",children:r.map(([e,t])=>a(e,t))})]}),
|
|
372
|
+
/* @__PURE__ */s("button",{type:"submit",disabled:T||l,className:"limbo-btn lb:w-full lb:mt-2 "+(T?"lb:cursor-not-allowed limbo-btn-disabled":"limbo-btn-primary"),style:{minHeight:44},children:T?"Buscando...":"Buscar imágenes"})]}),
|
|
373
|
+
/* @__PURE__ */s(St,{show:T&&!w.length,message:"Buscando imágenes..."})]})]})})(),F&&/* @__PURE__ */s("div",{className:"lb:mt-6 lb:md:w-full lb:mx-auto",children:/* @__PURE__ */s(ht,{image:F,onDiscard:()=>{j(null),L(null)},onDownload:()=>{},onSelect:e=>{if(r)if(e&&F&&e!==F.name){const t=new File([F],e,{type:F.type});r(t)}else r(F)},showRetry:!1,disabled:l,selectedFolder:a,onFolderChange:i,folderConfig:o,tags:d,onTagsChange:b})}),!F&&w.length>0&&/* @__PURE__ */c(u,{children:[
|
|
398
374
|
/* @__PURE__ */c("div",{className:"lb:mt-6 lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:lg:grid-cols-4 lb:gap-1 lb:relative","aria-live":"polite",children:[
|
|
399
|
-
/* @__PURE__ */s(
|
|
400
|
-
return s("div",{className:"lb:border lb:border-brand-blue-200 lb:rounded-sm lb:overflow-hidden lb:bg-white lb:shadow-sm lb:hover:shadow-md lb:transition-all lb:duration-200 lb:cursor-pointer",title:"Ver imagen",onClick:()=>{
|
|
401
|
-
/* @__PURE__ */s(
|
|
375
|
+
/* @__PURE__ */s(St,{show:T,message:"Cargando imágenes..."}),w.map((e,t)=>{const r=G({prod:n}),a=e.preview||e.thumbnail||e.url,i=a?`${r}/api/atenea/proxy?url=${encodeURIComponent(a)}`:null;/* @__PURE__ */
|
|
376
|
+
return s("div",{className:"lb:border lb:border-brand-blue-200 lb:rounded-sm lb:overflow-hidden lb:bg-white lb:shadow-sm lb:hover:shadow-md lb:transition-all lb:duration-200 lb:cursor-pointer",title:"Ver imagen",onClick:()=>{M||T||l||B(e)},children:/* @__PURE__ */c("div",{className:"lb:relative lb:aspect-video lb:bg-neutral-100",children:[
|
|
377
|
+
/* @__PURE__ */s(Lt,{src:a,fallbackSrc:i,alt:e.title||`Resultado ${t+1}`}),M===e.id&&/* @__PURE__ */c("div",{className:"lb:absolute lb:inset-0 lb:bg-white/90 lb:flex lb:flex-col lb:items-center lb:justify-center lb:gap-2",children:[
|
|
402
378
|
/* @__PURE__ */c("div",{className:"lb:relative lb:w-10 lb:h-10",children:[
|
|
403
379
|
/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:border-4 lb:border-brand-blue-200 lb:rounded-full"}),
|
|
404
380
|
/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:border-4 lb:border-brand-blue-800 lb:rounded-full lb:border-t-transparent lb:animate-spin"})]}),
|
|
405
|
-
/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-medium lb:text-brand-blue-1000",children:"Descargando..."})]})]})},e.id||t)})]}),
|
|
406
|
-
/* @__PURE__ */c("button",{onClick:()=>
|
|
381
|
+
/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-medium lb:text-brand-blue-1000",children:"Descargando..."})]})]})},e.id||t)})]}),S&&/* @__PURE__ */c("div",{className:"lb:mt-6 lb:flex lb:items-center lb:justify-center lb:gap-2",children:[
|
|
382
|
+
/* @__PURE__ */c("button",{onClick:()=>K(S.current_page-1),disabled:S.current_page<=1||T,className:"limbo-btn limbo-btn-secondary px-4 py-2 disabled:opacity-25"+(S.current_page<=1||T?" pointer-events-none cursor-default":" limbo-btn-primary"),children:[
|
|
407
383
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left-white icon--sm"})," ","Anterior"]}),
|
|
408
|
-
/* @__PURE__ */c("span",{className:"lb:px-4 lb:py-2 lb:text-sm lb:text-neutral-700",children:["Página ",
|
|
409
|
-
/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-neutral-500 lb:block",children:["(",
|
|
410
|
-
/* @__PURE__ */c("button",{onClick:()=>
|
|
411
|
-
/* @__PURE__ */s("span",{className:"icon icon-arrow-right-white icon--sm"})]})]})]})
|
|
384
|
+
/* @__PURE__ */c("span",{className:"lb:px-4 lb:py-2 lb:text-sm lb:text-neutral-700",children:["Página ",S.current_page," de"," ",Math.max(1,Math.ceil(S.total/S.per_page)),
|
|
385
|
+
/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-neutral-500 lb:block",children:["(",S.total," imágenes totales)"]})]}),
|
|
386
|
+
/* @__PURE__ */c("button",{onClick:()=>K(S.current_page+1),disabled:T||S.current_page>=Math.ceil(S.total/S.per_page),className:"limbo-btn limbo-btn-secondary px-4 py-2 disabled:opacity-25"+(T||S.current_page>=Math.ceil(S.total/S.per_page)?" pointer-events-none cursor-default":" limbo-btn-primary"),children:["Siguiente"," ",
|
|
387
|
+
/* @__PURE__ */s("span",{className:"icon icon-arrow-right-white icon--sm"})]})]})]}),!T&&0===w.length&&f&&E&&/* @__PURE__ */c("div",{className:"lb:mt-6 lb:text-center lb:text-neutral-600 lb:py-8 lb:bg-neutral-50 lb:rounded-lg",children:[
|
|
412
388
|
/* @__PURE__ */s("span",{className:"icon icon-search icon--lg lb:mb-2"}),
|
|
413
|
-
/* @__PURE__ */c("p",{children:['No se encontraron imágenes para "',
|
|
414
|
-
/* @__PURE__ */s("p",{className:"lb:text-sm lb:mt-1",children:"Intenta con otros términos de búsqueda"})]}),
|
|
415
|
-
return s(
|
|
389
|
+
/* @__PURE__ */c("p",{children:['No se encontraron imágenes para "',v.query,'"']}),
|
|
390
|
+
/* @__PURE__ */s("p",{className:"lb:text-sm lb:mt-1",children:"Intenta con otros términos de búsqueda"})]}),U&&(()=>{const e=G({prod:n}),t=U.preview||U.thumbnail||U.url,l=t?`${e}/api/atenea/proxy?url=${encodeURIComponent(t)}`:null;/* @__PURE__ */
|
|
391
|
+
return s(zt,{isOpen:!!U,image:{previewUrl:t,proxyUrl:l,title:U.title||U.filename||"Imagen"},onCancel:()=>B(null),onSelect:()=>{const e=U;B(null),Q(e)}})})()]})}):/* @__PURE__ */s(Se,{variant:"warning",children:"No hay servicios de Stock disponibles."})}const Pt="/api";function It(e,t=!1){const n=new URLSearchParams;return e.portal&&n.set("portal",e.portal),e.media_type&&n.set("media_type",e.media_type),e.page&&n.set("page",String(e.page)),n.set("per_page",String(e.per_page)),e.search&&n.set("search",e.search),e.order&&n.set("order",e.order),J({endpoint:`/external/media?${n.toString()}`,method:"GET",prod:t,basePath:Pt})}const Dt=/* @__PURE__ */new Map;function Rt(e=!1){const[l,r]=t([]),[a,i]=t(!0),[o,s]=t(null);n(()=>{const t=`portal-sources-${e}`,n=Dt.get(t),l=Date.now();if(n&&l-n.timestamp<864e5)return r(n.data),void i(!1);let a=!0;return(async()=>{try{const n=await function(e=!1,t=!0){const n=new URLSearchParams;return n.set("active",t?"true":"false"),J({endpoint:`/external/portals?${n.toString()}`,method:"GET",prod:e,basePath:Pt})}(e,!0);if(!a)return;let i=n?.data||[];Array.isArray(i)||(i=[]);const o=i.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}));r(o),Dt.set(t,{data:o,timestamp:l})}catch(n){a&&s(n.message)}finally{a&&i(!1)}})(),()=>{a=!1}},[e]);return{sources:l,loading:a,error:o,invalidateCache:()=>{Dt.delete(`portal-sources-${e}`)}}}function Ot({isOpen:e=!1,video:n,onClose:l,onSelect:i=null}){const[o,d]=t(!1),b=r(()=>n?"youtube"===n.platform&&n.video_id?`https://www.youtube.com/embed/${n.video_id}?autoplay=1&rel=0`:"vimeo"===n.platform&&n.video_id?`https://player.vimeo.com/video/${n.video_id}?autoplay=1`:n.embed_url||null:null,[n]),m=r(()=>n&&(n.player_url||n.embed_url||n.post_url)||"",[n]),h=a(async()=>{if(m)try{await navigator.clipboard.writeText(m),d(!0),setTimeout(()=>d(!1),2e3)}catch{const e=document.createElement("textarea");e.value=m,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),d(!0),setTimeout(()=>d(!1),2e3)}},[m]),p=a(()=>{i&&n&&i(n)},[i,n]);if(!n)return null;const f=[n.portal_name,n.platform].filter(Boolean).join(" · "),g=i?/* @__PURE__ */c("button",{type:"button",onClick:p,className:"lb:flex lb:items-center lb:gap-2 lb:px-4 lb:py-1.5 lb:rounded-lg lb:bg-brand-blue-800 lb:hover:bg-brand-blue-900 lb:text-white lb:text-sm lb:font-medium lb:transition-colors","aria-label":"Seleccionar video",children:[
|
|
416
392
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),
|
|
417
393
|
/* @__PURE__ */s("span",{children:"Seleccionar"})]}):/* @__PURE__ */s("button",{type:"button",onClick:h,disabled:!m,className:"lb:flex lb:items-center lb:gap-2 lb:px-4 lb:py-1.5 lb:rounded-lg lb:text-sm lb:font-medium lb:transition-colors "+(o?"lb:bg-green-600 lb:text-white":"lb:bg-white/10 lb:hover:bg-white/20 lb:text-white"),"aria-label":"Copiar URL del video",children:/* @__PURE__ */c(u,o?{children:[
|
|
418
394
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),
|
|
@@ -420,63 +396,63 @@ return s(Ut,{isOpen:!!j,image:{previewUrl:t,proxyUrl:n,title:j.title||j.filename
|
|
|
420
396
|
/* @__PURE__ */s("svg",{className:"lb:w-4 lb:h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})}),
|
|
421
397
|
/* @__PURE__ */s("span",{children:"Copiar URL"})]})}),v=/* @__PURE__ */c("span",{children:[
|
|
422
398
|
/* @__PURE__ */s("kbd",{className:"lb:px-1.5 lb:py-0.5 lb:bg-white/10 lb:rounded lb:text-white",children:"ESC"})," ","cerrar"]});/* @__PURE__ */
|
|
423
|
-
return s(
|
|
399
|
+
return s(Pe,{isOpen:e,onClose:l,title:n.title||"Video",subtitle:f,ariaLabel:"Vista previa de video externo",headerActions:g,footerHints:v,children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:items-center lb:gap-3 lb:w-full lb:max-w-5xl lb:px-4",children:[
|
|
424
400
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2 lb:px-4 lb:py-2 lb:bg-amber-500/20 lb:border lb:border-amber-500/40 lb:rounded-lg lb:text-amber-200 lb:text-sm",children:[
|
|
425
401
|
/* @__PURE__ */s("svg",{className:"lb:w-5 lb:h-5 lb:shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),
|
|
426
402
|
/* @__PURE__ */c("span",{children:["Este video no se puede guardar en Limbo — alojado en"," ",
|
|
427
|
-
/* @__PURE__ */s("strong",{className:"lb:capitalize",children:
|
|
428
|
-
/* @__PURE__ */s("div",{className:"lb:relative lb:w-full lb:aspect-video lb:bg-black lb:rounded-lg lb:overflow-hidden",children:b?/* @__PURE__ */s("iframe",{src:b,className:"lb:absolute lb:inset-0 lb:w-full lb:h-full",allow:"autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0,title:
|
|
403
|
+
/* @__PURE__ */s("strong",{className:"lb:capitalize",children:n.platform||"plataforma externa"})]})]}),
|
|
404
|
+
/* @__PURE__ */s("div",{className:"lb:relative lb:w-full lb:aspect-video lb:bg-black lb:rounded-lg lb:overflow-hidden",children:b?/* @__PURE__ */s("iframe",{src:b,className:"lb:absolute lb:inset-0 lb:w-full lb:h-full",allow:"autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0,title:n.title||"Video"}):/* @__PURE__ */c("div",{className:"lb:absolute lb:inset-0 lb:flex lb:flex-col lb:items-center lb:justify-center lb:text-white lb:gap-3",children:[
|
|
429
405
|
/* @__PURE__ */s("svg",{className:"lb:w-16 lb:h-16 lb:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:/* @__PURE__ */s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})}),
|
|
430
|
-
/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-gray-400",children:"No se puede previsualizar este video"}),m&&/* @__PURE__ */s("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"lb:text-sm lb:text-brand-blue-400 lb:hover:text-brand-blue-300 lb:underline",children:"Abrir en nueva pestaña"})]})}),m&&/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-500 lb:truncate lb:max-w-full lb:px-2",children:m})]})})}const
|
|
431
|
-
/* @__PURE__ */s("img",{src:u,alt:
|
|
406
|
+
/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-gray-400",children:"No se puede previsualizar este video"}),m&&/* @__PURE__ */s("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"lb:text-sm lb:text-brand-blue-400 lb:hover:text-brand-blue-300 lb:underline",children:"Abrir en nueva pestaña"})]})}),m&&/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-500 lb:truncate lb:max-w-full lb:px-2",children:m})]})})}const Ft=({src:t,fallbackSrc:n,alt:l,className:r,onError:a})=>{const[i,o]=e.useState("loading"),[u,d]=e.useState(t),[b,m]=e.useState(!1);return"error"===i?null:/* @__PURE__ */c("div",{className:"lb:relative lb:w-full lb:h-full",children:["loading"===i&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-linear-to-r lb:from-gray-200 lb:via-gray-100 lb:to-gray-200 lb:animate-pulse lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{className:"icon icon-spinner lb:w-8 lb:h-8 lb:text-gray-400 lb:animate-spin"})}),
|
|
407
|
+
/* @__PURE__ */s("img",{src:u,alt:l,className:`${r} ${"loading"===i?"lb:opacity-0":"lb:opacity-100"} lb:transition-opacity lb:duration-300`,loading:"lazy",onLoad:()=>{o("loaded")},onError:()=>{n&&!b?(m(!0),d(n),o("loading")):(o("error"),a&&a())}})]})};function jt({prod:e,disabled:n,onSelect:i,onVideoSelect:o,selectedFolder:d,onFolderChange:b,folderConfig:m,resolvedAccept:h=null,returnConfig:p=null,tags:f=[],onTagsChange:g=null}){const{sources:v,loading:y,error:w}=Rt(e),x=r(()=>{if(!h||h.isAllTypes)return[{value:"images",label:"Imágenes"},{value:"videos",label:"Vídeos"},{value:"all",label:"Todo"}];const e=[];return h.includesImages&&e.push({value:"images",label:"Imágenes"}),h.includesVideos&&e.push({value:"videos",label:"Vídeos"}),e.length>1&&e.push({value:"all",label:"Todo"}),e.length>0?e:[{value:"images",label:"Imágenes"}]},[h]),k=x[0]?.value||"images",[C,S]=t(null),[N,E]=t(k),[$,_]=t(""),[T,A]=t([]),[z,L]=t(1),[M,P]=t(null),[I,D]=t(!1),[R,O]=t(null),[F,j]=t(null),[U,B]=t(null),[q,W]=t(/* @__PURE__ */new Set),[V,H]=t(!1),[K,Q]=t(null),[X,Y]=t(null),J=!!p&&"url"===p.format,Z=l({}),ee=a((e,t,n,l)=>`${e}_${t}_${n}_${l}`,[]),te=a(async(t,n,l,r)=>{const a=ee(t,n,l,r),i=Z.current[a];if(i)return A(i.items),P(i.pagination),L(r),O(null),void H(!0);D(!0),O(null);try{const i={portal:t,media_type:n,page:r,per_page:20};l.trim()&&(i.search=l.trim());const o=new Promise((e,t)=>setTimeout(()=>t(new Error("__timeout__")),25e3)),s=await Promise.race([It(i,e),o]),c=s?.data||{},u=c.items||[],d=c.pagination||{total_items:u.length,total_pages:1,current_page:r,per_page:20};Z.current[a]={items:u,pagination:d},A(u),P(d),L(r),W(/* @__PURE__ */new Set),H(!0),0===u.length&&O("No se encontraron resultados para este portal.")}catch(o){const e="__timeout__"===o.message;O(e?"El portal tardó demasiado en responder. Puede estar temporalmente no disponible. Inténtalo de nuevo.":o.message||"Error al cargar media del portal"),A([]),P(null),H(!0)}finally{D(!1)}},[e,ee]),ne=a(e=>{e!==C&&(S(e),_(""),E(k),A([]),P(null),O(null),j(null),Q(null),W(/* @__PURE__ */new Set),H(!1),Z.current={},te(e,k,"",1))},[C,k,te]),le=a(()=>{S(null),A([]),P(null),O(null),_(""),j(null),Q(null),W(/* @__PURE__ */new Set),H(!1),Z.current={}},[]),re=a(()=>{C&&(Z.current={},te(C,N,$,1))},[C,N,$,te]),ae=a(e=>{"Enter"===e.key&&(e.preventDefault(),re())},[re]),ie=a(e=>{e<1||!C||te(C,N,$,e)},[C,N,$,te]),oe=a(e=>{Q(null),o?o(e):i&&i(e)},[o,i]),se=a(async t=>{if("video"===t.type){const e={type:"video",source:"portal",title:t.title||"",thumbnail:t.thumbnail||t.url,embed_url:t.embed_url||null,player_url:t.player_url||null,post_url:t.post_url||null,platform:t.platform||null,video_id:t.video_id||null,portal_slug:t.portal_slug||C,portal_name:t.portal_name||v.find(e=>e.slug===C)?.name||null,date_published:t.date_published||null,author:t.author||null};return void Q(e)}const n=t.url||t.thumbnail;if(n){B(n),O(null);try{let l=null;try{const e=await fetch(n,{mode:"cors"});e.ok&&(l=await e.blob())}catch{}if(!l){const t=`${G({prod:e})}/api/external/proxy?url=${encodeURIComponent(n)}`,r=await fetch(t);if(!r.ok)throw new Error(`Error al descargar: ${r.status}`);l=await r.blob()}const r=t.title?`${t.title.substring(0,80)}.${"image/png"===t.mime_type?"png":"jpg"}`:`portal-${Date.now()}.jpg`,a=new File([l],r,{type:l.type||t.mime_type||"image/jpeg"});j(a)}catch(l){O(l.message||"No se pudo recuperar la imagen del portal")}finally{B(null)}}else O("No se encontró URL de la imagen")},[e,C,v]);if(y)/* @__PURE__ */
|
|
432
408
|
return c("div",{className:"lb:flex lb:items-center lb:justify-center lb:py-8",children:[
|
|
433
|
-
/* @__PURE__ */s("span",{className:"limbo-loader lb:mr-2"})," Cargando portales disponibles..."]});if(!
|
|
434
|
-
return s(Se,{variant:"warning",children:"No hay portales externos disponibles."});if(!
|
|
409
|
+
/* @__PURE__ */s("span",{className:"limbo-loader lb:mr-2"})," Cargando portales disponibles..."]});if(!v.length)/* @__PURE__ */
|
|
410
|
+
return s(Se,{variant:"warning",children:"No hay portales externos disponibles."});if(!C)/* @__PURE__ */
|
|
435
411
|
return c("div",{className:"lb:flex lb:flex-col lb:gap-4",children:[
|
|
436
|
-
/* @__PURE__ */s("h3",{className:"lb:text-lg lb:font-semibold lb:text-brand-blue-1000",children:"Selecciona un Portal"}),
|
|
437
|
-
/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:gap-3",children:
|
|
412
|
+
/* @__PURE__ */s("h3",{className:"lb:text-lg lb:font-semibold lb:text-brand-blue-1000",children:"Selecciona un Portal"}),w&&/* @__PURE__ */s(Se,{variant:"danger",children:w}),
|
|
413
|
+
/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:gap-3",children:v.map(e=>/* @__PURE__ */s("button",{type:"button",onClick:()=>ne(e.slug),disabled:n,className:"lb:relative lb:p-4 lb:rounded-lg lb:border-2 lb:transition-all lb:duration-200 lb:flex lb:flex-col lb:items-center lb:justify-center lb:min-h-25 lb:gap-2 lb:max-h-27.5 lb:box-border lb:border-gray-200 lb:bg-white lb:hover:border-brand-blue-350 lb:hover:shadow-md "+(n?"lb:opacity-50 lb:cursor-not-allowed":"lb:cursor-pointer"),children:e.image?/* @__PURE__ */s("img",{className:"lb:object-auto lb:bg-no-repeat lb:bg-center lb:max-h-full lb:object-contain lb:h-full lb:px-16",src:e.image,alt:e.title}):/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-medium lb:text-brand-blue-800",children:e.name})},e.slug))})]});const ce=v.find(e=>e.slug===C),ue=G({prod:e});/* @__PURE__ */
|
|
438
414
|
return c("div",{className:"lb:flex lb:flex-col lb:gap-3",children:[
|
|
439
415
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-3",children:[
|
|
440
|
-
/* @__PURE__ */c("button",{type:"button",onClick:
|
|
416
|
+
/* @__PURE__ */c("button",{type:"button",onClick:le,className:"lb:flex lb:items-center lb:gap-1 lb:text-sm lb:text-brand-blue-800 lb:hover:text-brand-blue-1000 lb:font-medium lb:transition-colors",children:[
|
|
441
417
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left icon--sm"}),"Portales"]}),
|
|
442
418
|
/* @__PURE__ */s("span",{className:"lb:text-gray-300",children:"|"}),
|
|
443
|
-
/* @__PURE__ */s("h3",{className:"lb:text-lg lb:font-semibold lb:text-brand-blue-1000",children:
|
|
444
|
-
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:gap-3 lb:border-t lb:pt-3 lb:border-brand-blue-200",children:[
|
|
419
|
+
/* @__PURE__ */s("h3",{className:"lb:text-lg lb:font-semibold lb:text-brand-blue-1000",children:ce?.name||C})]}),
|
|
420
|
+
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:gap-3 lb:border-t lb:pt-3 lb:border-brand-blue-200",children:[x.length>1&&/* @__PURE__ */s("div",{className:"lb:flex lb:gap-2",children:x.map(({value:e,label:t})=>/* @__PURE__ */s("button",{type:"button",onClick:()=>E(e),disabled:n||I,className:"lb:px-3 lb:py-1.5 lb:text-sm lb:rounded-md lb:font-medium lb:transition-colors "+(N===e?"lb:bg-brand-blue-800 lb:text-white":"lb:bg-gray-100 lb:text-gray-700 lb:hover:bg-gray-200"),children:t},e))}),
|
|
445
421
|
/* @__PURE__ */c("div",{className:"lb:flex lb:gap-2",children:[
|
|
446
|
-
/* @__PURE__ */s("input",{type:"text",value
|
|
447
|
-
/* @__PURE__ */c("button",{type:"button",onClick:
|
|
422
|
+
/* @__PURE__ */s("input",{type:"text",value:$,onChange:e=>_(e.target.value),onKeyDown:ae,className:"limbo-input lb:flex-1",placeholder:"Buscar en el portal...",disabled:n||I}),
|
|
423
|
+
/* @__PURE__ */c("button",{type:"button",onClick:re,disabled:n||I,className:"limbo-btn limbo-btn-primary lb:px-4 lb:py-2 lb:text-sm lb:font-medium lb:whitespace-nowrap lb:flex lb:items-center lb:gap-1.5",children:[/* @__PURE__ */s("span",I?{className:"limbo-loader limbo-loader--sm"}:{className:"icon icon-search-white icon--sm"}),"Buscar"]})]})]}),R&&!I&&/* @__PURE__ */s(Se,{variant:"warning",children:R}),F&&/* @__PURE__ */s("div",{className:"lb:mt-2 lb:md:w-full lb:mx-auto",children:/* @__PURE__ */s(ht,{image:F,onDiscard:()=>{j(null),O(null)},onDownload:()=>{},onSelect:e=>{if(i)if(e&&F&&e!==F.name){const t=new File([F],e,{type:F.type});i(t)}else i(F)},showRetry:!1,disabled:n,selectedFolder:d,onFolderChange:b,folderConfig:m,tags:f,onTagsChange:g})}),!F&&/* @__PURE__ */c(u,{children:[
|
|
448
424
|
/* @__PURE__ */c("div",{className:"lb:relative lb:min-h-50","aria-live":"polite",children:[I&&/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:bg-white/80 lb:z-10 lb:flex lb:items-center lb:justify-center lb:rounded-lg",children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:items-center lb:gap-2",children:[
|
|
449
425
|
/* @__PURE__ */s("span",{className:"limbo-loader"}),
|
|
450
|
-
/* @__PURE__ */s("span",{className:"lb:text-sm lb:text-brand-blue-800",children:"Cargando media..."})]})})
|
|
451
|
-
/* @__PURE__ */s(
|
|
452
|
-
return c("div",{className:"lb:group lb:border lb:border-brand-blue-200 lb:rounded-lg lb:overflow-hidden lb:bg-white lb:shadow-sm lb:hover:shadow-md lb:transition-all lb:duration-200 lb:cursor-pointer",onClick:()=>{
|
|
426
|
+
/* @__PURE__ */s("span",{className:"lb:text-sm lb:text-brand-blue-800",children:"Cargando media..."})]})}),T.length>0&&/* @__PURE__ */c("div",{className:"lb:relative lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:lg:grid-cols-4 lb:gap-2",children:[
|
|
427
|
+
/* @__PURE__ */s(St,{show:I,message:"Cargando media..."}),T.map((e,t)=>{const l=`${e.portal_slug}-${e.id||t}`,r=e.thumbnail||e.url;if(q.has(l)||!r)return null;const a=`${ue}/api/external/proxy?url=${encodeURIComponent(r)}`,i="video"===e.type;/* @__PURE__ */
|
|
428
|
+
return c("div",{className:"lb:group lb:border lb:border-brand-blue-200 lb:rounded-lg lb:overflow-hidden lb:bg-white lb:shadow-sm lb:hover:shadow-md lb:transition-all lb:duration-200 lb:cursor-pointer",onClick:()=>{U||I||n||(i?se(e):Y(e))},children:[
|
|
453
429
|
/* @__PURE__ */c("div",{className:"lb:relative lb:aspect-video lb:bg-neutral-100",children:[
|
|
454
|
-
/* @__PURE__ */s(
|
|
430
|
+
/* @__PURE__ */s(Ft,{src:r,fallbackSrc:a,alt:e.alt||e.title||`Media ${t+1}`,className:"lb:object-cover lb:w-full lb:h-full",onError:()=>{W(e=>{const t=new Set(e);return t.add(l),t})}}),i&&/* @__PURE__ */s("span",{className:"lb:absolute lb:top-1 lb:left-1 lb:bg-black/60 lb:text-white lb:text-xs lb:px-2 lb:py-1 lb:rounded",children:"Video"}),U===(e.url||e.thumbnail)?/* @__PURE__ */c("div",{className:"lb:absolute lb:inset-0 lb:bg-white/90 lb:flex lb:flex-col lb:items-center lb:justify-center lb:gap-2",children:[
|
|
455
431
|
/* @__PURE__ */c("div",{className:"lb:relative lb:w-10 lb:h-10",children:[
|
|
456
432
|
/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:border-4 lb:border-brand-blue-200 lb:rounded-full"}),
|
|
457
433
|
/* @__PURE__ */s("div",{className:"lb:absolute lb:inset-0 lb:border-4 lb:border-brand-blue-800 lb:rounded-full lb:border-t-transparent lb:animate-spin"})]}),
|
|
458
434
|
/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-medium lb:text-brand-blue-1000",children:"Descargando..."})]}):i?
|
|
459
435
|
/* @__PURE__ */c("div",{className:"lb:absolute lb:inset-0 lb:bg-black/0 lb:group-hover:bg-black/60 lb:transition-colors lb:duration-200 lb:flex lb:items-center lb:justify-center lb:flex-col lb:gap-1",children:[
|
|
460
436
|
/* @__PURE__ */s("svg",{className:"lb:w-10 lb:h-10 lb:opacity-0 lb:group-hover:opacity-100 lb:transition-opacity lb:duration-200 lb:text-white",viewBox:"0 0 24 24",fill:"currentColor",children:/* @__PURE__ */s("path",{d:"M8 5v14l11-7z"})}),
|
|
461
|
-
/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-medium lb:text-white lb:opacity-0 lb:group-hover:opacity-100 lb:transition-opacity lb:duration-200",children:"Seleccionar vídeo"})]}):null]}),e.title&&/* @__PURE__ */s("div",{className:"lb:px-2 lb:pb-2 lb:pt-1",children:/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-600 lb:truncate",title:e.title,children:e.title})})]},
|
|
437
|
+
/* @__PURE__ */s("span",{className:"lb:text-sm lb:font-medium lb:text-white lb:opacity-0 lb:group-hover:opacity-100 lb:transition-opacity lb:duration-200",children:"Seleccionar vídeo"})]}):null]}),e.title&&/* @__PURE__ */s("div",{className:"lb:px-2 lb:pb-2 lb:pt-1",children:/* @__PURE__ */s("p",{className:"lb:text-xs lb:text-gray-600 lb:truncate",title:e.title,children:e.title})})]},l)})]}),!V&&!I&&0===T.length&&!R&&/* @__PURE__ */c("div",{className:"lb:text-center lb:text-neutral-600 lb:py-10 lb:bg-neutral-50 lb:rounded-lg",children:[
|
|
462
438
|
/* @__PURE__ */s("p",{className:"lb:font-medium lb:text-brand-blue-800",children:"Cargando contenido del portal..."}),
|
|
463
|
-
/* @__PURE__ */s("p",{className:"lb:text-sm lb:mt-1 lb:text-neutral-500",children:"También puedes buscar por término específico"})]}),
|
|
439
|
+
/* @__PURE__ */s("p",{className:"lb:text-sm lb:mt-1 lb:text-neutral-500",children:"También puedes buscar por término específico"})]}),V&&!I&&0===T.length&&!R&&/* @__PURE__ */c("div",{className:"lb:text-center lb:text-neutral-600 lb:py-8 lb:bg-neutral-50 lb:rounded-lg",children:[
|
|
464
440
|
/* @__PURE__ */s("span",{className:"icon icon-search icon--lg lb:mb-2"}),
|
|
465
|
-
/* @__PURE__ */s("p",{children:"No se encontraron resultados"})
|
|
466
|
-
/* @__PURE__ */c("button",{onClick:()=>
|
|
441
|
+
/* @__PURE__ */s("p",{children:"No se encontraron resultados"}),$&&/* @__PURE__ */s("p",{className:"lb:text-sm lb:mt-1",children:"Intenta con otros términos de búsqueda"})]})]}),M&&M.total_pages>1&&/* @__PURE__ */c("div",{className:"lb:mt-4 lb:flex lb:items-center lb:justify-center lb:gap-2",children:[
|
|
442
|
+
/* @__PURE__ */c("button",{onClick:()=>ie(z-1),disabled:1===z||I,className:"limbo-btn limbo-btn-secondary px-4 py-2 disabled:opacity-25"+(1===z||I?" pointer-events-none cursor-default":" limbo-btn-primary"),children:[
|
|
467
443
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-left-white icon--sm"})," ","Anterior"]}),
|
|
468
|
-
/* @__PURE__ */c("span",{className:"lb:px-4 lb:py-2 lb:text-sm lb:text-neutral-700",children:["Página ",
|
|
469
|
-
/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-neutral-500 lb:block",children:["(",
|
|
470
|
-
/* @__PURE__ */c("button",{onClick:()=>
|
|
444
|
+
/* @__PURE__ */c("span",{className:"lb:px-4 lb:py-2 lb:text-sm lb:text-neutral-700",children:["Página ",z," de ",M.total_pages,
|
|
445
|
+
/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-neutral-500 lb:block",children:["(",M.total_items," resultados)"]})]}),
|
|
446
|
+
/* @__PURE__ */c("button",{onClick:()=>ie(z+1),disabled:I||z>=M.total_pages,className:"limbo-btn limbo-btn-secondary px-4 py-2 disabled:opacity-25"+(I||z>=M.total_pages?" pointer-events-none cursor-default":" limbo-btn-primary"),children:["Siguiente"," ",
|
|
471
447
|
/* @__PURE__ */s("span",{className:"icon icon-arrow-right-white icon--sm"})]})]})]}),
|
|
472
|
-
/* @__PURE__ */s(
|
|
473
|
-
return s(
|
|
448
|
+
/* @__PURE__ */s(Ot,{isOpen:!!K,video:K,onClose:()=>Q(null),onSelect:J?oe:null}),X&&(()=>{const e=X.thumbnail||X.url,t=`${ue}/api/external/proxy?url=${encodeURIComponent(e)}`;/* @__PURE__ */
|
|
449
|
+
return s(zt,{isOpen:!!X,image:{previewUrl:e,proxyUrl:t,title:X.title||X.alt||"Imagen"},onCancel:()=>Y(null),onSelect:()=>{const e=X;Y(null),se(e)}})})()]})}const Ut=[{id:"upload",label:"Subir archivo"},{id:"ai",label:"Generar"},{id:"stock",label:"Buscar en Stock"},{id:"portals",label:"Otros portales"}];function Bt({onSelect:e,onVideoSelect:n,disabled:a=!1,apiKey:i,prod:o=!1,allowedCategories:u=null,resolvedAccept:d=null,returnConfig:b=null,folderConfig:m=null,selectedFolder:h=null,onFolderChange:p=null,aiStarterPrompt:f,tags:g=[],onTagsChange:v=null}){const{isMobile:y,isTouch:w}=D(),x=r(()=>!d||d.isAllTypes||d.includesImages?Ut:d.includesVideos?Ut.filter(e=>"upload"===e.id||"portals"===e.id):Ut.filter(e=>"upload"===e.id),[d]),[k,C]=t("upload"),[S,N]=t(null),[E,$]=t(null),_=l(),T=["limbo-tabs","lb:flex","lb:gap-4","lb:border-b-2","lb:border-brand-blue-200","lb:mb-4",y&&"lb:overflow-x-auto lb:scrollbar-none"].filter(Boolean).join(" "),A=e=>{const t=["limbo-tab","lb:relative","lb:px-4","lb:py-2","lb:font-medium","lb:text-brand-blue-1000","lb:bg-transparent","lb:border-0","lb:border-b-2","lb:cursor-pointer","lb:transition-all","lb:duration-200","lb:hover:text-pink-1000","lb:focus:outline-none","lb:focus-visible:ring-2","lb:focus-visible:ring-brand-blue-400","lb:focus-visible:ring-offset-2","lb:text-nowrap"];return e?t.push("lb:border-b-brand-blue-1000","lb:font-semibold","limbo-active"):t.push("lb:border-b-transparent"),y&&t.push("lb:min-w-[100px]","lb:min-h-[44px]","lb:text-sm","lb:shrink-0"),w&&t.push("lb:touch-manipulation"),t.join(" ")};/* @__PURE__ */
|
|
474
450
|
return c("div",{className:"limbo-upload-form lb:py-4 lb:max-w-7xl lb:mx-auto",children:[x.length>1&&/* @__PURE__ */s("div",{className:T,role:"tablist","aria-label":"Opciones de subida",style:y?{WebkitOverflowScrolling:"touch",scrollbarWidth:"none",msOverflowStyle:"none"}:void 0,children:x.map(e=>{const t=k===e.id;/* @__PURE__ */
|
|
475
|
-
return c("button",{type:"button","data-upload-tab-id":e.id,className:A(t),"aria-current":t?"page":void 0,"aria-selected":t,role:"tab",tabIndex:t?0:-1,onClick:()=>C(e.id),onKeyDown:t=>((e,t)=>{const
|
|
476
|
-
/* @__PURE__ */c("div",{className:"limbo-tab-content lb:px-2 lb:py-2",role:"tabpanel",id:`upload-tabpanel-${k}`,"aria-labelledby":`upload-tab-${k}`,children:["upload"===k&&/* @__PURE__ */s(
|
|
477
|
-
return c("div",{children:[
|
|
451
|
+
return c("button",{type:"button","data-upload-tab-id":e.id,className:A(t),"aria-current":t?"page":void 0,"aria-selected":t,role:"tab",tabIndex:t?0:-1,onClick:()=>C(e.id),onKeyDown:t=>((e,t)=>{const n=x.findIndex(e=>e.id===t);let l=n;switch(e.key){case"ArrowLeft":e.preventDefault(),l=n>0?n-1:x.length-1;break;case"ArrowRight":e.preventDefault(),l=n<x.length-1?n+1:0;break;case"Home":e.preventDefault(),l=0;break;case"End":e.preventDefault(),l=x.length-1;break;case"Enter":case" ":return e.preventDefault(),void C(t);default:return}const r=x[l];r&&(C(r.id),setTimeout(()=>{const e=document.querySelector(`[data-upload-tab-id="${r.id}"]`);e&&e.focus()},0))})(t,e.id),id:`upload-tab-${e.id}`,"aria-controls":`upload-tabpanel-${e.id}`,style:w?{WebkitTapHighlightColor:"transparent"}:void 0,children:["ai"===e.id?/* @__PURE__ */s("span",{className:"icon icon-ia lb:me-1"}):null,e.label]},e.id)})}),
|
|
452
|
+
/* @__PURE__ */c("div",{className:"limbo-tab-content lb:px-2 lb:py-2",role:"tabpanel",id:`upload-tabpanel-${k}`,"aria-labelledby":`upload-tab-${k}`,children:["upload"===k&&/* @__PURE__ */s(vt,{file:S,setFile:N,previewUrl:E,setPreviewUrl:$,fileInputRef:_,onSelect:e,disabled:a,allowedCategories:u,resolvedAccept:d,selectedFolder:h,onFolderChange:p,folderConfig:m,tags:g,onTagsChange:v}),"ai"===k&&/* @__PURE__ */s($t,{apiKey:i,prod:o,disabled:a,onSelect:e,selectedFolder:h,onFolderChange:p,folderConfig:m,aiStarterPrompt:f,tags:g,onTagsChange:v}),"stock"===k&&/* @__PURE__ */s(Mt,{apiKey:i,prod:o,disabled:a,onSelect:e,selectedFolder:h,onFolderChange:p,folderConfig:m,tags:g,onTagsChange:v}),"portals"===k&&/* @__PURE__ */s(jt,{apiKey:i,prod:o,disabled:a,onSelect:e,onVideoSelect:n,resolvedAccept:d,returnConfig:b,selectedFolder:h,onFolderChange:p,folderConfig:m,tags:g,onTagsChange:v})]})]})}function qt({onSelect:e,onVideoSelect:t,onFolderChange:n,uploading:l,uploadError:r,uploadedImage:a,selectedUploadFolder:i,apiKey:o,prod:u,allowedCategories:d,resolvedAccept:b,returnConfig:m,folderConfig:h,aiStarterPrompt:p,resetUpload:f,tags:g,onTagsChange:v}){/* @__PURE__ */
|
|
453
|
+
return c("div",{children:[l&&/* @__PURE__ */s(ut,{text:"Subiendo archivo..."}),r&&/* @__PURE__ */c(Se,{variant:"danger",toast:!0,onClose:f,children:["Error al subir archivo: ",r]}),a&&/* @__PURE__ */c(Se,{variant:"success",toast:!0,onClose:f,children:[
|
|
478
454
|
/* @__PURE__ */s("span",{className:"icon icon-tick-white icon--2sm"})," Archivo subido correctamente: ",a.filename]}),
|
|
479
|
-
/* @__PURE__ */s(Jt,{onSelect:e,onVideoSelect:t,disabled:n,apiKey:o,prod:u,allowedCategories:d,resolvedAccept:b,returnConfig:m,folderConfig:h,aiStarterPrompt:p,selectedFolder:i,onFolderChange:l,tags:g,onTagsChange:v})]})}const el="undefined"!=typeof window&&void 0!==window.document,tl=el?window:{},ll=!!el&&"ontouchstart"in tl.document.documentElement,nl=!!el&&"PointerEvent"in tl,rl="cropper",al=`${rl}-canvas`,il=`${rl}-crosshair`,ol=`${rl}-grid`,sl=`${rl}-handle`,cl=`${rl}-image`,ul=`${rl}-selection`,dl=`${rl}-shade`,bl=`${rl}-viewer`,ml="select",hl="move",pl="scale",fl="rotate",gl="transform",vl="none",yl="n-resize",wl="e-resize",xl="s-resize",kl="w-resize",Cl="ne-resize",Sl="nw-resize",Nl="se-resize",El="sw-resize",$l=nl?"pointerdown":ll?"touchstart":"mousedown",_l=nl?"pointermove":ll?"touchmove":"mousemove",Tl=nl?"pointerup pointercancel":ll?"touchend touchcancel":"mouseup",Al="error",zl="keydown",Ll="load",Il="resize",Ml="wheel",Pl="action",Dl="actionend",Rl="actionstart",Ol="change",jl="transform";const Fl=Number.isNaN||tl.isNaN;function Ul(e){return"number"==typeof e&&!Fl(e)}function Bl(e){return Ul(e)&&e>0&&e<1/0}function ql(e){return"object"==typeof e&&null!==e}const{hasOwnProperty:Wl}=Object.prototype;function Vl(e){if(!ql(e))return!1;try{const{constructor:t}=e,{prototype:l}=t;return t&&l&&Wl.call(l,"isPrototypeOf")}catch(t){return!1}}function Hl(e){return"function"==typeof e}function Kl(e){return"object"==typeof e&&null!==e&&1===e.nodeType}const Gl=/([a-z\d])([A-Z])/g;function Ql(e){return String(e).replace(Gl,"$1-$2").toLowerCase()}const Xl=/-[A-z\d]/g;function Yl(e){return e.replace(Xl,e=>e.slice(1).toUpperCase())}const Jl=/\s\s*/;function Zl(e,t,l,n){t.trim().split(Jl).forEach(t=>{e.removeEventListener(t,l,n)})}function en(e,t,l,n){t.trim().split(Jl).forEach(t=>{e.addEventListener(t,l,n)})}function tn(e,t,l,n){en(e,t,l,Object.assign(Object.assign({},n),{once:!0}))}const ln={bubbles:!0,cancelable:!0,composed:!0};const nn=Promise.resolve();function rn(e){const{documentElement:t}=e.ownerDocument,l=e.getBoundingClientRect();return{left:l.left+(tl.pageXOffset-t.clientLeft),top:l.top+(tl.pageYOffset-t.clientTop)}}const an=/deg|g?rad|turn$/i;function on(e){const t=parseFloat(e)||0;if(0!==t){const[l="rad"]=String(e).match(an)||[];switch(l.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 sn="contain";function cn(e,t=sn){const{aspectRatio:l}=e;let{width:n,height:r}=e;const a=Bl(n),i=Bl(r);if(a&&i){const e=r*l;t===sn&&e>n||"cover"===t&&e<n?r=n/l:n=r*l}else a?r=n/l:i&&(n=r*l);return{width:n,height:r}}function un(e,...t){if(0===t.length)return e;const[l,n,r,a,i,o]=e,[s,c,u,d,b,m]=t[0];return un(e=[l*s+r*c,n*s+a*c,l*u+r*d,n*u+a*d,l*b+r*m+i,n*b+a*m+o],...t.slice(1))}const dn=/left|top|width|height/i,bn="open",mn=/* @__PURE__ */new WeakMap,hn=/* @__PURE__ */new WeakMap,pn=/* @__PURE__ */new Map,fn=tl.document&&Array.isArray(tl.document.adoptedStyleSheets)&&"replaceSync"in tl.CSSStyleSheet.prototype;class gn extends HTMLElement{get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}constructor(){var e,t;super(),this.shadowRootMode=bn,this.slottable=!0;const l=null===(t=null===(e=Object.getPrototypeOf(this))||void 0===e?void 0:e.constructor)||void 0===t?void 0:t.$name;l&&pn.set(l,this.tagName.toLowerCase())}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(e,t,l){if(Object.is(l,t))return;const n=Yl(e);let r=l;switch(typeof this[n]){case"boolean":r=null!==l&&"false"!==l;break;case"number":r=Number(l)}switch(this[n]=r,e){case"theme-color":{const e=hn.get(this),t=this.$sharedStyle;e&&t&&(fn?e.replaceSync(t):e.textContent=t);break}}}$propertyChangedCallback(e,t,l){if(!Object.is(l,t))switch(e=Ql(e),typeof l){case"boolean":!0===l?this.hasAttribute(e)||this.setAttribute(e,""):this.removeAttribute(e);break;case"number":l=Fl(l)?"":String(l);default:l?this.getAttribute(e)!==l&&this.setAttribute(e,l):this.removeAttribute(e)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach(e=>{const t=Yl(e);let l=this[t];(function(e){return void 0===e})(l)||this.$propertyChangedCallback(t,void 0,l),Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>l,set(e){const n=l;l=e,this.$propertyChangedCallback(t,n,e)}})});const e=this.shadowRoot||this.attachShadow({mode:this.shadowRootMode||bn});if(mn.set(this,e),hn.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(){hn.has(this)&&hn.delete(this),mn.has(this)&&mn.delete(this)}$getTagNameOf(e){var t;return null!==(t=pn.get(e))&&void 0!==t?t:e}$setStyles(e){return Object.keys(e).forEach(t=>{let l=e[t];Ul(l)&&(l=0!==l&&dn.test(t)?`${l}px`:String(l)),this.style[t]=l}),this}$getShadowRoot(){return this.shadowRoot||mn.get(this)}$addStyles(e){let t;const l=this.$getShadowRoot();return fn?(t=new CSSStyleSheet,t.replaceSync(e),l.adoptedStyleSheets=l.adoptedStyleSheets.concat(t)):(t=document.createElement("style"),t.textContent=e,l.appendChild(t)),t}$emit(e,t,l){return function(e,t,l,n){return e.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},ln),{detail:l}),n)))}(this,e,t,l)}$nextTick(e){return function(e,t){return t?nn.then(e?t.bind(e):t):nn}(this,e)}static $define(e,t){ql(e)&&(t=e,e=""),e||(e=this.$name||this.name),e=Ql(e),el&&tl.customElements&&!tl.customElements.get(e)&&customElements.define(e,this,t)}}gn.$version="2.1.1";class vn extends gn{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=vl,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,l){if(!Object.is(l,t)&&(super.$propertyChangedCallback(e,t,l),"disabled"===e))l?this.$unbind():this.$bind()}$bind(){this.$onPointerDown||(this.$onPointerDown=this.$handlePointerDown.bind(this),en(this,$l,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),en(this.ownerDocument,_l,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),en(this.ownerDocument,Tl,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),en(this,Ml,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(Zl(this,$l,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(Zl(this.ownerDocument,_l,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(Zl(this.ownerDocument,Tl,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(Zl(this,Ml,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(e){const{buttons:t,button:l,type:n}=e;if(this.disabled||("pointerdown"===n&&"mouse"===e.pointerType||"mousedown"===n)&&(Ul(t)&&1!==t||Ul(l)&&0!==l||e.ctrlKey))return;const{$pointers:r}=this;let a="";if(e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:l})=>{r.set(e,{startX:t,startY:l,endX:t,endY:l})});else{const{pointerId:t=0,pageX:l,pageY:n}=e;r.set(t,{startX:l,startY:n,endX:l,endY:n})}r.size>1?a=gl:Kl(e.target)&&(a=e.target.action||e.target.getAttribute("action")||""),!1!==this.$emit(Rl,{action:a,relatedEvent:e})&&(e.preventDefault(),this.$action=a,this.style.willChange="transform")}$handlePointerMove(e){const{$action:t,$pointers:l}=this;if(this.disabled||t===vl||0===l.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:n})=>{const r=l.get(e);r&&Object.assign(r,{endX:t,endY:n})});else{const{pointerId:t=0,pageX:n,pageY:r}=e,a=l.get(t);a&&Object.assign(a,{endX:n,endY:r})}const n={action:t,relatedEvent:e};if(t===gl){const t=new Map(l);let r=0,a=0,i=0,o=0,s=e.pageX,c=e.pageY;l.forEach((e,l)=>{t.delete(l),t.forEach(t=>{let l=t.startX-e.startX,n=t.startY-e.startY,u=t.endX-e.endX,d=t.endY-e.endY,b=0,m=0,h=0,p=0;if(0===l?n<0?h=2*Math.PI:n>0&&(h=Math.PI):l>0?h=Math.PI/2+Math.atan(n/l):l<0&&(h=1.5*Math.PI+Math.atan(n/l)),0===u?d<0?p=2*Math.PI:d>0&&(p=Math.PI):u>0?p=Math.PI/2+Math.atan(d/u):u<0&&(p=1.5*Math.PI+Math.atan(d/u)),p>0||h>0){const l=p-h,n=Math.abs(l);n>r&&(r=n,i=l,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}if(l=Math.abs(l),n=Math.abs(n),u=Math.abs(u),d=Math.abs(d),l>0&&n>0?b=Math.sqrt(l*l+n*n):l>0?b=l:n>0&&(b=n),u>0&&d>0?m=Math.sqrt(u*u+d*d):u>0?m=u:d>0&&(m=d),b>0&&m>0){const l=(m-b)/b,n=Math.abs(l);n>a&&(a=n,o=l,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}})});const u=r>0,d=a>0;u&&d?(n.rotate=i,n.scale=o,n.centerX=s,n.centerY=c):u?(n.action=fl,n.rotate=i,n.centerX=s,n.centerY=c):d?(n.action=pl,n.scale=o,n.centerX=s,n.centerY=c):n.action=vl}else{const[e]=Array.from(l.values());Object.assign(n,e)}l.forEach(e=>{e.startX=e.endX,e.startY=e.endY}),n.action!==vl&&this.$emit(Pl,n,{cancelable:!1})}$handlePointerUp(e){const{$action:t,$pointers:l}=this;if(!this.disabled&&t!==vl&&!1!==this.$emit(Dl,{action:t,relatedEvent:e})){if(e.preventDefault(),e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e})=>{l.delete(e)});else{const{pointerId:t=0}=e;l.delete(t)}0===l.size&&(this.style.willChange="",this.$action=vl)}}$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(Pl,{action:pl,scale:t,relatedEvent:e},{cancelable:!1})}$setAction(e){return"string"==typeof e&&(this.$action=e),this}$toCanvas(e){return new Promise((t,l)=>{if(!this.isConnected)return void l(new Error("The current element is not connected to the DOM."));const n=document.createElement("canvas");let r=this.offsetWidth,a=this.offsetHeight,i=1;Vl(e)&&(Bl(e.width)||Bl(e.height))&&(({width:r,height:a}=cn({aspectRatio:r/a,width:e.width,height:e.height})),i=r/this.offsetWidth),n.width=r,n.height=a;const o=this.querySelector(this.$getTagNameOf(cl));o?o.$ready().then(l=>{const s=n.getContext("2d");if(s){const[t,c,u,d,b,m]=o.$getTransform();let h=b,p=m,f=l.naturalWidth,g=l.naturalHeight;1!==i&&(h*=i,p*=i,f*=i,g*=i);const v=f/2,y=g/2;s.fillStyle="transparent",s.fillRect(0,0,r,a),Vl(e)&&Hl(e.beforeDraw)&&e.beforeDraw.call(this,s,n),s.save(),s.translate(v,y),s.transform(t,c,u,d,h,p),s.translate(-v,-y),s.drawImage(l,0,0,f,g),s.restore()}t(n)}).catch(l):t(n)})}}vn.$name=al,vn.$version="2.1.1";const yn=/* @__PURE__ */new WeakMap,wn=["alt","crossorigin","decoding","elementtiming","fetchpriority","loading","referrerpolicy","sizes","src","srcset"];class xn extends gn{constructor(){super(...arguments),this.$isReady=!1,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){yn.set(this,e)}get $canvas(){return yn.get(this)}static get observedAttributes(){return super.observedAttributes.concat(wn,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(e,t,l){Object.is(l,t)||(super.attributeChangedCallback(e,t,l),wn.includes(e)&&this.$image.setAttribute(e,l))}$propertyChangedCallback(e,t,l){if(!Object.is(l,t))switch(super.$propertyChangedCallback(e,t,l),e){case"initialCenterSize":this.$nextTick(()=>{this.$center(l)});break;case"src":this.$isReady=!1}}connectedCallback(){super.connectedCallback();const{$image:e}=this,t=this.closest(this.$getTagNameOf(al));t&&(this.$canvas=t,this.$setStyles({display:"block",position:"absolute"}),this.$onCanvasActionStart=e=>{var t,l;this.$actionStartTarget=null===(l=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===l?void 0:l.target},this.$onCanvasActionEnd=()=>{this.$actionStartTarget=null},this.$onCanvasAction=this.$handleAction.bind(this),en(t,Rl,this.$onCanvasActionStart),en(t,Dl,this.$onCanvasActionEnd),en(t,Pl,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),en(e,Ll,this.$onLoad),this.$getShadowRoot().appendChild(e)}disconnectedCallback(){const{$image:e,$canvas:t}=this;t&&(this.$onCanvasActionStart&&(Zl(t,Rl,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(Zl(t,Dl,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(Zl(t,Pl,this.$onCanvasAction),this.$onCanvasAction=null)),e&&this.$onLoad&&(Zl(e,Ll,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),this.$isReady=!0}$handleAction(e){if(this.hidden||!(this.rotatable||this.scalable||this.translatable))return;const{$canvas:t}=this,{detail:l}=e;if(l){const{relatedEvent:e}=l;let{action:n}=l;switch(n!==gl||this.rotatable&&this.scalable||(n=this.rotatable?fl:this.scalable?pl:vl),n){case hl:if(this.translatable){let n=null;e&&(n=e.target.closest(this.$getTagNameOf(ul))),n||(n=t.querySelector(this.$getTagNameOf(ul))),n&&n.multiple&&!n.active&&(n=t.querySelector(`${this.$getTagNameOf(ul)}[active]`)),n&&!n.hidden&&n.movable&&!n.dynamic&&this.$actionStartTarget&&n.contains(this.$actionStartTarget)||this.$move(l.endX-l.startX,l.endY-l.startY)}break;case fl:if(this.rotatable)if(e){const{x:t,y:n}=this.getBoundingClientRect();this.$rotate(l.rotate,e.clientX-t,e.clientY-n)}else this.$rotate(l.rotate);break;case pl:if(this.scalable)if(e){const t=e.target.closest(this.$getTagNameOf(ul));if(!t||!t.zoomable||t.zoomable&&t.dynamic){const{x:t,y:n}=this.getBoundingClientRect();this.$zoom(l.scale,e.clientX-t,e.clientY-n)}}else this.$zoom(l.scale);break;case gl:if(this.rotatable&&this.scalable){const{rotate:t}=l;let{scale:n}=l;n<0?n=1/(1-n):n+=1;const r=Math.cos(t),a=Math.sin(t),[i,o,s,c]=[r*n,a*n,-a*n,r*n];if(e){const t=this.getBoundingClientRect(),l=e.clientX-t.x,n=e.clientY-t.y,[r,a,u,d]=this.$matrix,b=l-t.width/2,m=n-t.height/2,h=(b*d-u*m)/(r*d-u*a),p=(m*r-a*b)/(r*d-u*a);this.$transform(i,o,s,c,h*(1-i)+p*s,p*(1-c)+h*o)}else this.$transform(i,o,s,c,0,0)}}}}$ready(e){const{$image:t}=this,l=new Promise((e,l)=>{const n=new Error("Failed to load the image source");if(t.complete)t.naturalWidth>0&&t.naturalHeight>0?e(t):l(n);else{const r=()=>{Zl(t,Al,a),setTimeout(()=>{e(t)})},a=()=>{Zl(t,Ll,r),l(n)};tn(t,Ll,r),tn(t,Al,a)}});return Hl(e)&&l.then(t=>(e(t),t)),l}$center(e){const{parentElement:t}=this;if(!t)return this;const l=t.getBoundingClientRect(),n=l.width,r=l.height,{x:a,y:i,width:o,height:s}=this.getBoundingClientRect(),c=a+o/2,u=i+s/2,d=l.x+n/2,b=l.y+r/2,{translatable:m}=this;if(m||this.$isReady||(this.translatable=!0,this.$nextTick(()=>{this.translatable=m})),this.$move(d-c,b-u),e&&(o!==n||s!==r)){const t=n/o,l=r/s,{scalable:a}=this;switch(!e||a||this.$isReady||(this.scalable=!0,this.$nextTick(()=>{this.scalable=a})),e){case"cover":this.$scale(Math.max(t,l));break;case"contain":this.$scale(Math.min(t,l))}}return this}$move(e,t=e){if(this.translatable&&Ul(e)&&Ul(t)){const[l,n,r,a]=this.$matrix,i=(e*a-r*t)/(l*a-r*n),o=(t*l-n*e)/(l*a-r*n);this.$translate(i,o)}return this}$moveTo(e,t=e){if(this.translatable&&Ul(e)&&Ul(t)){const[l,n,r,a]=this.$matrix,i=(e*a-r*t)/(l*a-r*n),o=(t*l-n*e)/(l*a-r*n);this.$setTransform(l,n,r,a,i,o)}return this}$rotate(e,t,l){if(this.rotatable){const n=on(e),r=Math.cos(n),a=Math.sin(n),[i,o,s,c]=[r,a,-a,r];if(Ul(t)&&Ul(l)){const[e,n,r,a]=this.$matrix,{width:u,height:d}=this.getBoundingClientRect(),b=t-u/2,m=l-d/2,h=(b*a-r*m)/(e*a-r*n),p=(m*e-n*b)/(e*a-r*n);this.$transform(i,o,s,c,h*(1-i)-p*s,p*(1-c)-h*o)}else this.$transform(i,o,s,c,0,0)}return this}$zoom(e,t,l){if(!this.scalable||0===e)return this;if(e<0?e=1/(1-e):e+=1,Ul(t)&&Ul(l)){const[n,r,a,i]=this.$matrix,{width:o,height:s}=this.getBoundingClientRect(),c=t-o/2,u=l-s/2,d=(c*i-a*u)/(n*i-a*r),b=(u*n-r*c)/(n*i-a*r);this.$transform(e,0,0,e,d*(1-e),b*(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 l=on(e),n=on(t);this.$transform(1,Math.tan(n),Math.tan(l),1,0,0)}return this}$translate(e,t=e){return this.translatable&&Ul(e)&&Ul(t)&&this.$transform(1,0,0,1,e,t),this}$transform(e,t,l,n,r,a){return Ul(e)&&Ul(t)&&Ul(l)&&Ul(n)&&Ul(r)&&Ul(a)?this.$setTransform(un(this.$matrix,[e,t,l,n,r,a])):this}$setTransform(e,t,l,n,r,a){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(e)&&([e,t,l,n,r,a]=e),Ul(e)&&Ul(t)&&Ul(l)&&Ul(n)&&Ul(r)&&Ul(a))){const i=[...this.$matrix],o=[e,t,l,n,r,a];if(!1===this.$emit(jl,{matrix:o,oldMatrix:i}))return this;this.$matrix=o,this.style.transform=`matrix(${o.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}xn.$name=cl,xn.$version="2.1.1";const kn=/* @__PURE__ */new WeakMap;class Cn extends gn{constructor(){super(...arguments),this.$onWindowResize=null,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){kn.set(this,e)}get $canvas(){return kn.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(al));if(e){this.$canvas=e,this.style.position="absolute";const t=e.querySelector(this.$getTagNameOf(ul));t&&(this.$onWindowResize=this.$render.bind(this),this.$onCanvasActionStart=e=>{t.hidden&&e.detail.action===ml&&(this.hidden=!1)},this.$onCanvasActionEnd=e=>{t.hidden&&e.detail.action===ml&&(this.hidden=!0)},this.$onSelectionChange=e=>{const{x:l,y:n,width:r,height:a}=e.defaultPrevented?t:e.detail;this.$change(l,n,r,a),(t.hidden||0===l&&0===n&&0===r&&0===a)&&(this.hidden=!0)},en(window,Il,this.$onWindowResize),en(e,Rl,this.$onCanvasActionStart),en(e,Dl,this.$onCanvasActionEnd),en(e,Ol,this.$onSelectionChange))}this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onWindowResize&&(Zl(window,Il,this.$onWindowResize),this.$onWindowResize=null),this.$onCanvasActionStart&&(Zl(e,Rl,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(Zl(e,Dl,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onSelectionChange&&(Zl(e,Ol,this.$onSelectionChange),this.$onSelectionChange=null)),super.disconnectedCallback()}$change(e,t,l=this.width,n=this.height){return Ul(e)&&Ul(t)&&Ul(l)&&Ul(n)&&(e!==this.x||t!==this.y||l!==this.width||n!==this.height)?(this.hidden&&(this.hidden=!1),this.x=e,this.y=t,this.width=l,this.height=n,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:tl.innerWidth*tl.devicePixelRatio})}}Cn.$name=dl,Cn.$version="2.1.1";class Sn extends gn{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=vl,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}Sn.$name=sl,Sn.$version="2.1.1";const Nn=/* @__PURE__ */new WeakMap;class En extends gn{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){Nn.set(this,e)}get $canvas(){return Nn.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,l){if(!Object.is(l,t))switch(super.$propertyChangedCallback(e,t,l),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(()=>{Bl(l)&&l<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(l?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),en(this.ownerDocument,zl,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(Zl(this.ownerDocument,zl,this.$onDocumentKeyDown),this.$onDocumentKeyDown=null))});break;case"multiple":this.$nextTick(()=>{if(this.$canvas){const e=this.$getSelections();l?(e.forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Ol,{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":l&&(this.dynamic=!0)}}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(al));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),en(e,Rl,this.$onCanvasActionStart),en(e,Dl,this.$onCanvasActionEnd),en(e,Pl,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(Zl(e,Rl,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(Zl(e,Dl,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(Zl(e,Pl,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let e=[];return this.parentElement&&(e=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(ul)))),e}$initSelection(e=!1,t=!1){const{initialCoverage:l,parentElement:n}=this;if(Bl(l)&&n){const r=this.aspectRatio||this.initialAspectRatio;let a=(t?0:this.width)||n.offsetWidth*l,i=(t?0:this.height)||n.offsetHeight*l;Bl(r)&&({width:a,height:i}=cn({aspectRatio:r,width:a,height:i})),this.$change(this.x,this.y,a,i),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 l=t.indexOf(e),n=t[l+1]||t[l-1];n&&(e.active=!1,this.parentElement.removeChild(e),n.active=!0,n.$emit(Ol,{x:n.x,y:n.y,width:n.width,height:n.height}))}else this.$clear()}}$handleActionStart(e){var t,l;const n=null===(l=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===l?void 0:l.target;this.$action="",this.$actionStartTarget=n,!this.hidden&&this.multiple&&!this.active&&n===this&&this.parentElement&&(this.$getSelections().forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Ol,{x:this.x,y:this.y,width:this.width,height:this.height}))}$handleAction(e){const{currentTarget:t,detail:l}=e;if(!t||!l)return;const{relatedEvent:n}=l;let{action:r}=l;const a=n?function(e){if("function"==typeof e.composedPath)return e.composedPath().find(Kl)||e.target;return e.target}(n):null;if(!r&&this.multiple&&(r=this.$action||(null==a?void 0:a.action),this.$action=r),!r||this.hidden&&r!==ml||this.multiple&&!this.active&&r!==pl)return;const{width:i,height:o}=this;let s=l.endX-l.startX,c=l.endY-l.startY,{aspectRatio:u}=this;switch(!Bl(u)&&n.shiftKey&&(u=Bl(i)&&Bl(o)?i/o:1),r){case ml:if(0!==s||0!==c){0===s?s=c:0===c&&(c=s);const{$canvas:e}=this,n=rn(t);(this.multiple&&!this.hidden?this.$createSelection():this).$change(l.startX-n.left,l.startY-n.top,Math.abs(s),Math.abs(c),u),s<0?c<0?r=Sl:c>0&&(r=El):s>0&&(c<0?r=Cl:c>0&&(r=Nl)),e&&(e.$action=r)}break;case hl:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(s,c);break;case pl:if(n&&this.zoomable&&(this.dynamic||this.contains(n.target))){const e=rn(t);this.$zoom(l.scale,n.pageX-e.left,n.pageY-e.top)}break;default:this.$resize(r,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,l=(e.offsetHeight-this.height)/2;return this.$change(t,l)}$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,l=0,n=this.aspectRatio){if(!this.resizable)return this;const r=Bl(n),{$canvas:a}=this;let{x:i,y:o,width:s,height:c}=this;switch(e){case yl:o+=l,c-=l,c<0&&(e=xl,c=-c,o-=c),r&&(i+=(t=l*n)/2,s-=t,s<0&&(s=-s,i-=s));break;case wl:s+=t,s<0&&(e=kl,s=-s,i-=s),r&&(o-=(l=t/n)/2,c+=l,c<0&&(c=-c,o-=c));break;case xl:c+=l,c<0&&(e=yl,c=-c,o-=c),r&&(i-=(t=l*n)/2,s+=t,s<0&&(s=-s,i-=s));break;case kl:i+=t,s-=t,s<0&&(e=wl,s=-s,i-=s),r&&(o+=(l=t/n)/2,c-=l,c<0&&(c=-c,o-=c));break;case Cl:r&&(l=-t/n),o+=l,c-=l,s+=t,s<0&&c<0?(e=El,s=-s,c=-c,i-=s,o-=c):s<0?(e=Sl,s=-s,i-=s):c<0&&(e=Nl,c=-c,o-=c);break;case Sl:r&&(l=t/n),i+=t,o+=l,s-=t,c-=l,s<0&&c<0?(e=Nl,s=-s,c=-c,i-=s,o-=c):s<0?(e=Cl,s=-s,i-=s):c<0&&(e=El,c=-c,o-=c);break;case Nl:r&&(l=t/n),s+=t,c+=l,s<0&&c<0?(e=Sl,s=-s,c=-c,i-=s,o-=c):s<0?(e=El,s=-s,i-=s):c<0&&(e=Cl,c=-c,o-=c);break;case El:r&&(l=-t/n),i+=t,s-=t,c+=l,s<0&&c<0?(e=Cl,s=-s,c=-c,i-=s,o-=c):s<0?(e=Nl,s=-s,i-=s):c<0&&(e=Sl,c=-c,o-=c)}return a&&a.$setAction(e),this.$change(i,o,s,c)}$zoom(e,t,l){if(!this.zoomable||0===e)return this;e<0?e=1/(1-e):e+=1;const{width:n,height:r}=this,a=n*e,i=r*e;let o=this.x,s=this.y;return Ul(t)&&Ul(l)?(o-=(a-n)*((t-this.x)/n),s-=(i-r)*((l-this.y)/r)):(o-=(a-n)/2,s-=(i-r)/2),this.$change(o,s,a,i)}$change(e,t,l=this.width,n=this.height,r=this.aspectRatio,a=!1){return this.$changing||!Ul(e)||!Ul(t)||!Ul(l)||!Ul(n)||l<0||n<0?this:(Bl(r)&&({width:l,height:n}=cn({aspectRatio:r,width:l,height:n},"cover")),this.precise||(e=Math.round(e),t=Math.round(t),l=Math.round(l),n=Math.round(n)),e===this.x&&t===this.y&&l===this.width&&n===this.height&&Object.is(r,this.aspectRatio)&&!a?this:(this.hidden&&(this.hidden=!1),!1===this.$emit(Ol,{x:e,y:t,width:l,height:n})?this:(this.$changing=!0,this.x=e,this.y=t,this.width=l,this.height=n,this.$changing=!1,this.$render())))}$reset(){const{x:e,y:t,width:l,height:n}=this.$initialSelection;return this.$change(e,t,l,n)}$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,l)=>{if(!this.isConnected)return void l(new Error("The current element is not connected to the DOM."));const n=document.createElement("canvas");let{width:r,height:a}=this,i=1;if(Vl(e)&&(Bl(e.width)||Bl(e.height))&&(({width:r,height:a}=cn({aspectRatio:r/a,width:e.width,height:e.height})),i=r/this.width),n.width=r,n.height=a,!this.$canvas)return void t(n);const o=this.$canvas.querySelector(this.$getTagNameOf(cl));o?o.$ready().then(l=>{const s=n.getContext("2d");if(s){const[t,c,u,d,b,m]=o.$getTransform(),h=-this.x,p=-this.y,f=(h*d-u*p)/(t*d-u*c),g=(p*t-c*h)/(t*d-u*c);let v=t*f+u*g+b,y=c*f+d*g+m,w=l.naturalWidth,x=l.naturalHeight;1!==i&&(v*=i,y*=i,w*=i,x*=i);const k=w/2,C=x/2;s.fillStyle="transparent",s.fillRect(0,0,r,a),Vl(e)&&Hl(e.beforeDraw)&&e.beforeDraw.call(this,s,n),s.save(),s.translate(k,C),s.transform(t,c,u,d,v,y),s.translate(-k,-C),s.drawImage(l,0,0,w,x),s.restore()}t(n)}).catch(l):t(n)})}}En.$name=ul,En.$version="2.1.1";class $n extends gn{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,l){Object.is(l,t)||(super.$propertyChangedCallback(e,t,l),"rows"!==e&&"columns"!==e||this.$nextTick(()=>{this.$render()}))}connectedCallback(){super.connectedCallback(),this.$render()}$render(){const e=this.$getShadowRoot(),t=document.createDocumentFragment();for(let l=0;l<this.rows;l+=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))}}$n.$name=ol,$n.$version="2.1.1";class _n extends gn{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"])}}_n.$name=il,_n.$version="2.1.1";const Tn=/* @__PURE__ */new WeakMap,An=/* @__PURE__ */new WeakMap,zn=/* @__PURE__ */new WeakMap,Ln=/* @__PURE__ */new WeakMap,In="vertical";class Mn extends gn{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=In,this.selection="",this.slottable=!1}set $image(e){An.set(this,e)}get $image(){return An.get(this)}set $sourceImage(e){Ln.set(this,e)}get $sourceImage(){return Ln.get(this)}set $canvas(e){Tn.set(this,e)}get $canvas(){return Tn.get(this)}set $selection(e){zn.set(this,e)}get $selection(){return zn.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["resize","selection"])}connectedCallback(){var e,t;super.connectedCallback();let l=null;if(l=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(ul)),Kl(l)){this.$selection=l,this.$onSelectionChange=this.$handleSelectionChange.bind(this),en(l,Ol,this.$onSelectionChange);const e=l.closest(this.$getTagNameOf(al));if(e){this.$canvas=e;const t=e.querySelector(this.$getTagNameOf(cl));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),en(t.$image,Ll,this.$onSourceImageLoad),en(t,jl,this.$onSourceImageTransform))}this.$render()}}disconnectedCallback(){const{$selection:e,$sourceImage:t}=this;e&&this.$onSelectionChange&&(Zl(e,Ol,this.$onSelectionChange),this.$onSelectionChange=null),t&&this.$onSourceImageLoad&&(Zl(t.$image,Ll,this.$onSourceImageLoad),this.$onSourceImageLoad=null),t&&this.$onSourceImageTransform&&(Zl(t,jl,this.$onSourceImageTransform),this.$onSourceImageTransform=null),super.disconnectedCallback()}$handleSelectionChange(e){this.$render(e.defaultPrevented?this.$selection:e.detail)}$handleSourceImageLoad(){const{$image:e,$sourceImage:t}=this,l=e.getAttribute("src"),n=t.getAttribute("src");n&&n!==l&&(e.setAttribute("src",n),e.$ready(()=>{this.$render()}))}$handleSourceImageTransform(e){this.$render(void 0,e.detail.matrix)}$render(e,t){const{$canvas:l,$selection:n}=this;e||n.hidden||(e=n),(!e||0===e.x&&0===e.y&&0===e.width&&0===e.height)&&(e={x:0,y:0,width:l.offsetWidth,height:l.offsetHeight});const{x:r,y:a,width:i,height:o}=e,s={},{clientWidth:c,clientHeight:u}=this;let d=c,b=u,m=NaN;switch(this.resize){case"both":m=1,d=i,b=o,s.width=i,s.height=o;break;case"horizontal":m=o>0?u/o:0,d=i*m,s.width=d;break;case In:m=i>0?c/i:0,b=o*m,s.height=b;break;default:c>0?m=i>0?c/i:0:u>0&&(m=o>0?u/o:0)}this.$scale=m,this.$setStyles(s),this.$sourceImage&&setTimeout(()=>{this.$transformImageByOffset(null!=t?t:this.$sourceImage.$getTransform(),-r,-a)})}$transformImageByOffset(e,t,l){const{$image:n,$scale:r,$sourceImage:a}=this;if(a&&n&&r>=0){const[i,o,s,c,u,d]=e,b=(t*c-s*l)/(i*c-s*o),m=(l*i-o*t)/(i*c-s*o),h=i*b+s*m+u,p=o*b+c*m+d;a.$ready(e=>{this.$setStyles.call(n,{width:e.naturalWidth*r,height:e.naturalHeight*r})}),n.$setTransform(i,o,s,c,h*r,p*r)}}}function Pn(){const[e,l]=t(!1),[n,r]=t(null),[a,i]=t(null),o=async(e,t)=>{if(!e||!t)return r("ID de asset y configuración de variante son requeridos"),null;l(!0),r(null),i(null);try{const l=await async function(e,{variant_name:t,width:l,height:r,crop_params:a,preset_aspect:i=null,preset_size:o=null,output_format:s="webp"}){try{const n=[{name:t,width:l,height:r,output_format:s,crop_params:a}];return i&&(n[0].preset_aspect=i),o&&(n[0].preset_size=o),re(await J({endpoint:`/assets/${e}/variants`,method:"POST",body:{variants:n,async:!1},basePath:ie,useJWT:!0}))}catch(n){throw ae(n)}}(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(l?.result)return i(l.result),l.result;throw new Error("No se pudo crear la variante")}catch(a){return console.error("Error creating variant:",a),r(a.message||"Error desconocido al crear variante"),null}finally{l(!1)}};return{createVariant:o,createCropVariant:async(e,t,l={})=>{const n={name:l.name||`crop_${Date.now()}`,width:l.width||800,height:l.height||600,output_format:l.format||"webp",crop_params:{x:t.x||0,y:t.y||0,width:t.width||1,height:t.height||1}};return await o(e,n)},createVariantFromBlob:async(e,t,a={})=>{if(!e||!t)return r("ID de asset y blob son requeridos"),null;l(!0),r(null),i(null);try{const l=await async function(e,t,l={}){try{const n=new FormData,r=l.format||"webp",a=`${l.name||"variant"}.${r}`;return n.append("file",t,a),n.append("variant_name",l.name||"variant"),n.append("width",String(l.width||0)),n.append("height",String(l.height||0)),n.append("output_format",l.format||"webp"),n.append("permanent_url",!1!==l.permanentUrl?"true":"false"),re(await J({endpoint:`/assets/${e}/variants/upload`,method:"POST",body:n,basePath:ie,isFormData:!0,useJWT:!0}))}catch(n){throw ae(n)}}(e,t,{name:a.name||`crop_${Date.now()}`,width:a.width||0,height:a.height||0,format:a.format||"webp"});if(l?.result)return i(l.result),l.result;throw new Error("No se pudo crear la variante")}catch(o){return console.error("Error creating variant from blob:",o),r(o.message||"Error desconocido al crear variante"),null}finally{l(!1)}},loading:e,error:n,createdVariant:a,reset:()=>{r(null),i(null)}}}Mn.$name=bl,Mn.$version="2.1.1",vn.$define(),_n.$define(),$n.$define(),Sn.$define(),xn.$define(),En.$define(),Cn.$define(),Mn.$define();class Dn{constructor(e,t,l){this.canvasRef=e,this.imageRef=t,this.selectionRef=l}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(l){return console.warn("Error moving image:",l),!1}},moveTo:(e,t)=>{if(!this.image)return!1;try{return this.image.$moveTo(e,t),!0}catch(l){return console.warn("Error moving image to position:",l),!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(l){return console.warn("Error scaling image:",l),!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,l,n,r,a)=>{if(!this.image)return!1;try{return this.image.$setTransform(e,t,l,n,r,a),!0}catch(i){return console.warn("Error setting transform:",i),!1}},resetZoom:()=>{if(!this.image)return!1;try{const e=this.image.$getTransform();if(!e)return!1;const[t,l,n,r,a,i]=e,o=Math.sqrt(t*t+l*l),s=Math.sqrt(n*n+r*r),c=t/o,u=l/o,d=n/s,b=r/s;return this.image.$setTransform(c,u,d,b,a,i),!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[l,n,r,a,i,o]=t,s=Math.sqrt(l*l+n*n),c=Math.sqrt(r*r+a*a),u=l/s*e,d=n/s*e,b=r/c*e,m=a/c*e;return this.image.$setTransform(u,d,b,m,i,o),!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,l]=e;return Math.sqrt(t*t+l*l)}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 l=this.image.querySelector("img")||this.image;if(!l?.naturalWidth||!l?.naturalHeight)return!1;const n=1-e,r=t.width*n/l.naturalWidth,a=t.height*n/l.naturalHeight,i=Math.min(r,a,1);return this.transform.setZoom(i)}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[l,n]=e.split("/").map(e=>parseFloat(e.trim()));if(isNaN(l)||isNaN(n)||0===n)return console.warn("Invalid aspect ratio format:",e),!1;t=l/n}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(l){return console.warn("Error moving selection:",l),!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,l,n,r)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$change(e,t,l,n,r),!0}catch(a){return console.warn("Error changing selection:",a),!1}},set:(e,t,l,n)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.x=e,this.selectionElement.y=t,this.selectionElement.width=l,this.selectionElement.height=n,this.selectionElement.$render(),!0}catch(r){return console.warn("Error setting selection:",r),!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,l,n,r,a,i]=e;return this.transform.setTransform(-t,l,n,r,a,i)},flipVertical:()=>{const e=this.transform.getTransform();if(!e)return!1;const[t,l,n,r,a,i]=e;return this.transform.setTransform(t,l,n,-r,a,i)},setupInitialView:async(e={})=>{const{paspartuFactor:t=.85,retries:l=3,retryDelay:n=200}=e;return new Promise(e=>{const r=(a=0)=>{if(!this.isReady)return a<l?void setTimeout(()=>r(a+1),n):void e(!1);try{const i=this.canvasElement.getBoundingClientRect();let o=this.image.querySelector("img")||this.image;if(!o?.naturalWidth||!o?.naturalHeight)return a<l?void setTimeout(()=>r(a+1),n):(this.transform.center(),void e(!1));if(i.width>0&&i.height>0){const l=i.width*t/o.naturalWidth,n=i.height*t/o.naturalHeight,r=Math.min(l,n,1);this.transform.setTransform(r,0,0,r,0,0)?setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100):(this.transform.reset(),setTimeout(()=>{r<1&&this.transform.scale(r),setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100)},100))}else this.transform.center(),e(!1)}catch(i){console.warn("Error in setup:",i),this.transform.center(),e(!1)}};r()})},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:l,onAction:n,onActionStart:r,onActionMove:a,onActionEnd:i}=e,o=[];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),o.push(()=>{this.selectionElement&&this.selectionElement.removeEventListener("change",e)})}if(l&&this.image){const e=e=>{l({matrix:e.detail.matrix,oldMatrix:e.detail.oldMatrix})};this.image.addEventListener("transform",e),o.push(()=>{this.image&&this.image.removeEventListener("transform",e)})}if(this.canvasElement){if(n){const e=e=>n(e.detail);this.canvasElement.addEventListener("action",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("action",e)})}if(r){const e=e=>r(e.detail);this.canvasElement.addEventListener("actionstart",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionstart",e)})}if(a){const e=e=>a(e.detail);this.canvasElement.addEventListener("actionmove",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionmove",e)})}if(i){const e=e=>i(e.detail);this.canvasElement.addEventListener("actionend",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionend",e)})}}return()=>{o.forEach(e=>e())}}}async function Rn(e,t,l={}){const{format:n=null,originalFormat:r="webp",onSuccess:a=null,onError:i=null,accessibilityManager:o=null}=l;try{const l=window.limboCore?.config?.getGlobal(),i=n||l?.downloadFormat||r||"webp",c=`${t.split(".")[0]}.${i}`;if(o&&o.announce(`Descargando ${c}`),e.startsWith("data:image/"))return function(e,t){const l=document.createElement("a");l.href=e,l.download=t,l.style.display="none",document.body.appendChild(l),l.click(),setTimeout(()=>{document.body.removeChild(l)},100)}(e,c),a&&a(c),o&&o.announce(`${c} descargado correctamente`),!0;let u;try{if(u=await fetch(e,{mode:"cors"}),!u.ok)throw new Error(`HTTP error! status: ${u.status}`)}catch(s){if(!e.startsWith("http"))throw s;{const t=(window.limboCore?.config?.getGlobal()||{}).prod?"https://limbo.lefebvre.es":"https://led-dev-limbo-dev.eu.els.local",l=window.limboCore?.apiClient?.token||"",n=`${t}/api/atenea/proxy?url=${encodeURIComponent(e)}`;if(u=await fetch(n,{credentials:"include",headers:{Authorization:`Bearer ${l}`}}),!u.ok)throw new Error(`Proxy error: ${u.status}`)}}const d=await u.blob();let b=d;const m=d.type;m!==`image/${"jpg"===i?"jpeg":i}`&&function(e){return["webp","jpeg","jpg","svg","png"].includes(e.toLowerCase())}(i)&&(b=await async function(e,t){return new Promise(l=>{const n=new Image,r=URL.createObjectURL(e);n.onload=()=>{try{const a=document.createElement("canvas");a.width=n.width,a.height=n.height;a.getContext("2d").drawImage(n,0,0);const i=`image/${"jpg"===t?"jpeg":t}`,o="png"===t?void 0:.92;a.toBlob(t=>{URL.revokeObjectURL(r),l(t||e)},i,o)}catch(a){URL.revokeObjectURL(r),l(e)}},n.onerror=()=>{URL.revokeObjectURL(r),l(e)},n.src=r})}(d,i));const h=window.URL.createObjectURL(b),p=document.createElement("a");return p.href=h,p.download=c,p.style.display="none",document.body.appendChild(p),p.click(),setTimeout(()=>{window.URL.revokeObjectURL(h),document.body.removeChild(p)},100),a&&a(c),o&&o.announce(`${c} descargado correctamente`),!0}catch(c){return console.error("Error downloading image:",c),i&&i(c),o&&o.announce(`Error al descargar la imagen: ${c.message}`),!1}}const On=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Rn,downloadImage:Rn},Symbol.toStringTag,{value:"Module"}));function jn({image:e,onSave:i,onCancel:o,onDelete:d=null,onError:b=null,deleting:m=!1,onVariantCreated:h=null,onUpload:p=null,uploading:f=!1,cropperConfig:g=null}){const[v,y]=t(!1),[w,x]=t(null),[k,C]=t(!1),[S,N]=t(!0),[E,$]=t(!0),[_,T]=t(e.url||e.path||null);l(()=>{const t=e.url||e.path;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return void T(t);let l=!1;return _e(t,{bypassHttpCache:!0}).then(e=>{l||T(e)}).catch(()=>{l||T(t)}),()=>{l=!0}},[e.url,e.path]);const[A,z]=t({x:20,y:100}),[L,I]=t(!1),[M,P]=t({x:0,y:0}),[D,R]=t(!1),[O,j]=t(!0),[F,U]=t(!1),[B,q]=t({horizontal:!1,vertical:!1}),[W,V]=t(!1),[H,K]=t(!1),[G,Q]=t(!1),[X,Y]=t(!1),[J]=t(()=>{if(!e||!e.filename)return"image";const[t]=e.filename.split(".");return t}),Z=r(()=>{if(g)return{mandatoryCrops:g.mandatoryCrops||[],allowCustomCrops:!1!==g.allowAdditionalCrops,showDimensionInputs:!0===g.showDimensionInputs,maxCrops:g.maxCrops||null,localCropsOnly:!0===g.localCropsOnly,existingCrops:g.existingCrops||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,localCropsOnly:!0===e.cropper?.localCropsOnly,existingCrops:e.cropper?.existingCrops||null}},[g]),[ee,te]=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),format:e.format||null,savedState:null})):[{id:"crop-default-0",label:J,width:e.width||1920,height:e.height||1080,required:!1,isCustom:!0,confirmed:!1,savedState:null}]),[le,ne]=t(0),re=ee[le],ae=r(()=>re&&re.width&&re.height?re.width/re.height:"",[re]),ie=r(()=>{const e=50;if(!ae||""===ae)return{minWidth:e,minHeight:e};if(ae>=1){return{minWidth:e,minHeight:e/ae}}return{minWidth:e*ae,minHeight:e}},[ae]),[oe,se]=t(!1),[ce,ue]=t([]),[de,be]=t(null),me=window.limboCore?.accessibilityManager,{createVariantFromBlob:he,loading:pe,error:fe}=Pn(),ge=((e,a={})=>{const i=n(null),o=n(null),s=n(null),c=n(null),[u,d]=t(null),[b,m]=t(null),[h,p]=t(!1),[f,g]=t(!0),[v,y]=t(0),w={aspectRatio:"",shade:!0,paspartuFactor:.85,...a};l(()=>{i.current&&o.current&&s.current&&(c.current=new Dn(i,o,s),p(!0))},[]),l(()=>{if(c.current)return c.current.setupEventListeners({onSelectionChange:e=>{d(e)},onImageTransform:()=>{y(e=>e+1)}})},[h]),l(()=>{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();g(e);const t=o.current?.querySelector("img")||o.current;t?.naturalWidth&&t?.naturalHeight&&m({naturalWidth:t.naturalWidth,naturalHeight:t.naturalHeight,currentWidth:t.width,currentHeight:t.height})})()},[e]),l(()=>{c.current&&h&&c.current.selection.setAspectRatio(w.aspectRatio)},[w.aspectRatio,h]),l(()=>{c.current&&h&&c.current.canvas.setBackground(w.shade)},[w.shade,h]);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:i,imageRef:o,selectionRef:s},state:{cropData:u,imageInfo:b,isReady:h,canExport:f,transformVersion:v},transform:x,selection:k,utils:C,manager:c.current}})(e,{aspectRatio:ae||null,showGrid:S,shade:E,initialCoverage:.5,paspartuFactor:.85}),{refs:ve,state:ye,transform:we,selection:xe,utils:ke}=ge,{canvasRef:Ce,imageRef:Ne,selectionRef:Ee}=ve,{cropData:$e,imageInfo:Te,canExport:Ae,transformVersion:ze}=ye,Le=r(()=>Te||{naturalWidth:e.width||1920,naturalHeight:e.height||1080,currentWidth:e.width||1920,currentHeight:e.height||1080},[Te,e.width,e.height]),Ie=a(()=>N(e=>!e),[]),Me=a(()=>$(e=>!e),[]),Pe=a(()=>K(e=>!e),[]),De=a(()=>Q(e=>!e),[]),Re=a(()=>Y(e=>!e),[]),Oe=a(()=>we.center(),[we]),je=a(()=>xe.center(),[xe]),Fe=a(()=>xe.reset(),[xe]),Ue=a((e,t)=>we.move(e,t),[we]),Be=a(e=>we.zoom(e),[we]),qe=a(e=>we.rotate(e),[we]),We=a(e=>{xe.setCoverage(e)},[xe]),Ve=a(()=>{q(e=>{const t=!e.horizontal;return we.flipHorizontal(),{...e,horizontal:t}})},[we]),Ke=a(()=>{q(e=>{const t=!e.vertical;return we.flipVertical(),{...e,vertical:t}})},[we]),Ge=a(()=>{if(!ge.manager||!ye.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 l=null;if(Ne.current){const e=Ne.current.$getTransform?.();e&&Array.isArray(e)&&(l=[...e])}const n={cropData:e,selectorState:t,imageTransform:l,flipState:{horizontal:B.horizontal,vertical:B.vertical}};return te(e=>e.map((e,t)=>t===le?{...e,savedState:n}:e)),n}catch(e){return console.warn("Error saving crop state:",e),null}},[ge.manager,ye.isReady,$e,B,le,Ne,Ee]),Qe=a(e=>{const t=ee[e];if(t&&t.savedState)if(ge.manager&&ye.isReady)try{const{savedState:e}=t;if(e.imageTransform&&Ne.current&&Array.isArray(e.imageTransform)&&setTimeout(()=>{if(Ne.current&&Ne.current.$setTransform){const[t,l,n,r,a,i]=e.imageTransform;Ne.current.$setTransform(t,l,n,r,a,i)}},100),e.selectorState&&Ee.current){const{x:t,y:l,width:n,height:r}=e.selectorState;setTimeout(()=>{Ee.current&&(Ee.current.x=t,Ee.current.y=l,Ee.current.width=n,Ee.current.height=r,Ee.current.$render&&Ee.current.$render())},150)}e.flipState&&q({horizontal:e.flipState.horizontal??!1,vertical:e.flipState.vertical??!1})}catch(l){console.error("Error restoring crop state:",l),setTimeout(()=>{Oe(),setTimeout(()=>je(),100)},100)}else console.warn("Cropper not ready for state restoration");else setTimeout(()=>{Oe(),setTimeout(()=>je(),100)},100)},[ee,ge.manager,ye.isReady,Oe,je,Ee,Ne]),Xe=a(()=>{for(let e=0;e<ee.length;e++){const t=ee[e];if(!t.label||""===t.label.trim())return e}return-1},[ee]),Ye=a(async e=>{e!==le&&(U(!0),Ge(),await new Promise(e=>setTimeout(e,100)),ne(e),await new Promise(e=>setTimeout(e,250)),Qe(e),await new Promise(e=>setTimeout(e,200)),U(!1))},[le,Ge,Qe]),Je=a(()=>{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};te(e=>[...e,t]),me?.announce(`Nuevo recorte personalizado añadido: ${t.label}. Selecciónalo para editarlo.`)},[Z.allowCustomCrops,ee.length,e.width,e.height,me]),Ze=a((e,t)=>{const l=parseInt(t,10);""===t||isNaN(l)||te(t=>t.map((t,n)=>n===le?{...t,[e]:l}:t))},[le]),et=a(e=>{const t=re[e];let l=100;if(Ce.current&&Te){const e=Ce.current.getBoundingClientRect(),t=Math.min(e.width,e.height);l=Math.max(100,Math.round(.05*t))}const n=Math.max(l,Math.min(3500,t));n!==t&&te(t=>t.map((t,l)=>l===le?{...t,[e]:n}:t));const r={...re,[e]:n},a=r.width/r.height,i=xe.getData?.();xe.setAspectRatio(a),i&&void 0!==i.x&&setTimeout(()=>{xe.set?.(i.x,i.y,i.width,i.height)},50)},[le,re,xe,Ce,Te]),tt=a(e=>{te(t=>t.map((t,l)=>l===le?{...t,label:e}:t))},[le]),lt=a((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 l=ee[e];if(l.required)alert("No se puede eliminar un recorte obligatorio.");else if(1!==ee.length){if(te(t=>t.filter((t,l)=>l!==e)),e===le){const t=Math.max(0,e-1);ne(t)}else e<le&&ne(e=>e-1);me?.announce(`Recorte ${l.label} eliminado`)}else alert("Debe haber al menos un recorte.")},[ee,le,me]),nt=a(async()=>{if(!Ae)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}},[Ae,e.mime_type,xe]),rt=a(async()=>{if(v)return y(!1),x(null),void C(!1);if(Ae){y(!0),C(!0);try{const e=await nt();e?x(e):(y(!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.")},[Ae,nt,v]),at=a(e=>{e.target.closest(".limbo-preview-modal-header")&&(I(!0),P({x:e.clientX-A.x,y:e.clientY-A.y}))},[A]),it=a(e=>{L&&(e.preventDefault(),z({x:e.clientX-M.x,y:e.clientY-M.y}))},[L,M]),ot=a(()=>{I(!1)},[]),st=a(e=>{if(!e.target.closest(".limbo-preview-modal-header"))return;const t=e.touches[0];I(!0),P({x:t.clientX-A.x,y:t.clientY-A.y})},[A]),ct=a(e=>{if(!L)return;e.preventDefault();const t=e.touches[0];z({x:t.clientX-M.x,y:t.clientY-M.y})},[L,M]),ut=a(()=>{I(!1)},[]);l(()=>{if(L)return document.addEventListener("mousemove",it),document.addEventListener("mouseup",ot),document.addEventListener("touchmove",ct,{passive:!1}),document.addEventListener("touchend",ut),()=>{document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",ot),document.removeEventListener("touchmove",ct),document.removeEventListener("touchend",ut)}},[L,it,ot,ct,ut]),l(()=>{if(!D)return;const e=e=>{"Escape"===e.key&&R(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[D]);const dt=a(async(t,l=null)=>{const n=ee[t];if(!n)throw new Error(`Crop ${t} no encontrado`);if(!n.savedState&&t!==le)throw new Error(`El recorte "${n.label}" aún no ha sido configurado`);const r={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!==le&&n.savedState){if(n.savedState.imageTransform&&Ne.current?.$setTransform){const[e,t,l,r,a,i]=n.savedState.imageTransform;Ne.current.$setTransform(e,t,l,r,a,i)}if(n.savedState.selectorState&&Ee.current?.$change){const{x:e,y:t,width:l,height:r}=n.savedState.selectorState;Ee.current.$change(e,t,l,r,NaN,!0)}await new Promise(e=>setTimeout(e,100))}const r=Math.min(n.width,3500),i=Math.min(n.height,3500);let o=await xe.toCanvas({width:r,height:i,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!o)throw new Error(`No se pudo generar el canvas para "${n.label}"`);if(o.width!==r||o.height!==i){const e=document.createElement("canvas");e.width=r,e.height=i;const t=e.getContext("2d");t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(o,0,0,r,i),o=e}const s=n.format||globalThis.downloadFormat||"webp",c="webp"===s?"image/webp":"png"===s?"image/png":"image/jpeg",u=.9,d=await new Promise((e,t)=>{o.toBlob(l=>{l?e(l):t(new Error("No se pudo convertir el canvas a blob"))},c,u)}),b=`${Lt(n.label||"crop")}_${r}_${i}`,m=l||e.id,f=!m||"string"==typeof m&&m.startsWith("external"),g=(f||Z.localCropsOnly)&&!p;if(f&&p&&!Z.localCropsOnly)try{const e=new File([d],`${b}.${s}`,{type:c}),t=await p(e);if(t&&(t.id||t.url)){const e=n.savedState||{selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null,imageTransform:Ne.current?.$getTransform?.()||null,flipState:{horizontal:B.horizontal,vertical:B.vertical}},l={id:t.id||`uploaded-${Date.now()}`,name:b,filename:`${b}.${s}`,url:t.urlSigned||t.url,urlSigned:t.urlSigned||t.url,width:r,height:i,format:s,size:d.size,mime_type:c,isLocal:!1,originalAssetId:null,uploadedAssetId:t.id,cropState:e};return me?.announceSuccess(`Recorte guardado: ${b}`),l}}catch(a){console.error("[CropperView] ❌ Error subiendo crop, fallback a local:",a)}if(g){const e=URL.createObjectURL(d),t=n.savedState||{selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null,imageTransform:Ne.current?.$getTransform?.()||null,flipState:{horizontal:B.horizontal,vertical:B.vertical}},l={id:`local-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:b,filename:`${b}.${s}`,url:e,urlSigned:e,width:r,height:i,format:s,size:d.size,mime_type:c,blob:d,isLocal:!0,originalAssetId:m||null,cropState:t};return me?.announceSuccess(`Recorte creado localmente: ${b}`),l}const v=n.savedState||{selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null,imageTransform:Ne.current?.$getTransform?.()||null,flipState:{horizontal:B.horizontal,vertical:B.vertical}},y=await he(m,d,{name:b,width:r,height:i,format:s});if(y)return y.cropState=v,me?.announceSuccess(`Recorte creado: ${b}`),h?.(m,y),y;throw new Error("No se pudo crear la variante")}finally{if(t!==le&&r.imageTransform&&Ne.current?.$setTransform){const[e,t,l,n,a,i]=r.imageTransform;if(Ne.current.$setTransform(e,t,l,n,a,i),r.selectorState&&Ee.current?.$change){const{x:e,y:t,width:l,height:n}=r.selectorState;Ee.current.$change(e,t,l,n,NaN,!0)}}}},[ee,le,xe,he,e.id,h,me,Ne,Ee]),bt=a(async()=>{if(!Ae){const e="No se puede exportar el recorte por restricciones de CORS en la imagen original.";return me?.announceError(e),void alert(e)}if(!ye.isReady){const e="El cropper aún no está inicializado. Espera un momento e inténtalo de nuevo.";return me?.announceError(e),void alert(e)}Ge(),me?.announce("Creando recorte de la imagen");try{let t=e.id,l=null;if(e.file&&p){me?.announce("Subiendo imagen...");const n=await p(e.file);if(!n||!n.id)throw new Error("No se pudo subir la imagen al servidor");t=n.id,l=n,me?.announceSuccess("Imagen subida correctamente")}const n=await dt(le,t);n&&i(l?{crops:[n],asset:l}:n)}catch(t){console.warn("Error creating crop variant:",t);const e=t.message||"No se pudo crear el recorte. Inténtalo de nuevo.";me?.announceError(e),alert(e),b?.(t)}},[Ae,ye.isReady,me,Ge,dt,le,i,b,e.file,e.id,p]),mt=a(async t=>{Ge(),me?.announce(`Guardando ${t.length} recortes...`);try{let n=e.id,r=null;if(e.file&&p){me?.announce("Subiendo imagen...");const t=await p(e.file,e.tags||null);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");n=t.id,r=t,me?.announceSuccess("Imagen subida correctamente")}const a=[],o=[];for(const e of t)try{const t=await dt(e,n);t&&a.push(t)}catch(l){o.push({crop:ee[e]?.label||`Crop ${e}`,error:l.message})}if(a.length>0&&(me?.announceSuccess(`${a.length} recorte(s) guardado(s) correctamente`),i(r?{crops:a,asset:r}:a)),o.length>0){const e=`Errores al guardar algunos recortes:\n${o.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;me?.announceError(e),alert(e)}}catch(l){const e=l.message||"Error al procesar los recortes";me?.announceError(e),alert(e),b?.(l)}},[Ge,dt,ee,me,i,e.file,e.id,p,b]),ht=a(async()=>{(re.width>3500||re.height>3500)&&alert("Las dimensiones máximas permitidas son 3500x3500 píxeles. Por favor, ajusta el tamaño del recorte."),re.width=Math.min(re.width,3500),re.height=Math.min(re.height,3500);const e=Xe();if(-1!==e){const t=ee[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void ne(e)}const t=ee.findIndex((e,t)=>e.required&&!e.savedState&&t!==le);if(-1!==t){const e=ee[t];return alert(`El recorte obligatorio "${e.label}" aún no ha sido configurado.\n\nPor favor, configura todos los recortes obligatorios antes de guardar.`),ne(t),void me?.announce(`Recorte obligatorio "${e.label}" sin configurar. Por favor, configúralo.`,"assertive")}if(ee.length>1){be("save");const e=ee.map((e,t)=>({crop:e,index:t})).filter(({crop:e,index:t})=>e.required||e.savedState||t===le).map(({index:e})=>e);return ue(e),void se(!0)}await bt()},[Xe,ee,bt,le,me]),pt=a(async t=>{const l=ee[t];if(!l)throw new Error(`Crop ${t} no encontrado`);if(!l.savedState&&t!==le)throw new Error(`El recorte "${l.label}" aún no ha sido configurado`);const n={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!==le&&l.savedState){if(l.savedState.imageTransform&&Ne.current?.$setTransform){const[e,t,n,r,a,i]=l.savedState.imageTransform;Ne.current.$setTransform(e,t,n,r,a,i)}if(l.savedState.selectorState&&Ee.current?.$change){const{x:e,y:t,width:n,height:r}=l.savedState.selectorState;Ee.current.$change(e,t,n,r,NaN,!0)}await new Promise(e=>setTimeout(e,100))}const n=await xe.toCanvas({width:l.width,height:l.height,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!n)throw new Error(`No se pudo generar el canvas para "${l.label}"`);const r=n.toDataURL(`image/${globalThis.downloadFormat||e.mime_type?.split("/")[1]||"webp"}`,.9),a=`${Lt(l.label||"crop")}_${l.width}_${l.height}`;return await Rn(r,a,{accessibilityManager:me,onSuccess:e=>{console.log(`✅ Descargado: ${e}`)},onError:e=>{throw new Error(`Error al descargar "${l.label}": ${e.message}`)}}),{crop:l.label,filename:a}}finally{if(t!==le&&n.imageTransform&&Ne.current?.$setTransform){const[e,t,l,r,a,i]=n.imageTransform;if(Ne.current.$setTransform(e,t,l,r,a,i),n.selectorState&&Ee.current?.$change){const{x:e,y:t,width:l,height:r}=n.selectorState;Ee.current.$change(e,t,l,r,NaN,!0)}}}},[ee,le,xe,e.mime_type,me,Ne,Ee]),ft=a(async e=>{Ge(),me?.announce(`Descargando ${e.length} recortes...`);const t=[],l=[];for(const r of e)try{const e=await pt(r);e&&t.push(e)}catch(n){l.push({crop:ee[r]?.label||`Crop ${r}`,error:n.message})}if(t.length>0&&me?.announceSuccess(`${t.length} recorte(s) descargado(s) correctamente`),l.length>0){const e=`Errores al descargar algunos recortes:\n${l.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;me?.announceError(e),alert(e)}},[Ge,pt,ee,me]),gt=a(async()=>{if(!Ae){const e="No se puede descargar el recorte por restricciones de CORS en la imagen original.";return me?.announceError(e),void alert(e)}Ge(),me?.announce("Preparando descarga del recorte");try{await pt(le),me?.announceSuccess("Recorte descargado correctamente")}catch(e){console.error("Error downloading crop:",e);const t=e.message||"Error al descargar el recorte";me?.announceError(t),alert(t)}},[Ae,me,Ge,pt,le]),vt=a(async()=>{const e=Xe();if(-1!==e){const t=ee[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void ne(e)}if(ee.length>1){be("download");const e=ee.map((e,t)=>({crop:e,index:t})).filter(({crop:e,index:t})=>e.savedState||t===le).map(({index:e})=>e);return ue(e),void se(!0)}await gt()},[Xe,ee,gt,le]),yt=r(()=>!!e.file||(!e.id||!("string"!=typeof e.id||!e.id.startsWith("external"))),[e.file,e.id]),wt=a(async()=>{try{if(e.file&&p){me?.announce("Subiendo imagen original...");const t=await p(e.file);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");return me?.announceSuccess("Imagen guardada correctamente"),void i({asset:t,crops:[]})}if(yt){me?.announce("Conservando imagen original...");const t={id:`local-original-${Date.now()}`,name:e.filename||"original",filename:e.filename||"image.jpg",url:e.url,urlSigned:e.url,width:e.width||Te?.naturalWidth||1920,height:e.height||Te?.naturalHeight||1080,mime_type:e.mime_type||"image/jpeg",isLocal:!0,isOriginal:!0};return me?.announceSuccess("Imagen original conservada"),void i({crops:[t]})}if(e.id&&!e.id.startsWith("external")){me?.announce("Seleccionando imagen original...");const t={id:e.id,name:e.filename||"original",filename:e.filename||"image.jpg",url:e.url,urlSigned:e.urlSigned||e.url,width:e.width||Te?.naturalWidth||1920,height:e.height||Te?.naturalHeight||1080,mime_type:e.mime_type||"image/jpeg",isOriginal:!0};return me?.announceSuccess("Imagen original seleccionada"),void i({crops:[t],assetId:e.id})}o()}catch(t){console.error("Error guardando imagen original:",t);const e=t.message||"No se pudo guardar la imagen. Inténtalo de nuevo.";me?.announceError(e),alert(e),b?.(t)}},[e,Te,p,o,i,b,me,yt]);return l(()=>{y(!1),x(null)},[e]),l(()=>{if(!ge.manager||!ye.isReady||!O)return;const e=Z.existingCrops?.[0],t=e?.cropState;setTimeout(()=>{Oe(),setTimeout(()=>{if(t){if(t.imageTransform&&Ne.current?.$setTransform){const[e,l,n,r,a,i]=t.imageTransform;Ne.current.$setTransform(e,l,n,r,a,i)}if(t.selectorState&&Ee.current){const{x:e,y:l,width:n,height:r}=t.selectorState;Ee.current.x=e,Ee.current.y=l,Ee.current.width=n,Ee.current.height=r,Ee.current.$render?.()}t.flipState&&q(t.flipState)}else je();j(!1)},100)},50)},[ge.manager,ye.isReady,O,Oe,je,Z.existingCrops]),l(()=>{ge.manager&&ye.isReady&&(ae&&xe.setAspectRatio(ae),ke.setBackground(E))},[ae,E,ge.manager,ye.isReady,xe,ke]),l(()=>{if(!Te||!ye.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(Te.naturalWidth,3500),l=Math.min(Te.naturalHeight,3500);te([{...e,width:t,height:l}])}},[Te,ye.isReady,Z.mandatoryCrops.length,ee]),l(()=>{if(!v||!Ae)return;const e=setTimeout(async()=>{C(e=>!w&&!e||e);try{const e=await nt();e&&x(e)}finally{C(!1)}},300);return()=>{clearTimeout(e),C(!1)}},[$e,ze,v,Ae,nt,ae,B,w]),l(()=>{const e=Ce.current,t=t=>{if("Delete"===t.key||"Backspace"===t.key||"Backspace"===t.key&&t.metaKey||"Backspace"===t.key&&t.ctrlKey){const l=t.target;if(e&&(l===e||l===document.body||l===document.documentElement||"CROPPER-CANVAS"===l.tagName||"CROPPER-SELECTION"===l.tagName||"CROPPER-IMAGE"===l.tagName||"CROPPER-HANDLE"===l.tagName||"CROPPER-GRID"===l.tagName||l.closest("cropper-canvas")||e.contains(l)))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__ */c("div",{className:"limbo-cropper-view lb:px-2 lb:border-2 lb:border-gray-200/50 lb:rounded-lg lb:max-w-7xl lb:mx-auto lb:w-full lb:min-w-full lb:h-full lb:min-h-full lb:flex lb:flex-col",children:[
|
|
455
|
+
/* @__PURE__ */s(Bt,{onSelect:e,onVideoSelect:t,disabled:l,apiKey:o,prod:u,allowedCategories:d,resolvedAccept:b,returnConfig:m,folderConfig:h,aiStarterPrompt:p,selectedFolder:i,onFolderChange:n,tags:g,onTagsChange:v})]})}const Wt="undefined"!=typeof window&&void 0!==window.document,Vt=Wt?window:{},Ht=!!Wt&&"ontouchstart"in Vt.document.documentElement,Kt=!!Wt&&"PointerEvent"in Vt,Gt="cropper",Qt=`${Gt}-canvas`,Xt=`${Gt}-crosshair`,Yt=`${Gt}-grid`,Jt=`${Gt}-handle`,Zt=`${Gt}-image`,en=`${Gt}-selection`,tn=`${Gt}-shade`,nn=`${Gt}-viewer`,ln="select",rn="move",an="scale",on="rotate",sn="transform",cn="none",un="n-resize",dn="e-resize",bn="s-resize",mn="w-resize",hn="ne-resize",pn="nw-resize",fn="se-resize",gn="sw-resize",vn=Kt?"pointerdown":Ht?"touchstart":"mousedown",yn=Kt?"pointermove":Ht?"touchmove":"mousemove",wn=Kt?"pointerup pointercancel":Ht?"touchend touchcancel":"mouseup",xn="error",kn="keydown",Cn="load",Sn="resize",Nn="wheel",En="action",$n="actionend",_n="actionstart",Tn="change",An="transform";const zn=Number.isNaN||Vt.isNaN;function Ln(e){return"number"==typeof e&&!zn(e)}function Mn(e){return Ln(e)&&e>0&&e<1/0}function Pn(e){return"object"==typeof e&&null!==e}const{hasOwnProperty:In}=Object.prototype;function Dn(e){if(!Pn(e))return!1;try{const{constructor:t}=e,{prototype:n}=t;return t&&n&&In.call(n,"isPrototypeOf")}catch(t){return!1}}function Rn(e){return"function"==typeof e}function On(e){return"object"==typeof e&&null!==e&&1===e.nodeType}const Fn=/([a-z\d])([A-Z])/g;function jn(e){return String(e).replace(Fn,"$1-$2").toLowerCase()}const Un=/-[A-z\d]/g;function Bn(e){return e.replace(Un,e=>e.slice(1).toUpperCase())}const qn=/\s\s*/;function Wn(e,t,n,l){t.trim().split(qn).forEach(t=>{e.removeEventListener(t,n,l)})}function Vn(e,t,n,l){t.trim().split(qn).forEach(t=>{e.addEventListener(t,n,l)})}function Hn(e,t,n,l){Vn(e,t,n,Object.assign(Object.assign({},l),{once:!0}))}const Kn={bubbles:!0,cancelable:!0,composed:!0};const Gn=Promise.resolve();function Qn(e){const{documentElement:t}=e.ownerDocument,n=e.getBoundingClientRect();return{left:n.left+(Vt.pageXOffset-t.clientLeft),top:n.top+(Vt.pageYOffset-t.clientTop)}}const Xn=/deg|g?rad|turn$/i;function Yn(e){const t=parseFloat(e)||0;if(0!==t){const[n="rad"]=String(e).match(Xn)||[];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 Jn="contain";function Zn(e,t=Jn){const{aspectRatio:n}=e;let{width:l,height:r}=e;const a=Mn(l),i=Mn(r);if(a&&i){const e=r*n;t===Jn&&e>l||"cover"===t&&e<l?r=l/n:l=r*n}else a?r=l/n:i&&(l=r*n);return{width:l,height:r}}function el(e,...t){if(0===t.length)return e;const[n,l,r,a,i,o]=e,[s,c,u,d,b,m]=t[0];return el(e=[n*s+r*c,l*s+a*c,n*u+r*d,l*u+a*d,n*b+r*m+i,l*b+a*m+o],...t.slice(1))}const tl=/left|top|width|height/i,nl="open",ll=/* @__PURE__ */new WeakMap,rl=/* @__PURE__ */new WeakMap,al=/* @__PURE__ */new Map,il=Vt.document&&Array.isArray(Vt.document.adoptedStyleSheets)&&"replaceSync"in Vt.CSSStyleSheet.prototype;class ol extends HTMLElement{get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}constructor(){var e,t;super(),this.shadowRootMode=nl,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&&al.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 l=Bn(e);let r=n;switch(typeof this[l]){case"boolean":r=null!==n&&"false"!==n;break;case"number":r=Number(n)}switch(this[l]=r,e){case"theme-color":{const e=rl.get(this),t=this.$sharedStyle;e&&t&&(il?e.replaceSync(t):e.textContent=t);break}}}$propertyChangedCallback(e,t,n){if(!Object.is(n,t))switch(e=jn(e),typeof n){case"boolean":!0===n?this.hasAttribute(e)||this.setAttribute(e,""):this.removeAttribute(e);break;case"number":n=zn(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=Bn(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 l=n;n=e,this.$propertyChangedCallback(t,l,e)}})});const e=this.shadowRoot||this.attachShadow({mode:this.shadowRootMode||nl});if(ll.set(this,e),rl.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(){rl.has(this)&&rl.delete(this),ll.has(this)&&ll.delete(this)}$getTagNameOf(e){var t;return null!==(t=al.get(e))&&void 0!==t?t:e}$setStyles(e){return Object.keys(e).forEach(t=>{let n=e[t];Ln(n)&&(n=0!==n&&tl.test(t)?`${n}px`:String(n)),this.style[t]=n}),this}$getShadowRoot(){return this.shadowRoot||ll.get(this)}$addStyles(e){let t;const n=this.$getShadowRoot();return il?(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,l){return e.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign(Object.assign({},Kn),{detail:n}),l)))}(this,e,t,n)}$nextTick(e){return function(e,t){return t?Gn.then(e?t.bind(e):t):Gn}(this,e)}static $define(e,t){Pn(e)&&(t=e,e=""),e||(e=this.$name||this.name),e=jn(e),Wt&&Vt.customElements&&!Vt.customElements.get(e)&&customElements.define(e,this,t)}}ol.$version="2.1.1";class sl extends ol{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=cn,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),Vn(this,vn,this.$onPointerDown)),this.$onPointerMove||(this.$onPointerMove=this.$handlePointerMove.bind(this),Vn(this.ownerDocument,yn,this.$onPointerMove)),this.$onPointerUp||(this.$onPointerUp=this.$handlePointerUp.bind(this),Vn(this.ownerDocument,wn,this.$onPointerUp)),this.$onWheel||(this.$onWheel=this.$handleWheel.bind(this),Vn(this,Nn,this.$onWheel,{passive:!1,capture:!0}))}$unbind(){this.$onPointerDown&&(Wn(this,vn,this.$onPointerDown),this.$onPointerDown=null),this.$onPointerMove&&(Wn(this.ownerDocument,yn,this.$onPointerMove),this.$onPointerMove=null),this.$onPointerUp&&(Wn(this.ownerDocument,wn,this.$onPointerUp),this.$onPointerUp=null),this.$onWheel&&(Wn(this,Nn,this.$onWheel,{capture:!0}),this.$onWheel=null)}$handlePointerDown(e){const{buttons:t,button:n,type:l}=e;if(this.disabled||("pointerdown"===l&&"mouse"===e.pointerType||"mousedown"===l)&&(Ln(t)&&1!==t||Ln(n)&&0!==n||e.ctrlKey))return;const{$pointers:r}=this;let a="";if(e.changedTouches)Array.from(e.changedTouches).forEach(({identifier:e,pageX:t,pageY:n})=>{r.set(e,{startX:t,startY:n,endX:t,endY:n})});else{const{pointerId:t=0,pageX:n,pageY:l}=e;r.set(t,{startX:n,startY:l,endX:n,endY:l})}r.size>1?a=sn:On(e.target)&&(a=e.target.action||e.target.getAttribute("action")||""),!1!==this.$emit(_n,{action:a,relatedEvent:e})&&(e.preventDefault(),this.$action=a,this.style.willChange="transform")}$handlePointerMove(e){const{$action:t,$pointers:n}=this;if(this.disabled||t===cn||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:l})=>{const r=n.get(e);r&&Object.assign(r,{endX:t,endY:l})});else{const{pointerId:t=0,pageX:l,pageY:r}=e,a=n.get(t);a&&Object.assign(a,{endX:l,endY:r})}const l={action:t,relatedEvent:e};if(t===sn){const t=new Map(n);let r=0,a=0,i=0,o=0,s=e.pageX,c=e.pageY;n.forEach((e,n)=>{t.delete(n),t.forEach(t=>{let n=t.startX-e.startX,l=t.startY-e.startY,u=t.endX-e.endX,d=t.endY-e.endY,b=0,m=0,h=0,p=0;if(0===n?l<0?h=2*Math.PI:l>0&&(h=Math.PI):n>0?h=Math.PI/2+Math.atan(l/n):n<0&&(h=1.5*Math.PI+Math.atan(l/n)),0===u?d<0?p=2*Math.PI:d>0&&(p=Math.PI):u>0?p=Math.PI/2+Math.atan(d/u):u<0&&(p=1.5*Math.PI+Math.atan(d/u)),p>0||h>0){const n=p-h,l=Math.abs(n);l>r&&(r=l,i=n,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}if(n=Math.abs(n),l=Math.abs(l),u=Math.abs(u),d=Math.abs(d),n>0&&l>0?b=Math.sqrt(n*n+l*l):n>0?b=n:l>0&&(b=l),u>0&&d>0?m=Math.sqrt(u*u+d*d):u>0?m=u:d>0&&(m=d),b>0&&m>0){const n=(m-b)/b,l=Math.abs(n);l>a&&(a=l,o=n,s=(e.startX+t.startX)/2,c=(e.startY+t.startY)/2)}})});const u=r>0,d=a>0;u&&d?(l.rotate=i,l.scale=o,l.centerX=s,l.centerY=c):u?(l.action=on,l.rotate=i,l.centerX=s,l.centerY=c):d?(l.action=an,l.scale=o,l.centerX=s,l.centerY=c):l.action=cn}else{const[e]=Array.from(n.values());Object.assign(l,e)}n.forEach(e=>{e.startX=e.endX,e.startY=e.endY}),l.action!==cn&&this.$emit(En,l,{cancelable:!1})}$handlePointerUp(e){const{$action:t,$pointers:n}=this;if(!this.disabled&&t!==cn&&!1!==this.$emit($n,{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=cn)}}$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(En,{action:an,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 l=document.createElement("canvas");let r=this.offsetWidth,a=this.offsetHeight,i=1;Dn(e)&&(Mn(e.width)||Mn(e.height))&&(({width:r,height:a}=Zn({aspectRatio:r/a,width:e.width,height:e.height})),i=r/this.offsetWidth),l.width=r,l.height=a;const o=this.querySelector(this.$getTagNameOf(Zt));o?o.$ready().then(n=>{const s=l.getContext("2d");if(s){const[t,c,u,d,b,m]=o.$getTransform();let h=b,p=m,f=n.naturalWidth,g=n.naturalHeight;1!==i&&(h*=i,p*=i,f*=i,g*=i);const v=f/2,y=g/2;s.fillStyle="transparent",s.fillRect(0,0,r,a),Dn(e)&&Rn(e.beforeDraw)&&e.beforeDraw.call(this,s,l),s.save(),s.translate(v,y),s.transform(t,c,u,d,h,p),s.translate(-v,-y),s.drawImage(n,0,0,f,g),s.restore()}t(l)}).catch(n):t(l)})}}sl.$name=Qt,sl.$version="2.1.1";const cl=/* @__PURE__ */new WeakMap,ul=["alt","crossorigin","decoding","elementtiming","fetchpriority","loading","referrerpolicy","sizes","src","srcset"];class dl extends ol{constructor(){super(...arguments),this.$isReady=!1,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){cl.set(this,e)}get $canvas(){return cl.get(this)}static get observedAttributes(){return super.observedAttributes.concat(ul,["initial-center-size","rotatable","scalable","skewable","translatable"])}attributeChangedCallback(e,t,n){Object.is(n,t)||(super.attributeChangedCallback(e,t,n),ul.includes(e)&&this.$image.setAttribute(e,n))}$propertyChangedCallback(e,t,n){if(!Object.is(n,t))switch(super.$propertyChangedCallback(e,t,n),e){case"initialCenterSize":this.$nextTick(()=>{this.$center(n)});break;case"src":this.$isReady=!1}}connectedCallback(){super.connectedCallback();const{$image:e}=this,t=this.closest(this.$getTagNameOf(Qt));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),Vn(t,_n,this.$onCanvasActionStart),Vn(t,$n,this.$onCanvasActionEnd),Vn(t,En,this.$onCanvasAction)),this.$onLoad=this.$handleLoad.bind(this),Vn(e,Cn,this.$onLoad),this.$getShadowRoot().appendChild(e)}disconnectedCallback(){const{$image:e,$canvas:t}=this;t&&(this.$onCanvasActionStart&&(Wn(t,_n,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(Wn(t,$n,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(Wn(t,En,this.$onCanvasAction),this.$onCanvasAction=null)),e&&this.$onLoad&&(Wn(e,Cn,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),this.$isReady=!0}$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:l}=n;switch(l!==sn||this.rotatable&&this.scalable||(l=this.rotatable?on:this.scalable?an:cn),l){case rn:if(this.translatable){let l=null;e&&(l=e.target.closest(this.$getTagNameOf(en))),l||(l=t.querySelector(this.$getTagNameOf(en))),l&&l.multiple&&!l.active&&(l=t.querySelector(`${this.$getTagNameOf(en)}[active]`)),l&&!l.hidden&&l.movable&&!l.dynamic&&this.$actionStartTarget&&l.contains(this.$actionStartTarget)||this.$move(n.endX-n.startX,n.endY-n.startY)}break;case on:if(this.rotatable)if(e){const{x:t,y:l}=this.getBoundingClientRect();this.$rotate(n.rotate,e.clientX-t,e.clientY-l)}else this.$rotate(n.rotate);break;case an:if(this.scalable)if(e){const t=e.target.closest(this.$getTagNameOf(en));if(!t||!t.zoomable||t.zoomable&&t.dynamic){const{x:t,y:l}=this.getBoundingClientRect();this.$zoom(n.scale,e.clientX-t,e.clientY-l)}}else this.$zoom(n.scale);break;case sn:if(this.rotatable&&this.scalable){const{rotate:t}=n;let{scale:l}=n;l<0?l=1/(1-l):l+=1;const r=Math.cos(t),a=Math.sin(t),[i,o,s,c]=[r*l,a*l,-a*l,r*l];if(e){const t=this.getBoundingClientRect(),n=e.clientX-t.x,l=e.clientY-t.y,[r,a,u,d]=this.$matrix,b=n-t.width/2,m=l-t.height/2,h=(b*d-u*m)/(r*d-u*a),p=(m*r-a*b)/(r*d-u*a);this.$transform(i,o,s,c,h*(1-i)+p*s,p*(1-c)+h*o)}else this.$transform(i,o,s,c,0,0)}}}}$ready(e){const{$image:t}=this,n=new Promise((e,n)=>{const l=new Error("Failed to load the image source");if(t.complete)t.naturalWidth>0&&t.naturalHeight>0?e(t):n(l);else{const r=()=>{Wn(t,xn,a),setTimeout(()=>{e(t)})},a=()=>{Wn(t,Cn,r),n(l)};Hn(t,Cn,r),Hn(t,xn,a)}});return Rn(e)&&n.then(t=>(e(t),t)),n}$center(e){const{parentElement:t}=this;if(!t)return this;const n=t.getBoundingClientRect(),l=n.width,r=n.height,{x:a,y:i,width:o,height:s}=this.getBoundingClientRect(),c=a+o/2,u=i+s/2,d=n.x+l/2,b=n.y+r/2,{translatable:m}=this;if(m||this.$isReady||(this.translatable=!0,this.$nextTick(()=>{this.translatable=m})),this.$move(d-c,b-u),e&&(o!==l||s!==r)){const t=l/o,n=r/s,{scalable:a}=this;switch(!e||a||this.$isReady||(this.scalable=!0,this.$nextTick(()=>{this.scalable=a})),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&&Ln(e)&&Ln(t)){const[n,l,r,a]=this.$matrix,i=(e*a-r*t)/(n*a-r*l),o=(t*n-l*e)/(n*a-r*l);this.$translate(i,o)}return this}$moveTo(e,t=e){if(this.translatable&&Ln(e)&&Ln(t)){const[n,l,r,a]=this.$matrix,i=(e*a-r*t)/(n*a-r*l),o=(t*n-l*e)/(n*a-r*l);this.$setTransform(n,l,r,a,i,o)}return this}$rotate(e,t,n){if(this.rotatable){const l=Yn(e),r=Math.cos(l),a=Math.sin(l),[i,o,s,c]=[r,a,-a,r];if(Ln(t)&&Ln(n)){const[e,l,r,a]=this.$matrix,{width:u,height:d}=this.getBoundingClientRect(),b=t-u/2,m=n-d/2,h=(b*a-r*m)/(e*a-r*l),p=(m*e-l*b)/(e*a-r*l);this.$transform(i,o,s,c,h*(1-i)-p*s,p*(1-c)-h*o)}else this.$transform(i,o,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,Ln(t)&&Ln(n)){const[l,r,a,i]=this.$matrix,{width:o,height:s}=this.getBoundingClientRect(),c=t-o/2,u=n-s/2,d=(c*i-a*u)/(l*i-a*r),b=(u*l-r*c)/(l*i-a*r);this.$transform(e,0,0,e,d*(1-e),b*(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=Yn(e),l=Yn(t);this.$transform(1,Math.tan(l),Math.tan(n),1,0,0)}return this}$translate(e,t=e){return this.translatable&&Ln(e)&&Ln(t)&&this.$transform(1,0,0,1,e,t),this}$transform(e,t,n,l,r,a){return Ln(e)&&Ln(t)&&Ln(n)&&Ln(l)&&Ln(r)&&Ln(a)?this.$setTransform(el(this.$matrix,[e,t,n,l,r,a])):this}$setTransform(e,t,n,l,r,a){if((this.rotatable||this.scalable||this.skewable||this.translatable)&&(Array.isArray(e)&&([e,t,n,l,r,a]=e),Ln(e)&&Ln(t)&&Ln(n)&&Ln(l)&&Ln(r)&&Ln(a))){const i=[...this.$matrix],o=[e,t,n,l,r,a];if(!1===this.$emit(An,{matrix:o,oldMatrix:i}))return this;this.$matrix=o,this.style.transform=`matrix(${o.join(", ")})`}return this}$getTransform(){return this.$matrix.slice()}$resetTransform(){return this.$setTransform([1,0,0,1,0,0])}}dl.$name=Zt,dl.$version="2.1.1";const bl=/* @__PURE__ */new WeakMap;class ml extends ol{constructor(){super(...arguments),this.$onWindowResize=null,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){bl.set(this,e)}get $canvas(){return bl.get(this)}static get observedAttributes(){return super.observedAttributes.concat(["height","width","x","y"])}connectedCallback(){super.connectedCallback();const e=this.closest(this.$getTagNameOf(Qt));if(e){this.$canvas=e,this.style.position="absolute";const t=e.querySelector(this.$getTagNameOf(en));t&&(this.$onWindowResize=this.$render.bind(this),this.$onCanvasActionStart=e=>{t.hidden&&e.detail.action===ln&&(this.hidden=!1)},this.$onCanvasActionEnd=e=>{t.hidden&&e.detail.action===ln&&(this.hidden=!0)},this.$onSelectionChange=e=>{const{x:n,y:l,width:r,height:a}=e.defaultPrevented?t:e.detail;this.$change(n,l,r,a),(t.hidden||0===n&&0===l&&0===r&&0===a)&&(this.hidden=!0)},Vn(window,Sn,this.$onWindowResize),Vn(e,_n,this.$onCanvasActionStart),Vn(e,$n,this.$onCanvasActionEnd),Vn(e,Tn,this.$onSelectionChange))}this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onWindowResize&&(Wn(window,Sn,this.$onWindowResize),this.$onWindowResize=null),this.$onCanvasActionStart&&(Wn(e,_n,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(Wn(e,$n,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onSelectionChange&&(Wn(e,Tn,this.$onSelectionChange),this.$onSelectionChange=null)),super.disconnectedCallback()}$change(e,t,n=this.width,l=this.height){return Ln(e)&&Ln(t)&&Ln(n)&&Ln(l)&&(e!==this.x||t!==this.y||n!==this.width||l!==this.height)?(this.hidden&&(this.hidden=!1),this.x=e,this.y=t,this.width=n,this.height=l,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:Vt.innerWidth*Vt.devicePixelRatio})}}ml.$name=tn,ml.$version="2.1.1";class hl extends ol{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=cn,this.plain=!1,this.slottable=!1,this.themeColor="rgba(51, 153, 255, 0.5)"}static get observedAttributes(){return super.observedAttributes.concat(["action","plain"])}}hl.$name=Jt,hl.$version="2.1.1";const pl=/* @__PURE__ */new WeakMap;class fl extends ol{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){pl.set(this,e)}get $canvas(){return pl.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(()=>{Mn(n)&&n<=1&&this.$initSelection(!0,!0)});break;case"keyboard":this.$nextTick(()=>{this.$canvas&&(n?this.$onDocumentKeyDown||(this.$onDocumentKeyDown=this.$handleKeyDown.bind(this),Vn(this.ownerDocument,kn,this.$onDocumentKeyDown)):this.$onDocumentKeyDown&&(Wn(this.ownerDocument,kn,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(Tn,{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(Qt));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),Vn(e,_n,this.$onCanvasActionStart),Vn(e,$n,this.$onCanvasActionEnd),Vn(e,En,this.$onCanvasAction)):this.$render()}disconnectedCallback(){const{$canvas:e}=this;e&&(this.$onCanvasActionStart&&(Wn(e,_n,this.$onCanvasActionStart),this.$onCanvasActionStart=null),this.$onCanvasActionEnd&&(Wn(e,$n,this.$onCanvasActionEnd),this.$onCanvasActionEnd=null),this.$onCanvasAction&&(Wn(e,En,this.$onCanvasAction),this.$onCanvasAction=null)),super.disconnectedCallback()}$getSelections(){let e=[];return this.parentElement&&(e=Array.from(this.parentElement.querySelectorAll(this.$getTagNameOf(en)))),e}$initSelection(e=!1,t=!1){const{initialCoverage:n,parentElement:l}=this;if(Mn(n)&&l){const r=this.aspectRatio||this.initialAspectRatio;let a=(t?0:this.width)||l.offsetWidth*n,i=(t?0:this.height)||l.offsetHeight*n;Mn(r)&&({width:a,height:i}=Zn({aspectRatio:r,width:a,height:i})),this.$change(this.x,this.y,a,i),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),l=t[n+1]||t[n-1];l&&(e.active=!1,this.parentElement.removeChild(e),l.active=!0,l.$emit(Tn,{x:l.x,y:l.y,width:l.width,height:l.height}))}else this.$clear()}}$handleActionStart(e){var t,n;const l=null===(n=null===(t=e.detail)||void 0===t?void 0:t.relatedEvent)||void 0===n?void 0:n.target;this.$action="",this.$actionStartTarget=l,!this.hidden&&this.multiple&&!this.active&&l===this&&this.parentElement&&(this.$getSelections().forEach(e=>{e.active=!1}),this.active=!0,this.$emit(Tn,{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:l}=n;let{action:r}=n;const a=l?function(e){if("function"==typeof e.composedPath)return e.composedPath().find(On)||e.target;return e.target}(l):null;if(!r&&this.multiple&&(r=this.$action||(null==a?void 0:a.action),this.$action=r),!r||this.hidden&&r!==ln||this.multiple&&!this.active&&r!==an)return;const{width:i,height:o}=this;let s=n.endX-n.startX,c=n.endY-n.startY,{aspectRatio:u}=this;switch(!Mn(u)&&l.shiftKey&&(u=Mn(i)&&Mn(o)?i/o:1),r){case ln:if(0!==s||0!==c){0===s?s=c:0===c&&(c=s);const{$canvas:e}=this,l=Qn(t);(this.multiple&&!this.hidden?this.$createSelection():this).$change(n.startX-l.left,n.startY-l.top,Math.abs(s),Math.abs(c),u),s<0?c<0?r=pn:c>0&&(r=gn):s>0&&(c<0?r=hn:c>0&&(r=fn)),e&&(e.$action=r)}break;case rn:this.movable&&(this.dynamic||this.$actionStartTarget&&this.contains(this.$actionStartTarget))&&this.$move(s,c);break;case an:if(l&&this.zoomable&&(this.dynamic||this.contains(l.target))){const e=Qn(t);this.$zoom(n.scale,l.pageX-e.left,l.pageY-e.top)}break;default:this.$resize(r,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,l=this.aspectRatio){if(!this.resizable)return this;const r=Mn(l),{$canvas:a}=this;let{x:i,y:o,width:s,height:c}=this;switch(e){case un:o+=n,c-=n,c<0&&(e=bn,c=-c,o-=c),r&&(i+=(t=n*l)/2,s-=t,s<0&&(s=-s,i-=s));break;case dn:s+=t,s<0&&(e=mn,s=-s,i-=s),r&&(o-=(n=t/l)/2,c+=n,c<0&&(c=-c,o-=c));break;case bn:c+=n,c<0&&(e=un,c=-c,o-=c),r&&(i-=(t=n*l)/2,s+=t,s<0&&(s=-s,i-=s));break;case mn:i+=t,s-=t,s<0&&(e=dn,s=-s,i-=s),r&&(o+=(n=t/l)/2,c-=n,c<0&&(c=-c,o-=c));break;case hn:r&&(n=-t/l),o+=n,c-=n,s+=t,s<0&&c<0?(e=gn,s=-s,c=-c,i-=s,o-=c):s<0?(e=pn,s=-s,i-=s):c<0&&(e=fn,c=-c,o-=c);break;case pn:r&&(n=t/l),i+=t,o+=n,s-=t,c-=n,s<0&&c<0?(e=fn,s=-s,c=-c,i-=s,o-=c):s<0?(e=hn,s=-s,i-=s):c<0&&(e=gn,c=-c,o-=c);break;case fn:r&&(n=t/l),s+=t,c+=n,s<0&&c<0?(e=pn,s=-s,c=-c,i-=s,o-=c):s<0?(e=gn,s=-s,i-=s):c<0&&(e=hn,c=-c,o-=c);break;case gn:r&&(n=-t/l),i+=t,s-=t,c+=n,s<0&&c<0?(e=hn,s=-s,c=-c,i-=s,o-=c):s<0?(e=fn,s=-s,i-=s):c<0&&(e=pn,c=-c,o-=c)}return a&&a.$setAction(e),this.$change(i,o,s,c)}$zoom(e,t,n){if(!this.zoomable||0===e)return this;e<0?e=1/(1-e):e+=1;const{width:l,height:r}=this,a=l*e,i=r*e;let o=this.x,s=this.y;return Ln(t)&&Ln(n)?(o-=(a-l)*((t-this.x)/l),s-=(i-r)*((n-this.y)/r)):(o-=(a-l)/2,s-=(i-r)/2),this.$change(o,s,a,i)}$change(e,t,n=this.width,l=this.height,r=this.aspectRatio,a=!1){return this.$changing||!Ln(e)||!Ln(t)||!Ln(n)||!Ln(l)||n<0||l<0?this:(Mn(r)&&({width:n,height:l}=Zn({aspectRatio:r,width:n,height:l},"cover")),this.precise||(e=Math.round(e),t=Math.round(t),n=Math.round(n),l=Math.round(l)),e===this.x&&t===this.y&&n===this.width&&l===this.height&&Object.is(r,this.aspectRatio)&&!a?this:(this.hidden&&(this.hidden=!1),!1===this.$emit(Tn,{x:e,y:t,width:n,height:l})?this:(this.$changing=!0,this.x=e,this.y=t,this.width=n,this.height=l,this.$changing=!1,this.$render())))}$reset(){const{x:e,y:t,width:n,height:l}=this.$initialSelection;return this.$change(e,t,n,l)}$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 l=document.createElement("canvas");let{width:r,height:a}=this,i=1;if(Dn(e)&&(Mn(e.width)||Mn(e.height))&&(({width:r,height:a}=Zn({aspectRatio:r/a,width:e.width,height:e.height})),i=r/this.width),l.width=r,l.height=a,!this.$canvas)return void t(l);const o=this.$canvas.querySelector(this.$getTagNameOf(Zt));o?o.$ready().then(n=>{const s=l.getContext("2d");if(s){const[t,c,u,d,b,m]=o.$getTransform(),h=-this.x,p=-this.y,f=(h*d-u*p)/(t*d-u*c),g=(p*t-c*h)/(t*d-u*c);let v=t*f+u*g+b,y=c*f+d*g+m,w=n.naturalWidth,x=n.naturalHeight;1!==i&&(v*=i,y*=i,w*=i,x*=i);const k=w/2,C=x/2;s.fillStyle="transparent",s.fillRect(0,0,r,a),Dn(e)&&Rn(e.beforeDraw)&&e.beforeDraw.call(this,s,l),s.save(),s.translate(k,C),s.transform(t,c,u,d,v,y),s.translate(-k,-C),s.drawImage(n,0,0,w,x),s.restore()}t(l)}).catch(n):t(l)})}}fl.$name=en,fl.$version="2.1.1";class gl extends ol{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))}}gl.$name=Yt,gl.$version="2.1.1";class vl extends ol{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"])}}vl.$name=Xt,vl.$version="2.1.1";const yl=/* @__PURE__ */new WeakMap,wl=/* @__PURE__ */new WeakMap,xl=/* @__PURE__ */new WeakMap,kl=/* @__PURE__ */new WeakMap,Cl="vertical";class Sl extends ol{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=Cl,this.selection="",this.slottable=!1}set $image(e){wl.set(this,e)}get $image(){return wl.get(this)}set $sourceImage(e){kl.set(this,e)}get $sourceImage(){return kl.get(this)}set $canvas(e){yl.set(this,e)}get $canvas(){return yl.get(this)}set $selection(e){xl.set(this,e)}get $selection(){return xl.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(en)),On(n)){this.$selection=n,this.$onSelectionChange=this.$handleSelectionChange.bind(this),Vn(n,Tn,this.$onSelectionChange);const e=n.closest(this.$getTagNameOf(Qt));if(e){this.$canvas=e;const t=e.querySelector(this.$getTagNameOf(Zt));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),Vn(t.$image,Cn,this.$onSourceImageLoad),Vn(t,An,this.$onSourceImageTransform))}this.$render()}}disconnectedCallback(){const{$selection:e,$sourceImage:t}=this;e&&this.$onSelectionChange&&(Wn(e,Tn,this.$onSelectionChange),this.$onSelectionChange=null),t&&this.$onSourceImageLoad&&(Wn(t.$image,Cn,this.$onSourceImageLoad),this.$onSourceImageLoad=null),t&&this.$onSourceImageTransform&&(Wn(t,An,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"),l=t.getAttribute("src");l&&l!==n&&(e.setAttribute("src",l),e.$ready(()=>{this.$render()}))}$handleSourceImageTransform(e){this.$render(void 0,e.detail.matrix)}$render(e,t){const{$canvas:n,$selection:l}=this;e||l.hidden||(e=l),(!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:r,y:a,width:i,height:o}=e,s={},{clientWidth:c,clientHeight:u}=this;let d=c,b=u,m=NaN;switch(this.resize){case"both":m=1,d=i,b=o,s.width=i,s.height=o;break;case"horizontal":m=o>0?u/o:0,d=i*m,s.width=d;break;case Cl:m=i>0?c/i:0,b=o*m,s.height=b;break;default:c>0?m=i>0?c/i:0:u>0&&(m=o>0?u/o:0)}this.$scale=m,this.$setStyles(s),this.$sourceImage&&setTimeout(()=>{this.$transformImageByOffset(null!=t?t:this.$sourceImage.$getTransform(),-r,-a)})}$transformImageByOffset(e,t,n){const{$image:l,$scale:r,$sourceImage:a}=this;if(a&&l&&r>=0){const[i,o,s,c,u,d]=e,b=(t*c-s*n)/(i*c-s*o),m=(n*i-o*t)/(i*c-s*o),h=i*b+s*m+u,p=o*b+c*m+d;a.$ready(e=>{this.$setStyles.call(l,{width:e.naturalWidth*r,height:e.naturalHeight*r})}),l.$setTransform(i,o,s,c,h*r,p*r)}}}function Nl(){const[e,n]=t(!1),[l,r]=t(null),[a,i]=t(null),o=async(e,t)=>{if(!e||!t)return r("ID de asset y configuración de variante son requeridos"),null;n(!0),r(null),i(null);try{const n=await async function(e,{variant_name:t,width:n,height:r,crop_params:a,preset_aspect:i=null,preset_size:o=null,output_format:s="webp"}){try{const l=[{name:t,width:n,height:r,output_format:s,crop_params:a}];return i&&(l[0].preset_aspect=i),o&&(l[0].preset_size=o),re(await J({endpoint:`/assets/${e}/variants`,method:"POST",body:{variants:l,async:!1},basePath:ie,useJWT:!0}))}catch(l){throw ae(l)}}(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 i(n.result),n.result;throw new Error("No se pudo crear la variante")}catch(a){return console.error("Error creating variant:",a),r(a.message||"Error desconocido al crear variante"),null}finally{n(!1)}};return{createVariant:o,createCropVariant:async(e,t,n={})=>{const l={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 o(e,l)},createVariantFromBlob:async(e,t,a={})=>{if(!e||!t)return r("ID de asset y blob son requeridos"),null;n(!0),r(null),i(null);try{const n=await async function(e,t,n={}){try{const l=new FormData,r=n.format||"webp",a=`${n.name||"variant"}.${r}`;return l.append("file",t,a),l.append("variant_name",n.name||"variant"),l.append("width",String(n.width||0)),l.append("height",String(n.height||0)),l.append("output_format",n.format||"webp"),l.append("permanent_url",!1!==n.permanentUrl?"true":"false"),re(await J({endpoint:`/assets/${e}/variants/upload`,method:"POST",body:l,basePath:ie,isFormData:!0,useJWT:!0}))}catch(l){throw ae(l)}}(e,t,{name:a.name||`crop_${Date.now()}`,width:a.width||0,height:a.height||0,format:a.format||"webp"});if(n?.result)return i(n.result),n.result;throw new Error("No se pudo crear la variante")}catch(o){return console.error("Error creating variant from blob:",o),r(o.message||"Error desconocido al crear variante"),null}finally{n(!1)}},loading:e,error:l,createdVariant:a,reset:()=>{r(null),i(null)}}}Sl.$name=nn,Sl.$version="2.1.1",sl.$define(),vl.$define(),gl.$define(),hl.$define(),dl.$define(),fl.$define(),ml.$define(),Sl.$define();class El{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,l,r,a)=>{if(!this.image)return!1;try{return this.image.$setTransform(e,t,n,l,r,a),!0}catch(i){return console.warn("Error setting transform:",i),!1}},resetZoom:()=>{if(!this.image)return!1;try{const e=this.image.$getTransform();if(!e)return!1;const[t,n,l,r,a,i]=e,o=Math.sqrt(t*t+n*n),s=Math.sqrt(l*l+r*r),c=t/o,u=n/o,d=l/s,b=r/s;return this.image.$setTransform(c,u,d,b,a,i),!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,l,r,a,i,o]=t,s=Math.sqrt(n*n+l*l),c=Math.sqrt(r*r+a*a),u=n/s*e,d=l/s*e,b=r/c*e,m=a/c*e;return this.image.$setTransform(u,d,b,m,i,o),!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 l=1-e,r=t.width*l/n.naturalWidth,a=t.height*l/n.naturalHeight,i=Math.min(r,a,1);return this.transform.setZoom(i)}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,l]=e.split("/").map(e=>parseFloat(e.trim()));if(isNaN(n)||isNaN(l)||0===l)return console.warn("Invalid aspect ratio format:",e),!1;t=n/l}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,l,r)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.$change(e,t,n,l,r),!0}catch(a){return console.warn("Error changing selection:",a),!1}},set:(e,t,n,l)=>{if(!this.selectionElement)return!1;try{return this.selectionElement.x=e,this.selectionElement.y=t,this.selectionElement.width=n,this.selectionElement.height=l,this.selectionElement.$render(),!0}catch(r){return console.warn("Error setting selection:",r),!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,l,r,a,i]=e;return this.transform.setTransform(-t,n,l,r,a,i)},flipVertical:()=>{const e=this.transform.getTransform();if(!e)return!1;const[t,n,l,r,a,i]=e;return this.transform.setTransform(t,n,l,-r,a,i)},setupInitialView:async(e={})=>{const{paspartuFactor:t=.85,retries:n=3,retryDelay:l=200}=e;return new Promise(e=>{const r=(a=0)=>{if(!this.isReady)return a<n?void setTimeout(()=>r(a+1),l):void e(!1);try{const i=this.canvasElement.getBoundingClientRect();let o=this.image.querySelector("img")||this.image;if(!o?.naturalWidth||!o?.naturalHeight)return a<n?void setTimeout(()=>r(a+1),l):(this.transform.center(),void e(!1));if(i.width>0&&i.height>0){const n=i.width*t/o.naturalWidth,l=i.height*t/o.naturalHeight,r=Math.min(n,l,1);this.transform.setTransform(r,0,0,r,0,0)?setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100):(this.transform.reset(),setTimeout(()=>{r<1&&this.transform.scale(r),setTimeout(()=>{this.transform.center(),this.selection.center(),e(!0)},100)},100))}else this.transform.center(),e(!1)}catch(i){console.warn("Error in setup:",i),this.transform.center(),e(!1)}};r()})},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:l,onActionStart:r,onActionMove:a,onActionEnd:i}=e,o=[];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),o.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),o.push(()=>{this.image&&this.image.removeEventListener("transform",e)})}if(this.canvasElement){if(l){const e=e=>l(e.detail);this.canvasElement.addEventListener("action",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("action",e)})}if(r){const e=e=>r(e.detail);this.canvasElement.addEventListener("actionstart",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionstart",e)})}if(a){const e=e=>a(e.detail);this.canvasElement.addEventListener("actionmove",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionmove",e)})}if(i){const e=e=>i(e.detail);this.canvasElement.addEventListener("actionend",e),o.push(()=>{this.canvasElement&&this.canvasElement.removeEventListener("actionend",e)})}}return()=>{o.forEach(e=>e())}}}async function $l(e,t,n={}){const{format:l=null,originalFormat:r="webp",onSuccess:a=null,onError:i=null,accessibilityManager:o=null}=n;try{const n=window.limboCore?.config?.getGlobal(),i=l||n?.downloadFormat||r||"webp",c=`${t.split(".")[0]}.${i}`;if(o&&o.announce(`Descargando ${c}`),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,c),a&&a(c),o&&o.announce(`${c} descargado correctamente`),!0;let u;try{if(u=await fetch(e,{mode:"cors"}),!u.ok)throw new Error(`HTTP error! status: ${u.status}`)}catch(s){if(!e.startsWith("http"))throw s;{const t=(window.limboCore?.config?.getGlobal()||{}).prod?"https://limbo.lefebvre.es":"https://led-dev-limbo-dev.eu.els.local",n=window.limboCore?.apiClient?.token||"",l=`${t}/api/atenea/proxy?url=${encodeURIComponent(e)}`;if(u=await fetch(l,{credentials:"include",headers:{Authorization:`Bearer ${n}`}}),!u.ok)throw new Error(`Proxy error: ${u.status}`)}}const d=await u.blob();let b=d;const m=d.type;m!==`image/${"jpg"===i?"jpeg":i}`&&function(e){return["webp","jpeg","jpg","svg","png"].includes(e.toLowerCase())}(i)&&(b=await async function(e,t){return new Promise(n=>{const l=new Image,r=URL.createObjectURL(e);l.onload=()=>{try{const a=document.createElement("canvas");a.width=l.width,a.height=l.height;a.getContext("2d").drawImage(l,0,0);const i=`image/${"jpg"===t?"jpeg":t}`,o="png"===t?void 0:.92;a.toBlob(t=>{URL.revokeObjectURL(r),n(t||e)},i,o)}catch(a){URL.revokeObjectURL(r),n(e)}},l.onerror=()=>{URL.revokeObjectURL(r),n(e)},l.src=r})}(d,i));const h=window.URL.createObjectURL(b),p=document.createElement("a");return p.href=h,p.download=c,p.style.display="none",document.body.appendChild(p),p.click(),setTimeout(()=>{window.URL.revokeObjectURL(h),document.body.removeChild(p)},100),a&&a(c),o&&o.announce(`${c} descargado correctamente`),!0}catch(c){return console.error("Error downloading image:",c),i&&i(c),o&&o.announce(`Error al descargar la imagen: ${c.message}`),!1}}const _l=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:$l,downloadImage:$l},Symbol.toStringTag,{value:"Module"})),Tl={DEV:"https://led-dev-limbo-dev.eu.els.local",PROD:"https://limbo.lefebvre.es"};function Al(e,t=!1){if(!e)return"";if(e.startsWith("/files/")){return(t?Tl.PROD:Tl.DEV)+e}return e}function zl(e){return"string"!=typeof e?e:e.replace(/"/g,'"').replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/'/g,"'")}function Ll(e){return!(!e||"string"!=typeof e)&&!e.startsWith("blob:")}function Ml(e,t={}){if(!e)return"";const{prefer:n="crop",isProd:l=!1}=t,r=zl(e);try{const e=JSON.parse(r),t=()=>{if(e.images&&Array.isArray(e.images))for(const t of e.images)if(t&&Ll(t.url))return t.url;return null},a=e.original?.url,i=t();if("crop"===n){if(i)return Al(i,l);if(Ll(a))return Al(a,l)}else{if(Ll(a))return Al(a,l);if(i)return Al(i,l)}return Ll(e.url)?Al(e.url,l):""}catch{if("string"==typeof r){if(r.startsWith("blob:"))return"";if(r.startsWith("/files/"))return Al(r,l);if(r.startsWith("http")||r.startsWith("/"))return r}}return"string"==typeof e&&(e.startsWith("{")||e.startsWith("["))?"":e}function Pl(e,t={}){const{isProd:n=!1}=t;if(!e)return{original:null,images:[],url:""};try{const t=JSON.parse(zl(e)),l=t.original?{...t.original,url:Al(t.original.url,n)}:null,r=(t.images||[]).map(e=>({...e,url:Al(e.url,n)}));return{original:l,images:r,url:r[0]?.url||l?.url||Al(t.url,n)||""}}catch{return{original:null,images:[],url:Al(e,n)}}}function Il(e){if(!e||"string"!=typeof e)return"file";let t=e.normalize("NFD").replace(/[\u0300-\u036f]/g,"");return t=t.toLowerCase(),t=t.replace(/[^a-z0-9_]+/g,"-"),t=t.replace(/-+/g,"-").replace(/^-|-$/g,""),t||"file"}function Dl(e,t={}){const{isProd:n=!1}=t;if(!e?.fields)return e;const l=e.fields.map(e=>{if("image"===e.type&&"string"==typeof e.example_value){const t=Ml(e.example_value,{isProd:n});return{...e,example_value:t||e.example_value}}return e});return{...e,fields:l}}function Rl({image:e,onSave:i,onCancel:o,onDelete:d=null,onError:b=null,deleting:m=!1,onVariantCreated:h=null,onUpload:p=null,uploading:f=!1,cropperConfig:g=null}){const[v,y]=t(!1),[w,x]=t(null),[k,C]=t(!1),[S,N]=t(!0),[E,$]=t(!0),[_,T]=t(e.url||e.path||null);n(()=>{const t=e.url||e.path;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return void T(t);let n=!1;return _e(t,{bypassHttpCache:!0}).then(e=>{n||T(e)}).catch(()=>{n||T(t)}),()=>{n=!0}},[e.url,e.path]);const[A,z]=t({x:20,y:100}),[L,M]=t(!1),[P,I]=t({x:0,y:0}),[D,R]=t(!1),[O,F]=t(!0),[j,U]=t(!1),[B,q]=t({horizontal:!1,vertical:!1}),[W,V]=t(!1),[H,K]=t(!1),[G,Q]=t(!1),[X,Y]=t(!1),[J]=t(()=>{if(!e||!e.filename)return"image";const[t]=e.filename.split(".");return t}),Z=r(()=>{if(g)return{mandatoryCrops:g.mandatoryCrops||[],allowCustomCrops:!1!==g.allowAdditionalCrops,showDimensionInputs:!0===g.showDimensionInputs,maxCrops:g.maxCrops||null,localCropsOnly:!0===g.localCropsOnly,existingCrops:g.existingCrops||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,localCropsOnly:!0===e.cropper?.localCropsOnly,existingCrops:e.cropper?.existingCrops||null}},[g]),[ee,te]=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),format:e.format||null,savedState:null})):[{id:"crop-default-0",label:J,width:e.width||1920,height:e.height||1080,required:!1,isCustom:!0,confirmed:!1,savedState:null}]),[ne,le]=t(0),re=ee[ne],ae=r(()=>re&&re.width&&re.height?re.width/re.height:"",[re]),ie=r(()=>{const e=50;if(!ae||""===ae)return{minWidth:e,minHeight:e};if(ae>=1){return{minWidth:e,minHeight:e/ae}}return{minWidth:e*ae,minHeight:e}},[ae]),[oe,se]=t(!1),[ce,ue]=t([]),[de,be]=t(null),me=window.limboCore?.accessibilityManager,{createVariantFromBlob:he,loading:pe,error:fe}=Nl(),ge=((e,a={})=>{const i=l(null),o=l(null),s=l(null),c=l(null),[u,d]=t(null),[b,m]=t(null),[h,p]=t(!1),[f,g]=t(!0),[v,y]=t(0),w={aspectRatio:"",shade:!0,paspartuFactor:.85,...a};n(()=>{i.current&&o.current&&s.current&&(c.current=new El(i,o,s),p(!0))},[]),n(()=>{if(c.current)return c.current.setupEventListeners({onSelectionChange:e=>{d(e)},onImageTransform:()=>{y(e=>e+1)}})},[h]),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();g(e);const t=o.current?.querySelector("img")||o.current;t?.naturalWidth&&t?.naturalHeight&&m({naturalWidth:t.naturalWidth,naturalHeight:t.naturalHeight,currentWidth:t.width,currentHeight:t.height})})()},[e]),n(()=>{c.current&&h&&c.current.selection.setAspectRatio(w.aspectRatio)},[w.aspectRatio,h]),n(()=>{c.current&&h&&c.current.canvas.setBackground(w.shade)},[w.shade,h]);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:i,imageRef:o,selectionRef:s},state:{cropData:u,imageInfo:b,isReady:h,canExport:f,transformVersion:v},transform:x,selection:k,utils:C,manager:c.current}})(e,{aspectRatio:ae||null,showGrid:S,shade:E,initialCoverage:.5,paspartuFactor:.85}),{refs:ve,state:ye,transform:we,selection:xe,utils:ke}=ge,{canvasRef:Ce,imageRef:Ne,selectionRef:Ee}=ve,{cropData:$e,imageInfo:Te,canExport:Ae,transformVersion:ze}=ye,Le=r(()=>Te||{naturalWidth:e.width||1920,naturalHeight:e.height||1080,currentWidth:e.width||1920,currentHeight:e.height||1080},[Te,e.width,e.height]),Me=a(()=>N(e=>!e),[]),Pe=a(()=>$(e=>!e),[]),Ie=a(()=>K(e=>!e),[]),De=a(()=>Q(e=>!e),[]),Re=a(()=>Y(e=>!e),[]),Oe=a(()=>we.center(),[we]),Fe=a(()=>xe.center(),[xe]),je=a(()=>xe.reset(),[xe]),Ue=a((e,t)=>we.move(e,t),[we]),Be=a(e=>we.zoom(e),[we]),qe=a(e=>we.rotate(e),[we]),We=a(e=>{xe.setCoverage(e)},[xe]),Ve=a(()=>{q(e=>{const t=!e.horizontal;return we.flipHorizontal(),{...e,horizontal:t}})},[we]),Ke=a(()=>{q(e=>{const t=!e.vertical;return we.flipVertical(),{...e,vertical:t}})},[we]),Ge=a(()=>{if(!ge.manager||!ye.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 l={cropData:e,selectorState:t,imageTransform:n,flipState:{horizontal:B.horizontal,vertical:B.vertical}};return te(e=>e.map((e,t)=>t===ne?{...e,savedState:l}:e)),l}catch(e){return console.warn("Error saving crop state:",e),null}},[ge.manager,ye.isReady,$e,B,ne,Ne,Ee]),Qe=a(e=>{const t=ee[e];if(t&&t.savedState)if(ge.manager&&ye.isReady)try{const{savedState:e}=t;if(e.imageTransform&&Ne.current&&Array.isArray(e.imageTransform)&&setTimeout(()=>{if(Ne.current&&Ne.current.$setTransform){const[t,n,l,r,a,i]=e.imageTransform;Ne.current.$setTransform(t,n,l,r,a,i)}},100),e.selectorState&&Ee.current){const{x:t,y:n,width:l,height:r}=e.selectorState;setTimeout(()=>{Ee.current&&(Ee.current.x=t,Ee.current.y=n,Ee.current.width=l,Ee.current.height=r,Ee.current.$render&&Ee.current.$render())},150)}e.flipState&&q({horizontal:e.flipState.horizontal??!1,vertical:e.flipState.vertical??!1})}catch(n){console.error("Error restoring crop state:",n),setTimeout(()=>{Oe(),setTimeout(()=>Fe(),100)},100)}else console.warn("Cropper not ready for state restoration");else setTimeout(()=>{Oe(),setTimeout(()=>Fe(),100)},100)},[ee,ge.manager,ye.isReady,Oe,Fe,Ee,Ne]),Xe=a(()=>{for(let e=0;e<ee.length;e++){const t=ee[e];if(!t.label||""===t.label.trim())return e}return-1},[ee]),Ye=a(async e=>{e!==ne&&(U(!0),Ge(),await new Promise(e=>setTimeout(e,100)),le(e),await new Promise(e=>setTimeout(e,250)),Qe(e),await new Promise(e=>setTimeout(e,200)),U(!1))},[ne,Ge,Qe]),Je=a(()=>{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};te(e=>[...e,t]),me?.announce(`Nuevo recorte personalizado añadido: ${t.label}. Selecciónalo para editarlo.`)},[Z.allowCustomCrops,ee.length,e.width,e.height,me]),Ze=a((e,t)=>{const n=parseInt(t,10);""===t||isNaN(n)||te(t=>t.map((t,l)=>l===ne?{...t,[e]:n}:t))},[ne]),et=a(e=>{const t=re[e];let n=100;if(Ce.current&&Te){const e=Ce.current.getBoundingClientRect(),t=Math.min(e.width,e.height);n=Math.max(100,Math.round(.05*t))}const l=Math.max(n,Math.min(3500,t));l!==t&&te(t=>t.map((t,n)=>n===ne?{...t,[e]:l}:t));const r={...re,[e]:l},a=r.width/r.height,i=xe.getData?.();xe.setAspectRatio(a),i&&void 0!==i.x&&setTimeout(()=>{xe.set?.(i.x,i.y,i.width,i.height)},50)},[ne,re,xe,Ce,Te]),tt=a(e=>{te(t=>t.map((t,n)=>n===ne?{...t,label:e}:t))},[ne]),nt=a((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(te(t=>t.filter((t,n)=>n!==e)),e===ne){const t=Math.max(0,e-1);le(t)}else e<ne&&le(e=>e-1);me?.announce(`Recorte ${n.label} eliminado`)}else alert("Debe haber al menos un recorte.")},[ee,ne,me]),lt=a(async()=>{if(!Ae)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}},[Ae,e.mime_type,xe]),rt=a(async()=>{if(v)return y(!1),x(null),void C(!1);if(Ae){y(!0),C(!0);try{const e=await lt();e?x(e):(y(!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.")},[Ae,lt,v]),at=a(e=>{e.target.closest(".limbo-preview-modal-header")&&(M(!0),I({x:e.clientX-A.x,y:e.clientY-A.y}))},[A]),it=a(e=>{L&&(e.preventDefault(),z({x:e.clientX-P.x,y:e.clientY-P.y}))},[L,P]),ot=a(()=>{M(!1)},[]),st=a(e=>{if(!e.target.closest(".limbo-preview-modal-header"))return;const t=e.touches[0];M(!0),I({x:t.clientX-A.x,y:t.clientY-A.y})},[A]),ct=a(e=>{if(!L)return;e.preventDefault();const t=e.touches[0];z({x:t.clientX-P.x,y:t.clientY-P.y})},[L,P]),ut=a(()=>{M(!1)},[]);n(()=>{if(L)return document.addEventListener("mousemove",it),document.addEventListener("mouseup",ot),document.addEventListener("touchmove",ct,{passive:!1}),document.addEventListener("touchend",ut),()=>{document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",ot),document.removeEventListener("touchmove",ct),document.removeEventListener("touchend",ut)}},[L,it,ot,ct,ut]),n(()=>{if(!D)return;const e=e=>{"Escape"===e.key&&R(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[D]);const dt=a(async(t,n=null)=>{const l=ee[t];if(!l)throw new Error(`Crop ${t} no encontrado`);if(!l.savedState&&t!==ne)throw new Error(`El recorte "${l.label}" aún no ha sido configurado`);const r={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!==ne&&l.savedState){if(l.savedState.imageTransform&&Ne.current?.$setTransform){const[e,t,n,r,a,i]=l.savedState.imageTransform;Ne.current.$setTransform(e,t,n,r,a,i)}if(l.savedState.selectorState&&Ee.current?.$change){const{x:e,y:t,width:n,height:r}=l.savedState.selectorState;Ee.current.$change(e,t,n,r,NaN,!0)}await new Promise(e=>setTimeout(e,100))}const r=Math.min(l.width,3500),i=Math.min(l.height,3500);let o=await xe.toCanvas({width:r,height:i,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!o)throw new Error(`No se pudo generar el canvas para "${l.label}"`);if(o.width!==r||o.height!==i){const e=document.createElement("canvas");e.width=r,e.height=i;const t=e.getContext("2d");t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(o,0,0,r,i),o=e}const s=l.format||globalThis.downloadFormat||"webp",c="webp"===s?"image/webp":"png"===s?"image/png":"image/jpeg",u=.9,d=await new Promise((e,t)=>{o.toBlob(n=>{n?e(n):t(new Error("No se pudo convertir el canvas a blob"))},c,u)}),b=`${Il(l.label||"crop")}_${r}_${i}`,m=n||e.id,f=!m||"string"==typeof m&&m.startsWith("external"),g=(f||Z.localCropsOnly)&&!p;if(f&&p&&!Z.localCropsOnly)try{const e=new File([d],`${b}.${s}`,{type:c}),t=await p(e);if(t&&(t.id||t.url)){const e=l.savedState||{selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null,imageTransform:Ne.current?.$getTransform?.()||null,flipState:{horizontal:B.horizontal,vertical:B.vertical}},n={id:t.id||`uploaded-${Date.now()}`,name:b,filename:`${b}.${s}`,url:t.urlSigned||t.url,urlSigned:t.urlSigned||t.url,width:r,height:i,format:s,size:d.size,mime_type:c,isLocal:!1,originalAssetId:null,uploadedAssetId:t.id,cropState:e};return me?.announceSuccess(`Recorte guardado: ${b}`),n}}catch(a){console.error("[CropperView] ❌ Error subiendo crop, fallback a local:",a)}if(g){const e=URL.createObjectURL(d),t=l.savedState||{selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null,imageTransform:Ne.current?.$getTransform?.()||null,flipState:{horizontal:B.horizontal,vertical:B.vertical}},n={id:`local-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:b,filename:`${b}.${s}`,url:e,urlSigned:e,width:r,height:i,format:s,size:d.size,mime_type:c,blob:d,isLocal:!0,originalAssetId:m||null,cropState:t};return me?.announceSuccess(`Recorte creado localmente: ${b}`),n}const v=l.savedState||{selectorState:Ee.current?{x:Ee.current.x,y:Ee.current.y,width:Ee.current.width,height:Ee.current.height}:null,imageTransform:Ne.current?.$getTransform?.()||null,flipState:{horizontal:B.horizontal,vertical:B.vertical}},y=await he(m,d,{name:b,width:r,height:i,format:s});if(y)return y.cropState=v,me?.announceSuccess(`Recorte creado: ${b}`),h?.(m,y),y;throw new Error("No se pudo crear la variante")}finally{if(t!==ne&&r.imageTransform&&Ne.current?.$setTransform){const[e,t,n,l,a,i]=r.imageTransform;if(Ne.current.$setTransform(e,t,n,l,a,i),r.selectorState&&Ee.current?.$change){const{x:e,y:t,width:n,height:l}=r.selectorState;Ee.current.$change(e,t,n,l,NaN,!0)}}}},[ee,ne,xe,he,e.id,h,me,Ne,Ee]),bt=a(async()=>{if(!Ae){const e="No se puede exportar el recorte por restricciones de CORS en la imagen original.";return me?.announceError(e),void alert(e)}if(!ye.isReady){const e="El cropper aún no está inicializado. Espera un momento e inténtalo de nuevo.";return me?.announceError(e),void alert(e)}Ge(),me?.announce("Creando recorte de la imagen");try{let t=e.id,n=null;if(e.file&&p){me?.announce("Subiendo imagen...");const l=await p(e.file);if(!l||!l.id)throw new Error("No se pudo subir la imagen al servidor");t=l.id,n=l,me?.announceSuccess("Imagen subida correctamente")}const l=await dt(ne,t);l&&i(n?{crops:[l],asset:n}:l)}catch(t){console.warn("Error creating crop variant:",t);const e=t.message||"No se pudo crear el recorte. Inténtalo de nuevo.";me?.announceError(e),alert(e),b?.(t)}},[Ae,ye.isReady,me,Ge,dt,ne,i,b,e.file,e.id,p]),mt=a(async t=>{Ge(),me?.announce(`Guardando ${t.length} recortes...`);try{let l=e.id,r=null;if(e.file&&p){me?.announce("Subiendo imagen...");const t=await p(e.file,e.tags||null);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");l=t.id,r=t,me?.announceSuccess("Imagen subida correctamente")}const a=[],o=[];for(const e of t)try{const t=await dt(e,l);t&&a.push(t)}catch(n){o.push({crop:ee[e]?.label||`Crop ${e}`,error:n.message})}if(a.length>0&&(me?.announceSuccess(`${a.length} recorte(s) guardado(s) correctamente`),i(r?{crops:a,asset:r}:a)),o.length>0){const e=`Errores al guardar algunos recortes:\n${o.map(e=>`- ${e.crop}: ${e.error}`).join("\n")}`;me?.announceError(e),alert(e)}}catch(n){const e=n.message||"Error al procesar los recortes";me?.announceError(e),alert(e),b?.(n)}},[Ge,dt,ee,me,i,e.file,e.id,p,b]),ht=a(async()=>{(re.width>3500||re.height>3500)&&alert("Las dimensiones máximas permitidas son 3500x3500 píxeles. Por favor, ajusta el tamaño del recorte."),re.width=Math.min(re.width,3500),re.height=Math.min(re.height,3500);const e=Xe();if(-1!==e){const t=ee[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void le(e)}const t=ee.findIndex((e,t)=>e.required&&!e.savedState&&t!==ne);if(-1!==t){const e=ee[t];return alert(`El recorte obligatorio "${e.label}" aún no ha sido configurado.\n\nPor favor, configura todos los recortes obligatorios antes de guardar.`),le(t),void me?.announce(`Recorte obligatorio "${e.label}" sin configurar. Por favor, configúralo.`,"assertive")}if(ee.length>1){be("save");const e=ee.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 bt()},[Xe,ee,bt,ne,me]),pt=a(async t=>{const n=ee[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 l={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!==ne&&n.savedState){if(n.savedState.imageTransform&&Ne.current?.$setTransform){const[e,t,l,r,a,i]=n.savedState.imageTransform;Ne.current.$setTransform(e,t,l,r,a,i)}if(n.savedState.selectorState&&Ee.current?.$change){const{x:e,y:t,width:l,height:r}=n.savedState.selectorState;Ee.current.$change(e,t,l,r,NaN,!0)}await new Promise(e=>setTimeout(e,100))}const l=await xe.toCanvas({width:n.width,height:n.height,imageSmoothingEnabled:!0,imageSmoothingQuality:"high"});if(!l)throw new Error(`No se pudo generar el canvas para "${n.label}"`);const r=l.toDataURL(`image/${globalThis.downloadFormat||e.mime_type?.split("/")[1]||"webp"}`,.9),a=`${Il(n.label||"crop")}_${n.width}_${n.height}`;return await $l(r,a,{accessibilityManager:me,onSuccess:e=>{console.log(`✅ Descargado: ${e}`)},onError:e=>{throw new Error(`Error al descargar "${n.label}": ${e.message}`)}}),{crop:n.label,filename:a}}finally{if(t!==ne&&l.imageTransform&&Ne.current?.$setTransform){const[e,t,n,r,a,i]=l.imageTransform;if(Ne.current.$setTransform(e,t,n,r,a,i),l.selectorState&&Ee.current?.$change){const{x:e,y:t,width:n,height:r}=l.selectorState;Ee.current.$change(e,t,n,r,NaN,!0)}}}},[ee,ne,xe,e.mime_type,me,Ne,Ee]),ft=a(async e=>{Ge(),me?.announce(`Descargando ${e.length} recortes...`);const t=[],n=[];for(const r of e)try{const e=await pt(r);e&&t.push(e)}catch(l){n.push({crop:ee[r]?.label||`Crop ${r}`,error:l.message})}if(t.length>0&&me?.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")}`;me?.announceError(e),alert(e)}},[Ge,pt,ee,me]),gt=a(async()=>{if(!Ae){const e="No se puede descargar el recorte por restricciones de CORS en la imagen original.";return me?.announceError(e),void alert(e)}Ge(),me?.announce("Preparando descarga del recorte");try{await pt(ne),me?.announceSuccess("Recorte descargado correctamente")}catch(e){console.error("Error downloading crop:",e);const t=e.message||"Error al descargar el recorte";me?.announceError(t),alert(t)}},[Ae,me,Ge,pt,ne]),vt=a(async()=>{const e=Xe();if(-1!==e){const t=ee[e];return alert(`El recorte "${t.label||t||"(sin nombre)"}" debe tener un nombre válido.`),void le(e)}if(ee.length>1){be("download");const e=ee.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 gt()},[Xe,ee,gt,ne]),yt=r(()=>!!e.file||(!e.id||!("string"!=typeof e.id||!e.id.startsWith("external"))),[e.file,e.id]),wt=a(async()=>{try{if(e.file&&p){me?.announce("Subiendo imagen original...");const t=await p(e.file);if(!t||!t.id)throw new Error("No se pudo subir la imagen al servidor");return me?.announceSuccess("Imagen guardada correctamente"),void i({asset:t,crops:[]})}if(yt){me?.announce("Conservando imagen original...");const t={id:`local-original-${Date.now()}`,name:e.filename||"original",filename:e.filename||"image.jpg",url:e.url,urlSigned:e.url,width:e.width||Te?.naturalWidth||1920,height:e.height||Te?.naturalHeight||1080,mime_type:e.mime_type||"image/jpeg",isLocal:!0,isOriginal:!0};return me?.announceSuccess("Imagen original conservada"),void i({crops:[t]})}if(e.id&&!e.id.startsWith("external")){me?.announce("Seleccionando imagen original...");const t={id:e.id,name:e.filename||"original",filename:e.filename||"image.jpg",url:e.url,urlSigned:e.urlSigned||e.url,width:e.width||Te?.naturalWidth||1920,height:e.height||Te?.naturalHeight||1080,mime_type:e.mime_type||"image/jpeg",isOriginal:!0};return me?.announceSuccess("Imagen original seleccionada"),void i({crops:[t],assetId:e.id})}o()}catch(t){console.error("Error guardando imagen original:",t);const e=t.message||"No se pudo guardar la imagen. Inténtalo de nuevo.";me?.announceError(e),alert(e),b?.(t)}},[e,Te,p,o,i,b,me,yt]);return n(()=>{y(!1),x(null)},[e]),n(()=>{if(!ge.manager||!ye.isReady||!O)return;const e=Z.existingCrops?.[0],t=e?.cropState;setTimeout(()=>{Oe(),setTimeout(()=>{if(t){if(t.imageTransform&&Ne.current?.$setTransform){const[e,n,l,r,a,i]=t.imageTransform;Ne.current.$setTransform(e,n,l,r,a,i)}if(t.selectorState&&Ee.current){const{x:e,y:n,width:l,height:r}=t.selectorState;Ee.current.x=e,Ee.current.y=n,Ee.current.width=l,Ee.current.height=r,Ee.current.$render?.()}t.flipState&&q(t.flipState)}else Fe();F(!1)},100)},50)},[ge.manager,ye.isReady,O,Oe,Fe,Z.existingCrops]),n(()=>{ge.manager&&ye.isReady&&(ae&&xe.setAspectRatio(ae),ke.setBackground(E))},[ae,E,ge.manager,ye.isReady,xe,ke]),n(()=>{if(!Te||!ye.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(Te.naturalWidth,3500),n=Math.min(Te.naturalHeight,3500);te([{...e,width:t,height:n}])}},[Te,ye.isReady,Z.mandatoryCrops.length,ee]),n(()=>{if(!v||!Ae)return;const e=setTimeout(async()=>{C(e=>!w&&!e||e);try{const e=await lt();e&&x(e)}finally{C(!1)}},300);return()=>{clearTimeout(e),C(!1)}},[$e,ze,v,Ae,lt,ae,B,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__ */c("div",{className:"limbo-cropper-view lb:px-2 lb:border-2 lb:border-gray-200/50 lb:rounded-lg lb:max-w-7xl lb:mx-auto lb:w-full lb:min-w-full lb:h-full lb:min-h-full lb:flex lb:flex-col",children:[
|
|
480
456
|
/* @__PURE__ */c("div",{className:"limbo-cropper-header lb:flex lb:flex-row lb:justify-between lb:items-start lb:flex-wrap lb:mx-2 lb:py-2 lb:border-b lb:border-gray-200 lb:bg-white lb:z-10 lb:shrink-0 lb:lg:gap-2",children:[
|
|
481
457
|
/* @__PURE__ */c("div",{className:"lb:flex-1 lb:min-w-fit lb:space-y-2 lb:max-w-fit",children:[
|
|
482
458
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2",children:[
|
|
@@ -493,19 +469,19 @@ return c("div",{children:[n&&/* @__PURE__ */s(ct,{text:"Subiendo archivo..."}),r
|
|
|
493
469
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between lb:mb-2",children:[
|
|
494
470
|
/* @__PURE__ */c("h3",{className:"lb:text-sm lb:font-semibold lb:text-gray-700",children:["Recortes ",ee.length>1&&`(${ee.length})`]}),Z.allowCustomCrops&&/* @__PURE__ */c("button",{onClick:Je,disabled:pe,className:"lb:text-xs lb:cursor-pointer lb:px-2 lb:py-1 lb:bg-brand-blue-50 lb:hover:bg-brand-blue-200 lb:text-brand-blue-1000 lb:rounded lb:border lb:border-brand-blue-200 lb:transition-colors lb:flex lb:items-center lb:gap-1",title:"Añadir recorte personalizado",children:[
|
|
495
471
|
/* @__PURE__ */s("span",{className:"icon icon-add icon--sm",style:{filter:"var(--limbo-icon-blue)"}}),"Añadir recorte"]})]}),
|
|
496
|
-
/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:lg:grid-cols-4 lb:xl:grid-cols-5 lb:gap-1.5 lb:max-h-48 lb:overflow-y-auto",children:ee.map((e,t)=>{const
|
|
497
|
-
return c("label",{className:"lb:h-fit lb:flex lb:flex-col lb:p-1.5 lb:rounded lb:border lb:cursor-pointer lb:transition-colors lb:min-h-17.5 lb:w-full "+(
|
|
498
|
-
/* @__PURE__ */s("input",{type:"radio",name:"active-crop",checked:
|
|
472
|
+
/* @__PURE__ */s("div",{className:"lb:grid lb:grid-cols-2 lb:md:grid-cols-3 lb:lg:grid-cols-4 lb:xl:grid-cols-5 lb:gap-1.5 lb:max-h-48 lb:overflow-y-auto",children:ee.map((e,t)=>{const n=e.savedState||t===ne;/* @__PURE__ */
|
|
473
|
+
return c("label",{className:"lb:h-fit lb:flex lb:flex-col lb:p-1.5 lb:rounded lb:border lb:cursor-pointer lb:transition-colors lb:min-h-17.5 lb:w-full "+(ne===t?"lb:bg-blue-50 lb:border-blue-300":n?"lb:bg-gray-50 lb:border-gray-200 lb:hover:bg-gray-100":"lb:bg-orange-50 lb:border-orange-300 lb:hover:bg-orange-100"),children:[
|
|
474
|
+
/* @__PURE__ */s("input",{type:"radio",name:"active-crop",checked:ne===t,onChange:()=>Ye(t),disabled:pe,className:"lb:hidden"}),
|
|
499
475
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-1 lb:mb-1",children:[
|
|
500
|
-
/* @__PURE__ */s("div",{className:"lb:flex-1 lb:min-w-0",children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-wrap lb:items-center lb:gap-1 lb:min-h-",children:[
|
|
501
|
-
/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:gap-1 lb:mt-auto",children:
|
|
476
|
+
/* @__PURE__ */s("div",{className:"lb:flex-1 lb:min-w-0",children:/* @__PURE__ */c("div",{className:"lb:flex lb:flex-wrap lb:items-center lb:gap-1 lb:min-h-",children:[ne!==t||e.required?/* @__PURE__ */s("span",{className:"lb:text-xs lb:font-medium lb:text-gray-800 lb:truncate",children:e.label}):/* @__PURE__ */s("input",{type:"text",value:e.label,onChange:e=>tt(e.target.value),disabled:pe,className:"lb:w-full lb:max-h-fit lb:text-xs lb:px-1 lb:py-0.5 lb:border lb:border-gray-300 lb:rounded lb:focus:outline-none lb:focus:ring-1 lb:focus:ring-blue-500 lb:h-1",placeholder:"Nombre",maxLength:25,onClick:e=>e.stopPropagation()}),e.required&&/* @__PURE__ */s("span",{className:"lb:text-[10px] lb:px-1 lb:py-0.5 lb:bg-red-200 lb:text-red-1000 lb:rounded lb:whitespace-nowrap lb:truncate",children:"Obligatorio"})]})}),!e.required&&ee.length>1&&/* @__PURE__ */s("button",{onClick:n=>{n.preventDefault(),n.stopPropagation(),nt(t,e.label)},className:"lb:shrink-0 lb:hover:bg-red-500/70 lb:text-red-1000 lb:p-1 lb:rounded lb:max-h-fit lb:aspect-square lb:cursor-pointer lb:flex",title:"Eliminar",children:/* @__PURE__ */s("span",{className:"icon icon-close-small icon--xs"})})]}),
|
|
477
|
+
/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:gap-1 lb:mt-auto",children:ne===t?/* @__PURE__ */c(u,{children:[
|
|
502
478
|
/* @__PURE__ */s("input",{type:"number",min:"100",max:"3500",value:Math.min(e.width,3500),onChange:e=>Ze("width",e.target.value),onBlur:()=>et("width"),disabled:pe||e.lockDimensions,className:"lb:max-h-fit lb:flex-1 lb:text-xs lb:px-1 lb:py-0.5 lb:border lb:rounded lb:focus:outline-none lb:focus:ring-1 lb:focus:ring-blue-500 "+(e.lockDimensions?"lb:border-gray-200 lb:bg-gray-100 lb:text-gray-500 lb:cursor-not-allowed":"lb:border-gray-300"),placeholder:"Ancho",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Ancho en píxeles"}),
|
|
503
479
|
/* @__PURE__ */s("span",{className:"lb:text-gray-400 lb:text-xs",children:"×"}),
|
|
504
|
-
/* @__PURE__ */s("input",{type:"number",min:"100",max:"3500",value:Math.min(e.height,3500),onChange:e=>Ze("height",e.target.value),onBlur:()=>et("height"),disabled:pe||e.lockDimensions,className:"lb:max-h-fit lb:flex-1 lb:text-xs lb:px-1 lb:py-0.5 lb:border lb:rounded lb:focus:outline-none lb:focus:ring-1 lb:focus:ring-blue-500 "+(e.lockDimensions?"lb:border-gray-200 lb:bg-gray-100 lb:text-gray-500 lb:cursor-not-allowed":"lb:border-gray-300"),placeholder:"Alto",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Alto en píxeles"})]}):/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-gray-500",children:[e.width," × ",e.height," px"]})}),!
|
|
480
|
+
/* @__PURE__ */s("input",{type:"number",min:"100",max:"3500",value:Math.min(e.height,3500),onChange:e=>Ze("height",e.target.value),onBlur:()=>et("height"),disabled:pe||e.lockDimensions,className:"lb:max-h-fit lb:flex-1 lb:text-xs lb:px-1 lb:py-0.5 lb:border lb:rounded lb:focus:outline-none lb:focus:ring-1 lb:focus:ring-blue-500 "+(e.lockDimensions?"lb:border-gray-200 lb:bg-gray-100 lb:text-gray-500 lb:cursor-not-allowed":"lb:border-gray-300"),placeholder:"Alto",onClick:e=>e.stopPropagation(),title:e.lockDimensions?"Dimensiones bloqueadas (recorte obligatorio)":"Alto en píxeles"})]}):/* @__PURE__ */c("span",{className:"lb:text-xs lb:text-gray-500",children:[e.width," × ",e.height," px"]})}),!n&&/* @__PURE__ */s("div",{className:"lb:text-xs lb:px-1 lb:py-0.5 lb:bg-orange-300 lb:text-neutral-gray-25 lb:text-shadow-xs lb:font-semibold lb:rounded lb:text-center lb:mt-1",children:"Sin configurar"})]},e.id)})})]})]}),
|
|
505
481
|
/* @__PURE__ */c("div",{className:"lb:flex lb:flex-col lb:lg:flex-row lb:flex-1 lb:w-full lb:overflow-hidden lb:lg:max-h-130 lb:mx-2 lb:py-1",children:[
|
|
506
482
|
/* @__PURE__ */s("div",{className:"lb:relative lb:flex-1 lg:flex-2 lb:h-full lb:shrink-0 lb:grow-1 lb:order-0 lb:min-h-100 lb:lg:min-h-130",children:/* @__PURE__ */c("div",{className:"lb:absolute lb:inset-0 lb:bg-white lb:rounded-lg lb:border-2 lb:border-gray-200 lb:overflow-hidden",children:[
|
|
507
|
-
/* @__PURE__ */s(
|
|
508
|
-
/* @__PURE__ */s(
|
|
483
|
+
/* @__PURE__ */s(St,{show:O,message:"Cargando recortador..."}),
|
|
484
|
+
/* @__PURE__ */s(St,{show:j,message:`Cambiando a: ${ee[ne]?.label||"recorte"}...`}),
|
|
509
485
|
/* @__PURE__ */c("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:[
|
|
510
486
|
/* @__PURE__ */s("cropper-image",{ref:Ne,src:_,alt:e.filename,id:"limbo-cropperjs-image",action:"move",crossOrigin:"anonymous",rotatable:!0,scalable:!0,skewable:!0,translatable:!0}),
|
|
511
487
|
/* @__PURE__ */c("cropper-selection",{ref:Ee,"initial-coverage":"0.5",movable:!0,resizable:!0,keyboard:"true",action:"move",style:{cursor:"move",minWidth:`${ie.minWidth}px`,minHeight:`${ie.minHeight}px`},"data-prevent-delete":"true",tabindex:"-1",children:[S&&/* @__PURE__ */s("cropper-grid",{role:"grid",action:"move",covered:!0,bordered:!0}),
|
|
@@ -553,21 +529,21 @@ return c("label",{className:"lb:h-fit lb:flex lb:flex-col lb:p-1.5 lb:rounded lb
|
|
|
553
529
|
/* @__PURE__ */s("button",{onClick:()=>We(.9),className:"lb:p-1 lb:rounded lb:cursor-pointer lb:transition-colors lb:text-xs lb:bg-gray-100 lb:border lb:border-gray-300 lb:text-gray-700 lb:hover:bg-gray-200",disabled:pe,"aria-label":"Selección 90%",children:/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{children:"90%"})})}),
|
|
554
530
|
/* @__PURE__ */s("button",{onClick:()=>We(1),className:"lb:p-1 lb:rounded lb:cursor-pointer lb:transition-colors lb:text-xs lb:bg-gray-100 lb:border lb:border-gray-300 lb:text-gray-700 lb:hover:bg-gray-200",disabled:pe,"aria-label":"Selección completa",children:/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */s("span",{children:"100%"})})})]})}),
|
|
555
531
|
/* @__PURE__ */c("div",{className:"lb:space-y-2 lb:pt-2",children:[
|
|
556
|
-
/* @__PURE__ */s("button",{onClick:
|
|
532
|
+
/* @__PURE__ */s("button",{onClick:Fe,className:"lb:w-full lb:p-1 lb:rounded lb:cursor-pointer lb:transition-colors lb:text-sm lb:bg-gray-100 lb:border lb:border-gray-300 lb:text-gray-700 lb:hover:bg-gray-200",title:"Centrar selección",disabled:pe,"aria-label":"Centrar área de selección",children:/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */c("span",{children:[
|
|
557
533
|
/* @__PURE__ */s("span",{className:"icon icon-radio-button icon--sm lb:align-[middle!important] "})," ","Centrar selección"]})})}),
|
|
558
|
-
/* @__PURE__ */s("button",{onClick:
|
|
534
|
+
/* @__PURE__ */s("button",{onClick:je,className:"lb:w-full lb:p-1 lb:rounded lb:cursor-pointer lb:transition-colors lb:text-sm lb:bg-gray-100 lb:border lb:border-gray-300 lb:text-gray-700 lb:hover:bg-gray-200",title:"Reiniciar selección",disabled:pe,"aria-label":"Reiniciar área de selección",children:/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center",children:/* @__PURE__ */c("span",{children:[
|
|
559
535
|
/* @__PURE__ */s("span",{className:"icon icon-refresh icon--sm lb:align-[middle!important]"})," ","Reset selección"]})})})]})]})]}),
|
|
560
536
|
/* @__PURE__ */c("div",{className:"lb:bg-white lb:rounded lb:border lb:border-gray-200 lb:w-full",children:[
|
|
561
|
-
/* @__PURE__ */s("button",{onClick:
|
|
537
|
+
/* @__PURE__ */s("button",{onClick:Ie,className:"lb:hidden lb:sm:block lb:w-full lb:cursor-pointer lb:hover:bg-neutral-gray-050/50 lb:transition-colors lb:rounded-t-sm lb:mb-05 lb:p-2","aria-expanded":H,"aria-label":"Mostrar/ocultar opciones de visualización",children:/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between",children:[
|
|
562
538
|
/* @__PURE__ */s("h3",{className:"lb:text-sm lb:font-semibold lb:text-gray-700",children:"Visualización"}),
|
|
563
539
|
/* @__PURE__ */s("div",{className:"lb:text-center",children:/* @__PURE__ */s("span",{className:`icon ${H?"icon-chevron-up":"icon-chevron-down"} lb:text-center icon--xs`})})]})}),
|
|
564
540
|
/* @__PURE__ */c("div",{className:"lb:py-2 lb:space-y-2 lb:justify-items-stretch lb:static "+(H?"lb:block":"lb:sm:hidden"),children:[
|
|
565
|
-
/* @__PURE__ */c("button",{onClick:
|
|
541
|
+
/* @__PURE__ */c("button",{onClick:Me,className:"lb:w-auto lb:flex lb:cursor-pointer lb:items-center lb:justify-between lb:mx-2 lb:p-1 lb:rounded lb:transition-colors "+(S?"lb:bg-blue-100 lb:border lb:border-blue-300 lb:text-blue-800":"lb:bg-gray-100 lb:border lb:border-gray-300 lb:text-gray-700 lb:hover:bg-gray-200"),disabled:pe,"aria-pressed":S,title:"Mostrar/ocultar cuadrícula de la regla de los tercios en el selector","aria-label":"Activar/desactivar grid",children:[
|
|
566
542
|
/* @__PURE__ */c("span",{className:"lb:text-sm lb:flex lb:items-center",children:[
|
|
567
543
|
/* @__PURE__ */s("span",{className:"icon icon-area-blue lb:me-1"})," ","Cuadrícula"]}),
|
|
568
544
|
/* @__PURE__ */s("span",{className:"lb:text-xs",children:S?/* @__PURE__ */c(u,{children:[
|
|
569
545
|
/* @__PURE__ */s("span",{className:"icon icon-tick icon--xs lb:align-[middle!important] lb:-mt-0.5"})," ","Activo"]}):"Inactivo"})]}),
|
|
570
|
-
/* @__PURE__ */c("button",{onClick:
|
|
546
|
+
/* @__PURE__ */c("button",{onClick:Pe,className:"lb:w-auto lb:flex lb:cursor-pointer lb:items-center lb:justify-between lb:mx-2 lb:p-1 lb:rounded lb:transition-colors "+(E?"lb:bg-blue-100 lb:border lb:border-blue-300 lb:text-blue-800":"lb:bg-gray-100 lb:border lb:border-gray-300 lb:text-gray-700 lb:hover:bg-gray-200"),disabled:pe,"aria-pressed":E,"aria-label":"Activar/desactivar sombreado",children:[
|
|
571
547
|
/* @__PURE__ */c("span",{className:"lb:text-sm lb:flex lb:items-center",children:[
|
|
572
548
|
/* @__PURE__ */s("span",{className:"icon icon-comparison-blue lb:me-1"})," ","Tablero"]}),
|
|
573
549
|
/* @__PURE__ */s("span",{className:"lb:text-xs",children:E?/* @__PURE__ */c(u,{children:[
|
|
@@ -594,16 +570,16 @@ return c("label",{className:"lb:h-fit lb:flex lb:flex-col lb:p-1.5 lb:rounded lb
|
|
|
594
570
|
/* @__PURE__ */c("div",{className:"lb:px-6 lb:py-4 lb:border-b lb:border-gray-200",children:[
|
|
595
571
|
/* @__PURE__ */s("h3",{className:"lb:text-lg lb:font-semibold lb:text-gray-800",children:"save"===de?"Seleccionar recortes a guardar":"Seleccionar recortes a descargar"}),
|
|
596
572
|
/* @__PURE__ */c("p",{className:"lb:text-sm lb:text-gray-600 lb:mt-1",children:["Marca los recortes que deseas"," ","save"===de?"guardar":"descargar"]})]}),
|
|
597
|
-
/* @__PURE__ */s("div",{className:"lb:px-6 lb:py-4 lb:overflow-y-auto lb:flex-1",children:/* @__PURE__ */s("div",{className:"lb:space-y-2",children:ee.map((e,t)=>{const
|
|
598
|
-
return c("label",{className:`lb:flex lb:items-center lb:gap-3 lb:p-3 lb:rounded lb:border lb:transition-colors ${ce.includes(t)?"lb:bg-blue-50 lb:border-blue-300":
|
|
599
|
-
/* @__PURE__ */s("input",{type:"checkbox",checked:ce.includes(t),disabled:
|
|
573
|
+
/* @__PURE__ */s("div",{className:"lb:px-6 lb:py-4 lb:overflow-y-auto lb:flex-1",children:/* @__PURE__ */s("div",{className:"lb:space-y-2",children:ee.map((e,t)=>{const n=e.savedState||t===ne,l=!e.required&&!n,r=e.required&&"save"===de;/* @__PURE__ */
|
|
574
|
+
return c("label",{className:`lb:flex lb:items-center lb:gap-3 lb:p-3 lb:rounded lb:border lb:transition-colors ${ce.includes(t)?"lb:bg-blue-50 lb:border-blue-300":l?"lb:bg-gray-100 lb:border-gray-300 lb:opacity-60":"lb:bg-gray-50 lb:border-gray-200 lb:hover:bg-gray-100"} ${l||r?"lb:cursor-not-allowed":"lb:cursor-pointer"}`,title:r?"Este recorte es obligatorio y debe ser guardado":"",children:[
|
|
575
|
+
/* @__PURE__ */s("input",{type:"checkbox",checked:ce.includes(t),disabled:l||r,onChange:e=>{e.target.checked?ue(e=>[...e,t]):ue(e=>e.filter(e=>e!==t))},className:"lb:w-4 lb:h-4 lb:text-blue-600"}),
|
|
600
576
|
/* @__PURE__ */c("div",{className:"lb:flex-1 lb:min-w-0",children:[
|
|
601
577
|
/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:gap-2 lb:flex-wrap",children:[
|
|
602
|
-
/* @__PURE__ */c("span",{title:"Nombre del archivo a descargar",className:"lb:text-sm lb:font-medium lb:text-gray-800 lb:truncate",children:[e.label,"_",e.width,"_",e.height]}),e.required&&/* @__PURE__ */s("span",{className:"lb:text-xs lb:px-1.5 lb:py-0.5 lb:bg-red-200 lb:text-red-1000 lb:rounded lb:whitespace-nowrap",children:"Obligatorio"}),!
|
|
578
|
+
/* @__PURE__ */c("span",{title:"Nombre del archivo a descargar",className:"lb:text-sm lb:font-medium lb:text-gray-800 lb:truncate",children:[e.label,"_",e.width,"_",e.height]}),e.required&&/* @__PURE__ */s("span",{className:"lb:text-xs lb:px-1.5 lb:py-0.5 lb:bg-red-200 lb:text-red-1000 lb:rounded lb:whitespace-nowrap",children:"Obligatorio"}),!n&&!e.required&&/* @__PURE__ */s("span",{className:"lb:text-xs lb:px-1.5 lb:py-0.5 lb:bg-orange-100 lb:text-orange-700 lb:rounded lb:whitespace-nowrap",children:"Sin configurar"})]}),
|
|
603
579
|
/* @__PURE__ */c("span",{title:"Dimensiones del recorte",className:"lb:text-xs lb:text-gray-500",children:[e.width," × ",e.height," px"]})]})]},e.id)})})}),
|
|
604
580
|
/* @__PURE__ */c("div",{className:"lb:px-6 lb:py-4 lb:border-t lb:border-gray-200 lb:flex lb:gap-3 lb:justify-end",children:[
|
|
605
581
|
/* @__PURE__ */s("button",{onClick:()=>{se(!1),be(null),ue([])},className:"limbo-btn limbo-btn-secondary lb:px-4 lb:py-2",children:"Cancelar"}),
|
|
606
|
-
/* @__PURE__ */c("button",{onClick:async()=>{if(se(!1),"save"===de)if(1===ce.length){const e=le
|
|
582
|
+
/* @__PURE__ */c("button",{onClick:async()=>{if(se(!1),"save"===de)if(1===ce.length){const e=ne;le(ce[0]),await new Promise(e=>setTimeout(e,100)),await bt(),le(e)}else await mt(ce);else if(1===ce.length){const e=ne;le(ce[0]),await new Promise(e=>setTimeout(e,100)),await gt(),le(e)}else await ft(ce);be(null),ue([])},disabled:0===ce.length,className:"limbo-btn limbo-btn-primary lb:px-4 lb:py-2 lb:disabled:opacity-50 lb:disabled:cursor-not-allowed",children:["save"===de?"Guardar":"Descargar"," (",ce.length,")"]})]})]})}),W&&/* @__PURE__ */s("div",{className:"lb:fixed lb:inset-0 lb:bg-black/50 lb:flex lb:items-center lb:justify-center lb:z-[9999] lb:p-4",children:/* @__PURE__ */c("div",{className:"lb:bg-white lb:rounded-lg lb:shadow-xl lb:max-w-5xl lb:w-full lb:max-h-[90vh] lb:overflow-hidden lb:flex lb:flex-col",children:[
|
|
607
583
|
/* @__PURE__ */s("div",{className:"lb:px-6 lb:py-4 lb:border-b lb:border-gray-200 lb:bg-brand-blue-50",children:/* @__PURE__ */c("div",{className:"lb:flex lb:items-center lb:justify-between",children:[
|
|
608
584
|
/* @__PURE__ */c("h3",{className:"lb:text-xl lb:font-semibold lb:text-brand-blue-1000 lb:flex lb:items-center lb:gap-2",children:[
|
|
609
585
|
/* @__PURE__ */s("span",{className:"icon icon-lightbulb lb:text-yellow-500"}),"Guía de uso del Cropper"]}),
|
|
@@ -728,14 +704,14 @@ return c("label",{className:`lb:flex lb:items-center lb:gap-3 lb:p-3 lb:rounded
|
|
|
728
704
|
/* @__PURE__ */c("p",{children:[re?.width," × ",re?.height," px"]})]})]}):/* @__PURE__ */s("div",{className:"lb:flex lb:items-center lb:justify-center lb:h-full lb:min-h-[200px]",children:/* @__PURE__ */s("p",{className:"lb:text-sm lb:text-gray-500",children:"No se pudo generar la vista previa"})})}),
|
|
729
705
|
/* @__PURE__ */s("div",{className:"lb:px-4 lb:py-2 lb:bg-gray-100 lb:border-t lb:border-gray-200",children:/* @__PURE__ */c("p",{className:"lb:text-xs lb:text-gray-600 lb:text-center",children:[
|
|
730
706
|
/* @__PURE__ */c("span",{className:"lb:hidden lb:md:inline",children:["Arrastra desde el título para mover •"," "]}),"Actualización automática al editar"]})})]})}),
|
|
731
|
-
/* @__PURE__ */s(He,{src:w,alt:"Vista previa del recorte",title:re?.label||"Recorte",subtitle:`${re?.width||0} × ${re?.height||0} px`,isOpen:D&&!!w,onClose:()=>R(!1)})]}):null}function
|
|
732
|
-
return c(u,{children:[m&&/* @__PURE__ */s(
|
|
733
|
-
/* @__PURE__ */c("div","crop-only"===v?{children:[h&&/* @__PURE__ */s(
|
|
734
|
-
/* @__PURE__ */s(
|
|
707
|
+
/* @__PURE__ */s(He,{src:w,alt:"Vista previa del recorte",title:re?.label||"Recorte",subtitle:`${re?.width||0} × ${re?.height||0} px`,isOpen:D&&!!w,onClose:()=>R(!1)})]}):null}function Ol({onSave:e,onCancel:t,onError:n,onVariantCreated:l,onUploadAndCrop:r,onVideoSelect:a,onUploadWithFolder:i,onFolderChange:o,onDelete:d,isActionAllowed:b,selectedImage:m,uploading:h,uploadError:p,deleting:f,selectedUploadFolder:g,modeUI:v,apiKey:y,prod:w,allowedCategories:x,resolvedAccept:k,returnConfig:C,folderConfig:S,cropperConfig:N,resetUpload:E}){/* @__PURE__ */
|
|
708
|
+
return c(u,{children:[m&&/* @__PURE__ */s(Rl,{image:m,onSave:e,onCancel:t,onDelete:m?.id&&b("delete")?()=>d(m.id):null,onError:n,deleting:f,onVariantCreated:l,onUpload:m?.tags?e=>i(e,m.tags):i,uploading:h,cropperConfig:N}),!m&&
|
|
709
|
+
/* @__PURE__ */c("div","crop-only"===v?{children:[h&&/* @__PURE__ */s(ut,{text:"Subiendo archivo..."}),p&&/* @__PURE__ */c(Se,{variant:"danger",toast:!0,onClose:E,children:["Error al subir archivo: ",p]}),
|
|
710
|
+
/* @__PURE__ */s(Bt,{onSelect:r,onVideoSelect:a,disabled:h,apiKey:y,prod:w,allowedCategories:x,resolvedAccept:k,returnConfig:C,folderConfig:S,selectedFolder:g,onFolderChange:o})]}:{className:"limbo-empty-state lb:flex lb:flex-col lb:items-center lb:justify-center lb:py-12 lb:px-6 lb:text-center",children:[
|
|
735
711
|
/* @__PURE__ */s("div",{className:"lb:text-gray-400 lb:mb-4",children:/* @__PURE__ */s("svg",{className:"lb:w-16 lb:h-16 lb:mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */s("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"})})}),
|
|
736
|
-
/* @__PURE__ */s("p",{className:"lb:text-gray-600 lb:mb-4",children:"Selecciona una imagen de la galería para comenzar a recortar."})]})]})}function Un({apiKey:i,onClose:o,prod:u=!1,features:d=["gallery","upload","cropper"],modeUI:b="full",ui:m={showActions:["select","download","copy","delete","crop","variants","rename"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0},callbacks:h={},instanceId:p=null,itemsPerPage:g=30,_externalImage:v=null,cropperConfig:y=null,folderConfig:w={include:[],exclude:[],includeNoFolder:!0,showFolderSelector:!0,showFolderFilter:!0,showFolderInfo:!0,allowMoveFolder:!0,allowCreateFolder:!0,defaultFolder:null},allowedCategories:x=null,accept:k=null,returnConfig:C=null,aiStarterPrompt:S}){const N=n(h);l(()=>{N.current=h},[h]);const E=n(null);he(E,{onClose:o}),l(()=>{Ie(),["limbo_stock_selectedService","limbo_stock_dynamicForm","limbo_stock_stockImages","limbo_stock_currentPage","limbo_stock_paginationInfo","limbo_portals_searchName","limbo_portals_limit","limbo_portals_currentPage","limbo_portals_images","limbo_portals_portalResults","limbo_portals_paginationInfo"].forEach(e=>sessionStorage.removeItem(e))},[]),l(()=>{const e=()=>{["limbo_stock_selectedService","limbo_stock_dynamicForm","limbo_stock_stockImages","limbo_stock_currentPage","limbo_stock_paginationInfo","limbo_portals_searchName","limbo_portals_limit","limbo_portals_currentPage","limbo_portals_images","limbo_portals_portalResults","limbo_portals_paginationInfo"].forEach(e=>sessionStorage.removeItem(e)),we(),Ie()},t=t=>{t.persisted&&e()};let l=null;const n=()=>{"hidden"===document.visibilityState?l=Date.now():"visible"===document.visibilityState&&null!==l&&(Date.now()-l>18e5&&e(),l=null)};return window.addEventListener("pageshow",t),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("pageshow",t),document.removeEventListener("visibilitychange",n)}},[]);const[$,_]=t({name:"",uploadedBy:"",dateFrom:"",dateTo:"",assetType:"",folder:""}),[T,A]=t(w?.defaultFolder||null),[z,L]=t([]),[I,M]=t(null),P=j($.name,400),D=j($.uploadedBy,400),F=e.useMemo(()=>f(k||(x?x.map(e=>`${e}/*`).join(","):null)),[k,x]),U=e=>!!e&&(e.startsWith("image/")&&"image/gif"!==e),B=(()=>{let e;switch(b){case"gallery-only":e=["gallery"];break;case"upload-only":e=["upload","cropper"];break;case"crop-only":e=["cropper"];break;case"ia-only":e=["ia"];break;default:e=[...d]}return F.isAllTypes||F.includesImages||(e=e.filter(e=>"cropper"!==e)),e})(),q=()=>B.includes("gallery")?"gallery":B.includes("upload")?"upload":B.includes("cropper")?"cropper":B.includes("ia")?"ia":B[0]||"gallery",[W,V]=t(q()),[H,K]=t(null),G=n(null);l(()=>{!H&&G.current&&(URL.revokeObjectURL(G.current),G.current=null)},[H]);const[Q,J]=t(null);l(()=>{v&&(console.log("📸 Imagen externa detectada:",v),K(v),V("cropper"))},[v]),l(()=>{const e=()=>{console.log("[App] Modal cerrado, reseteando estado..."),K(null),V(q())};return window.limboCore?.events&&window.limboCore.events.on("modal:closed",e),()=>{window.limboCore?.events&&window.limboCore.events.off("modal:closed",e)}},[]);const[Z,ee]=t(1),{isTokenExpired:te,handleTokenExpiredClose:le,handleTokenExpiredReload:ne}=function(){const[e,n]=t(!1),[r,i]=t(!1),o=a(async()=>{const e=Y();if("jwt"!==e.authMode||!e.tokenProvider)return!1;i(!0);try{return X(await e.tokenProvider()),n(!1),!0}catch{return!1}finally{i(!1)}},[]),s=a(e=>{if(401===e?.response?.status){const t=e.response.data;if("token_expired"===t?.error||t?.message?.includes("expired")||t?.message?.includes("caducado")||"string"==typeof t?.error&&t.error.includes("expired"))return n(!0),!0}return!1},[]),c=a(()=>{n(!1)},[]),u=a(()=>{n(!1),window.location.reload()},[]);return l(()=>{const e=e=>{if(!e.detail?.error)return;const t=Y();s(e.detail.error)&&("jwt"===t.authMode&&t.tokenProvider&&!e.detail.refreshAttempted?o().then(e=>{e||n(!0)}):n(!0))};return window.addEventListener("tokenExpiredError",e),()=>window.removeEventListener("tokenExpiredError",e)},[s,o]),{isTokenExpired:e,isRefreshing:r,checkTokenExpiration:s,handleTokenExpiredClose:c,handleTokenExpiredReload:u,tryRefreshToken:o}}(),{upload:re,loading:ae,error:ie,uploadedImage:oe,reset:ue}=function(){const[e,l]=t(!1),[n,r]=t(null),[a,i]=t(null);return{upload:async(e,t=null,n=null,a=null)=>{if(!e)return r("No se ha proporcionado ningún archivo"),null;l(!0),r(null),i(null);try{const l="object"==typeof n?n?.slug:n,r=await se(e,t,!1,l,a),o=r.result||r;return i(o),o}catch(o){return r(o.message),null}finally{l(!1)}},loading:e,error:n,uploadedImage:a,reset:()=>{r(null),i(null)}}}(),{deleteImg:de,loading:be,error:me,reset:ge}=fe(),ve=r(()=>({limit:g,page:Z,...P&&{q:P},...D&&{uploadedBy:D},...$.dateFrom&&{dateFrom:$.dateFrom},...$.dateTo&&{dateTo:$.dateTo},...$.assetType&&{asset_type:$.assetType},...!F.isAllTypes&&F.raw&&{accept:F.raw},...$.folder&&{folder:$.folder},...w.include?.length>0&&{folders_include:w.include.join(",")},...0===w.include?.length&&w.exclude?.length>0&&{folders_exclude:w.exclude.join(",")},...(w.include?.length>0||w.exclude?.length>0)&&void 0!==w.includeNoFolder&&{include_no_folder:w.includeNoFolder?"1":"0"}}),[g,Z,P,D,$.dateFrom,$.dateTo,$.assetType,$.folder,F.isAllTypes,F.raw,w.include,w.exclude,w.includeNoFolder]),ye=B.includes("gallery"),{images:Ne,loading:Ee,error:$e,pagination:_e,invalidateCache:Te,setImages:Ae,refetch:ze}=xe(i,u,ve,ye);l(()=>{const e=()=>{ze()};return document.addEventListener("limbo:variantsCleared",e),document.addEventListener("limbo:variantDeleted",e),()=>{document.removeEventListener("limbo:variantsCleared",e),document.removeEventListener("limbo:variantDeleted",e)}},[ze]);const{refreshVariants:Me}=ke(),Pe=a((e,t=null)=>re(e,null,T?.slug||T,t),[re,T]),{handleDelete:De,handleAssetFolderChange:Re,handleRenameAsset:Oe,handleEditAsset:je,handleVariantCreated:Fe}=function({callbacksRef:e,deleteImg:t,evictFromCache:l,invalidateCache:n,refreshVariants:r,images:i,setImages:o,setCurrentPage:s,selectedImage:c,setSelectedImage:u,setActiveTab:d}){return{handleDelete:async r=>{if(!confirm("¿Estás seguro de que deseas eliminar este archivo? Esta acción también eliminará todos sus recortes."))return;const a=i.find(e=>e.id===r);await t(r)&&(a?.url&&l(a.url),n(),s(1),o(e=>e.filter(e=>e.id!==r)),c&&c.id===r&&(u(null),d("gallery")),e.current.onDelete&&e.current.onDelete({assetId:r}))},handleAssetFolderChange:async(e,t)=>{const l=t?.slug||null;try{return await ce(e.id,{folder:l}),n(),o(l=>l.map(l=>l.id===e.id?{...l,folder:t??null}:l)),t}catch(r){throw console.error("Error al cambiar carpeta:",r),r}},handleRenameAsset:a(async(e,t)=>{const l=await ce(e.id,{original_filename:t}),r=l?.result||{};return n(),o(l=>l.map(l=>l.id!==e.id?l:{...l,filename:r.filename??t,...r.url&&{url:r.url},...void 0!==r.url_webp&&{url_webp:r.url_webp}})),l},[n,o]),handleEditAsset:a(async(e,{name:t,tags:l})=>{const r=await ce(e.id,{original_filename:t,tags:l}),a=r?.result||{};return n(),o(n=>n.map(n=>n.id!==e.id?n:{...n,filename:a.filename??t,tags:a.tags??l,...a.url&&{url:a.url},...void 0!==a.url_webp&&{url_webp:a.url_webp}})),r},[n,o]),handleVariantCreated:(e,t)=>{r(e),o(t=>t.map(t=>t.id===e?{...t,variants_count:(t.variants_count||0)+1}:t)),n()}}}({callbacksRef:N,deleteImg:de,evictFromCache:Le,invalidateCache:Te,refreshVariants:Me,images:Ne,setImages:Ae,setCurrentPage:ee,selectedImage:H,setSelectedImage:K,setActiveTab:V}),Ue=a(e=>{M(e)},[]),Be=a(async({name:e,tags:t})=>{I&&(await je(I,{name:e,tags:t}),ze?.())},[I,je,ze]),{handleUploadAndCrop:qe,handleVideoSelect:We}=function({callbacksRef:e,upload:t,refetch:l,activeFeatures:n,setActiveTab:r,setSelectedImage:i,setCurrentPage:o,setSuccessMessage:s,instanceId:c,selectedUploadFolder:u,tempBlobUrlRef:d,uploadTags:b=null}){return{handleUploadAndCrop:async(a,s=null)=>{if(!a.type?.startsWith("image/")||"image/gif"===a.type){const i=u?.slug||u,d=await t(a,null,i,s);return void(d&&(l(),o(1),n.includes("gallery")&&r("gallery"),e.current.onUpload&&e.current.onUpload({assetId:d.id,url:d.url,fileName:d.filename,mime:d.mime_type,width:d.width,height:d.height,instanceId:c})))}const m=URL.createObjectURL(a),h=await new Promise(e=>{const t=new Image;t.onload=()=>{e({width:t.naturalWidth,height:t.naturalHeight}),URL.revokeObjectURL(m)},t.onerror=()=>{e({width:1920,height:1080}),URL.revokeObjectURL(m)},t.src=m}),p=s||b,f={file:a,filename:a.name,mime_type:a.type,url:(()=>{const e=URL.createObjectURL(a);return d.current=e,e})(),width:h.width,height:h.height,tags:p};if(i(f),n.includes("cropper"))r("cropper");else{const n=u?.slug||u,i=await t(a,null,n,s);i&&(l(),o(1),r("gallery"),e.current.onUpload&&e.current.onUpload({assetId:i.id,url:i.url,fileName:i.filename,mime:i.mime_type,width:i.width,height:i.height,instanceId:c}))}},handleVideoSelect:a(t=>{const l={...t,instanceId:c};e.current.onSelect&&e.current.onSelect(l),window.limboCore?.events&&window.limboCore.events.emit("select",l),"modal"===((window.limboCore?.config?.getGlobal()||{}).mode||"embed")&&window.limboCore?.modals?.closeAllModals(),s(`Vídeo seleccionado: ${t.title||"Sin título"}`),setTimeout(()=>s(null),3e3)},[c,s])}}({callbacksRef:N,upload:re,refetch:ze,activeFeatures:B,setActiveTab:V,setSelectedImage:K,setCurrentPage:ee,setSuccessMessage:J,instanceId:p,selectedUploadFolder:T,tempBlobUrlRef:G,uploadTags:z}),{handleCropSave:Ve,handleCropCancel:He,handleCropError:Ke}=function({callbacksRef:e,selectedImage:t,setSelectedImage:l,setActiveTab:n,setImages:r,setCurrentPage:a,setSuccessMessage:i,invalidateCache:o,refetch:s,evictFromCache:c,instanceId:u,activeFeatures:d,modeUI:b}){const m=()=>"crop-only"===b||1===d.length&&"cropper"===d[0]?"crop-only":d.includes("gallery")?"with-gallery":d.includes("upload")&&!d.includes("gallery")?"upload-only":"with-gallery";return{handleCropSave:d=>{const b=m(),h=window.limboCore?.config?.getGlobal()||{},p=h.mode||"embed",f=h.autoHideOnComplete||!1;let g=[],v=null;d.crops&&d.asset?(g=d.crops,v=d.asset):g=d.crops&&Array.isArray(d.crops)?d.crops:Array.isArray(d)?d:[d],v&&"with-gallery"===b&&(r(e=>[v,...e]),a(1),e.current.onUpload&&e.current.onUpload({assetId:v.id,url:v.url,fileName:v.filename,mime:v.mime_type,width:v.width,height:v.height,instanceId:u})),t?.url&&c(t.url),"with-gallery"===b&&(v?s():o());const y=v||t,w=g.some(e=>!0===e.isLocal),x={crops:g,assetId:y?.id,instanceId:u,localCrops:w,asset:y?{id:y.id,url:y.url||y.urlSigned,width:y.width,height:y.height,filename:y.filename,mime_type:y.mime_type}:null};console.log("[App] handleCropSave - callbackPayload:",x),console.log("[App] handleCropSave - crops:",g),console.log("[App] handleCropSave - crops[0]?.url:",g[0]?.url),console.log("[App] handleCropSave - asset:",x.asset),console.log("[App] handleCropSave - callbacksRef.current.onCropsSaved existe:",!!e.current.onCropsSaved),e.current.onCropsSaved?(console.log("[App] Llamando callbacksRef.current.onCropsSaved..."),e.current.onCropsSaved(x),console.log("[App] callbacksRef.current.onCropsSaved ejecutado")):console.warn("[App] ⚠️ callbacksRef.current.onCropsSaved NO existe"),window.limboCore?.events&&window.limboCore.events.emit("cropsSaved",x);const k=g.length;switch(i(`✅ ${k} recorte${1!==k?"s":""} guardado${1!==k?"s":""} correctamente`),setTimeout(()=>i(null),3e3),b){case"with-gallery":"modal"===p?e.current.onCropsSaved||(window.limboCore?.modals?.closeAllModals(),l(null),n("gallery")):(l(null),n("gallery"));break;case"upload-only":"modal"===p?e.current.onCropsSaved||(window.limboCore?.modals?.closeAllModals(),l(null),n("upload")):(l(null),n("upload"));break;case"crop-only":if("modal"===p)e.current.onCropperComplete&&e.current.onCropperComplete({crops:g,instanceId:u}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:g,instanceId:u}),window.limboCore?.modals?.closeAllModals();else if(e.current.onCropperComplete&&e.current.onCropperComplete({crops:g,instanceId:u}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:g,instanceId:u}),f){const e=document.querySelector(`#limbo-instance-${u}`);e&&(e.style.display="none")}}},handleCropCancel:()=>{const r=m(),a=(window.limboCore?.config?.getGlobal()||{}).mode||"embed";switch(e.current.onCropperCancelled&&e.current.onCropperCancelled({assetId:t?.id,instanceId:u}),window.limboCore?.events&&window.limboCore.events.emit("cropperCancelled",{assetId:t?.id,instanceId:u}),r){case"with-gallery":l(null),n("gallery");break;case"upload-only":"modal"===a?window.limboCore?.modals?.closeAllModals():(l(null),n("upload"));break;case"crop-only":"modal"===a?window.limboCore?.modals?.closeAllModals():window.limboCore?.events&&window.limboCore.events.emit("cropperClosed",{instanceId:u,reason:"cancelled"})}},handleCropError:l=>{e.current.onCropperError&&e.current.onCropperError(l,u),window.limboCore?.events&&window.limboCore.events.emit("cropperError",{error:l,assetId:t?.id,instanceId:u}),console.error("Cropper error:",l)}}}({callbacksRef:N,selectedImage:H,setSelectedImage:K,setActiveTab:V,setImages:Ae,setCurrentPage:ee,setSuccessMessage:J,invalidateCache:Te,evictFromCache:Le,refetch:ze,instanceId:p,activeFeatures:B,modeUI:b}),Ge=e=>!m.hideActions?.includes(e)&&(!!m.showActions?.includes(e)||!(m.showActions?.length>0)),Qe=[{id:"gallery",label:"Galería",feature:"gallery"},{id:"upload",label:"Subir",feature:"upload"},{id:"cropper",label:"Recortador",hideNonActive:!0,feature:"cropper"}].filter(e=>B.includes(e.feature)),Xe=e=>{U(e.mime_type||e.original_mime)?(K(e),B.includes("cropper")&&V("cropper")):console.log("[App] ⚠️ Archivo no recortable:",e.mime_type||e.original_mime,"- saltando cropper")};/* @__PURE__ */
|
|
737
|
-
return c("div",{ref:E,className:"limbo-app-root",children:[m.showTabs&&"cropper"!=W&&/* @__PURE__ */s(R,{tabs:Qe,active:W,onChange:e=>{V(e),"upload"!==e&&ue(),"gallery"!==e&&ge()}}),$e&&/* @__PURE__ */c(Se,{variant:"danger",children:["Error al cargar archivos: ",$e]}),me&&/* @__PURE__ */c(Se,{variant:"danger",children:["Error al eliminar archivo: ",me]}),Q&&/* @__PURE__ */s(Se,{variant:"success",fixed:!0,onClose:()=>J(null),children:Q}),"gallery"===W&&/* @__PURE__ */s(
|
|
712
|
+
/* @__PURE__ */s("p",{className:"lb:text-gray-600 lb:mb-4",children:"Selecciona una imagen de la galería para comenzar a recortar."})]})]})}function Fl({apiKey:i,onClose:o,prod:u=!1,features:d=["gallery","upload","cropper"],modeUI:b="full",ui:m={showActions:["select","download","copy","delete","crop","variants","rename"],hideActions:[],theme:"light",language:"es",compactMode:!1,showTabs:!0},callbacks:h={},instanceId:p=null,itemsPerPage:g=30,_externalImage:v=null,cropperConfig:y=null,folderConfig:w={include:[],exclude:[],includeNoFolder:!0,showFolderSelector:!0,showFolderFilter:!0,showFolderInfo:!0,allowMoveFolder:!0,allowCreateFolder:!0,defaultFolder:null},allowedCategories:x=null,accept:k=null,returnConfig:C=null,aiStarterPrompt:S}){const N=l(h);n(()=>{N.current=h},[h]);const E=l(null);he(E,{onClose:o}),n(()=>{Me(),["limbo_stock_selectedService","limbo_stock_dynamicForm","limbo_stock_stockImages","limbo_stock_currentPage","limbo_stock_paginationInfo","limbo_portals_searchName","limbo_portals_limit","limbo_portals_currentPage","limbo_portals_images","limbo_portals_portalResults","limbo_portals_paginationInfo"].forEach(e=>sessionStorage.removeItem(e))},[]),n(()=>{const e=()=>{["limbo_stock_selectedService","limbo_stock_dynamicForm","limbo_stock_stockImages","limbo_stock_currentPage","limbo_stock_paginationInfo","limbo_portals_searchName","limbo_portals_limit","limbo_portals_currentPage","limbo_portals_images","limbo_portals_portalResults","limbo_portals_paginationInfo"].forEach(e=>sessionStorage.removeItem(e)),we(),Me()},t=t=>{t.persisted&&e()};let n=null;const l=()=>{"hidden"===document.visibilityState?n=Date.now():"visible"===document.visibilityState&&null!==n&&(Date.now()-n>18e5&&e(),n=null)};return window.addEventListener("pageshow",t),document.addEventListener("visibilitychange",l),()=>{window.removeEventListener("pageshow",t),document.removeEventListener("visibilitychange",l)}},[]);const[$,_]=t({name:"",uploadedBy:"",dateFrom:"",dateTo:"",assetType:"",folder:""}),[T,A]=t(w?.defaultFolder||null),[z,L]=t([]),[M,P]=t(null),I=F($.name,400),D=F($.uploadedBy,400),j=e.useMemo(()=>f(k||(x?x.map(e=>`${e}/*`).join(","):null)),[k,x]),U=e=>!!e&&(e.startsWith("image/")&&"image/gif"!==e),B=(()=>{let e;switch(b){case"gallery-only":e=["gallery"];break;case"upload-only":e=["upload","cropper"];break;case"crop-only":e=["cropper"];break;case"ia-only":e=["ia"];break;default:e=[...d]}return j.isAllTypes||j.includesImages||(e=e.filter(e=>"cropper"!==e)),e})(),q=()=>B.includes("gallery")?"gallery":B.includes("upload")?"upload":B.includes("cropper")?"cropper":B.includes("ia")?"ia":B[0]||"gallery",[W,V]=t(q()),[H,K]=t(null),G=l(null);n(()=>{!H&&G.current&&(URL.revokeObjectURL(G.current),G.current=null)},[H]);const[Q,J]=t(null);n(()=>{v&&(console.log("📸 Imagen externa detectada:",v),K(v),V("cropper"))},[v]),n(()=>{const e=()=>{console.log("[App] Modal cerrado, reseteando estado..."),K(null),V(q())};return window.limboCore?.events&&window.limboCore.events.on("modal:closed",e),()=>{window.limboCore?.events&&window.limboCore.events.off("modal:closed",e)}},[]);const[Z,ee]=t(1),{isTokenExpired:te,handleTokenExpiredClose:ne,handleTokenExpiredReload:le}=function(){const[e,l]=t(!1),[r,i]=t(!1),o=a(async()=>{const e=Y();if("jwt"!==e.authMode||!e.tokenProvider)return!1;i(!0);try{return X(await e.tokenProvider()),l(!1),!0}catch{return!1}finally{i(!1)}},[]),s=a(e=>{if(401===e?.response?.status){const t=e.response.data;if("token_expired"===t?.error||t?.message?.includes("expired")||t?.message?.includes("caducado")||"string"==typeof t?.error&&t.error.includes("expired"))return l(!0),!0}return!1},[]),c=a(()=>{l(!1)},[]),u=a(()=>{l(!1),window.location.reload()},[]);return n(()=>{const e=e=>{if(!e.detail?.error)return;const t=Y();s(e.detail.error)&&("jwt"===t.authMode&&t.tokenProvider&&!e.detail.refreshAttempted?o().then(e=>{e||l(!0)}):l(!0))};return window.addEventListener("tokenExpiredError",e),()=>window.removeEventListener("tokenExpiredError",e)},[s,o]),{isTokenExpired:e,isRefreshing:r,checkTokenExpiration:s,handleTokenExpiredClose:c,handleTokenExpiredReload:u,tryRefreshToken:o}}(),{upload:re,loading:ae,error:ie,uploadedImage:oe,reset:ue}=function(){const[e,n]=t(!1),[l,r]=t(null),[a,i]=t(null);return{upload:async(e,t=null,l=null,a=null)=>{if(!e)return r("No se ha proporcionado ningún archivo"),null;n(!0),r(null),i(null);try{const n="object"==typeof l?l?.slug:l,r=await se(e,t,!1,n,a),o=r.result||r;return i(o),o}catch(o){return r(o.message),null}finally{n(!1)}},loading:e,error:l,uploadedImage:a,reset:()=>{r(null),i(null)}}}(),{deleteImg:de,loading:be,error:me,reset:ge}=fe(),ve=r(()=>({limit:g,page:Z,...I&&{q:I},...D&&{uploadedBy:D},...$.dateFrom&&{dateFrom:$.dateFrom},...$.dateTo&&{dateTo:$.dateTo},...$.assetType&&{asset_type:$.assetType},...!j.isAllTypes&&j.raw&&{accept:j.raw},...$.folder&&{folder:$.folder},...w.include?.length>0&&{folders_include:w.include.join(",")},...0===w.include?.length&&w.exclude?.length>0&&{folders_exclude:w.exclude.join(",")},...(w.include?.length>0||w.exclude?.length>0)&&void 0!==w.includeNoFolder&&{include_no_folder:w.includeNoFolder?"1":"0"}}),[g,Z,I,D,$.dateFrom,$.dateTo,$.assetType,$.folder,j.isAllTypes,j.raw,w.include,w.exclude,w.includeNoFolder]),ye=B.includes("gallery"),{images:Ne,loading:Ee,error:$e,pagination:_e,invalidateCache:Te,setImages:Ae,refetch:ze}=xe(i,u,ve,ye);n(()=>{const e=()=>{ze()};return document.addEventListener("limbo:variantsCleared",e),document.addEventListener("limbo:variantDeleted",e),()=>{document.removeEventListener("limbo:variantsCleared",e),document.removeEventListener("limbo:variantDeleted",e)}},[ze]);const{refreshVariants:Pe}=ke(),Ie=a((e,t=null)=>re(e,null,T?.slug||T,t),[re,T]),{handleDelete:De,handleAssetFolderChange:Re,handleRenameAsset:Oe,handleEditAsset:Fe,handleVariantCreated:je}=function({callbacksRef:e,deleteImg:t,evictFromCache:n,invalidateCache:l,refreshVariants:r,images:i,setImages:o,setCurrentPage:s,selectedImage:c,setSelectedImage:u,setActiveTab:d}){return{handleDelete:async r=>{if(!confirm("¿Estás seguro de que deseas eliminar este archivo? Esta acción también eliminará todos sus recortes."))return;const a=i.find(e=>e.id===r);await t(r)&&(a?.url&&n(a.url),l(),s(1),o(e=>e.filter(e=>e.id!==r)),c&&c.id===r&&(u(null),d("gallery")),e.current.onDelete&&e.current.onDelete({assetId:r}))},handleAssetFolderChange:async(e,t)=>{const n=t?.slug||null;try{return await ce(e.id,{folder:n}),l(),o(n=>n.map(n=>n.id===e.id?{...n,folder:t??null}:n)),t}catch(r){throw console.error("Error al cambiar carpeta:",r),r}},handleRenameAsset:a(async(e,t)=>{const n=await ce(e.id,{original_filename:t}),r=n?.result||{};return l(),o(n=>n.map(n=>n.id!==e.id?n:{...n,filename:r.filename??t,...r.url&&{url:r.url},...void 0!==r.url_webp&&{url_webp:r.url_webp}})),n},[l,o]),handleEditAsset:a(async(e,{name:t,tags:n})=>{const r=await ce(e.id,{original_filename:t,tags:n}),a=r?.result||{};return l(),o(l=>l.map(l=>l.id!==e.id?l:{...l,filename:a.filename??t,tags:a.tags??n,...a.url&&{url:a.url},...void 0!==a.url_webp&&{url_webp:a.url_webp}})),r},[l,o]),handleVariantCreated:(e,t)=>{r(e),o(t=>t.map(t=>t.id===e?{...t,variants_count:(t.variants_count||0)+1}:t)),l()}}}({callbacksRef:N,deleteImg:de,evictFromCache:Le,invalidateCache:Te,refreshVariants:Pe,images:Ne,setImages:Ae,setCurrentPage:ee,selectedImage:H,setSelectedImage:K,setActiveTab:V}),Ue=a(e=>{P(e)},[]),Be=a(async({name:e,tags:t})=>{M&&(await Fe(M,{name:e,tags:t}),ze?.())},[M,Fe,ze]),{handleUploadAndCrop:qe,handleVideoSelect:We}=function({callbacksRef:e,upload:t,refetch:n,activeFeatures:l,setActiveTab:r,setSelectedImage:i,setCurrentPage:o,setSuccessMessage:s,instanceId:c,selectedUploadFolder:u,tempBlobUrlRef:d,uploadTags:b=null}){return{handleUploadAndCrop:async(a,s=null)=>{if(!a.type?.startsWith("image/")||"image/gif"===a.type){const i=u?.slug||u,d=await t(a,null,i,s);return void(d&&(n(),o(1),l.includes("gallery")&&r("gallery"),e.current.onUpload&&e.current.onUpload({assetId:d.id,url:d.url,fileName:d.filename,mime:d.mime_type,width:d.width,height:d.height,instanceId:c})))}const m=URL.createObjectURL(a),h=await new Promise(e=>{const t=new Image;t.onload=()=>{e({width:t.naturalWidth,height:t.naturalHeight}),URL.revokeObjectURL(m)},t.onerror=()=>{e({width:1920,height:1080}),URL.revokeObjectURL(m)},t.src=m}),p=s||b,f={file:a,filename:a.name,mime_type:a.type,url:(()=>{const e=URL.createObjectURL(a);return d.current=e,e})(),width:h.width,height:h.height,tags:p};if(i(f),l.includes("cropper"))r("cropper");else{const l=u?.slug||u,i=await t(a,null,l,s);i&&(n(),o(1),r("gallery"),e.current.onUpload&&e.current.onUpload({assetId:i.id,url:i.url,fileName:i.filename,mime:i.mime_type,width:i.width,height:i.height,instanceId:c}))}},handleVideoSelect:a(t=>{const n={...t,instanceId:c};e.current.onSelect&&e.current.onSelect(n),window.limboCore?.events&&window.limboCore.events.emit("select",n),"modal"===((window.limboCore?.config?.getGlobal()||{}).mode||"embed")&&window.limboCore?.modals?.closeAllModals(),s(`Vídeo seleccionado: ${t.title||"Sin título"}`),setTimeout(()=>s(null),3e3)},[c,s])}}({callbacksRef:N,upload:re,refetch:ze,activeFeatures:B,setActiveTab:V,setSelectedImage:K,setCurrentPage:ee,setSuccessMessage:J,instanceId:p,selectedUploadFolder:T,tempBlobUrlRef:G,uploadTags:z}),{handleCropSave:Ve,handleCropCancel:He,handleCropError:Ke}=function({callbacksRef:e,selectedImage:t,setSelectedImage:n,setActiveTab:l,setImages:r,setCurrentPage:a,setSuccessMessage:i,invalidateCache:o,refetch:s,evictFromCache:c,instanceId:u,activeFeatures:d,modeUI:b}){const m=()=>"crop-only"===b||1===d.length&&"cropper"===d[0]?"crop-only":d.includes("gallery")?"with-gallery":d.includes("upload")&&!d.includes("gallery")?"upload-only":"with-gallery";return{handleCropSave:d=>{const b=m(),h=window.limboCore?.config?.getGlobal()||{},p=h.mode||"embed",f=h.autoHideOnComplete||!1;let g=[],v=null;d.crops&&d.asset?(g=d.crops,v=d.asset):g=d.crops&&Array.isArray(d.crops)?d.crops:Array.isArray(d)?d:[d],v&&"with-gallery"===b&&(r(e=>[v,...e]),a(1),e.current.onUpload&&e.current.onUpload({assetId:v.id,url:v.url,fileName:v.filename,mime:v.mime_type,width:v.width,height:v.height,instanceId:u})),t?.url&&c(t.url),"with-gallery"===b&&(v?s():o());const y=v||t,w=g.some(e=>!0===e.isLocal),x={crops:g,assetId:y?.id,instanceId:u,localCrops:w,asset:y?{id:y.id,url:y.url||y.urlSigned,width:y.width,height:y.height,filename:y.filename,mime_type:y.mime_type}:null};console.log("[App] handleCropSave - callbackPayload:",x),console.log("[App] handleCropSave - crops:",g),console.log("[App] handleCropSave - crops[0]?.url:",g[0]?.url),console.log("[App] handleCropSave - asset:",x.asset),console.log("[App] handleCropSave - callbacksRef.current.onCropsSaved existe:",!!e.current.onCropsSaved),e.current.onCropsSaved?(console.log("[App] Llamando callbacksRef.current.onCropsSaved..."),e.current.onCropsSaved(x),console.log("[App] callbacksRef.current.onCropsSaved ejecutado")):console.warn("[App] ⚠️ callbacksRef.current.onCropsSaved NO existe"),window.limboCore?.events&&window.limboCore.events.emit("cropsSaved",x);const k=g.length;switch(i(`✅ ${k} recorte${1!==k?"s":""} guardado${1!==k?"s":""} correctamente`),setTimeout(()=>i(null),3e3),b){case"with-gallery":"modal"===p?e.current.onCropsSaved||(window.limboCore?.modals?.closeAllModals(),n(null),l("gallery")):(n(null),l("gallery"));break;case"upload-only":"modal"===p?e.current.onCropsSaved||(window.limboCore?.modals?.closeAllModals(),n(null),l("upload")):(n(null),l("upload"));break;case"crop-only":if("modal"===p)e.current.onCropperComplete&&e.current.onCropperComplete({crops:g,instanceId:u}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:g,instanceId:u}),window.limboCore?.modals?.closeAllModals();else if(e.current.onCropperComplete&&e.current.onCropperComplete({crops:g,instanceId:u}),window.limboCore?.events&&window.limboCore.events.emit("cropperComplete",{crops:g,instanceId:u}),f){const e=document.querySelector(`#limbo-instance-${u}`);e&&(e.style.display="none")}}},handleCropCancel:()=>{const r=m(),a=(window.limboCore?.config?.getGlobal()||{}).mode||"embed";switch(e.current.onCropperCancelled&&e.current.onCropperCancelled({assetId:t?.id,instanceId:u}),window.limboCore?.events&&window.limboCore.events.emit("cropperCancelled",{assetId:t?.id,instanceId:u}),r){case"with-gallery":n(null),l("gallery");break;case"upload-only":"modal"===a?window.limboCore?.modals?.closeAllModals():(n(null),l("upload"));break;case"crop-only":"modal"===a?window.limboCore?.modals?.closeAllModals():window.limboCore?.events&&window.limboCore.events.emit("cropperClosed",{instanceId:u,reason:"cancelled"})}},handleCropError:n=>{e.current.onCropperError&&e.current.onCropperError(n,u),window.limboCore?.events&&window.limboCore.events.emit("cropperError",{error:n,assetId:t?.id,instanceId:u}),console.error("Cropper error:",n)}}}({callbacksRef:N,selectedImage:H,setSelectedImage:K,setActiveTab:V,setImages:Ae,setCurrentPage:ee,setSuccessMessage:J,invalidateCache:Te,evictFromCache:Le,refetch:ze,instanceId:p,activeFeatures:B,modeUI:b}),Ge=e=>!m.hideActions?.includes(e)&&(!!m.showActions?.includes(e)||!(m.showActions?.length>0)),Qe=[{id:"gallery",label:"Galería",feature:"gallery"},{id:"upload",label:"Subir",feature:"upload"},{id:"cropper",label:"Recortador",hideNonActive:!0,feature:"cropper"}].filter(e=>B.includes(e.feature)),Xe=e=>{U(e.mime_type||e.original_mime)?(K(e),B.includes("cropper")&&V("cropper")):console.log("[App] ⚠️ Archivo no recortable:",e.mime_type||e.original_mime,"- saltando cropper")};/* @__PURE__ */
|
|
713
|
+
return c("div",{ref:E,className:"limbo-app-root",children:[m.showTabs&&"cropper"!=W&&/* @__PURE__ */s(R,{tabs:Qe,active:W,onChange:e=>{V(e),"upload"!==e&&ue(),"gallery"!==e&&ge()}}),$e&&/* @__PURE__ */c(Se,{variant:"danger",children:["Error al cargar archivos: ",$e]}),me&&/* @__PURE__ */c(Se,{variant:"danger",children:["Error al eliminar archivo: ",me]}),Q&&/* @__PURE__ */s(Se,{variant:"success",fixed:!0,onClose:()=>J(null),children:Q}),"gallery"===W&&/* @__PURE__ */s(dt,{onSelect:e=>{const t=y?.mandatoryCrops?.length>0,n=U(e.mime_type||e.original_mime);if(t&&n&&B.includes("cropper"))return console.log("[App] 📐 MandatoryCrops detectados, navegando al cropper primero"),void Xe(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:Xe,onDelete:Ge("delete")?De:null,onFolderChange:Re,onRename:Oe,onEdit:Ue,onPageChange:e=>{ee(e)},onFiltersChange:e=>{_(e),ee(1)},images:Ne,loadingImages:Ee,imagesError:$e,deleting:be,uploadedImage:oe,pagination:_e,currentPage:Z,galleryFilters:$,debouncedFilters:{name:I,uploadedBy:D,dateFrom:$.dateFrom,dateTo:$.dateTo,assetType:$.assetType,folder:$.folder},allowedActions:{select:Ge("select"),download:Ge("download"),copy:Ge("copy"),delete:Ge("delete"),crop:Ge("crop"),rename:Ge("rename")},resolvedAccept:j,allowedCategories:x,folderConfig:w,filterConfig:m.galleryFilters||{},loadingConfig:m.galleryLoading||{},resetUpload:ue}),"upload"===W&&/* @__PURE__ */s(qt,{onSelect:qe,onVideoSelect:We,onFolderChange:A,uploading:ae,uploadError:ie,uploadedImage:oe,selectedUploadFolder:T,apiKey:i,prod:u,allowedCategories:x,resolvedAccept:j,returnConfig:C,folderConfig:w,aiStarterPrompt:S,resetUpload:ue,tags:z,onTagsChange:L}),"cropper"===W&&/* @__PURE__ */s(Ol,{onSave:Ve,onCancel:He,onError:Ke,onVariantCreated:je,onUploadAndCrop:qe,onVideoSelect:We,onUploadWithFolder:Ie,onFolderChange:A,onDelete:De,isActionAllowed:Ge,selectedImage:H,uploading:ae,uploadError:ie,uploadedImage:oe,deleting:be,selectedUploadFolder:T,modeUI:b,apiKey:i,prod:u,allowedCategories:x,resolvedAccept:j,returnConfig:C,folderConfig:w,cropperConfig:y,resetUpload:ue}),
|
|
738
714
|
/* @__PURE__ */s(Ce,{}),
|
|
739
|
-
/* @__PURE__ */s(O,{isOpen:te,onClose:
|
|
740
|
-
/* @__PURE__ */s(pe,{isOpen:!!I,asset:I,onClose:()=>M(null),onSave:Be})]})}class Bn{constructor(e,t,l,n){this.id=e,this.config=t,this.eventManager=l,this.modalManager=n,this.root=null,this.container=null,this.modal=null,this.mounted=!1,this.destroyed=!1,this.button=null,this._handleAppClose=()=>{this.modal&&"function"==typeof this.modal.close&&this.modal.close()},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=M.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||this.config.modal?.size||"large",usesReactFocusTrap:!0,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=M.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-scope limbo-instance limbo-component-container-wrapper lb:h-full lb:w-full lb:py-2 lb:pb-0 lb:bg-white","data-limbo-id":this.id,"data-limbo-mode":this.config.mode,"data-limbo-version":"4.2.1","data-limbo-isolated":"true","aria-label":"Limbo Image Manager",role:"region"},e.createElement(Un,{onClose:"modal"===this.config.mode?this._handleAppClose:void 0,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,allowedCategories:this.config.validation?.allowedCategories||null,accept:this.config.validation?.accept||null,returnConfig:this.config.returnConfig||null,aiStarterPrompt:this.config.aiStarterPrompt,folderConfig:this.config.folders||{include:[],exclude:[],includeNoFolder:!0},itemsPerPage:this.config.itemsPerPage||30}))}_createCallbacks(){return{onSelect:e=>{const t=this.config?.callbacks?.onSelect,l=this._createStandardPayload(e,"select");t&&Promise.resolve(t(l)).catch(e=>{console.error("[LimboInstance] Error en onSelect callback:",e)}),this.destroyed||this._emitDOMEvent("select",l)},onUpload:e=>{const t=this.config?.callbacks?.onUpload,l=this._createStandardPayload(e,"upload");t&&Promise.resolve(t(l)).catch(e=>{console.error("[LimboInstance] Error en onUpload callback:",e)}),this.destroyed||this._emitDOMEvent("upload",l)},onError:e=>{const t=this.config?.callbacks?.onError,l={instance:this,error:{message:e.message||"Unknown error",code:e.code||"UNKNOWN",timestamp:Date.now()}};t&&t(l.error),this.destroyed||this._emitDOMEvent("error",l)},onClose:()=>{const e=this.config?.callbacks?.onClose,t={instance:this,timestamp:Date.now()};e&&e(),this.destroyed||this._emitDOMEvent("close",t)},onCropsSaved:e=>{console.log("[LimboInstance] onCropsSaved recibido:",e),console.log("[LimboInstance] this.config?.callbacks:",this.config?.callbacks);const t=this.config?.callbacks?.onCropsSaved;console.log("[LimboInstance] userCallback existe:",!!t);const l={instance:this,eventType:"cropsSaved",timestamp:Date.now(),instanceId:this.id,...e};if(console.log("[LimboInstance] payload.crops:",l.crops),t){console.log("[LimboInstance] Llamando userCallback onCropsSaved");try{t(l),console.log("[LimboInstance] userCallback ejecutado correctamente")}catch(n){console.error("[LimboInstance] Error en userCallback:",n)}}else console.warn("[LimboInstance] ⚠️ userCallback onCropsSaved NO existe");this.destroyed||this._emitDOMEvent("cropsSaved",l)},onCropperComplete:e=>{console.log("[LimboInstance] onCropperComplete recibido:",e);const t=this.config?.callbacks?.onCropperComplete,l={instance:this,eventType:"cropperComplete",timestamp:Date.now(),instanceId:this.id,...e};t&&(console.log("[LimboInstance] Llamando userCallback onCropperComplete"),t(l)),this.destroyed||this._emitDOMEvent("cropperComplete",l)}}}_createStandardPayload(e,t){const l={instance:this,eventType:t,timestamp:Date.now(),instanceId:this.id,mode:this.config?.mode,features:this.config?.features};return e&&(e.assetId||e.id?(l.assetId=e.assetId||e.id,l.variants=e.variants||[],l.master=e.master||{urlSigned:e.url||e.urlSigned,width:e.width,height:e.height,mime:e.mime||e.mimeType},l.fileName=e.fileName||e.name,l.mime=e.mime||e.mimeType,l.width=e.width,l.height=e.height,l.fileBlob=e.fileBlob||e.file,l.metadata={uploadedBy:e.uploadedBy,uploadedAt:e.uploadedAt||e.timestamp,size:e.size,...e.metadata}):Object.assign(l,e)),l}_emitDOMEvent(e,t){if(this.destroyed)return;const l=new CustomEvent(`limbo:${e}`,{detail:t,bubbles:!0,cancelable:!0});(this.getContainer()||document).dispatchEvent(l),this.eventManager?.emit(e,t)}_validateConfig(){const e=Y();if(!(this.config.auth?.apiKey||this.config.auth?.publicKey||this.config.auth?.token||this.config.apiKey||this.config.publicKey||this.config.token||this.config.tokenProvider||this.config.auth?.tokenProvider||e.token||e.publicKey||e.tokenProvider))throw new Error(`LimboInstance ${this.id}: Authentication is required. Provide either auth.publicKey (recommended), auth.apiKey (for server-side only), token, or tokenProvider`);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 qn{constructor(){this.instances=/* @__PURE__ */new Map,this.counter=0}create(e,t,l){const n="limbo-"+ ++this.counter,r=new Bn(n,e,t,l);return this.instances.set(n,r),r}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,l)=>{t.isContainerInDOM()||e.push(l)}),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 Wn{constructor(){this.config=null,this.instances=/* @__PURE__ */new Map,this.observer=null,this.initialized=!1}configure(e,t,l){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","svg","webp"],minWidth:e.minWidth||null,minHeight:e.minHeight||null,maxWidth:e.maxWidth||null,maxHeight:e.maxHeight||null,buttonText:e.buttonText||"Seleccionar archivo",buttonClass:e.buttonClass||"limbo-auto-button",buttonStyle:e.buttonStyle||"primary",showPreview:!1!==e.showPreview,allowMultiple:e.allowMultiple||!1,autoAssign:!1!==e.autoAssign,localCropsOnly:e.localCropsOnly||!1,...e},this.configManager=t,this.eventManager=l,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 l=this._createButton(e);this._hideInput(e),this._insertButton(e,l),this.instances.set(t,{input:e,button:l,config:this._getInputConfig(e)}),this.eventManager.emit("autoInputs:processed",{inputId:t,input:e,button:l})}_createButton(e){const t=document.createElement("button"),l=this._getInputConfig(e);t.type="button";const n=e.dataset.buttontext||e.getAttribute("data-limbo-button-text")||null;t.textContent=n||v(l.accept||null,!1);const r=[this.config.buttonClass];return l.buttonClass&&l.buttonClass!==this.config.buttonClass&&r.push(l.buttonClass),t.className=r.join(" "),this._styleButton(t,l),this._attachButtonEvents(t,e),t.setAttribute("aria-label",l.buttonText||this.config.buttonText),t.setAttribute("data-limbo-trigger","true"),t.setAttribute("data-limbo-input-id",l.inputId),l.disabled&&(t.disabled=!0),t}_styleButton(e,t){const l=t.buttonStyle||this.config.buttonStyle,n=t.theme||this.config.theme,r=t.compact||this.config.compact,a={border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"inherit",fontSize:r?"12px":"14px",fontWeight:"500",transition:"all 0.2s ease",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:r?"6px 12px":"8px 16px",textDecoration:"none",userSelect:"none"},i={primary:{backgroundColor:"dark"===n?"#3b82f6":"#001978",color:"white",hoverBg:"dark"===n?"#2563eb":"#334793"},secondary:{backgroundColor:"dark"===n?"#374151":"#f3f4f6",color:"dark"===n?"#f9fafb":"#374151",border:"1px solid "+("dark"===n?"#4b5563":"#d1d5db"),hoverBg:"dark"===n?"#4b5563":"#e5e7eb"},outline:{backgroundColor:"transparent",color:"dark"===n?"#3b82f6":"#001978",border:"2px solid "+("dark"===n?"#3b82f6":"#001978"),hoverBg:"dark"===n?"#3b82f6":"#001978",hoverColor:"white"},ghost:{backgroundColor:"transparent",color:"dark"===n?"#f9fafb":"#374151",hoverBg:"dark"===n?"#374151":"#f3f4f6"}},o=i[l]||i.primary;Object.assign(e.style,{...a,...o});const s=o.backgroundColor,c=o.color;e.addEventListener("mouseenter",()=>{e.style.backgroundColor=o.hoverBg||o.backgroundColor,o.hoverColor&&(e.style.color=o.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),l=this._createModalConfig(t);this.eventManager.emit("autoInputs:modalRequest",{input:e,config:l,callback:async t=>await this._handleImageSelection(e,t)})}async _handleImageSelection(e,t){const l=this._getInputConfig(e);let n=t;try{if(!t.original&&!t.images&&(t.id||t.assetId)){console.log("[AutoInputManager] 🔗 Selección directa detectada, obteniendo URL permanente...");const e=t.id||t.assetId;try{const l=await async function(e,t=!0,l=!0,n=0){try{const r=new URLSearchParams({include_variants:t.toString(),include_metadata:l.toString(),url_expires:n.toString()});return le(await J({endpoint:`/assets/${e}?${r}`,method:"GET",basePath:ie,useJWT:!0}))}catch(r){throw ae(r)}}(e,!1,!1,!0);l?.result?.url?(console.log("[AutoInputManager] ✅ URL permanente obtenida:",l.result.url),n={original:{url:l.result.url,width:l.result.width||t.width,height:l.result.height||t.height,assetId:e},images:[]}):(console.warn("[AutoInputManager] ⚠️ No se pudo obtener URL permanente, usando URL temporal"),n={original:{url:t.url||t.path,width:t.width,height:t.height,assetId:e},images:[]})}catch(r){console.error("[AutoInputManager] Error obteniendo URL permanente:",r),n={original:{url:t.url||t.path,width:t.width,height:t.height,assetId:e},images:[]}}}const a=await this._formatImageData(n,l);console.log("[AutoInputManager] Valor formateado:",a),console.log("[AutoInputManager] Tipo de valor:",typeof a),!1!==l.autoAssign&&(e.value=a,console.log("[AutoInputManager] Valor asignado al input:",e.value)),this._updateButtonFeedback(e,n),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:resultReady",{detail:{imageData:n,input:e,value:a,config:l,assignment:{format:l.return,smartAssign:!1!==l.smartAssign,autoAssign:!1!==l.autoAssign},legacy:{imageData:n,formatted:this._createFormattedResult(n,l)}},bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:n,input:e,value:a,config:l,formatted:this._createFormattedResult(n,l)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:n,value:a,config:l})}catch(a){console.error("Error handling image selection:",a),e.dispatchEvent(new CustomEvent("limbo:error",{detail:{error:a.message,input:e,imageData:n,config:l},bubbles:!0})),this._handleImageSelectionLegacy(e,t)}}_updateButtonFeedback(e,t){const l=this._getInputId(e),n=this.instances.get(l);if(!n||!n.button)return;const r=n.button,a=r.nextElementSibling;a&&a.classList.contains("limbo-button-feedback")&&a.remove();const i=document.createElement("span");i.className="limbo-button-feedback",i.style.cssText="\n display: inline-flex;\n align-items: center;\n gap: 6px;\n margin-left: 8px;\n padding: 4px 8px;\n background: #10b981;\n color: white;\n border-radius: 6px;\n font-size: 12px;\n font-weight: 500;\n animation: limbo-fade-in 0.3s ease-out;\n ";const o=t.images&&t.images.length>0,s=o?t.images.length:0;for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(function(){const e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("viewBox","0 0 20 20"),t.setAttribute("fill","currentColor");const l=document.createElementNS(e,"path");return l.setAttribute("fill-rule","evenodd"),l.setAttribute("d","M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"),l.setAttribute("clip-rule","evenodd"),t.appendChild(l),t}());const c=document.createElement("span");c.textContent=o?`${s} recorte${1!==s?"s":""} configurado${1!==s?"s":""}`:"Archivo seleccionado",i.appendChild(c),r.parentNode.insertBefore(i,r.nextSibling);let u=r.parentNode.querySelector(".limbo-powered-by");if(!u){u=document.createElement("div"),u.className="limbo-powered-by";const e=document.createElement("span");e.style.cssText="display:block;margin-top:2px;font-size:10px;color:#aaa;text-align:left;font-family:inherit;opacity:0.7;",e.textContent="Powered by ";const t=document.createElement("b");t.textContent="Limbo",e.appendChild(t),u.appendChild(e),r.parentNode.insertBefore(u,i.nextSibling)}r.style.backgroundColor="#10b981";const d=n.config?.accept||null;r.textContent=v(d,!0)}async _handleImageSelectionLegacy(e,t){const l=this._getInputConfig(e),n=await this._formatImageData(t,l);!1!==l.autoAssign&&(e.value=n),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:t,input:e,value:n,config:l,formatted:this._createFormattedResult(t,l)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:t,value:n,config:l})}_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 l=(t||{}).return||this.config.return||"json",n=void 0!==e.original;switch(l){case"url":return n?e.images?.[0]?.url||e.original?.url||"":e.url||e.path||"";case"base64":return e.base64||e.dataUrl||"";case"assetId":return n?e.original?.assetId||"":e.assetId||e.id||"";case"fileName":return e.fileName||e.filename||"";default:try{if(n){const t={original:e.original?{url:e.original.url||e.original.urlSigned,width:e.original.width,height:e.original.height,assetId:e.original.assetId||e.original.id}:null,images:Array.isArray(e.images)?e.images.map(e=>{const t={url:e.url||e.urlSigned,width:e.width,height:e.height,name:e.name||e.filename||e.label};return e.cropState&&(t.cropState={selectorState:e.cropState.selectorState||null,imageTransform:e.cropState.imageTransform||null,flipState:e.cropState.flipState||null}),t}):[]};console.log("[AutoInputManager] Datos limpios para JSON:",t);const l=JSON.stringify(t);return console.log("[AutoInputManager] JSON generado:",l),l}const t={original:{url:e.url||e.path,width:e.width,height:e.height,assetId:e.assetId||e.id}};return console.log("[AutoInputManager] Datos legacy para JSON:",t),JSON.stringify(t)}catch(r){return console.error("[AutoInputManager] Error al serializar JSON:",r),console.error("[AutoInputManager] imageData problemático:",e),"{}"}}}_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 archivo",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:{accept:e.accept||null,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,existingCrops:e.existingCrops||null,existingData:e.existingData||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,l={quality:e.quality||this.config.quality,format:e.format||this.config.format,mandatoryCrops:e.mandatoryCrops||[],allowAdditionalCrops:!1!==e.allowAdditionalCrops,maxCrops:e.maxCrops||null,localCropsOnly:e.localCropsOnly??this.config.localCropsOnly??!1,existingCrops:e.existingCrops||null};if(e.mandatoryCrops&&e.mandatoryCrops.length>0)return{...l,aspectRatio:null};if(!t||"none"===t||"false"===t)return null;if("free"===t)return{...l,aspectRatio:null};const n={"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(n[t])return{...l,aspectRatio:n[t],minCropBoxWidth:e.minWidth||this.config.minWidth,minCropBoxHeight:e.minHeight||this.config.minHeight};if("string"==typeof t&&t.includes(":")){const[e,n]=t.split(":").map(Number);if(!isNaN(e)&&!isNaN(n)&&0!==n)return{...l,aspectRatio:e/n}}const r=parseFloat(t);return!isNaN(r)&&r>0?{...l,aspectRatio:r}:"object"==typeof t?{...l,...t}:null}_shouldShowTabs(e){const t=e.modeUI||this.config.modeUI||"full",l=e.features||this.config.features;return!["gallery-only","upload-only","crop-only","ia-only"].includes(t)&&(l&&l.length>1)}_getUIActions(e){const t=e.modeUI||this.config.modeUI||"full",l=e.features||this.config.features;let n=[];switch(t){case"gallery-only":case"upload-only":n=["select"];break;case"crop-only":n=["select","crop"];break;default:n=["select"],l.includes("cropper")&&n.push("crop"),l.includes("gallery")&&(n.push("download","copy","rename"),this.config.allowDelete&&n.push("delete"))}return n}_getInputId(e){if(e.id)return e.id;if(e.name)return e.name;let t=e.getAttribute("data-limbo-uid");return t||(t=`limbo-auto-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,e.setAttribute("data-limbo-uid",t)),t}_validateInput(e){return e instanceof HTMLInputElement}_getInputConfig(e){const t=e=>e?e.split(",").map(e=>e.trim()):null,l=e=>{if(!e)return null;const t=e.match(/^(\d+(?:\.\d+)?)(MB|KB|B)?$/i);if(!t)return null;const l=parseFloat(t[1]);switch((t[2]||"B").toUpperCase()){case"MB":return 1024*l*1024;case"KB":return 1024*l;default:return l}},n=(e,t=!1)=>null===e?t:"true"===e||"1"===e||""===e,r=e=>e?parseFloat(e):null,a=e=>{if(!e)return null;try{return JSON.parse(e)}catch(t){return console.warn("[Limbo AutoInputManager] Error parsing JSON attribute:",t),null}},i=a(e.dataset.mandatorycrops)||a(e.dataset.mandatoryCrops)||a(e.getAttribute("data-mandatory-crops"))||a(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:r(e.dataset.quality)||r(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:n(e.dataset.compact,null)??n(e.getAttribute("data-limbo-compact"),this.config.compact),maxSize:l(e.getAttribute("data-limbo-max-size"))||l(this.config.maxSize),formats:t(e.getAttribute("data-limbo-formats"))||this.config.formats,minWidth:r(e.getAttribute("data-limbo-min-width"))||this.config.minWidth,minHeight:r(e.getAttribute("data-limbo-min-height"))||this.config.minHeight,maxWidth:r(e.getAttribute("data-limbo-max-width"))||this.config.maxWidth,maxHeight:r(e.getAttribute("data-limbo-max-height"))||this.config.maxHeight,buttonText:e.dataset.buttontext||e.getAttribute("data-limbo-button-text")||this.config.buttonText,buttonStyle:e.dataset.buttonstyle||e.getAttribute("data-limbo-button-style")||this.config.buttonStyle,buttonClass:e.dataset.buttonclass||e.getAttribute("data-limbo-button-class")||this.config.buttonClass,showPreview:n(e.getAttribute("data-limbo-show-preview"),this.config.showPreview),allowMultiple:n(e.getAttribute("data-limbo-allow-multiple"),this.config.allowMultiple),autoAssign:n(e.getAttribute("data-limbo-auto-assign"),this.config.autoAssign),placeholder:e.getAttribute("data-limbo-placeholder"),description:e.getAttribute("data-limbo-description"),required:n(e.getAttribute("data-limbo-required"),!1),disabled:n(e.getAttribute("data-limbo-disabled"),!1),inputId:this._getInputId(e),inputName:e.name,inputType:e.type,mandatoryCrops:i,allowAdditionalCrops:n(e.dataset.allowadditionalcrops,null)??n(e.getAttribute("data-limbo-allow-additional-crops"),!0),maxCrops:r(e.dataset.maxcrops)||r(e.getAttribute("data-limbo-max-crops"))||null,accept:e.dataset.accept||e.getAttribute("data-limbo-accept")||null,allowSelectNew:n(e.dataset.allowselectnew,null)??n(e.getAttribute("data-limbo-allow-select-new"),!0),...this._parseExistingInputValue(e.value)}}_parseExistingInputValue(e){if(!e||""===e.trim())return{initialImageUrl:null,existingCrops:null,existingData:null};try{const t=JSON.parse(e);return t.original&&t.original.url?(console.log("[AutoInputManager] Valor existente parseado:",t),{initialImageUrl:t.original.url,existingCrops:t.images||null,existingData:t}):t.url?{initialImageUrl:t.url,existingCrops:null,existingData:t}:{initialImageUrl:null,existingCrops:null,existingData:t}}catch(t){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?{initialImageUrl:e,existingCrops:null,existingData:null}:{initialImageUrl:null,existingCrops:null,existingData: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 l=e.querySelectorAll&&e.querySelectorAll(t);l&&l.forEach(e=>this._processInput(e))}}class Vn{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 l=this.listeners.get(e);if(l){const e=l.indexOf(t);e>-1&&l.splice(e,1)}}cleanup(){this.listeners.clear()}_emitDOMEvent(e,t){const l=new CustomEvent(`limbo:${e}`,{detail:{...t,timestamp:Date.now()},bubbles:!0,cancelable:!0});(t.instance?.getContainer()||document).dispatchEvent(l)}_executeListeners(e,t){const l=this.listeners.get(e);l&&l.forEach(l=>{try{l(t)}catch(n){console.error(`Error executing listener for ${e}:`,n)}})}getStats(){const e={};return this.listeners.forEach((t,l)=>{e[l]=t.length}),e}}class Hn{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 Kn(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),window.limboCore?.events&&window.limboCore.events.emit("modal:closed",{modalId:e.getId(),remainingModals:this.activeModals.size})}_handleGlobalKeydown(e){const t=this.getActiveModal();t&&(t.config&&t.config.usesReactFocusTrap||("Escape"===e.key&&(e.preventDefault(),t.close()),"Tab"===e.key&&this._handleTabTrap(e,t)))}_handleTabTrap(e,t){const l=t.getFocusableElements();if(0===l.length)return;const n=l[0],r=l[l.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),n.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 Kn{constructor(e,t,l){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,usesReactFocusTrap:t.usesReactFocusTrap||!1},this.manager=l,this.element=null,this.backdrop=null,this.isOpen=!1,this.previousFocus=null,this._previousInertSiblings=[],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-scope limbo-modal limbo-modal--${this.config.size}`,this.element.id=this.id,this.element.setAttribute("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;"},l="fullscreen"===this.config.size,n=e||l?`\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=n,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 l=document.createElement("h2");if(l.id=`${this.id}-title`,l.className="limbo-modal-title",l.textContent=this.config.title,l.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(l),this.config.showCloseButton){const l=document.createElement("button");l.type="button",l.className="limbo-modal-close",l.textContent="✕",l.setAttribute("aria-label","Cerrar modal"),l.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 `,l.addEventListener("mouseenter",()=>{l.style.backgroundColor="#f8f9fa",l.style.color="#001978"}),l.addEventListener("mouseleave",()=>{l.style.backgroundColor="transparent",l.style.color="#6c757d"}),l.addEventListener("click",()=>this.close()),e.appendChild(l)}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 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",this._applyInertToSiblings();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}}_applyInertToSiblings(){const e=Array.from(document.body.children).filter(e=>e!==this.element&&e!==this.backdrop);this._previousInertSiblings=e.map(e=>({node:e,hadInert:e.hasAttribute("inert")})),e.forEach(e=>e.setAttribute("inert",""))}_restoreInertSiblings(){this._previousInertSiblings.forEach(({node:e,hadInert:t})=>{!t&&e.isConnected&&e.removeAttribute("inert")}),this._previousInertSiblings=[]}_cleanup(){document.body.style.overflow=this._originalBodyOverflow||"",this._restoreInertSiblings(),this.previousFocus&&"function"==typeof this.previousFocus.focus&&!1!==this.previousFocus.isConnected&&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 Gn{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 l=this._getTheme(e);if(!l)return console.warn(`Theme '${e}' not found`),!1;const n=this.currentTheme;return this._applyThemeVariables(l,t.scope),this._updateThemeAttributes(l.name),this.config.theme.storage&&!t.temporary&&this._saveThemePreference(l.name),this.currentTheme=l.name,this._triggerChangeCallbacks(l.name,n),!0}toggleTheme(e="light",t="dark"){const l=this.currentTheme===e?t:e;return this.applyTheme(l)}applyAutoTheme(){const e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return this.applyTheme(e)}registerTheme(e,t){const l={name:e,displayName:t.displayName||e,variables:t.variables||{},extends:t.extends||null,...t};if(l.extends){const e=this._getTheme(l.extends);e&&(l.variables={...e.variables,...l.variables})}return this.customThemes.set(e,l),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),l="ontouchstart"in window||navigator.maxTouchPoints>0;return!(!this.config.compact.forceOnMobile||!t&&!l)||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(l){console.error("Error in compact mode change callback:",l)}})}_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 l=document.querySelector(t);if(l){const t=this._extractCSSVariables(l);Object.keys(t).length>0&&(e.variables={...e.variables,...t});const n=l.getAttribute("data-theme")||l.getAttribute("class")?.match(/theme-(\w+)/)||l.getAttribute("class")?.match(/(\w+)-theme/);n&&(e.detectedName=Array.isArray(n)?n[1]:n)}}return Object.keys(e.variables).length>0?e:null}_extractCSSVariables(e){const t={},l=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 n=`--limbo-${e}`,r=l.getPropertyValue(n).trim();r&&(t[n]=r)});return["--primary-color","--background-color","--text-color","--border-color","--accent-color","--surface-color"].forEach(e=>{const n=l.getPropertyValue(e).trim();if(n){const l=this._mapGenericToLimbo(e,n);l&&Object.assign(t,l)}}),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 l=this._inheritPortalTheme();l&&(e=l),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 l="string"==typeof t?document.querySelector(t):t;l?(Object.entries(e.variables).forEach(([e,t])=>{l.style.setProperty(e,t),this.appliedStyles.add(`${l.tagName}:${e}`)}),this.themeCache.set(e.name,{theme:e,appliedAt:Date.now(),scope:l})):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 l=t.variables["--limbo-primary"]||"#3b82f6";let n=document.querySelector('meta[name="theme-color"]');n||(n=document.createElement("meta"),n.name="theme-color",document.head.appendChild(n)),n.content=l}_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),l={};return Object.keys(e.variables).forEach(e=>{l[e]=t.getPropertyValue(e).trim()}),l}_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(l=>{try{l({theme:e,previousTheme:t,themeData:this._getTheme(e),variables:this._getCurrentVariables()})}catch(n){console.error("Error in theme change callback:",n)}})}generateThemeFromColors(e,t){const l={name:e,displayName:e,variables:{}};t.primary&&(l.variables["--limbo-primary"]=t.primary,l.variables["--limbo-primary-hover"]=this._darkenColor(t.primary,10),l.variables["--limbo-primary-light"]=this._lightenColor(t.primary,40),l.variables["--limbo-primary-dark"]=this._darkenColor(t.primary,20)),t.background&&(l.variables["--limbo-bg-primary"]=t.background,l.variables["--limbo-bg-secondary"]=this._lightenColor(t.background,5),l.variables["--limbo-bg-tertiary"]=this._lightenColor(t.background,10),l.variables["--limbo-bg-card"]=t.background),t.text&&(l.variables["--limbo-text-primary"]=t.text,l.variables["--limbo-text-secondary"]=this._lightenColor(t.text,20),l.variables["--limbo-text-tertiary"]=this._lightenColor(t.text,40));const n=this._getTheme(this.config.inheritance.fallbackTheme);return n&&(l.variables={...n.variables,...l.variables}),this.registerTheme(e,l),l}_darkenColor(e,t){const l=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),r=(l>>16)-n,a=(l>>8&255)-n,i=(255&l)-n;return"#"+(16777216+65536*(r<255?r<1?0:r:255)+256*(a<255?a<1?0:a:255)+(i<255?i<1?0:i:255)).toString(16).slice(1)}_lightenColor(e,t){const l=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),r=(l>>16)+n,a=(l>>8&255)+n,i=(255&l)+n;return"#"+(16777216+65536*(r<255?r<1?0:r:255)+256*(a<255?a<1?0:a:255)+(i<255?i<1?0:i:255)).toString(16).slice(1)}_deepMerge(e,t){const l={...e};return Object.keys(t).forEach(n=>{t[n]&&"object"==typeof t[n]&&!Array.isArray(t[n])?l[n]=this._deepMerge(e[n]||{},t[n]):l[n]=t[n]}),l}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 Qn={border:"none",borderRadius:"6px",cursor:"pointer",fontFamily:"inherit",fontWeight:"500",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"6px",transition:"background 0.2s ease, transform 0.1s ease",userSelect:"none",textDecoration:"none",lineHeight:"1.25"},Xn={bg:"#001978",hover:"#334793"},Yn={bg:"#10b981",hover:"#059669"},Jn={bg:"#9ca3af",hover:"#9ca3af"};class Zn extends HTMLElement{constructor(){super(),this._btn=null,this._limboInstance=null}connectedCallback(){this._ensureButton(),this._syncButton()}disconnectedCallback(){this._destroyLimboInstance()}static get observedAttributes(){return["accept","has-file","disabled","compact","label-select","label-change","return-format","button-class","existing-url","mandatory-crops","public-key","token","auth-mode"]}attributeChangedCallback(){this._btn&&this._syncButton()}markSelected(e){this.setAttribute("has-file",""),e&&this.setAttribute("existing-url",e),this._syncButton()}clearSelection(){this.removeAttribute("has-file"),this.removeAttribute("existing-url"),this._syncButton()}open(){this._open()}_ensureButton(){this._btn||(this._btn=document.createElement("button"),this._btn.type="button",this._btn.classList.add("limbo-selector-btn","limbo-trigger-button","mecano:my-2"),this._btn.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this._open()}),this.appendChild(this._btn))}_syncButton(){if(!this._btn)return;const e=this.getAttribute("accept")||null,t=this.hasAttribute("has-file"),l=this.hasAttribute("disabled"),n=this.hasAttribute("compact"),r=this.getAttribute("label-select")||null,a=this.getAttribute("label-change")||null,i=this.getAttribute("button-class")||null;this._btn.textContent=t?a||v(e,!0):r||v(e,!1),this._btn.disabled=l,i&&i.split(/\s+/).filter(Boolean).forEach(e=>this._btn.classList.add(e));const o=l?Jn:t?Yn:Xn;Object.assign(this._btn.style,{...Qn,fontSize:n?"12px":"14px",padding:n?"6px 12px":"8px 16px",background:o.bg,color:"white",opacity:l?"0.55":"1",cursor:l?"not-allowed":"pointer"}),this._btn.onmouseenter=()=>{l||(this._btn.style.background=o.hover,this._btn.style.transform="translateY(-1px)",this._btn.style.boxShadow="0 4px 10px rgba(0,0,0,0.18)")},this._btn.onmouseleave=()=>{this._btn.style.background=o.bg,this._btn.style.transform="translateY(0)",this._btn.style.boxShadow="none"}}_open(){const e=window.Limbo||window.limboCore;if(!e)return void console.warn("[LimboSelector] window.Limbo no encontrado. Asegúrate de que el script de Limbo está cargado antes de usar <limbo-selector>.");const t=this.getAttribute("accept")||null,l=this.getAttribute("return-format")||"url",n=this.getAttribute("existing-url")||null,r=this.getAttribute("public-key")||null,a=this.getAttribute("token")||null,i=this.getAttribute("auth-mode")||null;(r||a)&&e.configure({...r&&{publicKey:r},...a&&{token:a},authMode:i||(a?"manual":"session")}),e.config?.setGlobal&&e.config.setGlobal({interaction:{allowSelection:!0,allowCropping:!0,selectionMode:"direct"}});let o=null;const s=this.getAttribute("mandatory-crops");if(s)try{o=JSON.parse(s)}catch{}this._destroyLimboInstance();try{const r={mode:"modal",modeUI:"full",modalSize:"fullscreen",features:["gallery","upload","cropper"],title:"Seleccionar archivo",validation:{accept:t},returnConfig:{format:l},initialImageUrl:n,interaction:{allowSelection:!0,allowCropping:!0},cropper:o?.length>0?{mandatoryCrops:o,allowAdditionalCrops:!0,maxCrops:10}:null},a=async e=>{const t="string"==typeof e?e:e?.images?.[0]?.url||e?.original?.url||e?.url||"";this.setAttribute("has-file",""),t&&this.setAttribute("existing-url",t),this._syncButton(),this.dispatchEvent(new CustomEvent("limbo:change",{detail:{data:e,url:t},bubbles:!0,composed:!0}))};e.events.emit("autoInputs:modalRequest",{config:r,input:null,callback:a})}catch(c){console.error("[LimboSelector] Error al abrir modal de Limbo:",c)}}_handleResult(e,t){if(this._limboInstance!==t)return;const l="string"==typeof e?e:e?.url||e?.master?.urlSigned||e?.master?.url||e?.asset?.url||e?.original?.url||e?.crops?.[0]?.url||e?.images?.[0]?.url||"";this.setAttribute("has-file",""),l&&this.setAttribute("existing-url",l),this._syncButton(),this.dispatchEvent(new CustomEvent("limbo:change",{detail:{data:e,url:l},bubbles:!0,composed:!0}));try{t?.close?.()}catch{}this._limboInstance=null}_destroyLimboInstance(){if(this._limboInstance){try{this._limboInstance.destroy?.()}catch{}this._limboInstance=null}}}function er(e="limbo-selector"){"undefined"==typeof customElements||customElements.get(e)||customElements.define(e,Zn)}const tr=new class{constructor(){this.config=new C,this.instances=new qn,this.autoInputs=new Wn,this.events=new Vn,this.modals=new Hn,this.theme=new Gn,this.containerQueryDetector=P,this._setupInternalListeners(),this._initializeContainerQueries()}configure(e){this.config.setGlobal(e);const t={};var l;return"publicKey"in e&&(t.publicKey=e.publicKey),"apiKey"in e&&(t.apiKey=e.apiKey),"token"in e&&(t.token=e.token),"authMode"in e&&(t.authMode=e.authMode),"tokenProvider"in e&&(t.tokenProvider=e.tokenProvider),"prod"in e&&(t.prod=Boolean(e.prod)),"mode"in e&&(t.mode=e.mode),"callbacks"in e&&(t.callbacks=e.callbacks),"token"in(l=t)&&l.token!==B.token&&(q=!1,W=null),B={...B,...l},B.authMode||(B.token?B.authMode="manual":B.authMode="session"),this.config}setToken(e){return X(e),this.config.setGlobal({token: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",l=e||`[${t}]`,n=document.querySelectorAll(l);if(0===n.length)return{found:0,processed:0,skipped:0};let r=0,a=0;return n.forEach(e=>{try{this.autoInputs._processInput(e),r++}catch(t){console.warn(`⚠️ Limbo: Error procesando input ${e.id||e.name}:`,t),a++}}),this.events.emit("limbo:scanCompleted",{found:n.length,processed:r,skipped:a,inputs:Array.from(n)}),{found:n.length,processed:r,skipped:a}}_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",l=e.querySelectorAll(`[${t}]`);let n=0;return l.forEach(e=>{if(!this.autoInputs.instances.has(this.autoInputs._getInputId(e)))try{this.autoInputs._processInput(e),n++}catch(t){console.warn("⚠️ Limbo: Error procesando nuevo input:",t)}}),n}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,input:l})=>{this._handleAutoInputModalRequest({config:e,callback:t,input:l})})}_handleAutoInputModalRequest({config:e,callback:t,input:l}){const n=l,r=async l=>{let r={};if(l.crops&&l.crops.length>0){const e=l.asset||l.original;r.original={url:e?.url||e?.urlSigned||l.originalUrl,width:e?.width||l.originalWidth,height:e?.height||l.originalHeight,assetId:e?.id||l.assetId},r.images=l.crops.map(e=>({url:e.url||e.urlSigned,width:e.width,height:e.height,name:e.name||e.filename}))}else l.asset?r.original={url:l.asset.url||l.asset.urlSigned,width:l.asset.width,height:l.asset.height,assetId:l.asset.id}:l.master?.urlSigned||l.master?.url?r.original={url:l.master.urlSigned||l.master.url,width:l.master.width||l.width,height:l.master.height||l.height,assetId:l.assetId}:l.url||l.urlSigned?r.original={url:l.url||l.urlSigned,width:l.width,height:l.height,assetId:l.assetId||l.id}:(console.warn("[Limbo] handleResult: formato de datos no reconocido",l),r=l);if(n){var a=e?.returnConfig?.format||"json",i="";i="url"===a?r.images?.[0]?.url||r.original?.url||"":"assetId"===a?r.original?.assetId||"":JSON.stringify(r),n.value=i,n.dispatchEvent(new Event("change",{bubbles:!0})),console.log("[Limbo] ✅ Valor asignado al input:",n.value?.substring(0,80))}try{await t(r)}catch(o){}c.close()},a={...e,mode:"modal",autoDestroy:!0,interaction:{allowSelection:!0,allowCropping:!0,...e.interaction},callbacks:{onSelect:e=>{r(e)},onCropsSaved:e=>{r(e)},onCropperComplete:e=>{r(e)},onUpload:t=>{"upload-only"!==e.modeUI||e.features?.includes("cropper")||r(t)},onClose:()=>{}}},i=e.validation?.accept||null,o=i?f(i):null,s=!o||o.isAllTypes||o.includesImages;if(e.initialImageUrl&&s){const t=this._extractAssetIdFromUrl(e.initialImageUrl)||e.existingData?.original?.assetId||null;t&&(a._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&&(a.cropper=e.cropper),this.config.setGlobal({interaction:{allowSelection:!0,allowCropping:!0,...e.interaction}});const c=this.create(a);c.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,l=e.match(t);return l&&l.length>=2?l[1]:l&&1===l.length?l[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"},validation:{accept:e.accept||null},callbacks:{onSelect:l=>{e.onSelect?.(l),!1!==e.autoClose&&t.close()}},...e});return t.open(),t}openUploader(e={}){const t=!1!==e.redirectToGallery?["upload","gallery"]:["upload"],l=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"},validation:{accept:e.accept||null},callbacks:{onUpload:t=>{e.onUpload?.(t),!1===e.autoClose||e.redirectToGallery||l.close()}},...e});return l.open(),l}openCropper(e,t={}){if(!e)throw new Error("Limbo.openCropper: imageUrl es requerido");const l={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()}`},n=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&&n.close()},onCropperCancelled:e=>{t.onCancelled?.(e),!1!==t.autoClose&&n.close()},onCropperError:e=>{t.onError?.(e)}},_externalImage:l,...t});return n.open(),n}createInlineGallery(e,t={}){return this.create({container:e,mode:"embed",modeUI:"gallery-only",features:["gallery"],validation:{accept:t.accept||null},callbacks:{onSelect:t.onSelect,onDelete:t.onDelete},...t})}createInlineUploader(e,t={}){return this.create({container:e,mode:"embed",modeUI:"upload-only",features:["upload"],validation:{accept:t.accept||null},callbacks:{onUpload:t.onUpload},...t})}createStandaloneCropper(e,t,l={}){if(!e)throw new Error("Limbo.createStandaloneCropper: container es requerido");if(!t)throw new Error("Limbo.createStandaloneCropper: imageUrl es requerido");const n={url:t,filename:l.filename||"image.jpg",width:l.width||1920,height:l.height||1080,mime_type:l.mimeType||"image/jpeg",id:l.assetId||`external-${Date.now()}`};return this.create({container:e,mode:"embed",modeUI:"crop-only",features:["cropper"],autoHideOnComplete:!1!==l.autoHideOnComplete,cropper:{mandatoryCrops:l.mandatoryCrops||[],allowCustomCrops:!1!==l.allowCustomCrops,enforceRequiredCrops:!1!==l.enforceRequiredCrops},callbacks:{onCropperComplete:l.onComplete,onCropperCancelled:l.onCancelled,onCropperError:l.onError},_externalImage:n,...l})}createFullSelector(e,t={}){return this.create({container:e,mode:t.mode||"embed",modeUI:"full",features:["gallery","upload","cropper"],validation:{accept:t.accept||null},callbacks:{onSelect:t.onSelect,onUpload:t.onUpload,onDelete:t.onDelete,onCropsSaved:t.onCropsSaved},...t})}};"undefined"!=typeof window&&(window.Limbo=tr,window.limboCore=tr,er());"undefined"!=typeof window&&document.querySelector("#root")&&(tr.configure({prod:!1,publicKey:"pk_e464fd744106b7a8d63d453c4bd02582",authMode:"session"}),tr.create({container:"#root",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],title:"Limbo Image Manager - Development",url:!0}),tr.configureAutoInputs({dataset:"data-limbo-input-file",return:"json",features:["gallery","upload","cropper"],modeUI:"full",modalSize:"large",title:"Seleccionar archivo",crops:"free",allowDelete:!1}));export{St as LIMBO_BASE_URL,Zn as LimboSelector,Et as decodeHtmlEntities,tr as default,_t as extractImageUrl,v as getButtonLabel,$t as isValidImageUrl,Tt as parseImageData,It as prepareImageFieldsForPreview,er as registerLimboSelector,Nt as resolveUrl};
|
|
715
|
+
/* @__PURE__ */s(O,{isOpen:te,onClose:ne,onReload:le}),
|
|
716
|
+
/* @__PURE__ */s(pe,{isOpen:!!M,asset:M,onClose:()=>P(null),onSave:Be})]})}class jl{constructor(e,t,n,l){this.id=e,this.config=t,this.eventManager=n,this.modalManager=l,this.root=null,this.container=null,this.modal=null,this.mounted=!1,this.destroyed=!1,this.button=null,this._handleAppClose=()=>{this.modal&&"function"==typeof this.modal.close&&this.modal.close()},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=P.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||this.config.modal?.size||"large",usesReactFocusTrap:!0,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=P.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-scope limbo-instance limbo-component-container-wrapper lb:h-full lb:w-full lb:py-2 lb:pb-0 lb:bg-white","data-limbo-id":this.id,"data-limbo-mode":this.config.mode,"data-limbo-version":"4.2.3","data-limbo-isolated":"true","aria-label":"Limbo Image Manager",role:"region"},e.createElement(Fl,{onClose:"modal"===this.config.mode?this._handleAppClose:void 0,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,allowedCategories:this.config.validation?.allowedCategories||null,accept:this.config.validation?.accept||null,returnConfig:this.config.returnConfig||null,aiStarterPrompt:this.config.aiStarterPrompt,folderConfig:this.config.folders||{include:[],exclude:[],includeNoFolder:!0},itemsPerPage:this.config.itemsPerPage||30}))}_createCallbacks(){return{onSelect:e=>{const t=this.config?.callbacks?.onSelect,n=this._createStandardPayload(e,"select");t&&Promise.resolve(t(n)).catch(e=>{console.error("[LimboInstance] Error en onSelect callback:",e)}),this.destroyed||this._emitDOMEvent("select",n)},onUpload:e=>{const t=this.config?.callbacks?.onUpload,n=this._createStandardPayload(e,"upload");t&&Promise.resolve(t(n)).catch(e=>{console.error("[LimboInstance] Error en onUpload callback:",e)}),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)},onCropsSaved:e=>{console.log("[LimboInstance] onCropsSaved recibido:",e),console.log("[LimboInstance] this.config?.callbacks:",this.config?.callbacks);const t=this.config?.callbacks?.onCropsSaved;console.log("[LimboInstance] userCallback existe:",!!t);const n={instance:this,eventType:"cropsSaved",timestamp:Date.now(),instanceId:this.id,...e};if(console.log("[LimboInstance] payload.crops:",n.crops),t){console.log("[LimboInstance] Llamando userCallback onCropsSaved");try{t(n),console.log("[LimboInstance] userCallback ejecutado correctamente")}catch(l){console.error("[LimboInstance] Error en userCallback:",l)}}else console.warn("[LimboInstance] ⚠️ userCallback onCropsSaved NO existe");this.destroyed||this._emitDOMEvent("cropsSaved",n)},onCropperComplete:e=>{console.log("[LimboInstance] onCropperComplete recibido:",e);const t=this.config?.callbacks?.onCropperComplete,n={instance:this,eventType:"cropperComplete",timestamp:Date.now(),instanceId:this.id,...e};t&&(console.log("[LimboInstance] Llamando userCallback onCropperComplete"),t(n)),this.destroyed||this._emitDOMEvent("cropperComplete",n)}}}_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(){const e=Y();if(!(this.config.auth?.apiKey||this.config.auth?.publicKey||this.config.auth?.token||this.config.apiKey||this.config.publicKey||this.config.token||this.config.tokenProvider||this.config.auth?.tokenProvider||e.token||e.publicKey||e.tokenProvider))throw new Error(`LimboInstance ${this.id}: Authentication is required. Provide either auth.publicKey (recommended), auth.apiKey (for server-side only), token, or tokenProvider`);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 Ul{constructor(){this.instances=/* @__PURE__ */new Map,this.counter=0}create(e,t,n){const l="limbo-"+ ++this.counter,r=new jl(l,e,t,n);return this.instances.set(l,r),r}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 Bl{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","svg","webp"],minWidth:e.minWidth||null,minHeight:e.minHeight||null,maxWidth:e.maxWidth||null,maxHeight:e.maxHeight||null,buttonText:e.buttonText||"Seleccionar archivo",buttonClass:e.buttonClass||"limbo-auto-button",buttonStyle:e.buttonStyle||"primary",showPreview:!1!==e.showPreview,allowMultiple:e.allowMultiple||!1,autoAssign:!1!==e.autoAssign,localCropsOnly:e.localCropsOnly||!1,...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";const l=e.dataset.buttontext||e.getAttribute("data-limbo-button-text")||null;t.textContent=l||v(n.accept||null,!1);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,l=t.theme||this.config.theme,r=t.compact||this.config.compact,a={border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"inherit",fontSize:r?"12px":"14px",fontWeight:"500",transition:"all 0.2s ease",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"8px",padding:r?"6px 12px":"8px 16px",textDecoration:"none",userSelect:"none"},i={primary:{backgroundColor:"dark"===l?"#3b82f6":"#001978",color:"white",hoverBg:"dark"===l?"#2563eb":"#334793"},secondary:{backgroundColor:"dark"===l?"#374151":"#f3f4f6",color:"dark"===l?"#f9fafb":"#374151",border:"1px solid "+("dark"===l?"#4b5563":"#d1d5db"),hoverBg:"dark"===l?"#4b5563":"#e5e7eb"},outline:{backgroundColor:"transparent",color:"dark"===l?"#3b82f6":"#001978",border:"2px solid "+("dark"===l?"#3b82f6":"#001978"),hoverBg:"dark"===l?"#3b82f6":"#001978",hoverColor:"white"},ghost:{backgroundColor:"transparent",color:"dark"===l?"#f9fafb":"#374151",hoverBg:"dark"===l?"#374151":"#f3f4f6"}},o=i[n]||i.primary;Object.assign(e.style,{...a,...o});const s=o.backgroundColor,c=o.color;e.addEventListener("mouseenter",()=>{e.style.backgroundColor=o.hoverBg||o.backgroundColor,o.hoverColor&&(e.style.color=o.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);let l=t;try{if(!t.original&&!t.images&&(t.id||t.assetId)){console.log("[AutoInputManager] 🔗 Selección directa detectada, obteniendo URL permanente...");const e=t.id||t.assetId;try{const n=await async function(e,t=!0,n=!0,l=0){try{const r=new URLSearchParams({include_variants:t.toString(),include_metadata:n.toString(),url_expires:l.toString()});return ne(await J({endpoint:`/assets/${e}?${r}`,method:"GET",basePath:ie,useJWT:!0}))}catch(r){throw ae(r)}}(e,!1,!1,!0);n?.result?.url?(console.log("[AutoInputManager] ✅ URL permanente obtenida:",n.result.url),l={original:{url:n.result.url,width:n.result.width||t.width,height:n.result.height||t.height,assetId:e},images:[]}):(console.warn("[AutoInputManager] ⚠️ No se pudo obtener URL permanente, usando URL temporal"),l={original:{url:t.url||t.path,width:t.width,height:t.height,assetId:e},images:[]})}catch(r){console.error("[AutoInputManager] Error obteniendo URL permanente:",r),l={original:{url:t.url||t.path,width:t.width,height:t.height,assetId:e},images:[]}}}const a=await this._formatImageData(l,n);console.log("[AutoInputManager] Valor formateado:",a),console.log("[AutoInputManager] Tipo de valor:",typeof a),!1!==n.autoAssign&&(e.value=a,console.log("[AutoInputManager] Valor asignado al input:",e.value)),this._updateButtonFeedback(e,l),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:resultReady",{detail:{imageData:l,input:e,value:a,config:n,assignment:{format:n.return,smartAssign:!1!==n.smartAssign,autoAssign:!1!==n.autoAssign},legacy:{imageData:l,formatted:this._createFormattedResult(l,n)}},bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:l,input:e,value:a,config:n,formatted:this._createFormattedResult(l,n)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:l,value:a,config:n})}catch(a){console.error("Error handling image selection:",a),e.dispatchEvent(new CustomEvent("limbo:error",{detail:{error:a.message,input:e,imageData:l,config:n},bubbles:!0})),this._handleImageSelectionLegacy(e,t)}}_updateButtonFeedback(e,t){const n=this._getInputId(e),l=this.instances.get(n);if(!l||!l.button)return;const r=l.button,a=r.nextElementSibling;a&&a.classList.contains("limbo-button-feedback")&&a.remove();const i=document.createElement("span");i.className="limbo-button-feedback",i.style.cssText="\n display: inline-flex;\n align-items: center;\n gap: 6px;\n margin-left: 8px;\n padding: 4px 8px;\n background: #10b981;\n color: white;\n border-radius: 6px;\n font-size: 12px;\n font-weight: 500;\n animation: limbo-fade-in 0.3s ease-out;\n ";const o=t.images&&t.images.length>0,s=o?t.images.length:0;for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(function(){const e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("viewBox","0 0 20 20"),t.setAttribute("fill","currentColor");const n=document.createElementNS(e,"path");return n.setAttribute("fill-rule","evenodd"),n.setAttribute("d","M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"),n.setAttribute("clip-rule","evenodd"),t.appendChild(n),t}());const c=document.createElement("span");c.textContent=o?`${s} recorte${1!==s?"s":""} configurado${1!==s?"s":""}`:"Archivo seleccionado",i.appendChild(c),r.parentNode.insertBefore(i,r.nextSibling);let u=r.parentNode.querySelector(".limbo-powered-by");if(!u){u=document.createElement("div"),u.className="limbo-powered-by";const e=document.createElement("span");e.style.cssText="display:block;margin-top:2px;font-size:10px;color:#aaa;text-align:left;font-family:inherit;opacity:0.7;",e.textContent="Powered by ";const t=document.createElement("b");t.textContent="Limbo",e.appendChild(t),u.appendChild(e),r.parentNode.insertBefore(u,i.nextSibling)}r.style.backgroundColor="#10b981";const d=l.config?.accept||null;r.textContent=v(d,!0)}async _handleImageSelectionLegacy(e,t){const n=this._getInputConfig(e),l=await this._formatImageData(t,n);!1!==n.autoAssign&&(e.value=l),e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new CustomEvent("limbo:imageSelected",{detail:{imageData:t,input:e,value:l,config:n,formatted:this._createFormattedResult(t,n)},bubbles:!0})),this.eventManager.emit("autoInputs:imageSelected",{input:e,imageData:t,value:l,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",l=void 0!==e.original;switch(n){case"url":return l?e.images?.[0]?.url||e.original?.url||"":e.url||e.path||"";case"base64":return e.base64||e.dataUrl||"";case"assetId":return l?e.original?.assetId||"":e.assetId||e.id||"";case"fileName":return e.fileName||e.filename||"";default:try{if(l){const t={original:e.original?{url:e.original.url||e.original.urlSigned,width:e.original.width,height:e.original.height,assetId:e.original.assetId||e.original.id}:null,images:Array.isArray(e.images)?e.images.map(e=>{const t={url:e.url||e.urlSigned,width:e.width,height:e.height,name:e.name||e.filename||e.label};return e.cropState&&(t.cropState={selectorState:e.cropState.selectorState||null,imageTransform:e.cropState.imageTransform||null,flipState:e.cropState.flipState||null}),t}):[]};console.log("[AutoInputManager] Datos limpios para JSON:",t);const n=JSON.stringify(t);return console.log("[AutoInputManager] JSON generado:",n),n}const t={original:{url:e.url||e.path,width:e.width,height:e.height,assetId:e.assetId||e.id}};return console.log("[AutoInputManager] Datos legacy para JSON:",t),JSON.stringify(t)}catch(r){return console.error("[AutoInputManager] Error al serializar JSON:",r),console.error("[AutoInputManager] imageData problemático:",e),"{}"}}}_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 archivo",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:{accept:e.accept||null,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,existingCrops:e.existingCrops||null,existingData:e.existingData||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,localCropsOnly:e.localCropsOnly??this.config.localCropsOnly??!1,existingCrops:e.existingCrops||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 l={"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(l[t])return{...n,aspectRatio:l[t],minCropBoxWidth:e.minWidth||this.config.minWidth,minCropBoxHeight:e.minHeight||this.config.minHeight};if("string"==typeof t&&t.includes(":")){const[e,l]=t.split(":").map(Number);if(!isNaN(e)&&!isNaN(l)&&0!==l)return{...n,aspectRatio:e/l}}const r=parseFloat(t);return!isNaN(r)&&r>0?{...n,aspectRatio:r}:"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 l=[];switch(t){case"gallery-only":case"upload-only":l=["select"];break;case"crop-only":l=["select","crop"];break;default:l=["select"],n.includes("cropper")&&l.push("crop"),n.includes("gallery")&&(l.push("download","copy","rename"),this.config.allowDelete&&l.push("delete"))}return l}_getInputId(e){if(e.id)return e.id;if(e.name)return e.name;let t=e.getAttribute("data-limbo-uid");return t||(t=`limbo-auto-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,e.setAttribute("data-limbo-uid",t)),t}_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}},l=(e,t=!1)=>null===e?t:"true"===e||"1"===e||""===e,r=e=>e?parseFloat(e):null,a=e=>{if(!e)return null;try{return JSON.parse(e)}catch(t){return console.warn("[Limbo AutoInputManager] Error parsing JSON attribute:",t),null}},i=a(e.dataset.mandatorycrops)||a(e.dataset.mandatoryCrops)||a(e.getAttribute("data-mandatory-crops"))||a(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:r(e.dataset.quality)||r(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:l(e.dataset.compact,null)??l(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:r(e.getAttribute("data-limbo-min-width"))||this.config.minWidth,minHeight:r(e.getAttribute("data-limbo-min-height"))||this.config.minHeight,maxWidth:r(e.getAttribute("data-limbo-max-width"))||this.config.maxWidth,maxHeight:r(e.getAttribute("data-limbo-max-height"))||this.config.maxHeight,buttonText:e.dataset.buttontext||e.getAttribute("data-limbo-button-text")||this.config.buttonText,buttonStyle:e.dataset.buttonstyle||e.getAttribute("data-limbo-button-style")||this.config.buttonStyle,buttonClass:e.dataset.buttonclass||e.getAttribute("data-limbo-button-class")||this.config.buttonClass,showPreview:l(e.getAttribute("data-limbo-show-preview"),this.config.showPreview),allowMultiple:l(e.getAttribute("data-limbo-allow-multiple"),this.config.allowMultiple),autoAssign:l(e.getAttribute("data-limbo-auto-assign"),this.config.autoAssign),placeholder:e.getAttribute("data-limbo-placeholder"),description:e.getAttribute("data-limbo-description"),required:l(e.getAttribute("data-limbo-required"),!1),disabled:l(e.getAttribute("data-limbo-disabled"),!1),inputId:this._getInputId(e),inputName:e.name,inputType:e.type,mandatoryCrops:i,allowAdditionalCrops:l(e.dataset.allowadditionalcrops,null)??l(e.getAttribute("data-limbo-allow-additional-crops"),!0),maxCrops:r(e.dataset.maxcrops)||r(e.getAttribute("data-limbo-max-crops"))||null,accept:e.dataset.accept||e.getAttribute("data-limbo-accept")||null,allowSelectNew:l(e.dataset.allowselectnew,null)??l(e.getAttribute("data-limbo-allow-select-new"),!0),...this._parseExistingInputValue(e.value)}}_parseExistingInputValue(e){if(!e||""===e.trim())return{initialImageUrl:null,existingCrops:null,existingData:null};try{const t=JSON.parse(e);return t.original&&t.original.url?(console.log("[AutoInputManager] Valor existente parseado:",t),{initialImageUrl:t.original.url,existingCrops:t.images||null,existingData:t}):t.url?{initialImageUrl:t.url,existingCrops:null,existingData:t}:{initialImageUrl:null,existingCrops:null,existingData:t}}catch(t){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?{initialImageUrl:e,existingCrops:null,existingData:null}:{initialImageUrl:null,existingCrops:null,existingData: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 ql{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(l){console.error(`Error executing listener for ${e}:`,l)}})}getStats(){const e={};return this.listeners.forEach((t,n)=>{e[n]=t.length}),e}}class Wl{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 Vl(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),window.limboCore?.events&&window.limboCore.events.emit("modal:closed",{modalId:e.getId(),remainingModals:this.activeModals.size})}_handleGlobalKeydown(e){const t=this.getActiveModal();t&&(t.config&&t.config.usesReactFocusTrap||("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 l=n[0],r=n[n.length-1];e.shiftKey?document.activeElement===l&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),l.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 Vl{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,usesReactFocusTrap:t.usesReactFocusTrap||!1},this.manager=n,this.element=null,this.backdrop=null,this.isOpen=!1,this.previousFocus=null,this._previousInertSiblings=[],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-scope limbo-modal limbo-modal--${this.config.size}`,this.element.id=this.id,this.element.setAttribute("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,l=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=l,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.textContent="✕",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 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",this._applyInertToSiblings();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}}_applyInertToSiblings(){const e=Array.from(document.body.children).filter(e=>e!==this.element&&e!==this.backdrop);this._previousInertSiblings=e.map(e=>({node:e,hadInert:e.hasAttribute("inert")})),e.forEach(e=>e.setAttribute("inert",""))}_restoreInertSiblings(){this._previousInertSiblings.forEach(({node:e,hadInert:t})=>{!t&&e.isConnected&&e.removeAttribute("inert")}),this._previousInertSiblings=[]}_cleanup(){document.body.style.overflow=this._originalBodyOverflow||"",this._restoreInertSiblings(),this.previousFocus&&"function"==typeof this.previousFocus.focus&&!1!==this.previousFocus.isConnected&&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 Hl{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 l=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,l),!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 l=n.getAttribute("data-theme")||n.getAttribute("class")?.match(/theme-(\w+)/)||n.getAttribute("class")?.match(/(\w+)-theme/);l&&(e.detectedName=Array.isArray(l)?l[1]:l)}}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 l=`--limbo-${e}`,r=n.getPropertyValue(l).trim();r&&(t[l]=r)});return["--primary-color","--background-color","--text-color","--border-color","--accent-color","--surface-color"].forEach(e=>{const l=n.getPropertyValue(e).trim();if(l){const n=this._mapGenericToLimbo(e,l);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 l=document.querySelector('meta[name="theme-color"]');l||(l=document.createElement("meta"),l.name="theme-color",document.head.appendChild(l)),l.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(l){console.error("Error in theme change callback:",l)}})}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 l=this._getTheme(this.config.inheritance.fallbackTheme);return l&&(n.variables={...l.variables,...n.variables}),this.registerTheme(e,n),n}_darkenColor(e,t){const n=parseInt(e.replace("#",""),16),l=Math.round(2.55*t),r=(n>>16)-l,a=(n>>8&255)-l,i=(255&n)-l;return"#"+(16777216+65536*(r<255?r<1?0:r:255)+256*(a<255?a<1?0:a:255)+(i<255?i<1?0:i:255)).toString(16).slice(1)}_lightenColor(e,t){const n=parseInt(e.replace("#",""),16),l=Math.round(2.55*t),r=(n>>16)+l,a=(n>>8&255)+l,i=(255&n)+l;return"#"+(16777216+65536*(r<255?r<1?0:r:255)+256*(a<255?a<1?0:a:255)+(i<255?i<1?0:i:255)).toString(16).slice(1)}_deepMerge(e,t){const n={...e};return Object.keys(t).forEach(l=>{t[l]&&"object"==typeof t[l]&&!Array.isArray(t[l])?n[l]=this._deepMerge(e[l]||{},t[l]):n[l]=t[l]}),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 Kl={border:"none",borderRadius:"6px",cursor:"pointer",fontFamily:"inherit",fontWeight:"500",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"6px",transition:"background 0.2s ease, transform 0.1s ease",userSelect:"none",textDecoration:"none",lineHeight:"1.25"},Gl={bg:"#001978",hover:"#334793"},Ql={bg:"#10b981",hover:"#059669"},Xl={bg:"#9ca3af",hover:"#9ca3af"};class Yl extends HTMLElement{constructor(){super(),this._btn=null,this._limboInstance=null}connectedCallback(){this._ensureButton(),this._syncButton()}disconnectedCallback(){this._destroyLimboInstance()}static get observedAttributes(){return["accept","has-file","disabled","compact","label-select","label-change","return-format","button-class","existing-url","mandatory-crops","public-key","token","auth-mode"]}attributeChangedCallback(){this._btn&&this._syncButton()}markSelected(e){this.setAttribute("has-file",""),e&&this.setAttribute("existing-url",e),this._syncButton()}clearSelection(){this.removeAttribute("has-file"),this.removeAttribute("existing-url"),this._syncButton()}open(){this._open()}_ensureButton(){this._btn||(this._btn=document.createElement("button"),this._btn.type="button",this._btn.classList.add("limbo-selector-btn","limbo-trigger-button","mecano:my-2"),this._btn.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),this._open()}),this.appendChild(this._btn))}_syncButton(){if(!this._btn)return;const e=this.getAttribute("accept")||null,t=this.hasAttribute("has-file"),n=this.hasAttribute("disabled"),l=this.hasAttribute("compact"),r=this.getAttribute("label-select")||null,a=this.getAttribute("label-change")||null,i=this.getAttribute("button-class")||null;this._btn.textContent=t?a||v(e,!0):r||v(e,!1),this._btn.disabled=n,i&&i.split(/\s+/).filter(Boolean).forEach(e=>this._btn.classList.add(e));const o=n?Xl:t?Ql:Gl;Object.assign(this._btn.style,{...Kl,fontSize:l?"12px":"14px",padding:l?"6px 12px":"8px 16px",background:o.bg,color:"white",opacity:n?"0.55":"1",cursor:n?"not-allowed":"pointer"}),this._btn.onmouseenter=()=>{n||(this._btn.style.background=o.hover,this._btn.style.transform="translateY(-1px)",this._btn.style.boxShadow="0 4px 10px rgba(0,0,0,0.18)")},this._btn.onmouseleave=()=>{this._btn.style.background=o.bg,this._btn.style.transform="translateY(0)",this._btn.style.boxShadow="none"}}_open(){const e=window.Limbo||window.limboCore;if(!e)return void console.warn("[LimboSelector] window.Limbo no encontrado. Asegúrate de que el script de Limbo está cargado antes de usar <limbo-selector>.");const t=this.getAttribute("accept")||null,n=this.getAttribute("return-format")||"url",l=this.getAttribute("existing-url")||null,r=this.getAttribute("public-key")||null,a=this.getAttribute("token")||null,i=this.getAttribute("auth-mode")||null;(r||a)&&e.configure({...r&&{publicKey:r},...a&&{token:a},authMode:i||(a?"manual":"session")}),e.config?.setGlobal&&e.config.setGlobal({interaction:{allowSelection:!0,allowCropping:!0,selectionMode:"direct"}});let o=null;const s=this.getAttribute("mandatory-crops");if(s)try{o=JSON.parse(s)}catch{}this._destroyLimboInstance();try{const r={mode:"modal",modeUI:"full",modalSize:"fullscreen",features:["gallery","upload","cropper"],title:"Seleccionar archivo",validation:{accept:t},returnConfig:{format:n},initialImageUrl:l,interaction:{allowSelection:!0,allowCropping:!0},cropper:o?.length>0?{mandatoryCrops:o,allowAdditionalCrops:!0,maxCrops:10}:null},a=async e=>{const t="string"==typeof e?e:e?.images?.[0]?.url||e?.original?.url||e?.url||"";this.setAttribute("has-file",""),t&&this.setAttribute("existing-url",t),this._syncButton(),this.dispatchEvent(new CustomEvent("limbo:change",{detail:{data:e,url:t},bubbles:!0,composed:!0}))};e.events.emit("autoInputs:modalRequest",{config:r,input:null,callback:a})}catch(c){console.error("[LimboSelector] Error al abrir modal de Limbo:",c)}}_handleResult(e,t){if(this._limboInstance!==t)return;const n="string"==typeof e?e:e?.url||e?.master?.urlSigned||e?.master?.url||e?.asset?.url||e?.original?.url||e?.crops?.[0]?.url||e?.images?.[0]?.url||"";this.setAttribute("has-file",""),n&&this.setAttribute("existing-url",n),this._syncButton(),this.dispatchEvent(new CustomEvent("limbo:change",{detail:{data:e,url:n},bubbles:!0,composed:!0}));try{t?.close?.()}catch{}this._limboInstance=null}_destroyLimboInstance(){if(this._limboInstance){try{this._limboInstance.destroy?.()}catch{}this._limboInstance=null}}}function Jl(e="limbo-selector"){"undefined"==typeof customElements||customElements.get(e)||customElements.define(e,Yl)}const Zl=new class{constructor(){this.config=new C,this.instances=new Ul,this.autoInputs=new Bl,this.events=new ql,this.modals=new Wl,this.theme=new Hl,this.containerQueryDetector=I,this._setupInternalListeners(),this._initializeContainerQueries()}configure(e){this.config.setGlobal(e);const t={};var n;return"publicKey"in e&&(t.publicKey=e.publicKey),"apiKey"in e&&(t.apiKey=e.apiKey),"token"in e&&(t.token=e.token),"authMode"in e&&(t.authMode=e.authMode),"tokenProvider"in e&&(t.tokenProvider=e.tokenProvider),"prod"in e&&(t.prod=Boolean(e.prod)),"mode"in e&&(t.mode=e.mode),"callbacks"in e&&(t.callbacks=e.callbacks),"token"in(n=t)&&n.token!==B.token&&(q=!1,W=null),B={...B,...n},B.authMode||(B.token?B.authMode="manual":B.authMode="session"),this.config}setToken(e){return X(e),this.config.setGlobal({token: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}]`,l=document.querySelectorAll(n);if(0===l.length)return{found:0,processed:0,skipped:0};let r=0,a=0;return l.forEach(e=>{try{this.autoInputs._processInput(e),r++}catch(t){console.warn(`⚠️ Limbo: Error procesando input ${e.id||e.name}:`,t),a++}}),this.events.emit("limbo:scanCompleted",{found:l.length,processed:r,skipped:a,inputs:Array.from(l)}),{found:l.length,processed:r,skipped:a}}_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 l=0;return n.forEach(e=>{if(!this.autoInputs.instances.has(this.autoInputs._getInputId(e)))try{this.autoInputs._processInput(e),l++}catch(t){console.warn("⚠️ Limbo: Error procesando nuevo input:",t)}}),l}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,input:n})=>{this._handleAutoInputModalRequest({config:e,callback:t,input:n})})}_handleAutoInputModalRequest({config:e,callback:t,input:n}){const l=n,r=async n=>{let r={};if(n.crops&&n.crops.length>0){const e=n.asset||n.original;r.original={url:e?.url||e?.urlSigned||n.originalUrl,width:e?.width||n.originalWidth,height:e?.height||n.originalHeight,assetId:e?.id||n.assetId},r.images=n.crops.map(e=>({url:e.url||e.urlSigned,width:e.width,height:e.height,name:e.name||e.filename}))}else n.asset?r.original={url:n.asset.url||n.asset.urlSigned,width:n.asset.width,height:n.asset.height,assetId:n.asset.id}:n.master?.urlSigned||n.master?.url?r.original={url:n.master.urlSigned||n.master.url,width:n.master.width||n.width,height:n.master.height||n.height,assetId:n.assetId}:n.url||n.urlSigned?r.original={url:n.url||n.urlSigned,width:n.width,height:n.height,assetId:n.assetId||n.id}:(console.warn("[Limbo] handleResult: formato de datos no reconocido",n),r=n);if(l){var a=e?.returnConfig?.format||"json",i="";i="url"===a?r.images?.[0]?.url||r.original?.url||"":"assetId"===a?r.original?.assetId||"":JSON.stringify(r),l.value=i,l.dispatchEvent(new Event("change",{bubbles:!0})),console.log("[Limbo] ✅ Valor asignado al input:",l.value?.substring(0,80))}try{await t(r)}catch(o){}c.close()},a={...e,mode:"modal",autoDestroy:!0,interaction:{allowSelection:!0,allowCropping:!0,...e.interaction},callbacks:{onSelect:e=>{r(e)},onCropsSaved:e=>{r(e)},onCropperComplete:e=>{r(e)},onUpload:t=>{"upload-only"!==e.modeUI||e.features?.includes("cropper")||r(t)},onClose:()=>{}}},i=e.validation?.accept||null,o=i?f(i):null,s=!o||o.isAllTypes||o.includesImages;if(e.initialImageUrl&&s){const t=this._extractAssetIdFromUrl(e.initialImageUrl)||e.existingData?.original?.assetId||null;t&&(a._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&&(a.cropper=e.cropper),this.config.setGlobal({interaction:{allowSelection:!0,allowCropping:!0,...e.interaction}});const c=this.create(a);c.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"},validation:{accept:e.accept||null},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"},validation:{accept:e.accept||null},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()}`},l=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&&l.close()},onCropperCancelled:e=>{t.onCancelled?.(e),!1!==t.autoClose&&l.close()},onCropperError:e=>{t.onError?.(e)}},_externalImage:n,...t});return l.open(),l}createInlineGallery(e,t={}){return this.create({container:e,mode:"embed",modeUI:"gallery-only",features:["gallery"],validation:{accept:t.accept||null},callbacks:{onSelect:t.onSelect,onDelete:t.onDelete},...t})}createInlineUploader(e,t={}){return this.create({container:e,mode:"embed",modeUI:"upload-only",features:["upload"],validation:{accept:t.accept||null},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 l={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:l,...n})}createFullSelector(e,t={}){return this.create({container:e,mode:t.mode||"embed",modeUI:"full",features:["gallery","upload","cropper"],validation:{accept:t.accept||null},callbacks:{onSelect:t.onSelect,onUpload:t.onUpload,onDelete:t.onDelete,onCropsSaved:t.onCropsSaved},...t})}};"undefined"!=typeof window&&(window.Limbo=Zl,window.limboCore=Zl,Jl());"undefined"!=typeof window&&document.querySelector("#root")&&(Zl.configure({prod:!1,publicKey:"pk_e464fd744106b7a8d63d453c4bd02582",authMode:"session"}),Zl.create({container:"#root",mode:"embed",modeUI:"full",features:["gallery","upload","cropper"],title:"Limbo Image Manager - Development",url:!0}),Zl.configureAutoInputs({dataset:"data-limbo-input-file",return:"json",features:["gallery","upload","cropper"],modeUI:"full",modalSize:"large",title:"Seleccionar archivo",crops:"free",allowDelete:!1}));export{Tl as LIMBO_BASE_URL,Yl as LimboSelector,zl as decodeHtmlEntities,Zl as default,Ml as extractImageUrl,v as getButtonLabel,Ll as isValidImageUrl,Pl as parseImageData,Dl as prepareImageFieldsForPreview,Jl as registerLimboSelector,Al as resolveUrl};
|
|
741
717
|
//# sourceMappingURL=limbo.es.map
|