import{__awaiter,__generator}from"tslib"; /*! * (C) Ionic http://ionicframework.com - MIT License */import{r as registerInstance,h,H as Host,f as getElement,d as createEvent}from"./index-73fa3fe8.js";import{j as reorderThreeOutline,k as reorderTwoSharp}from"./index-f7dc70ba.js";import{b as getIonMode}from"./ionic-global-d89a6ff6.js";import{f as findClosestIonContent,g as getScrollElement}from"./index-f3946ac1.js";import{r as raf}from"./helpers-be245865.js";import{a as hapticSelectionStart,b as hapticSelectionChanged,h as hapticSelectionEnd}from"./haptic-554688a5.js";import"./index-9b0d46f4.js";import"./capacitor-59395cbd.js";import"./index-a5d50daf.js";var reorderIosCss=":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:2.125rem;opacity:0.4}";var IonReorderIosStyle0=reorderIosCss;var reorderMdCss=":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:1.9375rem;opacity:0.3}";var IonReorderMdStyle0=reorderMdCss;var Reorder=function(){function r(r){registerInstance(this,r)}r.prototype.onClick=function(r){var e=this.el.closest("ion-reorder-group");r.preventDefault();if(!e||!e.disabled){r.stopImmediatePropagation()}};r.prototype.render=function(){var r=getIonMode(this);var e=r==="ios"?reorderThreeOutline:reorderTwoSharp;return h(Host,{key:"811f71aa6f4b45ee8a597f504af6c43d34cc8c53",class:r},h("slot",{key:"78e1898b412b322053fe924db7934d5840184bfc"},h("ion-icon",{key:"171f86c625d64ce3c5b5ebc54372a6573fc437ef",icon:e,lazy:false,class:"reorder-icon",part:"icon","aria-hidden":"true"})))};Object.defineProperty(r.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return r}();Reorder.style={ios:IonReorderIosStyle0,md:IonReorderMdStyle0};var reorderGroupCss=".reorder-list-active>*{display:block;-webkit-transition:-webkit-transform 300ms;transition:-webkit-transform 300ms;transition:transform 300ms;transition:transform 300ms, -webkit-transform 300ms;will-change:transform}.reorder-enabled{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.reorder-enabled ion-reorder{display:block;cursor:-webkit-grab;cursor:grab;pointer-events:all;-ms-touch-action:none;touch-action:none}.reorder-selected,.reorder-selected ion-reorder{cursor:-webkit-grabbing;cursor:grabbing}.reorder-selected{position:relative;-webkit-transition:none !important;transition:none !important;-webkit-box-shadow:0 0 10px rgba(0, 0, 0, 0.4);box-shadow:0 0 10px rgba(0, 0, 0, 0.4);opacity:0.8;z-index:100}.reorder-visible ion-reorder .reorder-icon{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0)}";var IonReorderGroupStyle0=reorderGroupCss;var ReorderGroup=function(){function r(r){registerInstance(this,r);this.ionItemReorder=createEvent(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=true}r.prototype.disabledChanged=function(){if(this.gesture){this.gesture.enable(!this.disabled)}};r.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var r,e,t;var i=this;return __generator(this,(function(n){switch(n.label){case 0:r=findClosestIonContent(this.el);if(!r)return[3,2];e=this;return[4,getScrollElement(r)];case 1:e.scrollEl=n.sent();n.label=2;case 2:t=this;return[4,import("./index-2cf77112.js")];case 3:t.gesture=n.sent().createGesture({el:this.el,gestureName:"reorder",gesturePriority:110,threshold:0,direction:"y",passive:false,canStart:function(r){return i.canStart(r)},onStart:function(r){return i.onStart(r)},onMove:function(r){return i.onMove(r)},onEnd:function(){return i.onEnd()}});this.disabledChanged();return[2]}}))}))};r.prototype.disconnectedCallback=function(){this.onEnd();if(this.gesture){this.gesture.destroy();this.gesture=undefined}};r.prototype.complete=function(r){return Promise.resolve(this.completeReorder(r))};r.prototype.canStart=function(r){if(this.selectedItemEl||this.state!==0){return false}var e=r.event.target;var t=e.closest("ion-reorder");if(!t){return false}var i=findReorderItem(t,this.el);if(!i){return false}r.data=i;return true};r.prototype.onStart=function(r){r.event.preventDefault();var e=this.selectedItemEl=r.data;var t=this.cachedHeights;t.length=0;var i=this.el;var n=i.children;if(!n||n.length===0){return}var o=0;for(var s=0;sr){return t}}return e.length-1};r.prototype.reorderMove=function(r,e){var t=this.selectedItemHeight;var i=this.el.children;for(var n=0;nr&&n<=e){s="translateY(".concat(-t,"px)")}else if(n=e){s="translateY(".concat(t,"px)")}o["transform"]=s}};r.prototype.autoscroll=function(r){if(!this.scrollEl){return 0}var e=0;if(rthis.scrollElBottom){e=SCROLL_JUMP}if(e!==0){this.scrollEl.scrollBy(0,e)}return this.scrollEl.scrollTop-this.scrollElInitial};r.prototype.render=function(){var r;var e=getIonMode(this);return h(Host,{key:"5a8c5c11fa48ff2cec319a1a07ba74427c2a42e5",class:(r={},r[e]=true,r["reorder-enabled"]=!this.disabled,r["reorder-list-active"]=this.state!==0,r)})};Object.defineProperty(r.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(r,"watchers",{get:function(){return{disabled:["disabledChanged"]}},enumerable:false,configurable:true});return r}();var indexForItem=function(r){return r["$ionIndex"]};var findReorderItem=function(r,e){var t;while(r){t=r.parentElement;if(t===e){return r}r=t}return undefined};var AUTO_SCROLL_MARGIN=60;var SCROLL_JUMP=10;var ITEM_REORDER_SELECTED="reorder-selected";var reorderArray=function(r,e,t){var i=r[e];r.splice(e,1);r.splice(t,0,i);return r.slice()};ReorderGroup.style=IonReorderGroupStyle0;export{Reorder as ion_reorder,ReorderGroup as ion_reorder_group};