/*! For license information please see descope-avatar.js.LICENSE.txt */
"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[2272],{1508:(t,e,o)=>{function s(t){const e=[];for(;t;){if(t.nodeType===Node.DOCUMENT_NODE){e.push(t);break}t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?t=t.assignedSlot?t.assignedSlot:t.parentNode:(e.push(t),t=t.host)}return e}function i(t){const e=[];let o;return"slot"===t.localName?o=t.assignedElements():(e.push(t),o=[...t.children]),o.forEach(t=>e.push(...i(t))),e}function n(t,e){return e?e.closest(t)||n(t,e.getRootNode().host):null}function d(t){return t?new Set(t.split(" ")):new Set}function a(t){return t?[...t].join(" "):""}function h(t,e,o){const s=d(t.getAttribute(e));s.add(o),t.setAttribute(e,a(s))}function r(t,e,o){const s=d(t.getAttribute(e));s.delete(o),0!==s.size?t.setAttribute(e,a(s)):t.removeAttribute(e)}function l(t){return t.nodeType===Node.TEXT_NODE&&""===t.textContent.trim()}o.d(e,{Dy:()=>s,J$:()=>i,Wr:()=>r,Z4:()=>d,ZA:()=>l,el:()=>n,iA:()=>h,sz:()=>a})},11707:(t,e,o)=>{o.d(e,{I:()=>i});let s=0;function i(){return s++}},42068:(t,e,o)=>{o(88660);var s=o(87550),i=o(36411);const n=s.AH`
  :host {
    --lumo-size-xs: 1.625rem;
    --lumo-size-s: 1.875rem;
    --lumo-size-m: 2.25rem;
    --lumo-size-l: 2.75rem;
    --lumo-size-xl: 3.5rem;

    /* Icons */
    --lumo-icon-size-s: 1.25em;
    --lumo-icon-size-m: 1.5em;
    --lumo-icon-size-l: 2.25em;
    /* For backwards compatibility */
    --lumo-icon-size: var(--lumo-icon-size-m);
  }
