1import{p as j,F as B}from"../base-Ci7vLHE_.js";import"../preload-helper-BVLnHgTN.js";var P=s=>{throw TypeError(s)},$=(s,t,e)=>t.has(s)||P("Cannot "+e),o=(s,t,e)=>($(s,t,"read from private field"),e?e.call(s):t.get(s)),k=(s,t,e)=>t.has(s)?P("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),C=(s,t,e,i)=>($(s,t,"write to private field"),t.set(s,e),e),f=(s,t,e)=>($(s,t,"access private method"),e),d,g,L,y,M,p,N,R,S;let F=class{constructor(t,e=2){k(this,p),k(this,d),k(this,g),k(this,L,null),k(this,y,null),k(this,M,{up:[],down:[],left:[],right:[]}),C(this,d,t),C(this,g,e)}register(){o(this,d).addEventListener("touchstart",this),o(this,d).addEventListener("touchmove",this),o(this,d).addEventListener("touchend",this)}deregister(){o(this,d).removeEventListener("touchstart",this),o(this,d).removeEventListener("touchmove",this),o(this,d).removeEventListener("touchend",this)}handleEvent(t){switch(t.type){case"touchstart":f(this,p,N).call(this,t);break;case"touchmove":f(this,p,R).call(this,t);break;case"touchend":f(this,p,R).call(this,t);break}}addEventListener(t,e){o(this,M)[t].push(e)}};d=new WeakMap,g=new WeakMap,L=new WeakMap,y=new WeakMap,M=new WeakMap,p=new WeakSet,N=function(s){C(this,L,s.touches[0].clientX),C(this,y,s.touches[0].clientY)},R=function(s){if(!o(this,L)||!o(this,y)||s.touches.length===0)return;const t=s.touches[0].clientX,e=s.touches[0].clientY,i=o(this,L)-t,a=o(this,y)-e;Math.abs(i)!==0&&(i>o(this,g)&&f(this,p,S).call(this,"left"),i<o(this,g)*-1&&f(this,p,S).call(this,"right")),Math.abs(a)!==0&&(a>o(this,g)&&f(this,p,S).call(this,"up"),a<o(this,g)*-1&&f(this,p,S).call(this,"down")),C(this,L,null),C(this,y,null)},S=function(s){for(const t of o(this,M)[s])t()};var I=Object.defineProperty,z=s=>{throw TypeError(s)},O=(s,t,e)=>t in s?I(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,U=(s,t,e)=>O(s,t+"",e),A=(s,t,e)=>t.has(s)||z("Cannot "+e),n=(s,t,e)=>(A(s,t,"read from private field"),e?e.call(s):t.get(s)),b=(s,t,e)=>t.has(s)?z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),w=(s,t,e,i)=>(A(s,t,"write to private field"),t.set(s,e),e),u=(s,t,e)=>(A(s,t,"access private method"),e);function G(s,t,e){let i=s.querySelector(t);return i||(i=e()),i}var E,r,h,x,m,l,W,T,D,q;const X=class Y extends j{constructor(){super(),b(this,l),b(this,E),b(this,r),b(this,h,null),b(this,x,[]),b(this,m);let t=this.shadowRoot.querySelector("slot");t||(t=this.ownerDocument.createElement("slot"),t.setAttribute("name","slot"),this.shadowRoot.appendChild(t)),w(this,r,new Map),w(this,E,B().newTranslator())}connectedCallback(){var t;w(this,x,(this.getAttribute("display")||"").split(" ")),(((t=this.shadowRoot.querySelector('slot[name = "slot"]'))==null?void 0:t.assignedElements())||[]).forEach(e=>{e.tagName==="A"&&u(this,l,W).call(this,[e]),u(this,l,W).call(this,e.querySelectorAll("a"))}),u(this,l,W).call(this,this.shadowRoot.querySelectorAll("a"))}get display(){return n(this,x)}set display(t){w(this,x,t),u(this,l,D).call(this)}handleEvent(t){switch(t.preventDefault(),t.type){case"click":u(this,l,T).call(this,t);break}}close(){const t=this.shadowRoot.querySelector("dialog");t&&t.close()}showPrev(){let t;const e=[...n(this,r).keys()];n(this,h)?t=n(this,r).get(n(this,h))-1:t=0,w(this,h,e[t]||e[e.length-1]),u(this,l,q).call(this)}showNext(){let t;const e=[...n(this,r).keys()];n(this,h)?t=n(this,r).get(n(this,h))+1:t=0,w(this,h,e[t]||e[0]),u(this,l,q).call(this)}static register(){customElements.get("g2ui-lightbox")||customElements.define("g2ui-lightbox",Y)}};E=new WeakMap,r=new WeakMap,h=new WeakMap,x=new WeakMap,m=new WeakMap,l=new WeakSet,W=function(s){let t=0;for(const e of s)e.addEventListener("click",this,!1),n(this,r).set(e,t),t++},T=function(s){var t;w(this,h,s.target.closest("a"));const e=G(this.shadowRoot,"dialog",()=>{const i=this.ownerDocument.createElement("dialog");i.addEventListener("close",()=>{var c;(c=n(this,m))==null||c.deregister(),i.dispatchEvent(new Event("modal:close",{bubbles:!0,composed:!0}))}),i.addEventListener("keydown",c=>{if(!i.open)return;const v=c.key;v==="ArrowRight"&&this.showNext(),v==="ArrowLeft"&&this.showPrev()});const a=i.querySelector(".image-container")||this.ownerDocument.createElement("div");return a.classList.add("image-container"),n(this,r).size>1&&(n(this,m)||w(this,m,new F(a)),n(this,m).addEventListener("left",()=>this.showNext()),n(this,m).addEventListener("right",()=>this.showPrev())),i.appendChild(a),this.shadowRoot.appendChild(i),i});u(this,l,D).call(this),e.classList.toggle("multiple",n(this,r).size>1),e.classList.toggle("single",n(this,r).size===1),u(this,l,q).call(this),e.showModal(),e.focus(),(t=n(this,m))==null||t.register(),e.dispatchEvent(new Event("modal:open",{bubbles:!0,composed:!0}))},D=function(){var s;const t=this.shadowRoot.querySelector("dialog");if(!t)return;(s=this.shadowRoot.querySelector(".controls"))==null||s.remove();const e=this.ownerDocument.createElement("div");e.classList.add("controls");const i=this.ownerDocument.createElement("button");i.type="button",i.addEventListener("click",()=>t.close()),i.textContent=n(this,E).lookup("close"),i.classList.add("close"),e.appendChild(i);const a=this.ownerDocument.createElement("button");a.type="button",a.textContent=n(this,E).lookup("prev"),a.classList.add("prev"),e.appendChild(a);const c=this.ownerDocument.createElement("button");if(c.type="button",c.textContent=n(this,E).lookup("next"),c.classList.add("next"),e.appendChild(c),a.addEventListener("click",()=>this.showPrev()),c.addEventListener("click",()=>this.showNext()),t.appendChild(e),n(this,x).includes("share")){const v=this.ownerDocument.createElement("button");v.type="button",v.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("share",{detail:{src:n(this,h).href}}))),v.textContent=n(this,E).lookup("share"),v.classList.add("share"),e.appendChild(v)}},q=function(){const s=this.shadowRoot.querySelector("dialog");if(!s)return;s.querySelectorAll("img").forEach(i=>
1i.remove()),s.classList.add("loading"),s.classList.remove("is-loaded");const t=s.querySelector(".image-container"),e=this.ownerDocument.createElement("img");e.src=n(this,h).href,e.addEventListener("load",()=>{s.classList.remove("loading"),s.classList.add("is-loaded")},{once:!0}),t.appendChild(e),this.dispatchEvent(new CustomEvent("change",{detail:{src:n(this,h).href}}))},U(X,"adopt",[new URL("/apps/framework/build/css/g2ui-lightbox-BIDWWlS0.css",import.meta.url)]);let Q=X;export{Q as default};
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.