@golstats/gsc-reports 1.0.61 → 1.0.62

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.
@@ -4078,7 +4078,7 @@ uniform ${Be} ${qe} u_${it};
4078
4078
  * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE
4079
4079
  */const Uc=new zse;class Wi{static init(a={},g=".grid-stack"){if(typeof document>"u")return null;const B=Wi.getGridElement(g);return B?(B.gridstack||(B.gridstack=new Wi(B,zn.cloneDeep(a))),B.gridstack):(console.error(typeof g=="string"?'GridStack.initAll() no grid was found with selector "'+g+`" - element missing or wrong selector ?
4080
4080
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(a={},g=".grid-stack"){const B=[];return typeof document>"u"||(Wi.getGridElements(g).forEach(K=>{K.gridstack||(K.gridstack=new Wi(K,zn.cloneDeep(a))),B.push(K.gridstack)}),B.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+g+`" - element missing or wrong selector ?
4081
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),B}static addGrid(a,g={}){if(!a)return null;let B=a;if(B.gridstack){const K=B.gridstack;return g&&(K.opts={...K.opts,...g}),g.children!==void 0&&K.load(g.children),K}return(!a.classList.contains("grid-stack")||Wi.addRemoveCB)&&(Wi.addRemoveCB?B=Wi.addRemoveCB(a,g,!0,!0):B=zn.createDiv(["grid-stack",g.class],a)),Wi.init(g,B)}static registerEngine(a){Wi.engineClass=a}get placeholder(){if(!this._placeholder){this._placeholder=zn.createDiv([this.opts.placeholderClass,Cu.itemClass,this.opts.itemClass]);const a=zn.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(a.textContent=this.opts.placeholderText)}return this._placeholder}constructor(a,g={}){var B;this.el=a,this.opts=g,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},a.gridstack=this,this.opts=g=g||{},a.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),g.row&&(g.minRow=g.maxRow=g.row,delete g.row);const K=zn.toNumber(a.getAttribute("gs-row"));g.column==="auto"&&delete g.column,g.alwaysShowResizeHandle!==void 0&&(g._alwaysShowResizeHandle=g.alwaysShowResizeHandle);const C=g.columnOpts;if(C){const e=C.breakpoints;!C.columnWidth&&!(e!=null&&e.length)?delete g.columnOpts:(C.columnMax=C.columnMax||12,(e==null?void 0:e.length)>1&&e.sort((w,y)=>(y.w||0)-(w.w||0)))}const b={...zn.cloneDeep(Cu),column:zn.toNumber(a.getAttribute("gs-column"))||Cu.column,minRow:K||zn.toNumber(a.getAttribute("gs-min-row"))||Cu.minRow,maxRow:K||zn.toNumber(a.getAttribute("gs-max-row"))||Cu.maxRow,staticGrid:zn.toBool(a.getAttribute("gs-static"))||Cu.staticGrid,sizeToContent:zn.toBool(a.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(g.handleClass?"."+g.handleClass:g.handle?g.handle:"")||Cu.draggable.handle},removableOptions:{accept:g.itemClass||Cu.removableOptions.accept,decline:Cu.removableOptions.decline}};a.getAttribute("gs-animate")&&(b.animate=zn.toBool(a.getAttribute("gs-animate"))),g=zn.defaults(g,b),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(g),g.rtl==="auto"&&(g.rtl=a.style.direction==="rtl"),g.rtl&&this.el.classList.add("grid-stack-rtl");const t=this.el.closest("."+Cu.itemClass),v=t==null?void 0:t.gridstackNode;if(v&&(v.subGrid=this,this.parentGridNode=v,this.el.classList.add("grid-stack-nested"),v.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=g.cellHeight==="auto",this._isAutoCellHeight||g.cellHeight==="initial")this.cellHeight(void 0);else{typeof g.cellHeight=="number"&&g.cellHeightUnit&&g.cellHeightUnit!==Cu.cellHeightUnit&&(g.cellHeight=g.cellHeight+g.cellHeightUnit,delete g.cellHeightUnit);const e=g.cellHeight;delete g.cellHeight,this.cellHeight(e)}g.alwaysShowResizeHandle==="mobile"&&(g.alwaysShowResizeHandle=$u),this._setStaticClass();const u=g.engineClass||Wi.engineClass||Bd;if(this.engine=new u({column:this.getColumn(),float:g.float,maxRow:g.maxRow,onChange:e=>{e.forEach(w=>{const y=w.el;y&&(w._removeDOM?(y&&y.remove(),delete w._removeDOM):this._writePosAttr(y,w))}),this._updateContainerHeight()}}),g.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(e=>this._prepareElement(e)),delete this.engine._loading,this.batchUpdate(!1)),g.children){const e=g.children;delete g.children,e.length&&this.load(e)}this.setAnimation(),g.subGridDynamic&&!Zi.pauseDrag&&(Zi.pauseDrag=!0),((B=g.draggable)==null?void 0:B.pause)!==void 0&&(Zi.pauseDrag=g.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(a=this.opts){this.el.classList.add("gs-"+a.column),typeof a.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/a.column}%`)}addWidget(a){if(!a)return;if(typeof a=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(a.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(a);let g,B=a;if(B.grid=this,B.el?g=B.el:Wi.addRemoveCB?g=Wi.addRemoveCB(this.el,a,!0,!1):g=this.createWidgetDivs(B),!g)return;if(B=g.gridstackNode,B&&g.parentElement===this.el&&this.engine.nodes.find(C=>C._id===B._id))return g;const K=this._readAttr(g);return zn.defaults(a,K),this.engine.prepareNode(a),this.el.appendChild(g),this.makeWidget(g,a),g}createWidgetDivs(a){const g=zn.createDiv(["grid-stack-item",this.opts.itemClass]),B=zn.createDiv(["grid-stack-item-content"],g);return zn.lazyLoad(a)?a.visibleObservable||(a.visibleObservable=new IntersectionObserver(([K])=>{var C,b;K.isIntersecting&&((C=a.visibleObservable)==null||C.disconnect(),delete a.visibleObservable,Wi.renderCB(B,a),(b=a.grid)==null||b.prepareDragDrop(a.el))}),window.setTimeout(()=>{var K;return(K=a.visibleObservable)==null?void 0:K.observe(g)})):Wi.renderCB(B,a),g}makeSubGrid(a,g,B,K=!0){var C,b,t;let v=a.gridstackNode;if(v||(v=this.makeWidget(a).gridstackNode),(C=v.subGrid)!=null&&C.el)return v.subGrid;let u,e=this;for(;e&&!u;)u=(b=e.opts)==null?void 0:b.subGridOpts,e=(t=e.parentGridNode)==null?void 0:t.grid;g=zn.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...u||{},...g||v.subGridOpts||{}}),v.subGridOpts=g;let w;g.column==="auto"&&(w=!0,g.column=Math.max(v.w||1,(B==null?void 0:B.w)||1),delete g.columnOpts);let y=v.el.querySelector(".grid-stack-item-content"),x,h;if(K&&(this._removeDD(v.el),h={...v,x:0,y:0},zn.removeInternalForSave(h),delete h.subGridOpts,v.content&&(h.content=v.content,delete v.content),Wi.addRemoveCB?x=Wi.addRemoveCB(this.el,h,!0,!1):(x=zn.createDiv(["grid-stack-item"]),x.appendChild(y),y=zn.createDiv(["grid-stack-item-content"],v.el)),this.prepareDragDrop(v.el)),B){const i=w?g.column:v.w,d=v.h+B.h,s=v.el.style;s.transition="none",this.update(v.el,{w:i,h:d}),setTimeout(()=>s.transition=null)}const n=v.subGrid=Wi.addGrid(y,g);return B!=null&&B._moving&&(n._isTemp=!0),w&&(n._autoColumn=!0),K&&n.makeWidget(x,h),B&&(B._moving?window.setTimeout(()=>zn.simulateMouseEvent(B._event,"mouseenter",n.el),0):n.makeWidget(v.el,v)),this.resizeToContentCheck(!1,v),n}removeAsSubGrid(a){var g;const B=(g=this.parentGridNode)==null?void 0:g.grid;B&&(B.batchUpdate(),B.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(K=>{K.x+=this.parentGridNode.x,K.y+=this.parentGridNode.y,B.makeWidget(K.el,K)}),B.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,a&&window.setTimeout(()=>zn.simulateMouseEvent(a._event,"mouseenter",B.el),0))}save(a=!0,g=!1,B=Wi.saveCB,K){const C=this.engine.save(a,B,K);if(C.forEach(b=>{var t;if(a&&b.el&&!b.subGrid&&!B){const v=b.el.querySelector(".grid-stack-item-content");b.content=v==null?void 0:v.innerHTML,b.content||delete b.content}else if(!a&&!B&&delete b.content,(t=b.subGrid)!=null&&t.el){const v=b.w||b.subGrid.getColumn(),u=b.subGrid.save(a,g,B,v);b.subGridOpts=g?u:{children:u},delete b.subGrid}delete b.el}),g){const b=zn.cloneDeep(this.opts);b.marginBottom===b.marginTop&&b.marginRight===b.marginLeft&&b.marginTop===b.marginRight&&(b.margin=b.marginTop,delete b.marginTop,delete b.marginRight,delete b.marginBottom,delete b.marginLeft),b.rtl===(this.el.style.direction==="rtl")&&(b.rtl="auto"),this._isAutoCellHeight&&(b.cellHeight="auto"),this._autoColumn&&(b.column="auto");const t=b._alwaysShowResizeHandle;return delete b._alwaysShowResizeHandle,t!==void 0?b.alwaysShowResizeHandle=t:delete b.alwaysShowResizeHandle,zn.removeInternalAndSame(b,Cu),b.children=C,b}return C}load(a,g=Wi.addRemoveCB||!0){a=zn.cloneDeep(a);const B=this.getColumn();a.forEach(e=>{e.w=e.w||e.minW||1,e.h=e.h||e.minH||1}),a=zn.sort(a),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let K=0;a.forEach(e=>{K=Math.max(K,(e.x||0)+e.w)}),K>this.engine.defaultColumn&&(this.engine.defaultColumn=K),K>B&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=a,this.engine.columnChanged(K,B,this.responseLayout),a=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(a,K,!0));const C=Wi.addRemoveCB;typeof g=="function"&&(Wi.addRemoveCB=g);const b=[];this.batchUpdate();const t=!this.engine.nodes.length,v=t&&this.opts.animate;v&&this.setAnimation(!1),!t&&g&&[...this.engine.nodes].forEach(e=>{e.id&&(zn.find(a,e.id)||(Wi.addRemoveCB&&Wi.addRemoveCB(this.el,e,!1,!1),b.push(e),this.removeWidget(e.el,!0,!1)))}),this.engine._loading=!0;const u=[];return this.engine.nodes=this.engine.nodes.filter(e=>zn.find(a,e.id)?(u.push(e),!1):!0),a.forEach(e=>{var w;const y=zn.find(u,e.id);if(y){if(zn.shouldSizeToContent(y)&&(e.h=y.h),this.engine.nodeBoundFix(e),(e.autoPosition||e.x===void 0||e.y===void 0)&&(e.w=e.w||y.w,e.h=e.h||y.h,this.engine.findEmptyPosition(e)),this.engine.nodes.push(y),zn.samePos(y,e)&&this.engine.nodes.length>1&&(this.moveNode(y,{...e,forceCollide:!0}),zn.copyPos(e,y)),this.update(y.el,e),(w=e.subGridOpts)!=null&&w.children){const x=y.el.querySelector(".grid-stack");x&&x.gridstack&&x.gridstack.load(e.subGridOpts.children)}}else g&&this.addWidget(e)}),delete this.engine._loading,this.engine.removedNodes=b,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,C?Wi.addRemoveCB=C:delete Wi.addRemoveCB,v&&this.setAnimation(!0,!0),this}batchUpdate(a=!0){return this.engine.batchUpdate(a),a||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(a=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!a||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const g=this.el.querySelector("."+this.opts.itemClass);if(g){const K=zn.toNumber(g.getAttribute("gs-h"))||1;return Math.round(g.offsetHeight/K)}const B=parseInt(this.el.getAttribute("gs-current-row"));return B?Math.round(this.el.getBoundingClientRect().height/B):this.opts.cellHeight}cellHeight(a){if(a!==void 0&&this._isAutoCellHeight!==(a==="auto")&&(this._isAutoCellHeight=a==="auto",this._updateResizeEvent()),(a==="initial"||a==="auto")&&(a=void 0),a===void 0){const B=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;a=this.cellWidth()+B}const g=zn.parseHeight(a);return this.opts.cellHeightUnit===g.unit&&this.opts.cellHeight===g.h?this:(this.opts.cellHeightUnit=g.unit,this.opts.cellHeight=g.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(a=!1){var g;return a&&(g=this.opts.columnOpts)!=null&&g.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var a,g;const B=this.opts.columnOpts;if(!B||!B.columnWidth&&!((a=B.breakpoints)!=null&&a.length))return!1;const K=this.getColumn();let C=K;const b=this._widthOrContainer(!0);if(B.columnWidth)C=Math.min(Math.round(b/B.columnWidth)||1,B.columnMax);else{C=B.columnMax;let t=0;for(;t<B.breakpoints.length&&b<=B.breakpoints[t].w;)C=B.breakpoints[t++].c||K}if(C!==K){const t=(g=B.breakpoints)==null?void 0:g.find(v=>v.c===C);return this.column(C,(t==null?void 0:t.layout)||B.layout),!0}return!1}compact(a="compact",g=!0){return this.engine.compact(a,g),this._triggerChangeEvent(),this}column(a,g="moveScale"){if(!a||a<1||this.opts.column===a)return this;const B=this.getColumn();return this.opts.column=a,this.engine?(this.engine.column=a,this.el.classList.remove("gs-"+B),this._updateColumnVar(),this.engine.columnChanged(B,a,g),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=g,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(a=>a.matches("."+this.opts.itemClass)&&!a.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(a=!0){var g;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),a?this.el.parentNode.removeChild(this.el):(this.removeAll(a),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(g=this._placeholder)==null||delete g.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(a){return this.opts.float!==a&&(this.opts.float=this.engine.float=a,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(a,g=!1){const B=this.el.getBoundingClientRect();let K;g?K={top:B.top+document.documentElement.scrollTop,left:B.left}:K={top:this.el.offsetTop,left:this.el.offsetLeft};const C=a.left-K.left,b=a.top-K.top,t=B.width/this.getColumn(),v=B.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(C/t),y:Math.floor(b/v)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(a,g,B,K){return this.engine.isAreaEmpty(a,g,B,K)}makeWidget(a,g){const B=Wi.getElement(a);if(!B||B.gridstackNode)return B;B.parentElement||this.el.appendChild(B),this._prepareElement(B,!0,g);const K=B.gridstackNode;this._updateContainerHeight(),K.subGridOpts&&this.makeSubGrid(B,K.subGridOpts,void 0,!1);let C;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(C=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),C&&delete this._ignoreLayoutsNodeChange,B}on(a,g){return a.indexOf(" ")!==-1?(a.split(" ").forEach(B=>this.on(B,g)),this):(a==="change"||a==="added"||a==="removed"||a==="enable"||a==="disable"?(a==="enable"||a==="disable"?this._gsEventHandler[a]=B=>g(B):this._gsEventHandler[a]=B=>{B.detail&&g(B,B.detail)},this.el.addEventListener(a,this._gsEventHandler[a])):a==="drag"||a==="dragstart"||a==="dragstop"||a==="resizestart"||a==="resize"||a==="resizestop"||a==="dropped"||a==="resizecontent"?this._gsEventHandler[a]=g:console.error("GridStack.on("+a+") event not supported"),this)}off(a){return a.indexOf(" ")!==-1?(a.split(" ").forEach(g=>this.off(g)),this):((a==="change"||a==="added"||a==="removed"||a==="enable"||a==="disable")&&this._gsEventHandler[a]&&this.el.removeEventListener(a,this._gsEventHandler[a]),delete this._gsEventHandler[a],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(a=>this.off(a)),this}removeWidget(a,g=!0,B=!0){return a?(Wi.getElements(a).forEach(K=>{if(K.parentElement&&K.parentElement!==this.el)return;let C=K.gridstackNode;C||(C=this.engine.nodes.find(b=>K===b.el)),C&&(g&&Wi.addRemoveCB&&Wi.addRemoveCB(this.el,C,!1,!1),delete K.gridstackNode,this._removeDD(K),this.engine.removeNode(C,g,B),g&&K.parentElement&&K.remove())}),B&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(a=!0,g=!0){return this.engine.nodes.forEach(B=>{a&&Wi.addRemoveCB&&Wi.addRemoveCB(this.el,B,!1,!1),delete B.el.gridstackNode,this.opts.staticGrid||this._removeDD(B.el)}),this.engine.removeAll(a,g),g&&this._triggerRemoveEvent(),this}setAnimation(a=this.opts.animate,g){return g?setTimeout(()=>{this.opts&&this.setAnimation(a)}):a?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=a,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(a,g=!0,B=!0){return!!this.opts.staticGrid===a?this:(a?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(K=>{this.prepareDragDrop(K.el),K.subGrid&&B&&K.subGrid.setStatic(a,g,B)}),g&&this._setStaticClass(),this)}updateOptions(a){var g;const B=this.opts;return a===B?this:(a.acceptWidgets!==void 0&&(B.acceptWidgets=a.acceptWidgets,this._setupAcceptWidget()),a.animate!==void 0&&this.setAnimation(a.animate),a.cellHeight&&this.cellHeight(a.cellHeight),a.class!==void 0&&a.class!==B.class&&(B.class&&this.el.classList.remove(B.class),a.class&&this.el.classList.add(a.class)),a.columnOpts?(this.opts.columnOpts=a.columnOpts,this.checkDynamicColumn()):a.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof a.column=="number"&&this.column(a.column),a.margin!==void 0&&this.margin(a.margin),a.staticGrid!==void 0&&this.setStatic(a.staticGrid),a.disableDrag!==void 0&&!a.staticGrid&&this.enableMove(!a.disableDrag),a.disableResize!==void 0&&!a.staticGrid&&this.enableResize(!a.disableResize),a.float!==void 0&&this.float(a.float),a.row!==void 0?(B.minRow=B.maxRow=B.row=a.row,this._updateContainerHeight()):(a.minRow!==void 0&&(B.minRow=a.minRow,this._updateContainerHeight()),a.maxRow!==void 0&&(B.maxRow=a.maxRow)),(g=a.children)!=null&&g.length&&this.load(a.children),this)}update(a,g){return Wi.getElements(a).forEach(B=>{var K;const C=B==null?void 0:B.gridstackNode;if(!C)return;const b={...zn.copyPos({},C),...zn.cloneDeep(g)};this.engine.nodeBoundFix(b),delete b.autoPosition;const t=["x","y","w","h"];let v;if(t.some(w=>b[w]!==void 0&&b[w]!==C[w])&&(v={},t.forEach(w=>{v[w]=b[w]!==void 0?b[w]:C[w],delete b[w]})),!v&&(b.minW||b.minH||b.maxW||b.maxH)&&(v={}),b.content!==void 0){const w=B.querySelector(".grid-stack-item-content");w&&w.textContent!==b.content&&(C.content=b.content,Wi.renderCB(w,b),(K=C.subGrid)!=null&&K.el&&(w.appendChild(C.subGrid.el),C.subGrid._updateContainerHeight())),delete b.content}let u=!1,e=!1;for(const w in b)w[0]!=="_"&&C[w]!==b[w]&&(C[w]=b[w],u=!0,e=e||!this.opts.staticGrid&&(w==="noResize"||w==="noMove"||w==="locked"));if(zn.sanitizeMinMax(C),v){const w=v.w!==void 0&&v.w!==C.w;this.moveNode(C,v),w&&C.subGrid?C.subGrid.onResize(this.hasAnimationCSS()?C.w:void 0):this.resizeToContentCheck(w,C),delete C._orig}(v||u)&&this._writeAttr(B,C),e&&this.prepareDragDrop(C.el),Wi.updateCB&&Wi.updateCB(C)}),this}moveNode(a,g){const B=a._updating;B||this.engine.cleanNodes().beginUpdate(a),this.engine.moveNode(a,g),this._updateContainerHeight(),B||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(a){var g,B;if(!a||(a.classList.remove("size-to-content-max"),!a.clientHeight))return;const K=a.gridstackNode;if(!K)return;const C=K.grid;if(!C||a.parentElement!==C.el)return;const b=C.getCellHeight(!0);if(!b)return;let t=K.h?K.h*b:a.clientHeight,v;if(K.resizeToContentParent&&(v=a.querySelector(K.resizeToContentParent)),v||(v=a.querySelector(Wi.resizeToContentParent)),!v)return;const u=a.clientHeight-v.clientHeight,e=K.h?K.h*b-u:v.clientHeight;let w;if(K.subGrid){w=K.subGrid.getRow()*K.subGrid.getCellHeight(!0);const h=K.subGrid.el.getBoundingClientRect(),n=a.getBoundingClientRect();w+=h.top-n.top}else{if((B=(g=K.subGridOpts)==null?void 0:g.children)!=null&&B.length)return;{const h=v.firstElementChild;if(!h){console.error(`Error: GridStack.resizeToContent() widget id:${K.id} '${Wi.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}w=h.getBoundingClientRect().height||e}}if(e===w)return;t+=w-e;let y=Math.ceil(t/b);const x=Number.isInteger(K.sizeToContent)?K.sizeToContent:0;x&&y>x&&(y=x,a.classList.add("size-to-content-max")),K.minH&&y<K.minH?y=K.minH:K.maxH&&y>K.maxH&&(y=K.maxH),y!==K.h&&(C._ignoreLayoutsNodeChange=!0,C.moveNode(K,{h:y}),delete C._ignoreLayoutsNodeChange)}resizeToContentCBCheck(a){Wi.resizeToContentCB?Wi.resizeToContentCB(a):this.resizeToContent(a)}rotate(a,g){return Wi.getElements(a).forEach(B=>{const K=B.gridstackNode;if(!zn.canBeRotated(K))return;const C={w:K.h,h:K.w,minH:K.minW,minW:K.minH,maxH:K.maxW,maxW:K.maxH};if(g){const t=g.left>0?Math.floor(g.left/this.cellWidth()):0,v=g.top>0?Math.floor(g.top/this.opts.cellHeight):0;C.x=K.x+t-(K.h-(v+1)),C.y=K.y+v-t}Object.keys(C).forEach(t=>{C[t]===void 0&&delete C[t]});const b=K._orig;this.update(B,C),K._orig=b}),this}margin(a){if(!(typeof a=="string"&&a.split(" ").length>1)){const g=zn.parseHeight(a);if(this.opts.marginUnit===g.unit&&this.opts.margin===g.h)return}return this.opts.margin=a,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(a){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const g=arguments;let B=0,K={x:g[B++],y:g[B++],w:g[B++],h:g[B++],autoPosition:g[B++]};return this.willItFit(K)}return this.engine.willItFit(a)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const a=this.engine.getDirtyNodes(!0);return a&&a.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(a),this._triggerEvent("change",a)),this.engine.saveInitial(),this}_triggerAddEvent(){var a;if(this.engine.batchMode)return this;if((a=this.engine.addedNodes)!=null&&a.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(B=>{delete B._dirty});const g=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",g)}return this}_triggerRemoveEvent(){var a;if(this.engine.batchMode)return this;if((a=this.engine.removedNodes)!=null&&a.length){const g=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",g)}return this}_triggerEvent(a,g){const B=g?new CustomEvent(a,{bubbles:!1,detail:g}):new Event(a);let K=this;for(;K.parentGridNode;)K=K.parentGridNode.grid;return K.el.dispatchEvent(B),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const a=this.parentGridNode;let g=this.getRow()+this._extraDragRow;const B=this.opts.cellHeight,K=this.opts.cellHeightUnit;if(!B)return this;if(!a&&!this.opts.minRow){const C=zn.parseHeight(getComputedStyle(this.el).minHeight);if(C.h>0&&C.unit===K){const b=Math.floor(C.h/B);g<b&&(g=b)}}return this.el.setAttribute("gs-current-row",String(g)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),g&&(this.el.style[a?"minHeight":"height"]=g*B+K),a&&zn.shouldSizeToContent(a)&&a.grid.resizeToContentCBCheck(a.el),this}_prepareElement(a,g=!1,B){B=B||this._readAttr(a),a.gridstackNode=B,B.el=a,B.grid=this,B=this.engine.addNode(B,g),this._writeAttr(a,B),a.classList.add(Cu.itemClass,this.opts.itemClass);const K=zn.shouldSizeToContent(B);return K?a.classList.add("size-to-content"):a.classList.remove("size-to-content"),K&&this.resizeToContentCheck(!1,B),zn.lazyLoad(B)||this.prepareDragDrop(B.el),this}_writePosAttr(a,g){return(!g._moving&&!g._resizing||this._placeholder===a)&&(a.style.top=g.y?g.y===1?"var(--gs-cell-height)":`calc(${g.y} * var(--gs-cell-height))`:null,a.style.left=g.x?g.x===1?"var(--gs-column-width)":`calc(${g.x} * var(--gs-column-width))`:null,a.style.width=g.w>1?`calc(${g.w} * var(--gs-column-width))`:null,a.style.height=g.h>1?`calc(${g.h} * var(--gs-cell-height))`:null),g.x>0?a.setAttribute("gs-x",String(g.x)):a.removeAttribute("gs-x"),g.y>0?a.setAttribute("gs-y",String(g.y)):a.removeAttribute("gs-y"),g.w>1?a.setAttribute("gs-w",String(g.w)):a.removeAttribute("gs-w"),g.h>1?a.setAttribute("gs-h",String(g.h)):a.removeAttribute("gs-h"),this}_writeAttr(a,g){if(!g)return this;this._writePosAttr(a,g);const B={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const K in B)g[K]?a.setAttribute(B[K],String(g[K])):a.removeAttribute(B[K]);return this}_readAttr(a,g=!0){const B={};B.x=zn.toNumber(a.getAttribute("gs-x")),B.y=zn.toNumber(a.getAttribute("gs-y")),B.w=zn.toNumber(a.getAttribute("gs-w")),B.h=zn.toNumber(a.getAttribute("gs-h")),B.autoPosition=zn.toBool(a.getAttribute("gs-auto-position")),B.noResize=zn.toBool(a.getAttribute("gs-no-resize")),B.noMove=zn.toBool(a.getAttribute("gs-no-move")),B.locked=zn.toBool(a.getAttribute("gs-locked"));const K=a.getAttribute("gs-size-to-content");K&&(K==="true"||K==="false"?B.sizeToContent=zn.toBool(K):B.sizeToContent=parseInt(K,10)),B.id=a.getAttribute("gs-id"),B.maxW=zn.toNumber(a.getAttribute("gs-max-w")),B.minW=zn.toNumber(a.getAttribute("gs-min-w")),B.maxH=zn.toNumber(a.getAttribute("gs-max-h")),B.minH=zn.toNumber(a.getAttribute("gs-min-h")),g&&(B.w===1&&a.removeAttribute("gs-w"),B.h===1&&a.removeAttribute("gs-h"),B.maxW&&a.removeAttribute("gs-max-w"),B.minW&&a.removeAttribute("gs-min-w"),B.maxH&&a.removeAttribute("gs-max-h"),B.minH&&a.removeAttribute("gs-min-h"));for(const C in B){if(!B.hasOwnProperty(C))return;!B[C]&&B[C]!==0&&C!=="sizeToContent"&&delete B[C]}return B}_setStaticClass(){const a=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...a),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...a),this.el.removeAttribute("gs-static")),this}onResize(a=(g=>(g=this.el)==null?void 0:g.clientWidth)()){if(!a||this.prevWidth===a)return;this.prevWidth=a,this.batchUpdate();let g=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),g=!0):g=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(B=>{B.subGrid&&B.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(g),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(a=!1,g=void 0){if(this.engine){if(a&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,g),this.animationDelay);if(g)zn.shouldSizeToContent(g)&&this.resizeToContentCBCheck(g.el);else if(this.engine.nodes.some(B=>zn.shouldSizeToContent(B))){const B=[...this.engine.nodes];this.batchUpdate(),B.forEach(K=>{zn.shouldSizeToContent(K)&&this.resizeToContentCBCheck(K.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,g?[g]:this.engine.nodes)}}_updateResizeEvent(a=!1){const g=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(B=>B.sizeToContent));return!a&&g&&!this.resizeObserver?(this._sizeThrottle=zn.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(a||!g)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(a=".grid-stack-item"){return zn.getElement(a)}static getElements(a=".grid-stack-item"){return zn.getElements(a)}static getGridElement(a){return Wi.getElement(a)}static getGridElements(a){return zn.getElements(a)}_initMargin(){let a,g=0,B=[];typeof this.opts.margin=="string"&&(B=this.opts.margin.split(" ")),B.length===2?(this.opts.marginTop=this.opts.marginBottom=B[0],this.opts.marginLeft=this.opts.marginRight=B[1]):B.length===4?(this.opts.marginTop=B[0],this.opts.marginRight=B[1],this.opts.marginBottom=B[2],this.opts.marginLeft=B[3]):(a=zn.parseHeight(this.opts.margin),this.opts.marginUnit=a.unit,g=this.opts.margin=a.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(C=>{this.opts[C]===void 0?this.opts[C]=g:(a=zn.parseHeight(this.opts[C]),this.opts[C]=a.h,delete this.opts.margin)}),this.opts.marginUnit=a.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const K=this.el.style;return K.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),K.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),K.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),K.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Uc}static setupDragIn(a,g,B,K=document){(g==null?void 0:g.pause)!==void 0&&(Zi.pauseDrag=g.pause),g={appendTo:"body",helper:"clone",...g||{}},(typeof a=="string"?zn.getElements(a,K):a).forEach((C,b)=>{Uc.isDraggable(C)||Uc.dragIn(C,g),B!=null&&B[b]&&(C.gridstackNode=B[b])})}movable(a,g){return this.opts.staticGrid?this:(Wi.getElements(a).forEach(B=>{const K=B.gridstackNode;K&&(g?delete K.noMove:K.noMove=!0,this.prepareDragDrop(K.el))}),this)}resizable(a,g){return this.opts.staticGrid?this:(Wi.getElements(a).forEach(B=>{const K=B.gridstackNode;K&&(g?delete K.noResize:K.noResize=!0,this.prepareDragDrop(K.el))}),this)}disable(a=!0){if(!this.opts.staticGrid)return this.enableMove(!1,a),this.enableResize(!1,a),this._triggerEvent("disable"),this}enable(a=!0){if(!this.opts.staticGrid)return this.enableMove(!0,a),this.enableResize(!0,a),this._triggerEvent("enable"),this}enableMove(a,g=!0){return this.opts.staticGrid?this:(a?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(B=>{this.prepareDragDrop(B.el),B.subGrid&&g&&B.subGrid.enableMove(a,g)}),this)}enableResize(a,g=!0){return this.opts.staticGrid?this:(a?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(B=>{this.prepareDragDrop(B.el),B.subGrid&&g&&B.subGrid.enableResize(a,g)}),this)}cancelDrag(){var a;const g=(a=this._placeholder)==null?void 0:a.gridstackNode;g&&(g._isExternal?(g._isAboutToRemove=!0,this.engine.removeNode(g)):g._isAboutToRemove&&Wi._itemRemoving(g.el,!1),this.engine.restoreInitial())}_removeDD(a){return Uc.draggable(a,"destroy").resizable(a,"destroy"),a.gridstackNode&&delete a.gridstackNode._initDD,delete a.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Uc.droppable(this.el,"destroy"),this;let a,g;const B=(K,C,b)=>{var t;b=b||C;const v=b.gridstackNode;if(!v)return;if(!((t=v.grid)!=null&&t.el)){b.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const x=b.getBoundingClientRect();b.style.left=x.x+(this.dragTransform.xScale-1)*(K.clientX-x.x)/this.dragTransform.xScale+"px",b.style.top=x.y+(this.dragTransform.yScale-1)*(K.clientY-x.y)/this.dragTransform.yScale+"px",b.style.transformOrigin="0px 0px"}let{top:u,left:e}=b.getBoundingClientRect();const w=this.el.getBoundingClientRect();e-=w.left,u-=w.top;const y={position:{top:u*this.dragTransform.xScale,left:e*this.dragTransform.yScale}};if(v._temporaryRemoved){if(v.x=Math.max(0,Math.round(e/g)),v.y=Math.max(0,Math.round(u/a)),delete v.autoPosition,this.engine.nodeBoundFix(v),!this.engine.willItFit(v)){if(v.autoPosition=!0,!this.engine.willItFit(v)){Uc.off(C,"drag");return}v._willFitPos&&(zn.copyPos(v,v._willFitPos),delete v._willFitPos)}this._onStartMoving(b,K,y,v,g,a)}else this._dragOrResize(b,K,y,v,g,a)};return Uc.droppable(this.el,{accept:K=>{const C=K.gridstackNode||this._readAttr(K,!1);if((C==null?void 0:C.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let b=!0;if(typeof this.opts.acceptWidgets=="function")b=this.opts.acceptWidgets(K);else{const t=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;b=K.matches(t)}if(b&&C&&this.opts.maxRow){const t={w:C.w,h:C.h,minW:C.minW,minH:C.minH};b=this.engine.willItFit(t)}return b}}).on(this.el,"dropover",(K,C,b)=>{let t=(b==null?void 0:b.gridstackNode)||C.gridstackNode;if((t==null?void 0:t.grid)===this&&!t._temporaryRemoved)return!1;if(t!=null&&t._sidebarOrig&&(t.w=t._sidebarOrig.w,t.h=t._sidebarOrig.h),t!=null&&t.grid&&t.grid!==this&&!t._temporaryRemoved&&t.grid._leave(C,b),b=b||C,g=this.cellWidth(),a=this.getCellHeight(!0),!t){const e=b.getAttribute("data-gs-widget")||b.getAttribute("gridstacknode");if(e){try{t=JSON.parse(e)}catch{console.error("Gridstack dropover: Bad JSON format: ",e)}b.removeAttribute("data-gs-widget"),b.removeAttribute("gridstacknode")}t||(t=this._readAttr(b)),t._sidebarOrig={w:t.w,h:t.h}}t.grid||(t.el||(t={...t}),t._isExternal=!0,b.gridstackNode=t);const v=t.w||Math.round(b.offsetWidth/g)||1,u=t.h||Math.round(b.offsetHeight/a)||1;return t.grid&&t.grid!==this?(C._gridstackNodeOrig||(C._gridstackNodeOrig=t),C.gridstackNode=t={...t,w:v,h:u,grid:this},delete t.x,delete t.y,this.engine.cleanupNode(t).nodeBoundFix(t),t._initDD=t._isExternal=t._temporaryRemoved=!0):(t.w=v,t.h=u,t._temporaryRemoved=!0),Wi._itemRemoving(t.el,!1),Uc.on(C,"drag",B),B(K,C,b),!1}).on(this.el,"dropout",(K,C,b)=>{const t=(b==null?void 0:b.gridstackNode)||C.gridstackNode;return t&&(!t.grid||t.grid===this)&&(this._leave(C,b),this._isTemp&&this.removeAsSubGrid(t)),!1}).on(this.el,"drop",(K,C,b)=>{var t,v,u;const e=(b==null?void 0:b.gridstackNode)||C.gridstackNode;if((e==null?void 0:e.grid)===this&&!e._isExternal)return!1;const w=!!this.placeholder.parentElement,y=C!==b;this.placeholder.remove(),delete this.placeholder.gridstackNode,w&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const x=C._gridstackNodeOrig;if(delete C._gridstackNodeOrig,w&&x!=null&&x.grid&&x.grid!==this){const n=x.grid;n.engine.removeNodeFromLayoutCache(x),n.engine.removedNodes.push(x),n._triggerRemoveEvent()._triggerChangeEvent(),n.parentGridNode&&!n.engine.nodes.length&&n.opts.subGridDynamic&&n.removeAsSubGrid()}if(!e||(w&&(this.engine.cleanupNode(e),e.grid=this),(t=e.grid)==null||delete t._isTemp,Uc.off(C,"drag"),b!==C?(b.remove(),C=b):C.remove(),this._removeDD(C),!w))return!1;const h=(u=(v=e.subGrid)==null?void 0:v.el)==null?void 0:u.gridstack;return zn.copyPos(e,this._readAttr(this.placeholder)),zn.removePositioningStyles(C),y&&(e.content||e.subGridOpts||Wi.addRemoveCB)?(delete e.el,C=this.addWidget(e)):(this._prepareElement(C,!0,e),this.el.appendChild(C),this.resizeToContentCheck(!1,e),h&&(h.parentGridNode=e),this._updateContainerHeight()),this.engine.addedNodes.push(e),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...K,type:"dropped"},x&&x.grid?x:void 0,e),!1}),this}static _itemRemoving(a,g){if(!a)return;const B=a?a.gridstackNode:void 0;!(B!=null&&B.grid)||a.classList.contains(B.grid.opts.removableOptions.decline)||(g?B._isAboutToRemove=!0:delete B._isAboutToRemove,g?a.classList.add("grid-stack-item-removing"):a.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const a=document.querySelector(this.opts.removable);return a?(!this.opts.staticGrid&&!Uc.isDroppable(a)&&Uc.droppable(a,this.opts.removableOptions).on(a,"dropover",(g,B)=>Wi._itemRemoving(B,!0)).on(a,"dropout",(g,B)=>Wi._itemRemoving(B,!1)),this):this}prepareDragDrop(a,g=!1){const B=a==null?void 0:a.gridstackNode;if(!B)return;const K=B.noMove||this.opts.disableDrag,C=B.noResize||this.opts.disableResize,b=this.opts.staticGrid||K&&C;if((g||b)&&(B._initDD&&(this._removeDD(a),delete B._initDD),b&&a.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!g))return this;if(!B._initDD){let t,v;const u=(y,x)=>{this.triggerEvent(y,y.target),t=this.cellWidth(),v=this.getCellHeight(!0),this._onStartMoving(a,y,x,B,t,v)},e=(y,x)=>{this._dragOrResize(a,y,x,B,t,v)},w=y=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete B._moving,delete B._resizing,delete B._event,delete B._lastTried;const x=B.w!==B._orig.w,h=y.target;if(!(!h.gridstackNode||h.gridstackNode.grid!==this)){if(B.el=h,B._isAboutToRemove){const n=a.gridstackNode.grid;n._gsEventHandler[y.type]&&n._gsEventHandler[y.type](y,h),n.engine.nodes.push(B),n.removeWidget(a,!0,!0)}else zn.removePositioningStyles(h),B._temporaryRemoved?(this._writePosAttr(h,B),this.engine.addNode(B)):this._writePosAttr(h,B),this.triggerEvent(y,h);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),y.type==="resizestop"&&(Number.isInteger(B.sizeToContent)&&(B.sizeToContent=B.h),this.resizeToContentCheck(x,B))}};Uc.draggable(a,{start:u,stop:w,drag:e}).resizable(a,{start:u,stop:w,resize:e}),B._initDD=!0}return Uc.draggable(a,K?"disable":"enable").resizable(a,C?"disable":"enable"),this}_onStartMoving(a,g,B,K,C,b){var t;if(this.engine.cleanNodes().beginUpdate(K),this._writePosAttr(this.placeholder,K),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=K,(t=K.grid)!=null&&t.el)this.dragTransform=zn.getValuesFromTransformedElement(a);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const v=this.placeholder.closest(".grid-stack");this.dragTransform=zn.getValuesFromTransformedElement(v)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(K.el=this.placeholder,K._lastUiPosition=B.position,K._prevYPix=B.position.top,K._moving=g.type==="dragstart",K._resizing=g.type==="resizestart",delete K._lastTried,g.type==="dropover"&&K._temporaryRemoved&&(this.engine.addNode(K),K._moving=!0),this.engine.cacheRects(C,b,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),g.type==="resizestart"){const v=this.getColumn()-K.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-K.y;Uc.resizable(a,"option","minWidth",C*Math.min(K.minW||1,v)).resizable(a,"option","minHeight",b*Math.min(K.minH||1,u)).resizable(a,"option","maxWidth",C*Math.min(K.maxW||Number.MAX_SAFE_INTEGER,v)).resizable(a,"option","maxWidthMoveLeft",C*Math.min(K.maxW||Number.MAX_SAFE_INTEGER,K.x+K.w)).resizable(a,"option","maxHeight",b*Math.min(K.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(a,"option","maxHeightMoveUp",b*Math.min(K.maxH||Number.MAX_SAFE_INTEGER,K.y+K.h))}}_dragOrResize(a,g,B,K,C,b){const t={...K._orig};let v,u=this.opts.marginLeft,e=this.opts.marginRight,w=this.opts.marginTop,y=this.opts.marginBottom;const x=Math.round(b*.1),h=Math.round(C*.1);if(u=Math.min(u,h),e=Math.min(e,h),w=Math.min(w,x),y=Math.min(y,x),g.type==="drag"){if(K._temporaryRemoved)return;const i=B.position.top-K._prevYPix;K._prevYPix=B.position.top,this.opts.draggable.scroll!==!1&&zn.updateScrollPosition(a,B.position,i);const d=B.position.left+(B.position.left>K._lastUiPosition.left?-e:u),s=B.position.top+(B.position.top>K._lastUiPosition.top?-y:w);t.x=Math.round(d/C),t.y=Math.round(s/b);const c=this._extraDragRow;if(this.engine.collide(K,t)){const f=this.getRow();let m=Math.max(0,t.y+K.h-f);this.opts.maxRow&&f+m>this.opts.maxRow&&(m=Math.max(0,this.opts.maxRow-f)),this._extraDragRow=m}else this._extraDragRow=0;if(this._extraDragRow!==c&&this._updateContainerHeight(),K.x===t.x&&K.y===t.y)return}else if(g.type==="resize"){if(t.x<0||(zn.updateScrollResize(g,a,b),t.w=Math.round((B.size.width-u)/C),t.h=Math.round((B.size.height-w)/b),K.w===t.w&&K.h===t.h)||K._lastTried&&K._lastTried.w===t.w&&K._lastTried.h===t.h)return;const i=B.position.left+u,d=B.position.top+w;t.x=Math.round(i/C),t.y=Math.round(d/b),v=!0}K._event=g,K._lastTried=t;const n={x:B.position.left+u,y:B.position.top+w,w:(B.size?B.size.width:K.w*C)-u-e,h:(B.size?B.size.height:K.h*b)-w-y};if(this.engine.moveNodeCheck(K,{...t,cellWidth:C,cellHeight:b,rect:n,resizing:v})){K._lastUiPosition=B.position,this.engine.cacheRects(C,b,w,e,y,u),delete K._skipDown,v&&K.subGrid&&K.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const i=g.target;K._sidebarOrig||this._writePosAttr(i,K),this.triggerEvent(g,i)}}triggerEvent(a,g){let B=this;for(;B.parentGridNode;)B=B.parentGridNode.grid;B._gsEventHandler[a.type]&&B._gsEventHandler[a.type](a,g)}_leave(a,g){g=g||a;const B=g.gridstackNode;if(!B||(g.style.transform=g.style.transformOrigin=null,Uc.off(a,"drag"),B._temporaryRemoved))return;B._temporaryRemoved=!0,this.engine.removeNode(B),B.el=B._isExternal&&g?g:a;const K=B._sidebarOrig;B._isExternal&&this.engine.cleanupNode(B),B._sidebarOrig=K,this.opts.removable===!0&&Wi._itemRemoving(a,!0),a._gridstackNodeOrig?(a.gridstackNode=a._gridstackNodeOrig,delete a._gridstackNodeOrig):B._isExternal&&this.engine.restoreInitial()}commit(){return Rse(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Wi.renderCB=(r,a)=>{r&&a!=null&&a.content&&(r.textContent=a.content)},Wi.resizeToContentParent=".grid-stack-item-content",Wi.Utils=zn,Wi.Engine=Bd,Wi.GDRev="12.3.2";const Dse=[{id:1,name:"Goles",isSelected:!1},{id:2,name:"Pases acertados",isSelected:!1},{id:23,name:"Tiros de Esquina",isSelected:!1},{id:3,name:"Balones recuperados en disputa",isSelected:!1},{id:4,name:"Asistencias",isSelected:!1},{id:5,name:"Participaciones en gol",isSelected:!1},{id:6,name:"Tiros a gol",isSelected:!1},{id:7,name:"Tiros a gol que llegaron a la portería",isSelected:!1},{id:8,name:"Cabeceos en área rival",isSelected:!1},{id:9,name:"Cabeceos en área propia",isSelected:!1},{id:10,name:"Centros",isSelected:!1},{id:11,name:"Centros acertados",isSelected:!1},{id:12,name:"1vs1 exitosos ofensivos",isSelected:!1},{id:13,name:"1vs1 exitosos ofensivos que terminaron en gol",isSelected:!1},{id:14,name:"1vs1 defensivos exitoso",isSelected:!1},{id:15,name:"Rechaces",isSelected:!1},{id:16,name:"Balones ganados en área propia",isSelected:!1},{id:17,name:"Balones ganados en área rival",isSelected:!1},{id:18,name:"Faltas cometidas",isSelected:!1},{id:19,name:"Faltas recibidas",isSelected:!1},{id:20,name:"Tarjetas amarillas",isSelected:!1},{id:21,name:"Tarjetas rojas",isSelected:!1},{id:22,name:"Atajadas",isSelected:!1},{id:24,name:"Oportunidades de gol",isSelected:!1},{id:25,name:"Balones recuperados en cancha rival",isSelected:!1}],Vd=r=>Dse.find(a=>a.id===r),Fd=new Map([[9,{id:9,analysisTypes:new Map([["2-20",{analysisType:"successfulPasses",name:"Pases acertados",title:"Mapeo de pases acertados",titleShort:"Pases acertados"}],["3-21",{analysisType:"unsuccessfulPasses",name:"Pases no acertados",title:"Mapeo de pases no acertados",titleShort:"Pases no acertados"}],["222-223-224-225",{analysisType:"recoveredBalls",name:"Balones recuperados",title:"Mapeo de balones recuperados",titleShort:"Balones recuperados"}],["226-227-228-229",{analysisType:"lostBalls",name:"Balones perdidos",title:"Mapeo de balones perdidos",titleShort:"Balones perdidos"}]])}],[1,{general:"General",offensive:"Ofensivo",defensive:"Defensivo",possession:"Posesión",stoppedBall:"Balón parado",penalties:"Infracción"}]]);class Up{constructor(a,g=[],B,K=null,C=!1,b=!1,t=null,v=null){ud(this,"id",""),ud(this,"childViews",[]),ud(this,"viewId",0),ud(this,"dynamicFilters",null),ud(this,"componentSpecificFilters",new Map),ud(this,"isPostMatch",!1),ud(this,"isTemplateMode",!1),ud(this,"filtresJSON",null),ud(this,"token",null),ud(this,"_isUpdating",!1),this.id=a,this.viewId=B,this.childViews=g,this.dynamicFilters=K,this.isPostMatch=C,this.isTemplateMode=b,this.filtresJSON=t,this.token=v,this.componentSpecificFilters=new Map}resetClass(){this.childViews.forEach(a=>{a.view.filterAndViewsContainer=new Up(this.id,[a],this.viewId,this.dynamicFilters,this.isPostMatch,this.isTemplateMode,this.filtresJSON,this.token)})}hasEventTypeId(a,g){return!a||!Array.isArray(a)?!1:a.some(B=>B&&B.event_type_id===g)}hasCategoryId(a,g){return!a||!Array.isArray(a)?!1:a.some(B=>B&&B.category_id===g)}getId(){return this.id}setViewId(a){this.viewId=a}setFiltersJSON(a){this.filtresJSON=a}setDynamicFilters(a,g=null){console.log("???????????????????????????????????????????????????????????? SET O UPDATE DYNAMIC FILTERS ????????????????????????????????????????????????????????????",a,g),g?this.componentSpecificFilters.set(g,[...a]):this.dynamicFilters=a}getComponentDynamicFilters(a){return a&&this.componentSpecificFilters.has(a)?this.componentSpecificFilters.get(a):this.dynamicFilters}getAllComponentFilters(){return this.componentSpecificFilters}debugComponentFilters(){this.componentSpecificFilters.forEach((a,g)=>{console.log(` Component ${g}:`,a)})}static debugAllComponentFilters(){document.querySelectorAll("[data-container-id]").forEach(a=>{a.getAttribute("data-container-id")})}clearAllComponentFilters(){this.componentSpecificFilters.clear()}getDynamicFilters(){return this.dynamicFilters}getHomeTeamViews(){return this.childViews.filter(a=>a.view.isHomeTeam)}getAwayTeamViews(){return this.childViews.filter(a=>!a.view.isHomeTeam)}addView(a,g=!1){var B,K,C,b,t,v,u,e,w,y;if(a.view.filterAndViewsContainer=this,Ai.emit("component-added-to-container",this),this.viewId===5&&a.view.componentProps&&!g&&(a.view.componentProps.preMatchType=this.dynamicFilters[0]!==3&&this.dynamicFilters[0]||1,a.view.filterMultiple={isHomeTeam:a.view.componentProps.preMatchType===1}),this.viewId===10&&a.view.componentProps&&!g&&(a.view.componentProps.isHomeTeamForAnalysis=this.dynamicFilters[0]!==3?this.dynamicFilters[0]===1:1),this.viewId===7&&a.view.componentProps&&!g){const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const n=h[0]===1?"offensive":"defensive",i=h[1]===1;a.view.componentProps.analysisType=n,a.view.componentProps.isHomeTeamForAnalysis=i,a.isHomeTeam=i,a.view.filterMultiple={isHomeTeam:i},Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:h})}if(this.viewId===1&&a.view.componentProps&&!g){const x=this.dynamicFilters[0]||[];if(x&&x.length>0){let h;if(Array.isArray(x)){const i=this.childViews.map(s=>{var c;return(c=s.view.componentProps)==null?void 0:c.type}).filter(s=>s!==void 0),d=x.filter(s=>!i.includes(s));d.length>0?h=d[0]:h=x[0]}else h=x;const n=Fd.get(this.viewId);a.view.componentProps.type=h,a.view.componentProps.default=!1,a.view.title=`Comparativa ${n[h]}`,a.view.filterMultiple={category:h}}}if(this.viewId===9&&a.view.componentProps&&!g){const x=this.dynamicFilters[0].map(d=>d.join("-"));let h="";const n=this.dynamicFilters[1],i=Fd.get(this.viewId);if(n===3){this.getHomeTeamViews().length===0&&this.getAwayTeamViews().length>0&&this.getAwayTeamViews().forEach(m=>{m.view.componentProps.isHomeTeamForAnalysis=!0,m.view.isHomeTeam=!0,m.view.filterMultiple&&(m.view.filterMultiple.isHomeTeam=!0)});let d=null;const s=this.getHomeTeamViews(),c=this.getAwayTeamViews();let f=!0;for(let m=0;m<x.length;m++){h=x[m],d=i.analysisTypes.get(x[m]);const T=s.find(S=>S.view.componentProps.analysisType===d.analysisType),E=c.find(S=>S.view.componentProps.analysisType===d.analysisType);if(!T||!E){f=!T;break}}f?this.childViews.length===0?(a.view.componentProps.analysisType=d.analysisType,a.view.componentProps.isHomeTeamForAnalysis=!0,a.view.title=d.title,a.view.titleShort=d.titleShort,a.view.isHomeTeam=!0,a.view.filterMultiple={isHomeTeam:a.view.isHomeTeam,categoryIds:h.split("-").map(m=>parseInt(m))}):this.childViews.reduce((m,T,E,S)=>{let L={analysisType:T.view.componentProps.analysisType,title:T.view.title,isHomeTeamForAnalysis:T.view.componentProps.isHomeTeamForAnalysis,isHomeTeam:T.view.isHomeTeam};return m&&(m.isHomeTeam&&!T.view.isHomeTeam?(T.view.componentProps.analysisType=d.analysisType,T.view.componentProps.isHomeTeamForAnalysis=!0,T.view.title=d.title,a.view.titleShort=d.titleShort,T.view.isHomeTeam=!0,T.view.filterMultiple={isHomeTeam:T.view.isHomeTeam,categoryIds:h.split("-").map(N=>parseInt(N))}):!m.isHomeTeam&&!T.view.isHomeTeam&&(T.view.componentProps.analysisType=m.analysisType,T.view.componentProps.isHomeTeamForAnalysis=m.isHomeTeamForAnalysis,T.view.title=m.title,T.view.titleShort=m.titleShort,T.view.isHomeTeam=m.isHomeTeam,T.view.filterMultiple={isHomeTeam:T.view.isHomeTeam,categoryIds:h.split("-").map(N=>parseInt(N))}),E===S.length-1&&(a.view.componentProps.analysisType=L.analysisType,a.view.componentProps.isHomeTeamForAnalysis=L.isHomeTeamForAnalysis,a.view.title=L.title,a.view.titleShort=L.titleShort,a.view.isHomeTeam=L.isHomeTeam,a.view.filterMultiple={isHomeTeam:a.view.isHomeTeam,categoryIds:h.split("-").map(N=>parseInt(N))})),L},null):(a.view.componentProps.analysisType=d.analysisType,a.view.componentProps.isHomeTeamForAnalysis=!1,a.view.title=d.title,a.view.titleShort=d.titleShort,a.view.isHomeTeam=!1,a.view.filterMultiple={isHomeTeam:a.view.isHomeTeam,categoryIds:h.split("-").map(m=>parseInt(m))})}else{const d=n===1,s=d?this.getHomeTeamViews():this.getAwayTeamViews();a.view.componentProps.isHomeTeamForAnalysis=d,a.view.isHomeTeam=d;for(let c=0;c<x.length;c++){const f=i.analysisTypes.get(x[c]);if(!s.find(m=>m.view.componentProps.analysisType===f.analysisType)){a.view.componentProps.analysisType=f.analysisType,a.view.title=f.title,a.view.titleShort=f.titleShort,a.view.filterMultiple={categoryIds:x[c].split("-").map(m=>parseInt(m)),isHomeTeam:a.view.isHomeTeam};break}}}}if(this.viewId===2&&!g&&a.view.componentProps){const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&(this.setDynamicFilters(this.dynamicFilters,a.view.id),console.log(`GscTopPlayer - initialized specific filters for component ${a.view.id} with default filters:`,this.dynamicFilters)),a.view.componentProps.game&&(a.view.componentProps.gameid=a.view.componentProps.game.id,a.view.componentProps.season=a.view.componentProps.game.season_id,a.view.componentProps.teamView=h[1]===2?a.view.componentProps.game.awayTeam.team_id:h[1]===1?a.view.componentProps.game.homeTeam.team_id:0);const n=this.dynamicFilters[0]||[];let i=null;if(Array.isArray(n)){if(n.length>0){const c=this.childViews.map(m=>{var T;const E=(T=m.view.componentProps)==null?void 0:T.categoryView;return E&&E.length>0?E[0].id:null}).filter(m=>m!==null),f=n.filter(m=>!c.includes(m));console.log("GSCtops addView (array mode) - existingCategories:",c),console.log("GSCtops addView (array mode) - categoriesWithoutComponent:",f),f.length>0?i=f[0]:console.log("GSCtops addView (array mode) - all categories already have components")}}else{const c=n;c&&(this.childViews.find(f=>{var m;const T=(m=f.view.componentProps)==null?void 0:m.categoryView;return T&&T.length>0&&T[0].id===c})?console.log("GSCtops addView (single mode) - component already exists, skipping creation"):i=c)}let d=null;if(i)try{d=Vd(i)}catch(c){console.warn("Error getting category by ID:",c)}const s=h&&h.length>1?h[1]:1;a.view.filterMultiple={categoryId:i,teamType:s},a.view.componentProps.categoryView=d?[{id:i,name:d.name}]:i?[{id:i,name:`Category ${i}`}]:[{id:0,name:"Category"}]}if(this.viewId===8&&a.view.componentProps&&!g&&a.view.game&&(a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0),a.view.componentProps.areInactiveVisible=this.dynamicFilters[0]||!1,a.view.componentProps.game=(B=a.view)==null?void 0:B.game,a.view.componentProps.teamSelected={teamId:(C=(K=a.view)==null?void 0:K.game)==null?void 0:C.home_team},a.view.componentProps.isDefault=!1,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:this.dynamicFilters})),this.viewId===6&&a.view.componentProps&&!g){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;console.log("6666666666666666666666666666666666666666666666666666666666666666666666666666666"),console.log("this.dynamicFilters",this.dynamicFilters),console.log("componentSpecificFilters",x),console.log("filtersToUse",h),!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const n=h&&h.length>0?h[0]:[];if(console.log("gamesToShow",n),n&&n.length>0){let i=0;for(const d of n)if(!this.childViews.find(s=>s.view.componentProps.gameNumber!==d)){i=d;break}console.log("************************************************** newGameNumberToShow: ",i),i&&(console.log("2 ************************************************** newGameNumberToShow: entro",i),a.view.componentProps.gameNumber=i,a.view.filterMultiple={gameNumber:i})}console.log(" /////////---------------------------------------> ",a.view.filterMultiple),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:h})}if(this.viewId===3&&a.view.componentProps&&!g&&a.view.game){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const n=h&&h.length>0?h[0]:!1;a.view.componentProps.desplegable=n,a.view.componentProps.key=n,a.view.componentProps.game=(b=a.view)==null?void 0:b.game,a.view.componentProps.defaultShields=!1,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:h})}if(this.viewId===4&&(console.log("TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE"),console.log("*********************** *********************** this.token *********************** *********************** ",this.token),a.view.componentProps&&!g&&a.view.game)){if(a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0),this.isPostMatch){a.view.componentProps.key=!1,a.view.componentProps.isDefault=!1,a.view.componentProps.token=this.token,a.view.componentProps.gameId=(v=(t=a.view)==null?void 0:t.game)==null?void 0:v.game_id,a.view.componentProps.homeTeam=(e=(u=a.view)==null?void 0:u.game)==null?void 0:e.home_team,a.view.componentProps.awayTeam=(y=(w=a.view)==null?void 0:w.game)==null?void 0:y.visiting_team;const n=this.getComponentDynamicFilters(a.view.id),i=n||this.dynamicFilters;!n&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const d=i&&i.length>0?i[0]:[],s=this.hasEventTypeId(d,1),c=this.hasCategoryId(d,8),f=this.hasCategoryId(d,9),m=this.hasEventTypeId(d,3);console.log("Timeline - Events check:",{goals:s,yellowCards:c,redCards:f,substitutions:m,selectedEvents:d,componentId:a.view.id,usingSpecificFilters:!!n}),a.view.componentProps.goals=s,a.view.componentProps.yellowCards=c,a.view.componentProps.redCards=f,a.view.componentProps.substitutions=m}const x=this.getComponentDynamicFilters(a.view.id)||this.dynamicFilters,h=x&&x.length>0?x[0]:[];a.view.componentProps.selectedEvents=h,a.view.componentProps.key=h.length>0,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:x})}this.childViews.push(a),Ai.emit("view-added"),console.log("this.childViews",this.childViews)}getHowManyViewsToAdd(a){if(this.viewId===5)return 1;if(this.viewId===6){const g=a[0];return g===2||g===3?g:1}if(this.viewId===4){const g=a&&a.length>0&&Array.isArray(a[0])&&a[0].length>0,B=this.childViews.length===0&&g;return console.log("Timeline getHowManyViewsToAdd:",{hasSelectedEvents:g,childViewsLength:this.childViews.length,shouldAdd:B,dynamicFilters:a}),g?1:0}if(this.viewId===9){const g=a[0],B=a[1];if(B===1||B===2){const K=B===1?this.getHomeTeamViews():this.getAwayTeamViews();return g.length-K.length}else return g*2-(this.getHomeTeamViews().length+this.getAwayTeamViews().length)}if(this.viewId===2){const g=a[0]||[],B=a[1]||1;if(console.log("GSCtops getHowManyViewsToAdd - categoriesIdsSelected:",g),console.log("GSCtops getHowManyViewsToAdd - teamType:",B),console.log("GSCtops getHowManyViewsToAdd - childViews.length:",this.childViews.length),!g||g.length===0)return 0;if(Array.isArray(g)){const K=this.childViews.map(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;return v&&v.length>0?v[0].id:null}).filter(b=>b!==null),C=g.filter(b=>!K.includes(b));return console.log("GSCtops getHowManyViewsToAdd (array mode) - existingCategories:",K),console.log("GSCtops getHowManyViewsToAdd (array mode) - categoriesWithoutComponent:",C),C.length}else{const K=g,C=this.childViews.find(b=>{var t,v;const u=(t=b.view.componentProps)==null?void 0:t.categoryView,e=((v=b.view.filterMultiple)==null?void 0:v.teamType)||1;return u&&u.length>0&&u[0].id===K&&e===B});return console.log("GSCtops getHowManyViewsToAdd (edit mode) - categoryId:",K),console.log("GSCtops getHowManyViewsToAdd (edit mode) - teamType:",B),console.log("GSCtops getHowManyViewsToAdd (edit mode) - existingComponent:",C),C?0:1}}if(this.viewId===1){const g=a[0]||[];if(console.log("GSCComparativeReports getHowManyViewsToAdd - selectedAnalysisTypes:",g),console.log("GSCComparativeReports getHowManyViewsToAdd - childViews.length:",this.childViews.length),!g||g.length===0)return 0;if(Array.isArray(g)){const B=this.childViews.map(C=>{var b;return(b=C.view.componentProps)==null?void 0:b.type}).filter(C=>C!==void 0),K=g.filter(C=>!B.includes(C));return console.log("GSCComparativeReports getHowManyViewsToAdd (array mode) - existingTypes:",B),console.log("GSCComparativeReports getHowManyViewsToAdd (array mode) - typesWithoutComponent:",K),K.length}else{const B=g,K=this.childViews.find(C=>{var b;return((b=C.view.componentProps)==null?void 0:b.type)===B});return console.log("GSCComparativeReports getHowManyViewsToAdd (edit mode) - analysisType:",B),console.log("GSCComparativeReports getHowManyViewsToAdd (edit mode) - existingComponent:",K),K?0:1}}return 0}getRequiresAddView(a){if(console.log("getRequiresAddView",this.viewId,a),this.viewId===5)return console.log("this.childViews:",this.childViews),a[0]===3?this.childViews.length<2:this.childViews.length===0;if(this.viewId===10)return a[0]===3?this.childViews.length<2:this.childViews.length===0;if(this.viewId===7)return a[1]===3?this.childViews.length<2:this.childViews.length===0;if(this.viewId===6){const g=a[0];return g?g.length>this.childViews.length:this.childViews.length===0}if(this.viewId===4){const g=a&&a.length>0&&Array.isArray(a[0])&&a[0].length>0,B=this.childViews.length===0&&g;return console.log("Timeline getRequiresAddView:",{hasSelectedEvents:g,childViewsLength:this.childViews.length,shouldAdd:B,dynamicFilters:a}),B}if(this.viewId===9)return this.getRequiresAddViewMultipleAndBothTeams(a);if(this.viewId===1){const g=a[0]||[];if(console.log("GSCComparativeReports getRequiresAddView - selectedAnalysisTypes:",g),console.log("GSCComparativeReports getRequiresAddView - childViews.length:",this.childViews.length),!g||g.length===0)return!1;if(Array.isArray(g)){const B=this.childViews.map(b=>{var t;return(t=b.view.componentProps)==null?void 0:t.type}).filter(b=>b!==void 0),K=g.filter(b=>!B.includes(b));console.log("GSCComparativeReports getRequiresAddView (array mode) - existingTypes:",B),console.log("GSCComparativeReports getRequiresAddView (array mode) - typesWithoutComponent:",K);const C=K.length>0;return console.log("GSCComparativeReports getRequiresAddView (array mode) - shouldAdd:",C),C}else{const B=g,K=this.childViews.find(b=>{var t;return((t=b.view.componentProps)==null?void 0:t.type)===B});console.log("GSCComparativeReports getRequiresAddView (edit mode) - analysisType:",B),console.log("GSCComparativeReports getRequiresAddView (edit mode) - existingComponent:",K);const C=!K;return console.log("GSCComparativeReports getRequiresAddView (edit mode) - shouldAdd:",C),C}}if(this.viewId===2){const g=a[0]||[];if(console.log("2222222222222222222222222222222222222222222222222222222222"),console.log(""),Array.isArray(g)){if(g.length>0){const B=this.childViews.map(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;return v&&v.length>0?v[0].id:null}).filter(b=>b!==null),K=g.filter(b=>!B.includes(b));console.log("GSCtops getRequiresAddView (array mode) - existingCategories:",B),console.log("GSCtops getRequiresAddView (array mode) - categoriesWithoutComponent:",K);const C=K.length>0;return console.log("GSCtops getRequiresAddView (array mode) - shouldAdd:",C),C}return!1}else{const B=g,K=a[1]||1;if(B){const C=this.childViews.find(t=>{var v,u;const e=(v=t.view.componentProps)==null?void 0:v.categoryView,w=((u=t.view.filterMultiple)==null?void 0:u.teamType)||1;return e&&e.length>0&&e[0].id===B&&w===K});console.log("GSCtops getRequiresAddView (single mode) - categoryId:",B,"teamType:",K),console.log("GSCtops getRequiresAddView (single mode) - existingComponent:",C);const b=!C;return console.log("GSCtops getRequiresAddView (single mode) - shouldAdd:",b),b}return!1}}return this.viewId===8||this.viewId===3?this.childViews.length===0:!1}getRequiresAddViewMultipleAndBothTeams(a){console.log("*******************************************************"),console.log("dynamicFilters",a);const g=this.childViews.filter(v=>v.view.isHomeTeam),B=this.childViews.filter(v=>!v.view.isHomeTeam),K=a[0].length,C=a[1],b=K*(C===1||C===2?1:2),t=C===3?g.length+B.length:g.length||B.length;return b>t}getRequiresLessViews(a){if(this.viewId===5)return a[0]!==3&&this.childViews.length>1;if(this.viewId===6){const g=a[0];return g===2||g===3}return this.viewId,!1}updateSummary({dynamicFilters:a}){const g=this.childViews[0],B=document.querySelector(`[gs-id="${g.view.id}"]`),K=g.grid;if(g&&B&&K){const C=a[0],b=`min_column${C?"_2":""}`,t=`min_row${C?"_2":""}`,v=`max_column${C?"_2":""}`,u=`max_row${C?"_2":""}`,e=`colspan${C?"_2":""}`,w=`rowspan${C?"_2":""}`,y=g.view.coreView[e],x=g.view.coreView[w],h=g.view.coreView[b],n=g.view.coreView[t],i=g.view.coreView[v],d=g.view.coreView[u];g.view.w=y,g.view.h=x,g.view.maxWidth=i,g.view.maxHeight=d,g.view.minWidth=h,g.view.minHeight=n,B.setAttribute("gs-w",y),B.setAttribute("gs-h",x),B.setAttribute("gs-max-w",i),B.setAttribute("gs-max-h",d),B.setAttribute("gs-min-w",h),B.setAttribute("gs-min-h",n),console.log("childView.view",g.view),K.update(B,{h:x,w:y,"gs-max-h":d,"gs-max-w":i,"gs-min-h":n,"gs-min-w":h})}}updateDynamicFilters(a,g=null){if(this._isUpdating){console.log("Skipping updateDynamicFilters due to update in progress");return}this._isUpdating=!0,g?(this.componentSpecificFilters.set(g,[...a]),console.log(`Updated specific filters for component ${g}:`,a)):this.dynamicFilters=a,Ai.emit("component-added-to-container",this);try{if(this.viewId===5){const B=a[0]||1;if(B<3)if(this.childViews.length===1){const K=this.childViews[0];K.view.componentProps&&(K.view.componentProps.preMatchType=B,K.view.filterMultiple={isHomeTeam:K.view.componentProps.preMatchType===1})}else{const K=this.childViews.pop(),C=K.grid,b=K.page,t=document.querySelector(`[gs-id="${K.view.id}"]`);if(C&&t&&(C.removeWidget(t),b)){const u=b.items.findIndex(e=>e.id===K.view.id);u!==-1&&b.items.splice(u,1)}const v=this.childViews[0];v.view.componentProps&&(v.view.componentProps.preMatchType=B,v.view.filterMultiple={isHomeTeam:v.view.componentProps.preMatchType})}else this.childViews.forEach((K,C)=>{K.view.componentProps.preMatchType=C+1,K.view.filterMultiple={isHomeTeam:K.view.componentProps.preMatchType}})}if(this.viewId===10){const B=a[0]||1;if(B<3)if(this.childViews.length===1){const K=this.childViews[0];K.view.componentProps&&(K.view.componentProps.isHomeTeamForAnalysis=B===1)}else{const K=this.childViews.pop(),C=K.grid,b=K.page,t=document.querySelector(`[gs-id="${K.view.id}"]`);if(C&&t&&(C.removeWidget(t),b)){const u=b.items.findIndex(e=>e.id===K.view.id);u!==-1&&b.items.splice(u,1)}const v=this.childViews[0];v.view.componentProps&&(v.view.componentProps.isHomeTeamForAnalysis=B===1)}else this.childViews.forEach((K,C)=>{K.view.componentProps.isHomeTeamForAnalysis=C%2===0})}if(this.viewId===7){const B=a[1];if(B===3)this.childViews.forEach((K,C)=>{K.view.componentProps.isHomeTeamForAnalysis=C%2===0,K.view.isHomeTeam=C%2===0,K.view.componentProps.analysisType=this.dynamicFilters[0]===1?"offensive":"defensive",K.view.filterMultiple={isHomeTeam:K.view.isHomeTeam}});else{const K=B===1;if(this.childViews.length>0){const C=this.childViews[0];C.view.componentProps.isHomeTeamForAnalysis=K,C.view.isHomeTeam=K,C.view.componentProps.analysisType=this.dynamicFilters[0]===1?"offensive":"defensive",C.view.filterMultiple={isHomeTeam:K},this.childViews.length>1&&this.removeChildView(this.childViews[1])}}}if(this.viewId===9){const B=a[0],K=a[1];if(console.log("---------------->>>> CANCHA DE ZONAS: ",B,K),K===3){if(this.childViews.length>B.length){const C=B.map(b=>{const t=b.join("-");return Fd.get(this.viewId).analysisTypes.get(t).analysisType});this.childViews.reduce((b,t)=>(C.includes(t.view.componentProps.analysisType)||b.push(t.view.componentProps.analysisType),b),[]).forEach(b=>{const t=this.childViews.findIndex(v=>v.view.componentProps.analysisType===b);if(t!==-1){const v=this.childViews[t];this.removeChildView(v)}})}}else{const C=K===1,b=this.getHomeTeamViews(),t=this.getAwayTeamViews();if(console.log("---------------->>>> CUANDO CANCHA DE ZONAS NO ELEJIO AMBOS: ",C),console.log("---------------->>>> homeTeamViews: ",b),console.log("---------------->>>> awayTeamViews: ",t),C&&b.length===0)console.log("---------------->>>> escenario 1: "),t.forEach(v=>{v.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}});else if(!C&&t.length===0)console.log("---------------->>>> escenario 2: "),b.forEach(v=>{v.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}});else if(b.length===t.length)console.log("---------------->>>> escenario 3: "),C||b.forEach(v=>{v.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}}),(C?t:b).forEach(v=>{this.removeChildView(v)});else{console.log("---------------->>>> escenario 4: ");const v=C?this.getHomeTeamViews():this.getAwayTeamViews();if(v.length>B.length){console.log("---------------->>>> escenario 4: eliminando vistas excedentes");const u=B.map(e=>{const w=e.join("-");return Fd.get(this.viewId).analysisTypes.get(w).analysisType});v.forEach(e=>{u.includes(e.view.componentProps.analysisType)?e.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}:this.removeChildView(e)})}else v.forEach(u=>{u.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}})}}}if(this.viewId===2){const B=a[0]||[];if(Array.isArray(B)){const K=this.childViews.map(C=>{var b,t;const v=(b=C.view.componentProps)==null?void 0:b.categoryView,u=((t=C.view.filterMultiple)==null?void 0:t.teamType)||1,e=v&&v.length>0?v[0].id:null;return e?{categoryId:e,teamType:u,viewId:C.view.id}:null}).filter(C=>C!==null);if(g){const C=this.childViews.find(b=>b.view.id===g);if(C){const b=a[1]||1,t=B[0];if(t){let v=null;try{v=Vd(t)}catch(u){console.warn("Error getting category by ID:",u)}C.view.filterMultiple={categoryId:t,teamType:b},C.view.componentProps.game&&(b===1?C.view.componentProps.teamView=C.view.componentProps.game.homeTeam.team_id:b===2?C.view.componentProps.teamView=C.view.componentProps.game.awayTeam.team_id:C.view.componentProps.teamView=0),C.view.componentProps.categoryView=v?[{id:t,name:v.name}]:[{id:t,name:`Category ${t}`}]}}}if(!g){const C=a[1]||1;this.childViews.forEach(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;if(v&&v.length>0){const u=v[0].id;B.includes(u)&&(b.view.filterMultiple={categoryId:u,teamType:C})}})}if(K.map(C=>C.categoryId).filter(C=>!B.includes(C)).forEach(C=>{this.childViews.filter(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;return v&&v.length>0&&v[0].id===C}).forEach(b=>{this.removeChildView(b),Ai.emit("component-removed",{viewId:b.view.id,categoryId:C})})}),g){const C=B[0];if(C){const b=this.childViews.find(t=>t.view.id===g);if(b){let t=null;try{t=Vd(C)}catch(u){console.warn("Error getting category by ID:",u)}const v=a[1]||1;b.view.filterMultiple={categoryId:C,teamType:v},b.view.componentProps.game&&(b.view.componentProps.teamView=v===2?b.view.componentProps.game.awayTeam.team_id:v===1?b.view.componentProps.game.homeTeam.team_id:0),b.view.componentProps.categoryView=t?[{id:C,name:t.name}]:[{id:C,name:`Category ${C}`}]}}}}else{const K=B;if(K&&g){const C=this.childViews.find(b=>b.view.id===g);if(C){let b=null;try{b=Vd(K)}catch(v){console.warn("Error getting category by ID:",v)}const t=a[1]||1;C.view.filterMultiple={categoryId:K,teamType:t},C.view.componentProps.game&&(C.view.componentProps.teamView=t===2?C.view.componentProps.game.awayTeam.team_id:t===1?C.view.componentProps.game.homeTeam.team_id:0),C.view.componentProps.categoryView=b?[{id:K,name:b.name}]:[{id:K,name:`Category ${K}`}]}}}}if(this.viewId===8){const B=a[0]||!1;this.childViews.forEach(K=>{K.view.componentProps&&(K.view.componentProps._isReactive||(K.view.componentProps=p.reactive(K.view.componentProps),K.view.componentProps._isReactive=!0),K.view.componentProps.areInactiveVisible=B,K.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:K.view.id,componentProps:K.view.componentProps,dynamicFilters:a}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:K.view.id,dynamicFilters:a}))})}if(this.viewId===1){const B=a[0]||[];if(console.log("GSCComparativeReports updateDynamicFilters - selectedAnalysisTypes:",B),console.log("GSCComparativeReports updateDynamicFilters - componentId:",g),g){console.log(`GSCComparativeReports - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const K=this.childViews.find(C=>C.view.id===g);K&&this.updateComparative(K,a)}else if(console.log("GSCComparativeReports - updating all components with global filters"),Array.isArray(B))console.log("GSCComparativeReports updateDynamicFilters (array mode) - skipping removal logic to prevent cross-page deletions"),this.childViews.length>0&&B.length>0&&this.childViews.forEach((K,C)=>{if(K.view.componentProps&&C<B.length){const b=B[C],t=Fd.get(this.viewId);K.view.componentProps.type=b,K.view.componentProps.default=!1,K.view.title=`Comparativa ${t[b]}`,K.view.filterMultiple={category:b},console.log(`GSCComparativeReports updateDynamicFilters - updated component ${C} with type:`,b)}});else{const K=B;if(K&&this.childViews.length>0){const C=this.childViews[0];if(C.view.componentProps){const b=Fd.get(this.viewId);C.view.componentProps.type=K,C.view.componentProps.default=!1,C.view.title=`Comparativa ${b[K]}`,C.view.filterMultiple={category:K}}}}console.log("-------------------------------------------------------------"),console.log("childViews",this.childViews)}if(this.viewId===6){const B=a[0]||[];if(g){console.log(`GSCLineupsReports - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const K=this.childViews.find(C=>C.view.id===g);K&&this.updateGSCLineupsReports(K,a)}else console.log("GSCLineupsReports - updating all components with global filters"),Array.isArray(B)&&B.length>0&&this.childViews.reduce((K,C)=>(B.includes(C.view.componentProps.gameNumber)||K.push(C.view.componentProps.gameNumber),K),[]).forEach(K=>{const C=this.childViews.findIndex(b=>b.view.componentProps.gameNumber===K);if(C!==-1){for(let b=C;b<this.childViews.length;b++){const t=this.childViews[b+1],v=this.childViews[b];t&&(v.view.componentProps.gameNumber=t.view.componentProps.gameNumber,v.view.filterMultiple={gameNumber:t.view.componentProps.gameNumber})}this.removeChildView(this.childViews[this.childViews.length-1])}}),this.childViews.forEach(K=>{K.view.componentProps&&(K.view.componentProps._isReactive||(K.view.componentProps=p.reactive(K.view.componentProps),K.view.componentProps._isReactive=!0),Ai.emit("component-props-updated",{viewId:K.view.id,componentProps:K.view.componentProps,dynamicFilters:a}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:K.view.id,dynamicFilters:a}))})}if(this.viewId===3){if(console.log("GSCMatchSummary updateDynamicFilters:",{dynamicFilters:a,componentId:g,childViewsLength:this.childViews.length}),g){console.log(`GSCMatchSummary - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const B=this.childViews.find(K=>K.view.id===g);B&&this.updateMatchSummary(B,a)}else{console.log("GSCMatchSummary - updating all components with global filters");const B=a[0]||!1;this.childViews.forEach(K=>{K.view.componentProps&&(K.view.componentProps._isReactive||(K.view.componentProps=p.reactive(K.view.componentProps),K.view.componentProps._isReactive=!0),K.view.componentProps.desplegable=B,K.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:K.view.id,componentProps:K.view.componentProps,dynamicFilters:a}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:K.view.id,dynamicFilters:a}))})}this.updateSummary({dynamicFilters:a})}if(this.viewId===4){const B=a&&a.length>0&&Array.isArray(a[0])&&a[0].length>0;if(console.log("Timeline updateDynamicFilters:",{hasSelectedEvents:B,childViewsLength:this.childViews.length,dynamicFilters:a,componentId:g}),g){console.log(`Timeline - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const K=this.childViews.find(C=>C.view.id===g);K&&this.updateTimeline(K,a)}else if(console.log("Timeline - updating all components with global filters"),!B&&this.childViews.length>0)console.log("Timeline - removing views due to no events"),this.childViews.forEach(K=>{this.removeChildView(K)});else if(B&&this.childViews.length===0){console.log("Timeline - emitting add-view event");const K={pageId:null,view:{id:this.viewId,name:"Timeline",title:"Timeline",colspan:12,rowspan:6,max_column:12,max_row:12,min_column:6,min_row:4},filterAndWidgetContainer:this};Ai.emit("add-view",K)}else this.childViews.forEach(K=>{this.updateTimeline(K,a)})}console.log("updateDynamic filters completed successfullyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"),console.log("this.childViews",this.childViews)}finally{this._isUpdating=!1}}removeAllChildViews(){[...this.childViews].forEach(a=>{this.removeChildView(a)})}removeChildView(a,g=!1){const B=this.childViews.findIndex(K=>K.view.id===a.view.id);if(B!==-1){const K=this.childViews[B];this.childViews.splice(B,1),K.view.id&&(this.componentSpecificFilters.delete(K.view.id),console.log(`Cleaned specific filters for component ${K.view.id}`));const C=K.grid,b=K.page,t=document.querySelector(`[gs-id="${K.view.id}"]`);if(C&&t&&(C.removeWidget(t),b&&!g)){const v=b.items.findIndex(u=>u.id===K.view.id);v!==-1&&(b.items.splice(v,1),b.items.length===0&&Ai.emit("empty-page",b))}}}updateView({view:a,dynamicFilters:g,filtersJSON:B}){this.dynamicFilters=g;const K=this.childViews.find(C=>{var b,t,v,u,e,w;return C.view.id===a.view.id||((t=(b=C.view)==null?void 0:b.coreView)==null?void 0:t.id)===a.view.id||((u=(v=C.view)==null?void 0:v.coreView)==null?void 0:u.id)===((w=(e=a.view)==null?void 0:e.coreView)==null?void 0:w.id)});if(console.log("222222222222222222222222222222222222222"),console.log("childViews:",this.childViews),console.log("viewToUpdate:",K),console.log("view:",a),console.log("dynamicFilters:",g),console.log("filtersJSON:",B),console.log("this.viewId:",this.viewId),K){K.view.filtersJSON=B,K.view.coreView&&(K.view.coreView.filtersJSON=B);let C=g;if(this.viewId===4){const b=this.getComponentDynamicFilters(a.view.id);b&&(C=b,console.log(`Timeline updateView - using specific filters for component ${a.view.id}:`,C))}else if(this.viewId===8){const b=this.getComponentDynamicFilters(a.view.id);b&&(C=b,console.log(`FieldPosesion updateView - using specific filters for component ${a.view.id}:`,C))}else if(this.viewId===3){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCMatchSummary updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCMatchSummary updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCMatchSummary updateView - no specific filters found, using dynamicFilters:",C),this.updateSummary({dynamicFilters:C})}else if(this.viewId===1){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCComparativeReports updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCComparativeReports updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCComparativeReports updateView - no specific filters found, using dynamicFilters:",C)}else if(this.viewId===6){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCLineupsReports updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCLineupsReports updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCLineupsReports updateView - no specific filters found, using dynamicFilters:",C)}else if(this.viewId===7){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCGoalData updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCGoalData updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCGoalData updateView - no specific filters found, using dynamicFilters:",C)}else if(this.viewId===9){console.log("update viewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww zones");const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCFieldDataByZones updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCFieldDataByZones updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCFieldDataByZones updateView - no specific filters found, using dynamicFilters:",C)}this.viewId===5?this.updateVolumetricField(K,C):this.viewId===7?this.updateGoalData(K,C):this.viewId===9?this.updateFieldDataByZones(K,g):this.viewId===10?this.updateXg(K,C):this.viewId===3?this.updateMatchSummary(K,C):this.viewId===4?this.updateTimeline(K,C):this.viewId===8?this.updateFieldPosesion(K,C):this.viewId===1?this.updateComparative(K,C):this.viewId===2?this.updateGSCtops(K,C):this.viewId===6&&this.updateGSCLineupsReports(K,C)}else console.log("viewToUpdate not found")}updateComparative(a,g){if(console.log("update comparative",g),a.view.componentProps){const B=g[0]||[];if(console.log("GSCComparativeReports updateComparative - selectedAnalysisTypes:",B),B&&B.length>0){let K;if(Array.isArray(B)){const b=this.childViews.findIndex(t=>t.view.id===a.view.id);b>=0&&b<B.length?K=B[b]:K=B[0]}else K=B;const C=Fd.get(this.viewId);a.view.componentProps.type=K,a.view.componentProps.default=!1,a.view.title=`Comparativa ${C[K]}`,a.view.filterMultiple={category:K},console.log("GSCComparativeReports updateComparative - updated component with type:",K)}Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g})}}updateVolumetricField(a,g){if(console.log("updateVolumetricField",g),a.view.componentProps){const B=g[0]||1;a.view.isHomeTeam=B===1,a.view.componentProps.preMatchType=B,a.view.filterMultiple={isHomeTeam:B},console.log("GSCVolumetricField updateVolumetricField - updated component with:",{isHomeTeam:B,preMatchType:a.view.componentProps.preMatchType,filterMultiple:a.view.filterMultiple}),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}updateGoalData(a,g){if(console.log("updateGoalData",g),a.view.componentProps){const B=g[0]===1?"offensive":"defensive",K=g[1]===1;a.view.componentProps.analysisType=B,a.view.componentProps.isHomeTeamForAnalysis=K,a.view.isHomeTeam=K,a.view.filterMultiple={isHomeTeam:K},console.log("GSCGoalData updateGoalData - updated component with:",{analysisType:B,isHomeTeam:K,filterMultiple:a.view.filterMultiple}),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}updateFieldDataByZones(a,g){if(console.log("9999999999999999999999999999999999999999999999999999"),console.log("updateFieldDataByZones",g),console.log("view",a),a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=g[0],K=g[1]===1;if(console.log("dynamicFiltersValuesPerTeam",B),console.log("isHomeTeam",K),a.view.componentProps.isHomeTeamForAnalysis=K,a.view.isHomeTeam=K,a.view.filterMultiple={categoryIds:B,isHomeTeam:K},B&&B.length){const C=B.join("-"),b=Fd.get(this.viewId).analysisTypes.get(C);console.log("analysisTypeInfo",b),b&&(a.view.componentProps.analysisType=b.analysisType,a.view.title=b.title),this.removeChildView(a),this.addView(a)}console.log("GSCFieldDataByZones updateFieldDataByZones - updated component with:",{categoryIds:B,isHomeTeam:K,analysisType:a.view.componentProps.analysisType,title:a.view.title,filterMultiple:a.view.filterMultiple})}}updateXg(a,g){a.view.componentProps&&(a.view.isHomeTeam=g[0]===1,a.view.componentProps.isHomeTeamForAnalysis=g[0]||1)}updateMatchSummary(a,g){if(a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=g&&g.length>0?g[0]:!1;a.view.componentProps.desplegable=B,a.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g})}}updateTimeline(a,g){if(a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=this.getComponentDynamicFilters(a.view.id),K=B||g,C=K&&K.length>0?K[0]:[];a.view.componentProps.selectedEvents=C,a.view.componentProps.key=C.length>0;const b=this.hasEventTypeId(C,1),t=this.hasCategoryId(C,8),v=this.hasCategoryId(C,9),u=this.hasEventTypeId(C,3);console.log("Timeline update - Events check:",{goals:b,yellowCards:t,redCards:v,substitutions:u,selectedEvents:C,componentId:a.view.id,usingSpecificFilters:!!B}),a.view.componentProps.goals=b,a.view.componentProps.yellowCards=t,a.view.componentProps.redCards=v,a.view.componentProps.substitutions=u,a.view.componentProps._updateKey=Date.now(),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:K}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:K}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}updateFieldPosesion(a,g){if(a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=g&&g.length>0?g[0]:!1;a.view.componentProps.areInactiveVisible=B,a.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g})}}updateGSCtops(a,g){if(console.log("updateGSCtops",g),a.view.componentProps){const B=g[0]||[];if(Array.isArray(B)){if(console.log("GSCtops updateGSCtops (array mode) - skipping removal logic to prevent cross-page deletions"),B.length>0){const K=B[0];let C=null;try{C=Vd(K)}catch(t){console.warn("Error getting category by ID:",t)}const b=g[1]||1;a.view.filterMultiple={categoryId:K,teamType:b},a.view.componentProps.game&&(b===1?a.view.componentProps.teamView=a.view.componentProps.game.homeTeam.team_id:b===2?a.view.componentProps.teamView=a.view.componentProps.game.awayTeam.team_id:a.view.componentProps.teamView=0),a.view.componentProps.categoryView=C?[{id:K,name:C.name}]:[{id:K,name:`Category ${K}`}]}}else{const K=B;if(K){let C=null;try{C=Vd(K)}catch(t){console.warn("Error getting category by ID:",t)}const b=g[1]||1;a.view.filterMultiple={categoryId:K,teamType:b},a.view.componentProps.game&&(b===1?a.view.componentProps.teamView=a.view.componentProps.game.homeTeam.team_id:b===2?a.view.componentProps.teamView=a.view.componentProps.game.awayTeam.team_id:a.view.componentProps.teamView=0),a.view.componentProps.categoryView=C?[{id:K,name:C.name}]:[{id:K,name:`Category ${K}`}]}}}}updateGSCLineupsReports(a,g){if(console.log("updateGSCLineupsReports",g),a.view.componentProps){const B=g[0]||[];if(Array.isArray(B)){if(console.log("GSCLineupsReports updateGSCLineupsReports (array mode) - skipping removal logic to prevent cross-page deletions"),B.length>0){const K=B[0];a.view.filterMultiple={gameNumber:K},a.view.componentProps.gameNumber=K}}else{const K=B;K&&(a.view.filterMultiple={gameNumber:K},a.view.componentProps.gameNumber=K)}Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}getCategoryIdFromAnalysisType(a,g){if(!a||!g)return null;for(const B of g){const K=B.join("-"),C=Fd.get(this.viewId);if(C&&C.analysisTypes){const b=C.analysisTypes.get(K);if(b&&b.analysisType===a)return B[0]||null}}return null}}const Bse={class:"template-page__header"},Vse={class:"template-page__header__name"},Fse=["value"],jse={class:"template-page__header__details"},Use={class:"template-page__header__details__teams"},qse={class:"template-page__header__details__teams__team"},Wse={key:0,class:"template-page__header__details__teams__team__logo"},Gse=["src"],Hse={key:1,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Xse={class:"template-page__header__details__teams__team"},Jse={key:0,class:"template-page__header__details__teams__team__logo"},Kse=["src"],Zse={key:1,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Yse={class:"template-page__content"},Qse=["id"],$se=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-max-w","gs-max-h","gs-min-w","gs-min-h","gs-no-resize","gs-no-move","gs-auto-position"],ele=p.defineComponent({__name:"TemplateReportPage",props:{token:{type:String,default:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"},game:{type:Object,default:()=>null},lastGames:{type:Array,default:()=>null},id:{type:[String,Number],default:()=>String(Date.now())},page:{type:Object,default:()=>({title:"Page 1",items:[{name:"Tabla jugadores",id:`w-${String(Date.now())}`,x:0,y:0,w:4,h:4,maxWidth:4,maxHeight:4,noResize:!1,noMove:!1,componentProps:{}}]})},isPostMatch:{type:Boolean,default:!1},isTemplateMode:{type:Boolean,default:!1},isFilterVisible:{type:Boolean,default:!1}},emits:["intersection-changed","delete-page","change-sort","edit-view","view-changed","component-props-updated","delete-view","dynamic-filters-changed"],setup(r,{emit:a}){var g,B;const K=p.ref(null);let C=null;const b=r,t=p.ref(!1),v=a,u=p.computed(()=>b.page.items.reduce((z,V)=>(z.set(V.id,V),z),new Map)),e=p.computed(()=>{var z,V,U,q;return b.game&&b.game.homeTeam&&b.game.awayTeam?{homeTeam:{name:((z=b.game.homeTeam)==null?void 0:z.acronym)||"LOC",logo:((V=b.game.homeTeam)==null?void 0:V.logo)||null},awayTeam:{name:((U=b.game.awayTeam)==null?void 0:U.acronym)||"VIS",logo:((q=b.game.awayTeam)==null?void 0:q.logo)||null}}:{homeTeam:{name:"LOC"},awayTeam:{name:"VIS"}}});let w=null,y=null,x=!1,h=null,n=!1;const i=()=>{n=!0},d=()=>{n=!1};function s(){n||(x=!0,h&&clearTimeout(h),h=setTimeout(()=>{x=!1},150))}function c(){const z={root:null,rootMargin:"0px",threshold:.7};w=new IntersectionObserver(q=>{q.forEach(W=>{if(console.log("Intersection observer triggered:",W.isIntersecting,"isScrolling:",x),x){console.log("Scroll in progress, delaying intersection event"),y&&clearTimeout(y),y=setTimeout(()=>{console.log("Emitting delayed intersection event:",W.isIntersecting),v("intersection-changed",W.isIntersecting)},100);return}y&&clearTimeout(y),y=setTimeout(()=>{console.log("Emitting immediate intersection event:",W.isIntersecting),v("intersection-changed",W.isIntersecting)},50)})},z);const V=K.value;V&&w.observe(V);const U=document.querySelector(".container-main");U&&U.addEventListener("scroll",s,{passive:!0}),document.addEventListener("programmatic-scroll-start",i),document.addEventListener("programmatic-scroll-end",d)}function f(z){console.log("newValue:",z),b.page.title=z.target.value,v("view-changed")}const m={game_id:0,season_id:0,prematch:!1},T={gameId:90209,id:90209,seasonId:1909,regularSeasonId:1909,matchday_name:"Matchday 1",status:1,score:[1,3],game_status:1,dateTimeUTC:"2024-09-05T22:00:00Z",homeTeam:{logo:"https://golstatsimages.blob.core.windows.net/teams-80/2936.png",team_id:2936,provisional_logo:"https://golstatsimages.blob.core.windows.net/teams-provisional/2936.png",colloquial_name:"Guyana",acronym:"GUY",team_name:"Guyana"},awayTeam:{logo:"https://golstatsimages.blob.core.windows.net/teams-80/3279.png",team_id:3279,provisional_logo:"https://golstatsimages.blob.core.windows.net/teams-provisional/3279.png",colloquial_name:"Surinam",acronym:"SUR",team_name:"Surinam"},is_live:0,minutes:{home_goals_minutes:[],visiting_goals_minutes:[],home_yellow_cards_minutes:[],away_yellow_cards_minutes:[],home_red_cards_minutes:[],away_red_cards_minutes:[]}},E=new Map([[5,{component:Rb,componentName:"GSCVolumetricField",props:{isGamePreMatch:!b.isPostMatch,areTeamsVisible:!1,isTitleVisible:!1,isGhostEffect:b.isTemplateMode,isTemplateMode:b.isTemplateMode,preMatchType:1}}],[2,{component:Tw,componentName:"GscTopPlayer",props:{categoryView:[{id:0,name:"Category"}],gamed:b.game?b.game.id:T.gameId,game:b.game,season:b.game?(g=b==null?void 0:b.game)==null?void 0:g.season_id:T.seasonId,teamView:0,useDummyData:b.isTemplateMode}}],[8,{component:E3,componentName:"FieldPosesion",props:{widthSection:600,game:T,teamSelected:{teamId:0},areInactiveVisible:!0,showTitle:!1,isDefault:!0,key:!1}}],[6,{component:L4,componentName:"GSCLineupsReports",props:{selectedOption:b.isPostMatch?"Postmatch":"Prematch",game:m,gamehome:m,gameaway:m}}],[3,{component:M3,componentName:"GSCMatchSummary",props:{game:T,defaultShields:!0,desplegable:!1}}],[4,{component:p5,componentName:"GSCTimelineReports",props:{key:!0,isDefault:!0,gameId:T.gameId,homeTeam:T.homeTeam.team_id,awayTeam:T.awayTeam.team_id,token:b.token,goals:!0,yellowCards:!0,redCards:!0,substitutions:!0}}],[7,{component:v6,componentName:"GSCGoalData",props:{game:b.game,isHomeTeamForAnalysis:!0,canInteract:!1,canPlayVideos:!1,isPreMatch:!b.isPostMatch,analysisType:1}}],[9,{component:N4,componentName:"GSCFieldDataByZones",props:{game:b.game,isHomeTeamForAnalysis:!0,analysisType:"successfulPasses",canPlayVideos:!1,isPreMatch:!b.isPostMatch}}],[10,{component:M6,componentName:"GSCGameXg",props:{game:b.game,isHomeTeamForAnalysis:!0,isPostMatch:b.isPostMatch}}],[1,{component:m6,componentName:"GSCComparativeReports",props:{gameId:b.game?b.game.id:"",homeLogo:b.game?b.game.homeTeam.logo:"",awayLogo:b.game?b.game.awayTeam.logo:"",seasonId:b.game?(B=b==null?void 0:b.game)==null?void 0:B.season_id:0,typeGame:b.isPostMatch,type:"stoppedBall",default:b.isTemplateMode}}]]);function S(z){if(z)if(typeof z=="string"){let V=null;switch(z){case"GSCVolumetricField":V=Rb;break;case"GSCGoalData":V=v6;break;case"GscTopPlayer":V=Tw;break;case"FieldPosesion":V=E3;break;case"GSCLineupsReports":V=L4;break;case"GSCMatchSummary":V=M3;break;case"GSCTimelineReports":V=p5;break;case"GSCFieldDataByZones":V=N4;break;case"GSCGameXg":V=M6;break;case"GSCComparativeReports":V=m6;break;default:V=null}return V}else return z;return null}function L({pageId:z,view:V,filterAndWidgetContainer:U,applyMinimumSize:q=!1,dynamicFilters:W=[]}){if(b.page.id===z&&C){let Y=!1;V.id===3&&(Y=W[0]);const ne=`min_column${Y?"_2":""}`,X=`min_row${Y?"_2":""}`,re=`colspan${Y?"_2":""}`,ee=`rowspan${Y?"_2":""}`,Z={w:q?V[ne]:V[re],h:q?V[X]:V[ee]};if(C.willItFit(0,0,Z.w,Z.h,!0)){const te=C.addWidget(Z),ae=Number(te.getAttribute("gs-x")||0),oe=Number(te.getAttribute("gs-y")||0);C.removeWidget(te);const he=E.get(V.id),fe=p.reactive({...JSON.parse(JSON.stringify(he.props))||{},_isReactive:!0}),se=p.reactive({pageId:z,grid:C,page:b.page,view:{name:V.name,title:V.title,key:Date.now()-7*Math.random(),id:`w-${String(Date.now())}`,x:ae,y:oe,w:Z.w,h:Z.h,maxWidth:V.max_column,maxHeight:V.max_row,minWidth:V.min_column,minHeight:V.min_row,componentName:he.componentName,componentProps:fe,pageId:z,coreView:V}});U.addView(se),Ai.emit("add-page-view",se)}else Ai.emit("add-page-and-view",{pageId:z,view:V,filterAndWidgetContainer:U})}}function N(z){if(C){const V=document.querySelector(`[gs-id="${z.id}"]`);V&&(C.removeWidget(V),v("delete-view",z))}v("view-changed")}function A(z){if(!z.filterAndViewsContainer&&z.coreView){const V=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[z],z.coreView.id,z.dynamicFilters||[],b.isPostMatch,b.isTemplateMode,z.filtersJSON);z.filterAndViewsContainer=V}v("edit-view",z)}function I(){v("delete-page",b.page)}function M(){Ai.emit("change-sort",b.page)}function k(z){if(x)return;console.log("force-component-update event received:",z);const V=b.page.items.find(U=>U.id===z.itemId||U.id===z.viewId);V?(console.log("Found item to update in force-component-update:",V.id),Object.assign(V.componentProps,z.componentProps),V._updateKey=Date.now(),console.log("Updated item in force-component-update:",V.componentProps)):console.log("Item not found in force-component-update for id:",z.itemId||z.viewId)}function R(z){if(x)return;console.log("component-props-updated event received:",z);const V=b.page.items.find(U=>U.id===z.viewId);V?(console.log("Found item to update in component-props-updated:",V.id),Object.assign(V.componentProps,z.componentProps),V._updateKey=Date.now(),console.log("Updated item in component-props-updated:",V.componentProps)):console.log("Item not found in component-props-updated for id:",z.viewId)}function _(z){if(x)return;console.log("dynamic-filters-changed event received:",z);const V=b.page.items.find(U=>U.id===z.viewId);V?(console.log("Found item to update in dynamic-filters-changed:",V.id),Object.assign(V.componentProps,z.componentProps||{}),V._updateKey=Date.now(),console.log("Updated item in dynamic-filters-changed:",V.componentProps)):console.log("Item not found in dynamic-filters-changed for id:",z.viewId)}const O=function(){Ai.off("add-view",L),Ai.off("force-component-update",k),Ai.off("component-props-updated",R),Ai.off("dynamic-filters-changed",_);const z=document.querySelector(".container-main");z&&z.removeEventListener("scroll",s),y&&clearTimeout(y),h&&clearTimeout(h)};return Ai.on("add-view",L),Ai.on("force-component-update",k),Ai.on("component-props-updated",R),Ai.on("dynamic-filters-changed",_),p.onMounted(async()=>{await p.nextTick(),C=Wi.init({column:12,row:12,maxRow:12,cellHeight:60,float:!0,resizable:{handles:"e, se, s, sw, w"}},`#grid-stack-${b.id}`),C.on("change",(z,V)=>{const U=V[0];if(U){const q=u.value.get(U.id);q&&(q.x=U.x,q.y=U.y,q.w=U.w,q.h=U.h,v("view-changed"))}}),c(),b.page.grid=C,b.page.offListeners=O}),p.onUnmounted(()=>{w&&w.disconnect(),O(),y&&clearTimeout(y),h&&clearTimeout(h),document.removeEventListener("programmatic-scroll-start",i),document.removeEventListener("programmatic-scroll-end",d)}),(z,V)=>(p.openBlock(),p.createElementBlock("div",{ref_key:"templatePage",ref:K,class:"template-page"},[p.createElementVNode("div",Bse,[t.value?(p.openBlock(),p.createBlock(L6,{key:0,"options-type":"page",onClick:V[0]||(V[0]=p.withModifiers(U=>t.value=!1,["self"])),onMouseleave:V[1]||(V[1]=U=>t.value=!1),onCloseTooltip:V[2]||(V[2]=U=>t.value=!1),onDeletePage:I,onChangeSort:M})):p.createCommentVNode("",!0),p.createElementVNode("div",Vse,[V[4]||(V[4]=p.createElementVNode("div",null,[p.createElementVNode("svg",{width:"19",height:"21",viewBox:"0 0 19 21",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M11.2986 12.9994C7.62909 14.8341 4.11744 16.0178 1.35547 16.4518L9.18763 20.0029C9.34545 20.0818 9.60192 20.0818 9.74002 20.0029L17.8878 16.3137C18.0457 16.2348 18.164 16.0572 18.164 15.8797V8.75781C16.2898 10.2177 13.9422 11.6776 11.2986 12.9994Z",fill:"white"}),p.createElementVNode("path",{d:"M4.7152 8.89735C4.7152 8.89735 10.9494 3.76802 16.8482 1.20335C15.0529 0.946887 11.3637 0.43395 9.3711 0.453678C4.41928 0.493135 1.06546 1.34145 1.06546 1.34145C0.90763 1.3809 0.769531 1.55846 0.769531 1.71629V8.12795C3.01857 6.56942 5.34651 5.56329 5.34651 5.56329C5.34651 5.56329 2.72264 7.06263 0.769531 8.81844V9.41028V14.1648C3.09748 13.9675 6.62886 12.7641 10.3575 10.7321C13.6719 8.91707 16.4733 6.84562 18.17 5.05035V2.40677C14.3032 3.37346 4.7152 8.89735 4.7152 8.89735Z",fill:"white"})])],-1)),V[5]||(V[5]=p.createElementVNode("div",{class:"separator"},null,-1)),p.createElementVNode("input",{value:r.page.title,type:"text",class:"page-title-input",onclick:"this.select()",onInput:f},null,40,Fse)]),p.createElementVNode("div",jse,[p.createElementVNode("div",Use,[p.createElementVNode("div",qse,[e.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",Wse,[p.createElementVNode("img",{src:e.value.homeTeam.logo,alt:"Home Team Logo",width:"25",height:"25"},null,8,Gse)])):(p.openBlock(),p.createElementBlock("svg",Hse,[...V[6]||(V[6]=[p.createElementVNode("path",{opacity:"0.4",d:"M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z",fill:"#54728B"},null,-1)])])),p.createElementVNode("span",null,p.toDisplayString(e.value.homeTeam.name),1)]),V[8]||(V[8]=p.createElementVNode("div",{class:"template-page__header__details__teams__vs"}," VS ",-1)),p.createElementVNode("div",Xse,[p.createElementVNode("span",null,p.toDisplayString(e.value.awayTeam.name),1),e.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",Jse,[p.createElementVNode("img",{src:e.value.awayTeam.logo,alt:"Away Team Logo",width:"25",height:"25"},null,8,Kse)])):(p.openBlock(),p.createElementBlock("svg",Zse,[...V[7]||(V[7]=[p.createElementVNode("path",{opacity:"0.4",d:"M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z",fill:"#54728B"},null,-1)])]))])]),r.isTemplateMode&&!r.isFilterVisible?(p.openBlock(),p.createElementBlock("div",{key:0,class:"template-page__header__details__options",onClick:V[3]||(V[3]=U=>t.value=!0)},[...V[9]||(V[9]=[p.createElementVNode("svg",{width:"17",height:"13",viewBox:"0 0 17 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M3.56953 6.28672C3.56953 7.19972 2.83253 7.93672 1.91953 7.93672C1.00653 7.93672 0.269531 7.19972 0.269531 6.28672C0.269531 5.37372 1.00653 4.63672 1.91953 4.63672C2.83253 4.63672 3.56953 5.37372 3.56953 6.28672ZM8.51953 4.63672C7.60653 4.63672 6.86953 5.37372 6.86953 6.28672C6.86953 7.19972 7.60653 7.93672 8.51953 7.93672C9.43253 7.93672 10.1695 7.19972 10.1695 6.28672C10.1695 5.37372 9.43253 4.63672 8.51953 4.63672ZM15.1195 4.63672C14.2065 4.63672 13.4695 5.37372 13.4695 6.28672C13.4695 7.19972 14.2065 7.93672 15.1195 7.93672C16.0325 7.93672 16.7695 7.19972 16.7695 6.28672C16.7695 5.37372 16.0325 4.63672 15.1195 4.63672Z",fill:"white"})],-1)])])):p.createCommentVNode("",!0)])]),p.createElementVNode("div",Yse,[p.createElementVNode("div",{id:`grid-stack-${r.id}`,class:"grid-stack"},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(r.page.items,U=>{var q,W,Y;return p.openBlock(),p.createElementBlock("div",{class:"grid-stack-item",key:U.key,"gs-id":U.id,"gs-x":U.x,"gs-y":U.y,"gs-w":U.w,"gs-h":U.h,"gs-max-w":U.maxWidth,"gs-max-h":U.maxHeight,"gs-min-w":U.minWidth,"gs-min-h":U.minHeight,"gs-no-resize":!r.isTemplateMode,"gs-no-move":!b.isTemplateMode,"gs-auto-position":U.x===0&&U.y===0},[p.createElementVNode("div",{class:p.normalizeClass(["grid-stack-item-content",{"is-selected":U.isSelected}])},[p.createVNode(Cse,{title:U.coreView&&U.coreView.id===9&&U.w<4&&U.titleShort||U.title,"is-template-mode":r.isTemplateMode,game:r.game,lastGames:r.lastGames,"is-home-team":(q=U.componentProps)!=null&&q.preMatchType?((W=U.componentProps)==null?void 0:W.preMatchType)===1:U.isHomeTeam,"is-filter-visible":r.isFilterVisible,"view-id":((Y=U==null?void 0:U.coreView)==null?void 0:Y.id)||0,onEdit:ne=>A(U),onDelete:ne=>N(U)},{default:p.withCtx(()=>[(p.openBlock(),p.createBlock(p.resolveDynamicComponent(S(U.componentName)),p.mergeProps({ref_for:!0},U.componentProps,{key:`${U.id}-${U._updateKey||0}`}),null,16))]),_:2},1032,["title","is-template-mode","game","lastGames","is-home-team","is-filter-visible","view-id","onEdit","onDelete"])],2)],8,$se)}),128))],8,Qse)])],512))}}),tle=dd(ele,[["__scopeId","data-v-c6c9b088"]]),rle={PO1:"CFI",PO2:"CFV",PO3:"SFI",PO4:"SFV",PO5:"FI",PO6:"FV"},nle={key:0,class:"cover__main-logo cover__main-logo__home"},ile={key:0,class:"team-logo"},ale=["src"],ole={key:1,width:"575",height:"675",viewBox:"0 0 160 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},sle=["fill"],lle={key:1,class:"cover__main-logo cover__main-logo__away"},cle={key:0,class:"team-logo"},ule=["src"],dle={key:1,width:"575",height:"575",viewBox:"0 0 161 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},hle=["fill"],ple={class:"cover__title-subtitle"},fle={class:"cover__title-subtitle__title"},mle={class:"cover__title-subtitle__subtitle"},gle={key:2,class:"cover-type-one"},yle={class:"team-info-one"},vle={class:"team-data"},xle={key:0,class:"team-logo"},ble=["src"],_le={key:1,width:"160",height:"161",viewBox:"0 0 160 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wle=["fill","opacity"],Tle={class:"team-name"},kle={key:0,class:"team-events"},Sle={class:"score-one"},Ele={key:0},Ale={class:"team-info-one"},Cle={class:"team-data"},Mle={key:0,class:"team-logo"},Lle=["src"],Nle={key:1,width:"161",height:"161",viewBox:"0 0 161 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ile=["fill","opacity"],Rle={class:"team-name"},Ole={key:0,class:"team-events"},Ple={key:3,class:"cover-type-two"},zle={class:"team-data"},Dle={class:"team-info"},Ble={key:0,class:"team-logo"},Vle=["src"],Fle={key:1,width:"160",height:"161",viewBox:"0 0 160 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},jle=["fill","opacity"],Ule={key:2,class:"team-score-two"},qle={key:0,class:"team-goals"},Wle={class:"team-data"},Gle={class:"team-info"},Hle={key:0,class:"team-score-two"},Xle={key:1,class:"team-logo"},Jle=["src"],Kle={key:2,width:"161",height:"161",viewBox:"0 0 161 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zle=["fill","opacity"],Yle={key:0,class:"team-goals"},Qle={__name:"CoverPage",props:{game:{type:Object,default:()=>null},coverId:{type:Number,default:1},isPostMatch:{type:Boolean,default:!0}},emits:["intersection-changed"],setup(r,{emit:a}){const g=r,B=a,K=p.ref(null),C=p.computed(()=>[1,2].includes(g.coverId)),b=p.computed(()=>[1,3].includes(g.coverId)),t=p.computed(()=>g.coverId===1?{homeTeam:"#1558CC",awayTeam:"#0046BF",opacity:1}:g.coverId===3?{homeTeam:"#000A1A",awayTeam:"#000A1A",opacity:.4}:{homeTeam:"#576883",awayTeam:"#576883",opacity:.4}),v=p.computed(()=>g.game&&g.game.score?g.game.score:["0","0"]),u=p.computed(()=>{var L,N,A,I,M,k,R,_;if(g.game&&g.game.homeTeam&&g.game.awayTeam){const O={homeTeam:{name:((L=g.game.homeTeam)==null?void 0:L.acronym)||"LOC",logo:((N=g.game.homeTeam)==null?void 0:N.logo)||null},awayTeam:{name:((A=g.game.awayTeam)==null?void 0:A.acronym)||"VIS",logo:((I=g.game.awayTeam)==null?void 0:I.logo)||null}};return C.value?(O.homeTeam.goalsMinutes=n(g.game.minutes.home_goals_minutes),O.homeTeam.totalYellowCards=((M=g.game.minutes.home_yellow_cards_minutes)==null?void 0:M.length)||0,O.homeTeam.totalRedCards=((k=g.game.minutes.home_red_cards_minutes)==null?void 0:k.length)||0,O.awayTeam.goalsMinutes=n(g.game.minutes.visiting_goals_minutes),O.awayTeam.totalYellowCards=((R=g.game.minutes.away_yellow_cards_minutes)==null?void 0:R.length)||0,O.awayTeam.totalRedCards=((_=g.game.minutes.away_red_cards_minutes)==null?void 0:_.length)||0):(O.homeTeam.goalsEvents=h(g.game.report_minutes.home_goals_minutes),O.awayTeam.goalsEvents=h(g.game.report_minutes.visiting_goals_minutes)),O}return{homeTeam:{name:"LOC",logo:null,goalsMinutes:"00'",totalYellowCards:0,totalRedCards:0,goalsEvents:[{playerName:"Nombre",goalTime:"00'"}]},awayTeam:{name:"VIS",logo:null,goalsMinutes:"00'",totalYellowCards:0,totalRedCards:0,goalsEvents:[{playerName:"Nombre",goalTime:"00'"}]}}}),e=p.computed(()=>({"--background-image":b.value?"url(https://golstatsimages.blob.core.windows.net/report-maker/background-postmatch-template-01@2x.jpg)":"url(https://golstatsimages.blob.core.windows.net/report-maker/background-postmatch-template-02@2x.jpg)","--grid-template-columns-type-one":g.isPostMatch?"1fr min-content 1fr":"320px min-content 320px","--width-type-one":g.isPostMatch?"100%":"fit-content","--grid-template-columns-type-two":g.isPostMatch?"1fr min-content 1fr":"320px min-content 320px","--width-type-two":g.isPostMatch?"100%":"fit-content"})),w=p.computed(()=>g.isPostMatch?"Postmatch":"Prematch"),y=["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],x=p.computed(()=>{if(g.game){let L=rle[g.game.matchday_abbreviation];L||(L=g.game.matchday_abbreviation.replace("M","J"));const[N,A,I]=g.game.date.split("-");return`${L} - ${I} ${y[Number(A)-1]}, ${N}`}return"Jornada - Día 00 Mes"});function h(L){return!L||!Array.isArray(L)||L.length===0?"":(console.log("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"),console.log("goalsDetails",L),L.map(N=>{const A=N.split(", ");let I=A[0].replace("'","");I=I.replace("+",""),I=I.replace("’",""),console.log("playerGoalsArray",A);const M=I.split(" "),{strings:k,numbers:R}=M.reduce((z,V)=>(isNaN(Number(V))?z.strings.push(V):z.numbers.push(V),z),{strings:[],numbers:[]}),_=k.join(" "),O=R.length===1?`${R[0]}'`:`${R[0]}' ${R.slice(1).join(" + ")}'`;return{playerName:_,goalTime:A.length===1?O:`${O}, ${A.reduce((z,V,U)=>U===0?z:`${z}${V}${U<A.length-1?", ":""}`,"")}`}}))}function n(L){return!L||!Array.isArray(L)||L.length===0?"":L.reduce((N,A,I)=>{const M=A.split(" ");let k="";return M.length===3?k=M[2]:M.length===5&&(k=`${M[2]} ${M[3]} ${M[4]}`),k&&(N+=`${k}${I<L.length-1?", ":""}`),N},"")}let i=null,d=null,s=!1,c=null,f=!1;const m=()=>{f=!0},T=()=>{f=!1};function E(){if(f){console.log("Cover: Ignoring programmatic scroll");return}s=!0,c&&clearTimeout(c),c=setTimeout(()=>{s=!1},150)}function S(){const L={root:null,rootMargin:"0px",threshold:.7};i=new IntersectionObserver(I=>{I.forEach(M=>{if(console.log("Cover: Intersection observer triggered:",M.isIntersecting,"isScrolling:",s),s){console.log("Cover: Scroll in progress, delaying intersection event"),d&&clearTimeout(d),d=setTimeout(()=>{console.log("Cover: Emitting delayed intersection event:",M.isIntersecting),B("intersection-changed",M.isIntersecting)},100);return}d&&clearTimeout(d),d=setTimeout(()=>{console.log("Cover: Emitting immediate intersection event:",M.isIntersecting),B("intersection-changed",M.isIntersecting)},50)})},L);const N=K.value;N&&i.observe(N);const A=document.querySelector(".container-main");A&&A.addEventListener("scroll",E,{passive:!0}),document.addEventListener("programmatic-scroll-start",m),document.addEventListener("programmatic-scroll-end",T)}return p.onMounted(()=>{S()}),p.onUnmounted(()=>{i&&i.disconnect();const L=document.querySelector(".container-main");L&&L.removeEventListener("scroll",E),document.removeEventListener("programmatic-scroll-start",m),document.removeEventListener("programmatic-scroll-end",T),d&&clearTimeout(d),c&&clearTimeout(c)}),(L,N)=>(p.openBlock(),p.createElementBlock("div",{ref_key:"coverPage",ref:K,class:"cover",style:p.normalizeStyle(e.value)},[C.value?(p.openBlock(),p.createElementBlock("div",nle,[u.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",ile,[p.createElementVNode("img",{src:u.value.homeTeam.logo||"/default-logo.png",alt:"Team 1 Logo"},null,8,ale)])):(p.openBlock(),p.createElementBlock("svg",ole,[p.createElementVNode("path",{d:"M80.0068 0.953125C80.0068 0.953125 91.0143 12.208 118.141 12.9913C140.898 13.6509 149.102 7.87917 149.102 7.87917C149.102 7.87917 169.839 67.5339 135.786 117.212C117.894 143.308 83.5935 160.211 79.9656 160.953C76.3789 160.211 42.0372 143.308 24.1449 117.212C-9.8257 67.5339 10.9112 7.87917 10.9112 7.87917C10.9112 7.87917 19.1153 13.6509 41.8723 12.9913C68.9993 12.208 80.0068 0.953125 80.0068 0.953125Z",fill:t.value.homeTeam},null,8,sle)]))])):p.createCommentVNode("",!0),C.value?(p.openBlock(),p.createElementBlock("div",lle,[u.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",cle,[p.createElementVNode("img",{src:u.value.awayTeam.logo||"/default-logo.png",alt:"Team 2 Logo"},null,8,ule)])):(p.openBlock(),p.createElementBlock("svg",dle,[p.createElementVNode("path",{d:"M80.8504 0.953125C80.8504 0.953125 92.9822 3.39499 119.261 10.1779C144.106 16.5733 152.827 19.1314 152.827 19.1314C152.827 19.1314 156.936 44.2089 145.657 90.5655C136.548 127.969 106.742 152.038 80.8504 160.953C54.9977 152.038 25.1527 128.007 16.0442 90.5655C4.8039 44.2477 8.91243 19.1314 8.91243 19.1314C8.91243 19.1314 17.6334 16.5733 42.4783 10.1779C68.7574 3.39499 80.8504 0.953125 80.8504 0.953125Z",fill:t.value.awayTeam},null,8,hle)]))])):p.createCommentVNode("",!0),p.createElementVNode("div",ple,[p.createElementVNode("div",fle,[N[0]||(N[0]=p.createElementVNode("div",null,"Análisis",-1)),p.createElementVNode("div",null,p.toDisplayString(w.value),1)]),p.createElementVNode("div",mle,p.toDisplayString(x.value),1)]),C.value?(p.openBlock(),p.createElementBlock("div",gle,[p.createElementVNode("div",yle,[p.createElementVNode("div",vle,[u.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",xle,[p.createElementVNode("img",{src:u.value.homeTeam.logo||"/default-logo.png",alt:"Team 1 Logo"},null,8,ble)])):(p.openBlock(),p.createElementBlock("svg",_le,[p.createElementVNode("path",{d:"M80.0068 0.953125C80.0068 0.953125 91.0143 12.208 118.141 12.9913C140.898 13.6509 149.102 7.87917 149.102 7.87917C149.102 7.87917 169.839 67.5339 135.786 117.212C117.894 143.308 83.5935 160.211 79.9656 160.953C76.3789 160.211 42.0372 143.308 24.1449 117.212C-9.8257 67.5339 10.9112 7.87917 10.9112 7.87917C10.9112 7.87917 19.1153 13.6509 41.8723 12.9913C68.9993 12.208 80.0068 0.953125 80.0068 0.953125Z",fill:t.value.homeTeam,opacity:t.value.opacity},null,8,wle)])),p.createElementVNode("div",Tle,p.toDisplayString(u.value.homeTeam.name),1)]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",kle,[N[1]||(N[1]=p.createStaticVNode('<svg class="ball" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1)),p.createElementVNode("div",null,p.toDisplayString(u.value.homeTeam.goalsMinutes),1),N[2]||(N[2]=p.createElementVNode("div",{class:"separator"},null,-1)),N[3]||(N[3]=p.createElementVNode("svg",{class:"card",width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.367188",y:"0.09375",width:"9.14286",height:"13.7143",rx:"2.28571",fill:"#F7C330"})],-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.homeTeam.totalYellowCards),1),N[4]||(N[4]=p.createElementVNode("svg",{class:"card",width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.109375",y:"0.09375",width:"9.14286",height:"13.7143",rx:"1.82857",fill:"#FF0000"})],-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.homeTeam.totalRedCards),1)])):p.createCommentVNode("",!0)]),p.createElementVNode("div",Sle,[r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Ele,p.toDisplayString(v.value[0])+" : "+p.toDisplayString(v.value[1]),1)):p.createCommentVNode("",!0)]),p.createElementVNode("div",Ale,[p.createElementVNode("div",Cle,[u.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",Mle,[p.createElementVNode("img",{src:u.value.awayTeam.logo||"/default-logo.png",alt:"Team 2 Logo"},null,8,Lle)])):(p.openBlock(),p.createElementBlock("svg",Nle,[p.createElementVNode("path",{d:"M80.8504 0.953125C80.8504 0.953125 92.9822 3.39499 119.261 10.1779C144.106 16.5733 152.827 19.1314 152.827 19.1314C152.827 19.1314 156.936 44.2089 145.657 90.5655C136.548 127.969 106.742 152.038 80.8504 160.953C54.9977 152.038 25.1527 128.007 16.0442 90.5655C4.8039 44.2477 8.91243 19.1314 8.91243 19.1314C8.91243 19.1314 17.6334 16.5733 42.4783 10.1779C68.7574 3.39499 80.8504 0.953125 80.8504 0.953125Z",fill:t.value.awayTeam,opacity:t.value.opacity},null,8,Ile)])),p.createElementVNode("div",Rle,p.toDisplayString(u.value.awayTeam.name),1)]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Ole,[p.createElementVNode("div",null,p.toDisplayString(u.value.awayTeam.totalYellowCards),1),N[5]||(N[5]=p.createElementVNode("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.367188",y:"0.09375",width:"9.14286",height:"13.7143",rx:"2.28571",fill:"#F7C330"})],-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.awayTeam.totalRedCards),1),N[6]||(N[6]=p.createElementVNode("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.109375",y:"0.09375",width:"9.14286",height:"13.7143",rx:"1.82857",fill:"#FF0000"})],-1)),N[7]||(N[7]=p.createElementVNode("div",{class:"separator"},null,-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.awayTeam.goalsMinutes),1),N[8]||(N[8]=p.createStaticVNode('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1))])):p.createCommentVNode("",!0)])])):(p.openBlock(),p.createElementBlock("div",Ple,[p.createElementVNode("div",zle,[p.createElementVNode("div",Dle,[u.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",Ble,[p.createElementVNode("img",{src:u.value.homeTeam.logo||"/default-logo.png",alt:"Team 1 Logo"},null,8,Vle)])):(p.openBlock(),p.createElementBlock("svg",Fle,[p.createElementVNode("path",{d:"M80.0068 0.953125C80.0068 0.953125 91.0143 12.208 118.141 12.9913C140.898 13.6509 149.102 7.87917 149.102 7.87917C149.102 7.87917 169.839 67.5339 135.786 117.212C117.894 143.308 83.5935 160.211 79.9656 160.953C76.3789 160.211 42.0372 143.308 24.1449 117.212C-9.8257 67.5339 10.9112 7.87917 10.9112 7.87917C10.9112 7.87917 19.1153 13.6509 41.8723 12.9913C68.9993 12.208 80.0068 0.953125 80.0068 0.953125Z",fill:t.value.homeTeam,opacity:t.value.opacity},null,8,jle)])),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Ule,p.toDisplayString(v.value[0]),1)):p.createCommentVNode("",!0)]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",qle,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(u.value.homeTeam.goalsEvents,(A,I)=>(p.openBlock(),p.createElementBlock("div",{key:`goal-${I}`,class:"goal"},[p.createElementVNode("div",null,p.toDisplayString(A.playerName),1),N[9]||(N[9]=p.createElementVNode("div",{class:"bullet"},null,-1)),p.createElementVNode("div",null,p.toDisplayString(A.goalTime),1),N[10]||(N[10]=p.createStaticVNode('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1))]))),128))])):p.createCommentVNode("",!0)]),N[13]||(N[13]=p.createElementVNode("div",{class:"separator"},null,-1)),p.createElementVNode("div",Wle,[p.createElementVNode("div",Gle,[r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Hle,p.toDisplayString(v.value[1]),1)):p.createCommentVNode("",!0),u.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",Xle,[p.createElementVNode("img",{src:u.value.awayTeam.logo||"/default-logo.png",alt:"Team 2 Logo"},null,8,Jle)])):(p.openBlock(),p.createElementBlock("svg",Kle,[p.createElementVNode("path",{d:"M80.8504 0.953125C80.8504 0.953125 92.9822 3.39499 119.261 10.1779C144.106 16.5733 152.827 19.1314 152.827 19.1314C152.827 19.1314 156.936 44.2089 145.657 90.5655C136.548 127.969 106.742 152.038 80.8504 160.953C54.9977 152.038 25.1527 128.007 16.0442 90.5655C4.8039 44.2477 8.91243 19.1314 8.91243 19.1314C8.91243 19.1314 17.6334 16.5733 42.4783 10.1779C68.7574 3.39499 80.8504 0.953125 80.8504 0.953125Z",fill:t.value.awayTeam,opacity:t.value.opacity},null,8,Zle)]))]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Yle,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(u.value.awayTeam.goalsEvents,(A,I)=>(p.openBlock(),p.createElementBlock("div",{key:`goal-a-${I}`,class:"goal"},[N[11]||(N[11]=p.createStaticVNode('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1)),p.createElementVNode("div",null,p.toDisplayString(A.goalTime),1),N[12]||(N[12]=p.createElementVNode("div",{class:"bullet"},null,-1)),p.createElementVNode("div",null,p.toDisplayString(A.playerName),1)]))),128))])):p.createCommentVNode("",!0)])]))],4))}},$le=dd(Qle,[["__scopeId","data-v-0364d256"]]),ece={class:"floating-bar"},tce={class:"tab active"},rce={class:"select-display"},nce={class:"select-icon"},ice=["src"],ace={key:1,src:"https://golstatsimages.blob.core.windows.net/images-library/vector2.png",alt:"icono",class:"option-img-default"},oce={key:0,class:"select-placeholder select-label"},sce={key:1,class:"select-label"},lce={key:0,class:"dropdown-menu field-menu"},cce=["onClick"],uce={class:"option-icon"},dce=["src","data-hover-src"],hce={class:"option-content"},pce={class:"option-title"},fce={key:0,class:"option-description"},mce={class:"select-display"},gce={class:"select-icon"},yce=["src"],vce=["src"],xce={class:"select-label"},bce={key:0,class:"dropdown-menu type-menu type-menu-grid"},_ce={class:"option-grid"},wce=["onClick"],Tce={class:"option-grid-title"},kce={class:"option-grid-icon"},Sce=["src"],Ece={key:1,class:"filter-separator"},Ace=["onClick"],Cce={class:"select-display"},Mce={key:0,class:"badge-categorias"},Lce={key:0,class:"dropdown-menu type-menu multi-select-menu"},Nce={class:"multi-select-scroll-area"},Ice={class:"select-all-checkbox"},Rce=["checked","indeterminate","onChange"],Oce={class:"option-checkbox"},Pce=["checked","onChange"],zce=["onClick"],Dce={class:"option-title"},Bce={class:"multi-select-footer"},Vce={key:1,class:"custom-radio-group filter-inline"},Fce={class:"radio-label"},jce={class:"radio-options"},Uce=["name","value","onUpdate:modelValue","disabled","onChange"],qce={key:2,class:"check-group filter-inline"},Wce=["onUpdate:modelValue","checked","onChange"],Gce=["data-filter-type","onClick"],Hce={class:"select-display"},Xce={key:0,class:"dropdown-menu type-menu simple-select-menu"},Jce={class:"simple-select-scroll-area"},Kce=["onMouseenter","onClick"],Zce={class:"option-content"},Yce={class:"option-title"},Qce={key:0,class:"option-checkmark"},$ce={key:4,class:"filter-separator"},eue=Object.assign({name:"FloatingFiltersBar"},{__name:"filters",props:{token:{type:String,required:!0},view:{type:Object,default:()=>null},isPostMatch:{type:Boolean,default:!1},filters_edition_mode:{type:Array,default:()=>null}},emits:["filters-changed","close"],setup(r,{expose:a,emit:g}){const B=r,K=g,C=p.ref([]);let b=null,t=null,v=null;const u=p.ref(!1),e=p.ref(!1),w=p.ref(!1),y=p.ref(!1),x=p.ref(!1),h=p.ref(!1),n=p.computed(()=>C.value),i=p.ref(null),d=p.computed(()=>n.value[i.value]||null),s=p.computed(()=>{var ve;const ye=((ve=d.value)==null?void 0:ve.views)||[];return I(ye)}),c=p.ref(null),f=p.computed(()=>s.value.find(ve=>ve.id===c.value)||null),m=p.ref([]),T=p.computed(()=>{var ve,ye;return u.value?((ve=f.value)==null?void 0:ve.filters_edition_mode)||[]:((ye=f.value)==null?void 0:ye.filters)||[]});p.watch(u,ve=>{ve||(e.value=!1)}),p.watch(f,ve=>{var ye,De;if(!ve){m.value=[];return}const Re=ve.id===6&&B.isPostMatch;if(!Array.isArray(T.value)&&!Re){m.value=[];return}if(y.value)return;Re?m.value=[]:m.value=T.value.map((We,Je)=>{var ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et;if(We.type==="select"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt){if(tt.selectedOptions&&Array.isArray(tt.selectedOptions)){const st=tt.selectedOptions.map(Xe=>Xe.value);return console.log(`Using saved select values for filter ${Je}:`,st),st}else if(tt.selectedValue&&Array.isArray(tt.selectedValue))if(tt.selectedValue.length>0&&tt.selectedValue[0]&&typeof tt.selectedValue[0]=="object"){const st=Ge(tt.selectedValue);return console.log(`Using saved Timeline values for filter ${Je}:`,st),st}else return console.log(`Using saved selectedValue for filter ${Je}:`,tt.selectedValue),tt.selectedValue}}if(ve.id===4&&We.options&&Array.isArray(We.options)){const tt=We.options.map(st=>st.value);return console.log(`Timeline detected - preselecting all options for filter ${Je}:`,tt),console.log("Timeline - filter options:",We.options),console.log("Timeline - filter type:",We.type),tt}return[]}else if(We.type==="radio-button"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.selectedOption)return console.log(`Using saved radio-button value for filter ${Je}:`,tt.selectedOption.value),tt.selectedOption.value}if(ve.id===7&&u.value&&t!=null&&t.view){if(console.log(`GSCGoalData - checking for stored values in initialization for filter ${Je}:`,t.view),console.log("GSCGoalData - filter index:",Je,"filter type:",We.type,"filter label:",We.label),Je===0&&(ke=t.view.componentProps)!=null&&ke.analysisType){const tt=t.view.componentProps.analysisType,st=tt==="offensive"?1:2;return console.log(`GSCGoalData - setting radio-button filter ${Je} to analysis value:`,st,"analysisType:",tt),console.log("GSCGoalData - filter options:",We.options),st}if(Je===1&&((ze=t.view.filterMultiple)==null?void 0:ze.isHomeTeam)!==void 0){const tt=t.view.filterMultiple.isHomeTeam,st=tt?1:2;return console.log(`GSCGoalData - setting radio-button filter ${Je} to team value:`,st,"isHomeTeam:",tt),console.log("GSCGoalData - filter options:",We.options),st}console.log(`GSCGoalData - filter index ${Je} - no stored value found or not applicable`)}else console.log(`GSCGoalData - conditions not met: newVal.id=${ve.id}, isEditMode=${u.value}, hasView=${!!(t!=null&&t.view)}`);return((He=(Fe=We.options)==null?void 0:Fe[0])==null?void 0:He.value)??null}else if(We.type==="select-simple"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.selectedValue!==void 0){console.log(`Using saved select-simple value for filter ${Je}:`,tt.selectedValue),console.log("Saved selectedValue type:",typeof tt.selectedValue),console.log("Saved selectedValue is array:",Array.isArray(tt.selectedValue));let st;return ve.id===2&&(nt=(rt=t==null?void 0:t.view)==null?void 0:rt.filterMultiple)!=null&&nt.categoryId?(st=t.view.filterMultiple.categoryId,console.log("GSCtops - using filterMultiple.categoryId in initialization:",st)):ve.id===1&&(vt=(ht=t==null?void 0:t.view)==null?void 0:ht.filterMultiple)!=null&&vt.category?(st=t.view.filterMultiple.category,console.log("GSCComparativeReports - using filterMultiple.category in initialization:",st)):ve.id===6&&(Rt=(ft=t==null?void 0:t.view)==null?void 0:ft.filterMultiple)!=null&&Rt.gameNumber?(st=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - using filterMultiple.gameNumber in initialization:",st)):st=Array.isArray(tt.selectedValue)?tt.selectedValue[0]:tt.selectedValue,console.log(`Returning select-simple value for filter ${Je}:`,st),st}}if(ve.id===2&&u.value&&t!=null&&t.view){if(b&&t.view.id){const tt=b.getComponentDynamicFilters(t.view.id);if(tt&&tt[Je]!==void 0)return console.log(`GSCtops - using component specific filter for index ${Je}:`,tt[Je]),tt[Je]}if(t.view.filterMultiple){if(console.log("111 ************************************************************",t.view.filterMultiple),We.type==="select-simple"&&t.view.filterMultiple.categoryId){const tt=t.view.filterMultiple.categoryId,st=(We.options||[]).find(Xe=>Xe.value==tt);return console.log("GSCtops - matching option in initialization:",st),tt}if(We.type==="radio-button"&&t.view.filterMultiple.teamType!==void 0){const tt=t.view.filterMultiple.teamType;return(We.options||[]).find(st=>st.value==tt)?(console.log("GSCtops - returning teamType:",tt),tt):(console.log("GSCtops - no matching option found for teamType:",tt),console.log("GSCtops - returning teamType anyway for consistency:",tt),tt)}else console.log("GSCtops - radio-button condition not met:",{isRadioButton:We.type==="radio-button",hasTeamType:t.view.filterMultiple.teamType!==void 0,teamType:t.view.filterMultiple.teamType})}}if(ve.id===1&&u.value&&(Ft=t==null?void 0:t.view)!=null&&Ft.filterMultiple&&(console.log(`GSCComparativeReports - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),t.view.filterMultiple.category)){const tt=t.view.filterMultiple.category,st=(We.options||[]).find(Xe=>Xe.value==tt);return console.log("GSCComparativeReports - matching option in initialization:",st),tt}if(ve.id===9&&u.value&&(Bt=t==null?void 0:t.view)!=null&&Bt.filterMultiple&&(console.log(`GSCFieldDataByZones - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),We.type==="select-simple"&&t.view.filterMultiple.categoryIds)){const tt=Array.isArray(t.view.filterMultiple.categoryIds)?t.view.filterMultiple.categoryIds:[t.view.filterMultiple.categoryIds];console.log(`GSCFieldDataByZones - setting select-simple filter ${Je} to categoryIds:`,tt),console.log("GSCFieldDataByZones - categoryIds type in initialization:",typeof tt),console.log("GSCFieldDataByZones - filter options in initialization:",We.options);const st=(We.options||[]).filter(Xe=>Array.isArray(Xe.value)?Ce(Xe.value,tt):tt.includes(Xe.value));if(st.length>0){const Xe=st[0];return console.log("GSCFieldDataByZones - found matching option in initialization:",Xe),Xe.value}else return console.log("GSCFieldDataByZones - no matching options found, using categoryIds directly:",tt),tt}if(ve.id===6&&u.value&&(at=t==null?void 0:t.view)!=null&&at.filterMultiple&&(console.log(`GSCLineupsReports - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),t.view.filterMultiple.gameNumber)){const tt=t.view.filterMultiple.gameNumber;console.log(`GSCLineupsReports - setting select-simple filter ${Je} to gameNumber:`,tt),console.log("GSCLineupsReports - gameNumber type in initialization:",typeof tt),console.log("GSCLineupsReports - filter options in initialization:",We.options);const st=(We.options||[]).find(Xe=>Xe.value==tt);return console.log("GSCLineupsReports - matching option in initialization:",st),tt}if(ve.id===5&&u.value&&(Ze=t==null?void 0:t.view)!=null&&Ze.filterMultiple&&(console.log(`GSCVolumetricField - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),console.log("GSCVolumetricField - filter details:",{type:We.type,label:We.label,options:We.options}),t.view.filterMultiple.isHomeTeam!==void 0)){const tt=t.view.filterMultiple.isHomeTeam;console.log(`GSCVolumetricField - setting radio-button filter ${Je} to isHomeTeam:`,tt),console.log("GSCVolumetricField - isHomeTeam type in initialization:",typeof tt),console.log("GSCVolumetricField - filter options in initialization:",We.options);let st;typeof tt=="boolean"?(st=tt?1:2,console.log("GSCVolumetricField - isHomeTeam is boolean in initialization, converting:",tt,"-> teamValue:",st)):typeof tt=="number"?(st=tt===1?1:2,console.log("GSCVolumetricField - isHomeTeam is number in initialization, using directly:",tt,"-> teamValue:",st)):(st=1,console.log("GSCVolumetricField - isHomeTeam is unknown type in initialization, using default:",st));const Xe=(We.options||[]).find(lt=>lt.value==st);if(console.log("GSCVolumetricField - matching option in initialization:",Xe),We.type==="radio-button"&&(We.label==="Equipo"||We.label==="Team"||We.label==="Equipo seleccionado"))return console.log("GSCVolumetricField - applying team filter value:",st),st;console.log("GSCVolumetricField - filter is not a team filter, skipping:",We.label)}if(ve.id===9&&u.value&&(ct=t==null?void 0:t.view)!=null&&ct.filterMultiple&&(console.log(`GSCFieldDataByZones - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),We.type==="radio-button"&&t.view.filterMultiple.isHomeTeam!==void 0)){const tt=t.view.filterMultiple.isHomeTeam,st=tt?1:2;console.log(`GSCFieldDataByZones - setting radio-button filter ${Je} to team value:`,st,"isHomeTeam:",tt),console.log("GSCFieldDataByZones - filter options:",We.options);const Xe=((gt=We.options)==null?void 0:gt.map(lt=>lt.value))||[];return Xe.includes(st)?(console.log("GSCFieldDataByZones - using valid team value from filterMultiple:",st),st):(console.log("GSCFieldDataByZones - team value not in valid options, using default:",Xe[0]),Xe[0]||1)}return((Et=(Nt=We.options)==null?void 0:Nt[0])==null?void 0:Et.value)??null}else if(We.type==="check"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.isChecked!==void 0)return console.log(`Using saved checkbox value for filter ${Je}:`,tt.isChecked),tt.isChecked}if(ve.id===8)return!0;if(ve.id===3){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.isChecked!==void 0)return console.log(`GSCMatchSummary - Using saved checkbox value for filter ${Je}:`,tt.isChecked),tt.isChecked}return!1}return!1}return null});const Ve=((ye=ve.name)==null?void 0:ye.toLowerCase().includes("tops players"))||((De=ve.title)==null?void 0:De.toLowerCase().includes("tops players"));!Ve&&(!u.value||Re)&&p.nextTick(()=>{var We,Je,ke;console.log("Timeline - about to emit change:",{esTopsPlayers:Ve,isEditMode:u.value,selectedSecond:(We=f.value)==null?void 0:We.id}),ve.id===4&&u.value&&(Je=t==null?void 0:t.view)!=null&&Je.id&&(console.log("Timeline - saving specific filters for component:",t.view.id),b&&b.setDynamicFilters(m.value,t.view.id)),ve.id===3&&u.value&&(ke=t==null?void 0:t.view)!=null&&ke.id&&(console.log("GSCMatchSummary - saving specific filters for component:",t.view.id),b&&b.setDynamicFilters(m.value,t.view.id)),he()})},{immediate:!0}),p.watch(()=>b,ve=>{ve&&ve.dynamicFilters&&(console.log("FilterAndViewsContainer changed, updating dynamicFilters:",ve.dynamicFilters),Array.isArray(ve.dynamicFilters)&&(y.value=!0,m.value=[...ve.dynamicFilters],p.nextTick(()=>{y.value=!1})))},{deep:!0}),p.watch(()=>b==null?void 0:b.dynamicFilters,ve=>{if(ve&&Array.isArray(ve)){if(console.log("Container dynamicFilters changed, updating:",ve),x.value){console.log("Skipping container update due to user update in progress");return}y.value=!0,m.value=[...ve],p.nextTick(()=>{y.value=!1})}},{deep:!0}),p.watch(()=>f.value,ve=>{if(u.value&&v&&ve&&ve.filters){if(y.value)return;if(h.value){console.log("Skipping force updates in selectedSecond watcher - already in force update");return}if(ve.id===3){if(console.log("GSCMatchSummary detected in edit mode, loading saved filters"),x.value||h.value){console.log("GSCMatchSummary - Skipping due to update in progress");return}const ye=v.dynamicFilters.find(De=>De.filterType==="check");ye&&ye.isChecked!==void 0&&(console.log("GSCMatchSummary - Found saved checkbox value:",ye.isChecked),m.value&&m.value.length>0&&(x.value=!0,m.value[0]=ye.isChecked,console.log("GSCMatchSummary - Updated dynamicFilters:",m.value),p.nextTick(()=>{m.value=[...m.value],console.log("GSCMatchSummary - Forced UI update"),x.value=!1})))}setTimeout(()=>{(!m.value||m.value.length===0)&&(Ne(),Le(),je()),ve.id===4&&Oe()},100)}},{deep:!0}),p.watch(()=>{var ve;return(ve=f.value)==null?void 0:ve.id},ve=>{if(u.value&&v&&ve===4){if(console.log("Timeline detected, preselecting filters"),y.value)return;if(h.value){console.log("Skipping force updates in Timeline watcher - already in force update");return}setTimeout(()=>{Oe()},200)}}),p.watch(()=>m.value,ve=>{if(u.value&&v&&ve&&ve.length>0){if(console.log("(((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))",v),console.log("Dynamic filters initialized, forcing update"),y.value||x.value)return;if(h.value){console.log("Skipping force updates - already in force update");return}setTimeout(()=>{var ye;me()&&(Ne(),Le(),je(),((ye=f.value)==null?void 0:ye.id)===4&&Oe())},50)}},{deep:!0});function E(ve,ye){var De,Re,Ve,We,Je;const ke=m.value[ve];if(((De=f.value)==null?void 0:De.id)===4&&ve===0&&console.log("Timeline filter check - optionValue:",ye,"selectedValues:",ke),((Re=f.value)==null?void 0:Re.id)===6&&ve===0&&console.log("GSCLineupsReports filter check - optionValue:",ye,"selectedValues:",ke,"type:",typeof ke),Array.isArray(ke)){if(((Ve=f.value)==null?void 0:Ve.id)===4&&ve===0){const ze=ke.some(Fe=>ye.category_id&&ye.event_type_id?Fe.category_id===ye.category_id&&Fe.event_type_id===ye.event_type_id:ye.event_type_id?Fe.event_type_id===ye.event_type_id:ye.category_id?Fe.category_id===ye.category_id:!1);return((We=f.value)==null?void 0:We.id)===4&&ve===0&&console.log("Timeline comparison (IDs) - optionValue:",ye,"selectedValues:",ke,"isSelected:",ze),ze}return ke.includes(ye)}else if(ke!=null){if(((Je=f.value)==null?void 0:Je.id)===6&&ve===0){const ze=ke===ye;return console.log("GSCLineupsReports comparison - optionValue:",ye,"selectedValues:",ke,"isSelected:",ze),ze}return ke===ye}return!1}function S(ve,ye){var De,Re;const Ve=(Re=(De=f.value)==null?void 0:De.filters)==null?void 0:Re[ve];if((Ve==null?void 0:Ve.type)==="select-simple"){console.log("toggleMultiSelectOption called for select-simple filter, using selectSimpleOption instead"),ae(ve,ye);return}Array.isArray(m.value[ve])||(m.value[ve]=[]);const We=m.value[ve],Je=We.indexOf(ye);Je>-1?We.splice(Je,1):We.push(ye),u.value&&Ie(),he()}function L(ve){var ye,De;const Re=m.value[ve],Ve=(De=(ye=f.value)==null?void 0:ye.filters)==null?void 0:De[ve];return(Ve==null?void 0:Ve.type)==="select-simple"||!Ve||!Ve.options||!Array.isArray(Re)?!1:Re.length===Ve.options.length}function N(ve){var ye,De;const Re=m.value[ve],Ve=(De=(ye=f.value)==null?void 0:ye.filters)==null?void 0:De[ve];return(Ve==null?void 0:Ve.type)==="select-simple"||!Ve||!Ve.options||!Array.isArray(Re)?!1:Re.length>0&&Re.length<Ve.options.length}function A(){var ve;return console.log("props.isPostMatch",B.isPostMatch),!(((ve=f.value)==null?void 0:ve.id)===6&&B.isPostMatch)}function I(ve){return!ve||!Array.isArray(ve)?ve:ve.filter(ye=>{const De=(ye.name||ye.title||"").toLowerCase();return B.isPostMatch?B.isPostMatch?!["fortalezas","tabla general"].some(Re=>De.includes(Re)):!0:!["resumen general","timeline","datos relevantes"].some(Re=>De.includes(Re))})}function M(){var ve,ye;const De=((ye=(ve=d.value)==null?void 0:ve.name)==null?void 0:ye.toLowerCase())||"";return De.includes("cancha")||De.includes("volumétrica")||De.includes("volumetric")}function k(ve,ye){if(!u.value||!M())return!1;const De=String(ve||"").toLowerCase(),Re=String(ye||"").toLowerCase();return De.includes("ambos")||Re.includes("ambos")}function R(ve){var ye,De;const Re=(De=(ye=f.value)==null?void 0:ye.filters)==null?void 0:De[ve];if(!Re||!Re.options)return;const Ve=Re.options.map(We=>We.value);Array.isArray(m.value[ve])||(m.value[ve]=[]),L(ve)?m.value[ve]=[]:m.value[ve]=[...Ve],V.value=ve,he()}const _=p.ref("ambos"),O=p.ref(!1),z=p.ref(!1),V=p.ref(null),U=p.ref(null);function q(ve,ye=!1){const De="https://golstatsimages.blob.core.windows.net/images-library/",Re="https://golstatsimages.blob.core.windows.net/reports-images/",Ve={cancha:"icn_cancha",grafico:"icn_grafico",gráfico:"icn_grafico",chart:"icn_grafico",volumetrica:"icn_cancha",volumétrica:"icn_cancha",volumetric:"icn_cancha",tabla:"icn_tabla",tablas:"icn_tabla",Tablas:"icn_tabla"},We=Object.keys(Ve).find(Je=>ve==null?void 0:ve.toLowerCase().includes(Je.toLowerCase()));if(We){const Je=Ve[We],ke=ye?"":"-def";return We.toLowerCase().includes("tabla")?`${Re}${Je}${ke}@2x.png`:`${De}${Je}${ke}@2x.png`}return`${De}icn_default${ye?"":"-def"}.png`}function W(){return d.value?d.value.name:"Tipo de vista"}function Y(){return f.value?f.value.name||f.value.title:"Visualización"}function ne(){u.value||(O.value=!O.value,O.value&&(z.value=!1,p.nextTick(()=>{Se()})))}function X(){u.value||d.value&&(z.value=!z.value,z.value&&(O.value=!1))}function re(ve){u.value||(i.value=ve,O.value=!1,c.value=null,he())}function ee(ve){var ye,De;u.value||(c.value=ve.id,z.value=!1,(ye=ve.name)!=null&&ye.toLowerCase().includes("tops players")||(De=ve.title)==null||De.toLowerCase().includes("tops players"))}function Z(ve){var ye;V.value=V.value===ve?null:ve,((ye=f.value)==null?void 0:ye.id)===4&&u.value&&ve===0&&(console.log("Timeline dropdown opened, forcing checkbox update"),setTimeout(()=>{m.value=[...m.value]},50))}function te(ve){U.value=U.value===ve?null:ve}function ae(ve,ye){var De,Re,Ve,We,Je,ke,ze;if(console.log("selectSimpleOption called:",{idx:ve,optionValue:ye,isEditMode:u.value}),((De=f.value)==null?void 0:De.id)===2){console.log("GSCtops - selectSimpleOption for GSCtops");const Fe=T.value.findIndex(He=>He.type==="select-simple"&&He.label==="Tipo de análisis");ve===Fe?(m.value[0]=ye,console.log("GSCtops - updated dynamicFilters[0] (category) to:",ye)):(m.value[ve]=ye,console.log("GSCtops - updated dynamicFilters["+ve+"] to:",ye))}else if(((Re=f.value)==null?void 0:Re.id)===1)console.log("GSCComparativeReports - selectSimpleOption for GSCComparativeReports"),m.value[0]=ye,console.log("GSCComparativeReports - updated dynamicFilters[0] (analysis type) to:",ye);else if(((Ve=f.value)==null?void 0:Ve.id)===6)console.log("GSCLineupsReports - selectSimpleOption for GSCLineupsReports"),m.value[0]=ye,console.log("GSCLineupsReports - updated dynamicFilters[0] (game number) to:",ye);else if(((We=f.value)==null?void 0:We.id)===9)if(console.log("GSCFieldDataByZones - selectSimpleOption for GSCFieldDataByZones"),ve===0){Array.isArray(ye)?(m.value[ve]=ye,console.log("GSCFieldDataByZones - updated dynamicFilters[0] (categories) to:",ye)):(m.value[ve]=[ye],console.log("GSCFieldDataByZones - converted to array and updated dynamicFilters[0] (categories) to:",[ye]));const Fe=((Je=T.value[ve])==null?void 0:Je.options)||[];console.log("GSCFieldDataByZones - filterOptions for comparison:",Fe);const He=Array.isArray(ye)?ye:[ye],rt=Fe.find(nt=>Array.isArray(nt.value)?Ce(nt.value,He):He.includes(nt.value));console.log("GSCFieldDataByZones - matching option found:",rt),rt?(console.log("GSCFieldDataByZones - using matching option value:",rt.value),m.value[ve]=rt.value,console.log("GSCFieldDataByZones - updated dynamicFilters["+ve+"] to matching option value:",rt.value)):(console.log("GSCFieldDataByZones - no matching option found, using selectedValue directly"),m.value[ve]=He)}else m.value[ve]=ye,console.log("GSCFieldDataByZones - updated dynamicFilters["+ve+"] to:",ye);else m.value[ve]=ye;U.value=null,console.log("dynamicFilters after selectSimpleOption:",m.value),((ke=f.value)==null?void 0:ke.id)===6&&(console.log("GSCLineupsReports - selectSimpleOption called"),console.log("GSCLineupsReports - isEditMode:",u.value),console.log("GSCLineupsReports - viewToEdit:",t),console.log("GSCLineupsReports - dynamicFilters:",m.value)),!(u.value&&(console.log("calling updateContainerOnUserChange"),console.log("isEditMode.value:",u.value),console.log("viewToEdit:",t),console.log("filterAndViewsContainer:",b),Ie(),((ze=f.value)==null?void 0:ze.id)===9))&&(console.log("calling emitChange"),he())}function oe(ve){ve.target.closest(".custom-select")||(O.value=!1,z.value=!1,U.value=null)}function he(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st,Xe,lt,Tt;if(console.log("emitChange called"),console.log("isEditMode.value:",u.value),console.log("viewToEdit:",t),console.log("dynamicFilters.value:",m.value),y.value){console.log("Skipping emitChange due to container update in progress");return}((ve=f.value)==null?void 0:ve.id)===8&&(console.log("FieldPosesion detected - dynamicFilters:",m.value),console.log("Current filters:",T.value)),((ye=f.value)==null?void 0:ye.id)===4&&(console.log("Timeline detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("Timeline - will emit change:",!y.value)),((De=f.value)==null?void 0:De.id)===2&&(console.log("GSCtops detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("GSCtops - will emit change:",!y.value)),((Re=f.value)==null?void 0:Re.id)===6&&(console.log("GSCLineupsReports detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("GSCLineupsReports - will emit change:",!y.value),console.log("GSCLineupsReports - isEditMode:",u.value),console.log("GSCLineupsReports - viewToEdit:",t)),((Ve=f.value)==null?void 0:Ve.id)===9&&(console.log("GSCFieldDataByZones detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("GSCFieldDataByZones - will emit change:",!y.value),console.log("GSCFieldDataByZones - isEditMode:",u.value),console.log("GSCFieldDataByZones - viewToEdit:",t));let yt=[],It=[];f.value&&Array.isArray(T.value)&&T.value.forEach((xt,Pt)=>{if(xt.type==="select"&&xt.label==="Tipo de análisis"&&xt.id===2){const Ot=m.value[Pt]||[];Array.isArray(Ot)&&Ot.length>0&&(yt=Ot.map(kt=>{var Ht;const qt=(Ht=xt.options)==null?void 0:Ht.find(Jt=>Jt.value===kt);return{value:kt,label:(qt==null?void 0:qt.label)||kt}}))}});const Lt=((We=f.value)==null?void 0:We.id)===4;if(f.value&&Array.isArray(f.value.filters)&&f.value.filters.some(xt=>xt.type==="select"&&xt.label==="Tipo de análisis"&&xt.id===2)&&yt.length===0&&!Lt)return;if(Lt&&m.value&&m.value.length>0){const xt=m.value[0];Array.isArray(xt)&&xt.length>0&&console.log("Timeline - emitting change with events:",xt)}It=((Je=T.value)==null?void 0:Je.map((xt,Pt)=>{var Ot,kt,Ht,qt,Jt;const Wt=m.value[Pt];((Ot=f.value)==null?void 0:Ot.id)===8&&console.log(`FieldPosesion filter ${Pt}:`,{type:xt.type,label:xt.label,selectedValue:Wt,selectedValueType:typeof Wt,isRadioButton:xt.type==="radio-button"});let Gt=xt.id||`filter_${Pt}`;return((kt=f.value)==null?void 0:kt.id)===3&&u.value&&(Ht=t==null?void 0:t.view)!=null&&Ht.id&&(Gt=`filter_${Pt}_component_${t.view.id}`,console.log(`GSCMatchSummary - Generated unique filterId: ${Gt} for component ${t.view.id}`)),{filterId:Gt,filterType:xt.type,filterLabel:xt.label,filterIcon:xt.icon||null,selectedValue:Wt,selectedOptions:xt.type==="select"&&Array.isArray(Wt)&&Wt.length>0?Wt.map(rr=>{var ir;const vr=(ir=xt.options)==null?void 0:ir.find(kr=>kr.value===rr);return{value:rr,label:(vr==null?void 0:vr.label)||rr,icon:(vr==null?void 0:vr.icon)||null}}):null,selectedOption:xt.type==="radio-button"&&Wt!=null?{value:Wt,label:((Jt=(qt=xt.options)==null?void 0:qt.find(rr=>rr.value===Wt))==null?void 0:Jt.label)||Wt}:null,isChecked:xt.type==="check"?Wt:null}}))||[];const Qe={mainSelector:{id:((ke=d.value)==null?void 0:ke.id)||null,name:((ze=d.value)==null?void 0:ze.name)||null,url:((Fe=d.value)==null?void 0:Fe.url)||null},viewSelector:{id:((He=f.value)==null?void 0:He.id)||null,name:((rt=f.value)==null?void 0:rt.name)||((nt=f.value)==null?void 0:nt.title)||null,url:((ht=f.value)==null?void 0:ht.url)||null},team:_.value,dynamicFilters:It,categoriasSeleccionadas:yt,timestamp:new Date().toISOString(),summary:{mainSelected:!!d.value,viewSelected:!!f.value,totalDynamicFilters:((vt=T.value)==null?void 0:vt.length)||0,activeFilters:((ft=T.value)==null?void 0:ft.filter((xt,Pt)=>{const Ot=m.value[Pt];return Array.isArray(Ot)?Ot.length>0:Ot!=null&&Ot!==!1}).length)||0}};t&&(console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"),console.log("viewToEdit.view.filterAndViewsContainer",t.view.filterAndViewsContainer),console.log("viewToEdit.view.filterAndViewsContainer.childViews.length",t.view.filterAndViewsContainer.childViews.length));const et={main:d.value,view:f.value,team:_.value,dynamicFilters:m.value,filtersJSON:Qe,filterAndViewsContainer:b,viewToEdit:t};if(console.log("GSCtops - emitting filters-changed with data:",et),K("filters-changed",et),u.value&&t){if(v=Qe,console.log("Updated editFiltersJSON:",v),((Rt=f.value)==null?void 0:Rt.id)===8&&(console.log("FieldPosesion - editFiltersJSON updated:",v),console.log("FieldPosesion - dynamicFilters in JSON:",v.dynamicFilters)),((Ft=f.value)==null?void 0:Ft.id)===2){console.log("GSCtops - editFiltersJSON updated:",v),console.log("GSCtops - dynamicFilters in JSON:",v.dynamicFilters),console.log("GSCtops - viewToEdit.filterMultiple:",(Bt=t.view)==null?void 0:Bt.filterMultiple);const xt=v.dynamicFilters.findIndex(Pt=>Pt.filterType==="select-simple"&&Pt.filterLabel==="Tipo de análisis");xt!==-1&&(Ze=(at=t.view)==null?void 0:at.filterMultiple)!=null&&Ze.categoryId&&(v.dynamicFilters[xt].selectedValue=t.view.filterMultiple.categoryId,console.log("GSCtops - updated editFiltersJSON with filterMultiple.categoryId:",t.view.filterMultiple.categoryId))}if(((ct=f.value)==null?void 0:ct.id)===1){console.log("GSCComparativeReports - editFiltersJSON updated:",v),console.log("GSCComparativeReports - dynamicFilters in JSON:",v.dynamicFilters),console.log("GSCComparativeReports - viewToEdit.filterMultiple:",(gt=t.view)==null?void 0:gt.filterMultiple);const xt=v.dynamicFilters.findIndex(Pt=>Pt.filterType==="select-simple"&&Pt.filterLabel==="Tipo de análisis");xt!==-1&&(Et=(Nt=t.view)==null?void 0:Nt.filterMultiple)!=null&&Et.category&&(v.dynamicFilters[xt].selectedValue=t.view.filterMultiple.category,console.log("GSCComparativeReports - updated editFiltersJSON with filterMultiple.category:",t.view.filterMultiple.category))}}if(((tt=f.value)==null?void 0:tt.id)===6&&u.value&&(st=t==null?void 0:t.view)!=null&&st.filterMultiple&&(console.log("GSCLineupsReports - viewToEdit.filterMultiple:",(Xe=t.view)==null?void 0:Xe.filterMultiple),t.view.filterMultiple.gameNumber&&v)){const xt=v.dynamicFilters.findIndex(Pt=>Pt.filterType==="select-simple"&&Pt.filterLabel==="Número de juego");xt!==-1&&(Tt=(lt=t.view)==null?void 0:lt.filterMultiple)!=null&&Tt.gameNumber&&(v.dynamicFilters[xt].selectedValue=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - updated editFiltersJSON with filterMultiple.gameNumber:",t.view.filterMultiple.gameNumber))}b&&!u.value?(b.setDynamicFilters(m.value),console.log("Updated container with new dynamicFilters:",m.value)):b&&u.value&&console.log("In edit mode, not updating container automatically")}function fe(){t=null,v=null,b=null,i.value=null,c.value=null,_.value="ambos",m.value=[],O.value=!1,z.value=!1,V.value=null,U.value=null,u.value=!1,e.value=!1,w.value=!1}function se(ve){if(ve&&ve.dynamicFilters){if(console.log("Updating filters from container:",ve.dynamicFilters),x.value){console.log("Skipping container update due to user update in progress");return}Array.isArray(ve.dynamicFilters)&&ve.dynamicFilters.length>0&&(y.value=!0,m.value=[...ve.dynamicFilters],p.nextTick(()=>{y.value=!1}))}}function ue(ve){if(console.log("preselectFiltersFromJSON called with:",ve),u.value=!0,ve.mainSelector&&ve.mainSelector.id){const ye=C.value.findIndex(De=>De.id===ve.mainSelector.id);ye!==-1&&(i.value=ye,console.log("Selected main index:",ye))}ve.viewSelector&&ve.viewSelector.id&&d.value&&d.value.views.findIndex(ye=>ye.id===ve.viewSelector.id)!==-1&&(c.value=ve.viewSelector.id,console.log("Selected second id:",ve.viewSelector.id)),ve.dynamicFilters&&Array.isArray(ve.dynamicFilters)&&(console.log("Processing dynamic filters:",ve.dynamicFilters),p.nextTick(()=>{setTimeout(()=>{var ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st,Xe,lt,Tt,yt,It;if(console.log("Processing filters after delay"),console.log("selectedSecond.value:",f.value),f.value&&T.value){if(console.log("Filters available:",T.value),y.value){console.log("Skipping preselect due to container update in progress");return}if(x.value=!0,console.log("&666&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",ve.dynamicFilters),ve.dynamicFilters.forEach((Lt,Qe)=>{var et,xt,Pt,Ot,kt,Ht,qt,Jt,Wt,Gt,rr,ir,vr,kr;if(Qe<T.value.length){const wr=T.value[Qe];if(((et=f.value)==null?void 0:et.id)===3&&u.value&&console.log(`GSCMatchSummary - Processing filter ${Qe} for component ${((xt=t==null?void 0:t.view)==null?void 0:xt.id)||"unknown"}`),wr.type==="check"){const ar=Lt.isChecked;console.log(`Setting check filter ${Qe} to:`,ar),typeof ar=="boolean"?(m.value[Qe]=ar,console.log(`Successfully set check filter ${Qe} to:`,ar)):console.log(`Invalid isChecked value for filter ${Qe}:`,ar)}else if(wr.type==="select"&&Lt.selectedOptions){const ar=Lt.selectedOptions.map(_r=>_r.value);console.log(`Setting select filter ${Qe} to:`,ar),m.value[Qe]=ar,console.log(`Successfully set select filter ${Qe} to:`,ar)}else if(wr.type==="select"&&Lt.selectedValue&&Array.isArray(Lt.selectedValue))if(Lt.selectedValue.length>0&&Lt.selectedValue[0]&&typeof Lt.selectedValue[0]=="object"){const ar=Ge(Lt.selectedValue);console.log(`Setting Timeline select filter ${Qe} to:`,ar),m.value[Qe]=ar,console.log(`Successfully set Timeline select filter ${Qe} to:`,ar)}else console.log(`Setting select filter ${Qe} to:`,Lt.selectedValue),m.value[Qe]=Lt.selectedValue,console.log(`Successfully set select filter ${Qe} to:`,Lt.selectedValue);else if(wr.type==="radio-button"&&Lt.selectedOption)console.log(`Setting radio filter ${Qe} to:`,Lt.selectedOption.value),m.value[Qe]=Lt.selectedOption.value;else if(wr.type==="select-simple"&&Lt.selectedValue!==void 0){console.log(`Setting select-simple filter ${Qe} to:`,Lt.selectedValue),console.log("select-simple filterData.selectedValue type:",typeof Lt.selectedValue),console.log("select-simple filterData.selectedValue is array:",Array.isArray(Lt.selectedValue));let ar;((Pt=f.value)==null?void 0:Pt.id)===2&&(kt=(Ot=t==null?void 0:t.view)==null?void 0:Ot.filterMultiple)!=null&&kt.categoryId?(ar=t.view.filterMultiple.categoryId,console.log("GSCtops - using filterMultiple.categoryId instead of selectedValue:",ar)):((Ht=f.value)==null?void 0:Ht.id)===1&&(Jt=(qt=t==null?void 0:t.view)==null?void 0:qt.filterMultiple)!=null&&Jt.category?(ar=t.view.filterMultiple.category,console.log("GSCComparativeReports - using filterMultiple.category instead of selectedValue:",ar)):((Wt=f.value)==null?void 0:Wt.id)===6&&(rr=(Gt=t==null?void 0:t.view)==null?void 0:Gt.filterMultiple)!=null&&rr.gameNumber?(ar=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - using filterMultiple.gameNumber instead of selectedValue:",ar)):((ir=f.value)==null?void 0:ir.id)===9&&(kr=(vr=t==null?void 0:t.view)==null?void 0:vr.filterMultiple)!=null&&kr.categoryIds?(ar=t.view.filterMultiple.categoryIds,console.log("GSCFieldDataByZones - using filterMultiple.categoryIds instead of selectedValue:",ar)):ar=Array.isArray(Lt.selectedValue)?Lt.selectedValue[0]:Lt.selectedValue,m.value[Qe]=ar,console.log(`Successfully set select-simple filter ${Qe} to:`,ar)}}else console.log(`Filter index ${Qe} out of range`)}),console.log("Final dynamicFilters.value:",m.value),((ye=f.value)==null?void 0:ye.id)===3&&u.value&&console.log("GSCMatchSummary - Final dynamicFilters after processing:",m.value),((De=f.value)==null?void 0:De.id)===2&&u.value&&(Re=t==null?void 0:t.view)!=null&&Re.filterMultiple){if(console.log("GSCtops - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("GSCtops - currentFilters:",T.value),console.log("GSCtops - dynamicFilters before:",m.value),t.view.filterMultiple.categoryId){console.log("GSCtops - found categoryId in filterMultiple:",t.view.filterMultiple.categoryId);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple"&&Qe.label==="Tipo de análisis");if(console.log("GSCtops - categoryFilterIndex:",Lt),console.log("GSCtops - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCtops - found category filter at index:",Lt);const Qe=t.view.filterMultiple.categoryId;if(console.log("GSCtops - setting category filter directly from filterMultiple.categoryId:",Qe),m.value[0]=Qe,t.view.componentProps&&Qe){let xt=`Category ${Qe}`,Pt=null;try{Pt=Vd(Qe),Pt&&(xt=Pt.name,console.log("GSCtops - found category info from getCategoryById in preselectFiltersFromJSON:",Pt))}catch{console.log("GSCtops - getCategoryById failed in preselectFiltersFromJSON, using filter options");const Ot=T.value.findIndex(kt=>kt.type==="select-simple"&&kt.label==="Tipo de análisis");if(Ot!==-1){const kt=(((Ve=T.value[Ot])==null?void 0:Ve.options)||[]).find(Ht=>Ht.value==Qe);kt&&(xt=kt.label,console.log("GSCtops - found category name from options in preselectFiltersFromJSON:",xt))}}t.view.componentProps.categoryView=[{id:Qe,name:xt}],console.log("GSCtops - updated componentProps.categoryView in preselectFiltersFromJSON:",t.view.componentProps.categoryView)}console.log("GSCtops - automatically set category filter to:",Qe),console.log("GSCtops - categoryId type:",typeof Qe),console.log("GSCtops - updated dynamicFilters:",m.value),console.log("GSCtops - filter options:",(We=T.value[Lt])==null?void 0:We.options);const et=(((Je=T.value[Lt])==null?void 0:Je.options)||[]).find(xt=>xt.value==Qe);console.log("GSCtops - matching option:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update")})}else console.log("GSCtops - category filter not found!")}if(t.view.filterMultiple.teamType!==void 0){console.log("GSCtops - found teamType in filterMultiple:",t.view.filterMultiple.teamType),console.log("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM ------------------------------------> ",T.value);const Lt=T.value.findIndex(Qe=>Qe.type==="radio-button");if(console.log("GSCtops - teamFilterIndex:",Lt),console.log("GSCtops - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCtops - found team filter at index:",Lt);const Qe=t.view.filterMultiple.teamType;console.log("GSCtops - setting team filter directly from filterMultiple.teamType:",Qe),m.value[Lt]=Qe,console.log("GSCtops - automatically set team filter to:",Qe),console.log("GSCtops - teamType type:",typeof Qe),console.log("GSCtops - updated dynamicFilters:",m.value),console.log("GSCtops - filter options:",(ke=T.value[Lt])==null?void 0:ke.options);const et=(((ze=T.value[Lt])==null?void 0:ze.options)||[]).find(xt=>xt.value==Qe);console.log("GSCtops - matching option for team:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update for team filter")})}else console.log("GSCtops - team filter not found!")}}if(((Fe=f.value)==null?void 0:Fe.id)===9&&u.value&&(He=t==null?void 0:t.view)!=null&&He.filterMultiple){if(console.log("55555 GSCFieldDataByZones - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("55555 GSCFieldDataByZones - currentFilters:",T.value),console.log(" 55555GSCFieldDataByZones - dynamicFilters before:",m.value),t.view.filterMultiple.categoryIds){console.log("55555 GSCFieldDataByZones - found categoryIds in filterMultiple:",t.view.filterMultiple.categoryIds);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple");if(console.log("55555 GSCFieldDataByZones - analysisTypeFilterIndex:",Lt),console.log("55555 GSCFieldDataByZones - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("55555 GSCFieldDataByZones - found analysis type filter at index:",Lt);const Qe=Array.isArray(t.view.filterMultiple.categoryIds)?t.view.filterMultiple.categoryIds:[t.view.filterMultiple.categoryIds];console.log("55555 GSCFieldDataByZones - setting category filter directly from filterMultiple.categoryIds:",Qe),m.value[0]=Qe,console.log("55555 GSCFieldDataByZones - automatically set category filter to:",Qe),console.log("55555 GSCFieldDataByZones - categoryIds type:",typeof Qe),console.log("55555 GSCFieldDataByZones - categoryIds is array:",Array.isArray(Qe)),console.log("55555 GSCFieldDataByZones - updated dynamicFilters:",m.value),console.log("55555 GSCFieldDataByZones - filter options:",(rt=T.value[Lt])==null?void 0:rt.options);const et=((nt=T.value[Lt])==null?void 0:nt.options)||[];console.log("55555 filterOptions :",et);const xt=et.filter(kt=>Array.isArray(kt.value)?Ce(kt.value,Qe):Qe.includes(kt.value));if(console.log("55555 GSCFieldDataByZones - matching options:",xt),xt.length>0){const kt=xt[0];console.log("55555 GSCFieldDataByZones - found matching option:",kt);const Ht=kt.value;console.log("55555 GSCFieldDataByZones - using option value:",Ht),m.value[Lt]=Ht,console.log("55555 GSCFieldDataByZones - set dynamicFilters["+Lt+"] to option value:",Ht)}else console.log("55555 GSCFieldDataByZones - no matching options found, using categoryIds directly"),m.value[Lt]=Qe;const Pt=m.value[Lt],Ot=Ce(Pt,Qe);console.log("55555 GSCFieldDataByZones - arrays match:",Ot),console.log("55555 GSCFieldDataByZones - current filter value:",Pt,"categoryIds:",Qe),p.nextTick(()=>{m.value=[...m.value],console.log("55555 GSCFieldDataByZones - forced reactivity update")})}else console.log("55555 GSCFieldDataByZones - analysis type filter not found!")}if(t.view.filterMultiple.isHomeTeam!==void 0){console.log("444444444 GSCFieldDataByZones - found isHomeTeam in filterMultiple:",t.view.filterMultiple.isHomeTeam);const Lt=T.value.findIndex(Qe=>Qe.type==="radio-button");if(console.log("444444444 GSCFieldDataByZones - teamFilterIndex:",Lt),console.log("444444444 GSCFieldDataByZones - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("444444444 GSCFieldDataByZones - found team filter at index:",Lt);const Qe=t.view.filterMultiple.isHomeTeam;console.log("444444444 GSCFieldDataByZones - isHomeTeam type:",typeof Qe,"value:",Qe);let et;typeof Qe=="boolean"?(et=Qe?1:2,console.log("444444444 GSCFieldDataByZones - converted boolean isHomeTeam to teamValue:",Qe,"->",et)):typeof Qe=="number"?(et=Qe===1?1:2,console.log("444444444 GSCFieldDataByZones - converted numeric isHomeTeam to teamValue:",Qe,"->",et)):(et=1,console.log("444444444 GSCFieldDataByZones - using default teamValue:",et)),console.log("444444444 GSCFieldDataByZones - setting team filter directly from filterMultiple.isHomeTeam:",Qe,"-> teamValue:",et),m.value[Lt]=et,console.log("444444444 GSCFieldDataByZones - automatically set team filter to:",et),console.log("444444444 GSCFieldDataByZones - teamValue type:",typeof et),console.log("444444444 GSCFieldDataByZones - updated dynamicFilters:",m.value),console.log(" 444444444 GSCFieldDataByZones - filter options:",(ht=T.value[Lt])==null?void 0:ht.options);const xt=(((vt=T.value[Lt])==null?void 0:vt.options)||[]).find(Pt=>Pt.value==et);console.log("444444444 GSCFieldDataByZones - matching option for team:",xt),p.nextTick(()=>{console.log("4444444 **************************************** dynamicFilters *************",m.value),m.value=[...m.value],console.log(" 444444444GSCFieldDataByZones - forced reactivity update for team filter")})}else console.log(" 444444444GSCFieldDataByZones - team filter not found!")}}if(((ft=f.value)==null?void 0:ft.id)===1&&u.value&&(Rt=t==null?void 0:t.view)!=null&&Rt.filterMultiple&&(console.log("GSCComparativeReports - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("GSCComparativeReports - currentFilters:",T.value),console.log("GSCComparativeReports - dynamicFilters before:",m.value),t.view.filterMultiple.category)){console.log("GSCComparativeReports - found category in filterMultiple:",t.view.filterMultiple.category);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple"&&Qe.label==="Tipo de análisis");if(console.log("GSCComparativeReports - analysisTypeFilterIndex:",Lt),console.log("GSCComparativeReports - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCComparativeReports - found analysis type filter at index:",Lt);const Qe=t.view.filterMultiple.category;console.log("GSCComparativeReports - setting analysis type filter directly from filterMultiple.category:",Qe),m.value[0]=Qe,t.view.componentProps&&Qe&&(t.view.componentProps.type=Qe,console.log("GSCComparativeReports - updated componentProps.type:",t.view.componentProps.type)),console.log("GSCComparativeReports - automatically set analysis type filter to:",Qe),console.log("GSCComparativeReports - category type:",typeof Qe),console.log("GSCComparativeReports - updated dynamicFilters:",m.value),console.log("GSCComparativeReports - filter options:",(Ft=T.value[Lt])==null?void 0:Ft.options);const et=(((Bt=T.value[Lt])==null?void 0:Bt.options)||[]).find(xt=>xt.value==Qe);console.log("GSCComparativeReports - matching option:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCComparativeReports - forced reactivity update")})}else console.log("GSCComparativeReports - analysis type filter not found!")}if(((at=f.value)==null?void 0:at.id)===6&&u.value&&(Ze=t==null?void 0:t.view)!=null&&Ze.filterMultiple&&(console.log("GSCLineupsReports - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("GSCLineupsReports - currentFilters:",T.value),console.log("GSCLineupsReports - dynamicFilters before:",m.value),t.view.filterMultiple.gameNumber)){console.log("GSCLineupsReports - found gameNumber in filterMultiple:",t.view.filterMultiple.gameNumber);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple"&&Qe.label==="Número de juego");if(console.log("GSCLineupsReports - gameNumberFilterIndex:",Lt),console.log("GSCLineupsReports - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCLineupsReports - found game number filter at index:",Lt);const Qe=t.view.filterMultiple.gameNumber;console.log("GSCLineupsReports - setting game number filter directly from filterMultiple.gameNumber:",Qe),m.value[0]=Qe,t.view.componentProps&&Qe&&(t.view.componentProps.gameNumber=Qe,console.log("GSCLineupsReports - updated componentProps.gameNumber:",t.view.componentProps.gameNumber)),console.log("GSCLineupsReports - automatically set game number filter to:",Qe),console.log("GSCLineupsReports - gameNumber type:",typeof Qe),console.log("GSCLineupsReports - updated dynamicFilters:",m.value),console.log("GSCLineupsReports - filter options:",(ct=T.value[Lt])==null?void 0:ct.options);const et=(((gt=T.value[Lt])==null?void 0:gt.options)||[]).find(xt=>xt.value==Qe);console.log("GSCLineupsReports - matching option:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCLineupsReports - forced reactivity update")})}else console.log("GSCLineupsReports - game number filter not found!")}if(((Nt=f.value)==null?void 0:Nt.id)===7&&u.value&&t!=null&&t.view){if(console.log("GSCGoalData - checking stored values after preselecting filters:",t.view),console.log("GSCGoalData - currentFilters:",T.value),console.log("GSCGoalData - dynamicFilters before:",m.value),(Et=t.view.componentProps)!=null&&Et.analysisType&&T.value.length>0&&((tt=T.value[0])==null?void 0:tt.type)==="radio-button"){const Lt=t.view.componentProps.analysisType,Qe=Lt==="offensive"?1:2;console.log("GSCGoalData - setting analysis type filter from componentProps.analysisType:",Qe,"analysisType:",Lt),m.value[0]=Qe}if(((st=t.view.filterMultiple)==null?void 0:st.isHomeTeam)!==void 0){console.log("GSCGoalData - found isHomeTeam in filterMultiple:",t.view.filterMultiple.isHomeTeam),console.log('GSCGoalData - searching for radio-button filter with label "Equipo"'),console.log("GSCGoalData - all filters details:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label,options:Qe.options})));const Lt=T.value.findIndex(Qe=>Qe.type==="radio-button"&&Qe.label==="Equipo");if(console.log("GSCGoalData - teamFilterIndex:",Lt),console.log("GSCGoalData - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCGoalData - found team filter at index:",Lt);const Qe=t.view.filterMultiple.isHomeTeam,et=Qe?1:2;console.log("GSCGoalData - setting team filter directly from filterMultiple.isHomeTeam:",et,"isHomeTeam:",Qe),m.value[1]=et}else if(console.log("GSCGoalData - team filter not found by label, trying by index"),T.value.length>1&&((Xe=T.value[1])==null?void 0:Xe.type)==="radio-button"){console.log("GSCGoalData - found radio-button filter at index 1 by fallback");const Qe=t.view.filterMultiple.isHomeTeam,et=Qe?1:2;console.log("GSCGoalData - setting team filter by fallback:",et,"isHomeTeam:",Qe),m.value[1]=et,t.view.componentProps&&(t.view.componentProps.isHomeTeamForAnalysis=Qe,console.log("GSCGoalData - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis)),console.log("GSCGoalData - automatically set team filter to:",et),console.log("GSCGoalData - teamValue type:",typeof et),console.log("GSCGoalData - updated dynamicFilters:",m.value),console.log("GSCGoalData - filter options:",(lt=T.value[1])==null?void 0:lt.options);const xt=(((Tt=T.value[1])==null?void 0:Tt.options)||[]).find(Pt=>Pt.value==et);console.log("GSCGoalData - matching option:",xt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCGoalData - forced reactivity update")})}else console.log("GSCGoalData - no radio-button filter found at index 1 either");if(Lt!==-1&&t.view.componentProps){const Qe=t.view.filterMultiple.isHomeTeam,et=Qe?1:2;t.view.componentProps.isHomeTeamForAnalysis=Qe,console.log("GSCGoalData - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis),console.log("GSCGoalData - automatically set team filter to:",et),console.log("GSCGoalData - teamValue type:",typeof et),console.log("GSCGoalData - updated dynamicFilters:",m.value),console.log("GSCGoalData - filter options:",(yt=T.value[Lt])==null?void 0:yt.options);const xt=(((It=T.value[Lt])==null?void 0:It.options)||[]).find(Pt=>Pt.value==et);console.log("GSCGoalData - matching option:",xt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCGoalData - forced reactivity update")})}}else console.log("GSCGoalData - isHomeTeam is undefined in filterMultiple")}p.nextTick(()=>{x.value=!1})}},100)}))}function de(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe;return{mainSelector:{id:((ve=d.value)==null?void 0:ve.id)||null,name:((ye=d.value)==null?void 0:ye.name)||null,url:((De=d.value)==null?void 0:De.url)||null},viewSelector:{id:((Re=f.value)==null?void 0:Re.id)||null,name:((Ve=f.value)==null?void 0:Ve.name)||((We=f.value)==null?void 0:We.title)||null,url:((Je=f.value)==null?void 0:Je.url)||null},team:_.value,dynamicFilters:((ke=T.value)==null?void 0:ke.map((He,rt)=>{var nt,ht;const vt=m.value[rt];return{filterId:He.id||`filter_${rt}`,filterType:He.type,filterLabel:He.label,filterIcon:He.icon||null,selectedValue:vt,selectedOptions:He.type==="select"&&Array.isArray(vt)&&vt.length>0?vt.map(ft=>{var Rt;const Ft=(Rt=He.options)==null?void 0:Rt.find(Bt=>Bt.value===ft);return{value:ft,label:(Ft==null?void 0:Ft.label)||ft,icon:(Ft==null?void 0:Ft.icon)||null}}):null,selectedOption:He.type==="radio-button"&&vt?{value:vt,label:((ht=(nt=He.options)==null?void 0:nt.find(ft=>ft.value===vt))==null?void 0:ht.label)||vt}:null,isChecked:He.type==="check"?vt:null}}))||[],timestamp:new Date().toISOString(),summary:{mainSelected:!!d.value,viewSelected:!!f.value,totalDynamicFilters:((ze=T.value)==null?void 0:ze.length)||0,activeFilters:((Fe=T.value)==null?void 0:Fe.filter((He,rt)=>{const nt=m.value[rt];return Array.isArray(nt)?nt.length>0:nt!=null&&nt!==!1}).length)||0}}}a({getCurrentFiltersJSON:de});function ge(){fe(),K("close",b)}function _e(){e.value=!1,ge()}function be(){w.value&&(Ai.emit("filters-cancelled",b),w.value=!1),e.value=!1,ge()}p.onMounted(async()=>{document.addEventListener("click",oe),p.nextTick(()=>{Se()});try{const ve=await(await fetch("https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/views",{headers:{Authorization:`${B.token}`}})).json();C.value=ve.data||[]}catch(ve){console.error("Error al obtener datos:",ve)}});function Se(){document.querySelectorAll(".field-menu .option-card").forEach(ve=>{const ye=ve.querySelector(".option-img");if(!ye||!ye.dataset.hoverSrc)return;const De=ye.src,Re=ye.dataset.hoverSrc;ve.addEventListener("mouseenter",()=>{ye.src=Re}),ve.addEventListener("mouseleave",()=>{ye.src=De})})}p.onUnmounted(()=>{document.removeEventListener("click",oe)}),Ai.on("set-filter-and-views-container",ve=>{b=ve,ve&&se(ve)}),Ai.on("view-added",()=>{console.log("View ************************************************************* add"),e.value=!0,w.value=!0}),Ai.on("component-added-to-container",ve=>{console.log("Component added to container, updating filters, container:",ve),!u.value||b&&ve.id===b.id?se(ve):console.log("Skipping container update - edit mode or different container")}),Ai.on("edit-view",ve=>{var ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt;console.log("edit-view received:",ve),t=ve,b=((ye=ve.view)==null?void 0:ye.filterAndViewsContainer)||null,v=null;const Ft=[(Re=(De=ve.view)==null?void 0:De.coreView)==null?void 0:Re.filtersJSON,(Ve=ve.view)==null?void 0:Ve.filtersJSON,(We=ve.coreView)==null?void 0:We.filtersJSON,ve.filtersJSON,(ke=(Je=ve.view)==null?void 0:Je.componentProps)==null?void 0:ke.filtersJSON];for(const Bt of Ft)if(Bt){v=Bt,console.log("Found editFiltersJSON in:",Bt);break}if(b&&(b.viewId===4||b.viewId===8||b.viewId===3||b.viewId===1||b.viewId===2)&&(ze=ve.view)!=null&&ze.id){const Bt=b.getComponentDynamicFilters(ve.view.id);if(Bt){let at="Unknown";b.viewId===4?at="Timeline":b.viewId===8?at="FieldPosesion":b.viewId===3?at="GSCMatchSummary":b.viewId===1?at="GSCComparativeReports":b.viewId===2&&(at="GscTopPlayer"),console.log(`${at} - found component specific filters:`,Bt),v&&(v={...v,dynamicFilters:Bt.map((Ze,ct)=>Array.isArray(Ze)?{selectedValue:Ze,selectedOptions:Ze.map(gt=>({value:gt,label:gt}))}:typeof Ze=="boolean"?{isChecked:Ze}:at==="GSCComparativeReports"&&ct===0?{selectedValue:Ze,selectedOptions:[{value:Ze,label:Ze}]}:at==="GscTopPlayer"&&ct===0?{selectedValue:Ze,selectedOptions:[{value:Ze,label:Ze}]}:at==="GscTopPlayer"&&ct===1?{selectedOption:{value:Ze,label:Ze}}:{selectedOption:{value:Ze,label:Ze}})},console.log(`${at} - updated editFiltersJSON with component specific filters:`,v))}}if(b&&b.viewId===2&&(Fe=ve.view)!=null&&Fe.filterMultiple){if(console.log("2222************************************************************",t.view.filterMultiple),console.log("GSCtops detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.categoryId&&v){console.log("GSCtops - found categoryId in filterMultiple:",ve.view.filterMultiple.categoryId);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select-simple"&&at.filterLabel==="Tipo de análisis");Bt!==-1&&(console.log("GSCtops - found category filter at index:",Bt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:ve.view.filterMultiple.categoryId,selectedOptions:[{value:ve.view.filterMultiple.categoryId,label:`Category ${ve.view.filterMultiple.categoryId}`}]},console.log("GSCtops - updated filter with single value:",ve.view.filterMultiple.categoryId),console.log("GSCtops - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCtops - updated category filter with filterMultiple.categoryId:",ve.view.filterMultiple.categoryId))}if(ve.view.filterMultiple.teamType!==void 0&&v){console.log("GSCtops - found teamType in filterMultiple:",ve.view.filterMultiple.teamType);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button");if(Bt!==-1){console.log("GSCtops - found team filter at index:",Bt);const at=ve.view.filterMultiple.teamType,Ze=at===1?"Mi equipo":at===2?"Rival":at===3?"Ambos":"Equipo";v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:at,label:Ze}},console.log("GSCtops - updated team filter with teamType:",at,"label:",Ze),console.log("GSCtops - updated team filter structure:",v.dynamicFilters[Bt]),console.log("GSCtops - updated team filter with filterMultiple.teamType:",ve.view.filterMultiple.teamType)}}}if(b&&b.viewId===1&&(He=ve.view)!=null&&He.filterMultiple&&(console.log("GSCComparativeReports detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.category&&v)){console.log("GSCComparativeReports - found category in filterMultiple:",ve.view.filterMultiple.category);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select-simple"&&at.filterLabel==="Tipo de análisis");Bt!==-1&&(console.log("GSCComparativeReports - found analysis type filter at index:",Bt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:ve.view.filterMultiple.category,selectedOptions:[{value:ve.view.filterMultiple.category,label:ve.view.filterMultiple.category}]},console.log("GSCComparativeReports - updated filter with single value:",ve.view.filterMultiple.category),console.log("GSCComparativeReports - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCComparativeReports - updated analysis type filter with filterMultiple.category:",ve.view.filterMultiple.category))}if(b&&b.viewId===9&&(rt=ve.view)!=null&&rt.filterMultiple){if(console.log("GSCFieldDataByZones detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.categoryIds&&v){console.log("GSCFieldDataByZones - found categoryIds in filterMultiple:",ve.view.filterMultiple.categoryIds);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select"&&at.filterLabel==="Tipo de análisis");if(Bt!==-1){console.log("GSCFieldDataByZones - found analysis type filter at index:",Bt);const at=Array.isArray(ve.view.filterMultiple.categoryIds)?ve.view.filterMultiple.categoryIds:[ve.view.filterMultiple.categoryIds];console.log("GSCFieldDataByZones - processing categoryIds array:",at),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:at,selectedOptions:at.map(Nt=>({value:Nt,label:`Category ${Nt}`}))},console.log("GSCFieldDataByZones - updated filter with categoryIds:",at),console.log("GSCFieldDataByZones - updated filter structure:",v.dynamicFilters[Bt]);const Ze=ve.view.filterMultiple.categoryIds,ct=Ce(Ze,at);console.log("GSCFieldDataByZones - category arrays match with original:",ct),console.log("GSCFieldDataByZones - original categoryIds:",Ze,"processed categoryIds:",at);const gt=(((nt=T.value[Bt])==null?void 0:nt.options)||[]).filter(Nt=>Array.isArray(Nt.value)?Ce(Nt.value,at):at.includes(Nt.value));if(console.log("GSCFieldDataByZones - matching options in editFiltersJSON:",gt),gt.length>0){const Nt=gt[0];console.log("GSCFieldDataByZones - found matching option in editFiltersJSON:",Nt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:Nt.value,selectedOptions:[Nt]},console.log("GSCFieldDataByZones - updated editFiltersJSON with matching option value:",Nt.value)}console.log("GSCFieldDataByZones - updated analysis type filter with filterMultiple.categoryIds:",at)}}if(ve.view.filterMultiple.isHomeTeam!==void 0&&v){console.log("GSCFieldDataByZones - found isHomeTeam in filterMultiple:",ve.view.filterMultiple.isHomeTeam),console.log("GSCFieldDataByZones - isHomeTeam type:",typeof ve.view.filterMultiple.isHomeTeam);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button");if(Bt!==-1){console.log("GSCFieldDataByZones - found team filter at index:",Bt);const at=ve.view.filterMultiple.isHomeTeam;let Ze,ct;typeof at=="boolean"?(Ze=at?1:2,ct=at?"Mi equipo":"Rival",console.log("GSCFieldDataByZones - converted boolean isHomeTeam to teamValue:",at,"->",Ze,"label:",ct)):typeof at=="number"?(Ze=at===1?1:2,ct=at===1?"Mi equipo":"Rival",console.log("GSCFieldDataByZones - converted numeric isHomeTeam to teamValue:",at,"->",Ze,"label:",ct)):(Ze=1,ct="Mi equipo",console.log("GSCFieldDataByZones - using default teamValue:",Ze,"label:",ct)),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCFieldDataByZones - updated team filter with isHomeTeam:",at,"teamValue:",Ze,"teamLabel:",ct),console.log("GSCFieldDataByZones - updated team filter structure:",v.dynamicFilters[Bt]),console.log("GSCFieldDataByZones - updated team filter with filterMultiple.isHomeTeam:",ve.view.filterMultiple.isHomeTeam)}}}if(b&&b.viewId===6&&(ht=ve.view)!=null&&ht.filterMultiple&&(console.log("GSCLineupsReports detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.gameNumber&&v)){console.log("GSCLineupsReports - found gameNumber in filterMultiple:",ve.view.filterMultiple.gameNumber);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select-simple"&&at.filterLabel==="Número de juego");Bt!==-1&&(console.log("GSCLineupsReports - found game number filter at index:",Bt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:ve.view.filterMultiple.gameNumber,selectedOptions:[{value:ve.view.filterMultiple.gameNumber,label:`Juego ${ve.view.filterMultiple.gameNumber}`}]},console.log("GSCLineupsReports - updated filter with single value:",ve.view.filterMultiple.gameNumber),console.log("GSCLineupsReports - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCLineupsReports - updated game number filter with filterMultiple.gameNumber:",ve.view.filterMultiple.gameNumber))}if(b&&b.viewId===7&&ve.view&&v){if(console.log("GSCGoalData detected - checking stored values:",ve.view),(vt=ve.view.componentProps)!=null&&vt.analysisType){console.log("GSCGoalData - found analysisType in componentProps:",ve.view.componentProps.analysisType);const Bt=v.dynamicFilters.findIndex((at,Ze)=>at.filterType==="radio-button"&&Ze===0);if(Bt!==-1){console.log("GSCGoalData - found analysis type filter at index:",Bt);const at=ve.view.componentProps.analysisType,Ze=at==="offensive"?1:2,ct=at==="offensive"?"A favor":"En contra";v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCGoalData - updated analysis filter with value:",Ze,"analysisType:",at),console.log("GSCGoalData - updated analysis filter structure:",v.dynamicFilters[Bt])}}if(((ft=ve.view.filterMultiple)==null?void 0:ft.isHomeTeam)!==void 0){console.log("GSCGoalData - found isHomeTeam in filterMultiple:",ve.view.filterMultiple.isHomeTeam);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button"&&at.filterLabel==="Equipo");if(Bt!==-1){console.log("GSCGoalData - found team filter at index:",Bt);const at=ve.view.filterMultiple.isHomeTeam,Ze=at?1:2,ct=at?"Equipo propio":"Equipo rival";v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCGoalData - updated filter with team value:",Ze,"isHomeTeam:",at),console.log("GSCGoalData - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCGoalData - updated team filter with filterMultiple.isHomeTeam:",at)}}}if(b&&b.viewId===5&&(Rt=ve.view)!=null&&Rt.filterMultiple&&(console.log("GSCVolumetricField detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.isHomeTeam!==void 0&&v)){console.log("GSCVolumetricField - found isHomeTeam in filterMultiple:",ve.view.filterMultiple.isHomeTeam),console.log("GSCVolumetricField - editFiltersJSON.dynamicFilters:",v.dynamicFilters),console.log("GSCVolumetricField - searching for team filter in editFiltersJSON");const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button"&&at.filterLabel==="Equipo");if(console.log("GSCVolumetricField - teamFilterIndex:",Bt),console.log("GSCVolumetricField - all filters in editFiltersJSON:",v.dynamicFilters.map((at,Ze)=>({index:Ze,filterType:at.filterType,filterLabel:at.filterLabel}))),Bt!==-1){console.log("GSCVolumetricField - found team filter at index:",Bt);const at=ve.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type in editFiltersJSON:",typeof at,"value:",at);let Ze,ct;typeof at=="boolean"?(Ze=at?1:2,ct=at?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is boolean in editFiltersJSON, converting:",at,"-> teamValue:",Ze,"teamLabel:",ct)):typeof at=="number"?(Ze=at===1?1:2,ct=at===1?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is number in editFiltersJSON, using directly:",at,"-> teamValue:",Ze,"teamLabel:",ct)):(Ze=1,ct="Equipo propio",console.log("GSCVolumetricField - isHomeTeam is unknown type in editFiltersJSON, using default:",Ze,"teamLabel:",ct)),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCVolumetricField - updated filter with team value:",Ze,"isHomeTeam:",at),console.log("GSCVolumetricField - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCVolumetricField - updated team filter with filterMultiple.isHomeTeam:",at)}else{console.log("GSCVolumetricField - team filter not found in editFiltersJSON, trying fallback");const at=v.dynamicFilters.findIndex(Ze=>Ze.filterType==="radio-button");if(at!==-1){console.log("GSCVolumetricField - found radio-button filter at index:",at);const Ze=ve.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type in editFiltersJSON fallback:",typeof Ze,"value:",Ze);let ct,gt;typeof Ze=="boolean"?(ct=Ze?1:2,gt=Ze?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is boolean in editFiltersJSON fallback, converting:",Ze,"-> teamValue:",ct,"teamLabel:",gt)):typeof Ze=="number"?(ct=Ze===1?1:2,gt=Ze===1?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is number in editFiltersJSON fallback, using directly:",Ze,"-> teamValue:",ct,"teamLabel:",gt)):(ct=1,gt="Equipo propio",console.log("GSCVolumetricField - isHomeTeam is unknown type in editFiltersJSON fallback, using default:",ct,"teamLabel:",gt)),v.dynamicFilters[at]={...v.dynamicFilters[at],selectedOption:{value:ct,label:gt}},console.log("GSCVolumetricField - updated filter with team value (fallback):",ct,"isHomeTeam:",Ze),console.log("GSCVolumetricField - updated filter structure (fallback):",v.dynamicFilters[at])}else console.log("GSCVolumetricField - no radio-button filters found in editFiltersJSON at all!")}}console.log("Final editFiltersJSON:",v),v?ue(v):console.log("No editFiltersJSON found, cannot preselect filters"),e.value=!0});function Me(){V.value=null}function Te(ve,ye){var De;((De=f.value)==null?void 0:De.id)===2&&console.log("GSCtops - debugSelectSimple:",{idx:ve,optionValue:ye,optionValueType:typeof ye,dynamicFiltersValue:m.value[ve],dynamicFiltersValueType:typeof m.value[ve],isEqual:m.value[ve]===ye,isEqualLoose:m.value[ve]==ye})}function Ce(ve,ye){if(!Array.isArray(ve)||!Array.isArray(ye)||ve.length!==ye.length)return!1;const De=[...ve].sort((Ve,We)=>Ve-We),Re=[...ye].sort((Ve,We)=>Ve-We);return JSON.stringify(De)===JSON.stringify(Re)}function Ne(){var ve;if(u.value&&v&&v.dynamicFilters){if(console.log("Forcing checkbox and select filter update from editFiltersJSON"),((ve=f.value)==null?void 0:ve.id)===8&&(console.log("FieldPosesion - forceCheckboxUpdate called"),console.log("FieldPosesion - viewToEdit:",t),console.log("FieldPosesion - editFiltersJSON:",v)),h.value){console.log("Skipping forceCheckboxUpdate - already in force update");return}if(y.value)return;h.value=!0,x.value=!0,v.dynamicFilters.forEach((ye,De)=>{var Re,Ve,We;if(ye&&(Re=T.value)!=null&&Re[De]){const Je=T.value[De];if(Je.type==="check"&&ye.isChecked!==void 0)console.log(`Forcing checkbox ${De} to:`,ye.isChecked),m.value[De]=ye.isChecked,((Ve=f.value)==null?void 0:Ve.id)===8&&console.log("FieldPosesion - Checkbox filter updated:",{index:De,value:ye.isChecked,componentId:(We=t==null?void 0:t.view)==null?void 0:We.id});else if(Je.type==="select"&&ye.selectedOptions){const ke=ye.selectedOptions.map(ze=>ze.value);console.log(`Forcing select filter ${De} to:`,ke),m.value[De]=ke}else Je.type==="select"&&ye.selectedValue&&Array.isArray(ye.selectedValue)&&(console.log(`Forcing select filter ${De} to:`,ye.selectedValue),m.value[De]=ye.selectedValue)}}),p.nextTick(()=>{x.value=!1,h.value=!1})}}function Oe(){var ve;if(u.value&&v&&v.dynamicFilters&&((ve=f.value)==null?void 0:ve.id)===4){if(console.log("Preselecting Timeline filters specifically"),h.value){console.log("Skipping preselectTimelineFilters - already in force update");return}if(y.value)return;h.value=!0,x.value=!0,v.dynamicFilters.forEach((ye,De)=>{var Re,Ve;if(ye&&((Ve=(Re=T.value)==null?void 0:Re[De])==null?void 0:Ve.type)==="select"){if(ye.selectedOptions){const We=ye.selectedOptions.map(Je=>Je.value);console.log(`Preselecting Timeline select filter ${De} to:`,We),m.value[De]=We}else if(ye.selectedValue&&Array.isArray(ye.selectedValue))if(ye.selectedValue.length>0&&ye.selectedValue[0]&&typeof ye.selectedValue[0]=="object"){const We=Ge(ye.selectedValue);console.log(`Preselecting Timeline select filter ${De} to:`,We),m.value[De]=We}else console.log(`Preselecting Timeline select filter ${De} to:`,ye.selectedValue),m.value[De]=ye.selectedValue}}),setTimeout(()=>{console.log("Forcing UI update after preselecting Timeline filters"),m.value=[...m.value]},200),p.nextTick(()=>{x.value=!1,h.value=!1})}}function Ge(ve){return!Array.isArray(ve)||ve.length===0?[]:ve.map(ye=>{if(ye&&typeof ye=="object"){if(ye.event_type_id&&ye.category_id)return`${ye.category_id}-${ye.event_type_id}`;if(ye.event_type_id)return ye.event_type_id.toString();if(ye.category_id)return ye.category_id.toString()}return ye})}function Le(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht;if(u.value&&v&&v.dynamicFilters&&T.value){if(console.log("Force updating select filters immediately"),h.value){console.log("Skipping forceSelectFilterUpdate - already in force update");return}if(y.value)return;if(h.value=!0,x.value=!0,v.dynamicFilters.forEach((vt,ft)=>{var Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st;if(vt&&((Rt=T.value[ft])==null?void 0:Rt.type)==="select"){if(vt.selectedOptions){const Xe=vt.selectedOptions.map(lt=>lt.value);console.log(`Force setting select filter ${ft} to:`,Xe),m.value[ft]=Xe}else if(vt.selectedValue&&Array.isArray(vt.selectedValue))if(vt.selectedValue.length>0&&vt.selectedValue[0]&&typeof vt.selectedValue[0]=="object"){const Xe=Ge(vt.selectedValue);console.log(`Force setting Timeline select filter ${ft} to:`,Xe),m.value[ft]=Xe}else console.log(`Force setting select filter ${ft} to:`,vt.selectedValue),m.value[ft]=vt.selectedValue}else if(vt&&((Ft=T.value[ft])==null?void 0:Ft.type)==="select-simple"&&vt.selectedValue!==void 0){console.log(`Force setting select-simple filter ${ft} to:`,vt.selectedValue),console.log("forceSelectFilterUpdate - selectedValue type:",typeof vt.selectedValue),console.log("forceSelectFilterUpdate - selectedValue is array:",Array.isArray(vt.selectedValue));let Xe;((Bt=f.value)==null?void 0:Bt.id)===2&&(Ze=(at=t==null?void 0:t.view)==null?void 0:at.filterMultiple)!=null&&Ze.categoryId?(Xe=t.view.filterMultiple.categoryId,console.log("GSCtops - using filterMultiple.categoryId in forceSelectFilterUpdate:",Xe)):((ct=f.value)==null?void 0:ct.id)===1&&(Nt=(gt=t==null?void 0:t.view)==null?void 0:gt.filterMultiple)!=null&&Nt.category?(Xe=t.view.filterMultiple.category,console.log("GSCComparativeReports - using filterMultiple.category in forceSelectFilterUpdate:",Xe)):((Et=f.value)==null?void 0:Et.id)===6&&(st=(tt=t==null?void 0:t.view)==null?void 0:tt.filterMultiple)!=null&&st.gameNumber?(Xe=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - using filterMultiple.gameNumber in forceSelectFilterUpdate:",Xe)):Xe=Array.isArray(vt.selectedValue)?vt.selectedValue[0]:vt.selectedValue,m.value[ft]=Xe,console.log(`Force setting select-simple filter ${ft} to:`,Xe)}}),((ve=f.value)==null?void 0:ve.id)===4&&setTimeout(()=>{console.log("Forcing UI update for Timeline filters"),m.value=[...m.value]},100),((ye=f.value)==null?void 0:ye.id)===2&&(De=t==null?void 0:t.view)!=null&&De.filterMultiple){if(console.log("GSCtops - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCtops - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.categoryId){console.log("GSCtops - found categoryId in filterMultiple:",t.view.filterMultiple.categoryId);const vt=T.value.findIndex(ft=>ft.type==="select-simple"&&ft.label==="Tipo de análisis");if(console.log("GSCtops - categoryFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCtops - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCtops - found category filter at index:",vt);const ft=t.view.filterMultiple.categoryId;if(console.log("GSCtops - setting category filter directly from filterMultiple.categoryId in forceSelectFilterUpdate:",ft),m.value[0]=ft,t.view.componentProps&&ft){let Ft=`Category ${ft}`,Bt=null;try{Bt=Vd(ft),Bt&&(Ft=Bt.name,console.log("GSCtops - found category info from getCategoryById in forceSelectFilterUpdate:",Bt))}catch{console.log("GSCtops - getCategoryById failed in forceSelectFilterUpdate, using filter options");const at=T.value.findIndex(Ze=>Ze.type==="select-simple"&&Ze.label==="Tipo de análisis");if(at!==-1){const Ze=(((Re=T.value[at])==null?void 0:Re.options)||[]).find(ct=>ct.value==ft);Ze&&(Ft=Ze.label,console.log("GSCtops - found category name from options in forceSelectFilterUpdate:",Ft))}}t.view.componentProps.categoryView=[{id:ft,name:Ft}],console.log("GSCtops - updated componentProps.categoryView in forceSelectFilterUpdate:",t.view.componentProps.categoryView)}console.log("GSCtops - automatically set category filter to:",ft),console.log("GSCtops - categoryId type:",typeof ft),console.log("GSCtops - updated dynamicFilters:",m.value),console.log("GSCtops - filter options:",(Ve=T.value[vt])==null?void 0:Ve.options);const Rt=(((We=T.value[vt])==null?void 0:We.options)||[]).find(Ft=>Ft.value==ft);console.log("GSCtops - matching option:",Rt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update in forceSelectFilterUpdate")})}else console.log("GSCtops - category filter not found in forceSelectFilterUpdate!")}if(t.view.filterMultiple.teamType!==void 0){console.log("GSCtops - found teamType in filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple.teamType);const vt=T.value.findIndex(ft=>ft.type==="radio-button");if(console.log("GSCtops - teamFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCtops - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCtops - found team filter at index in forceSelectFilterUpdate:",vt);const ft=t.view.filterMultiple.teamType;console.log("GSCtops - setting team filter directly from filterMultiple.teamType in forceSelectFilterUpdate:",ft),m.value[vt]=ft,console.log("GSCtops - automatically set team filter to in forceSelectFilterUpdate:",ft),console.log("GSCtops - teamType type in forceSelectFilterUpdate:",typeof ft),console.log("GSCtops - updated dynamicFilters in forceSelectFilterUpdate:",m.value),console.log("GSCtops - filter options in forceSelectFilterUpdate:",(Je=T.value[vt])==null?void 0:Je.options);const Rt=(((ke=T.value[vt])==null?void 0:ke.options)||[]).find(Ft=>Ft.value==ft);console.log("GSCtops - matching option for team in forceSelectFilterUpdate:",Rt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update for team filter in forceSelectFilterUpdate")})}else console.log("GSCtops - team filter not found in forceSelectFilterUpdate!")}}if(((ze=f.value)==null?void 0:ze.id)===1&&(Fe=t==null?void 0:t.view)!=null&&Fe.filterMultiple&&(console.log("GSCComparativeReports - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCComparativeReports - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.category)){console.log("GSCComparativeReports - found category in filterMultiple:",t.view.filterMultiple.category);const vt=T.value.findIndex(ft=>ft.type==="select-simple"&&ft.label==="Tipo de análisis");if(console.log("GSCComparativeReports - analysisTypeFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCComparativeReports - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCComparativeReports - found analysis type filter at index:",vt);const ft=t.view.filterMultiple.category;console.log("GSCComparativeReports - setting analysis type filter directly from filterMultiple.category in forceSelectFilterUpdate:",ft),m.value[0]=ft,t.view.componentProps&&ft&&(t.view.componentProps.type=ft,console.log("GSCComparativeReports - updated componentProps.type in forceSelectFilterUpdate:",t.view.componentProps.type)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCComparativeReports - forced reactivity update in forceSelectFilterUpdate")})}else console.log("GSCComparativeReports - analysis type filter not found in forceSelectFilterUpdate!")}if(((He=f.value)==null?void 0:He.id)===6&&(rt=t==null?void 0:t.view)!=null&&rt.filterMultiple&&(console.log("GSCLineupsReports - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCLineupsReports - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.gameNumber)){console.log("GSCLineupsReports - found gameNumber in filterMultiple:",t.view.filterMultiple.gameNumber);const vt=T.value.findIndex(ft=>ft.type==="select-simple"&&ft.label==="Número de juego");if(console.log("GSCLineupsReports - gameNumberFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCLineupsReports - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCLineupsReports - found game number filter at index:",vt);const ft=t.view.filterMultiple.gameNumber;console.log("GSCLineupsReports - setting game number filter directly from filterMultiple.gameNumber in forceSelectFilterUpdate:",ft),m.value[0]=ft,t.view.componentProps&&ft&&(t.view.componentProps.gameNumber=ft,console.log("GSCLineupsReports - updated componentProps.gameNumber in forceSelectFilterUpdate:",t.view.componentProps.gameNumber)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCLineupsReports - forced reactivity update in forceSelectFilterUpdate")})}else console.log("GSCLineupsReports - game number filter not found in forceSelectFilterUpdate!")}if(((nt=f.value)==null?void 0:nt.id)===5&&(ht=t==null?void 0:t.view)!=null&&ht.filterMultiple&&(console.log("GSCVolumetricField - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCVolumetricField - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.isHomeTeam!==void 0)){console.log("GSCVolumetricField - found isHomeTeam in filterMultiple:",t.view.filterMultiple.isHomeTeam),console.log('GSCVolumetricField - searching for team filter with label "Equipo"'),console.log("GSCVolumetricField - all filters details:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label,options:ft.options})));const vt=T.value.findIndex(ft=>ft.type==="radio-button"&&ft.label==="Equipo");if(console.log("GSCVolumetricField - teamFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCVolumetricField - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCVolumetricField - found team filter at index:",vt);const ft=t.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type:",typeof ft,"value:",ft);let Rt;typeof ft=="boolean"?(Rt=ft?1:2,console.log("GSCVolumetricField - isHomeTeam is boolean, converting:",ft,"-> teamValue:",Rt)):typeof ft=="number"?(Rt=ft===1?1:2,console.log("GSCVolumetricField - isHomeTeam is number, using directly:",ft,"-> teamValue:",Rt)):(Rt=1,console.log("GSCVolumetricField - isHomeTeam is unknown type, using default:",Rt)),console.log("GSCVolumetricField - setting team filter directly from filterMultiple.isHomeTeam in forceSelectFilterUpdate:",Rt),m.value[0]=Rt,t.view.componentProps&&ft!==void 0&&(t.view.componentProps.isHomeTeamForAnalysis=ft===1,console.log("GSCVolumetricField - updated componentProps.isHomeTeamForAnalysis in forceSelectFilterUpdate:",t.view.componentProps.isHomeTeamForAnalysis)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCVolumetricField - forced reactivity update in forceSelectFilterUpdate")})}else{console.log("GSCVolumetricField - team filter not found in forceSelectFilterUpdate!"),console.log("GSCVolumetricField - trying fallback: looking for any radio-button filter");const ft=T.value.findIndex(Rt=>Rt.type==="radio-button");if(ft!==-1){console.log("GSCVolumetricField - found radio-button filter at index:",ft);const Rt=t.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type in fallback:",typeof Rt,"value:",Rt);let Ft;typeof Rt=="boolean"?(Ft=Rt?1:2,console.log("GSCVolumetricField - isHomeTeam is boolean in fallback, converting:",Rt,"-> teamValue:",Ft)):typeof Rt=="number"?(Ft=Rt===1?1:2,console.log("GSCVolumetricField - isHomeTeam is number in fallback, using directly:",Rt,"-> teamValue:",Ft)):(Ft=1,console.log("GSCVolumetricField - isHomeTeam is unknown type in fallback, using default:",Ft)),console.log("GSCVolumetricField - setting radio-button filter by fallback:",Ft),m.value[ft]=Ft,t.view.componentProps&&Rt!==void 0&&(t.view.componentProps.preMatchType=Rt,console.log("GSCVolumetricField - updated componentProps.preMatchType in fallback:",t.view.componentProps.preMatchType)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCVolumetricField - forced reactivity update in fallback")})}else console.log("GSCVolumetricField - no radio-button filters found at all!")}}p.nextTick(()=>{x.value=!1,h.value=!1})}}function je(){if(console.log("FUNCION: forceRadioFilterUpdate"),h.value){console.log("Skipping forceRadioFilterUpdate - already in force update");return}if(u.value&&v&&v.dynamicFilters&&T.value){if(console.log("1"),y.value)return;h.value=!0,x.value=!0,v.dynamicFilters.forEach((ve,ye)=>{var De,Re;if(ve&&((De=T.value[ye])==null?void 0:De.type)==="radio-button"&&(console.log("2"),ve.selectedOption&&ve.selectedOption.value!==void 0)){console.log("3"),console.log("filterData: ----------------->",ve),console.log("editFiltersJSON: ",v),console.log(`Force setting radio filter ${ye} to:`,ve.selectedOption.value);const Ve=ve.selectedOption.value;m.value[ye]=Ve,console.log(`Radio filter ${ye} set to:`,Ve,"Type:",typeof Ve),((Re=f.value)==null?void 0:Re.id)===8&&(console.log("FieldPosesion - Radio filter updated to:",ve.selectedOption.value),console.log("FieldPosesion - Current dynamicFilters after update:",m.value))}}),p.nextTick(()=>{x.value=!1,h.value=!1})}}function Ie(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st,Xe,lt,Tt,yt,It,Lt,Qe,et,xt,Pt,Ot,kt,Ht,qt,Jt,Wt,Gt,rr,ir;if(console.log("updateContainerOnUserChange function called"),console.log("filterAndViewsContainer:",b),console.log("isEditMode.value:",u.value),console.log("viewToEdit:",t),b&&u.value&&t){if(console.log("User made changes, updating container for specific component"),console.log("Current dynamicFilters:",m.value),console.log("Component ID:",(ve=t.view)==null?void 0:ve.id),console.log("Selected component ID:",(ye=f.value)==null?void 0:ye.id),y.value){console.log("Skipping container update due to container update in progress");return}if(x.value=!0,((De=f.value)==null?void 0:De.id)===4)b.setDynamicFilters(m.value,(Re=t.view)==null?void 0:Re.id),b.updateDynamicFilters(m.value,(Ve=t.view)==null?void 0:Ve.id),console.log("Timeline - updated specific filters for component:",(We=t.view)==null?void 0:We.id);else if(((Je=f.value)==null?void 0:Je.id)===8)b.setDynamicFilters(m.value,(ke=t.view)==null?void 0:ke.id),b.updateDynamicFilters(m.value,(ze=t.view)==null?void 0:ze.id),console.log("FieldPosesion - updated specific filters for component:",(Fe=t.view)==null?void 0:Fe.id);else if(((He=f.value)==null?void 0:He.id)===3)b.setDynamicFilters(m.value,(rt=t.view)==null?void 0:rt.id),b.updateDynamicFilters(m.value,(nt=t.view)==null?void 0:nt.id),console.log("GSCMatchSummary - updated specific filters for component:",(ht=t.view)==null?void 0:ht.id);else if(((vt=f.value)==null?void 0:vt.id)===2){console.log("GSCtops - updateContainerOnUserChange - starting GSCtops logic"),console.log("GSCtops - current dynamicFilters:",m.value),console.log("GSCtops - currentFilters:",T.value),b.setDynamicFilters(m.value,(ft=t.view)==null?void 0:ft.id),b.updateDynamicFilters(m.value,(Rt=t.view)==null?void 0:Rt.id);const vr=m.value[0];if(console.log("GSCtops - newCategoryId from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCtops - created new filterMultiple object"));const wr=t.view.filterMultiple.categoryId;if(t.view.filterMultiple.categoryId=vr,console.log("GSCtops - updated filterMultiple.categoryId from",wr,"to:",vr),console.log("GSCtops - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps){let ar=`Category ${vr}`,_r=null;try{_r=Vd(vr),_r&&(ar=_r.name,console.log("GSCtops - found category info from getCategoryById:",_r))}catch{console.log("GSCtops - getCategoryById failed, using filter options");const Wr=T.value.findIndex(Er=>Er.type==="select-simple"&&Er.label==="Tipo de análisis");if(Wr!==-1){const Er=(((Ft=T.value[Wr])==null?void 0:Ft.options)||[]).find(yr=>yr.value==vr);Er&&(ar=Er.label,console.log("GSCtops - found category name from options:",ar))}}t.view.componentProps.categoryView=[{id:vr,name:ar}],console.log("GSCtops - updated componentProps.categoryView:",t.view.componentProps.categoryView),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCtops - emitted force-component-update event")}}else console.log("GSCtops - newCategoryId is undefined!");const kr=m.value[1];if(console.log("GSCtops - newTeamType from dynamicFilters[1]:",kr),kr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCtops - created new filterMultiple object for teamType"));const wr=t.view.filterMultiple.teamType;t.view.filterMultiple.teamType=kr,console.log("GSCtops - updated filterMultiple.teamType from",wr,"to:",kr),console.log("GSCtops - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&t.view.componentProps.game&&(kr===1?t.view.componentProps.teamView=t.view.componentProps.game.homeTeam.team_id:kr===2?t.view.componentProps.teamView=t.view.componentProps.game.awayTeam.team_id:t.view.componentProps.teamView=0,console.log("GSCtops - updated componentProps.teamView:",t.view.componentProps.teamView)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCtops - emitted force-component-update event for teamType")}else console.log("GSCtops - newTeamType is undefined!");console.log("GSCtops - updated specific filters for component:",(Bt=t.view)==null?void 0:Bt.id)}else if(((at=f.value)==null?void 0:at.id)===1){console.log("GSCComparativeReports - updateContainerOnUserChange - starting GSCComparativeReports logic"),console.log("GSCComparativeReports - current dynamicFilters:",m.value),console.log("GSCComparativeReports - currentFilters:",T.value),b.setDynamicFilters(m.value,(Ze=t.view)==null?void 0:Ze.id),b.updateDynamicFilters(m.value,(ct=t.view)==null?void 0:ct.id);const vr=m.value[0];if(console.log("GSCComparativeReports - newCategory from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCComparativeReports - created new filterMultiple object"));const kr=t.view.filterMultiple.category;t.view.filterMultiple.category=vr,console.log("GSCComparativeReports - updated filterMultiple.category from",kr,"to:",vr),console.log("GSCComparativeReports - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.type=vr,console.log("GSCComparativeReports - updated componentProps.type:",t.view.componentProps.type)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCComparativeReports - emitted force-component-update event")}else console.log("GSCComparativeReports - newCategory is undefined!");console.log("GSCComparativeReports - updated specific filters for component:",(gt=t.view)==null?void 0:gt.id)}else if(((Nt=f.value)==null?void 0:Nt.id)===6){console.log("GSCLineupsReports - updateContainerOnUserChange - starting GSCLineupsReports logic"),console.log("GSCLineupsReports - current dynamicFilters:",m.value),console.log("GSCLineupsReports - currentFilters:",T.value),console.log("GSCLineupsReports - viewToEdit:",t),console.log("GSCLineupsReports - filterAndViewsContainer:",b),b.setDynamicFilters(m.value,(Et=t.view)==null?void 0:Et.id),b.updateDynamicFilters(m.value,(tt=t.view)==null?void 0:tt.id);const vr=m.value[0];if(console.log("GSCLineupsReports - newGameNumber from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCLineupsReports - created new filterMultiple object"));const kr=t.view.filterMultiple.gameNumber;t.view.filterMultiple.gameNumber=vr,console.log("GSCLineupsReports - updated filterMultiple.gameNumber from",kr,"to:",vr),console.log("GSCLineupsReports - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.gameNumber=vr,console.log("GSCLineupsReports - updated componentProps.gameNumber:",t.view.componentProps.gameNumber),t.view._updateKey,t.view._updateKey=Date.now(),console.log("GSCLineupsReports - updated _updateKey:",t.view._updateKey)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCLineupsReports - emitted force-component-update event"),Ai.emit("dynamic-filters-changed",{containerViewId:(st=f.value)==null?void 0:st.id,viewId:t.view.id,dynamicFilters:m.value}),console.log("GSCLineupsReports - emitted dynamic-filters-changed event"),Ai.emit("component-props-updated",{viewId:t.view.id,componentProps:t.view.componentProps,dynamicFilters:m.value}),console.log("GSCLineupsReports - emitted component-props-updated event"),p.nextTick(()=>{console.log("GSCLineupsReports - forcing reactivity update"),t.view.componentProps&&(t.view.componentProps={...t.view.componentProps})})}else console.log("GSCLineupsReports - newGameNumber is undefined!");console.log("GSCLineupsReports - updated specific filters for component:",(Xe=t.view)==null?void 0:Xe.id)}else if(((lt=f.value)==null?void 0:lt.id)===7){console.log("GSCGoalData - updateContainerOnUserChange - starting GSCGoalData logic"),console.log("GSCGoalData - current dynamicFilters:",m.value),console.log("GSCGoalData - currentFilters:",T.value),console.log("GSCGoalData - viewToEdit:",t),console.log("GSCGoalData - filterAndViewsContainer:",b),b.setDynamicFilters(m.value,(Tt=t.view)==null?void 0:Tt.id),b.updateDynamicFilters(m.value,(yt=t.view)==null?void 0:yt.id);const vr=m.value[0],kr=m.value[1];if(console.log("GSCGoalData - newAnalysisValue from dynamicFilters[0]:",vr),console.log("GSCGoalData - newTeamValue from dynamicFilters[1]:",kr),vr!==void 0&&t.view.componentProps){const wr=vr===1?"offensive":"defensive";t.view.componentProps.analysisType=wr,console.log("GSCGoalData - updated componentProps.analysisType to:",wr)}if(kr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCGoalData - created new filterMultiple object"));const wr=t.view.filterMultiple.isHomeTeam,ar=kr===1;t.view.filterMultiple.isHomeTeam=ar,console.log("GSCGoalData - updated filterMultiple.isHomeTeam from",wr,"to:",ar),console.log("GSCGoalData - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.isHomeTeamForAnalysis=ar,console.log("GSCGoalData - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis),t.view._updateKey,t.view._updateKey=Date.now(),console.log("GSCGoalData - updated _updateKey:",t.view._updateKey)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCGoalData - emitted force-component-update event"),Ai.emit("dynamic-filters-changed",{containerViewId:(It=f.value)==null?void 0:It.id,viewId:t.view.id,dynamicFilters:m.value}),console.log("GSCGoalData - emitted dynamic-filters-changed event"),Ai.emit("component-props-updated",{viewId:t.view.id,componentProps:t.view.componentProps,dynamicFilters:m.value}),console.log("GSCGoalData - emitted component-props-updated event"),p.nextTick(()=>{console.log("GSCGoalData - forcing reactivity update"),t.view.componentProps&&(t.view.componentProps={...t.view.componentProps})})}else console.log("GSCGoalData - newTeamValue is undefined!");console.log("GSCGoalData - updated specific filters for component:",(Lt=t.view)==null?void 0:Lt.id)}else if(((Qe=f.value)==null?void 0:Qe.id)===5){console.log("GSCVolumetricField - updateContainerOnUserChange - starting GSCVolumetricField logic"),console.log("GSCVolumetricField - current dynamicFilters:",m.value),console.log("GSCVolumetricField - currentFilters:",T.value),console.log("GSCVolumetricField - viewToEdit:",t),console.log("GSCVolumetricField - filterAndViewsContainer:",b),b.setDynamicFilters(m.value,(et=t.view)==null?void 0:et.id),b.updateDynamicFilters(m.value,(xt=t.view)==null?void 0:xt.id);const vr=m.value[0];if(console.log("GSCVolumetricField - newTeamValue from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCVolumetricField - created new filterMultiple object"));const kr=t.view.filterMultiple.isHomeTeam,wr=vr===1?1:2;t.view.filterMultiple.isHomeTeam=wr,console.log("GSCVolumetricField - updated filterMultiple.isHomeTeam from",kr,"to:",wr),console.log("GSCVolumetricField - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.isHomeTeamForAnalysis=wr===1,console.log("GSCVolumetricField - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis),t.view._updateKey,t.view._updateKey=Date.now(),console.log("GSCVolumetricField - updated _updateKey:",t.view._updateKey)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCVolumetricField - emitted force-component-update event"),Ai.emit("dynamic-filters-changed",{containerViewId:(Pt=f.value)==null?void 0:Pt.id,viewId:t.view.id,dynamicFilters:m.value}),console.log("GSCVolumetricField - emitted dynamic-filters-changed event"),Ai.emit("component-props-updated",{viewId:t.view.id,componentProps:t.view.componentProps,dynamicFilters:m.value}),console.log("GSCVolumetricField - emitted component-props-updated event"),p.nextTick(()=>{console.log("GSCVolumetricField - forcing reactivity update"),t.view.componentProps&&(t.view.componentProps={...t.view.componentProps})})}else console.log("GSCVolumetricField - newPreMatchType is undefined!");console.log("GSCVolumetricField - updated specific filters for component:",(Ot=t.view)==null?void 0:Ot.id)}else{if(((kt=f.value)==null?void 0:kt.id)===9)return;b.setDynamicFilters(m.value),b.updateDynamicFilters(m.value)}((Ht=f.value)==null?void 0:Ht.id)===8&&console.log("FieldPosesion - Container updated with dynamicFilters:",m.value),((qt=f.value)==null?void 0:qt.id)===3&&console.log("GSCMatchSummary - Container updated with dynamicFilters:",m.value),((Jt=f.value)==null?void 0:Jt.id)===2&&console.log("GSCtops - Container updated with dynamicFilters:",m.value),((Wt=f.value)==null?void 0:Wt.id)===1&&console.log("GSCComparativeReports - Container updated with dynamicFilters:",m.value),((Gt=f.value)==null?void 0:Gt.id)===6&&console.log("GSCLineupsReports - Container updated with dynamicFilters:",m.value),((rr=f.value)==null?void 0:rr.id)===5&&console.log("GSCVolumetricField - Container updated with dynamicFilters:",m.value),((ir=f.value)==null?void 0:ir.id)===9&&console.log("GSCFieldDataByZones - Container updated with dynamicFilters:",m.value),p.nextTick(()=>{x.value=!1,console.log("updateContainerOnUserChange completed")})}else console.log("updateContainerOnUserChange - conditions not met"),console.log("filterAndViewsContainer exists:",!!b),console.log("isEditMode.value:",u.value),console.log("viewToEdit exists:",!!t)}function me(){var ve,ye,De;if(!v||!v.dynamicFilters||!T.value)return!1;for(let Re=0;Re<v.dynamicFilters.length;Re++){const Ve=v.dynamicFilters[Re],We=T.value[Re],Je=m.value[Re];if(!(!Ve||!We)){if(We.type==="check"){if(Ve.isChecked!==Je)return console.log(`Check filter ${Re} needs update: saved=${Ve.isChecked}, current=${Je}`),!0}else if(We.type==="radio-button"){if(((ve=Ve.selectedOption)==null?void 0:ve.value)!==Je)return console.log(`Radio filter ${Re} needs update: saved=${(ye=Ve.selectedOption)==null?void 0:ye.value}, current=${Je}`),!0}else if(We.type==="select"){const ke=((De=Ve.selectedOptions)==null?void 0:De.map(Fe=>Fe.value))||Ve.selectedValue||[],ze=Array.isArray(Je)?Je:[];if(JSON.stringify(ke)!==JSON.stringify(ze))return console.log(`Select filter ${Re} needs update: saved=${JSON.stringify(ke)}, current=${JSON.stringify(ze)}`),!0}}}return console.log("No force update needed - values already match"),!1}return(ve,ye)=>(p.openBlock(),p.createElementBlock("div",ece,[p.createElementVNode("button",tce,p.toDisplayString(u.value?"Editando visualización":"Nueva visualización"),1),p.createElementVNode("div",{class:p.normalizeClass(["custom-select main-select",{disabled:u.value}]),onClick:ne},[p.createElementVNode("div",rce,[p.createElementVNode("span",nce,[d.value?(p.openBlock(),p.createElementBlock("img",{key:0,src:q(d.value.name,!1),alt:"icono",class:"option-img"},null,8,ice)):(p.openBlock(),p.createElementBlock("img",ace))]),d.value?(p.openBlock(),p.createElementBlock("span",sce,p.toDisplayString(W()),1)):(p.openBlock(),p.createElementBlock("span",oce,"Tipo de vista")),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:O.value}])},[...ye[4]||(ye[4]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),O.value?(p.openBlock(),p.createElementBlock("div",lce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(n.value,(De,Re)=>(p.openBlock(),p.createElementBlock("div",{key:De.id,class:p.normalizeClass(["option-card",{active:i.value===Re}]),onClick:p.withModifiers(Ve=>re(Re),["stop"])},[p.createElementVNode("div",uce,[p.createElementVNode("img",{src:q(De.name,!1),"data-hover-src":q(De.name,!0),alt:"icono",class:"option-img-34"},null,8,dce)]),p.createElementVNode("div",hce,[p.createElementVNode("div",pce,p.toDisplayString(De.name),1),De.description?(p.openBlock(),p.createElementBlock("div",fce,p.toDisplayString(De.description),1)):p.createCommentVNode("",!0)])],10,cce))),128))])):p.createCommentVNode("",!0)],2),d.value?(p.openBlock(),p.createElementBlock("div",{key:0,class:p.normalizeClass(["custom-select second-select",{disabled:u.value}]),onClick:X},[p.createElementVNode("div",mce,[p.createElementVNode("span",gce,[f.value?(p.openBlock(),p.createElementBlock("img",{key:0,src:f.value.url,alt:"icono",class:"option-img-graph2"},null,8,yce)):d.value?(p.openBlock(),p.createElementBlock("img",{key:1,src:q(d.value.name,!1),alt:"icono",class:"option-img"},null,8,vce)):p.createCommentVNode("",!0)]),p.createElementVNode("span",xce,p.toDisplayString(Y()),1),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:z.value}])},[...ye[5]||(ye[5]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),z.value&&d.value?(p.openBlock(),p.createElementBlock("div",bce,[p.createElementVNode("div",_ce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(s.value,De=>(p.openBlock(),p.createElementBlock("div",{key:De.id,class:p.normalizeClass(["option-card-grid",{active:c.value===De.id}]),onClick:p.withModifiers(Re=>ee(De),["stop"])},[p.createElementVNode("div",Tce,p.toDisplayString(De.name||De.title),1),p.createElementVNode("div",kce,[p.createElementVNode("img",{src:De.url,alt:"icono",class:"option-img-grid"},null,8,Sce)])],10,wce))),128))])])):p.createCommentVNode("",!0)],2)):p.createCommentVNode("",!0),f.value?(p.openBlock(),p.createElementBlock("div",Ece)):p.createCommentVNode("",!0),f.value&&T.value&&A()?(p.openBlock(),p.createElementBlock("div",{key:2,class:p.normalizeClass(["dynamic-filters",{"dynamic-filters-wide":T.value.length>=2}])},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(T.value,(De,Re)=>(p.openBlock(),p.createElementBlock(p.Fragment,{key:Re},[De.type==="select"?(p.openBlock(),p.createElementBlock("div",{key:0,class:"custom-select dynamic-select filter-inline",onClick:p.withModifiers(Ve=>Z(Re),["stop"])},[p.createElementVNode("div",Cce,[ye[7]||(ye[7]=p.createElementVNode("span",{class:"select-icon select-analisis-icon"},[p.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/report-maker/iconocategorias.png",alt:"icono categorías",style:{width:"18px",height:"18px","object-fit":"contain"}})],-1)),ye[8]||(ye[8]=p.createElementVNode("span",{class:"select-label"}," Tipo de análisis ",-1)),Array.isArray(m.value[Re])&&m.value[Re].length>0?(p.openBlock(),p.createElementBlock("span",Mce,p.toDisplayString(m.value[Re].length),1)):p.createCommentVNode("",!0),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:V.value===Re}])},[...ye[6]||(ye[6]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),V.value===Re?(p.openBlock(),p.createElementBlock("div",Lce,[p.createElementVNode("div",Nce,[p.createElementVNode("div",{class:"multi-select-header",onClick:ye[1]||(ye[1]=p.withModifiers(()=>{},["stop"]))},[p.createElementVNode("label",Ice,[p.createElementVNode("input",{type:"checkbox",checked:L(Re),indeterminate:N(Re),onChange:p.withModifiers(Ve=>R(Re),["stop"]),onClick:ye[0]||(ye[0]=p.withModifiers(()=>{},["stop"]))},null,40,Rce),ye[9]||(ye[9]=p.createElementVNode("span",{class:"select-all-label"},"Agregar todas",-1))])]),(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(De.options,Ve=>(p.openBlock(),p.createElementBlock("div",{key:Ve.value,class:p.normalizeClass(["option-card multi-select-option",{active:E(Re,Ve.value)}]),onClick:ye[2]||(ye[2]=p.withModifiers(()=>{},["stop"]))},[p.createElementVNode("div",Oce,[p.createElementVNode("input",{type:"checkbox",checked:E(Re,Ve.value),onChange:p.withModifiers(We=>S(Re,Ve.value),["stop"])},null,40,Pce)]),p.createElementVNode("div",{class:"option-content",onClick:We=>S(Re,Ve.value)},[p.createElementVNode("div",Dce,p.toDisplayString(Ve.label),1)],8,zce)],2))),128))]),p.createElementVNode("div",Bce,[p.createElementVNode("button",{class:"btn-listo",onClick:ye[3]||(ye[3]=p.withModifiers(Ve=>Me(),["stop"]))},"Listo")])])):p.createCommentVNode("",!0)],8,Ace)):De.type==="radio-button"?(p.openBlock(),p.createElementBlock("div",Vce,[p.createElementVNode("div",Fce,p.toDisplayString(De.label),1),p.createElementVNode("div",jce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(De.options,Ve=>(p.openBlock(),p.createElementBlock("label",{key:Ve.value,class:p.normalizeClass(["radio-option-card",{active:m.value[Re]===Ve.value}])},[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"dynamic-radio-"+Re,value:Ve.value,"onUpdate:modelValue":We=>m.value[Re]=We,disabled:k(Ve.value,Ve.label),onChange:()=>{var We,Je,ke;if(console.log("Radio button changed for GSCFieldDataByZones:",m.value[Re]),((We=f.value.value)==null?void 0:We.id)===9&&u.value.value&&(ke=(Je=p.unref(t))==null?void 0:Je.view)!=null&&ke.filterMultiple){const ze=m.value[Re]===1;p.unref(t).view.filterMultiple.isHomeTeam=ze,console.log("GSCFieldDataByZones - preserved radio-button value in filterMultiple:",ze)}u.value.value&&Ie(),he()}},null,40,Uce),[[p.vModelRadio,m.value[Re]]]),p.createElementVNode("span",null,p.toDisplayString(Ve.label),1)],2))),128))])])):De.type==="check"?(p.openBlock(),p.createElementBlock("div",qce,[p.createElementVNode("label",null,[p.withDirectives(p.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":Ve=>m.value[Re]=Ve,checked:m.value[Re],onChange:()=>{console.log(`Checkbox ${Re} changed to:`,m.value[Re]),u.value.value&&Ie(),he()}},null,40,Wce),[[p.vModelCheckbox,m.value[Re]]]),p.createTextVNode(" "+p.toDisplayString(De.label),1)])])):De.type==="select-simple"?(p.openBlock(),p.createElementBlock("div",{key:3,class:"custom-select dynamic-select filter-inline","data-filter-type":De.type,onClick:p.withModifiers(Ve=>te(Re),["stop"])},[p.createElementVNode("div",Hce,[ye[11]||(ye[11]=p.createElementVNode("span",{class:"select-icon select-analisis-icon"},[p.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/report-maker/iconocategorias.png",alt:"icono categorías",style:{width:"18px",height:"18px","object-fit":"contain"}})],-1)),ye[12]||(ye[12]=p.createElementVNode("span",{class:"select-label"}," Tipo de análisis ",-1)),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:U.value===Re}])},[...ye[10]||(ye[10]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),U.value===Re?(p.openBlock(),p.createElementBlock("div",Xce,[p.createElementVNode("div",Jce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(De.options,Ve=>(p.openBlock(),p.createElementBlock("div",{key:Ve.value,class:p.normalizeClass(["option-card simple-select-option",{active:m.value[Re]===Ve.value}]),onMouseenter:We=>Te(Re,Ve.value),onClick:p.withModifiers(We=>ae(Re,Ve.value),["stop"])},[p.createElementVNode("div",Zce,[p.createElementVNode("div",Yce,p.toDisplayString(Ve.label),1)]),m.value[Re]===Ve.value?(p.openBlock(),p.createElementBlock("div",Qce,[...ye[13]||(ye[13]=[p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[p.createElementVNode("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#cbee6b","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):p.createCommentVNode("",!0)],42,Kce))),128))])])):p.createCommentVNode("",!0)],8,Gce)):p.createCommentVNode("",!0),Re===1&&T.value.length>2?(p.openBlock(),p.createElementBlock("div",$ce)):p.createCommentVNode("",!0)],64))),128))],2)):p.createCommentVNode("",!0),u.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("button",{key:3,class:"cancel-btn",onClick:be},"Cancelar")),e.value?(p.openBlock(),p.createElementBlock("button",{key:4,class:"ok-btn",onClick:_e},"OK")):p.createCommentVNode("",!0)]))}}),tue=dd(eue,[["__scopeId","data-v-113a6c74"]]),rue={key:0,class:"modal-simple"},nue={class:"modal-simple__content"},iue={class:"modal-simple__content__header"},aue={class:"modal-simple__content__body"},oue={class:"modal-simple__content__footer"},sue={__name:"ModalSimple",props:{modelValue:{type:Boolean,default:!1}},setup(r){return(a,g)=>(p.openBlock(),p.createBlock(p.Teleport,{to:"body"},[r.modelValue?(p.openBlock(),p.createElementBlock("div",rue,[p.createElementVNode("div",nue,[p.createElementVNode("div",iue,[p.renderSlot(a.$slots,"header",{},void 0,!0)]),p.createElementVNode("div",aue,[p.renderSlot(a.$slots,"body",{},void 0,!0)]),p.createElementVNode("div",oue,[p.renderSlot(a.$slots,"footer",{},void 0,!0)])])])):p.createCommentVNode("",!0)]))}},lue=dd(sue,[["__scopeId","data-v-1cc4f590"]]),cue={class:"footer"},uue={__name:"ModalCautionClose",props:{value:{type:Boolean,default:!1}},emits:["update:modelValue","action"],setup(r,{emit:a}){const g=a;function B(C){g("update:modelValue",C)}function K(C){g("action",C),g("update:modelValue",!1)}return(C,b)=>(p.openBlock(),p.createBlock(lue,{"modle-value":r.value,"onUpdate:modelValue":B},{header:p.withCtx(()=>[...b[2]||(b[2]=[p.createElementVNode("div",{class:"header"},"Descartar template",-1)])]),body:p.withCtx(()=>[...b[3]||(b[3]=[p.createElementVNode("div",{class:"body"},"¿Estás seguro que deseas abandonar el proceso?",-1)])]),footer:p.withCtx(()=>[p.createElementVNode("div",cue,[p.createElementVNode("div",{role:"button",class:"btn btn-cancel",onClick:b[0]||(b[0]=t=>K(!1))}," Seguir editando "),p.createElementVNode("div",{role:"button",class:"btn btn-confirm",onClick:b[1]||(b[1]=t=>K(!0))}," Descartar ")])]),_:1},8,["modle-value"]))}},due=dd(uue,[["__scopeId","data-v-ed9b5088"]]),hue={key:0,class:"modal-simple"},pue={__name:"ModalChangesSaved",props:{modelValue:{type:Boolean,default:!1}},setup(r){return(a,g)=>(p.openBlock(),p.createBlock(p.Teleport,{to:"body"},[p.createVNode(p.Transition,null,{default:p.withCtx(()=>[r.modelValue?(p.openBlock(),p.createElementBlock("div",hue,[...g[0]||(g[0]=[p.createElementVNode("div",{class:"modal-simple__content"},[p.createElementVNode("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M29.3346 14.7823V16.0089C29.333 18.8842 28.402 21.6818 26.6804 23.9847C24.9589 26.2876 22.539 27.9722 19.7818 28.7875C17.0245 29.6027 14.0776 29.5048 11.3806 28.5084C8.68354 27.512 6.38084 25.6704 4.81592 23.2584C3.25099 20.8463 2.50769 17.993 2.69687 15.124C2.88605 12.255 3.99758 9.52404 5.86568 7.33836C7.73377 5.15269 10.2583 3.62944 13.0629 2.9958C15.8674 2.36215 18.8017 2.65205 21.428 3.82227",stroke:"#CDEF71","stroke-width":"2.66667","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M29.3333 5.33203L16 18.6787L12 14.6787",stroke:"#CDEF71","stroke-width":"2.66667","stroke-linecap":"round","stroke-linejoin":"round"})]),p.createElementVNode("div",{class:"modal-simple__content__text"}," Los cambios se han guardado correctamente ")],-1)])])):p.createCommentVNode("",!0)]),_:1})]))}},fue=dd(pue,[["__scopeId","data-v-2bc30783"]]),mue={class:"template-maker__header"},gue={key:0,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yue={class:"template-maker__content"},vue={class:"template-maker__content__main"},xue={id:"containerMain",class:"container-main"},bue={class:"template-maker__content__main__cover-selector"},_ue=["id"],wue={class:"page-indicator"},Tue={class:"page-indicator__index"},kue=["onClick"],Sue=["onClick"],Eue={key:0,class:"template-maker__content__main__footer"},Aue={class:"template-maker__content__main__footer__paginator"},Cue={class:"template-maker__content__main__footer__paginator__nav"},Mue={class:"template-maker__content__main__footer__paginator__numbers"},Lue=["onClick"],Nue={__name:"GSC-TemplateReportMaker",props:{token:{type:String,default:""},userTeamId:{type:Number,default:0}},emits:["close"],setup(r,{expose:a,emit:g}){const B=new Map,K=p.ref([{title:"Page 1",id:String(Date.now()),items:[{name:"Volumetrica",id:`w-${String(Date.now())}`,x:0,y:0,w:4,h:6,maxWidth:4,maxHeight:4,noResize:!1,noMove:!1,componentProps:{}},{name:"Volumetrica",id:String(Date.now()),x:4,y:0,w:4,h:4,maxWidth:4,maxHeight:4,noResize:!1,noMove:!1,componentProps:{}}]}]),C=p.ref(null),b=p.ref(0),t=p.ref(!1),v=p.ref(null),u=p.ref(null),e=p.ref(!0),w=p.ref(!1),y=p.ref(!1),x=p.ref(0),h=p.ref(!1),n=p.ref(null),i=p.ref(new Map),d=p.ref(null),s=p.ref(null),c=p.ref(!1),f=p.ref(!1),m=p.ref(!1),T=p.computed(()=>({"--overflow-y-template-maker":w.value?"scroll":"hidden","--height-container-main":w.value?"fit-content":"calc(100vh - 64px)","--margin-bottom-container-main":(w.value,"0")})),E=p.computed(()=>b.value+1);p.watch(()=>t.value,Te=>{const Ce=document.getElementById("app");Te?(b.value=0,document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",Ce&&(Ce.style.overflow="hidden")):(document.body.style.overflow="",document.documentElement.style.overflow="",Ce&&(Ce.style.overflow=""))});function S(Te){return Te<10?`0${Te}`:Te}async function L({templateId:Te,userId:Ce}){try{return(await(await fetch(`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/users/${Ce}/templates/${Te}`,{method:"GET",headers:{Authorization:Z.token}})).json()).data}catch(Ne){console.error("Error fetching template by ID:",Ne)}}async function N({reportId:Te,userId:Ce}){try{return(await(await fetch(`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/users/${Ce}/reports/${Te}`,{method:"GET",headers:{Authorization:Z.token}})).json()).data}catch(Ne){console.error("Error fetching report by ID:",Ne)}}let A=0;function I(Te){C.value=Te,A>0&&(c.value=!0),A++}function M(Te){Te&&oe(null,!0)}let k=null;function R(Te,Ce){let Ne=Te.getBoundingClientRect(),Oe={height:Te.clientHeight,width:Te.clientWidth},Ge=Ce.getBoundingClientRect();if(!(Ge.top>=Ne.top&&Ge.bottom<=Ne.top+Oe.height)){const Le=Ge.top-Ne.top,je=Ge.bottom-Ne.bottom;Math.abs(Le)<Math.abs(je)?Te.scrollTop+=Le:Te.scrollTop+=je}}function _(Te,Ce){let Ne=Te.getBoundingClientRect();const Oe=Ce.getBoundingClientRect().top-Ne.top;Te.scrollTop+=Oe}function O(Te,Ce=!1){const Ne={title:`Page ${K.value.length+1}`,id:`p-${Date.now()}`,items:[]};if(ge(),Te!==void 0&&Te>=-1?K.value.splice(Te+1,0,Ne):K.value.push(Ne),p.nextTick(()=>{const Oe=K.value.findIndex(Le=>Le.id===Ne.id),Ge=document.getElementById(`page-${Oe+1}`);k||(k=document.getElementById("containerMain")),Ge&&k?R(k,Ge):console.error("Page element or container main element not found")}),Ce)return Ne;c.value=!0}function z(Te){if(console.log("onClickPage",Te),Te<0||Te>K.value.length){console.log("Invalid page index:",Te,"Valid range: 0 to",K.value.length);return}b.value=Te;const Ce=document.getElementById(`page-${Te}`);if(console.log("pageElement found:",Ce),k||(k=document.getElementById("containerMain")),console.log("containerMainEl found:",k),Ce&&k){const Ne=new CustomEvent("programmatic-scroll-start");document.dispatchEvent(Ne),_(k,Ce),setTimeout(()=>{const Oe=new CustomEvent("programmatic-scroll-end");document.dispatchEvent(Oe)},300)}else console.error("Page element or container main element not found")}function V(Te){d.value=Te,h.value=!0}function U(Te,Ce){const Ne=Ce+1;Te&&b.value!==Ne&&(b.value=Ne)}function q(Te){h.value=!0,Ai.emit("edit-view",{view:Te})}async function W({templateReportId:Te,userId:Ce,isTemplateMode:Ne}){try{return Ne?L({templateId:Te,userId:Ce}):N({reportId:Te,userId:Ce})}catch(Oe){throw new Error("Error fetching template or report by ID: "+Oe.message)}}function Y(){A=0,h.value=!1,b.value=0,d.value=null,s.value=null,i.value.clear(),k=null}async function ne(Te){if(console.log("show, initialConfig",Te),Y(),e.value=Te.isTemplateMode,console.log("****************************************** isTemplateMode.value",e.value),w.value=!!Te.isPDFMode,Te.isPDFMode?v.value=await N({reportId:Te.reportId,userId:Te.userId}):(v.value=Te.template,v.value=await W({templateReportId:Te.template.id,userId:Te.template.user_id,isTemplateMode:Te.isTemplateMode})),!v.value)return;v.value&&v.value.game&&(v.value.game=ae(v.value.game)),console.log("templateToEdit.value",v.value),u.value=JSON.parse(JSON.stringify(v.value)),y.value=v.value.template_type===2;const Ce=v.value.pages.find(Ne=>Ne.is_front_page);x.value=Ce?Ce.type:1,t.value=!0,K.value=v.value.pages.reduce((Ne,Oe,Ge)=>{if(!Oe.is_front_page){Oe.name||(Oe.name="");const Le={originalPage:JSON.parse(JSON.stringify(Oe)),title:Oe.name,id:`p-${Date.now()-Ge*9}`,items:[],components:Oe.components};Oe.components&&Oe.components.length>0&&(Le.items=Oe.components.map((je,Ie)=>{const me=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[],je.coreView.id,je.dynamicFilters,y.value,e.value,je.filtersJSON||null,Z.token),ve={originalComponent:JSON.parse(JSON.stringify(je)),title:je.title,game:v.value.game,idAux:je.id,id:`w-${Date.now()-Ie*7}`,x:je.column,y:je.row,w:je.colspan,h:je.rowspan,maxWidth:je.max_column,maxHeight:je.max_row,minWidth:je.min_column,minHeight:je.min_row,noResize:!e.value,noMove:!e.value,coreView:je.coreView||null,isTemplateMode:e.value,componentName:je.componentName,componentProps:ee({currentProps:je.componentProps,coreView:je.coreView,isTemplateMode:e.value,templateToEdit:v.value,filterMultiple:je.filterMultiple||null,game:v.value.game||null})||{},filterMultiple:je.filterMultiple,isHomeTeam:re({game:v.value.game,isTemplateMode:e.value,currentIsHomeTeam:je.isHomeTeam||je.componentProps.isHomeTeamForAnalysis}),filtersJSON:je.filtersJSON||null,dynamicFilters:je.dynamicFilters||[],filterAndViewsContainer:me},ye=p.reactive({view:ve});return me.addView(ye,!0),i.value.set(me.getId(),me),ve})),Ne.push(Le)}return Ne},[]),console.log("pages.value",K.value),console.log("isvisible.value",t.value)}function X({game:Te,isTemplateMode:Ce}){const Ne=Te&&Te.homeTeam&&Te.awayTeam&&(Te.homeTeam.team_id===Z.userTeamId||Te.awayTeam.team_id===Z.userTeamId);return{isUserTeamHome:Ne&&Te.homeTeam.team_id===Z.userTeamId,requiresUserTeamAdjustment:Ne&&!Ce}}function re({game:Te,isTemplateMode:Ce,currentIsHomeTeam:Ne}){const{isUserTeamHome:Oe,requiresUserTeamAdjustment:Ge}=X({game:Te,isTemplateMode:Ce});return Ge?Ne?Oe:!Oe:Ne}function ee({currentProps:Te,coreView:Ce,templateToEdit:Ne,isTemplateMode:Oe,filterMultiple:Ge,game:Le}){if(!Te||!Ce)return Te||{};const{isUserTeamHome:je,requiresUserTeamAdjustment:Ie}=X({game:Le,isTemplateMode:Oe}),me={...Te};if(Ce.id===5&&(me.isGhostEffect=Oe,Ie)){const ve=me.preMatchType===1;me.preMatchType=ve?je?1:2:je?2:1}if(Ce.id===7&&Ie){const ve=me.isHomeTeamForAnalysis;me.isHomeTeamForAnalysis=ve?je:!je}if(Ce.id===9&&Ie){const ve=me.isHomeTeamForAnalysis;me.isHomeTeamForAnalysis=ve?je:!je}if(Ce.id===10&&Ie){const ve=me.isHomeTeamForAnalysis;me.isHomeTeamForAnalysis=ve?je:!je}if(Ce.id===1&&(me.gameId=Le?Le.id:"",me.homeLogo=Le?Le.homeTeam.logo:"",me.awayLogo=Le?Le.awayTeam.logo:"",me.seasonId=Le?Le.season_id:0,me.default=Oe),Ce.id===6&&(me.game=Le||"",me.lastGames=Ne.last_games,me.selectedOption=Ne.template_type===2?"Postmatch":"Prematch"),Ce.id===3&&(me.defaultShields=Oe),Ce.id===2){let ve=!0,ye=0,De=0;Le&&(ve=Ne.main_team==Le.home_team||Ne.main_team==Le.visiting_team,ye=ve?Ne.main_team==(Le==null?void 0:Le.home_team)?Le==null?void 0:Le.home_team:Le==null?void 0:Le.visiting_team:Le==null?void 0:Le.home_team,De=ve?Ne.main_team==(Le==null?void 0:Le.home_team)?Le==null?void 0:Le.visiting_team:Le==null?void 0:Le.home_team:Le==null?void 0:Le.visiting_team),console.log("<- 1 -> ******************** component props //////////////////////////////////",Te),console.log("<- 2 -> ********************",Ce),console.log("<- 3 -> ********************",Ne),console.log("<- 4 -> ********************",Ge),me.gamed=Le?Le.id:"",me.game=Le||"",me.season=Le?Le.season_id:0,me.teamView=Ge.teamType==3?0:Ge.teamType==1?ye:De,me.useDummyData=Oe}return Ce.id===8&&(me.teamSelected=Le?{teamId:Le.home_team}:1,me.isDefault=Oe),Ce.id===4&&(me.gameId=Le?Le.id:"",me.isDefault=Oe,me.homeTeam=Le?Le==null?void 0:Le.home_team:"",me.awayTeam=Le?Le==null?void 0:Le.visiting_team:""),Le&&(me.game=Le),me}const Z=r,te=g;p.watch(()=>Z.token,(Te,Ce)=>{console.log("Token changed:",{newToken:Te,oldToken:Ce})},{immediate:!0}),a({show:ne}),Ai.on("add-page-view",Te=>{console.log("88888888888888888888888888888888888888888888888888888888888888888"),console.log("viewConfig",Te),B.set(Te.view.id,Te.view);const Ce=K.value.find(Ne=>Ne.id===Te.pageId);Ce&&(Ce.items||(Ce.items=[]),Ce.items.push(Te.view),p.nextTick(()=>{const Ne=document.querySelector(`[gs-id="${Te.view.id}"]`);Te.grid.makeWidget(Ne)}))}),Ai.on("add-page-and-view",Te=>{const Ce=K.value.findIndex(Ne=>Ne.id===Te.pageId);if(Ce>-1){const Ne=O(Ce,!0);setTimeout(()=>{Ai.emit("add-view",{pageId:Ne.id,view:Te.view,filterAndWidgetContainer:Te.filterAndWidgetContainer}),s.value&&(Ne.stepBackPage=s.value),s.value=Ne},500)}else console.error("Page not found for adding view:",Te.pageId)}),Ai.on("empty-page",Te=>{h.value&&d.value&&d.value.id===Te.id||(_e(Te),s.value&&s.value.id===Te.id&&(s.value.stepBackPage?s.value=s.value.stepBackPage:s.value=null))}),Ai.on("filters-cancelled",Te=>{Te&&Te.removeAllChildViews()}),Ai.on("activate-save-button",()=>{console.log("GSC-TemplateReportMaker - activate-save-button event received"),c.value=!0,console.log("GSC-TemplateReportMaker - isSaveActive set to true")});function ae(Te){return{...Te,gameId:Te.game_id,id:Te.game_id,seasonId:Te.season_id,status:Te.game_status,homeTeam:{logo:`https://golstatsimages.blob.core.windows.net/teams-150/${Te.home_team}.png`,team_id:Te.home_team,provisional_logo:`https://golstatsimages.blob.core.windows.net/teams-provisional/${Te.home_team}.png`,colloquial_name:Te.home_team_name,acronym:Te.home_team_acronym,team_name:Te.home_team_name},awayTeam:{logo:`https://golstatsimages.blob.core.windows.net/teams-150/${Te.visiting_team}.png`,team_id:Te.visiting_team,provisional_logo:`https://golstatsimages.blob.core.windows.net/teams-provisional/${Te.visiting_team}.png`,colloquial_name:Te.visiting_team_name,acronym:Te.visiting_team_acronym,team_name:Te.visiting_team_name}}}function oe(Te,Ce=!1){Ce||!e.value?(t.value=!1,Y(),te("close")):c.value?f.value=!0:(t.value=!1,Y(),te("close"))}function he(){n.value=null,h.value=!1}function fe({page:Te,view:Ce,applyMinimumSize:Ne=!1}){const Oe=Te.grid;if(!Te||!Ce||!Oe)return null;const Ge=Ne?{w:Ce.min_column,h:Ce.min_row}:{w:Ce.colspan,h:Ce.rowspan},Le=Oe.willItFit(0,0,Ge.w,Ge.h,!0);return Le?{willFit:Le,applyMinimumSize:Ne}:Ne?null:fe({page:Te,view:Ce,applyMinimumSize:!0})}const se=new Set([9]);function ue(Te){var Ce,Ne,Oe,Ge,Le,je,Ie;if(console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"),console.log("onFiltersChanged",Te),Te.dynamicFilters&&Te.dynamicFilters.length>0&&Te.viewToEdit&&Te.viewToEdit.view){const me=Te.viewToEdit.view.id;K.value.forEach(ve=>{ve.items.forEach(ye=>{ye.id===me&&ye.coreView&&ye.coreView.id===3&&(ye.componentProps.desplegable=Te.dynamicFilters[0]||!1,ye.componentProps.key=Te.dynamicFilters[0]||!1,p.nextTick(()=>{Ai.emit("force-component-update",{itemId:ye.id,componentProps:ye.componentProps})}))})})}if(console.log("filters.viewToEdit",Te.viewToEdit),Te.viewToEdit){if(!Te.viewToEdit.view.filterAndViewsContainer||Te.viewToEdit.view.filterAndViewsContainer.childViews.length>1){const me=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[Te.viewToEdit.view],((Ce=Te.viewToEdit.view.coreView)==null?void 0:Ce.id)||Te.viewToEdit.view.id,Te.dynamicFilters||[],y.value,e.value,Te.filtersJSON,Z.token);Te.viewToEdit.view.filterAndViewsContainer=me}Te.viewToEdit.view.filterAndViewsContainer.updateView({view:Te.viewToEdit,dynamicFilters:Te.dynamicFilters||[],filtersJSON:Te.filtersJSON||null}),c.value=!0}else if(Te.view){Te.view.id&&Te.filterAndViewsContainer&&Te.view.id!==Te.filterAndViewsContainer.viewId&&(Te.filterAndViewsContainer.removeAllChildViews(),Te.filterAndViewsContainer.setViewId(Te.view.id),Te.filterAndViewsContainer.setFiltersJSON(Te.filtersJSON||null)),Te.view.id&&se.has(Te.view.id)&&Te.dynamicFilters[0]&&Te.dynamicFilters[0].length===0&&Te.filterAndViewsContainer&&(Te.filterAndViewsContainer.updateDynamicFilters(Te.dynamicFilters,(Oe=(Ne=Te.viewToEdit)==null?void 0:Ne.view)==null?void 0:Oe.id),c.value=!0);const me=s.value||d.value,ve=fe({page:me,view:Te.view,applyMinimumSize:!1});Te.view.filtersJSON=Te.filtersJSON||null;const ye=Te.filterAndViewsContainer,De=K.value.findIndex(Re=>Re.id===me.id);if(ye){const Re=Te.filterAndViewsContainer.getRequiresAddView(Te.dynamicFilters);console.log("111111111111111111111111111111111"),console.log("requiersAddView",Re),Re?(ye.setDynamicFilters(Te.dynamicFilters),(ve||De===K.value.length-1)&&(Ai.emit("add-view",{pageId:me.id,view:Te.view,filterAndWidgetContainer:ye,avoidWillFit:!1,applyMinimumSize:ve?ve.applyMinimumSize:!1,dynamicFilters:Te.dynamicFilters}),Te.filterAndViewsContainer.updateDynamicFilters(Te.dynamicFilters,(Le=(Ge=Te.viewToEdit)==null?void 0:Ge.view)==null?void 0:Le.id),c.value=!0,setTimeout(()=>{Te.filterAndViewsContainer.getRequiresAddView(Te.dynamicFilters)?(console.log("GSCtops - still requires add view, calling recursively"),ue(Te)):console.log("GSCtops - no more views needed, stopping recursion")},1e3))):(Te.filterAndViewsContainer.updateDynamicFilters(Te.dynamicFilters,(Ie=(je=Te.viewToEdit)==null?void 0:je.view)==null?void 0:Ie.id),c.value=!0)}else if(ve||De===K.value.length-1){const Re=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[],Te.view.id,Te.dynamicFilters,y.value,e.value,Te.filtersJSON,Z.token);Ai.emit("set-filter-and-views-container",Re),i.value.set(Re.getId(),Re),Te.dynamicFilters&&Array.isArray(Te.dynamicFilters[0])?(Te.filterAndViewsContainer=Re,ue(Te)):Ai.emit("add-view",{pageId:me.id,view:Te.view,filterAndWidgetContainer:Re,avoidWillFit:!1,applyMinimumSize:ve?ve.applyMinimumSize:!1,dynamicFilters:Te.dynamicFilters}),c.value=!0}}}async function de(){if(c.value)try{const Te=[{is_front_page:!0,template_type:C.value.isPostMatch?2:1,type:C.value.id},...K.value.map(Ne=>({columns:Ne.originalPage?Ne.originalPage.columns:12,rows:Ne.originalPage?Ne.originalPage.rows:12,gap:Ne.originalPage?Ne.originalPage.gap:10,name:Ne.title,width:Ne.originalPage?Ne.originalPage.width:968,height:Ne.originalPage?Ne.originalPage.height:702,components:Ne.items.map(Oe=>({min_column:Oe.minWidth,min_row:Oe.minHeight,max_column:Oe.maxWidth,max_row:Oe.maxHeight,column:Oe.x,row:Oe.y,colspan:Oe.w,rowspan:Oe.h,name:Oe.name,title:Oe.title,dynamicFilters:Oe.filterAndViewsContainer.getComponentDynamicFilters(Oe.id)||Oe.filterAndViewsContainer.getDynamicFilters()||[],coreView:Oe.coreView||null,componentName:Oe.componentName,componentProps:Oe.componentProps||{},isHomeTeam:Oe.isHomeTeam||Oe.componentProps.isHomeTeamForAnalysis,filterMultiple:Oe.filterMultiple}))}))];console.log("pagesAuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),console.log(Te);const Ce=await fetch(`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/users/${v.value.user_id}/templates/${v.value.id}/pages`,{method:"PATCH",headers:{Authorization:Z.token},body:JSON.stringify({pages:Te})});m.value=!0,await Ce.json(),c.value=!1,setTimeout(()=>{m.value=!1},2e3)}catch(Te){console.error("Error saving template:",Te)}}function ge(){K.value.forEach(Te=>{Te.offListeners&&Te.offListeners()})}function _e(Te){const Ce=K.value.findIndex(Ne=>Ne.id===Te.id);Ce>-1&&(ge(),K.value=K.value.filter(Ne=>Ne.id!==Te.id),b.value>=Ce&&(b.value=Math.max(0,b.value-1)),c.value=!0)}function be(){c.value=!0}function Se(Te){const Ce=K.value.find(Ne=>Ne.items.some(Oe=>Oe.id===Te.id));if(Ce){const Ne=Ce.items.findIndex(Oe=>Oe.id===Te.id);Ne!==-1&&(Ce.items.splice(Ne,1),c.value=!0)}}function Me(Te){console.log("onChangeSort",Te)}return(Te,Ce)=>(p.openBlock(),p.createElementBlock(p.Fragment,null,[p.createVNode(due,{modelValue:f.value,"onUpdate:modelValue":Ce[0]||(Ce[0]=Ne=>f.value=Ne),onAction:M},null,8,["modelValue"]),p.createVNode(fue,{"model-value":m.value},null,8,["model-value"]),(p.openBlock(),p.createBlock(p.Teleport,{to:"body"},[t.value&&v.value?(p.openBlock(),p.createElementBlock("div",{key:0,class:"template-maker",style:p.normalizeStyle(T.value)},[p.withDirectives(p.createVNode(tue,{token:r.token,view:n.value,"is-post-match":y.value,onClose:he,onFiltersChanged:ue},null,8,["token","view","is-post-match"]),[[p.vShow,e.value&&h.value]]),p.createElementVNode("div",mue,[p.createTextVNode(p.toDisplayString(v.value?v.value.name:"Nuevo template")+" ",1),p.createElementVNode("div",{class:"template-maker__header__close",onClick:oe},[w.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("svg",gue,[...Ce[6]||(Ce[6]=[p.createElementVNode("path",{d:"M1.33398 1.33398L14.6673 14.6673",stroke:"#FFFFFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),p.createElementVNode("path",{d:"M14.666 1.33398L1.33268 14.6673",stroke:"#FFFFFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))])]),p.createElementVNode("div",yue,[Ce[13]||(Ce[13]=p.createElementVNode("div",{class:"template-maker__content__sidebar"},null,-1)),p.createElementVNode("div",vue,[p.createElementVNode("div",xue,[p.createElementVNode("div",bue,[p.withDirectives(p.createVNode(QT,{"is-post-match":y.value,"initial-cover-id":x.value,onSelectCover:I},null,8,["is-post-match","initial-cover-id"]),[[p.vShow,e.value]])]),(p.openBlock(),p.createElementBlock("div",{class:"template-maker__content__main__pages",key:K.value.length},[C.value?(p.openBlock(),p.createBlock($le,{key:0,id:"page-0",game:v.value.game||null,"cover-id":C.value.id,"is-post-match":C.value.isPostMatch,onIntersectionChanged:Ce[1]||(Ce[1]=Ne=>U(Ne,-1))},null,8,["game","cover-id","is-post-match"])):p.createCommentVNode("",!0),e.value?(p.openBlock(),p.createElementBlock("div",{key:1,class:"new-items-buttons",style:p.normalizeStyle({"margin-bottom":K.value.length===0?"30px":"0"})},[h.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("div",{key:0,class:"new-items-buttons__add-page new-item-button",onClick:Ce[2]||(Ce[2]=Ne=>O(-1))},[...Ce[7]||(Ce[7]=[p.createElementVNode("div",null,"+ Nueva página",-1),p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M8.66797 1.33203H4.0013C3.64768 1.33203 3.30854 1.47251 3.05849 1.72256C2.80844 1.9726 2.66797 2.31174 2.66797 2.66536V13.332C2.66797 13.6857 2.80844 14.0248 3.05849 14.2748C3.30854 14.5249 3.64768 14.6654 4.0013 14.6654H12.0013C12.3549 14.6654 12.6941 14.5249 12.9441 14.2748C13.1942 14.0248 13.3346 13.6857 13.3346 13.332V5.9987L8.66797 1.33203Z",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M8.66797 1.33203V5.9987H13.3346",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]))],4)):p.createCommentVNode("",!0),(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(K.value,(Ne,Oe)=>(p.openBlock(),p.createElementBlock("div",{key:Oe,id:`page-${Oe+1}`,class:"template-maker__content__main__pages__page"},[p.createElementVNode("div",wue,[p.createElementVNode("div",Tue,"Pag "+p.toDisplayString(S(Oe+2)),1)]),C.value?(p.openBlock(),p.createBlock(tle,{key:0,page:Ne,"is-template-mode":e.value,"is-post-match":C.value.isPostMatch,game:v.value.game||null,lastGames:v.value.lastGames||[],"is-filter-visible":h.value,onEditView:q,onIntersectionChanged:Ge=>U(Ge,Oe),onChangeSort:Me,onDeletePage:_e,onViewChanged:be,onDeleteView:Se},null,8,["page","is-template-mode","is-post-match","game","lastGames","is-filter-visible","onIntersectionChanged"])):p.createCommentVNode("",!0),e.value&&!h.value?(p.openBlock(),p.createElementBlock("div",{key:1,class:"new-items-buttons",style:p.normalizeStyle({"margin-bottom":Oe+1===K.value.length?"30px":"0","margin-top":"10px"})},[p.createElementVNode("div",{class:"new-items-buttons__add-page new-item-button",onClick:Ge=>O(Oe)},[...Ce[8]||(Ce[8]=[p.createElementVNode("div",null,"+ Nueva página",-1),p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M8.66797 1.33203H4.0013C3.64768 1.33203 3.30854 1.47251 3.05849 1.72256C2.80844 1.9726 2.66797 2.31174 2.66797 2.66536V13.332C2.66797 13.6857 2.80844 14.0248 3.05849 14.2748C3.30854 14.5249 3.64768 14.6654 4.0013 14.6654H12.0013C12.3549 14.6654 12.6941 14.5249 12.9441 14.2748C13.1942 14.0248 13.3346 13.6857 13.3346 13.332V5.9987L8.66797 1.33203Z",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M8.66797 1.33203V5.9987H13.3346",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,kue),p.createElementVNode("div",{class:"new-items-buttons__add-item new-item-button",onClick:Ge=>V(Ne)},[...Ce[9]||(Ce[9]=[p.createElementVNode("div",null,"+ Agregar gráfico",-1),p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M12 13.3346V6.66797",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M8 13.3346V2.66797",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M4 13.332V9.33203",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,Sue)],4)):p.createCommentVNode("",!0)],8,_ue))),128))]))]),w.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("div",Eue,[p.createElementVNode("div",Aue,[p.createElementVNode("div",Cue,[p.createElementVNode("div",null,"Páginas "+p.toDisplayString(E.value),1),p.createElementVNode("div",{class:p.normalizeClass(["template-maker__content__main__footer__paginator__nav__arrow",{disabled:b.value<=0}]),onClick:Ce[3]||(Ce[3]=Ne=>b.value>0&&z(b.value-1))},[...Ce[10]||(Ce[10]=[p.createElementVNode("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.22444 5L5.29079 8.57741C5.56974 8.90285 5.56974 9.43049 5.29079 9.75592C5.01184 10.0814 4.55958 10.0814 4.28064 9.75592L0.709209 5.58926C0.430263 5.26382 0.430263 4.73618 0.709209 4.41074L4.28064 0.244078C4.55958 -0.0813593 5.01184 -0.0813592 5.29079 0.244078C5.56974 0.569515 5.56974 1.09715 5.29079 1.42259L2.22444 5Z",fill:"#92929D"})],-1)])],2),p.createElementVNode("div",{class:p.normalizeClass(["template-maker__content__main__footer__paginator__nav__arrow",{disabled:b.value>=K.value.length}]),onClick:Ce[4]||(Ce[4]=Ne=>b.value<K.value.length&&z(b.value+1))},[...Ce[11]||(Ce[11]=[p.createElementVNode("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.77556 5L0.70921 8.57741C0.430264 8.90285 0.430264 9.43049 0.70921 9.75592C0.988156 10.0814 1.44042 10.0814 1.71936 9.75592L5.29079 5.58926C5.56974 5.26382 5.56974 4.73618 5.29079 4.41074L1.71936 0.244078C1.44042 -0.0813593 0.988155 -0.0813592 0.709209 0.244078C0.430264 0.569515 0.430264 1.09715 0.70921 1.42259L3.77556 5Z",fill:"#92929D"})],-1)])],2)]),p.createElementVNode("div",Mue,[p.createElementVNode("div",{role:"button",class:p.normalizeClass({active:b.value===0}),onClick:Ce[5]||(Ce[5]=Ne=>z(0))},p.toDisplayString(S(1)),3),(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(K.value,(Ne,Oe)=>(p.openBlock(),p.createElementBlock("div",{role:"button",key:Oe,class:p.normalizeClass({active:Oe+1===b.value}),onClick:Ge=>z(Oe+1)},p.toDisplayString(S(Oe+2)),11,Lue))),128))])]),e.value?(p.openBlock(),p.createElementBlock("div",{key:0,role:"button",class:p.normalizeClass(["template-maker__content__main__footer__save save-button",{disabled:!c.value}]),onClick:de},[...Ce[12]||(Ce[12]=[p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M12.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V3.33333C2 2.97971 2.14048 2.64057 2.39052 2.39052C2.64057 2.14048 2.97971 2 3.33333 2H10.6667L14 5.33333V12.6667C14 13.0203 13.8595 13.3594 13.6095 13.6095C13.3594 13.8595 13.0203 14 12.6667 14Z",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M11.3346 14.0013V8.66797H4.66797V14.0013",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M4.66797 2V5.33333H10.0013",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1),p.createElementVNode("div",null,"Guardar",-1)])],2)):p.createCommentVNode("",!0)]))])])],4)):p.createCommentVNode("",!0)]))],64))}},Iue=dd(Nue,[["__scopeId","data-v-e8645e22"]]);function z6(r,a){return function(){return r.apply(a,arguments)}}const{toString:Rue}=Object.prototype,{getPrototypeOf:H2}=Object,{iterator:oy,toStringTag:D6}=Symbol,sy=(r=>a=>{const g=Rue.call(a);return r[g]||(r[g]=g.slice(8,-1).toLowerCase())})(Object.create(null)),ed=r=>(r=r.toLowerCase(),a=>sy(a)===r),ly=r=>a=>typeof a===r,{isArray:qp}=Array,am=ly("undefined");function om(r){return r!==null&&!am(r)&&r.constructor!==null&&!am(r.constructor)&&fu(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const B6=ed("ArrayBuffer");function Oue(r){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(r):a=r&&r.buffer&&B6(r.buffer),a}const Pue=ly("string"),fu=ly("function"),V6=ly("number"),sm=r=>r!==null&&typeof r=="object",zue=r=>r===!0||r===!1,cy=r=>{if(sy(r)!=="object")return!1;const a=H2(r);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(D6 in r)&&!(oy in r)},Due=r=>{if(!sm(r)||om(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},Bue=ed("Date"),Vue=ed("File"),Fue=ed("Blob"),jue=ed("FileList"),Uue=r=>sm(r)&&fu(r.pipe),que=r=>{let a;return r&&(typeof FormData=="function"&&r instanceof FormData||fu(r.append)&&((a=sy(r))==="formdata"||a==="object"&&fu(r.toString)&&r.toString()==="[object FormData]"))},Wue=ed("URLSearchParams"),[Gue,Hue,Xue,Jue]=["ReadableStream","Request","Response","Headers"].map(ed),Kue=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lm(r,a,{allOwnKeys:g=!1}={}){if(r===null||typeof r>"u")return;let B,K;if(typeof r!="object"&&(r=[r]),qp(r))for(B=0,K=r.length;B<K;B++)a.call(null,r[B],B,r);else{if(om(r))return;const C=g?Object.getOwnPropertyNames(r):Object.keys(r),b=C.length;let t;for(B=0;B<b;B++)t=C[B],a.call(null,r[t],t,r)}}function F6(r,a){if(om(r))return null;a=a.toLowerCase();const g=Object.keys(r);let B=g.length,K;for(;B-- >0;)if(K=g[B],a===K.toLowerCase())return K;return null}const Yh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,j6=r=>!am(r)&&r!==Yh;function X2(){const{caseless:r}=j6(this)&&this||{},a={},g=(B,K)=>{const C=r&&F6(a,K)||K;cy(a[C])&&cy(B)?a[C]=X2(a[C],B):cy(B)?a[C]=X2({},B):qp(B)?a[C]=B.slice():a[C]=B};for(let B=0,K=arguments.length;B<K;B++)arguments[B]&&lm(arguments[B],g);return a}const Zue=(r,a,g,{allOwnKeys:B}={})=>(lm(a,(K,C)=>{g&&fu(K)?r[C]=z6(K,g):r[C]=K},{allOwnKeys:B}),r),Yue=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Que=(r,a,g,B)=>{r.prototype=Object.create(a.prototype,B),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:a.prototype}),g&&Object.assign(r.prototype,g)},$ue=(r,a,g,B)=>{let K,C,b;const t={};if(a=a||{},r==null)return a;do{for(K=Object.getOwnPropertyNames(r),C=K.length;C-- >0;)b=K[C],(!B||B(b,r,a))&&!t[b]&&(a[b]=r[b],t[b]=!0);r=g!==!1&&H2(r)}while(r&&(!g||g(r,a))&&r!==Object.prototype);return a},ede=(r,a,g)=>{r=String(r),(g===void 0||g>r.length)&&(g=r.length),g-=a.length;const B=r.indexOf(a,g);return B!==-1&&B===g},tde=r=>{if(!r)return null;if(qp(r))return r;let a=r.length;if(!V6(a))return null;const g=new Array(a);for(;a-- >0;)g[a]=r[a];return g},rde=(r=>a=>r&&a instanceof r)(typeof Uint8Array<"u"&&H2(Uint8Array)),nde=(r,a)=>{const B=(r&&r[oy]).call(r);let K;for(;(K=B.next())&&!K.done;){const C=K.value;a.call(r,C[0],C[1])}},ide=(r,a)=>{let g;const B=[];for(;(g=r.exec(a))!==null;)B.push(g);return B},ade=ed("HTMLFormElement"),ode=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(g,B,K){return B.toUpperCase()+K}),U6=(({hasOwnProperty:r})=>(a,g)=>r.call(a,g))(Object.prototype),sde=ed("RegExp"),q6=(r,a)=>{const g=Object.getOwnPropertyDescriptors(r),B={};lm(g,(K,C)=>{let b;(b=a(K,C,r))!==!1&&(B[C]=b||K)}),Object.defineProperties(r,B)},lde=r=>{q6(r,(a,g)=>{if(fu(r)&&["arguments","caller","callee"].indexOf(g)!==-1)return!1;const B=r[g];if(fu(B)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+g+"'")})}})},cde=(r,a)=>{const g={},B=K=>{K.forEach(C=>{g[C]=!0})};return qp(r)?B(r):B(String(r).split(a)),g},ude=()=>{},dde=(r,a)=>r!=null&&Number.isFinite(r=+r)?r:a;function hde(r){return!!(r&&fu(r.append)&&r[D6]==="FormData"&&r[oy])}const pde=r=>{const a=new Array(10),g=(B,K)=>{if(sm(B)){if(a.indexOf(B)>=0)return;if(om(B))return B;if(!("toJSON"in B)){a[K]=B;const C=qp(B)?[]:{};return lm(B,(b,t)=>{const v=g(b,K+1);!am(v)&&(C[t]=v)}),a[K]=void 0,C}}return B};return g(r,0)},fde=ed("AsyncFunction"),mde=r=>r&&(sm(r)||fu(r))&&fu(r.then)&&fu(r.catch),W6=((r,a)=>r?setImmediate:a?((g,B)=>(Yh.addEventListener("message",({source:K,data:C})=>{K===Yh&&C===g&&B.length&&B.shift()()},!1),K=>{B.push(K),Yh.postMessage(g,"*")}))(`axios@${Math.random()}`,[]):g=>setTimeout(g))(typeof setImmediate=="function",fu(Yh.postMessage)),gde=typeof queueMicrotask<"u"?queueMicrotask.bind(Yh):typeof process<"u"&&process.nextTick||W6,Hn={isArray:qp,isArrayBuffer:B6,isBuffer:om,isFormData:que,isArrayBufferView:Oue,isString:Pue,isNumber:V6,isBoolean:zue,isObject:sm,isPlainObject:cy,isEmptyObject:Due,isReadableStream:Gue,isRequest:Hue,isResponse:Xue,isHeaders:Jue,isUndefined:am,isDate:Bue,isFile:Vue,isBlob:Fue,isRegExp:sde,isFunction:fu,isStream:Uue,isURLSearchParams:Wue,isTypedArray:rde,isFileList:jue,forEach:lm,merge:X2,extend:Zue,trim:Kue,stripBOM:Yue,inherits:Que,toFlatObject:$ue,kindOf:sy,kindOfTest:ed,endsWith:ede,toArray:tde,forEachEntry:nde,matchAll:ide,isHTMLForm:ade,hasOwnProperty:U6,hasOwnProp:U6,reduceDescriptors:q6,freezeMethods:lde,toObjectSet:cde,toCamelCase:ode,noop:ude,toFiniteNumber:dde,findKey:F6,global:Yh,isContextDefined:j6,isSpecCompliantForm:hde,toJSONObject:pde,isAsyncFn:fde,isThenable:mde,setImmediate:W6,asap:gde,isIterable:r=>r!=null&&fu(r[oy])};function va(r,a,g,B,K){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",a&&(this.code=a),g&&(this.config=g),B&&(this.request=B),K&&(this.response=K,this.status=K.status?K.status:null)}Hn.inherits(va,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Hn.toJSONObject(this.config),code:this.code,status:this.status}}});const G6=va.prototype,H6={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{H6[r]={value:r}}),Object.defineProperties(va,H6),Object.defineProperty(G6,"isAxiosError",{value:!0}),va.from=(r,a,g,B,K,C)=>{const b=Object.create(G6);return Hn.toFlatObject(r,b,function(v){return v!==Error.prototype},t=>t!=="isAxiosError"),va.call(b,r.message,a,g,B,K),b.cause=r,b.name=r.name,C&&Object.assign(b,C),b};const yde=null;function J2(r){return Hn.isPlainObject(r)||Hn.isArray(r)}function X6(r){return Hn.endsWith(r,"[]")?r.slice(0,-2):r}function J6(r,a,g){return r?r.concat(a).map(function(K,C){return K=X6(K),!g&&C?"["+K+"]":K}).join(g?".":""):a}function vde(r){return Hn.isArray(r)&&!r.some(J2)}const xde=Hn.toFlatObject(Hn,{},null,function(a){return/^is[A-Z]/.test(a)});function uy(r,a,g){if(!Hn.isObject(r))throw new TypeError("target must be an object");a=a||new FormData,g=Hn.toFlatObject(g,{metaTokens:!0,dots:!1,indexes:!1},!1,function(n,i){return!Hn.isUndefined(i[n])});const B=g.metaTokens,K=g.visitor||e,C=g.dots,b=g.indexes,v=(g.Blob||typeof Blob<"u"&&Blob)&&Hn.isSpecCompliantForm(a);if(!Hn.isFunction(K))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(Hn.isDate(h))return h.toISOString();if(Hn.isBoolean(h))return h.toString();if(!v&&Hn.isBlob(h))throw new va("Blob is not supported. Use a Buffer instead.");return Hn.isArrayBuffer(h)||Hn.isTypedArray(h)?v&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function e(h,n,i){let d=h;if(h&&!i&&typeof h=="object"){if(Hn.endsWith(n,"{}"))n=B?n:n.slice(0,-2),h=JSON.stringify(h);else if(Hn.isArray(h)&&vde(h)||(Hn.isFileList(h)||Hn.endsWith(n,"[]"))&&(d=Hn.toArray(h)))return n=X6(n),d.forEach(function(c,f){!(Hn.isUndefined(c)||c===null)&&a.append(b===!0?J6([n],f,C):b===null?n:n+"[]",u(c))}),!1}return J2(h)?!0:(a.append(J6(i,n,C),u(h)),!1)}const w=[],y=Object.assign(xde,{defaultVisitor:e,convertValue:u,isVisitable:J2});function x(h,n){if(!Hn.isUndefined(h)){if(w.indexOf(h)!==-1)throw Error("Circular reference detected in "+n.join("."));w.push(h),Hn.forEach(h,function(d,s){(!(Hn.isUndefined(d)||d===null)&&K.call(a,d,Hn.isString(s)?s.trim():s,n,y))===!0&&x(d,n?n.concat(s):[s])}),w.pop()}}if(!Hn.isObject(r))throw new TypeError("data must be an object");return x(r),a}function K6(r){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(B){return a[B]})}function K2(r,a){this._pairs=[],r&&uy(r,this,a)}const Z6=K2.prototype;Z6.append=function(a,g){this._pairs.push([a,g])},Z6.toString=function(a){const g=a?function(B){return a.call(this,B,K6)}:K6;return this._pairs.map(function(K){return g(K[0])+"="+g(K[1])},"").join("&")};function bde(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y6(r,a,g){if(!a)return r;const B=g&&g.encode||bde;Hn.isFunction(g)&&(g={serialize:g});const K=g&&g.serialize;let C;if(K?C=K(a,g):C=Hn.isURLSearchParams(a)?a.toString():new K2(a,g).toString(B),C){const b=r.indexOf("#");b!==-1&&(r=r.slice(0,b)),r+=(r.indexOf("?")===-1?"?":"&")+C}return r}class Q6{constructor(){this.handlers=[]}use(a,g,B){return this.handlers.push({fulfilled:a,rejected:g,synchronous:B?B.synchronous:!1,runWhen:B?B.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){Hn.forEach(this.handlers,function(B){B!==null&&a(B)})}}const $6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_de={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:K2,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Z2=typeof window<"u"&&typeof document<"u",Y2=typeof navigator=="object"&&navigator||void 0,wde=Z2&&(!Y2||["ReactNative","NativeScript","NS"].indexOf(Y2.product)<0),Tde=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kde=Z2&&window.location.href||"http://localhost",Nc={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Z2,hasStandardBrowserEnv:wde,hasStandardBrowserWebWorkerEnv:Tde,navigator:Y2,origin:kde},Symbol.toStringTag,{value:"Module"})),..._de};function Sde(r,a){return uy(r,new Nc.classes.URLSearchParams,{visitor:function(g,B,K,C){return Nc.isNode&&Hn.isBuffer(g)?(this.append(B,g.toString("base64")),!1):C.defaultVisitor.apply(this,arguments)},...a})}function Ede(r){return Hn.matchAll(/\w+|\[(\w*)]/g,r).map(a=>a[0]==="[]"?"":a[1]||a[0])}function Ade(r){const a={},g=Object.keys(r);let B;const K=g.length;let C;for(B=0;B<K;B++)C=g[B],a[C]=r[C];return a}function eT(r){function a(g,B,K,C){let b=g[C++];if(b==="__proto__")return!0;const t=Number.isFinite(+b),v=C>=g.length;return b=!b&&Hn.isArray(K)?K.length:b,v?(Hn.hasOwnProp(K,b)?K[b]=[K[b],B]:K[b]=B,!t):((!K[b]||!Hn.isObject(K[b]))&&(K[b]=[]),a(g,B,K[b],C)&&Hn.isArray(K[b])&&(K[b]=Ade(K[b])),!t)}if(Hn.isFormData(r)&&Hn.isFunction(r.entries)){const g={};return Hn.forEachEntry(r,(B,K)=>{a(Ede(B),K,g,0)}),g}return null}function Cde(r,a,g){if(Hn.isString(r))try{return(a||JSON.parse)(r),Hn.trim(r)}catch(B){if(B.name!=="SyntaxError")throw B}return(g||JSON.stringify)(r)}const cm={transitional:$6,adapter:["xhr","http","fetch"],transformRequest:[function(a,g){const B=g.getContentType()||"",K=B.indexOf("application/json")>-1,C=Hn.isObject(a);if(C&&Hn.isHTMLForm(a)&&(a=new FormData(a)),Hn.isFormData(a))return K?JSON.stringify(eT(a)):a;if(Hn.isArrayBuffer(a)||Hn.isBuffer(a)||Hn.isStream(a)||Hn.isFile(a)||Hn.isBlob(a)||Hn.isReadableStream(a))return a;if(Hn.isArrayBufferView(a))return a.buffer;if(Hn.isURLSearchParams(a))return g.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let t;if(C){if(B.indexOf("application/x-www-form-urlencoded")>-1)return Sde(a,this.formSerializer).toString();if((t=Hn.isFileList(a))||B.indexOf("multipart/form-data")>-1){const v=this.env&&this.env.FormData;return uy(t?{"files[]":a}:a,v&&new v,this.formSerializer)}}return C||K?(g.setContentType("application/json",!1),Cde(a)):a}],transformResponse:[function(a){const g=this.transitional||cm.transitional,B=g&&g.forcedJSONParsing,K=this.responseType==="json";if(Hn.isResponse(a)||Hn.isReadableStream(a))return a;if(a&&Hn.isString(a)&&(B&&!this.responseType||K)){const b=!(g&&g.silentJSONParsing)&&K;try{return JSON.parse(a)}catch(t){if(b)throw t.name==="SyntaxError"?va.from(t,va.ERR_BAD_RESPONSE,this,null,this.response):t}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Nc.classes.FormData,Blob:Nc.classes.Blob},validateStatus:function(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hn.forEach(["delete","get","head","post","put","patch"],r=>{cm.headers[r]={}});const Mde=Hn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Lde=r=>{const a={};let g,B,K;return r&&r.split(`
4081
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),B}static addGrid(a,g={}){if(!a)return null;let B=a;if(B.gridstack){const K=B.gridstack;return g&&(K.opts={...K.opts,...g}),g.children!==void 0&&K.load(g.children),K}return(!a.classList.contains("grid-stack")||Wi.addRemoveCB)&&(Wi.addRemoveCB?B=Wi.addRemoveCB(a,g,!0,!0):B=zn.createDiv(["grid-stack",g.class],a)),Wi.init(g,B)}static registerEngine(a){Wi.engineClass=a}get placeholder(){if(!this._placeholder){this._placeholder=zn.createDiv([this.opts.placeholderClass,Cu.itemClass,this.opts.itemClass]);const a=zn.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(a.textContent=this.opts.placeholderText)}return this._placeholder}constructor(a,g={}){var B;this.el=a,this.opts=g,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},a.gridstack=this,this.opts=g=g||{},a.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),g.row&&(g.minRow=g.maxRow=g.row,delete g.row);const K=zn.toNumber(a.getAttribute("gs-row"));g.column==="auto"&&delete g.column,g.alwaysShowResizeHandle!==void 0&&(g._alwaysShowResizeHandle=g.alwaysShowResizeHandle);const C=g.columnOpts;if(C){const e=C.breakpoints;!C.columnWidth&&!(e!=null&&e.length)?delete g.columnOpts:(C.columnMax=C.columnMax||12,(e==null?void 0:e.length)>1&&e.sort((w,y)=>(y.w||0)-(w.w||0)))}const b={...zn.cloneDeep(Cu),column:zn.toNumber(a.getAttribute("gs-column"))||Cu.column,minRow:K||zn.toNumber(a.getAttribute("gs-min-row"))||Cu.minRow,maxRow:K||zn.toNumber(a.getAttribute("gs-max-row"))||Cu.maxRow,staticGrid:zn.toBool(a.getAttribute("gs-static"))||Cu.staticGrid,sizeToContent:zn.toBool(a.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(g.handleClass?"."+g.handleClass:g.handle?g.handle:"")||Cu.draggable.handle},removableOptions:{accept:g.itemClass||Cu.removableOptions.accept,decline:Cu.removableOptions.decline}};a.getAttribute("gs-animate")&&(b.animate=zn.toBool(a.getAttribute("gs-animate"))),g=zn.defaults(g,b),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(g),g.rtl==="auto"&&(g.rtl=a.style.direction==="rtl"),g.rtl&&this.el.classList.add("grid-stack-rtl");const t=this.el.closest("."+Cu.itemClass),v=t==null?void 0:t.gridstackNode;if(v&&(v.subGrid=this,this.parentGridNode=v,this.el.classList.add("grid-stack-nested"),v.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=g.cellHeight==="auto",this._isAutoCellHeight||g.cellHeight==="initial")this.cellHeight(void 0);else{typeof g.cellHeight=="number"&&g.cellHeightUnit&&g.cellHeightUnit!==Cu.cellHeightUnit&&(g.cellHeight=g.cellHeight+g.cellHeightUnit,delete g.cellHeightUnit);const e=g.cellHeight;delete g.cellHeight,this.cellHeight(e)}g.alwaysShowResizeHandle==="mobile"&&(g.alwaysShowResizeHandle=$u),this._setStaticClass();const u=g.engineClass||Wi.engineClass||Bd;if(this.engine=new u({column:this.getColumn(),float:g.float,maxRow:g.maxRow,onChange:e=>{e.forEach(w=>{const y=w.el;y&&(w._removeDOM?(y&&y.remove(),delete w._removeDOM):this._writePosAttr(y,w))}),this._updateContainerHeight()}}),g.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(e=>this._prepareElement(e)),delete this.engine._loading,this.batchUpdate(!1)),g.children){const e=g.children;delete g.children,e.length&&this.load(e)}this.setAnimation(),g.subGridDynamic&&!Zi.pauseDrag&&(Zi.pauseDrag=!0),((B=g.draggable)==null?void 0:B.pause)!==void 0&&(Zi.pauseDrag=g.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(a=this.opts){this.el.classList.add("gs-"+a.column),typeof a.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/a.column}%`)}addWidget(a){if(!a)return;if(typeof a=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(a.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(a);let g,B=a;if(B.grid=this,B.el?g=B.el:Wi.addRemoveCB?g=Wi.addRemoveCB(this.el,a,!0,!1):g=this.createWidgetDivs(B),!g)return;if(B=g.gridstackNode,B&&g.parentElement===this.el&&this.engine.nodes.find(C=>C._id===B._id))return g;const K=this._readAttr(g);return zn.defaults(a,K),this.engine.prepareNode(a),this.el.appendChild(g),this.makeWidget(g,a),g}createWidgetDivs(a){const g=zn.createDiv(["grid-stack-item",this.opts.itemClass]),B=zn.createDiv(["grid-stack-item-content"],g);return zn.lazyLoad(a)?a.visibleObservable||(a.visibleObservable=new IntersectionObserver(([K])=>{var C,b;K.isIntersecting&&((C=a.visibleObservable)==null||C.disconnect(),delete a.visibleObservable,Wi.renderCB(B,a),(b=a.grid)==null||b.prepareDragDrop(a.el))}),window.setTimeout(()=>{var K;return(K=a.visibleObservable)==null?void 0:K.observe(g)})):Wi.renderCB(B,a),g}makeSubGrid(a,g,B,K=!0){var C,b,t;let v=a.gridstackNode;if(v||(v=this.makeWidget(a).gridstackNode),(C=v.subGrid)!=null&&C.el)return v.subGrid;let u,e=this;for(;e&&!u;)u=(b=e.opts)==null?void 0:b.subGridOpts,e=(t=e.parentGridNode)==null?void 0:t.grid;g=zn.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...u||{},...g||v.subGridOpts||{}}),v.subGridOpts=g;let w;g.column==="auto"&&(w=!0,g.column=Math.max(v.w||1,(B==null?void 0:B.w)||1),delete g.columnOpts);let y=v.el.querySelector(".grid-stack-item-content"),x,h;if(K&&(this._removeDD(v.el),h={...v,x:0,y:0},zn.removeInternalForSave(h),delete h.subGridOpts,v.content&&(h.content=v.content,delete v.content),Wi.addRemoveCB?x=Wi.addRemoveCB(this.el,h,!0,!1):(x=zn.createDiv(["grid-stack-item"]),x.appendChild(y),y=zn.createDiv(["grid-stack-item-content"],v.el)),this.prepareDragDrop(v.el)),B){const i=w?g.column:v.w,d=v.h+B.h,s=v.el.style;s.transition="none",this.update(v.el,{w:i,h:d}),setTimeout(()=>s.transition=null)}const n=v.subGrid=Wi.addGrid(y,g);return B!=null&&B._moving&&(n._isTemp=!0),w&&(n._autoColumn=!0),K&&n.makeWidget(x,h),B&&(B._moving?window.setTimeout(()=>zn.simulateMouseEvent(B._event,"mouseenter",n.el),0):n.makeWidget(v.el,v)),this.resizeToContentCheck(!1,v),n}removeAsSubGrid(a){var g;const B=(g=this.parentGridNode)==null?void 0:g.grid;B&&(B.batchUpdate(),B.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(K=>{K.x+=this.parentGridNode.x,K.y+=this.parentGridNode.y,B.makeWidget(K.el,K)}),B.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,a&&window.setTimeout(()=>zn.simulateMouseEvent(a._event,"mouseenter",B.el),0))}save(a=!0,g=!1,B=Wi.saveCB,K){const C=this.engine.save(a,B,K);if(C.forEach(b=>{var t;if(a&&b.el&&!b.subGrid&&!B){const v=b.el.querySelector(".grid-stack-item-content");b.content=v==null?void 0:v.innerHTML,b.content||delete b.content}else if(!a&&!B&&delete b.content,(t=b.subGrid)!=null&&t.el){const v=b.w||b.subGrid.getColumn(),u=b.subGrid.save(a,g,B,v);b.subGridOpts=g?u:{children:u},delete b.subGrid}delete b.el}),g){const b=zn.cloneDeep(this.opts);b.marginBottom===b.marginTop&&b.marginRight===b.marginLeft&&b.marginTop===b.marginRight&&(b.margin=b.marginTop,delete b.marginTop,delete b.marginRight,delete b.marginBottom,delete b.marginLeft),b.rtl===(this.el.style.direction==="rtl")&&(b.rtl="auto"),this._isAutoCellHeight&&(b.cellHeight="auto"),this._autoColumn&&(b.column="auto");const t=b._alwaysShowResizeHandle;return delete b._alwaysShowResizeHandle,t!==void 0?b.alwaysShowResizeHandle=t:delete b.alwaysShowResizeHandle,zn.removeInternalAndSame(b,Cu),b.children=C,b}return C}load(a,g=Wi.addRemoveCB||!0){a=zn.cloneDeep(a);const B=this.getColumn();a.forEach(e=>{e.w=e.w||e.minW||1,e.h=e.h||e.minH||1}),a=zn.sort(a),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let K=0;a.forEach(e=>{K=Math.max(K,(e.x||0)+e.w)}),K>this.engine.defaultColumn&&(this.engine.defaultColumn=K),K>B&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=a,this.engine.columnChanged(K,B,this.responseLayout),a=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(a,K,!0));const C=Wi.addRemoveCB;typeof g=="function"&&(Wi.addRemoveCB=g);const b=[];this.batchUpdate();const t=!this.engine.nodes.length,v=t&&this.opts.animate;v&&this.setAnimation(!1),!t&&g&&[...this.engine.nodes].forEach(e=>{e.id&&(zn.find(a,e.id)||(Wi.addRemoveCB&&Wi.addRemoveCB(this.el,e,!1,!1),b.push(e),this.removeWidget(e.el,!0,!1)))}),this.engine._loading=!0;const u=[];return this.engine.nodes=this.engine.nodes.filter(e=>zn.find(a,e.id)?(u.push(e),!1):!0),a.forEach(e=>{var w;const y=zn.find(u,e.id);if(y){if(zn.shouldSizeToContent(y)&&(e.h=y.h),this.engine.nodeBoundFix(e),(e.autoPosition||e.x===void 0||e.y===void 0)&&(e.w=e.w||y.w,e.h=e.h||y.h,this.engine.findEmptyPosition(e)),this.engine.nodes.push(y),zn.samePos(y,e)&&this.engine.nodes.length>1&&(this.moveNode(y,{...e,forceCollide:!0}),zn.copyPos(e,y)),this.update(y.el,e),(w=e.subGridOpts)!=null&&w.children){const x=y.el.querySelector(".grid-stack");x&&x.gridstack&&x.gridstack.load(e.subGridOpts.children)}}else g&&this.addWidget(e)}),delete this.engine._loading,this.engine.removedNodes=b,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,C?Wi.addRemoveCB=C:delete Wi.addRemoveCB,v&&this.setAnimation(!0,!0),this}batchUpdate(a=!0){return this.engine.batchUpdate(a),a||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(a=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!a||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const g=this.el.querySelector("."+this.opts.itemClass);if(g){const K=zn.toNumber(g.getAttribute("gs-h"))||1;return Math.round(g.offsetHeight/K)}const B=parseInt(this.el.getAttribute("gs-current-row"));return B?Math.round(this.el.getBoundingClientRect().height/B):this.opts.cellHeight}cellHeight(a){if(a!==void 0&&this._isAutoCellHeight!==(a==="auto")&&(this._isAutoCellHeight=a==="auto",this._updateResizeEvent()),(a==="initial"||a==="auto")&&(a=void 0),a===void 0){const B=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;a=this.cellWidth()+B}const g=zn.parseHeight(a);return this.opts.cellHeightUnit===g.unit&&this.opts.cellHeight===g.h?this:(this.opts.cellHeightUnit=g.unit,this.opts.cellHeight=g.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(a=!1){var g;return a&&(g=this.opts.columnOpts)!=null&&g.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var a,g;const B=this.opts.columnOpts;if(!B||!B.columnWidth&&!((a=B.breakpoints)!=null&&a.length))return!1;const K=this.getColumn();let C=K;const b=this._widthOrContainer(!0);if(B.columnWidth)C=Math.min(Math.round(b/B.columnWidth)||1,B.columnMax);else{C=B.columnMax;let t=0;for(;t<B.breakpoints.length&&b<=B.breakpoints[t].w;)C=B.breakpoints[t++].c||K}if(C!==K){const t=(g=B.breakpoints)==null?void 0:g.find(v=>v.c===C);return this.column(C,(t==null?void 0:t.layout)||B.layout),!0}return!1}compact(a="compact",g=!0){return this.engine.compact(a,g),this._triggerChangeEvent(),this}column(a,g="moveScale"){if(!a||a<1||this.opts.column===a)return this;const B=this.getColumn();return this.opts.column=a,this.engine?(this.engine.column=a,this.el.classList.remove("gs-"+B),this._updateColumnVar(),this.engine.columnChanged(B,a,g),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=g,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(a=>a.matches("."+this.opts.itemClass)&&!a.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(a=!0){var g;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),a?this.el.parentNode.removeChild(this.el):(this.removeAll(a),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,(g=this._placeholder)==null||delete g.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(a){return this.opts.float!==a&&(this.opts.float=this.engine.float=a,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(a,g=!1){const B=this.el.getBoundingClientRect();let K;g?K={top:B.top+document.documentElement.scrollTop,left:B.left}:K={top:this.el.offsetTop,left:this.el.offsetLeft};const C=a.left-K.left,b=a.top-K.top,t=B.width/this.getColumn(),v=B.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(C/t),y:Math.floor(b/v)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(a,g,B,K){return this.engine.isAreaEmpty(a,g,B,K)}makeWidget(a,g){const B=Wi.getElement(a);if(!B||B.gridstackNode)return B;B.parentElement||this.el.appendChild(B),this._prepareElement(B,!0,g);const K=B.gridstackNode;this._updateContainerHeight(),K.subGridOpts&&this.makeSubGrid(B,K.subGridOpts,void 0,!1);let C;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(C=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),C&&delete this._ignoreLayoutsNodeChange,B}on(a,g){return a.indexOf(" ")!==-1?(a.split(" ").forEach(B=>this.on(B,g)),this):(a==="change"||a==="added"||a==="removed"||a==="enable"||a==="disable"?(a==="enable"||a==="disable"?this._gsEventHandler[a]=B=>g(B):this._gsEventHandler[a]=B=>{B.detail&&g(B,B.detail)},this.el.addEventListener(a,this._gsEventHandler[a])):a==="drag"||a==="dragstart"||a==="dragstop"||a==="resizestart"||a==="resize"||a==="resizestop"||a==="dropped"||a==="resizecontent"?this._gsEventHandler[a]=g:console.error("GridStack.on("+a+") event not supported"),this)}off(a){return a.indexOf(" ")!==-1?(a.split(" ").forEach(g=>this.off(g)),this):((a==="change"||a==="added"||a==="removed"||a==="enable"||a==="disable")&&this._gsEventHandler[a]&&this.el.removeEventListener(a,this._gsEventHandler[a]),delete this._gsEventHandler[a],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(a=>this.off(a)),this}removeWidget(a,g=!0,B=!0){return a?(Wi.getElements(a).forEach(K=>{if(K.parentElement&&K.parentElement!==this.el)return;let C=K.gridstackNode;C||(C=this.engine.nodes.find(b=>K===b.el)),C&&(g&&Wi.addRemoveCB&&Wi.addRemoveCB(this.el,C,!1,!1),delete K.gridstackNode,this._removeDD(K),this.engine.removeNode(C,g,B),g&&K.parentElement&&K.remove())}),B&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(a=!0,g=!0){return this.engine.nodes.forEach(B=>{a&&Wi.addRemoveCB&&Wi.addRemoveCB(this.el,B,!1,!1),delete B.el.gridstackNode,this.opts.staticGrid||this._removeDD(B.el)}),this.engine.removeAll(a,g),g&&this._triggerRemoveEvent(),this}setAnimation(a=this.opts.animate,g){return g?setTimeout(()=>{this.opts&&this.setAnimation(a)}):a?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=a,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(a,g=!0,B=!0){return!!this.opts.staticGrid===a?this:(a?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(K=>{this.prepareDragDrop(K.el),K.subGrid&&B&&K.subGrid.setStatic(a,g,B)}),g&&this._setStaticClass(),this)}updateOptions(a){var g;const B=this.opts;return a===B?this:(a.acceptWidgets!==void 0&&(B.acceptWidgets=a.acceptWidgets,this._setupAcceptWidget()),a.animate!==void 0&&this.setAnimation(a.animate),a.cellHeight&&this.cellHeight(a.cellHeight),a.class!==void 0&&a.class!==B.class&&(B.class&&this.el.classList.remove(B.class),a.class&&this.el.classList.add(a.class)),a.columnOpts?(this.opts.columnOpts=a.columnOpts,this.checkDynamicColumn()):a.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof a.column=="number"&&this.column(a.column),a.margin!==void 0&&this.margin(a.margin),a.staticGrid!==void 0&&this.setStatic(a.staticGrid),a.disableDrag!==void 0&&!a.staticGrid&&this.enableMove(!a.disableDrag),a.disableResize!==void 0&&!a.staticGrid&&this.enableResize(!a.disableResize),a.float!==void 0&&this.float(a.float),a.row!==void 0?(B.minRow=B.maxRow=B.row=a.row,this._updateContainerHeight()):(a.minRow!==void 0&&(B.minRow=a.minRow,this._updateContainerHeight()),a.maxRow!==void 0&&(B.maxRow=a.maxRow)),(g=a.children)!=null&&g.length&&this.load(a.children),this)}update(a,g){return Wi.getElements(a).forEach(B=>{var K;const C=B==null?void 0:B.gridstackNode;if(!C)return;const b={...zn.copyPos({},C),...zn.cloneDeep(g)};this.engine.nodeBoundFix(b),delete b.autoPosition;const t=["x","y","w","h"];let v;if(t.some(w=>b[w]!==void 0&&b[w]!==C[w])&&(v={},t.forEach(w=>{v[w]=b[w]!==void 0?b[w]:C[w],delete b[w]})),!v&&(b.minW||b.minH||b.maxW||b.maxH)&&(v={}),b.content!==void 0){const w=B.querySelector(".grid-stack-item-content");w&&w.textContent!==b.content&&(C.content=b.content,Wi.renderCB(w,b),(K=C.subGrid)!=null&&K.el&&(w.appendChild(C.subGrid.el),C.subGrid._updateContainerHeight())),delete b.content}let u=!1,e=!1;for(const w in b)w[0]!=="_"&&C[w]!==b[w]&&(C[w]=b[w],u=!0,e=e||!this.opts.staticGrid&&(w==="noResize"||w==="noMove"||w==="locked"));if(zn.sanitizeMinMax(C),v){const w=v.w!==void 0&&v.w!==C.w;this.moveNode(C,v),w&&C.subGrid?C.subGrid.onResize(this.hasAnimationCSS()?C.w:void 0):this.resizeToContentCheck(w,C),delete C._orig}(v||u)&&this._writeAttr(B,C),e&&this.prepareDragDrop(C.el),Wi.updateCB&&Wi.updateCB(C)}),this}moveNode(a,g){const B=a._updating;B||this.engine.cleanNodes().beginUpdate(a),this.engine.moveNode(a,g),this._updateContainerHeight(),B||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(a){var g,B;if(!a||(a.classList.remove("size-to-content-max"),!a.clientHeight))return;const K=a.gridstackNode;if(!K)return;const C=K.grid;if(!C||a.parentElement!==C.el)return;const b=C.getCellHeight(!0);if(!b)return;let t=K.h?K.h*b:a.clientHeight,v;if(K.resizeToContentParent&&(v=a.querySelector(K.resizeToContentParent)),v||(v=a.querySelector(Wi.resizeToContentParent)),!v)return;const u=a.clientHeight-v.clientHeight,e=K.h?K.h*b-u:v.clientHeight;let w;if(K.subGrid){w=K.subGrid.getRow()*K.subGrid.getCellHeight(!0);const h=K.subGrid.el.getBoundingClientRect(),n=a.getBoundingClientRect();w+=h.top-n.top}else{if((B=(g=K.subGridOpts)==null?void 0:g.children)!=null&&B.length)return;{const h=v.firstElementChild;if(!h){console.error(`Error: GridStack.resizeToContent() widget id:${K.id} '${Wi.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}w=h.getBoundingClientRect().height||e}}if(e===w)return;t+=w-e;let y=Math.ceil(t/b);const x=Number.isInteger(K.sizeToContent)?K.sizeToContent:0;x&&y>x&&(y=x,a.classList.add("size-to-content-max")),K.minH&&y<K.minH?y=K.minH:K.maxH&&y>K.maxH&&(y=K.maxH),y!==K.h&&(C._ignoreLayoutsNodeChange=!0,C.moveNode(K,{h:y}),delete C._ignoreLayoutsNodeChange)}resizeToContentCBCheck(a){Wi.resizeToContentCB?Wi.resizeToContentCB(a):this.resizeToContent(a)}rotate(a,g){return Wi.getElements(a).forEach(B=>{const K=B.gridstackNode;if(!zn.canBeRotated(K))return;const C={w:K.h,h:K.w,minH:K.minW,minW:K.minH,maxH:K.maxW,maxW:K.maxH};if(g){const t=g.left>0?Math.floor(g.left/this.cellWidth()):0,v=g.top>0?Math.floor(g.top/this.opts.cellHeight):0;C.x=K.x+t-(K.h-(v+1)),C.y=K.y+v-t}Object.keys(C).forEach(t=>{C[t]===void 0&&delete C[t]});const b=K._orig;this.update(B,C),K._orig=b}),this}margin(a){if(!(typeof a=="string"&&a.split(" ").length>1)){const g=zn.parseHeight(a);if(this.opts.marginUnit===g.unit&&this.opts.margin===g.h)return}return this.opts.margin=a,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(a){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const g=arguments;let B=0,K={x:g[B++],y:g[B++],w:g[B++],h:g[B++],autoPosition:g[B++]};return this.willItFit(K)}return this.engine.willItFit(a)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const a=this.engine.getDirtyNodes(!0);return a&&a.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(a),this._triggerEvent("change",a)),this.engine.saveInitial(),this}_triggerAddEvent(){var a;if(this.engine.batchMode)return this;if((a=this.engine.addedNodes)!=null&&a.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(B=>{delete B._dirty});const g=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",g)}return this}_triggerRemoveEvent(){var a;if(this.engine.batchMode)return this;if((a=this.engine.removedNodes)!=null&&a.length){const g=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",g)}return this}_triggerEvent(a,g){const B=g?new CustomEvent(a,{bubbles:!1,detail:g}):new Event(a);let K=this;for(;K.parentGridNode;)K=K.parentGridNode.grid;return K.el.dispatchEvent(B),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const a=this.parentGridNode;let g=this.getRow()+this._extraDragRow;const B=this.opts.cellHeight,K=this.opts.cellHeightUnit;if(!B)return this;if(!a&&!this.opts.minRow){const C=zn.parseHeight(getComputedStyle(this.el).minHeight);if(C.h>0&&C.unit===K){const b=Math.floor(C.h/B);g<b&&(g=b)}}return this.el.setAttribute("gs-current-row",String(g)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),g&&(this.el.style[a?"minHeight":"height"]=g*B+K),a&&zn.shouldSizeToContent(a)&&a.grid.resizeToContentCBCheck(a.el),this}_prepareElement(a,g=!1,B){B=B||this._readAttr(a),a.gridstackNode=B,B.el=a,B.grid=this,B=this.engine.addNode(B,g),this._writeAttr(a,B),a.classList.add(Cu.itemClass,this.opts.itemClass);const K=zn.shouldSizeToContent(B);return K?a.classList.add("size-to-content"):a.classList.remove("size-to-content"),K&&this.resizeToContentCheck(!1,B),zn.lazyLoad(B)||this.prepareDragDrop(B.el),this}_writePosAttr(a,g){return(!g._moving&&!g._resizing||this._placeholder===a)&&(a.style.top=g.y?g.y===1?"var(--gs-cell-height)":`calc(${g.y} * var(--gs-cell-height))`:null,a.style.left=g.x?g.x===1?"var(--gs-column-width)":`calc(${g.x} * var(--gs-column-width))`:null,a.style.width=g.w>1?`calc(${g.w} * var(--gs-column-width))`:null,a.style.height=g.h>1?`calc(${g.h} * var(--gs-cell-height))`:null),g.x>0?a.setAttribute("gs-x",String(g.x)):a.removeAttribute("gs-x"),g.y>0?a.setAttribute("gs-y",String(g.y)):a.removeAttribute("gs-y"),g.w>1?a.setAttribute("gs-w",String(g.w)):a.removeAttribute("gs-w"),g.h>1?a.setAttribute("gs-h",String(g.h)):a.removeAttribute("gs-h"),this}_writeAttr(a,g){if(!g)return this;this._writePosAttr(a,g);const B={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const K in B)g[K]?a.setAttribute(B[K],String(g[K])):a.removeAttribute(B[K]);return this}_readAttr(a,g=!0){const B={};B.x=zn.toNumber(a.getAttribute("gs-x")),B.y=zn.toNumber(a.getAttribute("gs-y")),B.w=zn.toNumber(a.getAttribute("gs-w")),B.h=zn.toNumber(a.getAttribute("gs-h")),B.autoPosition=zn.toBool(a.getAttribute("gs-auto-position")),B.noResize=zn.toBool(a.getAttribute("gs-no-resize")),B.noMove=zn.toBool(a.getAttribute("gs-no-move")),B.locked=zn.toBool(a.getAttribute("gs-locked"));const K=a.getAttribute("gs-size-to-content");K&&(K==="true"||K==="false"?B.sizeToContent=zn.toBool(K):B.sizeToContent=parseInt(K,10)),B.id=a.getAttribute("gs-id"),B.maxW=zn.toNumber(a.getAttribute("gs-max-w")),B.minW=zn.toNumber(a.getAttribute("gs-min-w")),B.maxH=zn.toNumber(a.getAttribute("gs-max-h")),B.minH=zn.toNumber(a.getAttribute("gs-min-h")),g&&(B.w===1&&a.removeAttribute("gs-w"),B.h===1&&a.removeAttribute("gs-h"),B.maxW&&a.removeAttribute("gs-max-w"),B.minW&&a.removeAttribute("gs-min-w"),B.maxH&&a.removeAttribute("gs-max-h"),B.minH&&a.removeAttribute("gs-min-h"));for(const C in B){if(!B.hasOwnProperty(C))return;!B[C]&&B[C]!==0&&C!=="sizeToContent"&&delete B[C]}return B}_setStaticClass(){const a=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...a),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...a),this.el.removeAttribute("gs-static")),this}onResize(a=(g=>(g=this.el)==null?void 0:g.clientWidth)()){if(!a||this.prevWidth===a)return;this.prevWidth=a,this.batchUpdate();let g=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),g=!0):g=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(B=>{B.subGrid&&B.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(g),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(a=!1,g=void 0){if(this.engine){if(a&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,g),this.animationDelay);if(g)zn.shouldSizeToContent(g)&&this.resizeToContentCBCheck(g.el);else if(this.engine.nodes.some(B=>zn.shouldSizeToContent(B))){const B=[...this.engine.nodes];this.batchUpdate(),B.forEach(K=>{zn.shouldSizeToContent(K)&&this.resizeToContentCBCheck(K.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,g?[g]:this.engine.nodes)}}_updateResizeEvent(a=!1){const g=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(B=>B.sizeToContent));return!a&&g&&!this.resizeObserver?(this._sizeThrottle=zn.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(a||!g)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(a=".grid-stack-item"){return zn.getElement(a)}static getElements(a=".grid-stack-item"){return zn.getElements(a)}static getGridElement(a){return Wi.getElement(a)}static getGridElements(a){return zn.getElements(a)}_initMargin(){let a,g=0,B=[];typeof this.opts.margin=="string"&&(B=this.opts.margin.split(" ")),B.length===2?(this.opts.marginTop=this.opts.marginBottom=B[0],this.opts.marginLeft=this.opts.marginRight=B[1]):B.length===4?(this.opts.marginTop=B[0],this.opts.marginRight=B[1],this.opts.marginBottom=B[2],this.opts.marginLeft=B[3]):(a=zn.parseHeight(this.opts.margin),this.opts.marginUnit=a.unit,g=this.opts.margin=a.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(C=>{this.opts[C]===void 0?this.opts[C]=g:(a=zn.parseHeight(this.opts[C]),this.opts[C]=a.h,delete this.opts.margin)}),this.opts.marginUnit=a.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const K=this.el.style;return K.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),K.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),K.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),K.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Uc}static setupDragIn(a,g,B,K=document){(g==null?void 0:g.pause)!==void 0&&(Zi.pauseDrag=g.pause),g={appendTo:"body",helper:"clone",...g||{}},(typeof a=="string"?zn.getElements(a,K):a).forEach((C,b)=>{Uc.isDraggable(C)||Uc.dragIn(C,g),B!=null&&B[b]&&(C.gridstackNode=B[b])})}movable(a,g){return this.opts.staticGrid?this:(Wi.getElements(a).forEach(B=>{const K=B.gridstackNode;K&&(g?delete K.noMove:K.noMove=!0,this.prepareDragDrop(K.el))}),this)}resizable(a,g){return this.opts.staticGrid?this:(Wi.getElements(a).forEach(B=>{const K=B.gridstackNode;K&&(g?delete K.noResize:K.noResize=!0,this.prepareDragDrop(K.el))}),this)}disable(a=!0){if(!this.opts.staticGrid)return this.enableMove(!1,a),this.enableResize(!1,a),this._triggerEvent("disable"),this}enable(a=!0){if(!this.opts.staticGrid)return this.enableMove(!0,a),this.enableResize(!0,a),this._triggerEvent("enable"),this}enableMove(a,g=!0){return this.opts.staticGrid?this:(a?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(B=>{this.prepareDragDrop(B.el),B.subGrid&&g&&B.subGrid.enableMove(a,g)}),this)}enableResize(a,g=!0){return this.opts.staticGrid?this:(a?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(B=>{this.prepareDragDrop(B.el),B.subGrid&&g&&B.subGrid.enableResize(a,g)}),this)}cancelDrag(){var a;const g=(a=this._placeholder)==null?void 0:a.gridstackNode;g&&(g._isExternal?(g._isAboutToRemove=!0,this.engine.removeNode(g)):g._isAboutToRemove&&Wi._itemRemoving(g.el,!1),this.engine.restoreInitial())}_removeDD(a){return Uc.draggable(a,"destroy").resizable(a,"destroy"),a.gridstackNode&&delete a.gridstackNode._initDD,delete a.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Uc.droppable(this.el,"destroy"),this;let a,g;const B=(K,C,b)=>{var t;b=b||C;const v=b.gridstackNode;if(!v)return;if(!((t=v.grid)!=null&&t.el)){b.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const x=b.getBoundingClientRect();b.style.left=x.x+(this.dragTransform.xScale-1)*(K.clientX-x.x)/this.dragTransform.xScale+"px",b.style.top=x.y+(this.dragTransform.yScale-1)*(K.clientY-x.y)/this.dragTransform.yScale+"px",b.style.transformOrigin="0px 0px"}let{top:u,left:e}=b.getBoundingClientRect();const w=this.el.getBoundingClientRect();e-=w.left,u-=w.top;const y={position:{top:u*this.dragTransform.xScale,left:e*this.dragTransform.yScale}};if(v._temporaryRemoved){if(v.x=Math.max(0,Math.round(e/g)),v.y=Math.max(0,Math.round(u/a)),delete v.autoPosition,this.engine.nodeBoundFix(v),!this.engine.willItFit(v)){if(v.autoPosition=!0,!this.engine.willItFit(v)){Uc.off(C,"drag");return}v._willFitPos&&(zn.copyPos(v,v._willFitPos),delete v._willFitPos)}this._onStartMoving(b,K,y,v,g,a)}else this._dragOrResize(b,K,y,v,g,a)};return Uc.droppable(this.el,{accept:K=>{const C=K.gridstackNode||this._readAttr(K,!1);if((C==null?void 0:C.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let b=!0;if(typeof this.opts.acceptWidgets=="function")b=this.opts.acceptWidgets(K);else{const t=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;b=K.matches(t)}if(b&&C&&this.opts.maxRow){const t={w:C.w,h:C.h,minW:C.minW,minH:C.minH};b=this.engine.willItFit(t)}return b}}).on(this.el,"dropover",(K,C,b)=>{let t=(b==null?void 0:b.gridstackNode)||C.gridstackNode;if((t==null?void 0:t.grid)===this&&!t._temporaryRemoved)return!1;if(t!=null&&t._sidebarOrig&&(t.w=t._sidebarOrig.w,t.h=t._sidebarOrig.h),t!=null&&t.grid&&t.grid!==this&&!t._temporaryRemoved&&t.grid._leave(C,b),b=b||C,g=this.cellWidth(),a=this.getCellHeight(!0),!t){const e=b.getAttribute("data-gs-widget")||b.getAttribute("gridstacknode");if(e){try{t=JSON.parse(e)}catch{console.error("Gridstack dropover: Bad JSON format: ",e)}b.removeAttribute("data-gs-widget"),b.removeAttribute("gridstacknode")}t||(t=this._readAttr(b)),t._sidebarOrig={w:t.w,h:t.h}}t.grid||(t.el||(t={...t}),t._isExternal=!0,b.gridstackNode=t);const v=t.w||Math.round(b.offsetWidth/g)||1,u=t.h||Math.round(b.offsetHeight/a)||1;return t.grid&&t.grid!==this?(C._gridstackNodeOrig||(C._gridstackNodeOrig=t),C.gridstackNode=t={...t,w:v,h:u,grid:this},delete t.x,delete t.y,this.engine.cleanupNode(t).nodeBoundFix(t),t._initDD=t._isExternal=t._temporaryRemoved=!0):(t.w=v,t.h=u,t._temporaryRemoved=!0),Wi._itemRemoving(t.el,!1),Uc.on(C,"drag",B),B(K,C,b),!1}).on(this.el,"dropout",(K,C,b)=>{const t=(b==null?void 0:b.gridstackNode)||C.gridstackNode;return t&&(!t.grid||t.grid===this)&&(this._leave(C,b),this._isTemp&&this.removeAsSubGrid(t)),!1}).on(this.el,"drop",(K,C,b)=>{var t,v,u;const e=(b==null?void 0:b.gridstackNode)||C.gridstackNode;if((e==null?void 0:e.grid)===this&&!e._isExternal)return!1;const w=!!this.placeholder.parentElement,y=C!==b;this.placeholder.remove(),delete this.placeholder.gridstackNode,w&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const x=C._gridstackNodeOrig;if(delete C._gridstackNodeOrig,w&&x!=null&&x.grid&&x.grid!==this){const n=x.grid;n.engine.removeNodeFromLayoutCache(x),n.engine.removedNodes.push(x),n._triggerRemoveEvent()._triggerChangeEvent(),n.parentGridNode&&!n.engine.nodes.length&&n.opts.subGridDynamic&&n.removeAsSubGrid()}if(!e||(w&&(this.engine.cleanupNode(e),e.grid=this),(t=e.grid)==null||delete t._isTemp,Uc.off(C,"drag"),b!==C?(b.remove(),C=b):C.remove(),this._removeDD(C),!w))return!1;const h=(u=(v=e.subGrid)==null?void 0:v.el)==null?void 0:u.gridstack;return zn.copyPos(e,this._readAttr(this.placeholder)),zn.removePositioningStyles(C),y&&(e.content||e.subGridOpts||Wi.addRemoveCB)?(delete e.el,C=this.addWidget(e)):(this._prepareElement(C,!0,e),this.el.appendChild(C),this.resizeToContentCheck(!1,e),h&&(h.parentGridNode=e),this._updateContainerHeight()),this.engine.addedNodes.push(e),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...K,type:"dropped"},x&&x.grid?x:void 0,e),!1}),this}static _itemRemoving(a,g){if(!a)return;const B=a?a.gridstackNode:void 0;!(B!=null&&B.grid)||a.classList.contains(B.grid.opts.removableOptions.decline)||(g?B._isAboutToRemove=!0:delete B._isAboutToRemove,g?a.classList.add("grid-stack-item-removing"):a.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const a=document.querySelector(this.opts.removable);return a?(!this.opts.staticGrid&&!Uc.isDroppable(a)&&Uc.droppable(a,this.opts.removableOptions).on(a,"dropover",(g,B)=>Wi._itemRemoving(B,!0)).on(a,"dropout",(g,B)=>Wi._itemRemoving(B,!1)),this):this}prepareDragDrop(a,g=!1){const B=a==null?void 0:a.gridstackNode;if(!B)return;const K=B.noMove||this.opts.disableDrag,C=B.noResize||this.opts.disableResize,b=this.opts.staticGrid||K&&C;if((g||b)&&(B._initDD&&(this._removeDD(a),delete B._initDD),b&&a.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!g))return this;if(!B._initDD){let t,v;const u=(y,x)=>{this.triggerEvent(y,y.target),t=this.cellWidth(),v=this.getCellHeight(!0),this._onStartMoving(a,y,x,B,t,v)},e=(y,x)=>{this._dragOrResize(a,y,x,B,t,v)},w=y=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete B._moving,delete B._resizing,delete B._event,delete B._lastTried;const x=B.w!==B._orig.w,h=y.target;if(!(!h.gridstackNode||h.gridstackNode.grid!==this)){if(B.el=h,B._isAboutToRemove){const n=a.gridstackNode.grid;n._gsEventHandler[y.type]&&n._gsEventHandler[y.type](y,h),n.engine.nodes.push(B),n.removeWidget(a,!0,!0)}else zn.removePositioningStyles(h),B._temporaryRemoved?(this._writePosAttr(h,B),this.engine.addNode(B)):this._writePosAttr(h,B),this.triggerEvent(y,h);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),y.type==="resizestop"&&(Number.isInteger(B.sizeToContent)&&(B.sizeToContent=B.h),this.resizeToContentCheck(x,B))}};Uc.draggable(a,{start:u,stop:w,drag:e}).resizable(a,{start:u,stop:w,resize:e}),B._initDD=!0}return Uc.draggable(a,K?"disable":"enable").resizable(a,C?"disable":"enable"),this}_onStartMoving(a,g,B,K,C,b){var t;if(this.engine.cleanNodes().beginUpdate(K),this._writePosAttr(this.placeholder,K),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=K,(t=K.grid)!=null&&t.el)this.dragTransform=zn.getValuesFromTransformedElement(a);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const v=this.placeholder.closest(".grid-stack");this.dragTransform=zn.getValuesFromTransformedElement(v)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(K.el=this.placeholder,K._lastUiPosition=B.position,K._prevYPix=B.position.top,K._moving=g.type==="dragstart",K._resizing=g.type==="resizestart",delete K._lastTried,g.type==="dropover"&&K._temporaryRemoved&&(this.engine.addNode(K),K._moving=!0),this.engine.cacheRects(C,b,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),g.type==="resizestart"){const v=this.getColumn()-K.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-K.y;Uc.resizable(a,"option","minWidth",C*Math.min(K.minW||1,v)).resizable(a,"option","minHeight",b*Math.min(K.minH||1,u)).resizable(a,"option","maxWidth",C*Math.min(K.maxW||Number.MAX_SAFE_INTEGER,v)).resizable(a,"option","maxWidthMoveLeft",C*Math.min(K.maxW||Number.MAX_SAFE_INTEGER,K.x+K.w)).resizable(a,"option","maxHeight",b*Math.min(K.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(a,"option","maxHeightMoveUp",b*Math.min(K.maxH||Number.MAX_SAFE_INTEGER,K.y+K.h))}}_dragOrResize(a,g,B,K,C,b){const t={...K._orig};let v,u=this.opts.marginLeft,e=this.opts.marginRight,w=this.opts.marginTop,y=this.opts.marginBottom;const x=Math.round(b*.1),h=Math.round(C*.1);if(u=Math.min(u,h),e=Math.min(e,h),w=Math.min(w,x),y=Math.min(y,x),g.type==="drag"){if(K._temporaryRemoved)return;const i=B.position.top-K._prevYPix;K._prevYPix=B.position.top,this.opts.draggable.scroll!==!1&&zn.updateScrollPosition(a,B.position,i);const d=B.position.left+(B.position.left>K._lastUiPosition.left?-e:u),s=B.position.top+(B.position.top>K._lastUiPosition.top?-y:w);t.x=Math.round(d/C),t.y=Math.round(s/b);const c=this._extraDragRow;if(this.engine.collide(K,t)){const f=this.getRow();let m=Math.max(0,t.y+K.h-f);this.opts.maxRow&&f+m>this.opts.maxRow&&(m=Math.max(0,this.opts.maxRow-f)),this._extraDragRow=m}else this._extraDragRow=0;if(this._extraDragRow!==c&&this._updateContainerHeight(),K.x===t.x&&K.y===t.y)return}else if(g.type==="resize"){if(t.x<0||(zn.updateScrollResize(g,a,b),t.w=Math.round((B.size.width-u)/C),t.h=Math.round((B.size.height-w)/b),K.w===t.w&&K.h===t.h)||K._lastTried&&K._lastTried.w===t.w&&K._lastTried.h===t.h)return;const i=B.position.left+u,d=B.position.top+w;t.x=Math.round(i/C),t.y=Math.round(d/b),v=!0}K._event=g,K._lastTried=t;const n={x:B.position.left+u,y:B.position.top+w,w:(B.size?B.size.width:K.w*C)-u-e,h:(B.size?B.size.height:K.h*b)-w-y};if(this.engine.moveNodeCheck(K,{...t,cellWidth:C,cellHeight:b,rect:n,resizing:v})){K._lastUiPosition=B.position,this.engine.cacheRects(C,b,w,e,y,u),delete K._skipDown,v&&K.subGrid&&K.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const i=g.target;K._sidebarOrig||this._writePosAttr(i,K),this.triggerEvent(g,i)}}triggerEvent(a,g){let B=this;for(;B.parentGridNode;)B=B.parentGridNode.grid;B._gsEventHandler[a.type]&&B._gsEventHandler[a.type](a,g)}_leave(a,g){g=g||a;const B=g.gridstackNode;if(!B||(g.style.transform=g.style.transformOrigin=null,Uc.off(a,"drag"),B._temporaryRemoved))return;B._temporaryRemoved=!0,this.engine.removeNode(B),B.el=B._isExternal&&g?g:a;const K=B._sidebarOrig;B._isExternal&&this.engine.cleanupNode(B),B._sidebarOrig=K,this.opts.removable===!0&&Wi._itemRemoving(a,!0),a._gridstackNodeOrig?(a.gridstackNode=a._gridstackNodeOrig,delete a._gridstackNodeOrig):B._isExternal&&this.engine.restoreInitial()}commit(){return Rse(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Wi.renderCB=(r,a)=>{r&&a!=null&&a.content&&(r.textContent=a.content)},Wi.resizeToContentParent=".grid-stack-item-content",Wi.Utils=zn,Wi.Engine=Bd,Wi.GDRev="12.3.2";const Dse=[{id:1,name:"Goles",isSelected:!1},{id:2,name:"Pases acertados",isSelected:!1},{id:23,name:"Tiros de Esquina",isSelected:!1},{id:3,name:"Balones recuperados en disputa",isSelected:!1},{id:4,name:"Asistencias",isSelected:!1},{id:5,name:"Participaciones en gol",isSelected:!1},{id:6,name:"Tiros a gol",isSelected:!1},{id:7,name:"Tiros a gol que llegaron a la portería",isSelected:!1},{id:8,name:"Cabeceos en área rival",isSelected:!1},{id:9,name:"Cabeceos en área propia",isSelected:!1},{id:10,name:"Centros",isSelected:!1},{id:11,name:"Centros acertados",isSelected:!1},{id:12,name:"1vs1 exitosos ofensivos",isSelected:!1},{id:13,name:"1vs1 exitosos ofensivos que terminaron en gol",isSelected:!1},{id:14,name:"1vs1 defensivos exitoso",isSelected:!1},{id:15,name:"Rechaces",isSelected:!1},{id:16,name:"Balones ganados en área propia",isSelected:!1},{id:17,name:"Balones ganados en área rival",isSelected:!1},{id:18,name:"Faltas cometidas",isSelected:!1},{id:19,name:"Faltas recibidas",isSelected:!1},{id:20,name:"Tarjetas amarillas",isSelected:!1},{id:21,name:"Tarjetas rojas",isSelected:!1},{id:22,name:"Atajadas",isSelected:!1},{id:24,name:"Oportunidades de gol",isSelected:!1},{id:25,name:"Balones recuperados en cancha rival",isSelected:!1}],Vd=r=>Dse.find(a=>a.id===r),Fd=new Map([[9,{id:9,analysisTypes:new Map([["2-20",{analysisType:"successfulPasses",name:"Pases acertados",title:"Mapeo de pases acertados",titleShort:"Pases acertados"}],["3-21",{analysisType:"unsuccessfulPasses",name:"Pases no acertados",title:"Mapeo de pases no acertados",titleShort:"Pases no acertados"}],["222-223-224-225",{analysisType:"recoveredBalls",name:"Balones recuperados",title:"Mapeo de balones recuperados",titleShort:"Balones recuperados"}],["226-227-228-229",{analysisType:"lostBalls",name:"Balones perdidos",title:"Mapeo de balones perdidos",titleShort:"Balones perdidos"}]])}],[1,{general:"General",offensive:"Ofensivo",defensive:"Defensivo",possession:"Posesión",stoppedBall:"Balón parado",penalties:"Infracción"}]]);class Up{constructor(a,g=[],B,K=null,C=!1,b=!1,t=null,v=null){ud(this,"id",""),ud(this,"childViews",[]),ud(this,"viewId",0),ud(this,"dynamicFilters",null),ud(this,"componentSpecificFilters",new Map),ud(this,"isPostMatch",!1),ud(this,"isTemplateMode",!1),ud(this,"filtresJSON",null),ud(this,"token",null),ud(this,"_isUpdating",!1),this.id=a,this.viewId=B,this.childViews=g,this.dynamicFilters=K,this.isPostMatch=C,this.isTemplateMode=b,this.filtresJSON=t,this.token=v,this.componentSpecificFilters=new Map}resetClass(){this.childViews.forEach(a=>{a.view.filterAndViewsContainer=new Up(this.id,[a],this.viewId,this.dynamicFilters,this.isPostMatch,this.isTemplateMode,this.filtresJSON,this.token)})}hasEventTypeId(a,g){return!a||!Array.isArray(a)?!1:a.some(B=>B&&B.event_type_id===g)}hasCategoryId(a,g){return!a||!Array.isArray(a)?!1:a.some(B=>B&&B.category_id===g)}getId(){return this.id}setViewId(a){this.viewId=a}setFiltersJSON(a){this.filtresJSON=a}setDynamicFilters(a,g=null){console.log("???????????????????????????????????????????????????????????? SET O UPDATE DYNAMIC FILTERS ????????????????????????????????????????????????????????????",a,g),g?this.componentSpecificFilters.set(g,[...a]):this.dynamicFilters=a}getComponentDynamicFilters(a){return a&&this.componentSpecificFilters.has(a)?this.componentSpecificFilters.get(a):this.dynamicFilters}getAllComponentFilters(){return this.componentSpecificFilters}debugComponentFilters(){this.componentSpecificFilters.forEach((a,g)=>{console.log(` Component ${g}:`,a)})}static debugAllComponentFilters(){document.querySelectorAll("[data-container-id]").forEach(a=>{a.getAttribute("data-container-id")})}clearAllComponentFilters(){this.componentSpecificFilters.clear()}getDynamicFilters(){return this.dynamicFilters}getHomeTeamViews(){return this.childViews.filter(a=>a.view.isHomeTeam)}getAwayTeamViews(){return this.childViews.filter(a=>!a.view.isHomeTeam)}addView(a,g=!1){var B,K,C,b,t,v,u,e,w,y;if(a.view.filterAndViewsContainer=this,Ai.emit("component-added-to-container",this),this.viewId===5&&a.view.componentProps&&!g&&(a.view.componentProps.preMatchType=this.dynamicFilters[0]!==3&&this.dynamicFilters[0]||1,a.view.filterMultiple={isHomeTeam:a.view.componentProps.preMatchType===1}),this.viewId===10&&a.view.componentProps&&!g&&(a.view.componentProps.isHomeTeamForAnalysis=this.dynamicFilters[0]!==3?this.dynamicFilters[0]===1:1),this.viewId===7&&a.view.componentProps&&!g){const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const n=h[0]===1?"offensive":"defensive",i=h[1]===1;a.view.componentProps.analysisType=n,a.view.componentProps.isHomeTeamForAnalysis=i,a.isHomeTeam=i,a.view.filterMultiple={isHomeTeam:i},Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:h})}if(this.viewId===1&&a.view.componentProps&&!g){const x=this.dynamicFilters[0]||[];if(x&&x.length>0){let h;if(Array.isArray(x)){const i=this.childViews.map(s=>{var c;return(c=s.view.componentProps)==null?void 0:c.type}).filter(s=>s!==void 0),d=x.filter(s=>!i.includes(s));d.length>0?h=d[0]:h=x[0]}else h=x;const n=Fd.get(this.viewId);a.view.componentProps.type=h,a.view.componentProps.default=!1,a.view.title=`Comparativa ${n[h]}`,a.view.filterMultiple={category:h}}}if(this.viewId===9&&a.view.componentProps&&!g){const x=this.dynamicFilters[0].map(d=>d.join("-"));let h="";const n=this.dynamicFilters[1],i=Fd.get(this.viewId);if(n===3){this.getHomeTeamViews().length===0&&this.getAwayTeamViews().length>0&&this.getAwayTeamViews().forEach(m=>{m.view.componentProps.isHomeTeamForAnalysis=!0,m.view.isHomeTeam=!0,m.view.filterMultiple&&(m.view.filterMultiple.isHomeTeam=!0)});let d=null;const s=this.getHomeTeamViews(),c=this.getAwayTeamViews();let f=!0;for(let m=0;m<x.length;m++){h=x[m],d=i.analysisTypes.get(x[m]);const T=s.find(S=>S.view.componentProps.analysisType===d.analysisType),E=c.find(S=>S.view.componentProps.analysisType===d.analysisType);if(!T||!E){f=!T;break}}f?this.childViews.length===0?(a.view.componentProps.analysisType=d.analysisType,a.view.componentProps.isHomeTeamForAnalysis=!0,a.view.title=d.title,a.view.titleShort=d.titleShort,a.view.isHomeTeam=!0,a.view.filterMultiple={isHomeTeam:a.view.isHomeTeam,categoryIds:h.split("-").map(m=>parseInt(m))}):this.childViews.reduce((m,T,E,S)=>{let L={analysisType:T.view.componentProps.analysisType,title:T.view.title,isHomeTeamForAnalysis:T.view.componentProps.isHomeTeamForAnalysis,isHomeTeam:T.view.isHomeTeam};return m&&(m.isHomeTeam&&!T.view.isHomeTeam?(T.view.componentProps.analysisType=d.analysisType,T.view.componentProps.isHomeTeamForAnalysis=!0,T.view.title=d.title,a.view.titleShort=d.titleShort,T.view.isHomeTeam=!0,T.view.filterMultiple={isHomeTeam:T.view.isHomeTeam,categoryIds:h.split("-").map(N=>parseInt(N))}):!m.isHomeTeam&&!T.view.isHomeTeam&&(T.view.componentProps.analysisType=m.analysisType,T.view.componentProps.isHomeTeamForAnalysis=m.isHomeTeamForAnalysis,T.view.title=m.title,T.view.titleShort=m.titleShort,T.view.isHomeTeam=m.isHomeTeam,T.view.filterMultiple={isHomeTeam:T.view.isHomeTeam,categoryIds:h.split("-").map(N=>parseInt(N))}),E===S.length-1&&(a.view.componentProps.analysisType=L.analysisType,a.view.componentProps.isHomeTeamForAnalysis=L.isHomeTeamForAnalysis,a.view.title=L.title,a.view.titleShort=L.titleShort,a.view.isHomeTeam=L.isHomeTeam,a.view.filterMultiple={isHomeTeam:a.view.isHomeTeam,categoryIds:h.split("-").map(N=>parseInt(N))})),L},null):(a.view.componentProps.analysisType=d.analysisType,a.view.componentProps.isHomeTeamForAnalysis=!1,a.view.title=d.title,a.view.titleShort=d.titleShort,a.view.isHomeTeam=!1,a.view.filterMultiple={isHomeTeam:a.view.isHomeTeam,categoryIds:h.split("-").map(m=>parseInt(m))})}else{const d=n===1,s=d?this.getHomeTeamViews():this.getAwayTeamViews();a.view.componentProps.isHomeTeamForAnalysis=d,a.view.isHomeTeam=d;for(let c=0;c<x.length;c++){const f=i.analysisTypes.get(x[c]);if(!s.find(m=>m.view.componentProps.analysisType===f.analysisType)){a.view.componentProps.analysisType=f.analysisType,a.view.title=f.title,a.view.titleShort=f.titleShort,a.view.filterMultiple={categoryIds:x[c].split("-").map(m=>parseInt(m)),isHomeTeam:a.view.isHomeTeam};break}}}}if(this.viewId===2&&!g&&a.view.componentProps){const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&(this.setDynamicFilters(this.dynamicFilters,a.view.id),console.log(`GscTopPlayer - initialized specific filters for component ${a.view.id} with default filters:`,this.dynamicFilters)),a.view.componentProps.game&&(a.view.componentProps.gameid=a.view.componentProps.game.id,a.view.componentProps.season=a.view.componentProps.game.season_id,a.view.componentProps.teamView=h[1]===2?a.view.componentProps.game.awayTeam.team_id:h[1]===1?a.view.componentProps.game.homeTeam.team_id:0);const n=this.dynamicFilters[0]||[];let i=null;if(Array.isArray(n)){if(n.length>0){const c=this.childViews.map(m=>{var T;const E=(T=m.view.componentProps)==null?void 0:T.categoryView;return E&&E.length>0?E[0].id:null}).filter(m=>m!==null),f=n.filter(m=>!c.includes(m));console.log("GSCtops addView (array mode) - existingCategories:",c),console.log("GSCtops addView (array mode) - categoriesWithoutComponent:",f),f.length>0?i=f[0]:console.log("GSCtops addView (array mode) - all categories already have components")}}else{const c=n;c&&(this.childViews.find(f=>{var m;const T=(m=f.view.componentProps)==null?void 0:m.categoryView;return T&&T.length>0&&T[0].id===c})?console.log("GSCtops addView (single mode) - component already exists, skipping creation"):i=c)}let d=null;if(i)try{d=Vd(i)}catch(c){console.warn("Error getting category by ID:",c)}const s=h&&h.length>1?h[1]:1;a.view.filterMultiple={categoryId:i,teamType:s},a.view.componentProps.categoryView=d?[{id:i,name:d.name}]:i?[{id:i,name:`Category ${i}`}]:[{id:0,name:"Category"}]}if(this.viewId===8&&a.view.componentProps&&!g&&a.view.game&&(a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0),a.view.componentProps.areInactiveVisible=this.dynamicFilters[0]||!1,a.view.componentProps.game=(B=a.view)==null?void 0:B.game,a.view.componentProps.teamSelected={teamId:(C=(K=a.view)==null?void 0:K.game)==null?void 0:C.home_team},a.view.componentProps.isDefault=!1,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:this.dynamicFilters})),this.viewId===6&&a.view.componentProps&&!g){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;console.log("6666666666666666666666666666666666666666666666666666666666666666666666666666666"),console.log("this.dynamicFilters",this.dynamicFilters),console.log("componentSpecificFilters",x),console.log("filtersToUse",h),!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const n=h&&h.length>0?h[0]:[];if(console.log("gamesToShow",n),n&&n.length>0){let i=0;for(const d of n)if(!this.childViews.find(s=>s.view.componentProps.gameNumber===d)){i=d;break}console.log("************************************************** newGameNumberToShow: ",i),i&&(console.log("2 ************************************************** newGameNumberToShow: entro",i),a.view.componentProps.gameNumber=i,a.view.filterMultiple={gameNumber:i})}console.log(" /////////---------------------------------------> ",a.view.filterMultiple),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:h})}if(this.viewId===3&&a.view.componentProps&&!g&&a.view.game){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const x=this.getComponentDynamicFilters(a.view.id),h=x||this.dynamicFilters;!x&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const n=h&&h.length>0?h[0]:!1;a.view.componentProps.desplegable=n,a.view.componentProps.key=n,a.view.componentProps.game=(b=a.view)==null?void 0:b.game,a.view.componentProps.defaultShields=!1,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:h})}if(this.viewId===4&&(console.log("TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE - TIMELINE TIMELINE"),console.log("*********************** *********************** this.token *********************** *********************** ",this.token),a.view.componentProps&&!g&&a.view.game)){if(a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0),this.isPostMatch){a.view.componentProps.key=!1,a.view.componentProps.isDefault=!1,a.view.componentProps.token=this.token,a.view.componentProps.gameId=(v=(t=a.view)==null?void 0:t.game)==null?void 0:v.game_id,a.view.componentProps.homeTeam=(e=(u=a.view)==null?void 0:u.game)==null?void 0:e.home_team,a.view.componentProps.awayTeam=(y=(w=a.view)==null?void 0:w.game)==null?void 0:y.visiting_team;const n=this.getComponentDynamicFilters(a.view.id),i=n||this.dynamicFilters;!n&&this.dynamicFilters&&this.dynamicFilters.length>0&&this.setDynamicFilters(this.dynamicFilters,a.view.id);const d=i&&i.length>0?i[0]:[],s=this.hasEventTypeId(d,1),c=this.hasCategoryId(d,8),f=this.hasCategoryId(d,9),m=this.hasEventTypeId(d,3);console.log("Timeline - Events check:",{goals:s,yellowCards:c,redCards:f,substitutions:m,selectedEvents:d,componentId:a.view.id,usingSpecificFilters:!!n}),a.view.componentProps.goals=s,a.view.componentProps.yellowCards=c,a.view.componentProps.redCards=f,a.view.componentProps.substitutions=m}const x=this.getComponentDynamicFilters(a.view.id)||this.dynamicFilters,h=x&&x.length>0?x[0]:[];a.view.componentProps.selectedEvents=h,a.view.componentProps.key=h.length>0,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:x})}this.childViews.push(a),Ai.emit("view-added"),console.log("this.childViews",this.childViews)}getHowManyViewsToAdd(a){if(this.viewId===5)return 1;if(this.viewId===6){const g=a[0];return g===2||g===3?g:1}if(this.viewId===4){const g=a&&a.length>0&&Array.isArray(a[0])&&a[0].length>0,B=this.childViews.length===0&&g;return console.log("Timeline getHowManyViewsToAdd:",{hasSelectedEvents:g,childViewsLength:this.childViews.length,shouldAdd:B,dynamicFilters:a}),g?1:0}if(this.viewId===9){const g=a[0],B=a[1];if(B===1||B===2){const K=B===1?this.getHomeTeamViews():this.getAwayTeamViews();return g.length-K.length}else return g*2-(this.getHomeTeamViews().length+this.getAwayTeamViews().length)}if(this.viewId===2){const g=a[0]||[],B=a[1]||1;if(console.log("GSCtops getHowManyViewsToAdd - categoriesIdsSelected:",g),console.log("GSCtops getHowManyViewsToAdd - teamType:",B),console.log("GSCtops getHowManyViewsToAdd - childViews.length:",this.childViews.length),!g||g.length===0)return 0;if(Array.isArray(g)){const K=this.childViews.map(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;return v&&v.length>0?v[0].id:null}).filter(b=>b!==null),C=g.filter(b=>!K.includes(b));return console.log("GSCtops getHowManyViewsToAdd (array mode) - existingCategories:",K),console.log("GSCtops getHowManyViewsToAdd (array mode) - categoriesWithoutComponent:",C),C.length}else{const K=g,C=this.childViews.find(b=>{var t,v;const u=(t=b.view.componentProps)==null?void 0:t.categoryView,e=((v=b.view.filterMultiple)==null?void 0:v.teamType)||1;return u&&u.length>0&&u[0].id===K&&e===B});return console.log("GSCtops getHowManyViewsToAdd (edit mode) - categoryId:",K),console.log("GSCtops getHowManyViewsToAdd (edit mode) - teamType:",B),console.log("GSCtops getHowManyViewsToAdd (edit mode) - existingComponent:",C),C?0:1}}if(this.viewId===1){const g=a[0]||[];if(console.log("GSCComparativeReports getHowManyViewsToAdd - selectedAnalysisTypes:",g),console.log("GSCComparativeReports getHowManyViewsToAdd - childViews.length:",this.childViews.length),!g||g.length===0)return 0;if(Array.isArray(g)){const B=this.childViews.map(C=>{var b;return(b=C.view.componentProps)==null?void 0:b.type}).filter(C=>C!==void 0),K=g.filter(C=>!B.includes(C));return console.log("GSCComparativeReports getHowManyViewsToAdd (array mode) - existingTypes:",B),console.log("GSCComparativeReports getHowManyViewsToAdd (array mode) - typesWithoutComponent:",K),K.length}else{const B=g,K=this.childViews.find(C=>{var b;return((b=C.view.componentProps)==null?void 0:b.type)===B});return console.log("GSCComparativeReports getHowManyViewsToAdd (edit mode) - analysisType:",B),console.log("GSCComparativeReports getHowManyViewsToAdd (edit mode) - existingComponent:",K),K?0:1}}return 0}getRequiresAddView(a){if(console.log("getRequiresAddView",this.viewId,a),this.viewId===5)return console.log("this.childViews:",this.childViews),a[0]===3?this.childViews.length<2:this.childViews.length===0;if(this.viewId===10)return a[0]===3?this.childViews.length<2:this.childViews.length===0;if(this.viewId===7)return a[1]===3?this.childViews.length<2:this.childViews.length===0;if(this.viewId===6){const g=a[0];return g?g.length>this.childViews.length:this.childViews.length===0}if(this.viewId===4){const g=a&&a.length>0&&Array.isArray(a[0])&&a[0].length>0,B=this.childViews.length===0&&g;return console.log("Timeline getRequiresAddView:",{hasSelectedEvents:g,childViewsLength:this.childViews.length,shouldAdd:B,dynamicFilters:a}),B}if(this.viewId===9)return this.getRequiresAddViewMultipleAndBothTeams(a);if(this.viewId===1){const g=a[0]||[];if(console.log("GSCComparativeReports getRequiresAddView - selectedAnalysisTypes:",g),console.log("GSCComparativeReports getRequiresAddView - childViews.length:",this.childViews.length),!g||g.length===0)return!1;if(Array.isArray(g)){const B=this.childViews.map(b=>{var t;return(t=b.view.componentProps)==null?void 0:t.type}).filter(b=>b!==void 0),K=g.filter(b=>!B.includes(b));console.log("GSCComparativeReports getRequiresAddView (array mode) - existingTypes:",B),console.log("GSCComparativeReports getRequiresAddView (array mode) - typesWithoutComponent:",K);const C=K.length>0;return console.log("GSCComparativeReports getRequiresAddView (array mode) - shouldAdd:",C),C}else{const B=g,K=this.childViews.find(b=>{var t;return((t=b.view.componentProps)==null?void 0:t.type)===B});console.log("GSCComparativeReports getRequiresAddView (edit mode) - analysisType:",B),console.log("GSCComparativeReports getRequiresAddView (edit mode) - existingComponent:",K);const C=!K;return console.log("GSCComparativeReports getRequiresAddView (edit mode) - shouldAdd:",C),C}}if(this.viewId===2){const g=a[0]||[];if(console.log("2222222222222222222222222222222222222222222222222222222222"),console.log(""),Array.isArray(g)){if(g.length>0){const B=this.childViews.map(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;return v&&v.length>0?v[0].id:null}).filter(b=>b!==null),K=g.filter(b=>!B.includes(b));console.log("GSCtops getRequiresAddView (array mode) - existingCategories:",B),console.log("GSCtops getRequiresAddView (array mode) - categoriesWithoutComponent:",K);const C=K.length>0;return console.log("GSCtops getRequiresAddView (array mode) - shouldAdd:",C),C}return!1}else{const B=g,K=a[1]||1;if(B){const C=this.childViews.find(t=>{var v,u;const e=(v=t.view.componentProps)==null?void 0:v.categoryView,w=((u=t.view.filterMultiple)==null?void 0:u.teamType)||1;return e&&e.length>0&&e[0].id===B&&w===K});console.log("GSCtops getRequiresAddView (single mode) - categoryId:",B,"teamType:",K),console.log("GSCtops getRequiresAddView (single mode) - existingComponent:",C);const b=!C;return console.log("GSCtops getRequiresAddView (single mode) - shouldAdd:",b),b}return!1}}return this.viewId===8||this.viewId===3?this.childViews.length===0:!1}getRequiresAddViewMultipleAndBothTeams(a){console.log("*******************************************************"),console.log("dynamicFilters",a);const g=this.childViews.filter(v=>v.view.isHomeTeam),B=this.childViews.filter(v=>!v.view.isHomeTeam),K=a[0].length,C=a[1],b=K*(C===1||C===2?1:2),t=C===3?g.length+B.length:g.length||B.length;return b>t}getRequiresLessViews(a){if(this.viewId===5)return a[0]!==3&&this.childViews.length>1;if(this.viewId===6){const g=a[0];return g===2||g===3}return this.viewId,!1}updateSummary({dynamicFilters:a}){const g=this.childViews[0],B=document.querySelector(`[gs-id="${g.view.id}"]`),K=g.grid;if(g&&B&&K){const C=a[0],b=`min_column${C?"_2":""}`,t=`min_row${C?"_2":""}`,v=`max_column${C?"_2":""}`,u=`max_row${C?"_2":""}`,e=`colspan${C?"_2":""}`,w=`rowspan${C?"_2":""}`,y=g.view.coreView[e],x=g.view.coreView[w],h=g.view.coreView[b],n=g.view.coreView[t],i=g.view.coreView[v],d=g.view.coreView[u];g.view.w=y,g.view.h=x,g.view.maxWidth=i,g.view.maxHeight=d,g.view.minWidth=h,g.view.minHeight=n,B.setAttribute("gs-w",y),B.setAttribute("gs-h",x),B.setAttribute("gs-max-w",i),B.setAttribute("gs-max-h",d),B.setAttribute("gs-min-w",h),B.setAttribute("gs-min-h",n),console.log("childView.view",g.view),K.update(B,{h:x,w:y,"gs-max-h":d,"gs-max-w":i,"gs-min-h":n,"gs-min-w":h})}}updateDynamicFilters(a,g=null){if(this._isUpdating){console.log("Skipping updateDynamicFilters due to update in progress");return}this._isUpdating=!0,g?(this.componentSpecificFilters.set(g,[...a]),console.log(`Updated specific filters for component ${g}:`,a)):this.dynamicFilters=a,Ai.emit("component-added-to-container",this);try{if(this.viewId===5){const B=a[0]||1;if(B<3)if(this.childViews.length===1){const K=this.childViews[0];K.view.componentProps&&(K.view.componentProps.preMatchType=B,K.view.filterMultiple={isHomeTeam:K.view.componentProps.preMatchType===1})}else{const K=this.childViews.pop(),C=K.grid,b=K.page,t=document.querySelector(`[gs-id="${K.view.id}"]`);if(C&&t&&(C.removeWidget(t),b)){const u=b.items.findIndex(e=>e.id===K.view.id);u!==-1&&b.items.splice(u,1)}const v=this.childViews[0];v.view.componentProps&&(v.view.componentProps.preMatchType=B,v.view.filterMultiple={isHomeTeam:v.view.componentProps.preMatchType})}else this.childViews.forEach((K,C)=>{K.view.componentProps.preMatchType=C+1,K.view.filterMultiple={isHomeTeam:K.view.componentProps.preMatchType}})}if(this.viewId===10){const B=a[0]||1;if(B<3)if(this.childViews.length===1){const K=this.childViews[0];K.view.componentProps&&(K.view.componentProps.isHomeTeamForAnalysis=B===1)}else{const K=this.childViews.pop(),C=K.grid,b=K.page,t=document.querySelector(`[gs-id="${K.view.id}"]`);if(C&&t&&(C.removeWidget(t),b)){const u=b.items.findIndex(e=>e.id===K.view.id);u!==-1&&b.items.splice(u,1)}const v=this.childViews[0];v.view.componentProps&&(v.view.componentProps.isHomeTeamForAnalysis=B===1)}else this.childViews.forEach((K,C)=>{K.view.componentProps.isHomeTeamForAnalysis=C%2===0})}if(this.viewId===7){const B=a[1];if(B===3)this.childViews.forEach((K,C)=>{K.view.componentProps.isHomeTeamForAnalysis=C%2===0,K.view.isHomeTeam=C%2===0,K.view.componentProps.analysisType=this.dynamicFilters[0]===1?"offensive":"defensive",K.view.filterMultiple={isHomeTeam:K.view.isHomeTeam}});else{const K=B===1;if(this.childViews.length>0){const C=this.childViews[0];C.view.componentProps.isHomeTeamForAnalysis=K,C.view.isHomeTeam=K,C.view.componentProps.analysisType=this.dynamicFilters[0]===1?"offensive":"defensive",C.view.filterMultiple={isHomeTeam:K},this.childViews.length>1&&this.removeChildView(this.childViews[1])}}}if(this.viewId===9){const B=a[0],K=a[1];if(console.log("---------------->>>> CANCHA DE ZONAS: ",B,K),K===3){if(this.childViews.length>B.length){const C=B.map(b=>{const t=b.join("-");return Fd.get(this.viewId).analysisTypes.get(t).analysisType});this.childViews.reduce((b,t)=>(C.includes(t.view.componentProps.analysisType)||b.push(t.view.componentProps.analysisType),b),[]).forEach(b=>{const t=this.childViews.findIndex(v=>v.view.componentProps.analysisType===b);if(t!==-1){const v=this.childViews[t];this.removeChildView(v)}})}}else{const C=K===1,b=this.getHomeTeamViews(),t=this.getAwayTeamViews();if(console.log("---------------->>>> CUANDO CANCHA DE ZONAS NO ELEJIO AMBOS: ",C),console.log("---------------->>>> homeTeamViews: ",b),console.log("---------------->>>> awayTeamViews: ",t),C&&b.length===0)console.log("---------------->>>> escenario 1: "),t.forEach(v=>{v.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}});else if(!C&&t.length===0)console.log("---------------->>>> escenario 2: "),b.forEach(v=>{v.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}});else if(b.length===t.length)console.log("---------------->>>> escenario 3: "),C||b.forEach(v=>{v.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}}),(C?t:b).forEach(v=>{this.removeChildView(v)});else{console.log("---------------->>>> escenario 4: ");const v=C?this.getHomeTeamViews():this.getAwayTeamViews();if(v.length>B.length){console.log("---------------->>>> escenario 4: eliminando vistas excedentes");const u=B.map(e=>{const w=e.join("-");return Fd.get(this.viewId).analysisTypes.get(w).analysisType});v.forEach(e=>{u.includes(e.view.componentProps.analysisType)?e.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}:this.removeChildView(e)})}else v.forEach(u=>{u.view.filterMultiple={categoryIds:B[0],isHomeTeam:C}})}}}if(this.viewId===2){const B=a[0]||[];if(Array.isArray(B)){const K=this.childViews.map(C=>{var b,t;const v=(b=C.view.componentProps)==null?void 0:b.categoryView,u=((t=C.view.filterMultiple)==null?void 0:t.teamType)||1,e=v&&v.length>0?v[0].id:null;return e?{categoryId:e,teamType:u,viewId:C.view.id}:null}).filter(C=>C!==null);if(g){const C=this.childViews.find(b=>b.view.id===g);if(C){const b=a[1]||1,t=B[0];if(t){let v=null;try{v=Vd(t)}catch(u){console.warn("Error getting category by ID:",u)}C.view.filterMultiple={categoryId:t,teamType:b},C.view.componentProps.game&&(b===1?C.view.componentProps.teamView=C.view.componentProps.game.homeTeam.team_id:b===2?C.view.componentProps.teamView=C.view.componentProps.game.awayTeam.team_id:C.view.componentProps.teamView=0),C.view.componentProps.categoryView=v?[{id:t,name:v.name}]:[{id:t,name:`Category ${t}`}]}}}if(!g){const C=a[1]||1;this.childViews.forEach(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;if(v&&v.length>0){const u=v[0].id;B.includes(u)&&(b.view.filterMultiple={categoryId:u,teamType:C})}})}if(K.map(C=>C.categoryId).filter(C=>!B.includes(C)).forEach(C=>{this.childViews.filter(b=>{var t;const v=(t=b.view.componentProps)==null?void 0:t.categoryView;return v&&v.length>0&&v[0].id===C}).forEach(b=>{this.removeChildView(b),Ai.emit("component-removed",{viewId:b.view.id,categoryId:C})})}),g){const C=B[0];if(C){const b=this.childViews.find(t=>t.view.id===g);if(b){let t=null;try{t=Vd(C)}catch(u){console.warn("Error getting category by ID:",u)}const v=a[1]||1;b.view.filterMultiple={categoryId:C,teamType:v},b.view.componentProps.game&&(b.view.componentProps.teamView=v===2?b.view.componentProps.game.awayTeam.team_id:v===1?b.view.componentProps.game.homeTeam.team_id:0),b.view.componentProps.categoryView=t?[{id:C,name:t.name}]:[{id:C,name:`Category ${C}`}]}}}}else{const K=B;if(K&&g){const C=this.childViews.find(b=>b.view.id===g);if(C){let b=null;try{b=Vd(K)}catch(v){console.warn("Error getting category by ID:",v)}const t=a[1]||1;C.view.filterMultiple={categoryId:K,teamType:t},C.view.componentProps.game&&(C.view.componentProps.teamView=t===2?C.view.componentProps.game.awayTeam.team_id:t===1?C.view.componentProps.game.homeTeam.team_id:0),C.view.componentProps.categoryView=b?[{id:K,name:b.name}]:[{id:K,name:`Category ${K}`}]}}}}if(this.viewId===8){const B=a[0]||!1;this.childViews.forEach(K=>{K.view.componentProps&&(K.view.componentProps._isReactive||(K.view.componentProps=p.reactive(K.view.componentProps),K.view.componentProps._isReactive=!0),K.view.componentProps.areInactiveVisible=B,K.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:K.view.id,componentProps:K.view.componentProps,dynamicFilters:a}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:K.view.id,dynamicFilters:a}))})}if(this.viewId===1){const B=a[0]||[];if(console.log("GSCComparativeReports updateDynamicFilters - selectedAnalysisTypes:",B),console.log("GSCComparativeReports updateDynamicFilters - componentId:",g),g){console.log(`GSCComparativeReports - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const K=this.childViews.find(C=>C.view.id===g);K&&this.updateComparative(K,a)}else if(console.log("GSCComparativeReports - updating all components with global filters"),Array.isArray(B))console.log("GSCComparativeReports updateDynamicFilters (array mode) - skipping removal logic to prevent cross-page deletions"),this.childViews.length>0&&B.length>0&&this.childViews.forEach((K,C)=>{if(K.view.componentProps&&C<B.length){const b=B[C],t=Fd.get(this.viewId);K.view.componentProps.type=b,K.view.componentProps.default=!1,K.view.title=`Comparativa ${t[b]}`,K.view.filterMultiple={category:b},console.log(`GSCComparativeReports updateDynamicFilters - updated component ${C} with type:`,b)}});else{const K=B;if(K&&this.childViews.length>0){const C=this.childViews[0];if(C.view.componentProps){const b=Fd.get(this.viewId);C.view.componentProps.type=K,C.view.componentProps.default=!1,C.view.title=`Comparativa ${b[K]}`,C.view.filterMultiple={category:K}}}}console.log("-------------------------------------------------------------"),console.log("childViews",this.childViews)}if(this.viewId===6){const B=a[0]||[];if(g){console.log(`GSCLineupsReports - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const K=this.childViews.find(C=>C.view.id===g);K&&this.updateGSCLineupsReports(K,a)}else{if(console.log("GSCLineupsReports - updating all components with global filters"),Array.isArray(B))if(B.length===0)for(console.log("GSCLineupsReports - no games selected, removing all components");this.childViews.length>0;)this.removeChildView(this.childViews[0]);else this.childViews.reduce((K,C)=>(B.includes(C.view.componentProps.gameNumber)||K.push(C.view.componentProps.gameNumber),K),[]).forEach(K=>{const C=this.childViews.findIndex(b=>b.view.componentProps.gameNumber===K);if(C!==-1){for(let b=C;b<this.childViews.length;b++){const t=this.childViews[b+1],v=this.childViews[b];t&&(v.view.componentProps.gameNumber=t.view.componentProps.gameNumber,v.view.filterMultiple={gameNumber:t.view.componentProps.gameNumber})}this.removeChildView(this.childViews[this.childViews.length-1])}});this.childViews.forEach(K=>{K.view.componentProps&&(K.view.componentProps._isReactive||(K.view.componentProps=p.reactive(K.view.componentProps),K.view.componentProps._isReactive=!0),Ai.emit("component-props-updated",{viewId:K.view.id,componentProps:K.view.componentProps,dynamicFilters:a}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:K.view.id,dynamicFilters:a}))})}}if(this.viewId===3){if(console.log("GSCMatchSummary updateDynamicFilters:",{dynamicFilters:a,componentId:g,childViewsLength:this.childViews.length}),g){console.log(`GSCMatchSummary - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const B=this.childViews.find(K=>K.view.id===g);B&&this.updateMatchSummary(B,a)}else{console.log("GSCMatchSummary - updating all components with global filters");const B=a[0]||!1;this.childViews.forEach(K=>{K.view.componentProps&&(K.view.componentProps._isReactive||(K.view.componentProps=p.reactive(K.view.componentProps),K.view.componentProps._isReactive=!0),K.view.componentProps.desplegable=B,K.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:K.view.id,componentProps:K.view.componentProps,dynamicFilters:a}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:K.view.id,dynamicFilters:a}))})}this.updateSummary({dynamicFilters:a})}if(this.viewId===4){const B=a&&a.length>0&&Array.isArray(a[0])&&a[0].length>0;if(console.log("Timeline updateDynamicFilters:",{hasSelectedEvents:B,childViewsLength:this.childViews.length,dynamicFilters:a,componentId:g}),g){console.log(`Timeline - updating specific filters for component ${g}`),this.setDynamicFilters(a,g);const K=this.childViews.find(C=>C.view.id===g);K&&this.updateTimeline(K,a)}else if(console.log("Timeline - updating all components with global filters"),!B&&this.childViews.length>0)console.log("Timeline - removing views due to no events"),this.childViews.forEach(K=>{this.removeChildView(K)});else if(B&&this.childViews.length===0){console.log("Timeline - emitting add-view event");const K={pageId:null,view:{id:this.viewId,name:"Timeline",title:"Timeline",colspan:12,rowspan:6,max_column:12,max_row:12,min_column:6,min_row:4},filterAndWidgetContainer:this};Ai.emit("add-view",K)}else this.childViews.forEach(K=>{this.updateTimeline(K,a)})}console.log("updateDynamic filters completed successfullyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"),console.log("this.childViews",this.childViews)}finally{this._isUpdating=!1}}removeAllChildViews(){[...this.childViews].forEach(a=>{this.removeChildView(a)})}removeChildView(a,g=!1){const B=this.childViews.findIndex(K=>K.view.id===a.view.id);if(B!==-1){const K=this.childViews[B];this.childViews.splice(B,1),K.view.id&&(this.componentSpecificFilters.delete(K.view.id),console.log(`Cleaned specific filters for component ${K.view.id}`));const C=K.grid,b=K.page,t=document.querySelector(`[gs-id="${K.view.id}"]`);if(C&&t&&(C.removeWidget(t),b&&!g)){const v=b.items.findIndex(u=>u.id===K.view.id);v!==-1&&(b.items.splice(v,1),b.items.length===0&&Ai.emit("empty-page",b))}}}updateView({view:a,dynamicFilters:g,filtersJSON:B}){this.dynamicFilters=g;const K=this.childViews.find(C=>{var b,t,v,u,e,w;return C.view.id===a.view.id||((t=(b=C.view)==null?void 0:b.coreView)==null?void 0:t.id)===a.view.id||((u=(v=C.view)==null?void 0:v.coreView)==null?void 0:u.id)===((w=(e=a.view)==null?void 0:e.coreView)==null?void 0:w.id)});if(console.log("222222222222222222222222222222222222222"),console.log("childViews:",this.childViews),console.log("viewToUpdate:",K),console.log("view:",a),console.log("dynamicFilters:",g),console.log("filtersJSON:",B),console.log("this.viewId:",this.viewId),K){K.view.filtersJSON=B,K.view.coreView&&(K.view.coreView.filtersJSON=B);let C=g;if(this.viewId===4){const b=this.getComponentDynamicFilters(a.view.id);b&&(C=b,console.log(`Timeline updateView - using specific filters for component ${a.view.id}:`,C))}else if(this.viewId===8){const b=this.getComponentDynamicFilters(a.view.id);b&&(C=b,console.log(`FieldPosesion updateView - using specific filters for component ${a.view.id}:`,C))}else if(this.viewId===3){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCMatchSummary updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCMatchSummary updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCMatchSummary updateView - no specific filters found, using dynamicFilters:",C),this.updateSummary({dynamicFilters:C})}else if(this.viewId===1){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCComparativeReports updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCComparativeReports updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCComparativeReports updateView - no specific filters found, using dynamicFilters:",C)}else if(this.viewId===6){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCLineupsReports updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCLineupsReports updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCLineupsReports updateView - no specific filters found, using dynamicFilters:",C)}else if(this.viewId===7){const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCGoalData updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCGoalData updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCGoalData updateView - no specific filters found, using dynamicFilters:",C)}else if(this.viewId===9){console.log("update viewwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww zones");const b=this.getComponentDynamicFilters(a.view.id);console.log(`GSCFieldDataByZones updateView - component ${a.view.id}:`,{componentSpecificFilters:b,dynamicFilters:g,willUseSpecific:!!b}),b?(C=b,console.log(`GSCFieldDataByZones updateView - using specific filters for component ${a.view.id}:`,C)):console.log("GSCFieldDataByZones updateView - no specific filters found, using dynamicFilters:",C)}this.viewId===5?this.updateVolumetricField(K,C):this.viewId===7?this.updateGoalData(K,C):this.viewId===9?this.updateFieldDataByZones(K,g):this.viewId===10?this.updateXg(K,C):this.viewId===3?this.updateMatchSummary(K,C):this.viewId===4?this.updateTimeline(K,C):this.viewId===8?this.updateFieldPosesion(K,C):this.viewId===1?this.updateComparative(K,C):this.viewId===2?this.updateGSCtops(K,C):this.viewId===6&&this.updateGSCLineupsReports(K,C)}else console.log("viewToUpdate not found")}updateComparative(a,g){if(console.log("update comparative",g),a.view.componentProps){const B=g[0]||[];if(console.log("GSCComparativeReports updateComparative - selectedAnalysisTypes:",B),B&&B.length>0){let K;if(Array.isArray(B)){const b=this.childViews.findIndex(t=>t.view.id===a.view.id);b>=0&&b<B.length?K=B[b]:K=B[0]}else K=B;const C=Fd.get(this.viewId);a.view.componentProps.type=K,a.view.componentProps.default=!1,a.view.title=`Comparativa ${C[K]}`,a.view.filterMultiple={category:K},console.log("GSCComparativeReports updateComparative - updated component with type:",K)}Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g})}}updateVolumetricField(a,g){if(console.log("updateVolumetricField",g),a.view.componentProps){const B=g[0]||1;a.view.isHomeTeam=B===1,a.view.componentProps.preMatchType=B,a.view.filterMultiple={isHomeTeam:B},console.log("GSCVolumetricField updateVolumetricField - updated component with:",{isHomeTeam:B,preMatchType:a.view.componentProps.preMatchType,filterMultiple:a.view.filterMultiple}),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}updateGoalData(a,g){if(console.log("updateGoalData",g),a.view.componentProps){const B=g[0]===1?"offensive":"defensive",K=g[1]===1;a.view.componentProps.analysisType=B,a.view.componentProps.isHomeTeamForAnalysis=K,a.view.isHomeTeam=K,a.view.filterMultiple={isHomeTeam:K},console.log("GSCGoalData updateGoalData - updated component with:",{analysisType:B,isHomeTeam:K,filterMultiple:a.view.filterMultiple}),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}updateFieldDataByZones(a,g){if(console.log("9999999999999999999999999999999999999999999999999999"),console.log("updateFieldDataByZones",g),console.log("view",a),a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=g[0],K=g[1]===1;if(console.log("dynamicFiltersValuesPerTeam",B),console.log("isHomeTeam",K),a.view.componentProps.isHomeTeamForAnalysis=K,a.view.isHomeTeam=K,a.view.filterMultiple={categoryIds:B,isHomeTeam:K},B&&B.length){const C=B.join("-"),b=Fd.get(this.viewId).analysisTypes.get(C);console.log("analysisTypeInfo",b),b&&(a.view.componentProps.analysisType=b.analysisType,a.view.title=b.title),this.removeChildView(a),this.addView(a)}console.log("GSCFieldDataByZones updateFieldDataByZones - updated component with:",{categoryIds:B,isHomeTeam:K,analysisType:a.view.componentProps.analysisType,title:a.view.title,filterMultiple:a.view.filterMultiple})}}updateXg(a,g){a.view.componentProps&&(a.view.isHomeTeam=g[0]===1,a.view.componentProps.isHomeTeamForAnalysis=g[0]||1)}updateMatchSummary(a,g){if(a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=g&&g.length>0?g[0]:!1;a.view.componentProps.desplegable=B,a.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g})}}updateTimeline(a,g){if(a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=this.getComponentDynamicFilters(a.view.id),K=B||g,C=K&&K.length>0?K[0]:[];a.view.componentProps.selectedEvents=C,a.view.componentProps.key=C.length>0;const b=this.hasEventTypeId(C,1),t=this.hasCategoryId(C,8),v=this.hasCategoryId(C,9),u=this.hasEventTypeId(C,3);console.log("Timeline update - Events check:",{goals:b,yellowCards:t,redCards:v,substitutions:u,selectedEvents:C,componentId:a.view.id,usingSpecificFilters:!!B}),a.view.componentProps.goals=b,a.view.componentProps.yellowCards=t,a.view.componentProps.redCards=v,a.view.componentProps.substitutions=u,a.view.componentProps._updateKey=Date.now(),Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:K}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:K}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}updateFieldPosesion(a,g){if(a.view.componentProps){a.view.componentProps._isReactive||(a.view.componentProps=p.reactive(a.view.componentProps),a.view.componentProps._isReactive=!0);const B=g&&g.length>0?g[0]:!1;a.view.componentProps.areInactiveVisible=B,a.view.componentProps.key=B,Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g})}}updateGSCtops(a,g){if(console.log("updateGSCtops",g),a.view.componentProps){const B=g[0]||[];if(Array.isArray(B)){if(console.log("GSCtops updateGSCtops (array mode) - skipping removal logic to prevent cross-page deletions"),B.length>0){const K=B[0];let C=null;try{C=Vd(K)}catch(t){console.warn("Error getting category by ID:",t)}const b=g[1]||1;a.view.filterMultiple={categoryId:K,teamType:b},a.view.componentProps.game&&(b===1?a.view.componentProps.teamView=a.view.componentProps.game.homeTeam.team_id:b===2?a.view.componentProps.teamView=a.view.componentProps.game.awayTeam.team_id:a.view.componentProps.teamView=0),a.view.componentProps.categoryView=C?[{id:K,name:C.name}]:[{id:K,name:`Category ${K}`}]}}else{const K=B;if(K){let C=null;try{C=Vd(K)}catch(t){console.warn("Error getting category by ID:",t)}const b=g[1]||1;a.view.filterMultiple={categoryId:K,teamType:b},a.view.componentProps.game&&(b===1?a.view.componentProps.teamView=a.view.componentProps.game.homeTeam.team_id:b===2?a.view.componentProps.teamView=a.view.componentProps.game.awayTeam.team_id:a.view.componentProps.teamView=0),a.view.componentProps.categoryView=C?[{id:K,name:C.name}]:[{id:K,name:`Category ${K}`}]}}}}updateGSCLineupsReports(a,g){if(console.log("updateGSCLineupsReports",g),a.view.componentProps){const B=g[0]||[];if(Array.isArray(B)){if(console.log("GSCLineupsReports updateGSCLineupsReports (array mode) - skipping removal logic to prevent cross-page deletions"),B.length>0){const K=B[0];a.view.filterMultiple={gameNumber:K},a.view.componentProps.gameNumber=K}}else{const K=B;K&&(a.view.filterMultiple={gameNumber:K},a.view.componentProps.gameNumber=K)}Ai.emit("component-props-updated",{viewId:a.view.id,componentProps:a.view.componentProps,dynamicFilters:g}),Ai.emit("dynamic-filters-changed",{containerViewId:this.viewId,viewId:a.view.id,dynamicFilters:g}),Ai.emit("force-component-update",{itemId:a.view.id,componentProps:a.view.componentProps})}}getCategoryIdFromAnalysisType(a,g){if(!a||!g)return null;for(const B of g){const K=B.join("-"),C=Fd.get(this.viewId);if(C&&C.analysisTypes){const b=C.analysisTypes.get(K);if(b&&b.analysisType===a)return B[0]||null}}return null}}const Bse={class:"template-page__header"},Vse={class:"template-page__header__name"},Fse=["value"],jse={class:"template-page__header__details"},Use={class:"template-page__header__details__teams"},qse={class:"template-page__header__details__teams__team"},Wse={key:0,class:"template-page__header__details__teams__team__logo"},Gse=["src"],Hse={key:1,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Xse={class:"template-page__header__details__teams__team"},Jse={key:0,class:"template-page__header__details__teams__team__logo"},Kse=["src"],Zse={key:1,width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Yse={class:"template-page__content"},Qse=["id"],$se=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-max-w","gs-max-h","gs-min-w","gs-min-h","gs-no-resize","gs-no-move","gs-auto-position"],ele=p.defineComponent({__name:"TemplateReportPage",props:{token:{type:String,default:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwibmFtZSI6IlVzdWFyaW8gRnJlZSIsInVzZXJuYW1lIjoiZnJlZUBnb2xzdGF0cy5jb20iLCJlbWFpbCI6ImZyZWVAZ29sc3RhdHMuY29tIiwiaWF0IjoxNjA2NzU4Nzk1LCJleHAiOjE2MzgyOTQ3OTV9.kPNmP7yDtk38cAXrUyc7OHRh6J25VFqy-XUNzbK-4YE"},game:{type:Object,default:()=>null},lastGames:{type:Array,default:()=>null},id:{type:[String,Number],default:()=>String(Date.now())},page:{type:Object,default:()=>({title:"Page 1",items:[{name:"Tabla jugadores",id:`w-${String(Date.now())}`,x:0,y:0,w:4,h:4,maxWidth:4,maxHeight:4,noResize:!1,noMove:!1,componentProps:{}}]})},isPostMatch:{type:Boolean,default:!1},isTemplateMode:{type:Boolean,default:!1},isFilterVisible:{type:Boolean,default:!1}},emits:["intersection-changed","delete-page","change-sort","edit-view","view-changed","component-props-updated","delete-view","dynamic-filters-changed"],setup(r,{emit:a}){var g,B;const K=p.ref(null);let C=null;const b=r,t=p.ref(!1),v=a,u=p.computed(()=>b.page.items.reduce((z,V)=>(z.set(V.id,V),z),new Map)),e=p.computed(()=>{var z,V,U,q;return b.game&&b.game.homeTeam&&b.game.awayTeam?{homeTeam:{name:((z=b.game.homeTeam)==null?void 0:z.acronym)||"LOC",logo:((V=b.game.homeTeam)==null?void 0:V.logo)||null},awayTeam:{name:((U=b.game.awayTeam)==null?void 0:U.acronym)||"VIS",logo:((q=b.game.awayTeam)==null?void 0:q.logo)||null}}:{homeTeam:{name:"LOC"},awayTeam:{name:"VIS"}}});let w=null,y=null,x=!1,h=null,n=!1;const i=()=>{n=!0},d=()=>{n=!1};function s(){n||(x=!0,h&&clearTimeout(h),h=setTimeout(()=>{x=!1},150))}function c(){const z={root:null,rootMargin:"0px",threshold:.7};w=new IntersectionObserver(q=>{q.forEach(W=>{if(console.log("Intersection observer triggered:",W.isIntersecting,"isScrolling:",x),x){console.log("Scroll in progress, delaying intersection event"),y&&clearTimeout(y),y=setTimeout(()=>{console.log("Emitting delayed intersection event:",W.isIntersecting),v("intersection-changed",W.isIntersecting)},100);return}y&&clearTimeout(y),y=setTimeout(()=>{console.log("Emitting immediate intersection event:",W.isIntersecting),v("intersection-changed",W.isIntersecting)},50)})},z);const V=K.value;V&&w.observe(V);const U=document.querySelector(".container-main");U&&U.addEventListener("scroll",s,{passive:!0}),document.addEventListener("programmatic-scroll-start",i),document.addEventListener("programmatic-scroll-end",d)}function f(z){console.log("newValue:",z),b.page.title=z.target.value,v("view-changed")}const m={game_id:0,season_id:0,prematch:!1},T={gameId:90209,id:90209,seasonId:1909,regularSeasonId:1909,matchday_name:"Matchday 1",status:1,score:[1,3],game_status:1,dateTimeUTC:"2024-09-05T22:00:00Z",homeTeam:{logo:"https://golstatsimages.blob.core.windows.net/teams-80/2936.png",team_id:2936,provisional_logo:"https://golstatsimages.blob.core.windows.net/teams-provisional/2936.png",colloquial_name:"Guyana",acronym:"GUY",team_name:"Guyana"},awayTeam:{logo:"https://golstatsimages.blob.core.windows.net/teams-80/3279.png",team_id:3279,provisional_logo:"https://golstatsimages.blob.core.windows.net/teams-provisional/3279.png",colloquial_name:"Surinam",acronym:"SUR",team_name:"Surinam"},is_live:0,minutes:{home_goals_minutes:[],visiting_goals_minutes:[],home_yellow_cards_minutes:[],away_yellow_cards_minutes:[],home_red_cards_minutes:[],away_red_cards_minutes:[]}},E=new Map([[5,{component:Rb,componentName:"GSCVolumetricField",props:{isGamePreMatch:!b.isPostMatch,areTeamsVisible:!1,isTitleVisible:!1,isGhostEffect:b.isTemplateMode,isTemplateMode:b.isTemplateMode,preMatchType:1}}],[2,{component:Tw,componentName:"GscTopPlayer",props:{categoryView:[{id:0,name:"Category"}],gamed:b.game?b.game.id:T.gameId,game:b.game,season:b.game?(g=b==null?void 0:b.game)==null?void 0:g.season_id:T.seasonId,teamView:0,useDummyData:b.isTemplateMode}}],[8,{component:E3,componentName:"FieldPosesion",props:{widthSection:600,game:T,teamSelected:{teamId:0},areInactiveVisible:!0,showTitle:!1,isDefault:!0,key:!1}}],[6,{component:L4,componentName:"GSCLineupsReports",props:{selectedOption:b.isPostMatch?"Postmatch":"Prematch",game:m,gamehome:m,gameaway:m}}],[3,{component:M3,componentName:"GSCMatchSummary",props:{game:T,defaultShields:!0,desplegable:!1}}],[4,{component:p5,componentName:"GSCTimelineReports",props:{key:!0,isDefault:!0,gameId:T.gameId,homeTeam:T.homeTeam.team_id,awayTeam:T.awayTeam.team_id,token:b.token,goals:!0,yellowCards:!0,redCards:!0,substitutions:!0}}],[7,{component:v6,componentName:"GSCGoalData",props:{game:b.game,isHomeTeamForAnalysis:!0,canInteract:!1,canPlayVideos:!1,isPreMatch:!b.isPostMatch,analysisType:1}}],[9,{component:N4,componentName:"GSCFieldDataByZones",props:{game:b.game,isHomeTeamForAnalysis:!0,analysisType:"successfulPasses",canPlayVideos:!1,isPreMatch:!b.isPostMatch}}],[10,{component:M6,componentName:"GSCGameXg",props:{game:b.game,isHomeTeamForAnalysis:!0,isPostMatch:b.isPostMatch}}],[1,{component:m6,componentName:"GSCComparativeReports",props:{gameId:b.game?b.game.id:"",homeLogo:b.game?b.game.homeTeam.logo:"",awayLogo:b.game?b.game.awayTeam.logo:"",seasonId:b.game?(B=b==null?void 0:b.game)==null?void 0:B.season_id:0,typeGame:b.isPostMatch,type:"stoppedBall",default:b.isTemplateMode}}]]);function S(z){if(z)if(typeof z=="string"){let V=null;switch(z){case"GSCVolumetricField":V=Rb;break;case"GSCGoalData":V=v6;break;case"GscTopPlayer":V=Tw;break;case"FieldPosesion":V=E3;break;case"GSCLineupsReports":V=L4;break;case"GSCMatchSummary":V=M3;break;case"GSCTimelineReports":V=p5;break;case"GSCFieldDataByZones":V=N4;break;case"GSCGameXg":V=M6;break;case"GSCComparativeReports":V=m6;break;default:V=null}return V}else return z;return null}function L({pageId:z,view:V,filterAndWidgetContainer:U,applyMinimumSize:q=!1,dynamicFilters:W=[]}){if(b.page.id===z&&C){let Y=!1;V.id===3&&(Y=W[0]);const ne=`min_column${Y?"_2":""}`,X=`min_row${Y?"_2":""}`,re=`colspan${Y?"_2":""}`,ee=`rowspan${Y?"_2":""}`,Z={w:q?V[ne]:V[re],h:q?V[X]:V[ee]};if(C.willItFit(0,0,Z.w,Z.h,!0)){const te=C.addWidget(Z),ae=Number(te.getAttribute("gs-x")||0),oe=Number(te.getAttribute("gs-y")||0);C.removeWidget(te);const he=E.get(V.id),fe=p.reactive({...JSON.parse(JSON.stringify(he.props))||{},_isReactive:!0}),se=p.reactive({pageId:z,grid:C,page:b.page,view:{name:V.name,title:V.title,key:Date.now()-7*Math.random(),id:`w-${String(Date.now())}`,x:ae,y:oe,w:Z.w,h:Z.h,maxWidth:V.max_column,maxHeight:V.max_row,minWidth:V.min_column,minHeight:V.min_row,componentName:he.componentName,componentProps:fe,pageId:z,coreView:V}});U.addView(se),Ai.emit("add-page-view",se)}else Ai.emit("add-page-and-view",{pageId:z,view:V,filterAndWidgetContainer:U})}}function N(z){if(C){const V=document.querySelector(`[gs-id="${z.id}"]`);V&&(C.removeWidget(V),v("delete-view",z))}v("view-changed")}function A(z){if(!z.filterAndViewsContainer&&z.coreView){const V=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[z],z.coreView.id,z.dynamicFilters||[],b.isPostMatch,b.isTemplateMode,z.filtersJSON);z.filterAndViewsContainer=V}v("edit-view",z)}function I(){v("delete-page",b.page)}function M(){Ai.emit("change-sort",b.page)}function k(z){if(x)return;console.log("force-component-update event received:",z);const V=b.page.items.find(U=>U.id===z.itemId||U.id===z.viewId);V?(console.log("Found item to update in force-component-update:",V.id),Object.assign(V.componentProps,z.componentProps),V._updateKey=Date.now(),console.log("Updated item in force-component-update:",V.componentProps)):console.log("Item not found in force-component-update for id:",z.itemId||z.viewId)}function R(z){if(x)return;console.log("component-props-updated event received:",z);const V=b.page.items.find(U=>U.id===z.viewId);V?(console.log("Found item to update in component-props-updated:",V.id),Object.assign(V.componentProps,z.componentProps),V._updateKey=Date.now(),console.log("Updated item in component-props-updated:",V.componentProps)):console.log("Item not found in component-props-updated for id:",z.viewId)}function _(z){if(x)return;console.log("dynamic-filters-changed event received:",z);const V=b.page.items.find(U=>U.id===z.viewId);V?(console.log("Found item to update in dynamic-filters-changed:",V.id),Object.assign(V.componentProps,z.componentProps||{}),V._updateKey=Date.now(),console.log("Updated item in dynamic-filters-changed:",V.componentProps)):console.log("Item not found in dynamic-filters-changed for id:",z.viewId)}const O=function(){Ai.off("add-view",L),Ai.off("force-component-update",k),Ai.off("component-props-updated",R),Ai.off("dynamic-filters-changed",_);const z=document.querySelector(".container-main");z&&z.removeEventListener("scroll",s),y&&clearTimeout(y),h&&clearTimeout(h)};return Ai.on("add-view",L),Ai.on("force-component-update",k),Ai.on("component-props-updated",R),Ai.on("dynamic-filters-changed",_),p.onMounted(async()=>{await p.nextTick(),C=Wi.init({column:12,row:12,maxRow:12,cellHeight:60,float:!0,resizable:{handles:"e, se, s, sw, w"}},`#grid-stack-${b.id}`),C.on("change",(z,V)=>{const U=V[0];if(U){const q=u.value.get(U.id);q&&(q.x=U.x,q.y=U.y,q.w=U.w,q.h=U.h,v("view-changed"))}}),c(),b.page.grid=C,b.page.offListeners=O}),p.onUnmounted(()=>{w&&w.disconnect(),O(),y&&clearTimeout(y),h&&clearTimeout(h),document.removeEventListener("programmatic-scroll-start",i),document.removeEventListener("programmatic-scroll-end",d)}),(z,V)=>(p.openBlock(),p.createElementBlock("div",{ref_key:"templatePage",ref:K,class:"template-page"},[p.createElementVNode("div",Bse,[t.value?(p.openBlock(),p.createBlock(L6,{key:0,"options-type":"page",onClick:V[0]||(V[0]=p.withModifiers(U=>t.value=!1,["self"])),onMouseleave:V[1]||(V[1]=U=>t.value=!1),onCloseTooltip:V[2]||(V[2]=U=>t.value=!1),onDeletePage:I,onChangeSort:M})):p.createCommentVNode("",!0),p.createElementVNode("div",Vse,[V[4]||(V[4]=p.createElementVNode("div",null,[p.createElementVNode("svg",{width:"19",height:"21",viewBox:"0 0 19 21",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M11.2986 12.9994C7.62909 14.8341 4.11744 16.0178 1.35547 16.4518L9.18763 20.0029C9.34545 20.0818 9.60192 20.0818 9.74002 20.0029L17.8878 16.3137C18.0457 16.2348 18.164 16.0572 18.164 15.8797V8.75781C16.2898 10.2177 13.9422 11.6776 11.2986 12.9994Z",fill:"white"}),p.createElementVNode("path",{d:"M4.7152 8.89735C4.7152 8.89735 10.9494 3.76802 16.8482 1.20335C15.0529 0.946887 11.3637 0.43395 9.3711 0.453678C4.41928 0.493135 1.06546 1.34145 1.06546 1.34145C0.90763 1.3809 0.769531 1.55846 0.769531 1.71629V8.12795C3.01857 6.56942 5.34651 5.56329 5.34651 5.56329C5.34651 5.56329 2.72264 7.06263 0.769531 8.81844V9.41028V14.1648C3.09748 13.9675 6.62886 12.7641 10.3575 10.7321C13.6719 8.91707 16.4733 6.84562 18.17 5.05035V2.40677C14.3032 3.37346 4.7152 8.89735 4.7152 8.89735Z",fill:"white"})])],-1)),V[5]||(V[5]=p.createElementVNode("div",{class:"separator"},null,-1)),p.createElementVNode("input",{value:r.page.title,type:"text",class:"page-title-input",onclick:"this.select()",onInput:f},null,40,Fse)]),p.createElementVNode("div",jse,[p.createElementVNode("div",Use,[p.createElementVNode("div",qse,[e.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",Wse,[p.createElementVNode("img",{src:e.value.homeTeam.logo,alt:"Home Team Logo",width:"25",height:"25"},null,8,Gse)])):(p.openBlock(),p.createElementBlock("svg",Hse,[...V[6]||(V[6]=[p.createElementVNode("path",{opacity:"0.4",d:"M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z",fill:"#54728B"},null,-1)])])),p.createElementVNode("span",null,p.toDisplayString(e.value.homeTeam.name),1)]),V[8]||(V[8]=p.createElementVNode("div",{class:"template-page__header__details__teams__vs"}," VS ",-1)),p.createElementVNode("div",Xse,[p.createElementVNode("span",null,p.toDisplayString(e.value.awayTeam.name),1),e.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",Jse,[p.createElementVNode("img",{src:e.value.awayTeam.logo,alt:"Away Team Logo",width:"25",height:"25"},null,8,Kse)])):(p.openBlock(),p.createElementBlock("svg",Zse,[...V[7]||(V[7]=[p.createElementVNode("path",{opacity:"0.4",d:"M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z",fill:"#54728B"},null,-1)])]))])]),r.isTemplateMode&&!r.isFilterVisible?(p.openBlock(),p.createElementBlock("div",{key:0,class:"template-page__header__details__options",onClick:V[3]||(V[3]=U=>t.value=!0)},[...V[9]||(V[9]=[p.createElementVNode("svg",{width:"17",height:"13",viewBox:"0 0 17 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M3.56953 6.28672C3.56953 7.19972 2.83253 7.93672 1.91953 7.93672C1.00653 7.93672 0.269531 7.19972 0.269531 6.28672C0.269531 5.37372 1.00653 4.63672 1.91953 4.63672C2.83253 4.63672 3.56953 5.37372 3.56953 6.28672ZM8.51953 4.63672C7.60653 4.63672 6.86953 5.37372 6.86953 6.28672C6.86953 7.19972 7.60653 7.93672 8.51953 7.93672C9.43253 7.93672 10.1695 7.19972 10.1695 6.28672C10.1695 5.37372 9.43253 4.63672 8.51953 4.63672ZM15.1195 4.63672C14.2065 4.63672 13.4695 5.37372 13.4695 6.28672C13.4695 7.19972 14.2065 7.93672 15.1195 7.93672C16.0325 7.93672 16.7695 7.19972 16.7695 6.28672C16.7695 5.37372 16.0325 4.63672 15.1195 4.63672Z",fill:"white"})],-1)])])):p.createCommentVNode("",!0)])]),p.createElementVNode("div",Yse,[p.createElementVNode("div",{id:`grid-stack-${r.id}`,class:"grid-stack"},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(r.page.items,U=>{var q,W,Y;return p.openBlock(),p.createElementBlock("div",{class:"grid-stack-item",key:U.key,"gs-id":U.id,"gs-x":U.x,"gs-y":U.y,"gs-w":U.w,"gs-h":U.h,"gs-max-w":U.maxWidth,"gs-max-h":U.maxHeight,"gs-min-w":U.minWidth,"gs-min-h":U.minHeight,"gs-no-resize":!r.isTemplateMode,"gs-no-move":!b.isTemplateMode,"gs-auto-position":U.x===0&&U.y===0},[p.createElementVNode("div",{class:p.normalizeClass(["grid-stack-item-content",{"is-selected":U.isSelected}])},[p.createVNode(Cse,{title:U.coreView&&U.coreView.id===9&&U.w<4&&U.titleShort||U.title,"is-template-mode":r.isTemplateMode,game:r.game,lastGames:r.lastGames,"is-home-team":(q=U.componentProps)!=null&&q.preMatchType?((W=U.componentProps)==null?void 0:W.preMatchType)===1:U.isHomeTeam,"is-filter-visible":r.isFilterVisible,"view-id":((Y=U==null?void 0:U.coreView)==null?void 0:Y.id)||0,onEdit:ne=>A(U),onDelete:ne=>N(U)},{default:p.withCtx(()=>[(p.openBlock(),p.createBlock(p.resolveDynamicComponent(S(U.componentName)),p.mergeProps({ref_for:!0},U.componentProps,{key:`${U.id}-${U._updateKey||0}`}),null,16))]),_:2},1032,["title","is-template-mode","game","lastGames","is-home-team","is-filter-visible","view-id","onEdit","onDelete"])],2)],8,$se)}),128))],8,Qse)])],512))}}),tle=dd(ele,[["__scopeId","data-v-c6c9b088"]]),rle={PO1:"CFI",PO2:"CFV",PO3:"SFI",PO4:"SFV",PO5:"FI",PO6:"FV"},nle={key:0,class:"cover__main-logo cover__main-logo__home"},ile={key:0,class:"team-logo"},ale=["src"],ole={key:1,width:"575",height:"675",viewBox:"0 0 160 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},sle=["fill"],lle={key:1,class:"cover__main-logo cover__main-logo__away"},cle={key:0,class:"team-logo"},ule=["src"],dle={key:1,width:"575",height:"575",viewBox:"0 0 161 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},hle=["fill"],ple={class:"cover__title-subtitle"},fle={class:"cover__title-subtitle__title"},mle={class:"cover__title-subtitle__subtitle"},gle={key:2,class:"cover-type-one"},yle={class:"team-info-one"},vle={class:"team-data"},xle={key:0,class:"team-logo"},ble=["src"],_le={key:1,width:"160",height:"161",viewBox:"0 0 160 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wle=["fill","opacity"],Tle={class:"team-name"},kle={key:0,class:"team-events"},Sle={class:"score-one"},Ele={key:0},Ale={class:"team-info-one"},Cle={class:"team-data"},Mle={key:0,class:"team-logo"},Lle=["src"],Nle={key:1,width:"161",height:"161",viewBox:"0 0 161 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ile=["fill","opacity"],Rle={class:"team-name"},Ole={key:0,class:"team-events"},Ple={key:3,class:"cover-type-two"},zle={class:"team-data"},Dle={class:"team-info"},Ble={key:0,class:"team-logo"},Vle=["src"],Fle={key:1,width:"160",height:"161",viewBox:"0 0 160 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},jle=["fill","opacity"],Ule={key:2,class:"team-score-two"},qle={key:0,class:"team-goals"},Wle={class:"team-data"},Gle={class:"team-info"},Hle={key:0,class:"team-score-two"},Xle={key:1,class:"team-logo"},Jle=["src"],Kle={key:2,width:"161",height:"161",viewBox:"0 0 161 161",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zle=["fill","opacity"],Yle={key:0,class:"team-goals"},Qle={__name:"CoverPage",props:{game:{type:Object,default:()=>null},coverId:{type:Number,default:1},isPostMatch:{type:Boolean,default:!0}},emits:["intersection-changed"],setup(r,{emit:a}){const g=r,B=a,K=p.ref(null),C=p.computed(()=>[1,2].includes(g.coverId)),b=p.computed(()=>[1,3].includes(g.coverId)),t=p.computed(()=>g.coverId===1?{homeTeam:"#1558CC",awayTeam:"#0046BF",opacity:1}:g.coverId===3?{homeTeam:"#000A1A",awayTeam:"#000A1A",opacity:.4}:{homeTeam:"#576883",awayTeam:"#576883",opacity:.4}),v=p.computed(()=>g.game&&g.game.score?g.game.score:["0","0"]),u=p.computed(()=>{var L,N,A,I,M,k,R,_;if(g.game&&g.game.homeTeam&&g.game.awayTeam){const O={homeTeam:{name:((L=g.game.homeTeam)==null?void 0:L.acronym)||"LOC",logo:((N=g.game.homeTeam)==null?void 0:N.logo)||null},awayTeam:{name:((A=g.game.awayTeam)==null?void 0:A.acronym)||"VIS",logo:((I=g.game.awayTeam)==null?void 0:I.logo)||null}};return C.value?(O.homeTeam.goalsMinutes=n(g.game.minutes.home_goals_minutes),O.homeTeam.totalYellowCards=((M=g.game.minutes.home_yellow_cards_minutes)==null?void 0:M.length)||0,O.homeTeam.totalRedCards=((k=g.game.minutes.home_red_cards_minutes)==null?void 0:k.length)||0,O.awayTeam.goalsMinutes=n(g.game.minutes.visiting_goals_minutes),O.awayTeam.totalYellowCards=((R=g.game.minutes.away_yellow_cards_minutes)==null?void 0:R.length)||0,O.awayTeam.totalRedCards=((_=g.game.minutes.away_red_cards_minutes)==null?void 0:_.length)||0):(O.homeTeam.goalsEvents=h(g.game.report_minutes.home_goals_minutes),O.awayTeam.goalsEvents=h(g.game.report_minutes.visiting_goals_minutes)),O}return{homeTeam:{name:"LOC",logo:null,goalsMinutes:"00'",totalYellowCards:0,totalRedCards:0,goalsEvents:[{playerName:"Nombre",goalTime:"00'"}]},awayTeam:{name:"VIS",logo:null,goalsMinutes:"00'",totalYellowCards:0,totalRedCards:0,goalsEvents:[{playerName:"Nombre",goalTime:"00'"}]}}}),e=p.computed(()=>({"--background-image":b.value?"url(https://golstatsimages.blob.core.windows.net/report-maker/background-postmatch-template-01@2x.jpg)":"url(https://golstatsimages.blob.core.windows.net/report-maker/background-postmatch-template-02@2x.jpg)","--grid-template-columns-type-one":g.isPostMatch?"1fr min-content 1fr":"320px min-content 320px","--width-type-one":g.isPostMatch?"100%":"fit-content","--grid-template-columns-type-two":g.isPostMatch?"1fr min-content 1fr":"320px min-content 320px","--width-type-two":g.isPostMatch?"100%":"fit-content"})),w=p.computed(()=>g.isPostMatch?"Postmatch":"Prematch"),y=["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],x=p.computed(()=>{if(g.game){let L=rle[g.game.matchday_abbreviation];L||(L=g.game.matchday_abbreviation.replace("M","J"));const[N,A,I]=g.game.date.split("-");return`${L} - ${I} ${y[Number(A)-1]}, ${N}`}return"Jornada - Día 00 Mes"});function h(L){return!L||!Array.isArray(L)||L.length===0?"":(console.log("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"),console.log("goalsDetails",L),L.map(N=>{const A=N.split(", ");let I=A[0].replace("'","");I=I.replace("+",""),I=I.replace("’",""),console.log("playerGoalsArray",A);const M=I.split(" "),{strings:k,numbers:R}=M.reduce((z,V)=>(isNaN(Number(V))?z.strings.push(V):z.numbers.push(V),z),{strings:[],numbers:[]}),_=k.join(" "),O=R.length===1?`${R[0]}'`:`${R[0]}' ${R.slice(1).join(" + ")}'`;return{playerName:_,goalTime:A.length===1?O:`${O}, ${A.reduce((z,V,U)=>U===0?z:`${z}${V}${U<A.length-1?", ":""}`,"")}`}}))}function n(L){return!L||!Array.isArray(L)||L.length===0?"":L.reduce((N,A,I)=>{const M=A.split(" ");let k="";return M.length===3?k=M[2]:M.length===5&&(k=`${M[2]} ${M[3]} ${M[4]}`),k&&(N+=`${k}${I<L.length-1?", ":""}`),N},"")}let i=null,d=null,s=!1,c=null,f=!1;const m=()=>{f=!0},T=()=>{f=!1};function E(){if(f){console.log("Cover: Ignoring programmatic scroll");return}s=!0,c&&clearTimeout(c),c=setTimeout(()=>{s=!1},150)}function S(){const L={root:null,rootMargin:"0px",threshold:.7};i=new IntersectionObserver(I=>{I.forEach(M=>{if(console.log("Cover: Intersection observer triggered:",M.isIntersecting,"isScrolling:",s),s){console.log("Cover: Scroll in progress, delaying intersection event"),d&&clearTimeout(d),d=setTimeout(()=>{console.log("Cover: Emitting delayed intersection event:",M.isIntersecting),B("intersection-changed",M.isIntersecting)},100);return}d&&clearTimeout(d),d=setTimeout(()=>{console.log("Cover: Emitting immediate intersection event:",M.isIntersecting),B("intersection-changed",M.isIntersecting)},50)})},L);const N=K.value;N&&i.observe(N);const A=document.querySelector(".container-main");A&&A.addEventListener("scroll",E,{passive:!0}),document.addEventListener("programmatic-scroll-start",m),document.addEventListener("programmatic-scroll-end",T)}return p.onMounted(()=>{S()}),p.onUnmounted(()=>{i&&i.disconnect();const L=document.querySelector(".container-main");L&&L.removeEventListener("scroll",E),document.removeEventListener("programmatic-scroll-start",m),document.removeEventListener("programmatic-scroll-end",T),d&&clearTimeout(d),c&&clearTimeout(c)}),(L,N)=>(p.openBlock(),p.createElementBlock("div",{ref_key:"coverPage",ref:K,class:"cover",style:p.normalizeStyle(e.value)},[C.value?(p.openBlock(),p.createElementBlock("div",nle,[u.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",ile,[p.createElementVNode("img",{src:u.value.homeTeam.logo||"/default-logo.png",alt:"Team 1 Logo"},null,8,ale)])):(p.openBlock(),p.createElementBlock("svg",ole,[p.createElementVNode("path",{d:"M80.0068 0.953125C80.0068 0.953125 91.0143 12.208 118.141 12.9913C140.898 13.6509 149.102 7.87917 149.102 7.87917C149.102 7.87917 169.839 67.5339 135.786 117.212C117.894 143.308 83.5935 160.211 79.9656 160.953C76.3789 160.211 42.0372 143.308 24.1449 117.212C-9.8257 67.5339 10.9112 7.87917 10.9112 7.87917C10.9112 7.87917 19.1153 13.6509 41.8723 12.9913C68.9993 12.208 80.0068 0.953125 80.0068 0.953125Z",fill:t.value.homeTeam},null,8,sle)]))])):p.createCommentVNode("",!0),C.value?(p.openBlock(),p.createElementBlock("div",lle,[u.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",cle,[p.createElementVNode("img",{src:u.value.awayTeam.logo||"/default-logo.png",alt:"Team 2 Logo"},null,8,ule)])):(p.openBlock(),p.createElementBlock("svg",dle,[p.createElementVNode("path",{d:"M80.8504 0.953125C80.8504 0.953125 92.9822 3.39499 119.261 10.1779C144.106 16.5733 152.827 19.1314 152.827 19.1314C152.827 19.1314 156.936 44.2089 145.657 90.5655C136.548 127.969 106.742 152.038 80.8504 160.953C54.9977 152.038 25.1527 128.007 16.0442 90.5655C4.8039 44.2477 8.91243 19.1314 8.91243 19.1314C8.91243 19.1314 17.6334 16.5733 42.4783 10.1779C68.7574 3.39499 80.8504 0.953125 80.8504 0.953125Z",fill:t.value.awayTeam},null,8,hle)]))])):p.createCommentVNode("",!0),p.createElementVNode("div",ple,[p.createElementVNode("div",fle,[N[0]||(N[0]=p.createElementVNode("div",null,"Análisis",-1)),p.createElementVNode("div",null,p.toDisplayString(w.value),1)]),p.createElementVNode("div",mle,p.toDisplayString(x.value),1)]),C.value?(p.openBlock(),p.createElementBlock("div",gle,[p.createElementVNode("div",yle,[p.createElementVNode("div",vle,[u.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",xle,[p.createElementVNode("img",{src:u.value.homeTeam.logo||"/default-logo.png",alt:"Team 1 Logo"},null,8,ble)])):(p.openBlock(),p.createElementBlock("svg",_le,[p.createElementVNode("path",{d:"M80.0068 0.953125C80.0068 0.953125 91.0143 12.208 118.141 12.9913C140.898 13.6509 149.102 7.87917 149.102 7.87917C149.102 7.87917 169.839 67.5339 135.786 117.212C117.894 143.308 83.5935 160.211 79.9656 160.953C76.3789 160.211 42.0372 143.308 24.1449 117.212C-9.8257 67.5339 10.9112 7.87917 10.9112 7.87917C10.9112 7.87917 19.1153 13.6509 41.8723 12.9913C68.9993 12.208 80.0068 0.953125 80.0068 0.953125Z",fill:t.value.homeTeam,opacity:t.value.opacity},null,8,wle)])),p.createElementVNode("div",Tle,p.toDisplayString(u.value.homeTeam.name),1)]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",kle,[N[1]||(N[1]=p.createStaticVNode('<svg class="ball" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1)),p.createElementVNode("div",null,p.toDisplayString(u.value.homeTeam.goalsMinutes),1),N[2]||(N[2]=p.createElementVNode("div",{class:"separator"},null,-1)),N[3]||(N[3]=p.createElementVNode("svg",{class:"card",width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.367188",y:"0.09375",width:"9.14286",height:"13.7143",rx:"2.28571",fill:"#F7C330"})],-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.homeTeam.totalYellowCards),1),N[4]||(N[4]=p.createElementVNode("svg",{class:"card",width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.109375",y:"0.09375",width:"9.14286",height:"13.7143",rx:"1.82857",fill:"#FF0000"})],-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.homeTeam.totalRedCards),1)])):p.createCommentVNode("",!0)]),p.createElementVNode("div",Sle,[r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Ele,p.toDisplayString(v.value[0])+" : "+p.toDisplayString(v.value[1]),1)):p.createCommentVNode("",!0)]),p.createElementVNode("div",Ale,[p.createElementVNode("div",Cle,[u.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",Mle,[p.createElementVNode("img",{src:u.value.awayTeam.logo||"/default-logo.png",alt:"Team 2 Logo"},null,8,Lle)])):(p.openBlock(),p.createElementBlock("svg",Nle,[p.createElementVNode("path",{d:"M80.8504 0.953125C80.8504 0.953125 92.9822 3.39499 119.261 10.1779C144.106 16.5733 152.827 19.1314 152.827 19.1314C152.827 19.1314 156.936 44.2089 145.657 90.5655C136.548 127.969 106.742 152.038 80.8504 160.953C54.9977 152.038 25.1527 128.007 16.0442 90.5655C4.8039 44.2477 8.91243 19.1314 8.91243 19.1314C8.91243 19.1314 17.6334 16.5733 42.4783 10.1779C68.7574 3.39499 80.8504 0.953125 80.8504 0.953125Z",fill:t.value.awayTeam,opacity:t.value.opacity},null,8,Ile)])),p.createElementVNode("div",Rle,p.toDisplayString(u.value.awayTeam.name),1)]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Ole,[p.createElementVNode("div",null,p.toDisplayString(u.value.awayTeam.totalYellowCards),1),N[5]||(N[5]=p.createElementVNode("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.367188",y:"0.09375",width:"9.14286",height:"13.7143",rx:"2.28571",fill:"#F7C330"})],-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.awayTeam.totalRedCards),1),N[6]||(N[6]=p.createElementVNode("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("rect",{x:"0.109375",y:"0.09375",width:"9.14286",height:"13.7143",rx:"1.82857",fill:"#FF0000"})],-1)),N[7]||(N[7]=p.createElementVNode("div",{class:"separator"},null,-1)),p.createElementVNode("div",null,p.toDisplayString(u.value.awayTeam.goalsMinutes),1),N[8]||(N[8]=p.createStaticVNode('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1))])):p.createCommentVNode("",!0)])])):(p.openBlock(),p.createElementBlock("div",Ple,[p.createElementVNode("div",zle,[p.createElementVNode("div",Dle,[u.value.homeTeam.logo?(p.openBlock(),p.createElementBlock("div",Ble,[p.createElementVNode("img",{src:u.value.homeTeam.logo||"/default-logo.png",alt:"Team 1 Logo"},null,8,Vle)])):(p.openBlock(),p.createElementBlock("svg",Fle,[p.createElementVNode("path",{d:"M80.0068 0.953125C80.0068 0.953125 91.0143 12.208 118.141 12.9913C140.898 13.6509 149.102 7.87917 149.102 7.87917C149.102 7.87917 169.839 67.5339 135.786 117.212C117.894 143.308 83.5935 160.211 79.9656 160.953C76.3789 160.211 42.0372 143.308 24.1449 117.212C-9.8257 67.5339 10.9112 7.87917 10.9112 7.87917C10.9112 7.87917 19.1153 13.6509 41.8723 12.9913C68.9993 12.208 80.0068 0.953125 80.0068 0.953125Z",fill:t.value.homeTeam,opacity:t.value.opacity},null,8,jle)])),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Ule,p.toDisplayString(v.value[0]),1)):p.createCommentVNode("",!0)]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",qle,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(u.value.homeTeam.goalsEvents,(A,I)=>(p.openBlock(),p.createElementBlock("div",{key:`goal-${I}`,class:"goal"},[p.createElementVNode("div",null,p.toDisplayString(A.playerName),1),N[9]||(N[9]=p.createElementVNode("div",{class:"bullet"},null,-1)),p.createElementVNode("div",null,p.toDisplayString(A.goalTime),1),N[10]||(N[10]=p.createStaticVNode('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1))]))),128))])):p.createCommentVNode("",!0)]),N[13]||(N[13]=p.createElementVNode("div",{class:"separator"},null,-1)),p.createElementVNode("div",Wle,[p.createElementVNode("div",Gle,[r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Hle,p.toDisplayString(v.value[1]),1)):p.createCommentVNode("",!0),u.value.awayTeam.logo?(p.openBlock(),p.createElementBlock("div",Xle,[p.createElementVNode("img",{src:u.value.awayTeam.logo||"/default-logo.png",alt:"Team 2 Logo"},null,8,Jle)])):(p.openBlock(),p.createElementBlock("svg",Kle,[p.createElementVNode("path",{d:"M80.8504 0.953125C80.8504 0.953125 92.9822 3.39499 119.261 10.1779C144.106 16.5733 152.827 19.1314 152.827 19.1314C152.827 19.1314 156.936 44.2089 145.657 90.5655C136.548 127.969 106.742 152.038 80.8504 160.953C54.9977 152.038 25.1527 128.007 16.0442 90.5655C4.8039 44.2477 8.91243 19.1314 8.91243 19.1314C8.91243 19.1314 17.6334 16.5733 42.4783 10.1779C68.7574 3.39499 80.8504 0.953125 80.8504 0.953125Z",fill:t.value.awayTeam,opacity:t.value.opacity},null,8,Zle)]))]),r.isPostMatch?(p.openBlock(),p.createElementBlock("div",Yle,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(u.value.awayTeam.goalsEvents,(A,I)=>(p.openBlock(),p.createElementBlock("div",{key:`goal-a-${I}`,class:"goal"},[N[11]||(N[11]=p.createStaticVNode('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-0364d256><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0268 2.83594C6.09038 2.83594 2.89844 6.01986 2.89844 9.94705C2.89844 13.8742 6.09038 17.0582 10.0268 17.0582C13.9632 17.0582 17.1551 13.8742 17.1551 9.94705C17.1551 6.01986 13.9632 2.83594 10.0268 2.83594V2.83594Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path fill-rule="evenodd" clip-rule="evenodd" d="M8.0826 12.9597L6.87109 9.2304L10.0401 6.92578L13.2097 9.2304L11.9995 12.9597H8.0826Z" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M12.7277 3.39453L10.0276 4.54375L7.32812 3.39453" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.65662 5.34766L4.91603 8.27341L2.98828 10.4871" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.01562 13.6523L6.87533 14.3093L8.38436 16.8279" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.7031 16.8213L13.2109 14.3015L16.0697 13.6445" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M17.1051 10.4865L15.1758 8.27156L15.4349 5.34766" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M10.0456 4.54688V6.92693" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M13.2109 9.32248L15.1681 8.27344" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M11.9961 12.9609L13.2064 14.3086" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M8.08198 12.9609L6.87109 14.3099" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path><path d="M4.91797 8.27344L6.87609 9.22818" stroke="white" stroke-width="1.36665" stroke-linecap="round" stroke-linejoin="round" data-v-0364d256></path></svg>',1)),p.createElementVNode("div",null,p.toDisplayString(A.goalTime),1),N[12]||(N[12]=p.createElementVNode("div",{class:"bullet"},null,-1)),p.createElementVNode("div",null,p.toDisplayString(A.playerName),1)]))),128))])):p.createCommentVNode("",!0)])]))],4))}},$le=dd(Qle,[["__scopeId","data-v-0364d256"]]),ece={class:"floating-bar"},tce={class:"tab active"},rce={class:"select-display"},nce={class:"select-icon"},ice=["src"],ace={key:1,src:"https://golstatsimages.blob.core.windows.net/images-library/vector2.png",alt:"icono",class:"option-img-default"},oce={key:0,class:"select-placeholder select-label"},sce={key:1,class:"select-label"},lce={key:0,class:"dropdown-menu field-menu"},cce=["onClick"],uce={class:"option-icon"},dce=["src","data-hover-src"],hce={class:"option-content"},pce={class:"option-title"},fce={key:0,class:"option-description"},mce={class:"select-display"},gce={class:"select-icon"},yce=["src"],vce=["src"],xce={class:"select-label"},bce={key:0,class:"dropdown-menu type-menu type-menu-grid"},_ce={class:"option-grid"},wce=["onClick"],Tce={class:"option-grid-title"},kce={class:"option-grid-icon"},Sce=["src"],Ece={key:1,class:"filter-separator"},Ace=["onClick"],Cce={class:"select-display"},Mce={key:0,class:"badge-categorias"},Lce={key:0,class:"dropdown-menu type-menu multi-select-menu"},Nce={class:"multi-select-scroll-area"},Ice={class:"select-all-checkbox"},Rce=["checked","indeterminate","onChange"],Oce={class:"option-checkbox"},Pce=["checked","onChange"],zce=["onClick"],Dce={class:"option-title"},Bce={class:"multi-select-footer"},Vce={key:1,class:"custom-radio-group filter-inline"},Fce={class:"radio-label"},jce={class:"radio-options"},Uce=["name","value","onUpdate:modelValue","disabled","onChange"],qce={key:2,class:"check-group filter-inline"},Wce=["onUpdate:modelValue","checked","onChange"],Gce=["data-filter-type","onClick"],Hce={class:"select-display"},Xce={key:0,class:"dropdown-menu type-menu simple-select-menu"},Jce={class:"simple-select-scroll-area"},Kce=["onMouseenter","onClick"],Zce={class:"option-content"},Yce={class:"option-title"},Qce={key:0,class:"option-checkmark"},$ce={key:4,class:"filter-separator"},eue=Object.assign({name:"FloatingFiltersBar"},{__name:"filters",props:{token:{type:String,required:!0},view:{type:Object,default:()=>null},isPostMatch:{type:Boolean,default:!1},filters_edition_mode:{type:Array,default:()=>null}},emits:["filters-changed","close"],setup(r,{expose:a,emit:g}){const B=r,K=g,C=p.ref([]);let b=null,t=null,v=null;const u=p.ref(!1),e=p.ref(!1),w=p.ref(!1),y=p.ref(!1),x=p.ref(!1),h=p.ref(!1),n=p.computed(()=>C.value),i=p.ref(null),d=p.computed(()=>n.value[i.value]||null),s=p.computed(()=>{var ve;const ye=((ve=d.value)==null?void 0:ve.views)||[];return I(ye)}),c=p.ref(null),f=p.computed(()=>s.value.find(ve=>ve.id===c.value)||null),m=p.ref([]),T=p.computed(()=>{var ve,ye;return u.value?((ve=f.value)==null?void 0:ve.filters_edition_mode)||[]:((ye=f.value)==null?void 0:ye.filters)||[]});p.watch(u,ve=>{ve||(e.value=!1)}),p.watch(f,ve=>{var ye,De;if(!ve){m.value=[];return}const Re=ve.id===6&&B.isPostMatch;if(!Array.isArray(T.value)&&!Re){m.value=[];return}if(y.value)return;Re?m.value=[]:m.value=T.value.map((We,Je)=>{var ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et;if(We.type==="select"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt){if(tt.selectedOptions&&Array.isArray(tt.selectedOptions)){const st=tt.selectedOptions.map(Xe=>Xe.value);return console.log(`Using saved select values for filter ${Je}:`,st),st}else if(tt.selectedValue&&Array.isArray(tt.selectedValue))if(tt.selectedValue.length>0&&tt.selectedValue[0]&&typeof tt.selectedValue[0]=="object"){const st=Ge(tt.selectedValue);return console.log(`Using saved Timeline values for filter ${Je}:`,st),st}else return console.log(`Using saved selectedValue for filter ${Je}:`,tt.selectedValue),tt.selectedValue}}if(ve.id===4&&We.options&&Array.isArray(We.options)){const tt=We.options.map(st=>st.value);return console.log(`Timeline detected - preselecting all options for filter ${Je}:`,tt),console.log("Timeline - filter options:",We.options),console.log("Timeline - filter type:",We.type),tt}return[]}else if(We.type==="radio-button"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.selectedOption)return console.log(`Using saved radio-button value for filter ${Je}:`,tt.selectedOption.value),tt.selectedOption.value}if(ve.id===7&&u.value&&t!=null&&t.view){if(console.log(`GSCGoalData - checking for stored values in initialization for filter ${Je}:`,t.view),console.log("GSCGoalData - filter index:",Je,"filter type:",We.type,"filter label:",We.label),Je===0&&(ke=t.view.componentProps)!=null&&ke.analysisType){const tt=t.view.componentProps.analysisType,st=tt==="offensive"?1:2;return console.log(`GSCGoalData - setting radio-button filter ${Je} to analysis value:`,st,"analysisType:",tt),console.log("GSCGoalData - filter options:",We.options),st}if(Je===1&&((ze=t.view.filterMultiple)==null?void 0:ze.isHomeTeam)!==void 0){const tt=t.view.filterMultiple.isHomeTeam,st=tt?1:2;return console.log(`GSCGoalData - setting radio-button filter ${Je} to team value:`,st,"isHomeTeam:",tt),console.log("GSCGoalData - filter options:",We.options),st}console.log(`GSCGoalData - filter index ${Je} - no stored value found or not applicable`)}else console.log(`GSCGoalData - conditions not met: newVal.id=${ve.id}, isEditMode=${u.value}, hasView=${!!(t!=null&&t.view)}`);return((He=(Fe=We.options)==null?void 0:Fe[0])==null?void 0:He.value)??null}else if(We.type==="select-simple"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.selectedValue!==void 0){console.log(`Using saved select-simple value for filter ${Je}:`,tt.selectedValue),console.log("Saved selectedValue type:",typeof tt.selectedValue),console.log("Saved selectedValue is array:",Array.isArray(tt.selectedValue));let st;return ve.id===2&&(nt=(rt=t==null?void 0:t.view)==null?void 0:rt.filterMultiple)!=null&&nt.categoryId?(st=t.view.filterMultiple.categoryId,console.log("GSCtops - using filterMultiple.categoryId in initialization:",st)):ve.id===1&&(vt=(ht=t==null?void 0:t.view)==null?void 0:ht.filterMultiple)!=null&&vt.category?(st=t.view.filterMultiple.category,console.log("GSCComparativeReports - using filterMultiple.category in initialization:",st)):ve.id===6&&(Rt=(ft=t==null?void 0:t.view)==null?void 0:ft.filterMultiple)!=null&&Rt.gameNumber?(st=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - using filterMultiple.gameNumber in initialization:",st)):st=Array.isArray(tt.selectedValue)?tt.selectedValue[0]:tt.selectedValue,console.log(`Returning select-simple value for filter ${Je}:`,st),st}}if(ve.id===2&&u.value&&t!=null&&t.view){if(b&&t.view.id){const tt=b.getComponentDynamicFilters(t.view.id);if(tt&&tt[Je]!==void 0)return console.log(`GSCtops - using component specific filter for index ${Je}:`,tt[Je]),tt[Je]}if(t.view.filterMultiple){if(console.log("111 ************************************************************",t.view.filterMultiple),We.type==="select-simple"&&t.view.filterMultiple.categoryId){const tt=t.view.filterMultiple.categoryId,st=(We.options||[]).find(Xe=>Xe.value==tt);return console.log("GSCtops - matching option in initialization:",st),tt}if(We.type==="radio-button"&&t.view.filterMultiple.teamType!==void 0){const tt=t.view.filterMultiple.teamType;return(We.options||[]).find(st=>st.value==tt)?(console.log("GSCtops - returning teamType:",tt),tt):(console.log("GSCtops - no matching option found for teamType:",tt),console.log("GSCtops - returning teamType anyway for consistency:",tt),tt)}else console.log("GSCtops - radio-button condition not met:",{isRadioButton:We.type==="radio-button",hasTeamType:t.view.filterMultiple.teamType!==void 0,teamType:t.view.filterMultiple.teamType})}}if(ve.id===1&&u.value&&(Ft=t==null?void 0:t.view)!=null&&Ft.filterMultiple&&(console.log(`GSCComparativeReports - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),t.view.filterMultiple.category)){const tt=t.view.filterMultiple.category,st=(We.options||[]).find(Xe=>Xe.value==tt);return console.log("GSCComparativeReports - matching option in initialization:",st),tt}if(ve.id===9&&u.value&&(Bt=t==null?void 0:t.view)!=null&&Bt.filterMultiple&&(console.log(`GSCFieldDataByZones - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),We.type==="select-simple"&&t.view.filterMultiple.categoryIds)){const tt=Array.isArray(t.view.filterMultiple.categoryIds)?t.view.filterMultiple.categoryIds:[t.view.filterMultiple.categoryIds];console.log(`GSCFieldDataByZones - setting select-simple filter ${Je} to categoryIds:`,tt),console.log("GSCFieldDataByZones - categoryIds type in initialization:",typeof tt),console.log("GSCFieldDataByZones - filter options in initialization:",We.options);const st=(We.options||[]).filter(Xe=>Array.isArray(Xe.value)?Ce(Xe.value,tt):tt.includes(Xe.value));if(st.length>0){const Xe=st[0];return console.log("GSCFieldDataByZones - found matching option in initialization:",Xe),Xe.value}else return console.log("GSCFieldDataByZones - no matching options found, using categoryIds directly:",tt),tt}if(ve.id===6&&u.value&&(at=t==null?void 0:t.view)!=null&&at.filterMultiple&&(console.log(`GSCLineupsReports - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),t.view.filterMultiple.gameNumber)){const tt=t.view.filterMultiple.gameNumber;console.log(`GSCLineupsReports - setting select-simple filter ${Je} to gameNumber:`,tt),console.log("GSCLineupsReports - gameNumber type in initialization:",typeof tt),console.log("GSCLineupsReports - filter options in initialization:",We.options);const st=(We.options||[]).find(Xe=>Xe.value==tt);return console.log("GSCLineupsReports - matching option in initialization:",st),tt}if(ve.id===5&&u.value&&(Ze=t==null?void 0:t.view)!=null&&Ze.filterMultiple&&(console.log(`GSCVolumetricField - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),console.log("GSCVolumetricField - filter details:",{type:We.type,label:We.label,options:We.options}),t.view.filterMultiple.isHomeTeam!==void 0)){const tt=t.view.filterMultiple.isHomeTeam;console.log(`GSCVolumetricField - setting radio-button filter ${Je} to isHomeTeam:`,tt),console.log("GSCVolumetricField - isHomeTeam type in initialization:",typeof tt),console.log("GSCVolumetricField - filter options in initialization:",We.options);let st;typeof tt=="boolean"?(st=tt?1:2,console.log("GSCVolumetricField - isHomeTeam is boolean in initialization, converting:",tt,"-> teamValue:",st)):typeof tt=="number"?(st=tt===1?1:2,console.log("GSCVolumetricField - isHomeTeam is number in initialization, using directly:",tt,"-> teamValue:",st)):(st=1,console.log("GSCVolumetricField - isHomeTeam is unknown type in initialization, using default:",st));const Xe=(We.options||[]).find(lt=>lt.value==st);if(console.log("GSCVolumetricField - matching option in initialization:",Xe),We.type==="radio-button"&&(We.label==="Equipo"||We.label==="Team"||We.label==="Equipo seleccionado"))return console.log("GSCVolumetricField - applying team filter value:",st),st;console.log("GSCVolumetricField - filter is not a team filter, skipping:",We.label)}if(ve.id===9&&u.value&&(ct=t==null?void 0:t.view)!=null&&ct.filterMultiple&&(console.log(`GSCFieldDataByZones - checking filterMultiple in initialization for filter ${Je}:`,t.view.filterMultiple),We.type==="radio-button"&&t.view.filterMultiple.isHomeTeam!==void 0)){const tt=t.view.filterMultiple.isHomeTeam,st=tt?1:2;console.log(`GSCFieldDataByZones - setting radio-button filter ${Je} to team value:`,st,"isHomeTeam:",tt),console.log("GSCFieldDataByZones - filter options:",We.options);const Xe=((gt=We.options)==null?void 0:gt.map(lt=>lt.value))||[];return Xe.includes(st)?(console.log("GSCFieldDataByZones - using valid team value from filterMultiple:",st),st):(console.log("GSCFieldDataByZones - team value not in valid options, using default:",Xe[0]),Xe[0]||1)}return((Et=(Nt=We.options)==null?void 0:Nt[0])==null?void 0:Et.value)??null}else if(We.type==="check"){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.isChecked!==void 0)return console.log(`Using saved checkbox value for filter ${Je}:`,tt.isChecked),tt.isChecked}if(ve.id===8)return!0;if(ve.id===3){if(u.value&&v&&v.dynamicFilters){const tt=v.dynamicFilters[Je];if(tt&&tt.isChecked!==void 0)return console.log(`GSCMatchSummary - Using saved checkbox value for filter ${Je}:`,tt.isChecked),tt.isChecked}return!1}return!1}return null});const Ve=((ye=ve.name)==null?void 0:ye.toLowerCase().includes("tops players"))||((De=ve.title)==null?void 0:De.toLowerCase().includes("tops players"));!Ve&&(!u.value||Re)&&p.nextTick(()=>{var We,Je,ke;console.log("Timeline - about to emit change:",{esTopsPlayers:Ve,isEditMode:u.value,selectedSecond:(We=f.value)==null?void 0:We.id}),ve.id===4&&u.value&&(Je=t==null?void 0:t.view)!=null&&Je.id&&(console.log("Timeline - saving specific filters for component:",t.view.id),b&&b.setDynamicFilters(m.value,t.view.id)),ve.id===3&&u.value&&(ke=t==null?void 0:t.view)!=null&&ke.id&&(console.log("GSCMatchSummary - saving specific filters for component:",t.view.id),b&&b.setDynamicFilters(m.value,t.view.id)),he()})},{immediate:!0}),p.watch(()=>b,ve=>{ve&&ve.dynamicFilters&&(console.log("FilterAndViewsContainer changed, updating dynamicFilters:",ve.dynamicFilters),Array.isArray(ve.dynamicFilters)&&(y.value=!0,m.value=[...ve.dynamicFilters],p.nextTick(()=>{y.value=!1})))},{deep:!0}),p.watch(()=>b==null?void 0:b.dynamicFilters,ve=>{if(ve&&Array.isArray(ve)){if(console.log("Container dynamicFilters changed, updating:",ve),x.value){console.log("Skipping container update due to user update in progress");return}y.value=!0,m.value=[...ve],p.nextTick(()=>{y.value=!1})}},{deep:!0}),p.watch(()=>f.value,ve=>{if(u.value&&v&&ve&&ve.filters){if(y.value)return;if(h.value){console.log("Skipping force updates in selectedSecond watcher - already in force update");return}if(ve.id===3){if(console.log("GSCMatchSummary detected in edit mode, loading saved filters"),x.value||h.value){console.log("GSCMatchSummary - Skipping due to update in progress");return}const ye=v.dynamicFilters.find(De=>De.filterType==="check");ye&&ye.isChecked!==void 0&&(console.log("GSCMatchSummary - Found saved checkbox value:",ye.isChecked),m.value&&m.value.length>0&&(x.value=!0,m.value[0]=ye.isChecked,console.log("GSCMatchSummary - Updated dynamicFilters:",m.value),p.nextTick(()=>{m.value=[...m.value],console.log("GSCMatchSummary - Forced UI update"),x.value=!1})))}setTimeout(()=>{(!m.value||m.value.length===0)&&(Ne(),Le(),je()),ve.id===4&&Oe()},100)}},{deep:!0}),p.watch(()=>{var ve;return(ve=f.value)==null?void 0:ve.id},ve=>{if(u.value&&v&&ve===4){if(console.log("Timeline detected, preselecting filters"),y.value)return;if(h.value){console.log("Skipping force updates in Timeline watcher - already in force update");return}setTimeout(()=>{Oe()},200)}}),p.watch(()=>m.value,ve=>{if(u.value&&v&&ve&&ve.length>0){if(console.log("(((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))",v),console.log("Dynamic filters initialized, forcing update"),y.value||x.value)return;if(h.value){console.log("Skipping force updates - already in force update");return}setTimeout(()=>{var ye;me()&&(Ne(),Le(),je(),((ye=f.value)==null?void 0:ye.id)===4&&Oe())},50)}},{deep:!0});function E(ve,ye){var De,Re,Ve,We,Je;const ke=m.value[ve];if(((De=f.value)==null?void 0:De.id)===4&&ve===0&&console.log("Timeline filter check - optionValue:",ye,"selectedValues:",ke),((Re=f.value)==null?void 0:Re.id)===6&&ve===0&&console.log("GSCLineupsReports filter check - optionValue:",ye,"selectedValues:",ke,"type:",typeof ke),Array.isArray(ke)){if(((Ve=f.value)==null?void 0:Ve.id)===4&&ve===0){const ze=ke.some(Fe=>ye.category_id&&ye.event_type_id?Fe.category_id===ye.category_id&&Fe.event_type_id===ye.event_type_id:ye.event_type_id?Fe.event_type_id===ye.event_type_id:ye.category_id?Fe.category_id===ye.category_id:!1);return((We=f.value)==null?void 0:We.id)===4&&ve===0&&console.log("Timeline comparison (IDs) - optionValue:",ye,"selectedValues:",ke,"isSelected:",ze),ze}return ke.includes(ye)}else if(ke!=null){if(((Je=f.value)==null?void 0:Je.id)===6&&ve===0){const ze=ke===ye;return console.log("GSCLineupsReports comparison - optionValue:",ye,"selectedValues:",ke,"isSelected:",ze),ze}return ke===ye}return!1}function S(ve,ye){var De,Re;const Ve=(Re=(De=f.value)==null?void 0:De.filters)==null?void 0:Re[ve];if((Ve==null?void 0:Ve.type)==="select-simple"){console.log("toggleMultiSelectOption called for select-simple filter, using selectSimpleOption instead"),ae(ve,ye);return}Array.isArray(m.value[ve])||(m.value[ve]=[]);const We=m.value[ve],Je=We.indexOf(ye);Je>-1?We.splice(Je,1):We.push(ye),u.value&&Ie(),he()}function L(ve){var ye,De;const Re=m.value[ve],Ve=(De=(ye=f.value)==null?void 0:ye.filters)==null?void 0:De[ve];return(Ve==null?void 0:Ve.type)==="select-simple"||!Ve||!Ve.options||!Array.isArray(Re)?!1:Re.length===Ve.options.length}function N(ve){var ye,De;const Re=m.value[ve],Ve=(De=(ye=f.value)==null?void 0:ye.filters)==null?void 0:De[ve];return(Ve==null?void 0:Ve.type)==="select-simple"||!Ve||!Ve.options||!Array.isArray(Re)?!1:Re.length>0&&Re.length<Ve.options.length}function A(){var ve;return console.log("props.isPostMatch",B.isPostMatch),!(((ve=f.value)==null?void 0:ve.id)===6&&B.isPostMatch)}function I(ve){return!ve||!Array.isArray(ve)?ve:ve.filter(ye=>{const De=(ye.name||ye.title||"").toLowerCase();return B.isPostMatch?B.isPostMatch?!["fortalezas","tabla general"].some(Re=>De.includes(Re)):!0:!["resumen general","timeline","datos relevantes"].some(Re=>De.includes(Re))})}function M(){var ve,ye;const De=((ye=(ve=d.value)==null?void 0:ve.name)==null?void 0:ye.toLowerCase())||"";return De.includes("cancha")||De.includes("volumétrica")||De.includes("volumetric")}function k(ve,ye){if(!u.value||!M())return!1;const De=String(ve||"").toLowerCase(),Re=String(ye||"").toLowerCase();return De.includes("ambos")||Re.includes("ambos")}function R(ve){var ye,De;const Re=(De=(ye=f.value)==null?void 0:ye.filters)==null?void 0:De[ve];if(!Re||!Re.options)return;const Ve=Re.options.map(We=>We.value);Array.isArray(m.value[ve])||(m.value[ve]=[]),L(ve)?m.value[ve]=[]:m.value[ve]=[...Ve],V.value=ve,he()}const _=p.ref("ambos"),O=p.ref(!1),z=p.ref(!1),V=p.ref(null),U=p.ref(null);function q(ve,ye=!1){const De="https://golstatsimages.blob.core.windows.net/images-library/",Re="https://golstatsimages.blob.core.windows.net/reports-images/",Ve={cancha:"icn_cancha",grafico:"icn_grafico",gráfico:"icn_grafico",chart:"icn_grafico",volumetrica:"icn_cancha",volumétrica:"icn_cancha",volumetric:"icn_cancha",tabla:"icn_tabla",tablas:"icn_tabla",Tablas:"icn_tabla"},We=Object.keys(Ve).find(Je=>ve==null?void 0:ve.toLowerCase().includes(Je.toLowerCase()));if(We){const Je=Ve[We],ke=ye?"":"-def";return We.toLowerCase().includes("tabla")?`${Re}${Je}${ke}@2x.png`:`${De}${Je}${ke}@2x.png`}return`${De}icn_default${ye?"":"-def"}.png`}function W(){return d.value?d.value.name:"Tipo de vista"}function Y(){return f.value?f.value.name||f.value.title:"Visualización"}function ne(){u.value||(O.value=!O.value,O.value&&(z.value=!1,p.nextTick(()=>{Se()})))}function X(){u.value||d.value&&(z.value=!z.value,z.value&&(O.value=!1))}function re(ve){u.value||(i.value=ve,O.value=!1,c.value=null,he())}function ee(ve){var ye,De;u.value||(c.value=ve.id,z.value=!1,(ye=ve.name)!=null&&ye.toLowerCase().includes("tops players")||(De=ve.title)==null||De.toLowerCase().includes("tops players"))}function Z(ve){var ye;V.value=V.value===ve?null:ve,((ye=f.value)==null?void 0:ye.id)===4&&u.value&&ve===0&&(console.log("Timeline dropdown opened, forcing checkbox update"),setTimeout(()=>{m.value=[...m.value]},50))}function te(ve){U.value=U.value===ve?null:ve}function ae(ve,ye){var De,Re,Ve,We,Je,ke,ze;if(console.log("selectSimpleOption called:",{idx:ve,optionValue:ye,isEditMode:u.value}),((De=f.value)==null?void 0:De.id)===2){console.log("GSCtops - selectSimpleOption for GSCtops");const Fe=T.value.findIndex(He=>He.type==="select-simple"&&He.label==="Tipo de análisis");ve===Fe?(m.value[0]=ye,console.log("GSCtops - updated dynamicFilters[0] (category) to:",ye)):(m.value[ve]=ye,console.log("GSCtops - updated dynamicFilters["+ve+"] to:",ye))}else if(((Re=f.value)==null?void 0:Re.id)===1)console.log("GSCComparativeReports - selectSimpleOption for GSCComparativeReports"),m.value[0]=ye,console.log("GSCComparativeReports - updated dynamicFilters[0] (analysis type) to:",ye);else if(((Ve=f.value)==null?void 0:Ve.id)===6)console.log("GSCLineupsReports - selectSimpleOption for GSCLineupsReports"),m.value[0]=ye,console.log("GSCLineupsReports - updated dynamicFilters[0] (game number) to:",ye);else if(((We=f.value)==null?void 0:We.id)===9)if(console.log("GSCFieldDataByZones - selectSimpleOption for GSCFieldDataByZones"),ve===0){Array.isArray(ye)?(m.value[ve]=ye,console.log("GSCFieldDataByZones - updated dynamicFilters[0] (categories) to:",ye)):(m.value[ve]=[ye],console.log("GSCFieldDataByZones - converted to array and updated dynamicFilters[0] (categories) to:",[ye]));const Fe=((Je=T.value[ve])==null?void 0:Je.options)||[];console.log("GSCFieldDataByZones - filterOptions for comparison:",Fe);const He=Array.isArray(ye)?ye:[ye],rt=Fe.find(nt=>Array.isArray(nt.value)?Ce(nt.value,He):He.includes(nt.value));console.log("GSCFieldDataByZones - matching option found:",rt),rt?(console.log("GSCFieldDataByZones - using matching option value:",rt.value),m.value[ve]=rt.value,console.log("GSCFieldDataByZones - updated dynamicFilters["+ve+"] to matching option value:",rt.value)):(console.log("GSCFieldDataByZones - no matching option found, using selectedValue directly"),m.value[ve]=He)}else m.value[ve]=ye,console.log("GSCFieldDataByZones - updated dynamicFilters["+ve+"] to:",ye);else m.value[ve]=ye;U.value=null,console.log("dynamicFilters after selectSimpleOption:",m.value),((ke=f.value)==null?void 0:ke.id)===6&&(console.log("GSCLineupsReports - selectSimpleOption called"),console.log("GSCLineupsReports - isEditMode:",u.value),console.log("GSCLineupsReports - viewToEdit:",t),console.log("GSCLineupsReports - dynamicFilters:",m.value)),!(u.value&&(console.log("calling updateContainerOnUserChange"),console.log("isEditMode.value:",u.value),console.log("viewToEdit:",t),console.log("filterAndViewsContainer:",b),Ie(),((ze=f.value)==null?void 0:ze.id)===9))&&(console.log("calling emitChange"),he())}function oe(ve){ve.target.closest(".custom-select")||(O.value=!1,z.value=!1,U.value=null)}function he(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st,Xe,lt,Tt;if(console.log("emitChange called"),console.log("isEditMode.value:",u.value),console.log("viewToEdit:",t),console.log("dynamicFilters.value:",m.value),y.value){console.log("Skipping emitChange due to container update in progress");return}((ve=f.value)==null?void 0:ve.id)===8&&(console.log("FieldPosesion detected - dynamicFilters:",m.value),console.log("Current filters:",T.value)),((ye=f.value)==null?void 0:ye.id)===4&&(console.log("Timeline detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("Timeline - will emit change:",!y.value)),((De=f.value)==null?void 0:De.id)===2&&(console.log("GSCtops detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("GSCtops - will emit change:",!y.value)),((Re=f.value)==null?void 0:Re.id)===6&&(console.log("GSCLineupsReports detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("GSCLineupsReports - will emit change:",!y.value),console.log("GSCLineupsReports - isEditMode:",u.value),console.log("GSCLineupsReports - viewToEdit:",t)),((Ve=f.value)==null?void 0:Ve.id)===9&&(console.log("GSCFieldDataByZones detected - dynamicFilters:",m.value),console.log("Current filters:",T.value),console.log("GSCFieldDataByZones - will emit change:",!y.value),console.log("GSCFieldDataByZones - isEditMode:",u.value),console.log("GSCFieldDataByZones - viewToEdit:",t));let yt=[],It=[];f.value&&Array.isArray(T.value)&&T.value.forEach((xt,Pt)=>{if(xt.type==="select"&&xt.label==="Tipo de análisis"&&xt.id===2){const Ot=m.value[Pt]||[];Array.isArray(Ot)&&Ot.length>0&&(yt=Ot.map(kt=>{var Ht;const qt=(Ht=xt.options)==null?void 0:Ht.find(Jt=>Jt.value===kt);return{value:kt,label:(qt==null?void 0:qt.label)||kt}}))}});const Lt=((We=f.value)==null?void 0:We.id)===4;if(f.value&&Array.isArray(f.value.filters)&&f.value.filters.some(xt=>xt.type==="select"&&xt.label==="Tipo de análisis"&&xt.id===2)&&yt.length===0&&!Lt)return;if(Lt&&m.value&&m.value.length>0){const xt=m.value[0];Array.isArray(xt)&&xt.length>0&&console.log("Timeline - emitting change with events:",xt)}It=((Je=T.value)==null?void 0:Je.map((xt,Pt)=>{var Ot,kt,Ht,qt,Jt;const Wt=m.value[Pt];((Ot=f.value)==null?void 0:Ot.id)===8&&console.log(`FieldPosesion filter ${Pt}:`,{type:xt.type,label:xt.label,selectedValue:Wt,selectedValueType:typeof Wt,isRadioButton:xt.type==="radio-button"});let Gt=xt.id||`filter_${Pt}`;return((kt=f.value)==null?void 0:kt.id)===3&&u.value&&(Ht=t==null?void 0:t.view)!=null&&Ht.id&&(Gt=`filter_${Pt}_component_${t.view.id}`,console.log(`GSCMatchSummary - Generated unique filterId: ${Gt} for component ${t.view.id}`)),{filterId:Gt,filterType:xt.type,filterLabel:xt.label,filterIcon:xt.icon||null,selectedValue:Wt,selectedOptions:xt.type==="select"&&Array.isArray(Wt)&&Wt.length>0?Wt.map(rr=>{var ir;const vr=(ir=xt.options)==null?void 0:ir.find(kr=>kr.value===rr);return{value:rr,label:(vr==null?void 0:vr.label)||rr,icon:(vr==null?void 0:vr.icon)||null}}):null,selectedOption:xt.type==="radio-button"&&Wt!=null?{value:Wt,label:((Jt=(qt=xt.options)==null?void 0:qt.find(rr=>rr.value===Wt))==null?void 0:Jt.label)||Wt}:null,isChecked:xt.type==="check"?Wt:null}}))||[];const Qe={mainSelector:{id:((ke=d.value)==null?void 0:ke.id)||null,name:((ze=d.value)==null?void 0:ze.name)||null,url:((Fe=d.value)==null?void 0:Fe.url)||null},viewSelector:{id:((He=f.value)==null?void 0:He.id)||null,name:((rt=f.value)==null?void 0:rt.name)||((nt=f.value)==null?void 0:nt.title)||null,url:((ht=f.value)==null?void 0:ht.url)||null},team:_.value,dynamicFilters:It,categoriasSeleccionadas:yt,timestamp:new Date().toISOString(),summary:{mainSelected:!!d.value,viewSelected:!!f.value,totalDynamicFilters:((vt=T.value)==null?void 0:vt.length)||0,activeFilters:((ft=T.value)==null?void 0:ft.filter((xt,Pt)=>{const Ot=m.value[Pt];return Array.isArray(Ot)?Ot.length>0:Ot!=null&&Ot!==!1}).length)||0}};t&&(console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"),console.log("viewToEdit.view.filterAndViewsContainer",t.view.filterAndViewsContainer),console.log("viewToEdit.view.filterAndViewsContainer.childViews.length",t.view.filterAndViewsContainer.childViews.length));const et={main:d.value,view:f.value,team:_.value,dynamicFilters:m.value,filtersJSON:Qe,filterAndViewsContainer:b,viewToEdit:t};if(console.log("GSCtops - emitting filters-changed with data:",et),K("filters-changed",et),u.value&&t){if(v=Qe,console.log("Updated editFiltersJSON:",v),((Rt=f.value)==null?void 0:Rt.id)===8&&(console.log("FieldPosesion - editFiltersJSON updated:",v),console.log("FieldPosesion - dynamicFilters in JSON:",v.dynamicFilters)),((Ft=f.value)==null?void 0:Ft.id)===2){console.log("GSCtops - editFiltersJSON updated:",v),console.log("GSCtops - dynamicFilters in JSON:",v.dynamicFilters),console.log("GSCtops - viewToEdit.filterMultiple:",(Bt=t.view)==null?void 0:Bt.filterMultiple);const xt=v.dynamicFilters.findIndex(Pt=>Pt.filterType==="select-simple"&&Pt.filterLabel==="Tipo de análisis");xt!==-1&&(Ze=(at=t.view)==null?void 0:at.filterMultiple)!=null&&Ze.categoryId&&(v.dynamicFilters[xt].selectedValue=t.view.filterMultiple.categoryId,console.log("GSCtops - updated editFiltersJSON with filterMultiple.categoryId:",t.view.filterMultiple.categoryId))}if(((ct=f.value)==null?void 0:ct.id)===1){console.log("GSCComparativeReports - editFiltersJSON updated:",v),console.log("GSCComparativeReports - dynamicFilters in JSON:",v.dynamicFilters),console.log("GSCComparativeReports - viewToEdit.filterMultiple:",(gt=t.view)==null?void 0:gt.filterMultiple);const xt=v.dynamicFilters.findIndex(Pt=>Pt.filterType==="select-simple"&&Pt.filterLabel==="Tipo de análisis");xt!==-1&&(Et=(Nt=t.view)==null?void 0:Nt.filterMultiple)!=null&&Et.category&&(v.dynamicFilters[xt].selectedValue=t.view.filterMultiple.category,console.log("GSCComparativeReports - updated editFiltersJSON with filterMultiple.category:",t.view.filterMultiple.category))}}if(((tt=f.value)==null?void 0:tt.id)===6&&u.value&&(st=t==null?void 0:t.view)!=null&&st.filterMultiple&&(console.log("GSCLineupsReports - viewToEdit.filterMultiple:",(Xe=t.view)==null?void 0:Xe.filterMultiple),t.view.filterMultiple.gameNumber&&v)){const xt=v.dynamicFilters.findIndex(Pt=>Pt.filterType==="select-simple"&&Pt.filterLabel==="Número de juego");xt!==-1&&(Tt=(lt=t.view)==null?void 0:lt.filterMultiple)!=null&&Tt.gameNumber&&(v.dynamicFilters[xt].selectedValue=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - updated editFiltersJSON with filterMultiple.gameNumber:",t.view.filterMultiple.gameNumber))}b&&!u.value?(b.setDynamicFilters(m.value),console.log("Updated container with new dynamicFilters:",m.value)):b&&u.value&&console.log("In edit mode, not updating container automatically")}function fe(){t=null,v=null,b=null,i.value=null,c.value=null,_.value="ambos",m.value=[],O.value=!1,z.value=!1,V.value=null,U.value=null,u.value=!1,e.value=!1,w.value=!1}function se(ve){if(ve&&ve.dynamicFilters){if(console.log("Updating filters from container:",ve.dynamicFilters),x.value){console.log("Skipping container update due to user update in progress");return}Array.isArray(ve.dynamicFilters)&&ve.dynamicFilters.length>0&&(y.value=!0,m.value=[...ve.dynamicFilters],p.nextTick(()=>{y.value=!1}))}}function ue(ve){if(console.log("preselectFiltersFromJSON called with:",ve),u.value=!0,ve.mainSelector&&ve.mainSelector.id){const ye=C.value.findIndex(De=>De.id===ve.mainSelector.id);ye!==-1&&(i.value=ye,console.log("Selected main index:",ye))}ve.viewSelector&&ve.viewSelector.id&&d.value&&d.value.views.findIndex(ye=>ye.id===ve.viewSelector.id)!==-1&&(c.value=ve.viewSelector.id,console.log("Selected second id:",ve.viewSelector.id)),ve.dynamicFilters&&Array.isArray(ve.dynamicFilters)&&(console.log("Processing dynamic filters:",ve.dynamicFilters),p.nextTick(()=>{setTimeout(()=>{var ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st,Xe,lt,Tt,yt,It;if(console.log("Processing filters after delay"),console.log("selectedSecond.value:",f.value),f.value&&T.value){if(console.log("Filters available:",T.value),y.value){console.log("Skipping preselect due to container update in progress");return}if(x.value=!0,console.log("&666&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",ve.dynamicFilters),ve.dynamicFilters.forEach((Lt,Qe)=>{var et,xt,Pt,Ot,kt,Ht,qt,Jt,Wt,Gt,rr,ir,vr,kr;if(Qe<T.value.length){const wr=T.value[Qe];if(((et=f.value)==null?void 0:et.id)===3&&u.value&&console.log(`GSCMatchSummary - Processing filter ${Qe} for component ${((xt=t==null?void 0:t.view)==null?void 0:xt.id)||"unknown"}`),wr.type==="check"){const ar=Lt.isChecked;console.log(`Setting check filter ${Qe} to:`,ar),typeof ar=="boolean"?(m.value[Qe]=ar,console.log(`Successfully set check filter ${Qe} to:`,ar)):console.log(`Invalid isChecked value for filter ${Qe}:`,ar)}else if(wr.type==="select"&&Lt.selectedOptions){const ar=Lt.selectedOptions.map(_r=>_r.value);console.log(`Setting select filter ${Qe} to:`,ar),m.value[Qe]=ar,console.log(`Successfully set select filter ${Qe} to:`,ar)}else if(wr.type==="select"&&Lt.selectedValue&&Array.isArray(Lt.selectedValue))if(Lt.selectedValue.length>0&&Lt.selectedValue[0]&&typeof Lt.selectedValue[0]=="object"){const ar=Ge(Lt.selectedValue);console.log(`Setting Timeline select filter ${Qe} to:`,ar),m.value[Qe]=ar,console.log(`Successfully set Timeline select filter ${Qe} to:`,ar)}else console.log(`Setting select filter ${Qe} to:`,Lt.selectedValue),m.value[Qe]=Lt.selectedValue,console.log(`Successfully set select filter ${Qe} to:`,Lt.selectedValue);else if(wr.type==="radio-button"&&Lt.selectedOption)console.log(`Setting radio filter ${Qe} to:`,Lt.selectedOption.value),m.value[Qe]=Lt.selectedOption.value;else if(wr.type==="select-simple"&&Lt.selectedValue!==void 0){console.log(`Setting select-simple filter ${Qe} to:`,Lt.selectedValue),console.log("select-simple filterData.selectedValue type:",typeof Lt.selectedValue),console.log("select-simple filterData.selectedValue is array:",Array.isArray(Lt.selectedValue));let ar;((Pt=f.value)==null?void 0:Pt.id)===2&&(kt=(Ot=t==null?void 0:t.view)==null?void 0:Ot.filterMultiple)!=null&&kt.categoryId?(ar=t.view.filterMultiple.categoryId,console.log("GSCtops - using filterMultiple.categoryId instead of selectedValue:",ar)):((Ht=f.value)==null?void 0:Ht.id)===1&&(Jt=(qt=t==null?void 0:t.view)==null?void 0:qt.filterMultiple)!=null&&Jt.category?(ar=t.view.filterMultiple.category,console.log("GSCComparativeReports - using filterMultiple.category instead of selectedValue:",ar)):((Wt=f.value)==null?void 0:Wt.id)===6&&(rr=(Gt=t==null?void 0:t.view)==null?void 0:Gt.filterMultiple)!=null&&rr.gameNumber?(ar=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - using filterMultiple.gameNumber instead of selectedValue:",ar)):((ir=f.value)==null?void 0:ir.id)===9&&(kr=(vr=t==null?void 0:t.view)==null?void 0:vr.filterMultiple)!=null&&kr.categoryIds?(ar=t.view.filterMultiple.categoryIds,console.log("GSCFieldDataByZones - using filterMultiple.categoryIds instead of selectedValue:",ar)):ar=Array.isArray(Lt.selectedValue)?Lt.selectedValue[0]:Lt.selectedValue,m.value[Qe]=ar,console.log(`Successfully set select-simple filter ${Qe} to:`,ar)}}else console.log(`Filter index ${Qe} out of range`)}),console.log("Final dynamicFilters.value:",m.value),((ye=f.value)==null?void 0:ye.id)===3&&u.value&&console.log("GSCMatchSummary - Final dynamicFilters after processing:",m.value),((De=f.value)==null?void 0:De.id)===2&&u.value&&(Re=t==null?void 0:t.view)!=null&&Re.filterMultiple){if(console.log("GSCtops - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("GSCtops - currentFilters:",T.value),console.log("GSCtops - dynamicFilters before:",m.value),t.view.filterMultiple.categoryId){console.log("GSCtops - found categoryId in filterMultiple:",t.view.filterMultiple.categoryId);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple"&&Qe.label==="Tipo de análisis");if(console.log("GSCtops - categoryFilterIndex:",Lt),console.log("GSCtops - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCtops - found category filter at index:",Lt);const Qe=t.view.filterMultiple.categoryId;if(console.log("GSCtops - setting category filter directly from filterMultiple.categoryId:",Qe),m.value[0]=Qe,t.view.componentProps&&Qe){let xt=`Category ${Qe}`,Pt=null;try{Pt=Vd(Qe),Pt&&(xt=Pt.name,console.log("GSCtops - found category info from getCategoryById in preselectFiltersFromJSON:",Pt))}catch{console.log("GSCtops - getCategoryById failed in preselectFiltersFromJSON, using filter options");const Ot=T.value.findIndex(kt=>kt.type==="select-simple"&&kt.label==="Tipo de análisis");if(Ot!==-1){const kt=(((Ve=T.value[Ot])==null?void 0:Ve.options)||[]).find(Ht=>Ht.value==Qe);kt&&(xt=kt.label,console.log("GSCtops - found category name from options in preselectFiltersFromJSON:",xt))}}t.view.componentProps.categoryView=[{id:Qe,name:xt}],console.log("GSCtops - updated componentProps.categoryView in preselectFiltersFromJSON:",t.view.componentProps.categoryView)}console.log("GSCtops - automatically set category filter to:",Qe),console.log("GSCtops - categoryId type:",typeof Qe),console.log("GSCtops - updated dynamicFilters:",m.value),console.log("GSCtops - filter options:",(We=T.value[Lt])==null?void 0:We.options);const et=(((Je=T.value[Lt])==null?void 0:Je.options)||[]).find(xt=>xt.value==Qe);console.log("GSCtops - matching option:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update")})}else console.log("GSCtops - category filter not found!")}if(t.view.filterMultiple.teamType!==void 0){console.log("GSCtops - found teamType in filterMultiple:",t.view.filterMultiple.teamType),console.log("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM ------------------------------------> ",T.value);const Lt=T.value.findIndex(Qe=>Qe.type==="radio-button");if(console.log("GSCtops - teamFilterIndex:",Lt),console.log("GSCtops - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCtops - found team filter at index:",Lt);const Qe=t.view.filterMultiple.teamType;console.log("GSCtops - setting team filter directly from filterMultiple.teamType:",Qe),m.value[Lt]=Qe,console.log("GSCtops - automatically set team filter to:",Qe),console.log("GSCtops - teamType type:",typeof Qe),console.log("GSCtops - updated dynamicFilters:",m.value),console.log("GSCtops - filter options:",(ke=T.value[Lt])==null?void 0:ke.options);const et=(((ze=T.value[Lt])==null?void 0:ze.options)||[]).find(xt=>xt.value==Qe);console.log("GSCtops - matching option for team:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update for team filter")})}else console.log("GSCtops - team filter not found!")}}if(((Fe=f.value)==null?void 0:Fe.id)===9&&u.value&&(He=t==null?void 0:t.view)!=null&&He.filterMultiple){if(console.log("55555 GSCFieldDataByZones - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("55555 GSCFieldDataByZones - currentFilters:",T.value),console.log(" 55555GSCFieldDataByZones - dynamicFilters before:",m.value),t.view.filterMultiple.categoryIds){console.log("55555 GSCFieldDataByZones - found categoryIds in filterMultiple:",t.view.filterMultiple.categoryIds);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple");if(console.log("55555 GSCFieldDataByZones - analysisTypeFilterIndex:",Lt),console.log("55555 GSCFieldDataByZones - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("55555 GSCFieldDataByZones - found analysis type filter at index:",Lt);const Qe=Array.isArray(t.view.filterMultiple.categoryIds)?t.view.filterMultiple.categoryIds:[t.view.filterMultiple.categoryIds];console.log("55555 GSCFieldDataByZones - setting category filter directly from filterMultiple.categoryIds:",Qe),m.value[0]=Qe,console.log("55555 GSCFieldDataByZones - automatically set category filter to:",Qe),console.log("55555 GSCFieldDataByZones - categoryIds type:",typeof Qe),console.log("55555 GSCFieldDataByZones - categoryIds is array:",Array.isArray(Qe)),console.log("55555 GSCFieldDataByZones - updated dynamicFilters:",m.value),console.log("55555 GSCFieldDataByZones - filter options:",(rt=T.value[Lt])==null?void 0:rt.options);const et=((nt=T.value[Lt])==null?void 0:nt.options)||[];console.log("55555 filterOptions :",et);const xt=et.filter(kt=>Array.isArray(kt.value)?Ce(kt.value,Qe):Qe.includes(kt.value));if(console.log("55555 GSCFieldDataByZones - matching options:",xt),xt.length>0){const kt=xt[0];console.log("55555 GSCFieldDataByZones - found matching option:",kt);const Ht=kt.value;console.log("55555 GSCFieldDataByZones - using option value:",Ht),m.value[Lt]=Ht,console.log("55555 GSCFieldDataByZones - set dynamicFilters["+Lt+"] to option value:",Ht)}else console.log("55555 GSCFieldDataByZones - no matching options found, using categoryIds directly"),m.value[Lt]=Qe;const Pt=m.value[Lt],Ot=Ce(Pt,Qe);console.log("55555 GSCFieldDataByZones - arrays match:",Ot),console.log("55555 GSCFieldDataByZones - current filter value:",Pt,"categoryIds:",Qe),p.nextTick(()=>{m.value=[...m.value],console.log("55555 GSCFieldDataByZones - forced reactivity update")})}else console.log("55555 GSCFieldDataByZones - analysis type filter not found!")}if(t.view.filterMultiple.isHomeTeam!==void 0){console.log("444444444 GSCFieldDataByZones - found isHomeTeam in filterMultiple:",t.view.filterMultiple.isHomeTeam);const Lt=T.value.findIndex(Qe=>Qe.type==="radio-button");if(console.log("444444444 GSCFieldDataByZones - teamFilterIndex:",Lt),console.log("444444444 GSCFieldDataByZones - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("444444444 GSCFieldDataByZones - found team filter at index:",Lt);const Qe=t.view.filterMultiple.isHomeTeam;console.log("444444444 GSCFieldDataByZones - isHomeTeam type:",typeof Qe,"value:",Qe);let et;typeof Qe=="boolean"?(et=Qe?1:2,console.log("444444444 GSCFieldDataByZones - converted boolean isHomeTeam to teamValue:",Qe,"->",et)):typeof Qe=="number"?(et=Qe===1?1:2,console.log("444444444 GSCFieldDataByZones - converted numeric isHomeTeam to teamValue:",Qe,"->",et)):(et=1,console.log("444444444 GSCFieldDataByZones - using default teamValue:",et)),console.log("444444444 GSCFieldDataByZones - setting team filter directly from filterMultiple.isHomeTeam:",Qe,"-> teamValue:",et),m.value[Lt]=et,console.log("444444444 GSCFieldDataByZones - automatically set team filter to:",et),console.log("444444444 GSCFieldDataByZones - teamValue type:",typeof et),console.log("444444444 GSCFieldDataByZones - updated dynamicFilters:",m.value),console.log(" 444444444 GSCFieldDataByZones - filter options:",(ht=T.value[Lt])==null?void 0:ht.options);const xt=(((vt=T.value[Lt])==null?void 0:vt.options)||[]).find(Pt=>Pt.value==et);console.log("444444444 GSCFieldDataByZones - matching option for team:",xt),p.nextTick(()=>{console.log("4444444 **************************************** dynamicFilters *************",m.value),m.value=[...m.value],console.log(" 444444444GSCFieldDataByZones - forced reactivity update for team filter")})}else console.log(" 444444444GSCFieldDataByZones - team filter not found!")}}if(((ft=f.value)==null?void 0:ft.id)===1&&u.value&&(Rt=t==null?void 0:t.view)!=null&&Rt.filterMultiple&&(console.log("GSCComparativeReports - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("GSCComparativeReports - currentFilters:",T.value),console.log("GSCComparativeReports - dynamicFilters before:",m.value),t.view.filterMultiple.category)){console.log("GSCComparativeReports - found category in filterMultiple:",t.view.filterMultiple.category);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple"&&Qe.label==="Tipo de análisis");if(console.log("GSCComparativeReports - analysisTypeFilterIndex:",Lt),console.log("GSCComparativeReports - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCComparativeReports - found analysis type filter at index:",Lt);const Qe=t.view.filterMultiple.category;console.log("GSCComparativeReports - setting analysis type filter directly from filterMultiple.category:",Qe),m.value[0]=Qe,t.view.componentProps&&Qe&&(t.view.componentProps.type=Qe,console.log("GSCComparativeReports - updated componentProps.type:",t.view.componentProps.type)),console.log("GSCComparativeReports - automatically set analysis type filter to:",Qe),console.log("GSCComparativeReports - category type:",typeof Qe),console.log("GSCComparativeReports - updated dynamicFilters:",m.value),console.log("GSCComparativeReports - filter options:",(Ft=T.value[Lt])==null?void 0:Ft.options);const et=(((Bt=T.value[Lt])==null?void 0:Bt.options)||[]).find(xt=>xt.value==Qe);console.log("GSCComparativeReports - matching option:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCComparativeReports - forced reactivity update")})}else console.log("GSCComparativeReports - analysis type filter not found!")}if(((at=f.value)==null?void 0:at.id)===6&&u.value&&(Ze=t==null?void 0:t.view)!=null&&Ze.filterMultiple&&(console.log("GSCLineupsReports - checking filterMultiple after preselecting filters:",t.view.filterMultiple),console.log("GSCLineupsReports - currentFilters:",T.value),console.log("GSCLineupsReports - dynamicFilters before:",m.value),t.view.filterMultiple.gameNumber)){console.log("GSCLineupsReports - found gameNumber in filterMultiple:",t.view.filterMultiple.gameNumber);const Lt=T.value.findIndex(Qe=>Qe.type==="select-simple"&&Qe.label==="Número de juego");if(console.log("GSCLineupsReports - gameNumberFilterIndex:",Lt),console.log("GSCLineupsReports - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCLineupsReports - found game number filter at index:",Lt);const Qe=t.view.filterMultiple.gameNumber;console.log("GSCLineupsReports - setting game number filter directly from filterMultiple.gameNumber:",Qe),m.value[0]=Qe,t.view.componentProps&&Qe&&(t.view.componentProps.gameNumber=Qe,console.log("GSCLineupsReports - updated componentProps.gameNumber:",t.view.componentProps.gameNumber)),console.log("GSCLineupsReports - automatically set game number filter to:",Qe),console.log("GSCLineupsReports - gameNumber type:",typeof Qe),console.log("GSCLineupsReports - updated dynamicFilters:",m.value),console.log("GSCLineupsReports - filter options:",(ct=T.value[Lt])==null?void 0:ct.options);const et=(((gt=T.value[Lt])==null?void 0:gt.options)||[]).find(xt=>xt.value==Qe);console.log("GSCLineupsReports - matching option:",et),p.nextTick(()=>{m.value=[...m.value],console.log("GSCLineupsReports - forced reactivity update")})}else console.log("GSCLineupsReports - game number filter not found!")}if(((Nt=f.value)==null?void 0:Nt.id)===7&&u.value&&t!=null&&t.view){if(console.log("GSCGoalData - checking stored values after preselecting filters:",t.view),console.log("GSCGoalData - currentFilters:",T.value),console.log("GSCGoalData - dynamicFilters before:",m.value),(Et=t.view.componentProps)!=null&&Et.analysisType&&T.value.length>0&&((tt=T.value[0])==null?void 0:tt.type)==="radio-button"){const Lt=t.view.componentProps.analysisType,Qe=Lt==="offensive"?1:2;console.log("GSCGoalData - setting analysis type filter from componentProps.analysisType:",Qe,"analysisType:",Lt),m.value[0]=Qe}if(((st=t.view.filterMultiple)==null?void 0:st.isHomeTeam)!==void 0){console.log("GSCGoalData - found isHomeTeam in filterMultiple:",t.view.filterMultiple.isHomeTeam),console.log('GSCGoalData - searching for radio-button filter with label "Equipo"'),console.log("GSCGoalData - all filters details:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label,options:Qe.options})));const Lt=T.value.findIndex(Qe=>Qe.type==="radio-button"&&Qe.label==="Equipo");if(console.log("GSCGoalData - teamFilterIndex:",Lt),console.log("GSCGoalData - all filters:",T.value.map((Qe,et)=>({index:et,type:Qe.type,label:Qe.label}))),Lt!==-1){console.log("GSCGoalData - found team filter at index:",Lt);const Qe=t.view.filterMultiple.isHomeTeam,et=Qe?1:2;console.log("GSCGoalData - setting team filter directly from filterMultiple.isHomeTeam:",et,"isHomeTeam:",Qe),m.value[1]=et}else if(console.log("GSCGoalData - team filter not found by label, trying by index"),T.value.length>1&&((Xe=T.value[1])==null?void 0:Xe.type)==="radio-button"){console.log("GSCGoalData - found radio-button filter at index 1 by fallback");const Qe=t.view.filterMultiple.isHomeTeam,et=Qe?1:2;console.log("GSCGoalData - setting team filter by fallback:",et,"isHomeTeam:",Qe),m.value[1]=et,t.view.componentProps&&(t.view.componentProps.isHomeTeamForAnalysis=Qe,console.log("GSCGoalData - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis)),console.log("GSCGoalData - automatically set team filter to:",et),console.log("GSCGoalData - teamValue type:",typeof et),console.log("GSCGoalData - updated dynamicFilters:",m.value),console.log("GSCGoalData - filter options:",(lt=T.value[1])==null?void 0:lt.options);const xt=(((Tt=T.value[1])==null?void 0:Tt.options)||[]).find(Pt=>Pt.value==et);console.log("GSCGoalData - matching option:",xt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCGoalData - forced reactivity update")})}else console.log("GSCGoalData - no radio-button filter found at index 1 either");if(Lt!==-1&&t.view.componentProps){const Qe=t.view.filterMultiple.isHomeTeam,et=Qe?1:2;t.view.componentProps.isHomeTeamForAnalysis=Qe,console.log("GSCGoalData - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis),console.log("GSCGoalData - automatically set team filter to:",et),console.log("GSCGoalData - teamValue type:",typeof et),console.log("GSCGoalData - updated dynamicFilters:",m.value),console.log("GSCGoalData - filter options:",(yt=T.value[Lt])==null?void 0:yt.options);const xt=(((It=T.value[Lt])==null?void 0:It.options)||[]).find(Pt=>Pt.value==et);console.log("GSCGoalData - matching option:",xt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCGoalData - forced reactivity update")})}}else console.log("GSCGoalData - isHomeTeam is undefined in filterMultiple")}p.nextTick(()=>{x.value=!1})}},100)}))}function de(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe;return{mainSelector:{id:((ve=d.value)==null?void 0:ve.id)||null,name:((ye=d.value)==null?void 0:ye.name)||null,url:((De=d.value)==null?void 0:De.url)||null},viewSelector:{id:((Re=f.value)==null?void 0:Re.id)||null,name:((Ve=f.value)==null?void 0:Ve.name)||((We=f.value)==null?void 0:We.title)||null,url:((Je=f.value)==null?void 0:Je.url)||null},team:_.value,dynamicFilters:((ke=T.value)==null?void 0:ke.map((He,rt)=>{var nt,ht;const vt=m.value[rt];return{filterId:He.id||`filter_${rt}`,filterType:He.type,filterLabel:He.label,filterIcon:He.icon||null,selectedValue:vt,selectedOptions:He.type==="select"&&Array.isArray(vt)&&vt.length>0?vt.map(ft=>{var Rt;const Ft=(Rt=He.options)==null?void 0:Rt.find(Bt=>Bt.value===ft);return{value:ft,label:(Ft==null?void 0:Ft.label)||ft,icon:(Ft==null?void 0:Ft.icon)||null}}):null,selectedOption:He.type==="radio-button"&&vt?{value:vt,label:((ht=(nt=He.options)==null?void 0:nt.find(ft=>ft.value===vt))==null?void 0:ht.label)||vt}:null,isChecked:He.type==="check"?vt:null}}))||[],timestamp:new Date().toISOString(),summary:{mainSelected:!!d.value,viewSelected:!!f.value,totalDynamicFilters:((ze=T.value)==null?void 0:ze.length)||0,activeFilters:((Fe=T.value)==null?void 0:Fe.filter((He,rt)=>{const nt=m.value[rt];return Array.isArray(nt)?nt.length>0:nt!=null&&nt!==!1}).length)||0}}}a({getCurrentFiltersJSON:de});function ge(){fe(),K("close",b)}function _e(){e.value=!1,ge()}function be(){w.value&&(Ai.emit("filters-cancelled",b),w.value=!1),e.value=!1,ge()}p.onMounted(async()=>{document.addEventListener("click",oe),p.nextTick(()=>{Se()});try{const ve=await(await fetch("https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/views",{headers:{Authorization:`${B.token}`}})).json();C.value=ve.data||[]}catch(ve){console.error("Error al obtener datos:",ve)}});function Se(){document.querySelectorAll(".field-menu .option-card").forEach(ve=>{const ye=ve.querySelector(".option-img");if(!ye||!ye.dataset.hoverSrc)return;const De=ye.src,Re=ye.dataset.hoverSrc;ve.addEventListener("mouseenter",()=>{ye.src=Re}),ve.addEventListener("mouseleave",()=>{ye.src=De})})}p.onUnmounted(()=>{document.removeEventListener("click",oe)}),Ai.on("set-filter-and-views-container",ve=>{b=ve,ve&&se(ve)}),Ai.on("view-added",()=>{console.log("View ************************************************************* add"),e.value=!0,w.value=!0}),Ai.on("component-added-to-container",ve=>{console.log("Component added to container, updating filters, container:",ve),!u.value||b&&ve.id===b.id?se(ve):console.log("Skipping container update - edit mode or different container")}),Ai.on("edit-view",ve=>{var ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt;console.log("edit-view received:",ve),t=ve,b=((ye=ve.view)==null?void 0:ye.filterAndViewsContainer)||null,v=null;const Ft=[(Re=(De=ve.view)==null?void 0:De.coreView)==null?void 0:Re.filtersJSON,(Ve=ve.view)==null?void 0:Ve.filtersJSON,(We=ve.coreView)==null?void 0:We.filtersJSON,ve.filtersJSON,(ke=(Je=ve.view)==null?void 0:Je.componentProps)==null?void 0:ke.filtersJSON];for(const Bt of Ft)if(Bt){v=Bt,console.log("Found editFiltersJSON in:",Bt);break}if(b&&(b.viewId===4||b.viewId===8||b.viewId===3||b.viewId===1||b.viewId===2)&&(ze=ve.view)!=null&&ze.id){const Bt=b.getComponentDynamicFilters(ve.view.id);if(Bt){let at="Unknown";b.viewId===4?at="Timeline":b.viewId===8?at="FieldPosesion":b.viewId===3?at="GSCMatchSummary":b.viewId===1?at="GSCComparativeReports":b.viewId===2&&(at="GscTopPlayer"),console.log(`${at} - found component specific filters:`,Bt),v&&(v={...v,dynamicFilters:Bt.map((Ze,ct)=>Array.isArray(Ze)?{selectedValue:Ze,selectedOptions:Ze.map(gt=>({value:gt,label:gt}))}:typeof Ze=="boolean"?{isChecked:Ze}:at==="GSCComparativeReports"&&ct===0?{selectedValue:Ze,selectedOptions:[{value:Ze,label:Ze}]}:at==="GscTopPlayer"&&ct===0?{selectedValue:Ze,selectedOptions:[{value:Ze,label:Ze}]}:at==="GscTopPlayer"&&ct===1?{selectedOption:{value:Ze,label:Ze}}:{selectedOption:{value:Ze,label:Ze}})},console.log(`${at} - updated editFiltersJSON with component specific filters:`,v))}}if(b&&b.viewId===2&&(Fe=ve.view)!=null&&Fe.filterMultiple){if(console.log("2222************************************************************",t.view.filterMultiple),console.log("GSCtops detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.categoryId&&v){console.log("GSCtops - found categoryId in filterMultiple:",ve.view.filterMultiple.categoryId);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select-simple"&&at.filterLabel==="Tipo de análisis");Bt!==-1&&(console.log("GSCtops - found category filter at index:",Bt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:ve.view.filterMultiple.categoryId,selectedOptions:[{value:ve.view.filterMultiple.categoryId,label:`Category ${ve.view.filterMultiple.categoryId}`}]},console.log("GSCtops - updated filter with single value:",ve.view.filterMultiple.categoryId),console.log("GSCtops - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCtops - updated category filter with filterMultiple.categoryId:",ve.view.filterMultiple.categoryId))}if(ve.view.filterMultiple.teamType!==void 0&&v){console.log("GSCtops - found teamType in filterMultiple:",ve.view.filterMultiple.teamType);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button");if(Bt!==-1){console.log("GSCtops - found team filter at index:",Bt);const at=ve.view.filterMultiple.teamType,Ze=at===1?"Mi equipo":at===2?"Rival":at===3?"Ambos":"Equipo";v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:at,label:Ze}},console.log("GSCtops - updated team filter with teamType:",at,"label:",Ze),console.log("GSCtops - updated team filter structure:",v.dynamicFilters[Bt]),console.log("GSCtops - updated team filter with filterMultiple.teamType:",ve.view.filterMultiple.teamType)}}}if(b&&b.viewId===1&&(He=ve.view)!=null&&He.filterMultiple&&(console.log("GSCComparativeReports detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.category&&v)){console.log("GSCComparativeReports - found category in filterMultiple:",ve.view.filterMultiple.category);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select-simple"&&at.filterLabel==="Tipo de análisis");Bt!==-1&&(console.log("GSCComparativeReports - found analysis type filter at index:",Bt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:ve.view.filterMultiple.category,selectedOptions:[{value:ve.view.filterMultiple.category,label:ve.view.filterMultiple.category}]},console.log("GSCComparativeReports - updated filter with single value:",ve.view.filterMultiple.category),console.log("GSCComparativeReports - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCComparativeReports - updated analysis type filter with filterMultiple.category:",ve.view.filterMultiple.category))}if(b&&b.viewId===9&&(rt=ve.view)!=null&&rt.filterMultiple){if(console.log("GSCFieldDataByZones detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.categoryIds&&v){console.log("GSCFieldDataByZones - found categoryIds in filterMultiple:",ve.view.filterMultiple.categoryIds);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select"&&at.filterLabel==="Tipo de análisis");if(Bt!==-1){console.log("GSCFieldDataByZones - found analysis type filter at index:",Bt);const at=Array.isArray(ve.view.filterMultiple.categoryIds)?ve.view.filterMultiple.categoryIds:[ve.view.filterMultiple.categoryIds];console.log("GSCFieldDataByZones - processing categoryIds array:",at),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:at,selectedOptions:at.map(Nt=>({value:Nt,label:`Category ${Nt}`}))},console.log("GSCFieldDataByZones - updated filter with categoryIds:",at),console.log("GSCFieldDataByZones - updated filter structure:",v.dynamicFilters[Bt]);const Ze=ve.view.filterMultiple.categoryIds,ct=Ce(Ze,at);console.log("GSCFieldDataByZones - category arrays match with original:",ct),console.log("GSCFieldDataByZones - original categoryIds:",Ze,"processed categoryIds:",at);const gt=(((nt=T.value[Bt])==null?void 0:nt.options)||[]).filter(Nt=>Array.isArray(Nt.value)?Ce(Nt.value,at):at.includes(Nt.value));if(console.log("GSCFieldDataByZones - matching options in editFiltersJSON:",gt),gt.length>0){const Nt=gt[0];console.log("GSCFieldDataByZones - found matching option in editFiltersJSON:",Nt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:Nt.value,selectedOptions:[Nt]},console.log("GSCFieldDataByZones - updated editFiltersJSON with matching option value:",Nt.value)}console.log("GSCFieldDataByZones - updated analysis type filter with filterMultiple.categoryIds:",at)}}if(ve.view.filterMultiple.isHomeTeam!==void 0&&v){console.log("GSCFieldDataByZones - found isHomeTeam in filterMultiple:",ve.view.filterMultiple.isHomeTeam),console.log("GSCFieldDataByZones - isHomeTeam type:",typeof ve.view.filterMultiple.isHomeTeam);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button");if(Bt!==-1){console.log("GSCFieldDataByZones - found team filter at index:",Bt);const at=ve.view.filterMultiple.isHomeTeam;let Ze,ct;typeof at=="boolean"?(Ze=at?1:2,ct=at?"Mi equipo":"Rival",console.log("GSCFieldDataByZones - converted boolean isHomeTeam to teamValue:",at,"->",Ze,"label:",ct)):typeof at=="number"?(Ze=at===1?1:2,ct=at===1?"Mi equipo":"Rival",console.log("GSCFieldDataByZones - converted numeric isHomeTeam to teamValue:",at,"->",Ze,"label:",ct)):(Ze=1,ct="Mi equipo",console.log("GSCFieldDataByZones - using default teamValue:",Ze,"label:",ct)),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCFieldDataByZones - updated team filter with isHomeTeam:",at,"teamValue:",Ze,"teamLabel:",ct),console.log("GSCFieldDataByZones - updated team filter structure:",v.dynamicFilters[Bt]),console.log("GSCFieldDataByZones - updated team filter with filterMultiple.isHomeTeam:",ve.view.filterMultiple.isHomeTeam)}}}if(b&&b.viewId===6&&(ht=ve.view)!=null&&ht.filterMultiple&&(console.log("GSCLineupsReports detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.gameNumber&&v)){console.log("GSCLineupsReports - found gameNumber in filterMultiple:",ve.view.filterMultiple.gameNumber);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="select-simple"&&at.filterLabel==="Número de juego");Bt!==-1&&(console.log("GSCLineupsReports - found game number filter at index:",Bt),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedValue:ve.view.filterMultiple.gameNumber,selectedOptions:[{value:ve.view.filterMultiple.gameNumber,label:`Juego ${ve.view.filterMultiple.gameNumber}`}]},console.log("GSCLineupsReports - updated filter with single value:",ve.view.filterMultiple.gameNumber),console.log("GSCLineupsReports - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCLineupsReports - updated game number filter with filterMultiple.gameNumber:",ve.view.filterMultiple.gameNumber))}if(b&&b.viewId===7&&ve.view&&v){if(console.log("GSCGoalData detected - checking stored values:",ve.view),(vt=ve.view.componentProps)!=null&&vt.analysisType){console.log("GSCGoalData - found analysisType in componentProps:",ve.view.componentProps.analysisType);const Bt=v.dynamicFilters.findIndex((at,Ze)=>at.filterType==="radio-button"&&Ze===0);if(Bt!==-1){console.log("GSCGoalData - found analysis type filter at index:",Bt);const at=ve.view.componentProps.analysisType,Ze=at==="offensive"?1:2,ct=at==="offensive"?"A favor":"En contra";v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCGoalData - updated analysis filter with value:",Ze,"analysisType:",at),console.log("GSCGoalData - updated analysis filter structure:",v.dynamicFilters[Bt])}}if(((ft=ve.view.filterMultiple)==null?void 0:ft.isHomeTeam)!==void 0){console.log("GSCGoalData - found isHomeTeam in filterMultiple:",ve.view.filterMultiple.isHomeTeam);const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button"&&at.filterLabel==="Equipo");if(Bt!==-1){console.log("GSCGoalData - found team filter at index:",Bt);const at=ve.view.filterMultiple.isHomeTeam,Ze=at?1:2,ct=at?"Equipo propio":"Equipo rival";v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCGoalData - updated filter with team value:",Ze,"isHomeTeam:",at),console.log("GSCGoalData - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCGoalData - updated team filter with filterMultiple.isHomeTeam:",at)}}}if(b&&b.viewId===5&&(Rt=ve.view)!=null&&Rt.filterMultiple&&(console.log("GSCVolumetricField detected - checking filterMultiple:",ve.view.filterMultiple),ve.view.filterMultiple.isHomeTeam!==void 0&&v)){console.log("GSCVolumetricField - found isHomeTeam in filterMultiple:",ve.view.filterMultiple.isHomeTeam),console.log("GSCVolumetricField - editFiltersJSON.dynamicFilters:",v.dynamicFilters),console.log("GSCVolumetricField - searching for team filter in editFiltersJSON");const Bt=v.dynamicFilters.findIndex(at=>at.filterType==="radio-button"&&at.filterLabel==="Equipo");if(console.log("GSCVolumetricField - teamFilterIndex:",Bt),console.log("GSCVolumetricField - all filters in editFiltersJSON:",v.dynamicFilters.map((at,Ze)=>({index:Ze,filterType:at.filterType,filterLabel:at.filterLabel}))),Bt!==-1){console.log("GSCVolumetricField - found team filter at index:",Bt);const at=ve.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type in editFiltersJSON:",typeof at,"value:",at);let Ze,ct;typeof at=="boolean"?(Ze=at?1:2,ct=at?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is boolean in editFiltersJSON, converting:",at,"-> teamValue:",Ze,"teamLabel:",ct)):typeof at=="number"?(Ze=at===1?1:2,ct=at===1?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is number in editFiltersJSON, using directly:",at,"-> teamValue:",Ze,"teamLabel:",ct)):(Ze=1,ct="Equipo propio",console.log("GSCVolumetricField - isHomeTeam is unknown type in editFiltersJSON, using default:",Ze,"teamLabel:",ct)),v.dynamicFilters[Bt]={...v.dynamicFilters[Bt],selectedOption:{value:Ze,label:ct}},console.log("GSCVolumetricField - updated filter with team value:",Ze,"isHomeTeam:",at),console.log("GSCVolumetricField - updated filter structure:",v.dynamicFilters[Bt]),console.log("GSCVolumetricField - updated team filter with filterMultiple.isHomeTeam:",at)}else{console.log("GSCVolumetricField - team filter not found in editFiltersJSON, trying fallback");const at=v.dynamicFilters.findIndex(Ze=>Ze.filterType==="radio-button");if(at!==-1){console.log("GSCVolumetricField - found radio-button filter at index:",at);const Ze=ve.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type in editFiltersJSON fallback:",typeof Ze,"value:",Ze);let ct,gt;typeof Ze=="boolean"?(ct=Ze?1:2,gt=Ze?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is boolean in editFiltersJSON fallback, converting:",Ze,"-> teamValue:",ct,"teamLabel:",gt)):typeof Ze=="number"?(ct=Ze===1?1:2,gt=Ze===1?"Equipo propio":"Equipo rival",console.log("GSCVolumetricField - isHomeTeam is number in editFiltersJSON fallback, using directly:",Ze,"-> teamValue:",ct,"teamLabel:",gt)):(ct=1,gt="Equipo propio",console.log("GSCVolumetricField - isHomeTeam is unknown type in editFiltersJSON fallback, using default:",ct,"teamLabel:",gt)),v.dynamicFilters[at]={...v.dynamicFilters[at],selectedOption:{value:ct,label:gt}},console.log("GSCVolumetricField - updated filter with team value (fallback):",ct,"isHomeTeam:",Ze),console.log("GSCVolumetricField - updated filter structure (fallback):",v.dynamicFilters[at])}else console.log("GSCVolumetricField - no radio-button filters found in editFiltersJSON at all!")}}console.log("Final editFiltersJSON:",v),v?ue(v):console.log("No editFiltersJSON found, cannot preselect filters"),e.value=!0});function Me(){V.value=null}function Te(ve,ye){var De;((De=f.value)==null?void 0:De.id)===2&&console.log("GSCtops - debugSelectSimple:",{idx:ve,optionValue:ye,optionValueType:typeof ye,dynamicFiltersValue:m.value[ve],dynamicFiltersValueType:typeof m.value[ve],isEqual:m.value[ve]===ye,isEqualLoose:m.value[ve]==ye})}function Ce(ve,ye){if(!Array.isArray(ve)||!Array.isArray(ye)||ve.length!==ye.length)return!1;const De=[...ve].sort((Ve,We)=>Ve-We),Re=[...ye].sort((Ve,We)=>Ve-We);return JSON.stringify(De)===JSON.stringify(Re)}function Ne(){var ve;if(u.value&&v&&v.dynamicFilters){if(console.log("Forcing checkbox and select filter update from editFiltersJSON"),((ve=f.value)==null?void 0:ve.id)===8&&(console.log("FieldPosesion - forceCheckboxUpdate called"),console.log("FieldPosesion - viewToEdit:",t),console.log("FieldPosesion - editFiltersJSON:",v)),h.value){console.log("Skipping forceCheckboxUpdate - already in force update");return}if(y.value)return;h.value=!0,x.value=!0,v.dynamicFilters.forEach((ye,De)=>{var Re,Ve,We;if(ye&&(Re=T.value)!=null&&Re[De]){const Je=T.value[De];if(Je.type==="check"&&ye.isChecked!==void 0)console.log(`Forcing checkbox ${De} to:`,ye.isChecked),m.value[De]=ye.isChecked,((Ve=f.value)==null?void 0:Ve.id)===8&&console.log("FieldPosesion - Checkbox filter updated:",{index:De,value:ye.isChecked,componentId:(We=t==null?void 0:t.view)==null?void 0:We.id});else if(Je.type==="select"&&ye.selectedOptions){const ke=ye.selectedOptions.map(ze=>ze.value);console.log(`Forcing select filter ${De} to:`,ke),m.value[De]=ke}else Je.type==="select"&&ye.selectedValue&&Array.isArray(ye.selectedValue)&&(console.log(`Forcing select filter ${De} to:`,ye.selectedValue),m.value[De]=ye.selectedValue)}}),p.nextTick(()=>{x.value=!1,h.value=!1})}}function Oe(){var ve;if(u.value&&v&&v.dynamicFilters&&((ve=f.value)==null?void 0:ve.id)===4){if(console.log("Preselecting Timeline filters specifically"),h.value){console.log("Skipping preselectTimelineFilters - already in force update");return}if(y.value)return;h.value=!0,x.value=!0,v.dynamicFilters.forEach((ye,De)=>{var Re,Ve;if(ye&&((Ve=(Re=T.value)==null?void 0:Re[De])==null?void 0:Ve.type)==="select"){if(ye.selectedOptions){const We=ye.selectedOptions.map(Je=>Je.value);console.log(`Preselecting Timeline select filter ${De} to:`,We),m.value[De]=We}else if(ye.selectedValue&&Array.isArray(ye.selectedValue))if(ye.selectedValue.length>0&&ye.selectedValue[0]&&typeof ye.selectedValue[0]=="object"){const We=Ge(ye.selectedValue);console.log(`Preselecting Timeline select filter ${De} to:`,We),m.value[De]=We}else console.log(`Preselecting Timeline select filter ${De} to:`,ye.selectedValue),m.value[De]=ye.selectedValue}}),setTimeout(()=>{console.log("Forcing UI update after preselecting Timeline filters"),m.value=[...m.value]},200),p.nextTick(()=>{x.value=!1,h.value=!1})}}function Ge(ve){return!Array.isArray(ve)||ve.length===0?[]:ve.map(ye=>{if(ye&&typeof ye=="object"){if(ye.event_type_id&&ye.category_id)return`${ye.category_id}-${ye.event_type_id}`;if(ye.event_type_id)return ye.event_type_id.toString();if(ye.category_id)return ye.category_id.toString()}return ye})}function Le(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht;if(u.value&&v&&v.dynamicFilters&&T.value){if(console.log("Force updating select filters immediately"),h.value){console.log("Skipping forceSelectFilterUpdate - already in force update");return}if(y.value)return;if(h.value=!0,x.value=!0,v.dynamicFilters.forEach((vt,ft)=>{var Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st;if(vt&&((Rt=T.value[ft])==null?void 0:Rt.type)==="select"){if(vt.selectedOptions){const Xe=vt.selectedOptions.map(lt=>lt.value);console.log(`Force setting select filter ${ft} to:`,Xe),m.value[ft]=Xe}else if(vt.selectedValue&&Array.isArray(vt.selectedValue))if(vt.selectedValue.length>0&&vt.selectedValue[0]&&typeof vt.selectedValue[0]=="object"){const Xe=Ge(vt.selectedValue);console.log(`Force setting Timeline select filter ${ft} to:`,Xe),m.value[ft]=Xe}else console.log(`Force setting select filter ${ft} to:`,vt.selectedValue),m.value[ft]=vt.selectedValue}else if(vt&&((Ft=T.value[ft])==null?void 0:Ft.type)==="select-simple"&&vt.selectedValue!==void 0){console.log(`Force setting select-simple filter ${ft} to:`,vt.selectedValue),console.log("forceSelectFilterUpdate - selectedValue type:",typeof vt.selectedValue),console.log("forceSelectFilterUpdate - selectedValue is array:",Array.isArray(vt.selectedValue));let Xe;((Bt=f.value)==null?void 0:Bt.id)===2&&(Ze=(at=t==null?void 0:t.view)==null?void 0:at.filterMultiple)!=null&&Ze.categoryId?(Xe=t.view.filterMultiple.categoryId,console.log("GSCtops - using filterMultiple.categoryId in forceSelectFilterUpdate:",Xe)):((ct=f.value)==null?void 0:ct.id)===1&&(Nt=(gt=t==null?void 0:t.view)==null?void 0:gt.filterMultiple)!=null&&Nt.category?(Xe=t.view.filterMultiple.category,console.log("GSCComparativeReports - using filterMultiple.category in forceSelectFilterUpdate:",Xe)):((Et=f.value)==null?void 0:Et.id)===6&&(st=(tt=t==null?void 0:t.view)==null?void 0:tt.filterMultiple)!=null&&st.gameNumber?(Xe=t.view.filterMultiple.gameNumber,console.log("GSCLineupsReports - using filterMultiple.gameNumber in forceSelectFilterUpdate:",Xe)):Xe=Array.isArray(vt.selectedValue)?vt.selectedValue[0]:vt.selectedValue,m.value[ft]=Xe,console.log(`Force setting select-simple filter ${ft} to:`,Xe)}}),((ve=f.value)==null?void 0:ve.id)===4&&setTimeout(()=>{console.log("Forcing UI update for Timeline filters"),m.value=[...m.value]},100),((ye=f.value)==null?void 0:ye.id)===2&&(De=t==null?void 0:t.view)!=null&&De.filterMultiple){if(console.log("GSCtops - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCtops - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.categoryId){console.log("GSCtops - found categoryId in filterMultiple:",t.view.filterMultiple.categoryId);const vt=T.value.findIndex(ft=>ft.type==="select-simple"&&ft.label==="Tipo de análisis");if(console.log("GSCtops - categoryFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCtops - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCtops - found category filter at index:",vt);const ft=t.view.filterMultiple.categoryId;if(console.log("GSCtops - setting category filter directly from filterMultiple.categoryId in forceSelectFilterUpdate:",ft),m.value[0]=ft,t.view.componentProps&&ft){let Ft=`Category ${ft}`,Bt=null;try{Bt=Vd(ft),Bt&&(Ft=Bt.name,console.log("GSCtops - found category info from getCategoryById in forceSelectFilterUpdate:",Bt))}catch{console.log("GSCtops - getCategoryById failed in forceSelectFilterUpdate, using filter options");const at=T.value.findIndex(Ze=>Ze.type==="select-simple"&&Ze.label==="Tipo de análisis");if(at!==-1){const Ze=(((Re=T.value[at])==null?void 0:Re.options)||[]).find(ct=>ct.value==ft);Ze&&(Ft=Ze.label,console.log("GSCtops - found category name from options in forceSelectFilterUpdate:",Ft))}}t.view.componentProps.categoryView=[{id:ft,name:Ft}],console.log("GSCtops - updated componentProps.categoryView in forceSelectFilterUpdate:",t.view.componentProps.categoryView)}console.log("GSCtops - automatically set category filter to:",ft),console.log("GSCtops - categoryId type:",typeof ft),console.log("GSCtops - updated dynamicFilters:",m.value),console.log("GSCtops - filter options:",(Ve=T.value[vt])==null?void 0:Ve.options);const Rt=(((We=T.value[vt])==null?void 0:We.options)||[]).find(Ft=>Ft.value==ft);console.log("GSCtops - matching option:",Rt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update in forceSelectFilterUpdate")})}else console.log("GSCtops - category filter not found in forceSelectFilterUpdate!")}if(t.view.filterMultiple.teamType!==void 0){console.log("GSCtops - found teamType in filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple.teamType);const vt=T.value.findIndex(ft=>ft.type==="radio-button");if(console.log("GSCtops - teamFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCtops - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCtops - found team filter at index in forceSelectFilterUpdate:",vt);const ft=t.view.filterMultiple.teamType;console.log("GSCtops - setting team filter directly from filterMultiple.teamType in forceSelectFilterUpdate:",ft),m.value[vt]=ft,console.log("GSCtops - automatically set team filter to in forceSelectFilterUpdate:",ft),console.log("GSCtops - teamType type in forceSelectFilterUpdate:",typeof ft),console.log("GSCtops - updated dynamicFilters in forceSelectFilterUpdate:",m.value),console.log("GSCtops - filter options in forceSelectFilterUpdate:",(Je=T.value[vt])==null?void 0:Je.options);const Rt=(((ke=T.value[vt])==null?void 0:ke.options)||[]).find(Ft=>Ft.value==ft);console.log("GSCtops - matching option for team in forceSelectFilterUpdate:",Rt),p.nextTick(()=>{m.value=[...m.value],console.log("GSCtops - forced reactivity update for team filter in forceSelectFilterUpdate")})}else console.log("GSCtops - team filter not found in forceSelectFilterUpdate!")}}if(((ze=f.value)==null?void 0:ze.id)===1&&(Fe=t==null?void 0:t.view)!=null&&Fe.filterMultiple&&(console.log("GSCComparativeReports - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCComparativeReports - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.category)){console.log("GSCComparativeReports - found category in filterMultiple:",t.view.filterMultiple.category);const vt=T.value.findIndex(ft=>ft.type==="select-simple"&&ft.label==="Tipo de análisis");if(console.log("GSCComparativeReports - analysisTypeFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCComparativeReports - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCComparativeReports - found analysis type filter at index:",vt);const ft=t.view.filterMultiple.category;console.log("GSCComparativeReports - setting analysis type filter directly from filterMultiple.category in forceSelectFilterUpdate:",ft),m.value[0]=ft,t.view.componentProps&&ft&&(t.view.componentProps.type=ft,console.log("GSCComparativeReports - updated componentProps.type in forceSelectFilterUpdate:",t.view.componentProps.type)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCComparativeReports - forced reactivity update in forceSelectFilterUpdate")})}else console.log("GSCComparativeReports - analysis type filter not found in forceSelectFilterUpdate!")}if(((He=f.value)==null?void 0:He.id)===6&&(rt=t==null?void 0:t.view)!=null&&rt.filterMultiple&&(console.log("GSCLineupsReports - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCLineupsReports - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.gameNumber)){console.log("GSCLineupsReports - found gameNumber in filterMultiple:",t.view.filterMultiple.gameNumber);const vt=T.value.findIndex(ft=>ft.type==="select-simple"&&ft.label==="Número de juego");if(console.log("GSCLineupsReports - gameNumberFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCLineupsReports - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCLineupsReports - found game number filter at index:",vt);const ft=t.view.filterMultiple.gameNumber;console.log("GSCLineupsReports - setting game number filter directly from filterMultiple.gameNumber in forceSelectFilterUpdate:",ft),m.value[0]=ft,t.view.componentProps&&ft&&(t.view.componentProps.gameNumber=ft,console.log("GSCLineupsReports - updated componentProps.gameNumber in forceSelectFilterUpdate:",t.view.componentProps.gameNumber)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCLineupsReports - forced reactivity update in forceSelectFilterUpdate")})}else console.log("GSCLineupsReports - game number filter not found in forceSelectFilterUpdate!")}if(((nt=f.value)==null?void 0:nt.id)===5&&(ht=t==null?void 0:t.view)!=null&&ht.filterMultiple&&(console.log("GSCVolumetricField - checking filterMultiple in forceSelectFilterUpdate:",t.view.filterMultiple),console.log("GSCVolumetricField - currentFilters in forceSelectFilterUpdate:",T.value),t.view.filterMultiple.isHomeTeam!==void 0)){console.log("GSCVolumetricField - found isHomeTeam in filterMultiple:",t.view.filterMultiple.isHomeTeam),console.log('GSCVolumetricField - searching for team filter with label "Equipo"'),console.log("GSCVolumetricField - all filters details:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label,options:ft.options})));const vt=T.value.findIndex(ft=>ft.type==="radio-button"&&ft.label==="Equipo");if(console.log("GSCVolumetricField - teamFilterIndex in forceSelectFilterUpdate:",vt),console.log("GSCVolumetricField - all filters in forceSelectFilterUpdate:",T.value.map((ft,Rt)=>({index:Rt,type:ft.type,label:ft.label}))),vt!==-1){console.log("GSCVolumetricField - found team filter at index:",vt);const ft=t.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type:",typeof ft,"value:",ft);let Rt;typeof ft=="boolean"?(Rt=ft?1:2,console.log("GSCVolumetricField - isHomeTeam is boolean, converting:",ft,"-> teamValue:",Rt)):typeof ft=="number"?(Rt=ft===1?1:2,console.log("GSCVolumetricField - isHomeTeam is number, using directly:",ft,"-> teamValue:",Rt)):(Rt=1,console.log("GSCVolumetricField - isHomeTeam is unknown type, using default:",Rt)),console.log("GSCVolumetricField - setting team filter directly from filterMultiple.isHomeTeam in forceSelectFilterUpdate:",Rt),m.value[0]=Rt,t.view.componentProps&&ft!==void 0&&(t.view.componentProps.isHomeTeamForAnalysis=ft===1,console.log("GSCVolumetricField - updated componentProps.isHomeTeamForAnalysis in forceSelectFilterUpdate:",t.view.componentProps.isHomeTeamForAnalysis)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCVolumetricField - forced reactivity update in forceSelectFilterUpdate")})}else{console.log("GSCVolumetricField - team filter not found in forceSelectFilterUpdate!"),console.log("GSCVolumetricField - trying fallback: looking for any radio-button filter");const ft=T.value.findIndex(Rt=>Rt.type==="radio-button");if(ft!==-1){console.log("GSCVolumetricField - found radio-button filter at index:",ft);const Rt=t.view.filterMultiple.isHomeTeam;console.log("GSCVolumetricField - isHomeTeam type in fallback:",typeof Rt,"value:",Rt);let Ft;typeof Rt=="boolean"?(Ft=Rt?1:2,console.log("GSCVolumetricField - isHomeTeam is boolean in fallback, converting:",Rt,"-> teamValue:",Ft)):typeof Rt=="number"?(Ft=Rt===1?1:2,console.log("GSCVolumetricField - isHomeTeam is number in fallback, using directly:",Rt,"-> teamValue:",Ft)):(Ft=1,console.log("GSCVolumetricField - isHomeTeam is unknown type in fallback, using default:",Ft)),console.log("GSCVolumetricField - setting radio-button filter by fallback:",Ft),m.value[ft]=Ft,t.view.componentProps&&Rt!==void 0&&(t.view.componentProps.preMatchType=Rt,console.log("GSCVolumetricField - updated componentProps.preMatchType in fallback:",t.view.componentProps.preMatchType)),p.nextTick(()=>{m.value=[...m.value],console.log("GSCVolumetricField - forced reactivity update in fallback")})}else console.log("GSCVolumetricField - no radio-button filters found at all!")}}p.nextTick(()=>{x.value=!1,h.value=!1})}}function je(){if(console.log("FUNCION: forceRadioFilterUpdate"),h.value){console.log("Skipping forceRadioFilterUpdate - already in force update");return}if(u.value&&v&&v.dynamicFilters&&T.value){if(console.log("1"),y.value)return;h.value=!0,x.value=!0,v.dynamicFilters.forEach((ve,ye)=>{var De,Re;if(ve&&((De=T.value[ye])==null?void 0:De.type)==="radio-button"&&(console.log("2"),ve.selectedOption&&ve.selectedOption.value!==void 0)){console.log("3"),console.log("filterData: ----------------->",ve),console.log("editFiltersJSON: ",v),console.log(`Force setting radio filter ${ye} to:`,ve.selectedOption.value);const Ve=ve.selectedOption.value;m.value[ye]=Ve,console.log(`Radio filter ${ye} set to:`,Ve,"Type:",typeof Ve),((Re=f.value)==null?void 0:Re.id)===8&&(console.log("FieldPosesion - Radio filter updated to:",ve.selectedOption.value),console.log("FieldPosesion - Current dynamicFilters after update:",m.value))}}),p.nextTick(()=>{x.value=!1,h.value=!1})}}function Ie(){var ve,ye,De,Re,Ve,We,Je,ke,ze,Fe,He,rt,nt,ht,vt,ft,Rt,Ft,Bt,at,Ze,ct,gt,Nt,Et,tt,st,Xe,lt,Tt,yt,It,Lt,Qe,et,xt,Pt,Ot,kt,Ht,qt,Jt,Wt,Gt,rr,ir;if(console.log("updateContainerOnUserChange function called"),console.log("filterAndViewsContainer:",b),console.log("isEditMode.value:",u.value),console.log("viewToEdit:",t),b&&u.value&&t){if(console.log("User made changes, updating container for specific component"),console.log("Current dynamicFilters:",m.value),console.log("Component ID:",(ve=t.view)==null?void 0:ve.id),console.log("Selected component ID:",(ye=f.value)==null?void 0:ye.id),y.value){console.log("Skipping container update due to container update in progress");return}if(x.value=!0,((De=f.value)==null?void 0:De.id)===4)b.setDynamicFilters(m.value,(Re=t.view)==null?void 0:Re.id),b.updateDynamicFilters(m.value,(Ve=t.view)==null?void 0:Ve.id),console.log("Timeline - updated specific filters for component:",(We=t.view)==null?void 0:We.id);else if(((Je=f.value)==null?void 0:Je.id)===8)b.setDynamicFilters(m.value,(ke=t.view)==null?void 0:ke.id),b.updateDynamicFilters(m.value,(ze=t.view)==null?void 0:ze.id),console.log("FieldPosesion - updated specific filters for component:",(Fe=t.view)==null?void 0:Fe.id);else if(((He=f.value)==null?void 0:He.id)===3)b.setDynamicFilters(m.value,(rt=t.view)==null?void 0:rt.id),b.updateDynamicFilters(m.value,(nt=t.view)==null?void 0:nt.id),console.log("GSCMatchSummary - updated specific filters for component:",(ht=t.view)==null?void 0:ht.id);else if(((vt=f.value)==null?void 0:vt.id)===2){console.log("GSCtops - updateContainerOnUserChange - starting GSCtops logic"),console.log("GSCtops - current dynamicFilters:",m.value),console.log("GSCtops - currentFilters:",T.value),b.setDynamicFilters(m.value,(ft=t.view)==null?void 0:ft.id),b.updateDynamicFilters(m.value,(Rt=t.view)==null?void 0:Rt.id);const vr=m.value[0];if(console.log("GSCtops - newCategoryId from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCtops - created new filterMultiple object"));const wr=t.view.filterMultiple.categoryId;if(t.view.filterMultiple.categoryId=vr,console.log("GSCtops - updated filterMultiple.categoryId from",wr,"to:",vr),console.log("GSCtops - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps){let ar=`Category ${vr}`,_r=null;try{_r=Vd(vr),_r&&(ar=_r.name,console.log("GSCtops - found category info from getCategoryById:",_r))}catch{console.log("GSCtops - getCategoryById failed, using filter options");const Wr=T.value.findIndex(Er=>Er.type==="select-simple"&&Er.label==="Tipo de análisis");if(Wr!==-1){const Er=(((Ft=T.value[Wr])==null?void 0:Ft.options)||[]).find(yr=>yr.value==vr);Er&&(ar=Er.label,console.log("GSCtops - found category name from options:",ar))}}t.view.componentProps.categoryView=[{id:vr,name:ar}],console.log("GSCtops - updated componentProps.categoryView:",t.view.componentProps.categoryView),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCtops - emitted force-component-update event")}}else console.log("GSCtops - newCategoryId is undefined!");const kr=m.value[1];if(console.log("GSCtops - newTeamType from dynamicFilters[1]:",kr),kr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCtops - created new filterMultiple object for teamType"));const wr=t.view.filterMultiple.teamType;t.view.filterMultiple.teamType=kr,console.log("GSCtops - updated filterMultiple.teamType from",wr,"to:",kr),console.log("GSCtops - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&t.view.componentProps.game&&(kr===1?t.view.componentProps.teamView=t.view.componentProps.game.homeTeam.team_id:kr===2?t.view.componentProps.teamView=t.view.componentProps.game.awayTeam.team_id:t.view.componentProps.teamView=0,console.log("GSCtops - updated componentProps.teamView:",t.view.componentProps.teamView)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCtops - emitted force-component-update event for teamType")}else console.log("GSCtops - newTeamType is undefined!");console.log("GSCtops - updated specific filters for component:",(Bt=t.view)==null?void 0:Bt.id)}else if(((at=f.value)==null?void 0:at.id)===1){console.log("GSCComparativeReports - updateContainerOnUserChange - starting GSCComparativeReports logic"),console.log("GSCComparativeReports - current dynamicFilters:",m.value),console.log("GSCComparativeReports - currentFilters:",T.value),b.setDynamicFilters(m.value,(Ze=t.view)==null?void 0:Ze.id),b.updateDynamicFilters(m.value,(ct=t.view)==null?void 0:ct.id);const vr=m.value[0];if(console.log("GSCComparativeReports - newCategory from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCComparativeReports - created new filterMultiple object"));const kr=t.view.filterMultiple.category;t.view.filterMultiple.category=vr,console.log("GSCComparativeReports - updated filterMultiple.category from",kr,"to:",vr),console.log("GSCComparativeReports - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.type=vr,console.log("GSCComparativeReports - updated componentProps.type:",t.view.componentProps.type)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCComparativeReports - emitted force-component-update event")}else console.log("GSCComparativeReports - newCategory is undefined!");console.log("GSCComparativeReports - updated specific filters for component:",(gt=t.view)==null?void 0:gt.id)}else if(((Nt=f.value)==null?void 0:Nt.id)===6){console.log("GSCLineupsReports - updateContainerOnUserChange - starting GSCLineupsReports logic"),console.log("GSCLineupsReports - current dynamicFilters:",m.value),console.log("GSCLineupsReports - currentFilters:",T.value),console.log("GSCLineupsReports - viewToEdit:",t),console.log("GSCLineupsReports - filterAndViewsContainer:",b),b.setDynamicFilters(m.value,(Et=t.view)==null?void 0:Et.id),b.updateDynamicFilters(m.value,(tt=t.view)==null?void 0:tt.id);const vr=m.value[0];if(console.log("GSCLineupsReports - newGameNumber from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCLineupsReports - created new filterMultiple object"));const kr=t.view.filterMultiple.gameNumber;t.view.filterMultiple.gameNumber=vr,console.log("GSCLineupsReports - updated filterMultiple.gameNumber from",kr,"to:",vr),console.log("GSCLineupsReports - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.gameNumber=vr,console.log("GSCLineupsReports - updated componentProps.gameNumber:",t.view.componentProps.gameNumber),t.view._updateKey,t.view._updateKey=Date.now(),console.log("GSCLineupsReports - updated _updateKey:",t.view._updateKey)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCLineupsReports - emitted force-component-update event"),Ai.emit("dynamic-filters-changed",{containerViewId:(st=f.value)==null?void 0:st.id,viewId:t.view.id,dynamicFilters:m.value}),console.log("GSCLineupsReports - emitted dynamic-filters-changed event"),Ai.emit("component-props-updated",{viewId:t.view.id,componentProps:t.view.componentProps,dynamicFilters:m.value}),console.log("GSCLineupsReports - emitted component-props-updated event"),p.nextTick(()=>{console.log("GSCLineupsReports - forcing reactivity update"),t.view.componentProps&&(t.view.componentProps={...t.view.componentProps})})}else console.log("GSCLineupsReports - newGameNumber is undefined!");console.log("GSCLineupsReports - updated specific filters for component:",(Xe=t.view)==null?void 0:Xe.id)}else if(((lt=f.value)==null?void 0:lt.id)===7){console.log("GSCGoalData - updateContainerOnUserChange - starting GSCGoalData logic"),console.log("GSCGoalData - current dynamicFilters:",m.value),console.log("GSCGoalData - currentFilters:",T.value),console.log("GSCGoalData - viewToEdit:",t),console.log("GSCGoalData - filterAndViewsContainer:",b),b.setDynamicFilters(m.value,(Tt=t.view)==null?void 0:Tt.id),b.updateDynamicFilters(m.value,(yt=t.view)==null?void 0:yt.id);const vr=m.value[0],kr=m.value[1];if(console.log("GSCGoalData - newAnalysisValue from dynamicFilters[0]:",vr),console.log("GSCGoalData - newTeamValue from dynamicFilters[1]:",kr),vr!==void 0&&t.view.componentProps){const wr=vr===1?"offensive":"defensive";t.view.componentProps.analysisType=wr,console.log("GSCGoalData - updated componentProps.analysisType to:",wr)}if(kr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCGoalData - created new filterMultiple object"));const wr=t.view.filterMultiple.isHomeTeam,ar=kr===1;t.view.filterMultiple.isHomeTeam=ar,console.log("GSCGoalData - updated filterMultiple.isHomeTeam from",wr,"to:",ar),console.log("GSCGoalData - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.isHomeTeamForAnalysis=ar,console.log("GSCGoalData - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis),t.view._updateKey,t.view._updateKey=Date.now(),console.log("GSCGoalData - updated _updateKey:",t.view._updateKey)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCGoalData - emitted force-component-update event"),Ai.emit("dynamic-filters-changed",{containerViewId:(It=f.value)==null?void 0:It.id,viewId:t.view.id,dynamicFilters:m.value}),console.log("GSCGoalData - emitted dynamic-filters-changed event"),Ai.emit("component-props-updated",{viewId:t.view.id,componentProps:t.view.componentProps,dynamicFilters:m.value}),console.log("GSCGoalData - emitted component-props-updated event"),p.nextTick(()=>{console.log("GSCGoalData - forcing reactivity update"),t.view.componentProps&&(t.view.componentProps={...t.view.componentProps})})}else console.log("GSCGoalData - newTeamValue is undefined!");console.log("GSCGoalData - updated specific filters for component:",(Lt=t.view)==null?void 0:Lt.id)}else if(((Qe=f.value)==null?void 0:Qe.id)===5){console.log("GSCVolumetricField - updateContainerOnUserChange - starting GSCVolumetricField logic"),console.log("GSCVolumetricField - current dynamicFilters:",m.value),console.log("GSCVolumetricField - currentFilters:",T.value),console.log("GSCVolumetricField - viewToEdit:",t),console.log("GSCVolumetricField - filterAndViewsContainer:",b),b.setDynamicFilters(m.value,(et=t.view)==null?void 0:et.id),b.updateDynamicFilters(m.value,(xt=t.view)==null?void 0:xt.id);const vr=m.value[0];if(console.log("GSCVolumetricField - newTeamValue from dynamicFilters[0]:",vr),vr!==void 0){t.view.filterMultiple||(t.view.filterMultiple={},console.log("GSCVolumetricField - created new filterMultiple object"));const kr=t.view.filterMultiple.isHomeTeam,wr=vr===1?1:2;t.view.filterMultiple.isHomeTeam=wr,console.log("GSCVolumetricField - updated filterMultiple.isHomeTeam from",kr,"to:",wr),console.log("GSCVolumetricField - updated component filterMultiple:",t.view.filterMultiple),t.view.componentProps&&(t.view.componentProps.isHomeTeamForAnalysis=wr===1,console.log("GSCVolumetricField - updated componentProps.isHomeTeamForAnalysis:",t.view.componentProps.isHomeTeamForAnalysis),t.view._updateKey,t.view._updateKey=Date.now(),console.log("GSCVolumetricField - updated _updateKey:",t.view._updateKey)),Ai.emit("force-component-update",{itemId:t.view.id,componentProps:t.view.componentProps,filterMultiple:t.view.filterMultiple}),console.log("GSCVolumetricField - emitted force-component-update event"),Ai.emit("dynamic-filters-changed",{containerViewId:(Pt=f.value)==null?void 0:Pt.id,viewId:t.view.id,dynamicFilters:m.value}),console.log("GSCVolumetricField - emitted dynamic-filters-changed event"),Ai.emit("component-props-updated",{viewId:t.view.id,componentProps:t.view.componentProps,dynamicFilters:m.value}),console.log("GSCVolumetricField - emitted component-props-updated event"),p.nextTick(()=>{console.log("GSCVolumetricField - forcing reactivity update"),t.view.componentProps&&(t.view.componentProps={...t.view.componentProps})})}else console.log("GSCVolumetricField - newPreMatchType is undefined!");console.log("GSCVolumetricField - updated specific filters for component:",(Ot=t.view)==null?void 0:Ot.id)}else{if(((kt=f.value)==null?void 0:kt.id)===9)return;b.setDynamicFilters(m.value),b.updateDynamicFilters(m.value)}((Ht=f.value)==null?void 0:Ht.id)===8&&console.log("FieldPosesion - Container updated with dynamicFilters:",m.value),((qt=f.value)==null?void 0:qt.id)===3&&console.log("GSCMatchSummary - Container updated with dynamicFilters:",m.value),((Jt=f.value)==null?void 0:Jt.id)===2&&console.log("GSCtops - Container updated with dynamicFilters:",m.value),((Wt=f.value)==null?void 0:Wt.id)===1&&console.log("GSCComparativeReports - Container updated with dynamicFilters:",m.value),((Gt=f.value)==null?void 0:Gt.id)===6&&console.log("GSCLineupsReports - Container updated with dynamicFilters:",m.value),((rr=f.value)==null?void 0:rr.id)===5&&console.log("GSCVolumetricField - Container updated with dynamicFilters:",m.value),((ir=f.value)==null?void 0:ir.id)===9&&console.log("GSCFieldDataByZones - Container updated with dynamicFilters:",m.value),p.nextTick(()=>{x.value=!1,console.log("updateContainerOnUserChange completed")})}else console.log("updateContainerOnUserChange - conditions not met"),console.log("filterAndViewsContainer exists:",!!b),console.log("isEditMode.value:",u.value),console.log("viewToEdit exists:",!!t)}function me(){var ve,ye,De;if(!v||!v.dynamicFilters||!T.value)return!1;for(let Re=0;Re<v.dynamicFilters.length;Re++){const Ve=v.dynamicFilters[Re],We=T.value[Re],Je=m.value[Re];if(!(!Ve||!We)){if(We.type==="check"){if(Ve.isChecked!==Je)return console.log(`Check filter ${Re} needs update: saved=${Ve.isChecked}, current=${Je}`),!0}else if(We.type==="radio-button"){if(((ve=Ve.selectedOption)==null?void 0:ve.value)!==Je)return console.log(`Radio filter ${Re} needs update: saved=${(ye=Ve.selectedOption)==null?void 0:ye.value}, current=${Je}`),!0}else if(We.type==="select"){const ke=((De=Ve.selectedOptions)==null?void 0:De.map(Fe=>Fe.value))||Ve.selectedValue||[],ze=Array.isArray(Je)?Je:[];if(JSON.stringify(ke)!==JSON.stringify(ze))return console.log(`Select filter ${Re} needs update: saved=${JSON.stringify(ke)}, current=${JSON.stringify(ze)}`),!0}}}return console.log("No force update needed - values already match"),!1}return(ve,ye)=>(p.openBlock(),p.createElementBlock("div",ece,[p.createElementVNode("button",tce,p.toDisplayString(u.value?"Editando visualización":"Nueva visualización"),1),p.createElementVNode("div",{class:p.normalizeClass(["custom-select main-select",{disabled:u.value}]),onClick:ne},[p.createElementVNode("div",rce,[p.createElementVNode("span",nce,[d.value?(p.openBlock(),p.createElementBlock("img",{key:0,src:q(d.value.name,!1),alt:"icono",class:"option-img"},null,8,ice)):(p.openBlock(),p.createElementBlock("img",ace))]),d.value?(p.openBlock(),p.createElementBlock("span",sce,p.toDisplayString(W()),1)):(p.openBlock(),p.createElementBlock("span",oce,"Tipo de vista")),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:O.value}])},[...ye[4]||(ye[4]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),O.value?(p.openBlock(),p.createElementBlock("div",lce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(n.value,(De,Re)=>(p.openBlock(),p.createElementBlock("div",{key:De.id,class:p.normalizeClass(["option-card",{active:i.value===Re}]),onClick:p.withModifiers(Ve=>re(Re),["stop"])},[p.createElementVNode("div",uce,[p.createElementVNode("img",{src:q(De.name,!1),"data-hover-src":q(De.name,!0),alt:"icono",class:"option-img-34"},null,8,dce)]),p.createElementVNode("div",hce,[p.createElementVNode("div",pce,p.toDisplayString(De.name),1),De.description?(p.openBlock(),p.createElementBlock("div",fce,p.toDisplayString(De.description),1)):p.createCommentVNode("",!0)])],10,cce))),128))])):p.createCommentVNode("",!0)],2),d.value?(p.openBlock(),p.createElementBlock("div",{key:0,class:p.normalizeClass(["custom-select second-select",{disabled:u.value}]),onClick:X},[p.createElementVNode("div",mce,[p.createElementVNode("span",gce,[f.value?(p.openBlock(),p.createElementBlock("img",{key:0,src:f.value.url,alt:"icono",class:"option-img-graph2"},null,8,yce)):d.value?(p.openBlock(),p.createElementBlock("img",{key:1,src:q(d.value.name,!1),alt:"icono",class:"option-img"},null,8,vce)):p.createCommentVNode("",!0)]),p.createElementVNode("span",xce,p.toDisplayString(Y()),1),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:z.value}])},[...ye[5]||(ye[5]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),z.value&&d.value?(p.openBlock(),p.createElementBlock("div",bce,[p.createElementVNode("div",_ce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(s.value,De=>(p.openBlock(),p.createElementBlock("div",{key:De.id,class:p.normalizeClass(["option-card-grid",{active:c.value===De.id}]),onClick:p.withModifiers(Re=>ee(De),["stop"])},[p.createElementVNode("div",Tce,p.toDisplayString(De.name||De.title),1),p.createElementVNode("div",kce,[p.createElementVNode("img",{src:De.url,alt:"icono",class:"option-img-grid"},null,8,Sce)])],10,wce))),128))])])):p.createCommentVNode("",!0)],2)):p.createCommentVNode("",!0),f.value?(p.openBlock(),p.createElementBlock("div",Ece)):p.createCommentVNode("",!0),f.value&&T.value&&A()?(p.openBlock(),p.createElementBlock("div",{key:2,class:p.normalizeClass(["dynamic-filters",{"dynamic-filters-wide":T.value.length>=2}])},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(T.value,(De,Re)=>(p.openBlock(),p.createElementBlock(p.Fragment,{key:Re},[De.type==="select"?(p.openBlock(),p.createElementBlock("div",{key:0,class:"custom-select dynamic-select filter-inline",onClick:p.withModifiers(Ve=>Z(Re),["stop"])},[p.createElementVNode("div",Cce,[ye[7]||(ye[7]=p.createElementVNode("span",{class:"select-icon select-analisis-icon"},[p.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/report-maker/iconocategorias.png",alt:"icono categorías",style:{width:"18px",height:"18px","object-fit":"contain"}})],-1)),ye[8]||(ye[8]=p.createElementVNode("span",{class:"select-label"}," Tipo de análisis ",-1)),Array.isArray(m.value[Re])&&m.value[Re].length>0?(p.openBlock(),p.createElementBlock("span",Mce,p.toDisplayString(m.value[Re].length),1)):p.createCommentVNode("",!0),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:V.value===Re}])},[...ye[6]||(ye[6]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),V.value===Re?(p.openBlock(),p.createElementBlock("div",Lce,[p.createElementVNode("div",Nce,[p.createElementVNode("div",{class:"multi-select-header",onClick:ye[1]||(ye[1]=p.withModifiers(()=>{},["stop"]))},[p.createElementVNode("label",Ice,[p.createElementVNode("input",{type:"checkbox",checked:L(Re),indeterminate:N(Re),onChange:p.withModifiers(Ve=>R(Re),["stop"]),onClick:ye[0]||(ye[0]=p.withModifiers(()=>{},["stop"]))},null,40,Rce),ye[9]||(ye[9]=p.createElementVNode("span",{class:"select-all-label"},"Agregar todas",-1))])]),(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(De.options,Ve=>(p.openBlock(),p.createElementBlock("div",{key:Ve.value,class:p.normalizeClass(["option-card multi-select-option",{active:E(Re,Ve.value)}]),onClick:ye[2]||(ye[2]=p.withModifiers(()=>{},["stop"]))},[p.createElementVNode("div",Oce,[p.createElementVNode("input",{type:"checkbox",checked:E(Re,Ve.value),onChange:p.withModifiers(We=>S(Re,Ve.value),["stop"])},null,40,Pce)]),p.createElementVNode("div",{class:"option-content",onClick:We=>S(Re,Ve.value)},[p.createElementVNode("div",Dce,p.toDisplayString(Ve.label),1)],8,zce)],2))),128))]),p.createElementVNode("div",Bce,[p.createElementVNode("button",{class:"btn-listo",onClick:ye[3]||(ye[3]=p.withModifiers(Ve=>Me(),["stop"]))},"Listo")])])):p.createCommentVNode("",!0)],8,Ace)):De.type==="radio-button"?(p.openBlock(),p.createElementBlock("div",Vce,[p.createElementVNode("div",Fce,p.toDisplayString(De.label),1),p.createElementVNode("div",jce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(De.options,Ve=>(p.openBlock(),p.createElementBlock("label",{key:Ve.value,class:p.normalizeClass(["radio-option-card",{active:m.value[Re]===Ve.value}])},[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"dynamic-radio-"+Re,value:Ve.value,"onUpdate:modelValue":We=>m.value[Re]=We,disabled:k(Ve.value,Ve.label),onChange:()=>{var We,Je,ke;if(console.log("Radio button changed for GSCFieldDataByZones:",m.value[Re]),((We=f.value.value)==null?void 0:We.id)===9&&u.value.value&&(ke=(Je=p.unref(t))==null?void 0:Je.view)!=null&&ke.filterMultiple){const ze=m.value[Re]===1;p.unref(t).view.filterMultiple.isHomeTeam=ze,console.log("GSCFieldDataByZones - preserved radio-button value in filterMultiple:",ze)}u.value.value&&Ie(),he()}},null,40,Uce),[[p.vModelRadio,m.value[Re]]]),p.createElementVNode("span",null,p.toDisplayString(Ve.label),1)],2))),128))])])):De.type==="check"?(p.openBlock(),p.createElementBlock("div",qce,[p.createElementVNode("label",null,[p.withDirectives(p.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":Ve=>m.value[Re]=Ve,checked:m.value[Re],onChange:()=>{console.log(`Checkbox ${Re} changed to:`,m.value[Re]),u.value.value&&Ie(),he()}},null,40,Wce),[[p.vModelCheckbox,m.value[Re]]]),p.createTextVNode(" "+p.toDisplayString(De.label),1)])])):De.type==="select-simple"?(p.openBlock(),p.createElementBlock("div",{key:3,class:"custom-select dynamic-select filter-inline","data-filter-type":De.type,onClick:p.withModifiers(Ve=>te(Re),["stop"])},[p.createElementVNode("div",Hce,[ye[11]||(ye[11]=p.createElementVNode("span",{class:"select-icon select-analisis-icon"},[p.createElementVNode("img",{src:"https://golstatsimages.blob.core.windows.net/report-maker/iconocategorias.png",alt:"icono categorías",style:{width:"18px",height:"18px","object-fit":"contain"}})],-1)),ye[12]||(ye[12]=p.createElementVNode("span",{class:"select-label"}," Tipo de análisis ",-1)),p.createElementVNode("span",{class:p.normalizeClass(["arrow",{open:U.value===Re}])},[...ye[10]||(ye[10]=[p.createElementVNode("svg",{width:"16",height:"14",viewBox:"0 0 16 14",fill:"none"},[p.createElementVNode("path",{d:"M3 5L8 10L13 5",stroke:"#AAB4BE","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)]),U.value===Re?(p.openBlock(),p.createElementBlock("div",Xce,[p.createElementVNode("div",Jce,[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(De.options,Ve=>(p.openBlock(),p.createElementBlock("div",{key:Ve.value,class:p.normalizeClass(["option-card simple-select-option",{active:m.value[Re]===Ve.value}]),onMouseenter:We=>Te(Re,Ve.value),onClick:p.withModifiers(We=>ae(Re,Ve.value),["stop"])},[p.createElementVNode("div",Zce,[p.createElementVNode("div",Yce,p.toDisplayString(Ve.label),1)]),m.value[Re]===Ve.value?(p.openBlock(),p.createElementBlock("div",Qce,[...ye[13]||(ye[13]=[p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},[p.createElementVNode("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#cbee6b","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):p.createCommentVNode("",!0)],42,Kce))),128))])])):p.createCommentVNode("",!0)],8,Gce)):p.createCommentVNode("",!0),Re===1&&T.value.length>2?(p.openBlock(),p.createElementBlock("div",$ce)):p.createCommentVNode("",!0)],64))),128))],2)):p.createCommentVNode("",!0),u.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("button",{key:3,class:"cancel-btn",onClick:be},"Cancelar")),e.value?(p.openBlock(),p.createElementBlock("button",{key:4,class:"ok-btn",onClick:_e},"OK")):p.createCommentVNode("",!0)]))}}),tue=dd(eue,[["__scopeId","data-v-113a6c74"]]),rue={key:0,class:"modal-simple"},nue={class:"modal-simple__content"},iue={class:"modal-simple__content__header"},aue={class:"modal-simple__content__body"},oue={class:"modal-simple__content__footer"},sue={__name:"ModalSimple",props:{modelValue:{type:Boolean,default:!1}},setup(r){return(a,g)=>(p.openBlock(),p.createBlock(p.Teleport,{to:"body"},[r.modelValue?(p.openBlock(),p.createElementBlock("div",rue,[p.createElementVNode("div",nue,[p.createElementVNode("div",iue,[p.renderSlot(a.$slots,"header",{},void 0,!0)]),p.createElementVNode("div",aue,[p.renderSlot(a.$slots,"body",{},void 0,!0)]),p.createElementVNode("div",oue,[p.renderSlot(a.$slots,"footer",{},void 0,!0)])])])):p.createCommentVNode("",!0)]))}},lue=dd(sue,[["__scopeId","data-v-1cc4f590"]]),cue={class:"footer"},uue={__name:"ModalCautionClose",props:{value:{type:Boolean,default:!1}},emits:["update:modelValue","action"],setup(r,{emit:a}){const g=a;function B(C){g("update:modelValue",C)}function K(C){g("action",C),g("update:modelValue",!1)}return(C,b)=>(p.openBlock(),p.createBlock(lue,{"modle-value":r.value,"onUpdate:modelValue":B},{header:p.withCtx(()=>[...b[2]||(b[2]=[p.createElementVNode("div",{class:"header"},"Descartar template",-1)])]),body:p.withCtx(()=>[...b[3]||(b[3]=[p.createElementVNode("div",{class:"body"},"¿Estás seguro que deseas abandonar el proceso?",-1)])]),footer:p.withCtx(()=>[p.createElementVNode("div",cue,[p.createElementVNode("div",{role:"button",class:"btn btn-cancel",onClick:b[0]||(b[0]=t=>K(!1))}," Seguir editando "),p.createElementVNode("div",{role:"button",class:"btn btn-confirm",onClick:b[1]||(b[1]=t=>K(!0))}," Descartar ")])]),_:1},8,["modle-value"]))}},due=dd(uue,[["__scopeId","data-v-ed9b5088"]]),hue={key:0,class:"modal-simple"},pue={__name:"ModalChangesSaved",props:{modelValue:{type:Boolean,default:!1}},setup(r){return(a,g)=>(p.openBlock(),p.createBlock(p.Teleport,{to:"body"},[p.createVNode(p.Transition,null,{default:p.withCtx(()=>[r.modelValue?(p.openBlock(),p.createElementBlock("div",hue,[...g[0]||(g[0]=[p.createElementVNode("div",{class:"modal-simple__content"},[p.createElementVNode("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M29.3346 14.7823V16.0089C29.333 18.8842 28.402 21.6818 26.6804 23.9847C24.9589 26.2876 22.539 27.9722 19.7818 28.7875C17.0245 29.6027 14.0776 29.5048 11.3806 28.5084C8.68354 27.512 6.38084 25.6704 4.81592 23.2584C3.25099 20.8463 2.50769 17.993 2.69687 15.124C2.88605 12.255 3.99758 9.52404 5.86568 7.33836C7.73377 5.15269 10.2583 3.62944 13.0629 2.9958C15.8674 2.36215 18.8017 2.65205 21.428 3.82227",stroke:"#CDEF71","stroke-width":"2.66667","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M29.3333 5.33203L16 18.6787L12 14.6787",stroke:"#CDEF71","stroke-width":"2.66667","stroke-linecap":"round","stroke-linejoin":"round"})]),p.createElementVNode("div",{class:"modal-simple__content__text"}," Los cambios se han guardado correctamente ")],-1)])])):p.createCommentVNode("",!0)]),_:1})]))}},fue=dd(pue,[["__scopeId","data-v-2bc30783"]]),mue={class:"template-maker__header"},gue={key:0,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yue={class:"template-maker__content"},vue={class:"template-maker__content__main"},xue={id:"containerMain",class:"container-main"},bue={class:"template-maker__content__main__cover-selector"},_ue=["id"],wue={class:"page-indicator"},Tue={class:"page-indicator__index"},kue=["onClick"],Sue=["onClick"],Eue={key:0,class:"template-maker__content__main__footer"},Aue={class:"template-maker__content__main__footer__paginator"},Cue={class:"template-maker__content__main__footer__paginator__nav"},Mue={class:"template-maker__content__main__footer__paginator__numbers"},Lue=["onClick"],Nue={__name:"GSC-TemplateReportMaker",props:{token:{type:String,default:""},userTeamId:{type:Number,default:0}},emits:["close"],setup(r,{expose:a,emit:g}){const B=new Map,K=p.ref([{title:"Page 1",id:String(Date.now()),items:[{name:"Volumetrica",id:`w-${String(Date.now())}`,x:0,y:0,w:4,h:6,maxWidth:4,maxHeight:4,noResize:!1,noMove:!1,componentProps:{}},{name:"Volumetrica",id:String(Date.now()),x:4,y:0,w:4,h:4,maxWidth:4,maxHeight:4,noResize:!1,noMove:!1,componentProps:{}}]}]),C=p.ref(null),b=p.ref(0),t=p.ref(!1),v=p.ref(null),u=p.ref(null),e=p.ref(!0),w=p.ref(!1),y=p.ref(!1),x=p.ref(0),h=p.ref(!1),n=p.ref(null),i=p.ref(new Map),d=p.ref(null),s=p.ref(null),c=p.ref(!1),f=p.ref(!1),m=p.ref(!1),T=p.computed(()=>({"--overflow-y-template-maker":w.value?"scroll":"hidden","--height-container-main":w.value?"fit-content":"calc(100vh - 64px)","--margin-bottom-container-main":(w.value,"0")})),E=p.computed(()=>b.value+1);p.watch(()=>t.value,Te=>{const Ce=document.getElementById("app");Te?(b.value=0,document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",Ce&&(Ce.style.overflow="hidden")):(document.body.style.overflow="",document.documentElement.style.overflow="",Ce&&(Ce.style.overflow=""))});function S(Te){return Te<10?`0${Te}`:Te}async function L({templateId:Te,userId:Ce}){try{return(await(await fetch(`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/users/${Ce}/templates/${Te}`,{method:"GET",headers:{Authorization:Z.token}})).json()).data}catch(Ne){console.error("Error fetching template by ID:",Ne)}}async function N({reportId:Te,userId:Ce}){try{return(await(await fetch(`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/users/${Ce}/reports/${Te}`,{method:"GET",headers:{Authorization:Z.token}})).json()).data}catch(Ne){console.error("Error fetching report by ID:",Ne)}}let A=0;function I(Te){C.value=Te,A>0&&(c.value=!0),A++}function M(Te){Te&&oe(null,!0)}let k=null;function R(Te,Ce){let Ne=Te.getBoundingClientRect(),Oe={height:Te.clientHeight,width:Te.clientWidth},Ge=Ce.getBoundingClientRect();if(!(Ge.top>=Ne.top&&Ge.bottom<=Ne.top+Oe.height)){const Le=Ge.top-Ne.top,je=Ge.bottom-Ne.bottom;Math.abs(Le)<Math.abs(je)?Te.scrollTop+=Le:Te.scrollTop+=je}}function _(Te,Ce){let Ne=Te.getBoundingClientRect();const Oe=Ce.getBoundingClientRect().top-Ne.top;Te.scrollTop+=Oe}function O(Te,Ce=!1){const Ne={title:`Page ${K.value.length+1}`,id:`p-${Date.now()}`,items:[]};if(ge(),Te!==void 0&&Te>=-1?K.value.splice(Te+1,0,Ne):K.value.push(Ne),p.nextTick(()=>{const Oe=K.value.findIndex(Le=>Le.id===Ne.id),Ge=document.getElementById(`page-${Oe+1}`);k||(k=document.getElementById("containerMain")),Ge&&k?R(k,Ge):console.error("Page element or container main element not found")}),Ce)return Ne;c.value=!0}function z(Te){if(console.log("onClickPage",Te),Te<0||Te>K.value.length){console.log("Invalid page index:",Te,"Valid range: 0 to",K.value.length);return}b.value=Te;const Ce=document.getElementById(`page-${Te}`);if(console.log("pageElement found:",Ce),k||(k=document.getElementById("containerMain")),console.log("containerMainEl found:",k),Ce&&k){const Ne=new CustomEvent("programmatic-scroll-start");document.dispatchEvent(Ne),_(k,Ce),setTimeout(()=>{const Oe=new CustomEvent("programmatic-scroll-end");document.dispatchEvent(Oe)},300)}else console.error("Page element or container main element not found")}function V(Te){d.value=Te,h.value=!0}function U(Te,Ce){const Ne=Ce+1;Te&&b.value!==Ne&&(b.value=Ne)}function q(Te){h.value=!0,Ai.emit("edit-view",{view:Te})}async function W({templateReportId:Te,userId:Ce,isTemplateMode:Ne}){try{return Ne?L({templateId:Te,userId:Ce}):N({reportId:Te,userId:Ce})}catch(Oe){throw new Error("Error fetching template or report by ID: "+Oe.message)}}function Y(){A=0,h.value=!1,b.value=0,d.value=null,s.value=null,i.value.clear(),k=null}async function ne(Te){if(console.log("show, initialConfig",Te),Y(),e.value=Te.isTemplateMode,console.log("****************************************** isTemplateMode.value",e.value),w.value=!!Te.isPDFMode,Te.isPDFMode?v.value=await N({reportId:Te.reportId,userId:Te.userId}):(v.value=Te.template,v.value=await W({templateReportId:Te.template.id,userId:Te.template.user_id,isTemplateMode:Te.isTemplateMode})),!v.value)return;v.value&&v.value.game&&(v.value.game=ae(v.value.game)),console.log("templateToEdit.value",v.value),u.value=JSON.parse(JSON.stringify(v.value)),y.value=v.value.template_type===2;const Ce=v.value.pages.find(Ne=>Ne.is_front_page);x.value=Ce?Ce.type:1,t.value=!0,K.value=v.value.pages.reduce((Ne,Oe,Ge)=>{if(!Oe.is_front_page){Oe.name||(Oe.name="");const Le={originalPage:JSON.parse(JSON.stringify(Oe)),title:Oe.name,id:`p-${Date.now()-Ge*9}`,items:[],components:Oe.components};Oe.components&&Oe.components.length>0&&(Le.items=Oe.components.map((je,Ie)=>{const me=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[],je.coreView.id,je.dynamicFilters,y.value,e.value,je.filtersJSON||null,Z.token),ve={originalComponent:JSON.parse(JSON.stringify(je)),title:je.title,game:v.value.game,idAux:je.id,id:`w-${Date.now()-Ie*7}`,x:je.column,y:je.row,w:je.colspan,h:je.rowspan,maxWidth:je.max_column,maxHeight:je.max_row,minWidth:je.min_column,minHeight:je.min_row,noResize:!e.value,noMove:!e.value,coreView:je.coreView||null,isTemplateMode:e.value,componentName:je.componentName,componentProps:ee({currentProps:je.componentProps,coreView:je.coreView,isTemplateMode:e.value,templateToEdit:v.value,filterMultiple:je.filterMultiple||null,game:v.value.game||null})||{},filterMultiple:je.filterMultiple,isHomeTeam:re({game:v.value.game,isTemplateMode:e.value,currentIsHomeTeam:je.isHomeTeam||je.componentProps.isHomeTeamForAnalysis}),filtersJSON:je.filtersJSON||null,dynamicFilters:je.dynamicFilters||[],filterAndViewsContainer:me},ye=p.reactive({view:ve});return me.addView(ye,!0),i.value.set(me.getId(),me),ve})),Ne.push(Le)}return Ne},[]),console.log("pages.value",K.value),console.log("isvisible.value",t.value)}function X({game:Te,isTemplateMode:Ce}){const Ne=Te&&Te.homeTeam&&Te.awayTeam&&(Te.homeTeam.team_id===Z.userTeamId||Te.awayTeam.team_id===Z.userTeamId);return{isUserTeamHome:Ne&&Te.homeTeam.team_id===Z.userTeamId,requiresUserTeamAdjustment:Ne&&!Ce}}function re({game:Te,isTemplateMode:Ce,currentIsHomeTeam:Ne}){const{isUserTeamHome:Oe,requiresUserTeamAdjustment:Ge}=X({game:Te,isTemplateMode:Ce});return Ge?Ne?Oe:!Oe:Ne}function ee({currentProps:Te,coreView:Ce,templateToEdit:Ne,isTemplateMode:Oe,filterMultiple:Ge,game:Le}){if(!Te||!Ce)return Te||{};const{isUserTeamHome:je,requiresUserTeamAdjustment:Ie}=X({game:Le,isTemplateMode:Oe}),me={...Te};if(Ce.id===5&&(me.isGhostEffect=Oe,Ie)){const ve=me.preMatchType===1;me.preMatchType=ve?je?1:2:je?2:1}if(Ce.id===7&&Ie){const ve=me.isHomeTeamForAnalysis;me.isHomeTeamForAnalysis=ve?je:!je}if(Ce.id===9&&Ie){const ve=me.isHomeTeamForAnalysis;me.isHomeTeamForAnalysis=ve?je:!je}if(Ce.id===10&&Ie){const ve=me.isHomeTeamForAnalysis;me.isHomeTeamForAnalysis=ve?je:!je}if(Ce.id===1&&(me.gameId=Le?Le.id:"",me.homeLogo=Le?Le.homeTeam.logo:"",me.awayLogo=Le?Le.awayTeam.logo:"",me.seasonId=Le?Le.season_id:0,me.default=Oe),Ce.id===6&&(me.game=Le||"",me.lastGames=Ne.last_games,me.selectedOption=Ne.template_type===2?"Postmatch":"Prematch"),Ce.id===3&&(me.defaultShields=Oe),Ce.id===2){let ve=!0,ye=0,De=0;Le&&(ve=Ne.main_team==Le.home_team||Ne.main_team==Le.visiting_team,ye=ve?Ne.main_team==(Le==null?void 0:Le.home_team)?Le==null?void 0:Le.home_team:Le==null?void 0:Le.visiting_team:Le==null?void 0:Le.home_team,De=ve?Ne.main_team==(Le==null?void 0:Le.home_team)?Le==null?void 0:Le.visiting_team:Le==null?void 0:Le.home_team:Le==null?void 0:Le.visiting_team),console.log("<- 1 -> ******************** component props //////////////////////////////////",Te),console.log("<- 2 -> ********************",Ce),console.log("<- 3 -> ********************",Ne),console.log("<- 4 -> ********************",Ge),me.gamed=Le?Le.id:"",me.game=Le||"",me.season=Le?Le.season_id:0,me.teamView=Ge.teamType==3?0:Ge.teamType==1?ye:De,me.useDummyData=Oe}return Ce.id===8&&(me.teamSelected=Le?{teamId:Le.home_team}:1,me.isDefault=Oe),Ce.id===4&&(me.gameId=Le?Le.id:"",me.isDefault=Oe,me.homeTeam=Le?Le==null?void 0:Le.home_team:"",me.awayTeam=Le?Le==null?void 0:Le.visiting_team:""),Le&&(me.game=Le),me}const Z=r,te=g;p.watch(()=>Z.token,(Te,Ce)=>{console.log("Token changed:",{newToken:Te,oldToken:Ce})},{immediate:!0}),a({show:ne}),Ai.on("add-page-view",Te=>{console.log("88888888888888888888888888888888888888888888888888888888888888888"),console.log("viewConfig",Te),B.set(Te.view.id,Te.view);const Ce=K.value.find(Ne=>Ne.id===Te.pageId);Ce&&(Ce.items||(Ce.items=[]),Ce.items.push(Te.view),p.nextTick(()=>{const Ne=document.querySelector(`[gs-id="${Te.view.id}"]`);Te.grid.makeWidget(Ne)}))}),Ai.on("add-page-and-view",Te=>{const Ce=K.value.findIndex(Ne=>Ne.id===Te.pageId);if(Ce>-1){const Ne=O(Ce,!0);setTimeout(()=>{Ai.emit("add-view",{pageId:Ne.id,view:Te.view,filterAndWidgetContainer:Te.filterAndWidgetContainer}),s.value&&(Ne.stepBackPage=s.value),s.value=Ne},500)}else console.error("Page not found for adding view:",Te.pageId)}),Ai.on("empty-page",Te=>{h.value&&d.value&&d.value.id===Te.id||(_e(Te),s.value&&s.value.id===Te.id&&(s.value.stepBackPage?s.value=s.value.stepBackPage:s.value=null))}),Ai.on("filters-cancelled",Te=>{Te&&Te.removeAllChildViews()}),Ai.on("activate-save-button",()=>{console.log("GSC-TemplateReportMaker - activate-save-button event received"),c.value=!0,console.log("GSC-TemplateReportMaker - isSaveActive set to true")});function ae(Te){return{...Te,gameId:Te.game_id,id:Te.game_id,seasonId:Te.season_id,status:Te.game_status,homeTeam:{logo:`https://golstatsimages.blob.core.windows.net/teams-150/${Te.home_team}.png`,team_id:Te.home_team,provisional_logo:`https://golstatsimages.blob.core.windows.net/teams-provisional/${Te.home_team}.png`,colloquial_name:Te.home_team_name,acronym:Te.home_team_acronym,team_name:Te.home_team_name},awayTeam:{logo:`https://golstatsimages.blob.core.windows.net/teams-150/${Te.visiting_team}.png`,team_id:Te.visiting_team,provisional_logo:`https://golstatsimages.blob.core.windows.net/teams-provisional/${Te.visiting_team}.png`,colloquial_name:Te.visiting_team_name,acronym:Te.visiting_team_acronym,team_name:Te.visiting_team_name}}}function oe(Te,Ce=!1){Ce||!e.value?(t.value=!1,Y(),te("close")):c.value?f.value=!0:(t.value=!1,Y(),te("close"))}function he(){n.value=null,h.value=!1}function fe({page:Te,view:Ce,applyMinimumSize:Ne=!1}){const Oe=Te.grid;if(!Te||!Ce||!Oe)return null;const Ge=Ne?{w:Ce.min_column,h:Ce.min_row}:{w:Ce.colspan,h:Ce.rowspan},Le=Oe.willItFit(0,0,Ge.w,Ge.h,!0);return Le?{willFit:Le,applyMinimumSize:Ne}:Ne?null:fe({page:Te,view:Ce,applyMinimumSize:!0})}const se=new Set([9]);function ue(Te){var Ce,Ne,Oe,Ge,Le,je,Ie;if(console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"),console.log("onFiltersChanged",Te),Te.dynamicFilters&&Te.dynamicFilters.length>0&&Te.viewToEdit&&Te.viewToEdit.view){const me=Te.viewToEdit.view.id;K.value.forEach(ve=>{ve.items.forEach(ye=>{ye.id===me&&ye.coreView&&ye.coreView.id===3&&(ye.componentProps.desplegable=Te.dynamicFilters[0]||!1,ye.componentProps.key=Te.dynamicFilters[0]||!1,p.nextTick(()=>{Ai.emit("force-component-update",{itemId:ye.id,componentProps:ye.componentProps})}))})})}if(console.log("filters.viewToEdit",Te.viewToEdit),Te.viewToEdit){if(!Te.viewToEdit.view.filterAndViewsContainer||Te.viewToEdit.view.filterAndViewsContainer.childViews.length>1){const me=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[Te.viewToEdit.view],((Ce=Te.viewToEdit.view.coreView)==null?void 0:Ce.id)||Te.viewToEdit.view.id,Te.dynamicFilters||[],y.value,e.value,Te.filtersJSON,Z.token);Te.viewToEdit.view.filterAndViewsContainer=me}Te.viewToEdit.view.filterAndViewsContainer.updateView({view:Te.viewToEdit,dynamicFilters:Te.dynamicFilters||[],filtersJSON:Te.filtersJSON||null}),c.value=!0}else if(Te.view){Te.view.id&&Te.filterAndViewsContainer&&Te.view.id!==Te.filterAndViewsContainer.viewId&&(Te.filterAndViewsContainer.removeAllChildViews(),Te.filterAndViewsContainer.setViewId(Te.view.id),Te.filterAndViewsContainer.setFiltersJSON(Te.filtersJSON||null)),Te.view.id&&se.has(Te.view.id)&&Te.dynamicFilters[0]&&Te.dynamicFilters[0].length===0&&Te.filterAndViewsContainer&&(Te.filterAndViewsContainer.updateDynamicFilters(Te.dynamicFilters,(Oe=(Ne=Te.viewToEdit)==null?void 0:Ne.view)==null?void 0:Oe.id),c.value=!0);const me=s.value||d.value,ve=fe({page:me,view:Te.view,applyMinimumSize:!1});Te.view.filtersJSON=Te.filtersJSON||null;const ye=Te.filterAndViewsContainer,De=K.value.findIndex(Re=>Re.id===me.id);if(ye){const Re=Te.filterAndViewsContainer.getRequiresAddView(Te.dynamicFilters);console.log("111111111111111111111111111111111"),console.log("requiersAddView",Re),Re?(ye.setDynamicFilters(Te.dynamicFilters),(ve||De===K.value.length-1)&&(Ai.emit("add-view",{pageId:me.id,view:Te.view,filterAndWidgetContainer:ye,avoidWillFit:!1,applyMinimumSize:ve?ve.applyMinimumSize:!1,dynamicFilters:Te.dynamicFilters}),Te.filterAndViewsContainer.updateDynamicFilters(Te.dynamicFilters,(Le=(Ge=Te.viewToEdit)==null?void 0:Ge.view)==null?void 0:Le.id),c.value=!0,setTimeout(()=>{Te.filterAndViewsContainer.getRequiresAddView(Te.dynamicFilters)?(console.log("GSCtops - still requires add view, calling recursively"),ue(Te)):console.log("GSCtops - no more views needed, stopping recursion")},1e3))):(Te.filterAndViewsContainer.updateDynamicFilters(Te.dynamicFilters,(Ie=(je=Te.viewToEdit)==null?void 0:je.view)==null?void 0:Ie.id),c.value=!0)}else if(ve||De===K.value.length-1){const Re=new Up(`FAWC-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,[],Te.view.id,Te.dynamicFilters,y.value,e.value,Te.filtersJSON,Z.token);Ai.emit("set-filter-and-views-container",Re),i.value.set(Re.getId(),Re),Te.dynamicFilters&&Array.isArray(Te.dynamicFilters[0])?(Te.filterAndViewsContainer=Re,ue(Te)):Ai.emit("add-view",{pageId:me.id,view:Te.view,filterAndWidgetContainer:Re,avoidWillFit:!1,applyMinimumSize:ve?ve.applyMinimumSize:!1,dynamicFilters:Te.dynamicFilters}),c.value=!0}}}async function de(){if(c.value)try{const Te=[{is_front_page:!0,template_type:C.value.isPostMatch?2:1,type:C.value.id},...K.value.map(Ne=>({columns:Ne.originalPage?Ne.originalPage.columns:12,rows:Ne.originalPage?Ne.originalPage.rows:12,gap:Ne.originalPage?Ne.originalPage.gap:10,name:Ne.title,width:Ne.originalPage?Ne.originalPage.width:968,height:Ne.originalPage?Ne.originalPage.height:702,components:Ne.items.map(Oe=>({min_column:Oe.minWidth,min_row:Oe.minHeight,max_column:Oe.maxWidth,max_row:Oe.maxHeight,column:Oe.x,row:Oe.y,colspan:Oe.w,rowspan:Oe.h,name:Oe.name,title:Oe.title,dynamicFilters:Oe.filterAndViewsContainer.getComponentDynamicFilters(Oe.id)||Oe.filterAndViewsContainer.getDynamicFilters()||[],coreView:Oe.coreView||null,componentName:Oe.componentName,componentProps:Oe.componentProps||{},isHomeTeam:Oe.isHomeTeam||Oe.componentProps.isHomeTeamForAnalysis,filterMultiple:Oe.filterMultiple}))}))];console.log("pagesAuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),console.log(Te);const Ce=await fetch(`https://m9qip57rsh.execute-api.us-east-2.amazonaws.com/prod/users/${v.value.user_id}/templates/${v.value.id}/pages`,{method:"PATCH",headers:{Authorization:Z.token},body:JSON.stringify({pages:Te})});m.value=!0,await Ce.json(),c.value=!1,setTimeout(()=>{m.value=!1},2e3)}catch(Te){console.error("Error saving template:",Te)}}function ge(){K.value.forEach(Te=>{Te.offListeners&&Te.offListeners()})}function _e(Te){const Ce=K.value.findIndex(Ne=>Ne.id===Te.id);Ce>-1&&(ge(),K.value=K.value.filter(Ne=>Ne.id!==Te.id),b.value>=Ce&&(b.value=Math.max(0,b.value-1)),c.value=!0)}function be(){c.value=!0}function Se(Te){const Ce=K.value.find(Ne=>Ne.items.some(Oe=>Oe.id===Te.id));if(Ce){const Ne=Ce.items.findIndex(Oe=>Oe.id===Te.id);Ne!==-1&&(Ce.items.splice(Ne,1),c.value=!0)}}function Me(Te){console.log("onChangeSort",Te)}return(Te,Ce)=>(p.openBlock(),p.createElementBlock(p.Fragment,null,[p.createVNode(due,{modelValue:f.value,"onUpdate:modelValue":Ce[0]||(Ce[0]=Ne=>f.value=Ne),onAction:M},null,8,["modelValue"]),p.createVNode(fue,{"model-value":m.value},null,8,["model-value"]),(p.openBlock(),p.createBlock(p.Teleport,{to:"body"},[t.value&&v.value?(p.openBlock(),p.createElementBlock("div",{key:0,class:"template-maker",style:p.normalizeStyle(T.value)},[p.withDirectives(p.createVNode(tue,{token:r.token,view:n.value,"is-post-match":y.value,onClose:he,onFiltersChanged:ue},null,8,["token","view","is-post-match"]),[[p.vShow,e.value&&h.value]]),p.createElementVNode("div",mue,[p.createTextVNode(p.toDisplayString(v.value?v.value.name:"Nuevo template")+" ",1),p.createElementVNode("div",{class:"template-maker__header__close",onClick:oe},[w.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("svg",gue,[...Ce[6]||(Ce[6]=[p.createElementVNode("path",{d:"M1.33398 1.33398L14.6673 14.6673",stroke:"#FFFFFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),p.createElementVNode("path",{d:"M14.666 1.33398L1.33268 14.6673",stroke:"#FFFFFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))])]),p.createElementVNode("div",yue,[Ce[13]||(Ce[13]=p.createElementVNode("div",{class:"template-maker__content__sidebar"},null,-1)),p.createElementVNode("div",vue,[p.createElementVNode("div",xue,[p.createElementVNode("div",bue,[p.withDirectives(p.createVNode(QT,{"is-post-match":y.value,"initial-cover-id":x.value,onSelectCover:I},null,8,["is-post-match","initial-cover-id"]),[[p.vShow,e.value]])]),(p.openBlock(),p.createElementBlock("div",{class:"template-maker__content__main__pages",key:K.value.length},[C.value?(p.openBlock(),p.createBlock($le,{key:0,id:"page-0",game:v.value.game||null,"cover-id":C.value.id,"is-post-match":C.value.isPostMatch,onIntersectionChanged:Ce[1]||(Ce[1]=Ne=>U(Ne,-1))},null,8,["game","cover-id","is-post-match"])):p.createCommentVNode("",!0),e.value?(p.openBlock(),p.createElementBlock("div",{key:1,class:"new-items-buttons",style:p.normalizeStyle({"margin-bottom":K.value.length===0?"30px":"0"})},[h.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("div",{key:0,class:"new-items-buttons__add-page new-item-button",onClick:Ce[2]||(Ce[2]=Ne=>O(-1))},[...Ce[7]||(Ce[7]=[p.createElementVNode("div",null,"+ Nueva página",-1),p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M8.66797 1.33203H4.0013C3.64768 1.33203 3.30854 1.47251 3.05849 1.72256C2.80844 1.9726 2.66797 2.31174 2.66797 2.66536V13.332C2.66797 13.6857 2.80844 14.0248 3.05849 14.2748C3.30854 14.5249 3.64768 14.6654 4.0013 14.6654H12.0013C12.3549 14.6654 12.6941 14.5249 12.9441 14.2748C13.1942 14.0248 13.3346 13.6857 13.3346 13.332V5.9987L8.66797 1.33203Z",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M8.66797 1.33203V5.9987H13.3346",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]))],4)):p.createCommentVNode("",!0),(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(K.value,(Ne,Oe)=>(p.openBlock(),p.createElementBlock("div",{key:Oe,id:`page-${Oe+1}`,class:"template-maker__content__main__pages__page"},[p.createElementVNode("div",wue,[p.createElementVNode("div",Tue,"Pag "+p.toDisplayString(S(Oe+2)),1)]),C.value?(p.openBlock(),p.createBlock(tle,{key:0,page:Ne,"is-template-mode":e.value,"is-post-match":C.value.isPostMatch,game:v.value.game||null,lastGames:v.value.lastGames||[],"is-filter-visible":h.value,onEditView:q,onIntersectionChanged:Ge=>U(Ge,Oe),onChangeSort:Me,onDeletePage:_e,onViewChanged:be,onDeleteView:Se},null,8,["page","is-template-mode","is-post-match","game","lastGames","is-filter-visible","onIntersectionChanged"])):p.createCommentVNode("",!0),e.value&&!h.value?(p.openBlock(),p.createElementBlock("div",{key:1,class:"new-items-buttons",style:p.normalizeStyle({"margin-bottom":Oe+1===K.value.length?"30px":"0","margin-top":"10px"})},[p.createElementVNode("div",{class:"new-items-buttons__add-page new-item-button",onClick:Ge=>O(Oe)},[...Ce[8]||(Ce[8]=[p.createElementVNode("div",null,"+ Nueva página",-1),p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M8.66797 1.33203H4.0013C3.64768 1.33203 3.30854 1.47251 3.05849 1.72256C2.80844 1.9726 2.66797 2.31174 2.66797 2.66536V13.332C2.66797 13.6857 2.80844 14.0248 3.05849 14.2748C3.30854 14.5249 3.64768 14.6654 4.0013 14.6654H12.0013C12.3549 14.6654 12.6941 14.5249 12.9441 14.2748C13.1942 14.0248 13.3346 13.6857 13.3346 13.332V5.9987L8.66797 1.33203Z",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M8.66797 1.33203V5.9987H13.3346",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,kue),p.createElementVNode("div",{class:"new-items-buttons__add-item new-item-button",onClick:Ge=>V(Ne)},[...Ce[9]||(Ce[9]=[p.createElementVNode("div",null,"+ Agregar gráfico",-1),p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M12 13.3346V6.66797",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M8 13.3346V2.66797",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M4 13.332V9.33203",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],8,Sue)],4)):p.createCommentVNode("",!0)],8,_ue))),128))]))]),w.value?p.createCommentVNode("",!0):(p.openBlock(),p.createElementBlock("div",Eue,[p.createElementVNode("div",Aue,[p.createElementVNode("div",Cue,[p.createElementVNode("div",null,"Páginas "+p.toDisplayString(E.value),1),p.createElementVNode("div",{class:p.normalizeClass(["template-maker__content__main__footer__paginator__nav__arrow",{disabled:b.value<=0}]),onClick:Ce[3]||(Ce[3]=Ne=>b.value>0&&z(b.value-1))},[...Ce[10]||(Ce[10]=[p.createElementVNode("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.22444 5L5.29079 8.57741C5.56974 8.90285 5.56974 9.43049 5.29079 9.75592C5.01184 10.0814 4.55958 10.0814 4.28064 9.75592L0.709209 5.58926C0.430263 5.26382 0.430263 4.73618 0.709209 4.41074L4.28064 0.244078C4.55958 -0.0813593 5.01184 -0.0813592 5.29079 0.244078C5.56974 0.569515 5.56974 1.09715 5.29079 1.42259L2.22444 5Z",fill:"#92929D"})],-1)])],2),p.createElementVNode("div",{class:p.normalizeClass(["template-maker__content__main__footer__paginator__nav__arrow",{disabled:b.value>=K.value.length}]),onClick:Ce[4]||(Ce[4]=Ne=>b.value<K.value.length&&z(b.value+1))},[...Ce[11]||(Ce[11]=[p.createElementVNode("svg",{width:"6",height:"10",viewBox:"0 0 6 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.77556 5L0.70921 8.57741C0.430264 8.90285 0.430264 9.43049 0.70921 9.75592C0.988156 10.0814 1.44042 10.0814 1.71936 9.75592L5.29079 5.58926C5.56974 5.26382 5.56974 4.73618 5.29079 4.41074L1.71936 0.244078C1.44042 -0.0813593 0.988155 -0.0813592 0.709209 0.244078C0.430264 0.569515 0.430264 1.09715 0.70921 1.42259L3.77556 5Z",fill:"#92929D"})],-1)])],2)]),p.createElementVNode("div",Mue,[p.createElementVNode("div",{role:"button",class:p.normalizeClass({active:b.value===0}),onClick:Ce[5]||(Ce[5]=Ne=>z(0))},p.toDisplayString(S(1)),3),(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(K.value,(Ne,Oe)=>(p.openBlock(),p.createElementBlock("div",{role:"button",key:Oe,class:p.normalizeClass({active:Oe+1===b.value}),onClick:Ge=>z(Oe+1)},p.toDisplayString(S(Oe+2)),11,Lue))),128))])]),e.value?(p.openBlock(),p.createElementBlock("div",{key:0,role:"button",class:p.normalizeClass(["template-maker__content__main__footer__save save-button",{disabled:!c.value}]),onClick:de},[...Ce[12]||(Ce[12]=[p.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[p.createElementVNode("path",{d:"M12.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V3.33333C2 2.97971 2.14048 2.64057 2.39052 2.39052C2.64057 2.14048 2.97971 2 3.33333 2H10.6667L14 5.33333V12.6667C14 13.0203 13.8595 13.3594 13.6095 13.6095C13.3594 13.8595 13.0203 14 12.6667 14Z",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M11.3346 14.0013V8.66797H4.66797V14.0013",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"}),p.createElementVNode("path",{d:"M4.66797 2V5.33333H10.0013",stroke:"white","stroke-width":"1.33333","stroke-linecap":"round","stroke-linejoin":"round"})],-1),p.createElementVNode("div",null,"Guardar",-1)])],2)):p.createCommentVNode("",!0)]))])])],4)):p.createCommentVNode("",!0)]))],64))}},Iue=dd(Nue,[["__scopeId","data-v-e8645e22"]]);function z6(r,a){return function(){return r.apply(a,arguments)}}const{toString:Rue}=Object.prototype,{getPrototypeOf:H2}=Object,{iterator:oy,toStringTag:D6}=Symbol,sy=(r=>a=>{const g=Rue.call(a);return r[g]||(r[g]=g.slice(8,-1).toLowerCase())})(Object.create(null)),ed=r=>(r=r.toLowerCase(),a=>sy(a)===r),ly=r=>a=>typeof a===r,{isArray:qp}=Array,am=ly("undefined");function om(r){return r!==null&&!am(r)&&r.constructor!==null&&!am(r.constructor)&&fu(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const B6=ed("ArrayBuffer");function Oue(r){let a;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?a=ArrayBuffer.isView(r):a=r&&r.buffer&&B6(r.buffer),a}const Pue=ly("string"),fu=ly("function"),V6=ly("number"),sm=r=>r!==null&&typeof r=="object",zue=r=>r===!0||r===!1,cy=r=>{if(sy(r)!=="object")return!1;const a=H2(r);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(D6 in r)&&!(oy in r)},Due=r=>{if(!sm(r)||om(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},Bue=ed("Date"),Vue=ed("File"),Fue=ed("Blob"),jue=ed("FileList"),Uue=r=>sm(r)&&fu(r.pipe),que=r=>{let a;return r&&(typeof FormData=="function"&&r instanceof FormData||fu(r.append)&&((a=sy(r))==="formdata"||a==="object"&&fu(r.toString)&&r.toString()==="[object FormData]"))},Wue=ed("URLSearchParams"),[Gue,Hue,Xue,Jue]=["ReadableStream","Request","Response","Headers"].map(ed),Kue=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function lm(r,a,{allOwnKeys:g=!1}={}){if(r===null||typeof r>"u")return;let B,K;if(typeof r!="object"&&(r=[r]),qp(r))for(B=0,K=r.length;B<K;B++)a.call(null,r[B],B,r);else{if(om(r))return;const C=g?Object.getOwnPropertyNames(r):Object.keys(r),b=C.length;let t;for(B=0;B<b;B++)t=C[B],a.call(null,r[t],t,r)}}function F6(r,a){if(om(r))return null;a=a.toLowerCase();const g=Object.keys(r);let B=g.length,K;for(;B-- >0;)if(K=g[B],a===K.toLowerCase())return K;return null}const Yh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,j6=r=>!am(r)&&r!==Yh;function X2(){const{caseless:r}=j6(this)&&this||{},a={},g=(B,K)=>{const C=r&&F6(a,K)||K;cy(a[C])&&cy(B)?a[C]=X2(a[C],B):cy(B)?a[C]=X2({},B):qp(B)?a[C]=B.slice():a[C]=B};for(let B=0,K=arguments.length;B<K;B++)arguments[B]&&lm(arguments[B],g);return a}const Zue=(r,a,g,{allOwnKeys:B}={})=>(lm(a,(K,C)=>{g&&fu(K)?r[C]=z6(K,g):r[C]=K},{allOwnKeys:B}),r),Yue=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Que=(r,a,g,B)=>{r.prototype=Object.create(a.prototype,B),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:a.prototype}),g&&Object.assign(r.prototype,g)},$ue=(r,a,g,B)=>{let K,C,b;const t={};if(a=a||{},r==null)return a;do{for(K=Object.getOwnPropertyNames(r),C=K.length;C-- >0;)b=K[C],(!B||B(b,r,a))&&!t[b]&&(a[b]=r[b],t[b]=!0);r=g!==!1&&H2(r)}while(r&&(!g||g(r,a))&&r!==Object.prototype);return a},ede=(r,a,g)=>{r=String(r),(g===void 0||g>r.length)&&(g=r.length),g-=a.length;const B=r.indexOf(a,g);return B!==-1&&B===g},tde=r=>{if(!r)return null;if(qp(r))return r;let a=r.length;if(!V6(a))return null;const g=new Array(a);for(;a-- >0;)g[a]=r[a];return g},rde=(r=>a=>r&&a instanceof r)(typeof Uint8Array<"u"&&H2(Uint8Array)),nde=(r,a)=>{const B=(r&&r[oy]).call(r);let K;for(;(K=B.next())&&!K.done;){const C=K.value;a.call(r,C[0],C[1])}},ide=(r,a)=>{let g;const B=[];for(;(g=r.exec(a))!==null;)B.push(g);return B},ade=ed("HTMLFormElement"),ode=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(g,B,K){return B.toUpperCase()+K}),U6=(({hasOwnProperty:r})=>(a,g)=>r.call(a,g))(Object.prototype),sde=ed("RegExp"),q6=(r,a)=>{const g=Object.getOwnPropertyDescriptors(r),B={};lm(g,(K,C)=>{let b;(b=a(K,C,r))!==!1&&(B[C]=b||K)}),Object.defineProperties(r,B)},lde=r=>{q6(r,(a,g)=>{if(fu(r)&&["arguments","caller","callee"].indexOf(g)!==-1)return!1;const B=r[g];if(fu(B)){if(a.enumerable=!1,"writable"in a){a.writable=!1;return}a.set||(a.set=()=>{throw Error("Can not rewrite read-only method '"+g+"'")})}})},cde=(r,a)=>{const g={},B=K=>{K.forEach(C=>{g[C]=!0})};return qp(r)?B(r):B(String(r).split(a)),g},ude=()=>{},dde=(r,a)=>r!=null&&Number.isFinite(r=+r)?r:a;function hde(r){return!!(r&&fu(r.append)&&r[D6]==="FormData"&&r[oy])}const pde=r=>{const a=new Array(10),g=(B,K)=>{if(sm(B)){if(a.indexOf(B)>=0)return;if(om(B))return B;if(!("toJSON"in B)){a[K]=B;const C=qp(B)?[]:{};return lm(B,(b,t)=>{const v=g(b,K+1);!am(v)&&(C[t]=v)}),a[K]=void 0,C}}return B};return g(r,0)},fde=ed("AsyncFunction"),mde=r=>r&&(sm(r)||fu(r))&&fu(r.then)&&fu(r.catch),W6=((r,a)=>r?setImmediate:a?((g,B)=>(Yh.addEventListener("message",({source:K,data:C})=>{K===Yh&&C===g&&B.length&&B.shift()()},!1),K=>{B.push(K),Yh.postMessage(g,"*")}))(`axios@${Math.random()}`,[]):g=>setTimeout(g))(typeof setImmediate=="function",fu(Yh.postMessage)),gde=typeof queueMicrotask<"u"?queueMicrotask.bind(Yh):typeof process<"u"&&process.nextTick||W6,Hn={isArray:qp,isArrayBuffer:B6,isBuffer:om,isFormData:que,isArrayBufferView:Oue,isString:Pue,isNumber:V6,isBoolean:zue,isObject:sm,isPlainObject:cy,isEmptyObject:Due,isReadableStream:Gue,isRequest:Hue,isResponse:Xue,isHeaders:Jue,isUndefined:am,isDate:Bue,isFile:Vue,isBlob:Fue,isRegExp:sde,isFunction:fu,isStream:Uue,isURLSearchParams:Wue,isTypedArray:rde,isFileList:jue,forEach:lm,merge:X2,extend:Zue,trim:Kue,stripBOM:Yue,inherits:Que,toFlatObject:$ue,kindOf:sy,kindOfTest:ed,endsWith:ede,toArray:tde,forEachEntry:nde,matchAll:ide,isHTMLForm:ade,hasOwnProperty:U6,hasOwnProp:U6,reduceDescriptors:q6,freezeMethods:lde,toObjectSet:cde,toCamelCase:ode,noop:ude,toFiniteNumber:dde,findKey:F6,global:Yh,isContextDefined:j6,isSpecCompliantForm:hde,toJSONObject:pde,isAsyncFn:fde,isThenable:mde,setImmediate:W6,asap:gde,isIterable:r=>r!=null&&fu(r[oy])};function va(r,a,g,B,K){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",a&&(this.code=a),g&&(this.config=g),B&&(this.request=B),K&&(this.response=K,this.status=K.status?K.status:null)}Hn.inherits(va,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Hn.toJSONObject(this.config),code:this.code,status:this.status}}});const G6=va.prototype,H6={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{H6[r]={value:r}}),Object.defineProperties(va,H6),Object.defineProperty(G6,"isAxiosError",{value:!0}),va.from=(r,a,g,B,K,C)=>{const b=Object.create(G6);return Hn.toFlatObject(r,b,function(v){return v!==Error.prototype},t=>t!=="isAxiosError"),va.call(b,r.message,a,g,B,K),b.cause=r,b.name=r.name,C&&Object.assign(b,C),b};const yde=null;function J2(r){return Hn.isPlainObject(r)||Hn.isArray(r)}function X6(r){return Hn.endsWith(r,"[]")?r.slice(0,-2):r}function J6(r,a,g){return r?r.concat(a).map(function(K,C){return K=X6(K),!g&&C?"["+K+"]":K}).join(g?".":""):a}function vde(r){return Hn.isArray(r)&&!r.some(J2)}const xde=Hn.toFlatObject(Hn,{},null,function(a){return/^is[A-Z]/.test(a)});function uy(r,a,g){if(!Hn.isObject(r))throw new TypeError("target must be an object");a=a||new FormData,g=Hn.toFlatObject(g,{metaTokens:!0,dots:!1,indexes:!1},!1,function(n,i){return!Hn.isUndefined(i[n])});const B=g.metaTokens,K=g.visitor||e,C=g.dots,b=g.indexes,v=(g.Blob||typeof Blob<"u"&&Blob)&&Hn.isSpecCompliantForm(a);if(!Hn.isFunction(K))throw new TypeError("visitor must be a function");function u(h){if(h===null)return"";if(Hn.isDate(h))return h.toISOString();if(Hn.isBoolean(h))return h.toString();if(!v&&Hn.isBlob(h))throw new va("Blob is not supported. Use a Buffer instead.");return Hn.isArrayBuffer(h)||Hn.isTypedArray(h)?v&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function e(h,n,i){let d=h;if(h&&!i&&typeof h=="object"){if(Hn.endsWith(n,"{}"))n=B?n:n.slice(0,-2),h=JSON.stringify(h);else if(Hn.isArray(h)&&vde(h)||(Hn.isFileList(h)||Hn.endsWith(n,"[]"))&&(d=Hn.toArray(h)))return n=X6(n),d.forEach(function(c,f){!(Hn.isUndefined(c)||c===null)&&a.append(b===!0?J6([n],f,C):b===null?n:n+"[]",u(c))}),!1}return J2(h)?!0:(a.append(J6(i,n,C),u(h)),!1)}const w=[],y=Object.assign(xde,{defaultVisitor:e,convertValue:u,isVisitable:J2});function x(h,n){if(!Hn.isUndefined(h)){if(w.indexOf(h)!==-1)throw Error("Circular reference detected in "+n.join("."));w.push(h),Hn.forEach(h,function(d,s){(!(Hn.isUndefined(d)||d===null)&&K.call(a,d,Hn.isString(s)?s.trim():s,n,y))===!0&&x(d,n?n.concat(s):[s])}),w.pop()}}if(!Hn.isObject(r))throw new TypeError("data must be an object");return x(r),a}function K6(r){const a={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(B){return a[B]})}function K2(r,a){this._pairs=[],r&&uy(r,this,a)}const Z6=K2.prototype;Z6.append=function(a,g){this._pairs.push([a,g])},Z6.toString=function(a){const g=a?function(B){return a.call(this,B,K6)}:K6;return this._pairs.map(function(K){return g(K[0])+"="+g(K[1])},"").join("&")};function bde(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y6(r,a,g){if(!a)return r;const B=g&&g.encode||bde;Hn.isFunction(g)&&(g={serialize:g});const K=g&&g.serialize;let C;if(K?C=K(a,g):C=Hn.isURLSearchParams(a)?a.toString():new K2(a,g).toString(B),C){const b=r.indexOf("#");b!==-1&&(r=r.slice(0,b)),r+=(r.indexOf("?")===-1?"?":"&")+C}return r}class Q6{constructor(){this.handlers=[]}use(a,g,B){return this.handlers.push({fulfilled:a,rejected:g,synchronous:B?B.synchronous:!1,runWhen:B?B.runWhen:null}),this.handlers.length-1}eject(a){this.handlers[a]&&(this.handlers[a]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(a){Hn.forEach(this.handlers,function(B){B!==null&&a(B)})}}const $6={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_de={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:K2,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Z2=typeof window<"u"&&typeof document<"u",Y2=typeof navigator=="object"&&navigator||void 0,wde=Z2&&(!Y2||["ReactNative","NativeScript","NS"].indexOf(Y2.product)<0),Tde=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",kde=Z2&&window.location.href||"http://localhost",Nc={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Z2,hasStandardBrowserEnv:wde,hasStandardBrowserWebWorkerEnv:Tde,navigator:Y2,origin:kde},Symbol.toStringTag,{value:"Module"})),..._de};function Sde(r,a){return uy(r,new Nc.classes.URLSearchParams,{visitor:function(g,B,K,C){return Nc.isNode&&Hn.isBuffer(g)?(this.append(B,g.toString("base64")),!1):C.defaultVisitor.apply(this,arguments)},...a})}function Ede(r){return Hn.matchAll(/\w+|\[(\w*)]/g,r).map(a=>a[0]==="[]"?"":a[1]||a[0])}function Ade(r){const a={},g=Object.keys(r);let B;const K=g.length;let C;for(B=0;B<K;B++)C=g[B],a[C]=r[C];return a}function eT(r){function a(g,B,K,C){let b=g[C++];if(b==="__proto__")return!0;const t=Number.isFinite(+b),v=C>=g.length;return b=!b&&Hn.isArray(K)?K.length:b,v?(Hn.hasOwnProp(K,b)?K[b]=[K[b],B]:K[b]=B,!t):((!K[b]||!Hn.isObject(K[b]))&&(K[b]=[]),a(g,B,K[b],C)&&Hn.isArray(K[b])&&(K[b]=Ade(K[b])),!t)}if(Hn.isFormData(r)&&Hn.isFunction(r.entries)){const g={};return Hn.forEachEntry(r,(B,K)=>{a(Ede(B),K,g,0)}),g}return null}function Cde(r,a,g){if(Hn.isString(r))try{return(a||JSON.parse)(r),Hn.trim(r)}catch(B){if(B.name!=="SyntaxError")throw B}return(g||JSON.stringify)(r)}const cm={transitional:$6,adapter:["xhr","http","fetch"],transformRequest:[function(a,g){const B=g.getContentType()||"",K=B.indexOf("application/json")>-1,C=Hn.isObject(a);if(C&&Hn.isHTMLForm(a)&&(a=new FormData(a)),Hn.isFormData(a))return K?JSON.stringify(eT(a)):a;if(Hn.isArrayBuffer(a)||Hn.isBuffer(a)||Hn.isStream(a)||Hn.isFile(a)||Hn.isBlob(a)||Hn.isReadableStream(a))return a;if(Hn.isArrayBufferView(a))return a.buffer;if(Hn.isURLSearchParams(a))return g.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),a.toString();let t;if(C){if(B.indexOf("application/x-www-form-urlencoded")>-1)return Sde(a,this.formSerializer).toString();if((t=Hn.isFileList(a))||B.indexOf("multipart/form-data")>-1){const v=this.env&&this.env.FormData;return uy(t?{"files[]":a}:a,v&&new v,this.formSerializer)}}return C||K?(g.setContentType("application/json",!1),Cde(a)):a}],transformResponse:[function(a){const g=this.transitional||cm.transitional,B=g&&g.forcedJSONParsing,K=this.responseType==="json";if(Hn.isResponse(a)||Hn.isReadableStream(a))return a;if(a&&Hn.isString(a)&&(B&&!this.responseType||K)){const b=!(g&&g.silentJSONParsing)&&K;try{return JSON.parse(a)}catch(t){if(b)throw t.name==="SyntaxError"?va.from(t,va.ERR_BAD_RESPONSE,this,null,this.response):t}}return a}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Nc.classes.FormData,Blob:Nc.classes.Blob},validateStatus:function(a){return a>=200&&a<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hn.forEach(["delete","get","head","post","put","patch"],r=>{cm.headers[r]={}});const Mde=Hn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Lde=r=>{const a={};let g,B,K;return r&&r.split(`
4082
4082
  `).forEach(function(b){K=b.indexOf(":"),g=b.substring(0,K).trim().toLowerCase(),B=b.substring(K+1).trim(),!(!g||a[g]&&Mde[g])&&(g==="set-cookie"?a[g]?a[g].push(B):a[g]=[B]:a[g]=a[g]?a[g]+", "+B:B)}),a},tT=Symbol("internals");function um(r){return r&&String(r).trim().toLowerCase()}function dy(r){return r===!1||r==null?r:Hn.isArray(r)?r.map(dy):String(r)}function Nde(r){const a=Object.create(null),g=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let B;for(;B=g.exec(r);)a[B[1]]=B[2];return a}const Ide=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Q2(r,a,g,B,K){if(Hn.isFunction(B))return B.call(this,a,g);if(K&&(a=g),!!Hn.isString(a)){if(Hn.isString(B))return a.indexOf(B)!==-1;if(Hn.isRegExp(B))return B.test(a)}}function Rde(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(a,g,B)=>g.toUpperCase()+B)}function Ode(r,a){const g=Hn.toCamelCase(" "+a);["get","set","has"].forEach(B=>{Object.defineProperty(r,B+g,{value:function(K,C,b){return this[B].call(this,a,K,C,b)},configurable:!0})})}let mu=class{constructor(a){a&&this.set(a)}set(a,g,B){const K=this;function C(t,v,u){const e=um(v);if(!e)throw new Error("header name must be a non-empty string");const w=Hn.findKey(K,e);(!w||K[w]===void 0||u===!0||u===void 0&&K[w]!==!1)&&(K[w||v]=dy(t))}const b=(t,v)=>Hn.forEach(t,(u,e)=>C(u,e,v));if(Hn.isPlainObject(a)||a instanceof this.constructor)b(a,g);else if(Hn.isString(a)&&(a=a.trim())&&!Ide(a))b(Lde(a),g);else if(Hn.isObject(a)&&Hn.isIterable(a)){let t={},v,u;for(const e of a){if(!Hn.isArray(e))throw TypeError("Object iterator must return a key-value pair");t[u=e[0]]=(v=t[u])?Hn.isArray(v)?[...v,e[1]]:[v,e[1]]:e[1]}b(t,g)}else a!=null&&C(g,a,B);return this}get(a,g){if(a=um(a),a){const B=Hn.findKey(this,a);if(B){const K=this[B];if(!g)return K;if(g===!0)return Nde(K);if(Hn.isFunction(g))return g.call(this,K,B);if(Hn.isRegExp(g))return g.exec(K);throw new TypeError("parser must be boolean|regexp|function")}}}has(a,g){if(a=um(a),a){const B=Hn.findKey(this,a);return!!(B&&this[B]!==void 0&&(!g||Q2(this,this[B],B,g)))}return!1}delete(a,g){const B=this;let K=!1;function C(b){if(b=um(b),b){const t=Hn.findKey(B,b);t&&(!g||Q2(B,B[t],t,g))&&(delete B[t],K=!0)}}return Hn.isArray(a)?a.forEach(C):C(a),K}clear(a){const g=Object.keys(this);let B=g.length,K=!1;for(;B--;){const C=g[B];(!a||Q2(this,this[C],C,a,!0))&&(delete this[C],K=!0)}return K}normalize(a){const g=this,B={};return Hn.forEach(this,(K,C)=>{const b=Hn.findKey(B,C);if(b){g[b]=dy(K),delete g[C];return}const t=a?Rde(C):String(C).trim();t!==C&&delete g[C],g[t]=dy(K),B[t]=!0}),this}concat(...a){return this.constructor.concat(this,...a)}toJSON(a){const g=Object.create(null);return Hn.forEach(this,(B,K)=>{B!=null&&B!==!1&&(g[K]=a&&Hn.isArray(B)?B.join(", "):B)}),g}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([a,g])=>a+": "+g).join(`
4083
4083
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(a){return a instanceof this?a:new this(a)}static concat(a,...g){const B=new this(a);return g.forEach(K=>B.set(K)),B}static accessor(a){const B=(this[tT]=this[tT]={accessors:{}}).accessors,K=this.prototype;function C(b){const t=um(b);B[t]||(Ode(K,b),B[t]=!0)}return Hn.isArray(a)?a.forEach(C):C(a),this}};mu.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Hn.reduceDescriptors(mu.prototype,({value:r},a)=>{let g=a[0].toUpperCase()+a.slice(1);return{get:()=>r,set(B){this[g]=B}}}),Hn.freezeMethods(mu);function $2(r,a){const g=this||cm,B=a||g,K=mu.from(B.headers);let C=B.data;return Hn.forEach(r,function(t){C=t.call(g,C,K.normalize(),a?a.status:void 0)}),K.normalize(),C}function rT(r){return!!(r&&r.__CANCEL__)}function Wp(r,a,g){va.call(this,r??"canceled",va.ERR_CANCELED,a,g),this.name="CanceledError"}Hn.inherits(Wp,va,{__CANCEL__:!0});function nT(r,a,g){const B=g.config.validateStatus;!g.status||!B||B(g.status)?r(g):a(new va("Request failed with status code "+g.status,[va.ERR_BAD_REQUEST,va.ERR_BAD_RESPONSE][Math.floor(g.status/100)-4],g.config,g.request,g))}function Pde(r){const a=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return a&&a[1]||""}function zde(r,a){r=r||10;const g=new Array(r),B=new Array(r);let K=0,C=0,b;return a=a!==void 0?a:1e3,function(v){const u=Date.now(),e=B[C];b||(b=u),g[K]=v,B[K]=u;let w=C,y=0;for(;w!==K;)y+=g[w++],w=w%r;if(K=(K+1)%r,K===C&&(C=(C+1)%r),u-b<a)return;const x=e&&u-e;return x?Math.round(y*1e3/x):void 0}}function Dde(r,a){let g=0,B=1e3/a,K,C;const b=(u,e=Date.now())=>{g=e,K=null,C&&(clearTimeout(C),C=null),r(...u)};return[(...u)=>{const e=Date.now(),w=e-g;w>=B?b(u,e):(K=u,C||(C=setTimeout(()=>{C=null,b(K)},B-w)))},()=>K&&b(K)]}const hy=(r,a,g=3)=>{let B=0;const K=zde(50,250);return Dde(C=>{const b=C.loaded,t=C.lengthComputable?C.total:void 0,v=b-B,u=K(v),e=b<=t;B=b;const w={loaded:b,total:t,progress:t?b/t:void 0,bytes:v,rate:u||void 0,estimated:u&&t&&e?(t-b)/u:void 0,event:C,lengthComputable:t!=null,[a?"download":"upload"]:!0};r(w)},g)},iT=(r,a)=>{const g=r!=null;return[B=>a[0]({lengthComputable:g,total:r,loaded:B}),a[1]]},aT=r=>(...a)=>Hn.asap(()=>r(...a)),Bde=Nc.hasStandardBrowserEnv?((r,a)=>g=>(g=new URL(g,Nc.origin),r.protocol===g.protocol&&r.host===g.host&&(a||r.port===g.port)))(new URL(Nc.origin),Nc.navigator&&/(msie|trident)/i.test(Nc.navigator.userAgent)):()=>!0,Vde=Nc.hasStandardBrowserEnv?{write(r,a,g,B,K,C){const b=[r+"="+encodeURIComponent(a)];Hn.isNumber(g)&&b.push("expires="+new Date(g).toGMTString()),Hn.isString(B)&&b.push("path="+B),Hn.isString(K)&&b.push("domain="+K),C===!0&&b.push("secure"),document.cookie=b.join("; ")},read(r){const a=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Fde(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function jde(r,a){return a?r.replace(/\/?\/$/,"")+"/"+a.replace(/^\/+/,""):r}function oT(r,a,g){let B=!Fde(a);return r&&(B||g==!1)?jde(r,a):a}const sT=r=>r instanceof mu?{...r}:r;function Qh(r,a){a=a||{};const g={};function B(u,e,w,y){return Hn.isPlainObject(u)&&Hn.isPlainObject(e)?Hn.merge.call({caseless:y},u,e):Hn.isPlainObject(e)?Hn.merge({},e):Hn.isArray(e)?e.slice():e}function K(u,e,w,y){if(Hn.isUndefined(e)){if(!Hn.isUndefined(u))return B(void 0,u,w,y)}else return B(u,e,w,y)}function C(u,e){if(!Hn.isUndefined(e))return B(void 0,e)}function b(u,e){if(Hn.isUndefined(e)){if(!Hn.isUndefined(u))return B(void 0,u)}else return B(void 0,e)}function t(u,e,w){if(w in a)return B(u,e);if(w in r)return B(void 0,u)}const v={url:C,method:C,data:C,baseURL:b,transformRequest:b,transformResponse:b,paramsSerializer:b,timeout:b,timeoutMessage:b,withCredentials:b,withXSRFToken:b,adapter:b,responseType:b,xsrfCookieName:b,xsrfHeaderName:b,onUploadProgress:b,onDownloadProgress:b,decompress:b,maxContentLength:b,maxBodyLength:b,beforeRedirect:b,transport:b,httpAgent:b,httpsAgent:b,cancelToken:b,socketPath:b,responseEncoding:b,validateStatus:t,headers:(u,e,w)=>K(sT(u),sT(e),w,!0)};return Hn.forEach(Object.keys({...r,...a}),function(e){const w=v[e]||K,y=w(r[e],a[e],e);Hn.isUndefined(y)&&w!==t||(g[e]=y)}),g}const lT=r=>{const a=Qh({},r);let{data:g,withXSRFToken:B,xsrfHeaderName:K,xsrfCookieName:C,headers:b,auth:t}=a;a.headers=b=mu.from(b),a.url=Y6(oT(a.baseURL,a.url,a.allowAbsoluteUrls),r.params,r.paramsSerializer),t&&b.set("Authorization","Basic "+btoa((t.username||"")+":"+(t.password?unescape(encodeURIComponent(t.password)):"")));let v;if(Hn.isFormData(g)){if(Nc.hasStandardBrowserEnv||Nc.hasStandardBrowserWebWorkerEnv)b.setContentType(void 0);else if((v=b.getContentType())!==!1){const[u,...e]=v?v.split(";").map(w=>w.trim()).filter(Boolean):[];b.setContentType([u||"multipart/form-data",...e].join("; "))}}if(Nc.hasStandardBrowserEnv&&(B&&Hn.isFunction(B)&&(B=B(a)),B||B!==!1&&Bde(a.url))){const u=K&&C&&Vde.read(C);u&&b.set(K,u)}return a},Ude=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(g,B){const K=lT(r);let C=K.data;const b=mu.from(K.headers).normalize();let{responseType:t,onUploadProgress:v,onDownloadProgress:u}=K,e,w,y,x,h;function n(){x&&x(),h&&h(),K.cancelToken&&K.cancelToken.unsubscribe(e),K.signal&&K.signal.removeEventListener("abort",e)}let i=new XMLHttpRequest;i.open(K.method.toUpperCase(),K.url,!0),i.timeout=K.timeout;function d(){if(!i)return;const c=mu.from("getAllResponseHeaders"in i&&i.getAllResponseHeaders()),m={data:!t||t==="text"||t==="json"?i.responseText:i.response,status:i.status,statusText:i.statusText,headers:c,config:r,request:i};nT(function(E){g(E),n()},function(E){B(E),n()},m),i=null}"onloadend"in i?i.onloadend=d:i.onreadystatechange=function(){!i||i.readyState!==4||i.status===0&&!(i.responseURL&&i.responseURL.indexOf("file:")===0)||setTimeout(d)},i.onabort=function(){i&&(B(new va("Request aborted",va.ECONNABORTED,r,i)),i=null)},i.onerror=function(){B(new va("Network Error",va.ERR_NETWORK,r,i)),i=null},i.ontimeout=function(){let f=K.timeout?"timeout of "+K.timeout+"ms exceeded":"timeout exceeded";const m=K.transitional||$6;K.timeoutErrorMessage&&(f=K.timeoutErrorMessage),B(new va(f,m.clarifyTimeoutError?va.ETIMEDOUT:va.ECONNABORTED,r,i)),i=null},C===void 0&&b.setContentType(null),"setRequestHeader"in i&&Hn.forEach(b.toJSON(),function(f,m){i.setRequestHeader(m,f)}),Hn.isUndefined(K.withCredentials)||(i.withCredentials=!!K.withCredentials),t&&t!=="json"&&(i.responseType=K.responseType),u&&([y,h]=hy(u,!0),i.addEventListener("progress",y)),v&&i.upload&&([w,x]=hy(v),i.upload.addEventListener("progress",w),i.upload.addEventListener("loadend",x)),(K.cancelToken||K.signal)&&(e=c=>{i&&(B(!c||c.type?new Wp(null,r,i):c),i.abort(),i=null)},K.cancelToken&&K.cancelToken.subscribe(e),K.signal&&(K.signal.aborted?e():K.signal.addEventListener("abort",e)));const s=Pde(K.url);if(s&&Nc.protocols.indexOf(s)===-1){B(new va("Unsupported protocol "+s+":",va.ERR_BAD_REQUEST,r));return}i.send(C||null)})},qde=(r,a)=>{const{length:g}=r=r?r.filter(Boolean):[];if(a||g){let B=new AbortController,K;const C=function(u){if(!K){K=!0,t();const e=u instanceof Error?u:this.reason;B.abort(e instanceof va?e:new Wp(e instanceof Error?e.message:e))}};let b=a&&setTimeout(()=>{b=null,C(new va(`timeout ${a} of ms exceeded`,va.ETIMEDOUT))},a);const t=()=>{r&&(b&&clearTimeout(b),b=null,r.forEach(u=>{u.unsubscribe?u.unsubscribe(C):u.removeEventListener("abort",C)}),r=null)};r.forEach(u=>u.addEventListener("abort",C));const{signal:v}=B;return v.unsubscribe=()=>Hn.asap(t),v}},Wde=function*(r,a){let g=r.byteLength;if(g<a){yield r;return}let B=0,K;for(;B<g;)K=B+a,yield r.slice(B,K),B=K},Gde=async function*(r,a){for await(const g of Hde(r))yield*Wde(g,a)},Hde=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const a=r.getReader();try{for(;;){const{done:g,value:B}=await a.read();if(g)break;yield B}}finally{await a.cancel()}},cT=(r,a,g,B)=>{const K=Gde(r,a);let C=0,b,t=v=>{b||(b=!0,B&&B(v))};return new ReadableStream({async pull(v){try{const{done:u,value:e}=await K.next();if(u){t(),v.close();return}let w=e.byteLength;if(g){let y=C+=w;g(y)}v.enqueue(new Uint8Array(e))}catch(u){throw t(u),u}},cancel(v){return t(v),K.return()}},{highWaterMark:2})},py=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",uT=py&&typeof ReadableStream=="function",Xde=py&&(typeof TextEncoder=="function"?(r=>a=>r.encode(a))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),dT=(r,...a)=>{try{return!!r(...a)}catch{return!1}},Jde=uT&&dT(()=>{let r=!1;const a=new Request(Nc.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!a}),hT=64*1024,ex=uT&&dT(()=>Hn.isReadableStream(new Response("").body)),fy={stream:ex&&(r=>r.body)};py&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(a=>{!fy[a]&&(fy[a]=Hn.isFunction(r[a])?g=>g[a]():(g,B)=>{throw new va(`Response type '${a}' is not supported`,va.ERR_NOT_SUPPORT,B)})})})(new Response);const Kde=async r=>{if(r==null)return 0;if(Hn.isBlob(r))return r.size;if(Hn.isSpecCompliantForm(r))return(await new Request(Nc.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(Hn.isArrayBufferView(r)||Hn.isArrayBuffer(r))return r.byteLength;if(Hn.isURLSearchParams(r)&&(r=r+""),Hn.isString(r))return(await Xde(r)).byteLength},Zde=async(r,a)=>{const g=Hn.toFiniteNumber(r.getContentLength());return g??Kde(a)},tx={http:yde,xhr:Ude,fetch:py&&(async r=>{let{url:a,method:g,data:B,signal:K,cancelToken:C,timeout:b,onDownloadProgress:t,onUploadProgress:v,responseType:u,headers:e,withCredentials:w="same-origin",fetchOptions:y}=lT(r);u=u?(u+"").toLowerCase():"text";let x=qde([K,C&&C.toAbortSignal()],b),h;const n=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let i;try{if(v&&Jde&&g!=="get"&&g!=="head"&&(i=await Zde(e,B))!==0){let m=new Request(a,{method:"POST",body:B,duplex:"half"}),T;if(Hn.isFormData(B)&&(T=m.headers.get("content-type"))&&e.setContentType(T),m.body){const[E,S]=iT(i,hy(aT(v)));B=cT(m.body,hT,E,S)}}Hn.isString(w)||(w=w?"include":"omit");const d="credentials"in Request.prototype;h=new Request(a,{...y,signal:x,method:g.toUpperCase(),headers:e.normalize().toJSON(),body:B,duplex:"half",credentials:d?w:void 0});let s=await fetch(h,y);const c=ex&&(u==="stream"||u==="response");if(ex&&(t||c&&n)){const m={};["status","statusText","headers"].forEach(L=>{m[L]=s[L]});const T=Hn.toFiniteNumber(s.headers.get("content-length")),[E,S]=t&&iT(T,hy(aT(t),!0))||[];s=new Response(cT(s.body,hT,E,()=>{S&&S(),n&&n()}),m)}u=u||"text";let f=await fy[Hn.findKey(fy,u)||"text"](s,r);return!c&&n&&n(),await new Promise((m,T)=>{nT(m,T,{data:f,headers:mu.from(s.headers),status:s.status,statusText:s.statusText,config:r,request:h})})}catch(d){throw n&&n(),d&&d.name==="TypeError"&&/Load failed|fetch/i.test(d.message)?Object.assign(new va("Network Error",va.ERR_NETWORK,r,h),{cause:d.cause||d}):va.from(d,d&&d.code,r,h)}})};Hn.forEach(tx,(r,a)=>{if(r){try{Object.defineProperty(r,"name",{value:a})}catch{}Object.defineProperty(r,"adapterName",{value:a})}});const pT=r=>`- ${r}`,Yde=r=>Hn.isFunction(r)||r===null||r===!1,fT={getAdapter:r=>{r=Hn.isArray(r)?r:[r];const{length:a}=r;let g,B;const K={};for(let C=0;C<a;C++){g=r[C];let b;if(B=g,!Yde(g)&&(B=tx[(b=String(g)).toLowerCase()],B===void 0))throw new va(`Unknown adapter '${b}'`);if(B)break;K[b||"#"+C]=B}if(!B){const C=Object.entries(K).map(([t,v])=>`adapter ${t} `+(v===!1?"is not supported by the environment":"is not available in the build"));let b=a?C.length>1?`since :
4084
4084
  `+C.map(pT).join(`