`;(0,i.q)("sizing-props",n)},44099:(t,e,o)=>{o.d(e,{r:()=>d});var s=o(1508),i=o(65641),n=o(11707);class d extends EventTarget{static generateId(t,e){return`${e||"default"}-${t.localName}-${(0,n.I)()}`}constructor(t,e,o,s={}){super();const{initializer:i,multiple:n,observe:d,useUniqueId:a}=s;this.host=t,this.slotName=e,this.tagName=o,this.observe="boolean"!=typeof d||d,this.multiple="boolean"==typeof n&&n,this.slotInitializer=i,n&&(this.nodes=[]),a&&(this.defaultId=this.constructor.generateId(t,e))}hostConnected(){this.initialized||(this.multiple?this.initMultiple():this.initSingle(),this.observe&&this.observeSlot(),this.initialized=!0)}initSingle(){let t=this.getSlotChild();t?(this.node=t,this.initAddedNode(t)):(t=this.attachDefaultNode(),this.initNode(t))}initMultiple(){const t=this.getSlotChildren();if(0===t.length){const t=this.attachDefaultNode();t&&(this.nodes=[t],this.initNode(t))}else this.nodes=t,t.forEach(t=>{this.initAddedNode(t)})}attachDefaultNode(){const{host:t,slotName:e,tagName:o}=this;let s=this.defaultNode;return!s&&o&&(s=document.createElement(o),s instanceof Element&&(""!==e&&s.setAttribute("slot",e),this.defaultNode=s)),s&&(this.node=s,t.appendChild(s)),s}getSlotChildren(){const{slotName:t}=this;return Array.from(this.host.childNodes).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e.slot===t||e.nodeType===Node.TEXT_NODE&&e.textContent.trim()&&""===t)}getSlotChild(){return this.getSlotChildren()[0]}initNode(t){const{slotInitializer:e}=this;e&&e(t,this.host)}initCustomNode(t){}teardownNode(t){}initAddedNode(t){t!==this.defaultNode&&(this.initCustomNode(t),this.initNode(t))}observeSlot(){const{slotName:t}=this,e=""===t?"slot:not([name])":`slot[name=${t}]`,o=this.host.shadowRoot.querySelector(e);this.__slotObserver=new i.P(o,({addedNodes:t,removedNodes:e})=>{const o=this.multiple?this.nodes:[this.node],i=t.filter(t=>!(0,s.ZA)(t)&&!o.includes(t));e.length&&(this.nodes=o.filter(t=>!e.includes(t)),e.forEach(t=>{this.teardownNode(t)})),i&&i.length>0&&(this.multiple?(this.defaultNode&&this.defaultNode.remove(),this.nodes=[...o,...i].filter(t=>t!==this.defaultNode),i.forEach(t=>{this.initAddedNode(t)})):(this.node&&this.node.remove(),this.node=i[0],this.initAddedNode(this.node)))})}}},53149:(t,e,o)=>{o.d(e,{y:()=>n});var s=o(98741),i=o(30025);const n=(0,s.y)(t=>class extends t{get _keyboardActive(){return(0,i.aJ)()}ready(){this.addEventListener("focusin",t=>{this._shouldSetFocus(t)&&this._setFocused(!0)}),this.addEventListener("focusout",t=>{this._shouldRemoveFocus(t)&&this._setFocused(!1)}),super.ready()}disconnectedCallback(){super.disconnectedCallback(),this.hasAttribute("focused")&&this._setFocused(!1)}_setFocused(t){this.toggleAttribute("focused",t),this.toggleAttribute("focus-ring",t&&this._keyboardActive)}_shouldSetFocus(t){return!0}_shouldRemoveFocus(t){return!0}})},53557:(t,e,o)=>{o.r(e),o.d(e,{AvatarClass:()=>u,componentName:()=>a});var s=o(88961),i=o(72270),n=o(63200),d=o(25964);const a=(0,d.xE)("avatar");class h extends((0,i.qu)({componentName:a,baseSelector:":host > .wrapper"})){constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n      <div class="wrapper">\n        <vaadin-avatar></vaadin-avatar>\n        <div class="editableBadge">\n          <vaadin-icon icon="vaadin:pencil"></vaadin-icon>\n        </div>\n      </div>\n\t\t',(0,d.fz)("\n        :host {\n\t\t\t\t\tdisplay: inline-flex;\n\t\t\t\t}\n\n        .editableBadge {\n          border: 1px solid;\n          border-radius: 100%;\n          height: fit-content;\n          width: 25%;\n          height: 25%;\n          display: flex;\n          justify-content: center;\n          align-items: center;\n          padding: 5%;\n          box-sizing: border-box;\n          position: absolute;\n          bottom: 0;\n          inset-inline-end: 0;\n        }\n\n        vaadin-icon {\n          color: currentcolor;\n        }\n\n        vaadin-avatar {\n          width: 100%;\n          height: 100%;\n          margin: 0;\n          border: none\n        }\n\n        .wrapper {\n          display: inline-flex;\n          position: relative;\n          width: 100%;\n          height: 100%;\n        }\n    ",this),this.avatarComponent=this.shadowRoot.querySelector("vaadin-avatar"),(0,d.EA)(this,this.avatarComponent,{includeAttrs:["display-name","img","abbr"],mapAttrs:{"display-name":"name"}});const t=this.shadowRoot.querySelector(".editableBadge");(0,d.mx)(this,()=>{t.style.display=this.isEditable?"":"none"},{includeAttrs:["editable"]})}get isEditable(){return"true"===this.getAttribute("editable")}}const{host:r,editableBadge:l,avatar:c}={host:{selector:()=>":host"},editableBadge:{selector:"> .editableBadge"},avatar:{selector:"vaadin-avatar"}},u=(0,n.Zz)((0,s.RF)({mappings:{hostWidth:[{...r,property:"width"},{...r,property:"min-width"}],hostHeight:{...r,property:"height"},cursor:[c,r],hostDirection:{...r,property:"direction"},avatarTextColor:{...c,property:"color"},avatarBackgroundColor:{...c,property:"background-color"},editableIconColor:{...l,property:"color"},editableBorderColor:{...l,property:"border-color"},editableBackgroundColor:{...l,property:"background-color"}}}),s.VO,s.tQ)(h);o(4408),o(95260),o(37182),customElements.define(a,u)},65641:(t,e,o)=>{o.d(e,{P:()=>s});class s{constructor(t,e){this.slot=t,this.callback=e,this._storedNodes=[],this._connected=!1,this._scheduled=!1,this._boundSchedule=()=>{this._schedule()},this.connect(),this._schedule()}connect(){this.slot.addEventListener("slotchange",this._boundSchedule),this._connected=!0}disconnect(){this.slot.removeEventListener("slotchange",this._boundSchedule),this._connected=!1}_schedule(){this._scheduled||(this._scheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){this._connected&&(this._scheduled=!1,this._processNodes())}_processNodes(){const t=this.slot.assignedNodes({flatten:!0});let e=[];const o=[],s=[];t.length&&(e=t.filter(t=>!this._storedNodes.includes(t))),this._storedNodes.length&&this._storedNodes.forEach((e,i)=>{const n=t.indexOf(e);-1===n?o.push(e):n!==i&&s.push(e)}),(e.length||o.length||s.length)&&this.callback({addedNodes:e,movedNodes:s,removedNodes:o}),this._storedNodes=t}}},81488:(t,e,o)=>{o.d(e,{I:()=>i});var s=o(44099);class i extends s.r{constructor(t){super(t,"tooltip"),this.setTarget(t)}initCustomNode(t){t.target=this.target,void 0!==this.ariaTarget&&(t.ariaTarget=this.ariaTarget),void 0!==this.context&&(t.context=this.context),void 0!==this.manual&&(t.manual=this.manual),void 0!==this.opened&&(t.opened=this.opened),void 0!==this.position&&(t._position=this.position),void 0!==this.shouldShow&&(t.shouldShow=this.shouldShow),this.__notifyChange()}teardownNode(){this.__notifyChange()}setAriaTarget(t){this.ariaTarget=t;const e=this.node;e&&(e.ariaTarget=t)}setContext(t){this.context=t;const e=this.node;e&&(e.context=t)}setManual(t){this.manual=t;const e=this.node;e&&(e.manual=t)}setOpened(t){this.opened=t;const e=this.node;e&&(e.opened=t)}setPosition(t){this.position=t;const e=this.node;e&&(e._position=t)}setShouldShow(t){this.shouldShow=t;const e=this.node;e&&(e.shouldShow=t)}setTarget(t){this.target=t;const e=this.node;e&&(e.target=t)}__notifyChange(){this.dispatchEvent(new CustomEvent("tooltip-changed",{detail:{node:this.node}}))}}}}]);
//# sourceMappingURL=descope-avatar.js.map