1import{_ as n,a as o,c as l,b as y}from"./chunk-vendor-di.Bh23gdA.js";import{P as H,e as r,b as G,d as Y,r as B,$ as q,t as F}from"./chunk-vendor-lit.NvY0u02.js";import{p as K}from"./chunk-phoenix_custom_element.-3oJuZO.js";import{c as J}from"./chunk-index.D5AUA1V.js";import{I as W,b as Q,a as E,c as w}from"./chunk-input_constants.Bz3yUrY.js";import{C as X,B as Z,a as tt}from"./chunk-control_props_sync_consumer_controller.B1LB2a5.js";import{B as et}from"./chunk-btn_controller.BPcEEeZ.js";import{H as it}from"./chunk-input_icon.Dk1x6ey.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-behavior_subject.BGn-8a7.js";import"./chunk-subject.nuVoBpB.js";import"./chunk-context_provider_controller.CCbkLM7.js";import"./chunk-observer.oe4_irb.js";import"./chunk-context_consumer_controller.DQ84A7A.js";import"./chunk-keystrokes_controller.BSiCZ0Y.js";import"./chunk-icon_constants.BVm6Vwv.js";let f=class extends H{constructor(){super(),this.type=W.text,new X({host:this,propsToSync:[...Object.keys(Z),...Object.values(Q)]})}connectedCallback(){super.connectedCallback(),this.type!==W.hidden&&this.classList.add(E.input),this._updateCssClassesBasedOnProps()}updated(t){super.updated(t),this._updateCssClassesBasedOnProps()}_updateCssClassesBasedOnProps(){var t;const e=[E.inputDisabled,E.inputError];this.classList.remove(...e);const i=J({[E.inputDisabled]:this.disabled,[E.inputError]:this.error},E[(t=this.size)!==null&&t!==void 0?t:""]);i&&this.classList.add(i)}};n([r({type:String}),o("design:type",String)],f.prototype,"controlId",void 0);n([r({type:String}),o("design:type",String)],f.prototype,"controlName",void 0);n([r({type:String}),o("design:type",String)],f.prototype,"size",void 0);n([r({type:Boolean}),o("design:type",Boolean)],f.prototype,"withButton",void 0);n([r({type:Boolean}),o("design:type",Boolean)],f.prototype,"disabled",void 0);n([r({type:Boolean}),o("design:type",Boolean)],f.prototype,"required",void 0);n([r({type:Boolean}),o("design:type",Boolean)],f.prototype,"hidden",void 0);n([r({type:Boolean}),o("design:type",Boolean)],f.prototype,"readonly",void 0);n([r({type:Boolean}),o("design:type",Boolean)],f.prototype,"error",void 0);n([r({type:String}),o("design:type",String)],f.prototype,"placeholder",void 0);n([r({type:String}),o("design:type",String)],f.prototype,"type",void 0);n([r({type:String}),o("design:type",String)],f.prototype,"value",void 0);f=n([K("h-input"),o("design:paramtypes",[])],f);var x,I,v,L,A,k,$,D,R,b,V,T;const M="_";class st{constructor({host:t,input:e,mask:i,pattern:h,validPattern:j}){x.set(this,void 0),I.set(this,void 0),v.set(this,void 0),L.set(this,void 0),A.set(this,void 0),k.set(this,[]),$.set(this,["Backspace","Enter","Escape","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete","CapsLock","Shift","Control","Alt","AltGraph","Tab"]),D.set(this,void 0),R.set(this,!1),b.set(this,""),V.set(this,!1),T.set(this,!1),this.isEnabled=!1,this.enable=()=>{if(!this.isEnabled){const s=this._getInput();this._isValidPattern(s.value)||(s.value=""),this.isEnabled=!0}},this.disable=()=>{this.isEnabled&&(this.isEnabled=!1)},this.setInitialMaskWhenEmpty=s=>{if(s.target instanceof HTMLInputElement){const u=s.target;u.value||(u.value=l(this,v,"f"),this._setCursorPosition())}},this.setCursorOnStartWhenEmpty=s=>{s.target instanceof HTMLInputElement&&s.target.value===l(this,v,"f")&&this._setCursorPosition()},this.setEmptyValueForNoValue=s=>{if(s.target instanceof HTMLInputElement){const u=s.target;u.value===l(this,v,"f")&&(u.value="")}},this.onKeyDown=s=>{if(s.target instanceof HTMLInputElement){const u=s.target,p=u.value,_=s.key==="Backspace"||s.keyCode===8,C=s.key==="Delete"||s.keyCode===46,d=_||C;p===""&&!d&&this.setInitialMaskWhenEmpty(s);let a=this._getCursorPosition();if(a[0]!==a[1])if(d){const g=p.substring(0,a[0]),m=p.substring(a[0],a[1]),P=p.substring(a[1],p.length),z=new RegExp("[^"+l(this,k,"f").join("")+"]","g"),U=g+m.replace(z,M)+P;return u.value=U,y(this,b,U),s.key==="Backspace"||s.keyCode===8?(this._setCursorPosition(a[0]+2),a[0]==5&&y(this,T,!0)):this._setCursorPosition(a[0]),!1}else!this._areKeysCombined(s)&&l(this,$,"f").indexOf(s.key)<0&&(a=[a[0],a[0]]);if(d){if(_){if(l(this,k,"f").indexOf(p[a[0]-1])>=0)return y(this,b,u.value),this._setCursorPosition(a[0]+1),!1;a[0]!==0&&(s.target.value=this._insertCharAt(p,M,a[0]),this._setCursorPosition(a))}if(C){if(l(this,k,"f").indexOf(p[a[0]])>=0)return y(this,b,u.value),this._setCursorPosition(a[0]+1),!1;if(a[0]!==p.length)return s.target.value=this._replaceCharAt(p,M,a[0]),y(this,b,u.value),setTimeout(()=>{this._setCursorPosition(a.map(function(g){return g+=1}))}),!1}return!0}if(l(this,$,"f").indexOf(s.key)>=0||this._areKeysCombined(s))return!0;a[1]+=1,window.navigator.userAgent.indexOf("Edge/")>-1&&(s.target.value=this._replaceCharAt(s.target.value,s.key,a[0])),this._setCursorPosition(a),y(this,b,p)}},this.onInput=s=>{if(s.target instanceof HTMLInputElement){const u=s.target,p=u.value,_=this._getCursorPosition(),C=this._skipCharactersBy.call(this,p,_[0],0);if(C>0&&p.length!==_[0]+C&&this._setCursorPosition(_.map(d=>d+C)),!this._isValidPattern(p)){const d=this._getCursorPosition();return u.value=l(this,b,"f"),l(this,T,"f")||l(this,V,"f")?(this._setCursorPosition(d[0]),y(this,T,!1),y(this,V,!1)):this._setCursorPosition(d[0]-1),!1}if(l(this,v,"f").length!==p.length){u.value=p.slice(0,l(this,v,"f").length);const d=p.indexOf(M);d>=0&&this._setCursorPosition(d)}}},this.onKeyUp=s=>{if(s.target instanceof HTMLInputElement){const u=s.target,p=u.value,_=this._getCursorPosition();let C;if(s.key==="Backspace"||s.keyCode===8)return C=this._skipCharactersBy(p,_[0]-1,0,!0),C>0&&this._setCursorPosition(_.map(d=>d-C)),!0;if(s.key==="Delete"||s.keyCode===46)return C=this._skipCharactersBy(p,_[0],0),C>0&&this._setCursorPosition(_.map(d=>d+C)),!0;if(l(this,$,"f").indexOf(s.key)>=0||this._areKeysCombined(s))return!0;p||(u.value=l(this,v,"f"),this._setCursorPosition())}},this.onPaste=s=>{var u;if(s.target instanceof HTMLInputElement){const p=s.target,_=p.value,C=_.length,d=(u=s.clipboardData)===null||u===void 0?void 0:u.getData("Text"),a=this._getCursorPosition();let g="";s.preventDefault();for(let m=0,P=0;m<C;m+=1)m>=a[0]&&d[P]&&l(this,k,"f").indexOf(_[m])<0?(l(this,k,"f").indexOf(d[P])<0?g=g+d[P]:m-=1,P+=1):g=g+_[m];this._isValidPattern(g)&&(s.target.value=g,this._setCursorPosition(p.value.indexOf(M)))}},y(this,x,t),y(this,I,e),y(this,v,i),y(this,L,h),y(this,A,j),h&&(y(this,D,new RegExp(l(this,L,"f"),"g")),y(this,R,!0)),l(this,x,"f").addController(this)}hostConnected(){const t=new RegExp(M,"g");y(this,k,this._uniqueArr(l(this,v,"f").replace(t,"").split("")))}hostDisconnected(){}_setCursorPosition(t=0,e=t){const i=this._getInput();if(typeof t!="number"){i.selectionStart=t[0],i.selectionEnd=e[1];return}i.selectionStart=t,typeof e=="number"&&(i.selectionEnd=e)}_getCursorPosition(){var t,e;const i=this._getInput();return[(t=i.selectionStart)!==null&&t!==void 0?t:0,(e=i.selectionEnd)!==null&&e!==void 0?e:0
1]}_uniqueArr(t){const e=[],i=t.length;for(let h=0;h<i;h++)e.indexOf(t[h])===-1&&t[h]!==""&&e.push(t[h]);return e}_getInput(){if(!l(this,I,"f").value)throw new Error("Input element is not defined");return l(this,I,"f").value}_areKeysCombined(t){return t.altKey||t.ctrlKey||t.metaKey}_insertCharAt(t,e,i){return t.slice(0,i)+e+t.slice(i)}_replaceCharAt(t,e,i){return t.substr(0,i)+e+t.substr(i+1)}_skipCharactersBy(t,e,i,h){return h=h||!1,l(this,k,"f").indexOf(t[e])>=0?(h?e-=1:e+=1,i+=1,this._skipCharactersBy.call(this,t,e,i,h)):i}_isValidPattern(t){if(l(this,R,"f")){const e=t.length;let i="";for(let h=0;h<e;h+=1)i+=t[h]!=="_"?t[h]:l(this,A,"f")[h];return i.match(l(this,D,"f"))!==null}return!0}}x=new WeakMap,I=new WeakMap,v=new WeakMap,L=new WeakMap,A=new WeakMap,k=new WeakMap,$=new WeakMap,D=new WeakMap,R=new WeakMap,b=new WeakMap,V=new WeakMap,T=new WeakMap;let c=class extends H{constructor(){super(),this.type=W.text,this._inputRef=G(),this._inputMaskController=null,this._handleChangeEvent=t=>{this.emitCustomEvent(w.change,{detail:t})},this._handleMouseDownEvent=t=>{},this._handleMouseUpEvent=t=>{var e,i;!((e=this._inputMaskController)===null||e===void 0)&&e.isEnabled&&((i=this._inputMaskController)===null||i===void 0||i.setCursorOnStartWhenEmpty(t))},this._handleBlurEvent=t=>{var e,i;!((e=this._inputMaskController)===null||e===void 0)&&e.isEnabled&&((i=this._inputMaskController)===null||i===void 0||i.setEmptyValueForNoValue(t))},this._handleFocusEvent=t=>{},this._handleKeyDownEvent=t=>{var e,i;!((e=this._inputMaskController)===null||e===void 0)&&e.isEnabled&&((i=this._inputMaskController)===null||i===void 0||i.onKeyDown(t))},this._handleInputEvent=t=>{var e,i;!((e=this._inputMaskController)===null||e===void 0)&&e.isEnabled&&((i=this._inputMaskController)===null||i===void 0||i.onInput(t)),this.emitCustomEvent(w.input,{detail:t})},this._handlePasteEvent=t=>{var e,i;!((e=this._inputMaskController)===null||e===void 0)&&e.isEnabled&&((i=this._inputMaskController)===null||i===void 0||i.onPaste(t))},this._handleKeyUpEvent=t=>{var e,i;!((e=this._inputMaskController)===null||e===void 0)&&e.isEnabled&&((i=this._inputMaskController)===null||i===void 0||i.onKeyUp(t)),this.emitCustomEvent(w.keyup,{detail:t})},new tt({host:this})}connectedCallback(){super.connectedCallback(),this.mask&&(this._inputMaskController=new st({host:this,input:this._inputRef,mask:this.mask,pattern:this.pattern,validPattern:this.validPattern})),this.classList.add(E.inputControl)}updated(t){if(super.updated(t),t.has("value")&&this._inputRef.value){const e=new Event("input",{bubbles:!0,composed:!0});this._inputRef.value.dispatchEvent(e)}this.mask&&!this.maskDisabled?this.enableMask():this.disableMask()}enableMask(){this._inputMaskController&&this._inputMaskController.enable()}disableMask(){this._inputMaskController&&this._inputMaskController.disable()}render(){return super.render(),q` 2 <input 3 ${Y(this._inputRef)} 4 id="${B(this.controlId)}" 5 name="${B(this.controlName)}" 6 type="${B(this.type)}" 7 .value="${B(this.value)}" 8 placeholder="${B(this.placeholder)}" 9 ?disabled="${this.disabled}" 10 ?readonly="${this.readonly}" 11 ?hidden="${this.hidden}" 12 ?autofocus="${this.autofocus}" 13 aria-required="${this.required?"true":"false"}" 14 aria-describedby="${this.ariaDescribedBy}" 15 aria-invalid="${this.error?"true":"false"}" 16 @mousedown="${this._handleMouseDownEvent}" 17 @mouseup="${this._handleMouseUpEvent}" 18 @blur="${this._handleBlurEvent}" 19 @focus="${this._handleFocusEvent}" 20 @keydown="${this._handleKeyDownEvent}" 21 @paste="${this._handlePasteEvent}" 22 @change="${this._handleChangeEvent}" 23 @input="${this._handleInputEvent}" 24 @keyup="${this._handleKeyUpEvent}" 25 /> 26 `}};n([r({type:String}),o("design:type",String)],c.prototype,"controlId",void 0);n([r({type:String}),o("design:type",String)],c.prototype,"controlName",void 0);n([r({type:String}),o("design:type",String)],c.prototype,"type",void 0);n([r({type:Boolean}),o("design:type",Boolean)],c.prototype,"disabled",void 0);n([r({type:Boolean}),o("design:type",Boolean)],c.prototype,"required",void 0);n([r({type:Boolean}),o("design:type",Boolean)],c.prototype,"hidden",void 0);n([r({type:Boolean}),o("design:type",Boolean)],c.prototype,"readonly",void 0);n([r({type:String}),o("design:type",String)],c.prototype,"value",void 0);n([r({type:String}),o("design:type",String)],c.prototype,"placeholder",void 0);n([r({type:String}),o("design:type",String)],c.prototype,"mask",void 0);n([r({type:Boolean,attribute:"mask-disabled"}),o("design:type",Boolean)],c.prototype,"maskDisabled",void 0);n([r({type:String}),o("design:type",String)],c.prototype,"pattern",void 0);n([r({type:String,attribute:"valid-pattern"}),o("design:type",String)],c.prototype,"validPattern",void 0);n([r({type:Boolean}),o("design:type",Boolean)],c.prototype,"autofocus",void 0);n([r({type:String,attribute:"aria-describedby"}),o("design:type",String)],c.prototype,"ariaDescribedBy",void 0);n([r({type:Boolean}),o("design:type",Boolean)],c.prototype,"error",void 0);c=n([K("h-input-control"),o("design:paramtypes",[])],c);let N=class extends H{connectedCallback(){super.connectedCallback(),this.classList.add(E.inputUnit)}};N=n([K("h-input-unit")],N);let S=class extends H{constructor(){super(),this.hasBeenCopied=!1,this.copyValue="",this._$inputToCopy=null,this._handleCopyToClipboard=async()=>{!this._$inputToCopy||this.hasBeenCopied||(this._$inputToCopy.select(),this.copyValue=this._$inputToCopy.value,await this._copyToClipboard())},this._resetCopyStateAfterTimeout=()=>{setTimeout(()=>{this._resetCopyState()},2e3)},this._resetCopyState=()=>{this._$inputToCopy&&(this._$inputToCopy.value=this.copyValue),this.copyValue="",this.hasBeenCopied=!1},this._btnController=new et(this,this._handleCopyToClipboard)}connectedCallback(){super.connectedCallback(),this._$inputToCopy=document.querySelector(`#${this.inputId}`),this._$inputToCopy&&this.addEventListener("click",this._handleCopyToClipboard)}async _copyToClipboard(){try{await navigator.clipboard.writeText(this.copyValue),this._onCopySuccess()}catch(t){this._onCopyError(t)}}_onCopySuccess(){this.inputTextSuccess&&this._$inputToCopy&&(this._$inputToCopy.value=this.inputTextSuccess),this.hasBeenCopied=!0,this._resetCopyStateAfterTimeout(),this.emitCustomEvent(w.copy)}_onCopyError(t){this.hasBeenCopied=!1,this._resetCopyState(),this.emitCustomEvent(w.copyError,{detail:t})}render(){return super.render(),q` 27 <navigator-controller property="clipboard"> 28 <div slot="supported">
29 ${this.hasBeenCopied?this.getSlot("copy-success"):this.getSlot("copy-pending")} 30 </div> 31 </navigator-controller> 32 `}};n([r({type:String,attribute:"input-id"}),o("design:type",String)],S.prototype,"inputId",void 0);n([r({type:String,attribute:"input-text-success"}),o("design:type",String)],S.prototype,"inputTextSuccess",void 0);n([F(),o("design:type",Object)],S.prototype,"hasBeenCopied",void 0);n([F(),o("design:type",Object)],S.prototype,"copyValue",void 0);S=n([K("h-input-copy-button"),o("design:paramtypes",[])],S);requestAnimationFrame(()=>{});globalThis.__phoenix_wc__=[f,c,S,it,N];
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.