import{Y as t,bg as e,ap as n}from"./backend-ai-webui-661d9e43.js";
/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/const o=!1,i=t=>t,s="string"==typeof document.head.style.touchAction,c="__polymerGestures",u="__polymerGesturesHandled",r="__polymerGesturesTouchAction",a=25,h=5,d=["mousedown","mousemove","mouseup","click"],l=[0,1,4,2],f=function(){try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(t){return!1}}();function m(t){return d.indexOf(t)>-1}let v=!1;function p(t){if(!m(t)&&"touchend"!==t)return s&&v&&o?{passive:!0}:void 0}!function(){try{const t=Object.defineProperty({},"passive",{get(){v=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){}}();const y=navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/u),w={button:!0,command:!0,fieldset:!0,input:!0,keygen:!0,optgroup:!0,option:!0,select:!0,textarea:!0};function g(t){const e=t.type;if(!m(e))return!1;if("mousemove"===e){let e=void 0===t.buttons?1:t.buttons;return t instanceof window.MouseEvent&&!f&&(e=l[t.which]||0),Boolean(1&e)}return 0===(void 0===t.button?0:t.button)}const b={mouse:{target:null,mouseIgnoreJob:null},touch:{x:0,y:0,id:-1,scrollDecided:!1}};function x(t,e,n){t.movefn=e,t.upfn=n,document.addEventListener("mousemove",e),document.addEventListener("mouseup",n)}function _(t){document.removeEventListener("mousemove",t.movefn),document.removeEventListener("mouseup",t.upfn),t.movefn=null,t.upfn=null}const E=window.ShadyDOM&&window.ShadyDOM.noPatch?window.ShadyDOM.composedPath:t=>t.composedPath&&t.composedPath()||[],k={},A=[];function M(t){const e=E(t);return e.length>0?e[0]:t.target}function N(t){const e=t.type,n=t.currentTarget[c];if(!n)return;const o=n[e];if(!o)return;if(!t[u]&&(t[u]={},e.startsWith("touch"))){const n=t.changedTouches[0];if("touchstart"===e&&1===t.touches.length&&(b.touch.id=n.identifier),b.touch.id!==n.identifier)return;s||"touchstart"!==e&&"touchmove"!==e||function(t){const e=t.changedTouches[0],n=t.type;if("touchstart"===n)b.touch.x=e.clientX,b.touch.y=e.clientY,b.touch.scrollDecided=!1;else if("touchmove"===n){if(b.touch.scrollDecided)return;b.touch.scrollDecided=!0;const n=function(t){let e="auto";const n=E(t);for(let t,o=0;o<n.length;o++)if(t=n[o],t[r]){e=t[r];break}return e}(t);let o=!1;const i=Math.abs(b.touch.x-e.clientX),s=Math.abs(b.touch.y-e.clientY);t.cancelable&&("none"===n?o=!0:"pan-x"===n?o=s>i:"pan-y"===n&&(o=i>s)),o?t.preventDefault():L("track")}}(t)}const i=t[u];if(!i.skip){for(let e,n=0;n<A.length;n++)e=A[n],o[e.name]&&!i[e.name]&&e.flow&&e.flow.start.indexOf(t.type)>-1&&e.reset&&e.reset();for(let n,s=0;s<A.length;s++)n=A[s],o[n.name]&&!i[n.name]&&(i[n.name]=!0,n[e](t))}}function Y(t,e,n){return!!k[e]&&(function(t,e,n){const o=k[e],i=o.deps,s=o.name;let u=t[c];u||(t[c]=u={});for(let e,n,o=0;o<i.length;o++)e=i[o],y&&m(e)&&"click"!==e||(n=u[e],n||(u[e]=n={_count:0}),0===n._count&&t.addEventListener(e,N,p(e)),n[s]=(n[s]||0)+1,n._count=(n._count||0)+1);t.addEventListener(e,n),o.touchAction&&X(t,o.touchAction)}(t,e,n),!0)}function T(t){A.push(t),t.emits.forEach((e=>{k[e]=t}))}function X(e,n){s&&e instanceof HTMLElement&&t.run((()=>{e.style.touchAction=n})),e[r]=n}function D(t,e,n){const o=new Event(e,{bubbles:!0,cancelable:!0,composed:!0});if(o.detail=n,i(t).dispatchEvent(o),o.defaultPrevented){const t=n.preventer||n.sourceEvent;t&&t.preventDefault&&t.preventDefault()}}function L(t){const e=function(t){for(let e,n=0;n<A.length;n++){e=A[n];for(let n,o=0;o<e.emits.length;o++)if(n=e.emits[o],n===t)return e}return null}(t);e.info&&(e.info.prevent=!0)}function P(t,e,n,o){e&&D(e,t,{x:n.clientX,y:n.clientY,sourceEvent:n,preventer:o,prevent:t=>L(t)})}function O(t,e,n){if(t.prevent)return!1;if(t.started)return!0;const o=Math.abs(t.x-e),i=Math.abs(t.y-n);return o>=h||i>=h}function S(t,e,n){if(!e)return;const o=t.moves[t.moves.length-2],i=t.moves[t.moves.length-1],s=i.x-t.x,c=i.y-t.y;let u,r=0;o&&(u=i.x-o.x,r=i.y-o.y),D(e,"track",{state:t.state,x:n.clientX,y:n.clientY,dx:s,dy:c,ddx:u,ddy:r,sourceEvent:n,hover:()=>function(t,e){let n=document.elementFromPoint(t,e),o=n;for(;o&&o.shadowRoot&&!window.ShadyDOM;){const i=o;if(o=o.shadowRoot.elementFromPoint(t,e),i===o)break;o&&(n=o)}return n}(n.clientX,n.clientY)})}function K(t,e,n){const o=Math.abs(e.clientX-t.x),i=Math.abs(e.clientY-t.y),s=M(n||e);!s||w[s.localName]&&s.hasAttribute("disabled")||(isNaN(o)||isNaN(i)||o<=a&&i<=a||function(t){if("click"===t.type){if(0===t.detail)return!0;const e=M(t);if(!e.nodeType||e.nodeType!==Node.ELEMENT_NODE)return!0;const n=e.getBoundingClientRect(),o=t.pageX,i=t.pageY;return!(o>=n.left&&o<=n.right&&i>=n.top&&i<=n.bottom)}return!1}(e))&&(t.prevent||D(s,"tap",{x:e.clientX,y:e.clientY,sourceEvent:e,preventer:n}))}
/**
 * @license
 * Copyright (c) 2021 - 2023 Vaadin Ltd.
 * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
 */T({name:"downup",deps:["mousedown","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["down","up"],info:{movefn:null,upfn:null},reset(){_(this.info)},mousedown(t){if(!g(t))return;const e=M(t),n=this;x(this.info,(t=>{g(t)||(P("up",e,t),_(n.info))}),(t=>{g(t)&&P("up",e,t),_(n.info)})),P("down",e,t)},touchstart(t){P("down",M(t),t.changedTouches[0],t)},touchend(t){P("up",M(t),t.changedTouches[0],t)}}),T({name:"track",touchAction:"none",deps:["mousedown","touchstart","touchmove","touchend"],flow:{start:["mousedown","touchstart"],end:["mouseup","touchend"]},emits:["track"],info:{x:0,y:0,state:"start",started:!1,moves:[],addMove(t){this.moves.length>2&&this.moves.shift(),this.moves.push(t)},movefn:null,upfn:null,prevent:!1},reset(){this.info.state="start",this.info.started=!1,this.info.moves=[],this.info.x=0,this.info.y=0,this.info.prevent=!1,_(this.info)},mousedown(t){if(!g(t))return;const e=M(t),n=this,o=t=>{const o=t.clientX,i=t.clientY;O(n.info,o,i)&&(n.info.state=n.info.started?"mouseup"===t.type?"end":"track":"start","start"===n.info.state&&L("tap"),n.info.addMove({x:o,y:i}),g(t)||(n.info.state="end",_(n.info)),e&&S(n.info,e,t),n.info.started=!0)};x(this.info,o,(t=>{n.info.started&&o(t),_(n.info)})),this.info.x=t.clientX,this.info.y=t.clientY},touchstart(t){const e=t.changedTouches[0];this.info.x=e.clientX,this.info.y=e.clientY},touchmove(t){const e=M(t),n=t.changedTouches[0],o=n.clientX,i=n.clientY;O(this.info,o,i)&&("start"===this.info.state&&L("tap"),this.info.addMove({x:o,y:i}),S(this.info,e,n),this.info.state="track",this.info.started=!0)},touchend(t){const e=M(t),n=t.changedTouches[0];this.info.started&&(this.info.state="end",this.info.addMove({x:n.clientX,y:n.clientY}),S(this.info,e,n))}}),T({name:"tap",deps:["mousedown","click","touchstart","touchend"],flow:{start:["mousedown","touchstart"],end:["click","touchend"]},emits:["tap"],info:{x:NaN,y:NaN,prevent:!1},reset(){this.info.x=NaN,this.info.y=NaN,this.info.prevent=!1},mousedown(t){g(t)&&(this.info.x=t.clientX,this.info.y=t.clientY)},click(t){g(t)&&K(this.info,t)},touchstart(t){const e=t.changedTouches[0];this.info.x=e.clientX,this.info.y=e.clientY},touchend(t){K(this.info,t.changedTouches[0],t)}});const W=t=>class extends(e(n(t))){get _activeKeys(){return[" "]}ready(){super.ready(),Y(this,"down",(t=>{this._shouldSetActive(t)&&this._setActive(!0)})),Y(this,"up",(()=>{this._setActive(!1)}))}disconnectedCallback(){super.disconnectedCallback(),this._setActive(!1)}_shouldSetActive(t){return!this.disabled}_onKeyDown(t){super._onKeyDown(t),this._shouldSetActive(t)&&this._activeKeys.includes(t.key)&&(this._setActive(!0),document.addEventListener("keyup",(t=>{this._activeKeys.includes(t.key)&&this._setActive(!1)}),{once:!0}))}_setActive(t){this.toggleAttribute("active",t)}}
/**
 * @license
 * Copyright (c) 2021 - 2023 Vaadin Ltd.
 * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
 */;function C(t,e){const{scrollLeft:n}=t;return"rtl"!==e?n:t.scrollWidth-t.clientWidth+n}function G(t,e,n){t.scrollLeft="rtl"!==e?n:t.clientWidth-t.scrollWidth+n}export{W as A,Y as a,X as b,C as g,G as s};
