(function(n,Ie){typeof exports=="object"&&typeof module<"u"?module.exports=Ie(require("vue")):typeof define=="function"&&define.amd?define(["vue"],Ie):(n=typeof globalThis<"u"?globalThis:n||self,n["tabbed-macos-modal"]=Ie(n.Vue))})(this,function(n){"use strict";var Ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yt(g){return g&&g.__esModule&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g}var Tt={exports:{}},Ze={exports:{}},vt;function Dt(){return vt||(vt=1,function(g){(function(_,E){g.exports?g.exports=E():_.EvEmitter=E()})(typeof window<"u"?window:Ie,function(){function _(){}let E=_.prototype;return E.on=function(u,c){if(!u||!c)return this;let d=this._events=this._events||{},v=d[u]=d[u]||[];return v.includes(c)||v.push(c),this},E.once=function(u,c){if(!u||!c)return this;this.on(u,c);let d=this._onceEvents=this._onceEvents||{},v=d[u]=d[u]||{};return v[c]=!0,this},E.off=function(u,c){let d=this._events&&this._events[u];if(!d||!d.length)return this;let v=d.indexOf(c);return v!=-1&&d.splice(v,1),this},E.emitEvent=function(u,c){let d=this._events&&this._events[u];if(!d||!d.length)return this;d=d.slice(0),c=c||[];let v=this._onceEvents&&this._onceEvents[u];for(let S of d)v&&v[S]&&(this.off(u,S),delete v[S]),S.apply(this,c);return this},E.allOff=function(){return delete this._events,delete this._onceEvents,this},_})}(Ze)),Ze.exports}/*! * imagesLoaded v5.0.0 * JavaScript is all like "You images are done yet or what?" * MIT License */(function(g){(function(_,E){g.exports?g.exports=E(_,Dt()):_.imagesLoaded=E(_,_.EvEmitter)})(typeof window<"u"?window:Ie,function(E,u){let c=E.jQuery,d=E.console;function v(l){return Array.isArray(l)?l:typeof l=="object"&&typeof l.length=="number"?[...l]:[l]}function S(l,s,m){if(!(this instanceof S))return new S(l,s,m);let p=l;if(typeof l=="string"&&(p=document.querySelectorAll(l)),!p){d.error(`Bad element for imagesLoaded ${p||l}`);return}this.elements=v(p),this.options={},typeof s=="function"?m=s:Object.assign(this.options,s),m&&this.on("always",m),this.getImages(),c&&(this.jqDeferred=new c.Deferred),setTimeout(this.check.bind(this))}S.prototype=Object.create(u.prototype),S.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const w=[1,9,11];S.prototype.addElementImages=function(l){l.nodeName==="IMG"&&this.addImage(l),this.options.background===!0&&this.addElementBackgroundImages(l);let{nodeType:s}=l;if(!s||!w.includes(s))return;let m=l.querySelectorAll("img");for(let p of m)this.addImage(p);if(typeof this.options.background=="string"){let p=l.querySelectorAll(this.options.background);for(let b of p)this.addElementBackgroundImages(b)}};const M=/url\((['"])?(.*?)\1\)/gi;S.prototype.addElementBackgroundImages=function(l){let s=getComputedStyle(l);if(!s)return;let m=M.exec(s.backgroundImage);for(;m!==null;){let p=m&&m[2];p&&this.addBackground(p,l),m=M.exec(s.backgroundImage)}},S.prototype.addImage=function(l){let s=new y(l);this.images.push(s)},S.prototype.addBackground=function(l,s){let m=new x(l,s);this.images.push(m)},S.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length){this.complete();return}let l=(s,m,p)=>{setTimeout(()=>{this.progress(s,m,p)})};this.images.forEach(function(s){s.once("progress",l),s.check()})},S.prototype.progress=function(l,s,m){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!l.isLoaded,this.emitEvent("progress",[this,l,s]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,l),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&d&&d.log(`progress: ${m}`,l,s)},S.prototype.complete=function(){let l=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(l,[this]),this.emitEvent("always",[this]),this.jqDeferred){let s=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[s](this)}};function y(l){this.img=l}y.prototype=Object.create(u.prototype),y.prototype.check=function(){if(this.getIsImageComplete()){this.confirm(this.img.naturalWidth!==0,"naturalWidth");return}this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src},y.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},y.prototype.confirm=function(l,s){this.isLoaded=l;let{parentNode:m}=this.img,p=m.nodeName==="PICTURE"?m:this.img;this.emitEvent("progress",[this,p,s])},y.prototype.handleEvent=function(l){let s="on"+l.type;this[s]&&this[s](l)},y.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},y.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},y.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)};function x(l,s){this.url=l,this.element=s,this.img=new Image}return x.prototype=Object.create(y.prototype),x.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(this.img.naturalWidth!==0,"naturalWidth"),this.unbindEvents())},x.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},x.prototype.confirm=function(l,s){this.isLoaded=l,this.emitEvent("progress",[this,this.element,s])},S.makeJQueryPlugin=function(l){l=l||E.jQuery,l&&(c=l,c.fn.imagesLoaded=function(s,m){return new S(this,s,m).jqDeferred.promise(c(this))})},S.makeJQueryPlugin(),S})})(Tt);var Ht=Tt.exports;const Vt=yt(Ht);function Ke(){function g(d){let v="",S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",w=S.length;for(let M=0;M{Vt(d,()=>{v("loaded")})})}return{pxToNumber:_,numberToPx:E,isIphone:u,makeId:g,imagesIsLoaded:c}}const Je=n.ref(0);function He(g=!1){Je.value=document.documentElement.clientWidth;function _(){Je.value=document.documentElement.clientWidth}return g&&(n.onMounted(()=>window.addEventListener("resize",_)),n.onUnmounted(()=>window.removeEventListener("resize",_))),Je}const Se=n.ref([]),_t=Ke();function Qe(g){Se.value.find(s=>s.modalId==g)||Se.value.push({modalId:g,history:[],hasChildFooter:!1,hasCustomHeader:!1,renderKey:_t.makeId(15)});function E(s,m=!1){const p=Se.value.findIndex(b=>b.modalId==s);if(p>-1)return m?p:Se.value[p]}function u(s){let m=_t.makeId(15);return s!=m?m:u(s)}function c(s){const m=E(s);m.renderKey=u(m.renderKey)}function d({current:s="",clearAll:m=!1,key:p=""}){const b=E(p);m&&b.history.splice(0);const z=b.history.length?b.history[0].current:"root";s&&b.history.unshift({current:s,parent:z})}function v(s){return E(s).history.shift()}function S(s){const m=E(s,!0);return Se.value.splice(m,1)}function w(s,m){const p=E(m);return p.history[0].title=s}function M(s){return E(s).hasChildFooter||!1}function y(s,m){const p=E(m);return p.hasChildFooter=s}function x(s){return E(s).hasCustomHeader||!1}function l(s,m){const p=E(m);return p.hasCustomHeader=s}return{addItem:d,clear:S,history:Se,goBack:v,setCurrentTitle:w,hasChildFooter:M,setChildFooter:y,setCustomHeader:l,hasCustomHeader:x,rerenderSlotContent:c}}var Et={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */(function(g){(function(_,E,u,c){var d=["","webkit","Moz","MS","ms","o"],v=E.createElement("div"),S="function",w=Math.round,M=Math.abs,y=Date.now;function x(e,t,i){return setTimeout(B(e,i),t)}function l(e,t,i){return Array.isArray(e)?(s(e,i[t],i),!0):!1}function s(e,t,i){var o;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==c)for(o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",C=_.console&&(_.console.warn||_.console.log);return C&&C.call(_.console,o,f),e.apply(this,arguments)}}var p;typeof Object.assign!="function"?p=function(t){if(t===c||t===null)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),o=1;o-1}function F(e){return e.trim().split(/\s+/g)}function Z(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var o=0;oW[t]}):o=o.sort()),o}function Ce(e,t){for(var i,o,r=t[0].toUpperCase()+t.slice(1),f=0;f1&&!i.firstMultiple?i.firstMultiple=ie(t):r===1&&(i.firstMultiple=!1);var f=i.firstInput,C=i.firstMultiple,D=C?C.center:f.center,R=t.center=fe(o);t.timeStamp=y(),t.deltaTime=t.timeStamp-f.timeStamp,t.angle=J(D,R),t.distance=oe(D,R),K(i,t),t.offsetDirection=Ee(t.deltaX,t.deltaY);var W=me(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=W.x,t.overallVelocityY=W.y,t.overallVelocity=M(W.x)>M(W.y)?W.x:W.y,t.scale=C?we(C.pointers,o):1,t.rotation=C?re(C.pointers,o):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,ue(i,t);var ee=e.element;te(t.srcEvent.target,ee)&&(ee=t.srcEvent.target),t.target=ee}function K(e,t){var i=t.center,o=e.offsetDelta||{},r=e.prevDelta||{},f=e.prevInput||{};(t.eventType===H||f.eventType===k)&&(r=e.prevDelta={x:f.deltaX||0,y:f.deltaY||0},o=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=r.x+(i.x-o.x),t.deltaY=r.y+(i.y-o.y)}function ue(e,t){var i=e.lastInterval||t,o=t.timeStamp-i.timeStamp,r,f,C,D;if(t.eventType!=U&&(o>Oe||i.velocity===c)){var R=t.deltaX-i.deltaX,W=t.deltaY-i.deltaY,ee=me(o,R,W);f=ee.x,C=ee.y,r=M(ee.x)>M(ee.y)?ee.x:ee.y,D=Ee(R,W),e.lastInterval=t}else r=i.velocity,f=i.velocityX,C=i.velocityY,D=i.direction;t.velocity=r,t.velocityX=f,t.velocityY=C,t.direction=D}function ie(e){for(var t=[],i=0;i=M(t)?e<0?de:Te:t<0?ve:_e}function oe(e,t,i){i||(i=a);var o=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return Math.sqrt(o*o+r*r)}function J(e,t,i){i||(i=a);var o=t[i[0]]-e[i[0]],r=t[i[1]]-e[i[1]];return Math.atan2(r,o)*180/Math.PI}function re(e,t){return J(t[1],t[0],h)+J(e[1],e[0],h)}function we(e,t){return oe(t[0],t[1],h)/oe(e[0],e[1],h)}var st={mousedown:H,mousemove:q,mouseup:k},at="mousedown",bt="mousemove mouseup";function se(){this.evEl=at,this.evWin=bt,this.pressed=!1,I.apply(this,arguments)}T(se,I,{handler:function(t){var i=st[t.type];i&H&&t.button===0&&(this.pressed=!0),i&q&&t.which!==1&&(i=k),this.pressed&&(i&k&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[t],changedPointers:[t],pointerType:he,srcEvent:t}))}});var Ae={pointerdown:H,pointermove:q,pointerup:k,pointercancel:U,pointerout:U},fn={2:ye,3:rt,4:he,5:qe},It="pointerdown",St="pointermove pointerup pointercancel";_.MSPointerEvent&&!_.PointerEvent&&(It="MSPointerDown",St="MSPointerMove MSPointerUp MSPointerCancel");function lt(){this.evEl=It,this.evWin=St,I.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}T(lt,I,{handler:function(t){var i=this.store,o=!1,r=t.type.toLowerCase().replace("ms",""),f=Ae[r],C=fn[t.pointerType]||t.pointerType,D=C==ye,R=Z(i,t.pointerId,"pointerId");f&H&&(t.button===0||D)?R<0&&(i.push(t),R=i.length-1):f&(k|U)&&(o=!0),!(R<0)&&(i[R]=t,this.callback(this.manager,f,{pointers:i,changedPointers:[t],pointerType:C,srcEvent:t}),o&&i.splice(R,1))}});var mn={touchstart:H,touchmove:q,touchend:k,touchcancel:U},pn="touchstart",gn="touchstart touchmove touchend touchcancel";function Ct(){this.evTarget=pn,this.evWin=gn,this.started=!1,I.apply(this,arguments)}T(Ct,I,{handler:function(t){var i=mn[t.type];if(i===H&&(this.started=!0),!!this.started){var o=yn.call(this,t,i);i&(k|U)&&o[0].length-o[1].length===0&&(this.started=!1),this.callback(this.manager,i,{pointers:o[0],changedPointers:o[1],pointerType:ye,srcEvent:t})}}});function yn(e,t){var i=ge(e.touches),o=ge(e.changedTouches);return t&(k|U)&&(i=xe(i.concat(o),"identifier",!0)),[i,o]}var Tn={touchstart:H,touchmove:q,touchend:k,touchcancel:U},vn="touchstart touchmove touchend touchcancel";function Ye(){this.evTarget=vn,this.targetIds={},I.apply(this,arguments)}T(Ye,I,{handler:function(t){var i=Tn[t.type],o=_n.call(this,t,i);o&&this.callback(this.manager,i,{pointers:o[0],changedPointers:o[1],pointerType:ye,srcEvent:t})}});function _n(e,t){var i=ge(e.touches),o=this.targetIds;if(t&(H|q)&&i.length===1)return o[i[0].identifier]=!0,[i,i];var r,f,C=ge(e.changedTouches),D=[],R=this.target;if(f=i.filter(function(W){return te(W.target,R)}),t===H)for(r=0;r-1&&o.splice(f,1)};setTimeout(r,En)}}function In(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,i=this.state;function o(r){t.manager.emit(r,e)}i=pe&&o(t.options.event+wt(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Q},canEmit:function(){for(var e=0;et.threshold&&r&t.direction},attrTest:function(e){return G.prototype.attrTest.call(this,e)&&(this.state&j||!(this.state&j)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=At(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}});function ut(){G.apply(this,arguments)}T(ut,G,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&j)},emit:function(e){if(e.scale!==1){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}});function ft(){le.apply(this,arguments),this._timer=null,this._input=null}T(ft,le,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Mt]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,o=e.distancet.time;if(this._input=e,!o||!i||e.eventType&(k|U)&&!r)this.reset();else if(e.eventType&H)this.reset(),this._timer=x(function(){this.state=ae,this.tryEmit()},t.time,this);else if(e.eventType&k)return ae;return Q},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===ae&&(e&&e.eventType&k?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=y(),this.manager.emit(this.options.event,this._input)))}});function mt(){G.apply(this,arguments)}T(mt,G,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[be]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&j)}});function pt(){G.apply(this,arguments)}T(pt,G,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Y|ne,pointers:1},getTouchAction:function(){return je.prototype.getTouchAction.call(this)},attrTest:function(e){var t=this.options.direction,i;return t&(Y|ne)?i=e.overallVelocity:t&Y?i=e.overallVelocityX:t&ne&&(i=e.overallVelocityY),this._super.attrTest.call(this,e)&&t&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&M(i)>this.options.velocity&&e.eventType&k},emit:function(e){var t=At(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}});function Ge(){le.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}T(Ge,le,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ht]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,o=e.distance{const E=g.__vccOpts||g;for(const[u,c]of _)E[u]=c;return E},Ut=g=>(n.pushScopeId("data-v-64119f04"),g=g(),n.popScopeId(),g),Ft=["onClick"],Wt={class:"modal__tab-content"},qt={key:0,xmlns:"http://www.w3.org/2000/svg",class:"sections-mode__section-arrow",fill:"#000000",width:"16px",height:"16px",viewBox:"0 0 24 24"},Yt=[Ut(()=>n.createElementVNode("g",{"data-name":"Layer 2"},[n.createElementVNode("g",{"data-name":"arrow-ios-forward"},[n.createElementVNode("rect",{width:"24",height:"24",transform:"rotate(-90 12 12)",opacity:"0"}),n.createElementVNode("path",{d:"M10 19a1 1 0 0 1-.64-.23 1 1 0 0 1-.13-1.41L13.71 12 9.39 6.63a1 1 0 0 1 .15-1.41 1 1 0 0 1 1.46.15l4.83 6a1 1 0 0 1 0 1.27l-5 6A1 1 0 0 1 10 19z"})])],-1))],Xt={__name:"SidebarTabs",props:{...tt},emits:["goto"],setup(g,{emit:_}){const E=n.useSlots(),u=He(),c=n.computed(()=>!!E.sidebar),d=g,v=_,S=(y,x=!1)=>{v("goto",{tabName:y,root:x})},w=y=>{let x=d.history[d.history.length-1];return x?x.current==y:d.current.current==y},M=y=>y.title?y.title:y.name?y.name:"tab name";return(y,x)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["modal__tabs",{"sections-mode":d.sectionsMode,"h-scrollable":!d.sectionsMode}])},[c.value?n.renderSlot(y.$slots,"sidebar",{key:1},void 0,!0):(n.openBlock(!0),n.createElementBlock(n.Fragment,{key:0},n.renderList(y.tabsSidebar,(l,s)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["modal__tab-head-item",{"modal__tab-head-item--active":n.unref(u)>768?w(l.name):d.sectionsMode?!1:w(l.name)}]),key:s,onClick:m=>S(l.name,!0)},[n.createElementVNode("span",Wt,n.toDisplayString(M(l)),1),d.sectionsMode&&n.unref(u)<768?(n.openBlock(),n.createElementBlock("svg",qt,Yt)):n.createCommentVNode("",!0)],10,Ft))),128))],2))}},zt=Ve(Xt,[["__scopeId","data-v-64119f04"]]),$t={key:0,class:"modal__title"},jt=["id"],Gt={key:2,class:"modal__sidebar-search"},Zt=["placeholder"],Kt={__name:"Sidebar",props:{...tt,sidebarSearch:{type:Boolean,default:!0},currentTitle:{type:String,default:""},title:{type:String,default:"Settings"}},emits:["goto","search"],setup(g,{emit:_}){const E=n.inject("modalId"),u=Qe(E),c=n.useSlots(),d=Ke(),v=He(),S=n.inject("panMobile"),w=n.computed(()=>u.hasCustomHeader(E)),M=n.ref(""),y=n.ref(null),x=n.computed(()=>{if(v.value>768){let N=180;if(!T.dynamicSidebarWidth)N=d.pxToNumber(T.sidebarWidth);else{N=s();const A=d.pxToNumber(T.maxDynamicSidebarWidth);N>A&&(N=A)}return d.numberToPx(N)}return"100%"});function l(N,A){const L=document.createElement("canvas").getContext("2d");return L.font=A||getComputedStyle(document.body).font,L.measureText(N).width}const s=()=>{if(y.value){const N=y.value.querySelectorAll(".modal__tab-content");if(N.length){let A=[];for(const L of Array.from(N)){const{font:te}=getComputedStyle(L),O=l(L.innerText,te);A.push(O)}return Math.max(...A)+50}}return 180},m=n.computed(()=>!!c.sidebar),p=n.computed(()=>!!c.title),b=()=>{z("search",M.value)},z=_,T=g,B=({tabName:N,root:A=!1})=>{z("goto",{tabName:N,root:A})};return(N,A)=>T.simple?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["modal__sidebar",{"sidebar-sections":T.sectionsMode,"no-wrap":T.dynamicSidebarWidth}]),ref_key:"sidebar",ref:y,style:n.normalizeStyle({width:x.value})},[p.value?(n.openBlock(),n.createElementBlock("div",$t,[n.renderSlot(N.$slots,"title",{},void 0,!0)])):(n.openBlock(),n.createElementBlock("div",{key:1,class:n.normalizeClass(["modal__title",{"no-pan-mobile-45":!n.unref(S)&&(T.sectionsMode?T.history.length:!1),"no-pan-mobile-30":!n.unref(S)&&(T.sectionsMode?!1:T.history.length>1)}])},[n.createElementVNode("div",{id:"modal__custom-header-"+n.unref(E)},null,8,jt),w.value?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(T.sectionsMode&&n.unref(v)<768?T.currentTitle:T.title),1)],64))],2)),T.sidebarSearch&&(n.unref(v)>768||T.sectionsMode&&!T.history.length)?(n.openBlock(),n.createElementBlock("div",Gt,[n.withDirectives(n.createElementVNode("input",{type:"search","onUpdate:modelValue":A[0]||(A[0]=$=>M.value=$),onKeyup:b,name:"sidebar_search",class:"modal__sidebar-search-input",autocomplete:"off",placeholder:T.searchPlaceholder},null,40,Zt),[[n.vModelText,M.value]])])):n.createCommentVNode("",!0),!T.sectionsMode||!T.history.length||n.unref(v)>768?(n.openBlock(),n.createBlock(zt,{key:3,"sections-mode":T.sectionsMode,history:T.history,current:T.current,"tabs-sidebar":T.tabsSidebar,onGoto:B},n.createSlots({_:2},[m.value?{name:"sidebar",fn:n.withCtx(()=>[n.renderSlot(N.$slots,"sidebar",{},void 0,!0)]),key:"0"}:void 0]),1032,["sections-mode","history","current","tabs-sidebar"])):n.createCommentVNode("",!0)],6))}},Jt=Ve(Kt,[["__scopeId","data-v-cb8ae5ec"]]),nt=g=>(n.pushScopeId("data-v-ec9c80b5"),g=g(),n.popScopeId(),g),Qt=nt(()=>n.createElementVNode("div",{class:"modal-item__backdrop"},null,-1)),en=[nt(()=>n.createElementVNode("div",{class:"modal__pan-bar"},null,-1))],tn={class:"modal__container"},nn={key:1,class:"modal__footer"},on=[nt(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 16 16",fill:"none"},[n.createElementVNode("path",{d:"M15.6821 2.104L14.3696 0.791504L8.18213 6.979L1.99463 0.791504L0.682129 2.104L6.86963 8.2915L0.682129 14.479L1.99463 15.7915L8.18213 9.604L14.3696 15.7915L15.6821 14.479L9.49463 8.2915L15.6821 2.104Z",fill:"#0A281A"})],-1))],rn={__name:"TabbedModal",props:{...tt,sidebarSearch:{type:Boolean,default:!1},simple:{type:Boolean,default:!1},openFirstSection:{type:Boolean,default:!0},needFooter:{type:Boolean,default:!0},title:{type:String,default:"Default Title"},panDesktop:{type:Boolean,default:!1},panMobile:{type:Boolean,default:!0},height:{type:[Number,String],default:600},contentWidth:{type:[Number,String],default:520},fixedHeight:{type:Boolean,default:!1},needCloseIcon:{type:Boolean,default:!0}},emits:["close","opened"],setup(g,{expose:_,emit:E}){const u=g,c=Ke(),d=c.makeId(15),v=n.useSlots(),S=n.computed(()=>!!v.sidebar),w=n.computed(()=>!!v.title),M=n.computed(()=>!!v.mainFooter),y=n.computed(()=>!!v.closeIcon),x={pan:null,content:null};n.provide("needFooter",u.needFooter),n.provide("panMobile",u.panMobile),n.provide("modalId",d),n.provide("isSectionsMode",u.sectionsMode);const l=Qe(d),s=E,m=n.ref(null),p=n.ref(""),b=n.ref(null),z=n.ref(!1),T=n.ref(!1),B=n.ref(u.height),N=He(!0),A=n.ref(""),$=n.ref("unset");let L=0;const te=async()=>{await n.nextTick(),it(),rt()},O=n.computed(()=>{var a;(a=l.history.value.find(h=>h.modalId==d))==null||a.renderKey}),F=()=>{const a=new MutationObserver(h=>{for(const I of h)I.type==="childList"&&Z()});return a.observe(b.value,{childList:!0,subtree:!0}),a};n.onMounted(()=>{const a=F();n.onBeforeUnmount(()=>{a.disconnect()})}),n.onUpdated(()=>{Z()}),n.onBeforeUnmount(()=>{var a;(a=x.pan)==null||a.destroy(),We(),l.clear(d)});const Z=async()=>{await n.nextTick(),N.value<768?Ue():Re()},ge=n.computed(()=>{const a={};return b.value?(N.value>768?L=(document.documentElement.clientHeight-c.pxToNumber(B.value))/2:L=0,a.height=c.numberToPx(B.value),a.bottom=c.numberToPx(L),a.contentWidth=c.numberToPx(u.contentWidth)):a.bottom="0px",a}),xe=(a=!1)=>{var P,V,X,K,ue,ie,fe,me,Ee,oe,J;const h=b.value.querySelector(".modal__inner-content"),I=h==null?void 0:h.closest(".modal__content");if(I){const re=h.closest(".modal"),we=((V=(P=I.querySelector(".modal__footer"))==null?void 0:P.getBoundingClientRect())==null?void 0:V.height)+(q.value.length?15:1)||(q.value.length?35:0),st=((K=(X=re.querySelector(".modal__sidebar"))==null?void 0:X.getBoundingClientRect())==null?void 0:K.height)||0,at=((ie=(ue=re.querySelector(".modal__pan"))==null?void 0:ue.getBoundingClientRect())==null?void 0:ie.height)||0;let se=(((me=(fe=I.querySelector(".modal__child-item-header"))==null?void 0:fe.getBoundingClientRect())==null?void 0:me.height)||0)+we+at;if(u.simple){const Ae=((oe=(Ee=re.querySelector(".modal__title"))==null?void 0:Ee.getBoundingClientRect())==null?void 0:oe.height)||0;se+=Ae}if(a||(se+=st),a){const Ae=(J=getComputedStyle(I.querySelector(".modal__child-item-content")))==null?void 0:J.marginTop;se+=c.pxToNumber(Ae)}return se}return 0},Ce=()=>{var a;if(b.value){const h=b.value.querySelector(".modal__tabs"),I=c.pxToNumber(b.value.style.height),P=b.value.querySelector(".modal__title"),V=(a=P.getBoundingClientRect())==null?void 0:a.height,X=c.pxToNumber(getComputedStyle(P).marginBottom),K=getComputedStyle(b.value.querySelector(".modal__sidebar")),ue=c.pxToNumber(K.paddingTop),ie=c.pxToNumber(K.paddingBottom);h.style.height=c.numberToPx(I-V-X-ue-ie)}},Re=()=>{B.value=u.height;const a=xe(!0),h=b.value.querySelector(".modal__inner-content");h&&(h.style.height=c.numberToPx(B.value-a)),u.simple||Ce()},Ue=async()=>{const a=xe(),h=b.value.querySelector(".modal__inner-content");await c.imagesIsLoaded(h),h&&h.style.height&&h.getAttribute("style")&&h.style.removeProperty("height");let P=(h==null?void 0:h.scrollHeight)+a;if(u.fixedHeight&&(P=c.pxToNumber(u.height)),P>=document.documentElement.clientHeight&&(P=document.documentElement.clientHeight-60-(c.isIphone()?30:0)),B.value=P,h&&(h.style.height=c.numberToPx(Math.abs(B.value-a))),u.sectionsMode){const V=Fe(),X=b.value.querySelector(".sections-mode");X&&(X.style.height=c.numberToPx(Math.abs(B.value-V)),!q.value.length&&N.value<768&&(A.value?X.style.height=A.value:A.value=X.style.height))}},Fe=()=>{var a,h,I,P,V,X,K;if(b.value){const ue=((h=(a=b.value.querySelector(".modal__footer"))==null?void 0:a.getBoundingClientRect())==null?void 0:h.height)||0,ie=((P=(I=b.value.querySelector(".pan"))==null?void 0:I.getBoundingClientRect())==null?void 0:P.height)||0,fe=b.value.querySelector(".modal__sidebar"),me=b.value.querySelector(".modal__title"),Ee=(V=me.getBoundingClientRect())==null?void 0:V.height,oe=c.pxToNumber(getComputedStyle(me).marginBottom);let J=ue+ie+Ee+oe;if(fe){let{paddingTop:re,paddingBottom:we}=getComputedStyle(fe);J+=c.pxToNumber(re)+c.pxToNumber(we)}if(u.sidebarSearch){const re=((K=(X=b.value.querySelector(".modal__sidebar-search"))==null?void 0:X.getBoundingClientRect())==null?void 0:K.height)||0;J+=re}return J}return 0},it=()=>{const a={recognizers:[[et.Pan,{direction:et.DIRECTION_VERTICAL}]]};m.value&&(x.pan=new et(m.value,a),x.pan&&x.pan.on("panstart panup pandown panend",h=>{ot(h,"pan")}))};let Ne=0;const ot=(a,h)=>{const I=-a.deltaY;h==="content"&&a.type==="panup"||h==="content"&&a.type==="pandown"&&Ne>0?b.value.scrollTop=Ne+I:(a.type==="panup"||a.type==="pandown")&&(T.value=!0,a.deltaY>0&&(b.value.style.bottom=c.numberToPx(L+I))),a.isFinal&&(Ne=b.value.scrollTop,T.value=!1,c.pxToNumber(b.value.style.bottom){await n.nextTick(),document.getElementsByClassName("modal-item opened").length||(document.documentElement.style.overflow="auto",document.documentElement.style.overflowY="auto",document.body.style.overflow="auto",document.body.style.overflowY="auto",document.body.style.removeProperty("overflow"))},ye=()=>{document.getElementsByClassName("modal-item opened").length||(document.documentElement.style.overflow="hidden",document.documentElement.style.overflowY="hidden",document.body.style.overflow="hidden",document.body.style.overflowY="hidden")},rt=()=>{ye(),z.value=!0,N.value>768&&n.nextTick(()=>{Re()}),s("opened")},he=()=>{We(),s("close")},qe=a=>{a.target.classList.contains("modal-item__backdrop")&&he()},Oe=a=>a.filter(h=>h.type.__name=="TabbedModalItem")||[],H=a=>{var h,I;return((I=(h=Oe(a)[0])==null?void 0:h.props)==null?void 0:I.name)||null},q=n.computed(()=>{var a;return((a=l.history.value.find(h=>h.modalId==d))==null?void 0:a.history)||[]}),k=n.computed(()=>q.value[0]),U=n.computed(()=>{if(k.value){if(k.value.title)return k.value.title;if(k.value.current)return k.value.current}return u.title?u.title:"Window"}),ke=n.computed(()=>l.hasChildFooter(d));!u.simple&&(u.openFirstSection||N.value>768)&&l.addItem({current:H(v.default()),key:d});const de=a=>a.toLocaleLowerCase().replace(/[^A-Za-zА-Яа-яёЁ0-9@]/g,"").replace("ё","е"),Te=a=>{p.value=a},ve=n.computed(()=>{let a=Oe(v.default()).map(h=>({name:h.props.name,title:h.props.title}));if(u.sidebarSearch&&p.value){let h=de(p.value);a=a.filter(I=>{let P=de(I.title??I.name);if(P.indexOf(h)!==-1)return P.indexOf(h)!==-1})}return n.nextTick(()=>{!p.value&&N.value<768&&Ue()}),a}),_e=()=>{if(!u.simple&&u.sectionsMode&&!q.value.length&&N.value<768)return n.h("div",{class:"modal__child-item-content"},[n.h("div",{class:"modal__inner-content"},"")]);if(u.simple)return n.h("div",{class:"modal__child-item-content"},[n.h("div",{class:"modal__inner-content"},v.default().filter(h=>h.type.__name!="TabbedModalItem"))]);if(!v.default().filter(h=>h.type.__name=="TabbedModalItem").length)return n.h("div",{},[n.h("div",{class:"modal__child-item-header"},[n.h("span",{class:"header__title"},"")]),n.h("div",{class:"modal__child-item-content"},[n.h("div",{class:"modal__inner-content"},v.default().filter(h=>h.type.__name!="TabbedModalItem"))])]);let a=Y(v.default());if(a&&a.props){let h=null;a.props.title&&(h=a.props.title),a.props.headTitle&&(h=a.props.headTitle),a.props["head-title"]&&(h=a.props["head-title"]),h&&l.setCurrentTitle(h,d)}return n.h("div",{key:a.key},a)},Y=a=>{var h,I;a=Oe(a);for(let P of a){if(P.props.name==k.value.current)return P.key=c.makeId(10),P;if((I=(h=P.component)==null?void 0:h.exposed)!=null&&I.defaultSlots){let V=Y(P.component.exposed.defaultSlots);if(V)return V}if(typeof(P==null?void 0:P.children)=="object"){let V=Y(P.children.default());if(V)return V}}},ne=({tabName:a,root:h=!1})=>{Me(a,h)},Me=(a,h=!1)=>{l.addItem({current:a,title:"",clearAll:h,key:d})};return _({goto:Me}),te(),(a,h)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["tabbed-modal modal-item",{opened:z.value,closed:z.value===!1,moving:T.value}]),onMousedown:qe,onTouchstart:qe},[Qt,n.createElementVNode("div",{class:n.normalizeClass(["modal",{moving:T.value}]),ref_key:"modal",ref:b,style:n.normalizeStyle(ge.value)},[u.panDesktop&&n.unref(N)>768||u.panMobile&&n.unref(N)<768?(n.openBlock(),n.createElementBlock("div",{key:0,ref_key:"pan",ref:m,class:"modal__pan"},en,512)):n.createCommentVNode("",!0),n.createElementVNode("div",tn,[u.simple?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(Jt,{key:0,history:q.value,current:k.value,"tabs-sidebar":ve.value,"sidebar-search":u.sidebarSearch,"sidebar-width":u.sidebarWidth,"dynamic-sidebar-width":u.dynamicSidebarWidth,"max-dynamic-sidebar-width":u.maxDynamicSidebarWidth,"search-placeholder":u.searchPlaceholder,onGoto:ne,onSearch:Te,"sections-mode":u.sectionsMode,"current-title":U.value,title:u.title},n.createSlots({_:2},[w.value?{name:"title",fn:n.withCtx(()=>[n.renderSlot(a.$slots,"title",{},void 0,!0)]),key:"0"}:void 0,S.value?{name:"sidebar",fn:n.withCtx(()=>[n.renderSlot(a.$slots,"sidebar",{},void 0,!0)]),key:"1"}:void 0]),1032,["history","current","tabs-sidebar","sidebar-search","sidebar-width","dynamic-sidebar-width","max-dynamic-sidebar-width","search-placeholder","sections-mode","current-title","title"])),n.createElementVNode("div",{class:n.normalizeClass(["modal__content",{"modal__content-simple":u.simple}]),style:n.normalizeStyle({width:ge.value.contentWidth})},[u.simple?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["modal__title",{"modal__title-simple":u.simple}])},[w.value?n.renderSlot(a.$slots,"title",{key:1},void 0,!0):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createTextVNode(n.toDisplayString(u.title),1)],64))],2)):n.createCommentVNode("",!0),(n.openBlock(),n.createBlock(_e,{key:O.value})),M.value&&!ke.value&&u.needFooter?(n.openBlock(),n.createElementBlock("div",nn,[n.renderSlot(a.$slots,"mainFooter",{},void 0,!0)])):n.createCommentVNode("",!0)],6),u.needCloseIcon?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[y.value?(n.openBlock(),n.createElementBlock("div",{key:1,class:"custom-close-icon",onClick:h[1]||(h[1]=I=>he())},[n.renderSlot(a.$slots,"closeIcon",{},void 0,!0)])):(n.openBlock(),n.createElementBlock("div",{key:0,class:"modal__close",onClick:h[0]||(h[0]=I=>he())},on))],64)):n.createCommentVNode("",!0)])],6)],34))}},sn=Ve(rn,[["__scopeId","data-v-ec9c80b5"]]),an=g=>(n.pushScopeId("data-v-bed4ab54"),g=g(),n.popScopeId(),g),ln={class:"modal__child-item-header"},cn=[an(()=>n.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[n.createElementVNode("path",{d:"M20 11H7.83L13.42 5.41L12 4L4 12L12 20L13.41 18.59L7.83 13H20V11Z",fill:"black"})],-1))],hn={key:2,class:"modal__child-item-header-title"},dn={key:0,class:"footer modal__footer"},un=Ve({__name:"TabbedModalItem",props:{name:String,title:String,headTitle:String},emits:["goback"],setup(g,{expose:_,emit:E}){const u=E,c=He(),d=n.useSlots(),v=n.inject("needFooter"),S=n.computed(()=>!!d.header),w=n.computed(()=>!!d.footer),M=n.inject("panMobile"),y=n.inject("modalId"),x=n.inject("isSectionsMode"),l=n.ref(!1),s=Qe(y);s.setChildFooter(w.value,y),s.setCustomHeader(S.value&&c.value<768,y);const m=g,p=n.ref(null),b=n.computed(()=>{const O=s.history.value.find(F=>F.modalId==y);return!!(O.history.length&&(x&&c.value<768||O.history[0].parent!="root"))}),z=n.computed(()=>m.headTitle?m.headTitle:m.title?m.title:m.name?m.name:"Tab title"),T=()=>{n.nextTick(()=>{s.rerenderSlotContent(y)});let O=d.default().filter(F=>F.type.__name!="TabbedModalItem");return n.h("div",{class:"modal__inner-content"},O)},B=(O=!0)=>{s.goBack(y),s.setChildFooter(!1,y),O&&u("goback")};let N=0,A=0;const $=()=>{if(A80){const O=s.history.value.find(F=>F.modalId==y);x&&B(),O.history.length>1&&B()}},L=O=>{N=O.changedTouches[0].screenX},te=O=>{A=O.changedTouches[0].screenX,$()};return n.onMounted(()=>{l.value=!0,c.value<768&&(document.addEventListener("touchstart",L),document.addEventListener("touchend",te))}),n.onBeforeUnmount(()=>{c.value<768&&(document.removeEventListener("touchstart",L),document.removeEventListener("touchend",te))}),_({goBack:B,defaultSlots:d.default(),slotHeader:d.header&&typeof d.header=="function"?d.header():[]}),(O,F)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createElementVNode("div",ln,[b.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["modal__go-back",{"modal__go-back--no-mobile-pan":!n.unref(M)}]),onClick:F[0]||(F[0]=Z=>B())},cn,2)):n.createCommentVNode("",!0),S.value?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[l.value?(n.openBlock(),n.createBlock(n.Teleport,{key:0,to:"#modal__custom-header-"+n.unref(y),disabled:n.unref(c)>768},[n.renderSlot(O.$slots,"header",{},void 0,!0)],8,["to","disabled"])):n.createCommentVNode("",!0)],64)):(n.openBlock(),n.createElementBlock("span",hn,n.toDisplayString(z.value),1))]),n.createElementVNode("div",{class:"modal__child-item-content",ref_key:"contentItem",ref:p},[n.createVNode(T)],512),w.value&&n.unref(v)?(n.openBlock(),n.createElementBlock("div",dn,[n.renderSlot(O.$slots,"footer",{},void 0,!0)])):n.createCommentVNode("",!0)],64))}},[["__scopeId","data-v-bed4ab54"]]);return{install:(g,_)=>{g.component("TabbedModal",sn),g.component("TabbedModalItem",un)}}});