vendor: 4,373 bytes, line 1
1import{r as t,e as s,h as r,d as e,H as i}from"./p-5c854bc2.js";import{a as o,g as h}from"./p-70297545.js";import{r as n}from"./p-be06fc33.js";import{a,b as c,c as d}from"./p-de26a437.js";import{g as l}from"./p-cc7cb1a3.js";import"./p-bd6f674d.js";import"./p-78bffe29.js";import"./p-3647f076.js";const p=class{constructor(r){t(this,r),this.ionItemReorder=s(this,"ionItemReorder",7),this.lastToIndex=-1,this.cachedHeights=[],this.scrollElTop=0,this.scrollElBottom=0,this.scrollElInitial=0,this.containerTop=0,this.containerBottom=0,this.state=0,this.disabled=!0}disabledChanged(){this.gesture&&this.gesture.enable(!this.disabled)}async connectedCallback(){const t=o(this.el);t&&(this.scrollEl=await h(t)),this.gesture=(await import("./p-52ed752a.js")).createGesture({el:this.el,gestureName:"reorder",gesturePriority:110,threshold:0,direction:"y",passive:!1,canStart:t=>this.canStart(t),onStart:t=>this.onStart(t),onMove:t=>this.onMove(t),onEnd:()=>this.onEnd()}),this.disabledChanged()}disconnectedCallback(){this.onEnd(),this.gesture&&(this.gesture.destroy(),this.gesture=void 0)}complete(t){return Promise.resolve(this.completeReorder(t))}canStart(t){if(this.selectedItemEl||0!==this.state)return!1;const s=t.event.target.closest("ion-reorder");if(!s)return!1;const r=m(s,this.el);return!!r&&(t.data=r,!0)}onStart(t){t.event.preventDefault();const s=this.selectedItemEl=t.data,r=this.cachedHeights;r.length=0;const e=this.el,i=e.children;if(!i||0===i.length)return;let o=0;for(let t=0;t<i.length;t++){const s=i[t];o+=s.offsetHeight,r.push(o),s.$ionIndex=t}const h=e.getBoundingClientRect();if(this.containerTop=h.top,this.containerBottom=h.bottom,this.scrollEl){const t=this.scrollEl.getBoundingClientRect();this.scrollElInitial=this.scrollEl.scrollTop,this.scrollElTop=t.top+u,this.scrollElBottom=t.bottom-u}else this.scrollElInitial=0,this.scrollElTop=0,this.scrollElBottom=0;this.lastToIndex=f(s),this.selectedItemHeight=s.offsetHeight,this.state=1,s.classList.add(g),a()}onMove(t){const s=this.selectedItemEl;if(!s)return;const r=this.autoscroll(t.currentY),e=this.containerTop-r,i=Math.max(e,Math.min(t.currentY,this.containerBottom-r)),o=r+i-t.startY,h=this.itemIndexForTop(i-e);if(h!==this.lastToIndex){const t=f(s);this.lastToIndex=h,c(),this.reorderMove(t,h)}s.style.transform=`translateY(${o}px)`}onEnd(){const t=this.selectedItemEl;if(this.state=2,!t)return void(this.state=0);const s=this.lastToIndex,r=f(t);s===r?this.completeReorder():this.ionItemReorder.emit({from:r,to:s,complete:this.completeReorder.bind(this)}),d()}completeReorder(t){const s=this.selectedItemEl;if(s&&2===this.state){const r=this.el.children,e=r.length,i=this.lastToIndex,o=f(s);n((()=>{i===o||void 0!==t&&!0!==t||this.el.insertBefore(s,o<i?r[i+1]:r[i]);for(let t=0;t<e;t++)r[t].style.transform=""})),Array.isArray(t)&&(t=v(t,o,i)),s.style.transition="",s.classList.remove(g),this.selectedItemEl=void 0,this.state=0}return t}itemIndexForTop(t){const s=this.cachedHeights;for(let r=0;r<s.length;r++)if(s[r]>t)return r;return s.length-1}reorderMove(t,s){const r=this.selectedItemHeight,e=this.el.children;for(let i=0;i<e.length;i++){let o="";i>t&&i<=s?o=`translateY(${-r}px)`:i<t&&i>=s&&(o=`translateY(${r}px)`),e[i].style.transform=o}}autoscroll(t){if(!this.scrollEl)return 0;let s=0;return t<this.scrollElTop?s=-b:t>this.scrollElBottom&&(s=b),0!==s&&this.scrollEl.scrollBy(0,s),this.scrollEl.scrollTop-this.scrollElInitial}render(){const t=l(this);return r(i,{key:"491f3e5843cf728ff4589e58bd86b8ce6709b293",class:{[t]:!0,"reorder-enabled":!this.disabled,"reorder-list-active":0!==this.state}})}get el(){return e(this)}static get watchers(){return{disabled:["disabledChanged"]}}},f=t=>t.$ionIndex,m=(t,s)=>{let r;for(;t;){if(r=t.parentElement,r===s)return t;t=r}},u=60,b=10,g="reorder-selected",v=(t,s,r)=>{const e=t[s];return t.splice(s,1),t.splice(r,0,e),t.slice()};p.style=".reorder-list-active>*{display:block;transition:transform 300ms;will-change:transform}.reorder-enabled{user-select:none}.reorder-enabled ion-reorder{display:block;cursor:grab;pointer-events:all;touch-action:none}.reorder-selected,.reorder-selected ion-reorder{cursor:grabbing}.reorder-selected{position:relative;transition:none !important;box-shadow:0 0 10px rgba(0, 0, 0, 0.4);opacity:0.8;z-index:100}.reorder-visible ion-reorder .reorder-icon{transform:translate3d(0, 0, 0)}";export{p as ion_reorder_group}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.