@company-ui/vue
Version:
3 lines (2 loc) • 43.2 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CompanyUI={},t.vue)}(this,(function(t,e){"use strict";const n={},o=Object.freeze(Object.defineProperty({__proto__:null,default:n},Symbol.toStringTag,{value:"Module"}));var i={},r=function(){return r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function s(t,e,n,o){return new(n||(n=Promise))((function(e,i){function r(t){try{a(o.next(t))}catch(t){i(t)}}function s(t){try{a(o.throw(t))}catch(t){i(t)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(t){t(o)}))).then(r,s)}a((o=o.apply(t,[])).next())}))}function a(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],o=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}"function"==typeof SuppressedError&&SuppressedError;var l=["https://image.qcc.com/logo/{id}.jpg","https://image.qcc.com/auto/{id}.jpg"],c=function(t,e){return s(void 0,0,void 0,(function(){var n,o,i,r,s,l,c;return a(this,(function(a){switch(a.label){case 0:n=0,o=e,a.label=1;case 1:if(!(n<o.length))return[3,8];i=o[n],a.label=2;case 2:return a.trys.push([2,6,,7]),u="{id}",h=t,r=i.replace(new RegExp(u,"g"),h),[4,fetch(r)];case 3:return 200!==(s=a.sent()).status?[3,5]:[4,s.blob()];case 4:return l=a.sent(),[2,URL.createObjectURL(l)];case 5:return[3,7];case 6:return c=a.sent(),console.error(c),[3,7];case 7:return n++,[3,1];case 8:return[2,""]}var u,h}))}))},u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var d={exports:{}};var f,p,g={exports:{}};function m(){return f||(f=1,g.exports=(t=t||function(t,e){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==u&&u.crypto&&(i=u.crypto),!i)try{i=n||o}catch(t){}var r=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),a={},l=a.lib={},c=l.Base=function(){return{extend:function(t){var e=s(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=l.WordArray=c.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||f).stringify(this)},concat:function(t){var e=this.words,n=t.words,o=this.sigBytes,i=t.sigBytes;if(this.clamp(),o%4)for(var r=0;r<i;r++){var s=n[r>>>2]>>>24-r%4*8&255;e[o+r>>>2]|=s<<24-(o+r)%4*8}else for(var a=0;a<i;a+=4)e[o+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(r());return new h.init(e,t)}}),d=a.enc={},f=d.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,o=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;o.push((r>>>4).toString(16)),o.push((15&r).toString(16))}return o.join("")},parse:function(t){for(var e=t.length,n=[],o=0;o<e;o+=2)n[o>>>3]|=parseInt(t.substr(o,2),16)<<24-o%8*4;return new h.init(n,e/2)}},p=d.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,o=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;o.push(String.fromCharCode(r))}return o.join("")},parse:function(t){for(var e=t.length,n=[],o=0;o<e;o++)n[o>>>2]|=(255&t.charCodeAt(o))<<24-o%4*8;return new h.init(n,e)}},g=d.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},m=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=g.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,o=this._data,i=o.words,r=o.sigBytes,s=this.blockSize,a=r/(4*s),l=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,c=t.min(4*l,r);if(l){for(var u=0;u<l;u+=s)this._doProcessBlock(i,u);n=i.splice(0,l),o.sigBytes-=c}return new h.init(n,c)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});l.Hasher=m.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new y.HMAC.init(t,n).finalize(e)}}});var y=a.algo={};return a}(Math),t)),g.exports;var t}d.exports=(p=m(),function(t){var e=p,n=e.lib,o=n.WordArray,i=n.Hasher,r=e.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var a=r.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var o=e+n,i=t[o];t[o]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r=this._hash.words,a=t[e+0],d=t[e+1],f=t[e+2],p=t[e+3],g=t[e+4],m=t[e+5],y=t[e+6],v=t[e+7],b=t[e+8],w=t[e+9],x=t[e+10],S=t[e+11],k=t[e+12],C=t[e+13],B=t[e+14],I=t[e+15],T=r[0],E=r[1],_=r[2],O=r[3];T=l(T,E,_,O,a,7,s[0]),O=l(O,T,E,_,d,12,s[1]),_=l(_,O,T,E,f,17,s[2]),E=l(E,_,O,T,p,22,s[3]),T=l(T,E,_,O,g,7,s[4]),O=l(O,T,E,_,m,12,s[5]),_=l(_,O,T,E,y,17,s[6]),E=l(E,_,O,T,v,22,s[7]),T=l(T,E,_,O,b,7,s[8]),O=l(O,T,E,_,w,12,s[9]),_=l(_,O,T,E,x,17,s[10]),E=l(E,_,O,T,S,22,s[11]),T=l(T,E,_,O,k,7,s[12]),O=l(O,T,E,_,C,12,s[13]),_=l(_,O,T,E,B,17,s[14]),T=c(T,E=l(E,_,O,T,I,22,s[15]),_,O,d,5,s[16]),O=c(O,T,E,_,y,9,s[17]),_=c(_,O,T,E,S,14,s[18]),E=c(E,_,O,T,a,20,s[19]),T=c(T,E,_,O,m,5,s[20]),O=c(O,T,E,_,x,9,s[21]),_=c(_,O,T,E,I,14,s[22]),E=c(E,_,O,T,g,20,s[23]),T=c(T,E,_,O,w,5,s[24]),O=c(O,T,E,_,B,9,s[25]),_=c(_,O,T,E,p,14,s[26]),E=c(E,_,O,T,b,20,s[27]),T=c(T,E,_,O,C,5,s[28]),O=c(O,T,E,_,f,9,s[29]),_=c(_,O,T,E,v,14,s[30]),T=u(T,E=c(E,_,O,T,k,20,s[31]),_,O,m,4,s[32]),O=u(O,T,E,_,b,11,s[33]),_=u(_,O,T,E,S,16,s[34]),E=u(E,_,O,T,B,23,s[35]),T=u(T,E,_,O,d,4,s[36]),O=u(O,T,E,_,g,11,s[37]),_=u(_,O,T,E,v,16,s[38]),E=u(E,_,O,T,x,23,s[39]),T=u(T,E,_,O,C,4,s[40]),O=u(O,T,E,_,a,11,s[41]),_=u(_,O,T,E,p,16,s[42]),E=u(E,_,O,T,y,23,s[43]),T=u(T,E,_,O,w,4,s[44]),O=u(O,T,E,_,k,11,s[45]),_=u(_,O,T,E,I,16,s[46]),T=h(T,E=u(E,_,O,T,f,23,s[47]),_,O,a,6,s[48]),O=h(O,T,E,_,v,10,s[49]),_=h(_,O,T,E,B,15,s[50]),E=h(E,_,O,T,m,21,s[51]),T=h(T,E,_,O,k,6,s[52]),O=h(O,T,E,_,p,10,s[53]),_=h(_,O,T,E,x,15,s[54]),E=h(E,_,O,T,d,21,s[55]),T=h(T,E,_,O,b,6,s[56]),O=h(O,T,E,_,I,10,s[57]),_=h(_,O,T,E,y,15,s[58]),E=h(E,_,O,T,C,21,s[59]),T=h(T,E,_,O,g,6,s[60]),O=h(O,T,E,_,S,10,s[61]),_=h(_,O,T,E,f,15,s[62]),E=h(E,_,O,T,w,21,s[63]),r[0]=r[0]+T|0,r[1]=r[1]+E|0,r[2]=r[2]+_|0,r[3]=r[3]+O|0},_doFinalize:function(){var e=this._data,n=e.words,o=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var r=t.floor(o/4294967296),s=o;n[15+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,l=a.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function l(t,e,n,o,i,r,s){var a=t+(e&n|~e&o)+i+s;return(a<<r|a>>>32-r)+e}function c(t,e,n,o,i,r,s){var a=t+(e&o|n&~o)+i+s;return(a<<r|a>>>32-r)+e}function u(t,e,n,o,i,r,s){var a=t+(e^n^o)+i+s;return(a<<r|a>>>32-r)+e}function h(t,e,n,o,i,r,s){var a=t+(n^(e|~o))+i+s;return(a<<r|a>>>32-r)+e}e.MD5=i._createHelper(a),e.HmacMD5=i._createHmacHelper(a)}(Math),p.MD5);var y=h(d.exports),v=["9y16cxzg","sr2z1z63","hk2ssit3","acsevi4u","nu38i9ej","6m70kgre","hl8rvmhu","30uzkxp0","v9jggair","4ryav515","pgx6isvq","6b3zumy7","bxureygp","jff4xbhb","7j56lyfw","2tctuvza","8jfrswdr","r2as467y","jzye6ls1","bpi7fhat","ywp0p3qn","rzybga6p","84u199q5","kktjaqis","amn5oud8","a0zs4b52","x16y3u37","xku2lp9m","n8eawc7q","gw68xkfw","4wxtunev","ew2x6rzg","go9f3t54","7d0fkx5i","ai6ol58k","47jsslmm","70mxfzcz","b90wzl0c","ua78bvmr","7p60hdt4","ge5lw4u8","ref3rey2","wgay7vhx","b8l2u4mj","rk80y5ot","o37o4wq3","0moweoh0","r10m9bpy","wjilkjhj","il27pnod"],b=function(t,e){for(var n=[],o=0;o<t.length;o+=e)n.push(t.slice(o,o+e));return n}(v,5),w=function(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";return Array.from({length:t},(function(){return e.charAt(Math.floor(62*Math.random()))})).join("")},x=function(t){var e=31+(null===t?0:S(t))|0;return Math.abs(e)},S=function(t){for(var e=1,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return e},k=function(t){var e,n,o,i,r,s,a={f:w(5),g:w(3),r:"/company/getCompanyName",searchKey:t,t:Math.floor(Date.now()/1e3),v:"v2.0"},l=(e=a,void 0===n&&(n=""),n+Object.keys(e).map((function(t){return"".concat(t,"=").concat(e[t])})).join("&")),c=(o=a.r.toUpperCase()+l,i=x(o)%v.length,r=Math.floor(i/5),b[r][i%5]),u=(s="GET".concat(l).concat(c),y(s).toString());return"https://c.qcc.com/embed/api".concat(a.r,"?").concat(l,"&m=").concat(u)},C=function(t,e){return s(void 0,0,void 0,(function(){var n,o,i;return a(this,(function(s){switch(s.label){case 0:if(t.length<2||t.length>100)throw new Error(" keyword length must be between 2 and 100");return n=k(t),[4,fetch(n,r({method:"GET",mode:"cors",headers:{Referer:"https://c.qcc.com/"}},(a=e,void 0!==a?{signal:null==e?void 0:e.signal}:null)))];case 1:return[4,s.sent().json()];case 2:return o=s.sent(),i=[],"200"!==o.status?[2,i]:[2,o.result.map((function(t){var e=t.keyNo||t.companyName.replace(/(<([^>]+)>)/gi,"");return{name:t.companyName,id:e}}))]}var a}))}))},B=function(t,e){return s(void 0,0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:if(t.length<2||t.length>=100)throw new Error("keyword length must be between 2 and 100");return n="https://autocomplete.clearbit.com/v1/companies/suggest?query=".concat(t),[4,fetch(n,{method:"GET",mode:"cors",signal:null==e?void 0:e.signal})];case 1:return[4,o.sent().json()];case 2:return[2,o.sent().map((function(t){return{name:t.name,id:t.domain,avatar:t.logo}}))]}}))}))},I=function(t){return t.enabled&&t.key?function(t){try{var e=JSON.parse(t);return Array.isArray(e)?e:[]}catch(t){return[]}}(("localStorage"===t.type?localStorage:sessionStorage).getItem(t.key)||""):[]},T=Object.freeze({__proto__:null,addHistory:function(t,e){if(e.enabled&&e.key){var n="localStorage"===e.type?localStorage:sessionStorage,o=I(e),i=o.findIndex((function(e){return e.id===t.id}));i>-1&&o.splice(i,1),o.splice(0,0,t),n.setItem(e.key,JSON.stringify(o.length>5?o.slice(0,5):o))}},getHistory:I,getImageData:c,handleAvatar:function(t,e){return s(void 0,0,void 0,(function(){var n,o,i;return a(this,(function(r){switch(r.label){case 0:return n=t.dataset.id||"",e.avatarUrl?(o=t,[4,c(n,[e.avatarUrl])]):[3,2];case 1:return o.src=r.sent(),[2];case 2:return"qcc_open"===e.api?[3,3]:[3,5];case 3:return i=t,[4,c(n,l)];case 4:return i.src=r.sent(),[3,5];case 5:return[2]}}))}))},handleQueryData:function(t,e,n){return s(void 0,0,void 0,(function(){var o;return a(this,(function(i){switch(i.label){case 0:switch(e){case"qcc_open":return[3,1];case"clearbit":return[3,3]}return[3,5];case 1:return[4,C(t,n)];case 2:case 4:return o=i.sent(),[3,6];case 3:return[4,B(t,n)];case 5:return o=[],[3,6];case 6:return[2,{data:o}]}}))}))},initialOptions:{target:"body",api:"clearbit",queryDelay:500,placeholder:"Input company name",clearable:!0,backFill:!1,popupAppendToBody:!0,clearIcon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10s10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17L12 13.41L8.41 17L7 15.59L10.59 12L7 8.41L8.41 7L12 10.59L15.59 7L17 8.41L13.41 12L17 15.59z"/></svg>',autoFocus:!0,history:{enabled:!0,type:"localStorage",key:"company-history",showClear:!0,itemIcon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="m15.1 19.37l1 1.74c-.96.44-2.01.73-3.1.84v-2.02c.74-.09 1.44-.28 2.1-.56zM4.07 13H2.05c.11 1.1.4 2.14.84 3.1l1.74-1c-.28-.66-.47-1.36-.56-2.1zM15.1 4.63l1-1.74c-.96-.44-2-.73-3.1-.84v2.02c.74.09 1.44.28 2.1.56zM19.93 11h2.02c-.11-1.1-.4-2.14-.84-3.1l-1.74 1c.28.66.47 1.36.56 2.1zM8.9 19.37l-1 1.74c.96.44 2.01.73 3.1.84v-2.02c-.74-.09-1.44-.28-2.1-.56zM11 4.07V2.05c-1.1.11-2.14.4-3.1.84l1 1.74c.66-.28 1.36-.47 2.1-.56zm7.36 3.1l1.74-1.01c-.63-.87-1.4-1.64-2.27-2.27l-1.01 1.74c.59.45 1.1.96 1.54 1.54zM4.63 8.9l-1.74-1c-.44.96-.73 2-.84 3.1h2.02c.09-.74.28-1.44.56-2.1zm15.3 4.1c-.09.74-.28 1.44-.56 2.1l1.74 1c.44-.96.73-2.01.84-3.1h-2.02zm-3.1 5.36l1.01 1.74c.87-.63 1.64-1.4 2.27-2.27l-1.74-1.01c-.45.59-.96 1.1-1.54 1.54zM7.17 5.64l-1-1.75c-.88.64-1.64 1.4-2.27 2.28l1.74 1.01a7.7 7.7 0 0 1 1.53-1.54zM5.64 16.83l-1.74 1c.63.87 1.4 1.64 2.27 2.27l1.01-1.74a7.7 7.7 0 0 1-1.54-1.53zM13 7h-2v5.41l4.29 4.29l1.41-1.41l-3.7-3.7V7z"/></svg>',clearIcon:'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M15 2h-3.5l-1-1h-5l-1 1H1v2h14zm1 7c-.7 0-1.37.1-2 .29V5H2v12c0 1.1.9 2 2 2h5.68A6.999 6.999 0 0 0 23 16c0-3.87-3.13-7-7-7zm-7 7c0 .34.03.67.08 1H4V7h8v3.26c-1.81 1.27-3 3.36-3 5.74zm7 5c-2.76 0-5-2.24-5-5s2.24-5 5-5s5 2.24 5 5s-2.24 5-5 5z"/><path fill="currentColor" d="M16.5 12H15v5l3.6 2.1l.8-1.2l-2.9-1.7z"/></svg>'},onInput:function(){},onChange:function(){},onFetch:function(){},onAbortFetch:function(){},onSelect:function(){},onClear:function(){},onFocus:function(){},onBlur:function(){},onSubmit:function(){},onDropdownVisibleChange:function(){},showSubmitButton:!0,submitButtonLabel:"Submit",offsetTop:5,autoFlip:!1},removeHistory:function(t){("localStorage"===t.type?localStorage:sessionStorage).removeItem(t.key)}});(null==i?{}:i).default;var E=function(t){return void 0===t};function _(t,e,n){void 0===e&&(e=0);var o={},i=o.start,r=o.middle,s=o.once;return function(t,e,n){void 0===e&&(e=0);var o,i=void 0===n?{}:n,r=i.start,s=void 0===r||r,a=i.middle,l=void 0===a||a,c=i.once,u=void 0!==c&&c,h=s,d=0,f=!1;function p(){for(var n=this,i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];if(!f){var a=Date.now()-d;d=Date.now(),s&&l&&a>=e&&(h=!0),h?(h=!1,t.apply(this,i),u&&p.cancel()):(l&&a<e||!l)&&(clearTimeout(o),o=setTimeout((function(){d=Date.now(),t.apply(n,i),u&&p.cancel()}),l?e-a:e))}}return p.cancel=function(){clearTimeout(o),f=!0},p}(t,e,{start:void 0!==i&&i,middle:void 0!==r&&r,once:void 0!==s&&s})}var O=function(t){return t.replace(/(<([^>]+)>)/gi,"")};const V=Math.min,L=Math.max,A=Math.round,M=Math.floor,z=t=>({x:t,y:t}),F={left:"right",right:"left",bottom:"top",top:"bottom"},R={start:"end",end:"start"};function D(t,e){return"function"==typeof t?t(e):t}function H(t){return t.split("-")[0]}function N(t){return t.split("-")[1]}function j(t){return"y"===t?"height":"width"}function P(t){return["top","bottom"].includes(H(t))?"y":"x"}function $(t){return"x"===P(t)?"y":"x"}function q(t){return t.replace(/start|end/g,(t=>R[t]))}function U(t){return t.replace(/left|right|bottom|top/g,(t=>F[t]))}function W(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function K(t,e,n){let{reference:o,floating:i}=t;const r=P(e),s=$(e),a=j(s),l=H(e),c="y"===r,u=o.x+o.width/2-i.width/2,h=o.y+o.height/2-i.height/2,d=o[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:o.y-i.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:h};break;case"left":f={x:o.x-i.width,y:h};break;default:f={x:o.x,y:o.y}}switch(N(e)){case"start":f[s]-=d*(n&&c?-1:1);break;case"end":f[s]+=d*(n&&c?-1:1)}return f}async function Q(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:r,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=D(e,t),p=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(f),g=a[d?"floating"===h?"reference":"floating":h],m=W(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(g)))||n?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y="floating"===h?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(null==r.getOffsetParent?void 0:r.getOffsetParent(a.floating)),b=await(null==r.isElement?void 0:r.isElement(v))&&await(null==r.getScale?void 0:r.getScale(v))||{x:1,y:1},w=W(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:v,strategy:l}):y);return{top:(m.top-w.top+p.top)/b.y,bottom:(w.bottom-m.bottom+p.bottom)/b.y,left:(m.left-w.left+p.left)/b.x,right:(w.right-m.right+p.right)/b.x}}function G(t){return Y(t)?(t.nodeName||"").toLowerCase():"#document"}function J(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function X(t){var e;return null==(e=(Y(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function Y(t){return t instanceof Node||t instanceof J(t).Node}function Z(t){return t instanceof Element||t instanceof J(t).Element}function tt(t){return t instanceof HTMLElement||t instanceof J(t).HTMLElement}function et(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ShadowRoot||t instanceof J(t).ShadowRoot)}function nt(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=at(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(i)}function ot(t){return["table","td","th"].includes(G(t))}function it(t){const e=rt(),n=at(t);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((t=>(n.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(n.contain||"").includes(t)))}function rt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function st(t){return["html","body","#document"].includes(G(t))}function at(t){return J(t).getComputedStyle(t)}function lt(t){return Z(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function ct(t){if("html"===G(t))return t;const e=t.assignedSlot||t.parentNode||et(t)&&t.host||X(t);return et(e)?e.host:e}function ut(t){const e=ct(t);return st(e)?t.ownerDocument?t.ownerDocument.body:t.body:tt(e)&&nt(e)?e:ut(e)}function ht(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=ut(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),s=J(i);return r?e.concat(s,s.visualViewport||[],nt(i)?i:[],s.frameElement&&n?ht(s.frameElement):[]):e.concat(i,ht(i,[],n))}function dt(t){const e=at(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=tt(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,a=A(n)!==r||A(o)!==s;return a&&(n=r,o=s),{width:n,height:o,$:a}}function ft(t){return Z(t)?t:t.contextElement}function pt(t){const e=ft(t);if(!tt(e))return z(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=dt(e);let s=(r?A(n.width):n.width)/o,a=(r?A(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const gt=z(0);function mt(t){const e=J(t);return rt()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:gt}function yt(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),r=ft(t);let s=z(1);e&&(o?Z(o)&&(s=pt(o)):s=pt(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==J(t))&&e}(r,n,o)?mt(r):z(0);let l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,h=i.height/s.y;if(r){const t=J(r),e=o&&Z(o)?J(o):o;let n=t,i=n.frameElement;for(;i&&o&&e!==n;){const t=pt(i),e=i.getBoundingClientRect(),o=at(i),r=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,s=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;l*=t.x,c*=t.y,u*=t.x,h*=t.y,l+=r,c+=s,n=J(i),i=n.frameElement}}return W({width:u,height:h,x:l,y:c})}const vt=[":popover-open",":modal"];function bt(t){return vt.some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function wt(t){return yt(X(t)).left+lt(t).scrollLeft}function xt(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=J(t),o=X(t),i=n.visualViewport;let r=o.clientWidth,s=o.clientHeight,a=0,l=0;if(i){r=i.width,s=i.height;const t=rt();(!t||t&&"fixed"===e)&&(a=i.offsetLeft,l=i.offsetTop)}return{width:r,height:s,x:a,y:l}}(t,n);else if("document"===e)o=function(t){const e=X(t),n=lt(t),o=t.ownerDocument.body,i=L(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=L(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+wt(t);const a=-n.scrollTop;return"rtl"===at(o).direction&&(s+=L(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:a}}(X(t));else if(Z(e))o=function(t,e){const n=yt(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=tt(t)?pt(t):z(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:i*r.x,y:o*r.y}}(e,n);else{const n=mt(t);o={...e,x:e.x-n.x,y:e.y-n.y}}return W(o)}function St(t,e){const n=ct(t);return!(n===e||!Z(n)||st(n))&&("fixed"===at(n).position||St(n,e))}function kt(t,e,n){const o=tt(e),i=X(e),r="fixed"===n,s=yt(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=z(0);if(o||!o&&!r)if(("body"!==G(e)||nt(i))&&(a=lt(e)),o){const t=yt(e,!0,r,e);l.x=t.x+e.clientLeft,l.y=t.y+e.clientTop}else i&&(l.x=wt(i));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function Ct(t){return"static"===at(t).position}function Bt(t,e){return tt(t)&&"fixed"!==at(t).position?e?e(t):t.offsetParent:null}function It(t,e){const n=J(t);if(bt(t))return n;if(!tt(t)){let e=ct(t);for(;e&&!st(e);){if(Z(e)&&!Ct(e))return e;e=ct(e)}return n}let o=Bt(t,e);for(;o&&ot(o)&&Ct(o);)o=Bt(o,e);return o&&st(o)&&Ct(o)&&!it(o)?n:o||function(t){let e=ct(t);for(;tt(e)&&!st(e);){if(it(e))return e;e=ct(e)}return null}(t)||n}const Tt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r="fixed"===i,s=X(o),a=!!e&&bt(e.floating);if(o===s||a&&r)return n;let l={scrollLeft:0,scrollTop:0},c=z(1);const u=z(0),h=tt(o);if((h||!h&&!r)&&(("body"!==G(o)||nt(s))&&(l=lt(o)),tt(o))){const t=yt(o);c=pt(o),u.x=t.x+o.clientLeft,u.y=t.y+o.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:X,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?bt(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=ht(t,[],!1).filter((t=>Z(t)&&"body"!==G(t))),i=null;const r="fixed"===at(t).position;let s=r?ct(t):t;for(;Z(s)&&!st(s);){const e=at(s),n=it(s);n||"fixed"!==e.position||(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&["absolute","fixed"].includes(i.position)||nt(s)&&!n&&St(t,s))?o=o.filter((t=>t!==s)):i=e,s=ct(s)}return e.set(t,o),o}(e,this._c):[].concat(n),o],s=r[0],a=r.reduce(((t,n)=>{const o=xt(e,n,i);return t.top=L(o.top,t.top),t.right=V(o.right,t.right),t.bottom=V(o.bottom,t.bottom),t.left=L(o.left,t.left),t}),xt(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:It,getElementRects:async function(t){const e=this.getOffsetParent||It,n=this.getDimensions,o=await n(t.floating);return{reference:kt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=dt(t);return{width:e,height:n}},getScale:pt,isElement:Z,isRTL:function(t){return"rtl"===at(t).direction}};function Et(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:l=!1}=o,c=ft(t),u=i||r?[...c?ht(c):[],...ht(e)]:[];u.forEach((t=>{i&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));const h=c&&a?function(t,e){let n,o=null;const i=X(t);function r(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function s(a,l){void 0===a&&(a=!1),void 0===l&&(l=1),r();const{left:c,top:u,width:h,height:d}=t.getBoundingClientRect();if(a||e(),!h||!d)return;const f={rootMargin:-M(u)+"px "+-M(i.clientWidth-(c+h))+"px "+-M(i.clientHeight-(u+d))+"px "+-M(c)+"px",threshold:L(0,V(1,l))||1};let p=!0;function g(t){const e=t[0].intersectionRatio;if(e!==l){if(!p)return s();e?s(!1,e):n=setTimeout((()=>{s(!1,1e-7)}),1e3)}p=!1}try{o=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch(t){o=new IntersectionObserver(g,f)}o.observe(t)}(!0),r}(c,n):null;let d,f=-1,p=null;s&&(p=new ResizeObserver((t=>{let[o]=t;o&&o.target===c&&p&&(p.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var t;null==(t=p)||t.observe(e)}))),n()})),c&&!l&&p.observe(c),p.observe(e));let g=l?yt(t):null;return l&&function e(){const o=yt(t);!g||o.x===g.x&&o.y===g.y&&o.width===g.width&&o.height===g.height||n();g=o,d=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{i&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==h||h(),null==(t=p)||t.disconnect(),p=null,l&&cancelAnimationFrame(d)}}const _t=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:s,middlewareData:a}=e,l=await async function(t,e){const{placement:n,platform:o,elements:i}=t,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),s=H(n),a=N(n),l="y"===P(n),c=["left","top"].includes(s)?-1:1,u=r&&l?-1:1,h=D(e,t);let{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&"number"==typeof p&&(f="end"===a?-1*p:p),l?{x:f*u,y:d*c}:{x:d*c,y:f*u}}(e,t);return s===(null==(n=a.offset)?void 0:n.placement)&&null!=(o=a.arrow)&&o.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}},Ot=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=D(t,e);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const y=H(i),v=H(a)===a,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=d||(v||!g?[U(a)]:function(t){const e=U(t);return[q(t),e,q(e)]}(a));d||"none"===p||w.push(...function(t,e,n,o){const i=N(t);let r=function(t,e,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:o:e?o:i;case"left":case"right":return e?r:s;default:return[]}}(H(t),"start"===n,o);return i&&(r=r.map((t=>t+"-"+i)),e&&(r=r.concat(r.map(q)))),r}(a,g,p,b));const x=[a,...w],S=await Q(e,m),k=[];let C=(null==(o=r.flip)?void 0:o.overflows)||[];if(u&&k.push(S[y]),h){const t=function(t,e,n){void 0===n&&(n=!1);const o=N(t),i=$(t),r=j(i);let s="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=U(s)),[s,U(s)]}(i,s,b);k.push(S[t[0]],S[t[1]])}if(C=[...C,{placement:i,overflows:k}],!k.every((t=>t<=0))){var B,I;const t=((null==(B=r.flip)?void 0:B.index)||0)+1,e=x[t];if(e)return{data:{index:t,overflows:C},reset:{placement:e}};let n=null==(I=C.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:I.placement;if(!n)switch(f){case"bestFit":{var T;const t=null==(T=C.map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:T[0];t&&(n=t);break}case"initialPlacement":n=a}if(i!==n)return{reset:{placement:n}}}return{}}}},Vt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:o,platform:i,elements:r}=e,{apply:s=(()=>{}),...a}=D(t,e),l=await Q(e,a),c=H(n),u=N(n),h="y"===P(n),{width:d,height:f}=o.floating;let p,g;"top"===c||"bottom"===c?(p=c,g=u===(await(null==i.isRTL?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(g=c,p="end"===u?"top":"bottom");const m=f-l[p],y=d-l[g],v=!e.middlewareData.shift;let b=m,w=y;if(h){const t=d-l.left-l.right;w=u||v?V(y,t):t}else{const t=f-l.top-l.bottom;b=u||v?V(m,t):t}if(v&&!u){const t=L(l.left,0),e=L(l.right,0),n=L(l.top,0),o=L(l.bottom,0);h?w=d-2*(0!==t||0!==e?t+e:L(l.left,l.right)):b=f-2*(0!==n||0!==o?n+o:L(l.top,l.bottom))}await s({...e,availableWidth:w,availableHeight:b});const x=await i.getDimensions(r.floating);return d!==x.width||f!==x.height?{reset:{rects:!0}}:{}}}},Lt=(t,e,n)=>{const o=new Map,i={platform:Tt,...n},r={...i.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,a=r.filter(Boolean),l=await(null==s.isRTL?void 0:s.isRTL(e));let c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:h}=K(c,o,l),d=o,f={},p=0;for(let n=0;n<a.length;n++){const{name:r,fn:g}=a[n],{x:m,y:y,data:v,reset:b}=await g({x:u,y:h,initialPlacement:o,placement:d,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:t,floating:e}});u=null!=m?m:u,h=null!=y?y:h,f={...f,[r]:{...f[r],...v}},b&&p<=50&&(p++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(c=!0===b.rects?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),({x:u,y:h}=K(c,d,l))),n=-1)}return{x:u,y:h,placement:d,strategy:i,middlewareData:f}})(t,e,{...i,platform:r})},At=(t,e)=>{let n=!1;const o=e.value,i=e=>{!t.contains(e.target)&&n&&o(),n=t.contains(e.target)};document.addEventListener("click",i,!0),t.onClickOutside=i},Mt=t=>{document.removeEventListener("click",t.onClickOutside,!0),delete t.onClickOutside},zt={created:At,unmounted:Mt,bind:At,unbind:Mt},Ft=(t,e)=>{const n=t.__vccOpts||t;for(const[t,o]of e)n[t]=o;return n};const Rt=Ft({name:"Teleport",props:{to:{type:String,required:!0},where:{type:String,default:"after"},disabled:Boolean},data:()=>({nodes:[],waiting:!1,observer:null,parent:null}),computed:{classes(){return this.disabled?["teleport"]:["teleport","teleport-hidden"]}},watch:{to:"maybeMove",where:"maybeMove",disabled(t){t?(this.disable(),this.teardownObserver()):(this.bootObserver(),this.move())}},mounted(){this.nodes=Array.from(this.$el.childNodes),this.disabled||this.bootObserver(),this.maybeMove()},beforeUnmount(){this.disable(),this.teardownObserver()},methods:{maybeMove(){this.disabled||this.move()},move(){if(this.waiting=!1,this.parent=document.querySelector(this.to),!this.parent)return this.disable(),void(this.waiting=!0);"before"===this.where?this.parent.prepend(this.getFragment()):this.parent.appendChild(this.getFragment())},disable(){this.$el.appendChild(this.getFragment()),this.parent=null},getFragment(){const t=document.createDocumentFragment();return this.nodes.forEach((e=>t.appendChild(e))),t},onMutations(t){let e=!1;for(let n=0;n<t.length;n++){const o=t[n],i=Array.from(o.addedNodes).filter((t=>!this.nodes.includes(t)));Array.from(o.removedNodes).includes(this.parent)?(this.disable(),this.waiting=!this.disabled):this.waiting&&i.length>0&&(e=!0)}e&&this.move()},bootObserver(){this.observer||(this.observer=new MutationObserver((t=>this.onMutations(t))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))},teardownObserver(){this.observer&&(this.observer.disconnect(),this.observer=null)}}},[["render",function(t,n,o,i,r,s){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.classes)},[e.renderSlot(t.$slots,"default")],2)}]]),Dt="handleDebounceQuerySuggestion",Ht=e.defineComponent({name:"Autocomplete",directives:{clickOutside:zt},props:{modelValue:{type:String,default:""},api:{type:String,default:T.initialOptions.api},queryDelay:{type:Number,default:T.initialOptions.queryDelay},placeholder:{type:String,default:T.initialOptions.placeholder},clearable:{type:Boolean,default:T.initialOptions.clearable},backFill:{type:Boolean,default:T.initialOptions.backFill},popupAppendToBody:{type:Boolean,default:T.initialOptions.popupAppendToBody},autoFocus:{type:Boolean,default:T.initialOptions.autoFocus},showSubmitButton:{type:Boolean,default:T.initialOptions.showSubmitButton},submitButtonLabel:{type:String,default:T.initialOptions.submitButtonLabel},offsetTop:{type:Number,default:T.initialOptions.offsetTop},autoFlip:{type:Boolean,default:T.initialOptions.autoFlip},historyEnabled:{type:Boolean,default:T.initialOptions.history.enabled},historyType:{type:String,default:T.initialOptions.history.type},historyStorageKey:{type:String,default:T.initialOptions.history.key},historyClearable:{type:Boolean,default:T.initialOptions.history.showClear}},emits:["update:modelValue","change","input","fetch","abortFetch","select","clear","focus","blur","submit","dropdownVisibleChange"],data:()=>({isVue3:true,abortController:void 0,latestKeyword:"",selectSuggestion:void 0,suggestionVisible:!1,suggestionType:"fetch",suggestions:[],keyboardActiveIndex:void 0,floatingWidth:void 0,floatingStyles:{left:"0",top:"0",width:"auto"},clearIcon:T.initialOptions.clearIcon,historyClearIcon:T.initialOptions.history.clearIcon,historyItemIcon:T.initialOptions.history.itemIcon}),computed:{nativeInputValue(){return null==(t=this.modelValue)||void 0===t?"":String(this.modelValue);var t}},watch:{nativeInputValue(){this.setNativeInputValue()}},created(){this[Dt]=_(this.handleQuerySuggestion,this.queryDelay)},mounted(){this.autoFocus&&this.handleFocus(),this.setNativeInputValue(),this.handleCalculatePosition()},methods:{handleFocus(){this.$refs.input.focus()},handleCalculatePosition(){const t=this.$refs.reference,e=this.$refs.floating;Et(t,e,(()=>{Lt(t,e,{middleware:[_t(this.offsetTop),Vt({apply:({rects:t})=>{this.floatingStyles.width=`${t.reference.width}px`}}),...this.autoFlip?[Ot({fallbackPlacements:["top"]})]:[]]}).then((({x:t,y:e})=>{this.floatingStyles.left=`${t}px`,this.floatingStyles.top=`${e}px`}))}))},handleCancelQuerySuggestion(){this.abortController&&(this.abortController.abort("repeated request"),this.abortController=void 0)},async handleQuerySuggestion(t){this.handleCancelQuerySuggestion(),this.nativeInputValue!==this.latestKeyword?(this.abortController=new AbortController,T.handleQueryData(t.trim(),this.api,this.abortController).then((({data:e})=>{this.latestKeyword=t.trim(),this.suggestions=e,this.showSuggestion(),this.$emit("fetch",e)})).catch((t=>{"AbortError"===t.name&&this.$emit("abortFetch",t)}))):this.showSuggestion()},setNativeInputValue(){const t=this.$refs.input;t.value!==this.nativeInputValue&&(t.value=this.nativeInputValue)},handleInput(t){this.hideSuggestion();const{value:e}=t.target;this.handleUpdateModelValue(e),this.$emit("input",e),this.keyboardActiveIndex=void 0,this.selectSuggestion=void 0,0!==e.length?this[Dt](e):this.clearSuggestion()},handleInputClick(){this.nativeInputValue?this.handleQuerySuggestion(this.nativeInputValue):this.historyEnabled&&(this.latestKeyword="",this.handleShowHistory())},handleInputChange(t){const{value:e}=t.target;this.$emit("change",e)},handleInputFocus(){this.$emit("focus")},handleInputBlur(){this.handleCancelQuerySuggestion(),this.$emit("blur")},handleShowHistory(){const t={enabled:this.historyEnabled,key:this.historyStorageKey,type:this.historyType};this.suggestions=T.getHistory(t),this.showSuggestion("history")},clearSuggestion(){this.suggestions=[]},showSuggestion(t="fetch"){if(0===this.suggestions.length)return this.clearSuggestion(),void this.hideSuggestion();this.suggestionType=t,this.suggestionVisible||(this.suggestionVisible=!0,this.$emit("dropdownVisibleChange",!0))},hideSuggestion(){this.suggestionVisible&&(this.suggestionVisible=!1,this.$emit("dropdownVisibleChange",!1))},handleSubmit(){this.$emit("submit",{text:this.nativeInputValue})},handleInputClear(){this.selectSuggestion=void 0,this.handleUpdateModelValue(""),this.clearSuggestion(),this.hideSuggestion(),this.handleFocus(),this.$emit("clear")},handleClickOutside(){this.hideSuggestion()},handleKeyDown(t){switch(t.key){case"Enter":E(this.keyboardActiveIndex)||this.handleSuggestionClick(this.suggestions[this.keyboardActiveIndex]);break;case"ArrowUp":this.keyboardActiveIndex?this.keyboardActiveIndex--:this.keyboardActiveIndex=this.suggestions.length-1,this.backFill&&this.handleFillInput();break;case"ArrowDown":E(this.keyboardActiveIndex)||this.keyboardActiveIndex>=this.suggestions.length-1?this.keyboardActiveIndex=0:this.keyboardActiveIndex++,this.backFill&&this.handleFillInput();break;case"Escape":this.handleInputClear()}},handleFillInput(){this.selectSuggestion=this.suggestions[this.keyboardActiveIndex],this.handleUpdateModelValue(O(this.selectSuggestion.name||""))},handleHistoryClear(){const t={key:this.historyStorageKey,type:this.historyType};T.removeHistory(t),this.clearSuggestion(),this.hideSuggestion()},handleSuggestionClick(t){if(this.handleUpdateModelValue(O(t.name)),this.selectSuggestion={id:t.id,name:t.name},this.clearSuggestion(),this.hideSuggestion(),this.historyEnabled&&this.selectSuggestion){const t={enabled:this.historyEnabled,key:this.historyStorageKey,type:this.historyType};T.addHistory(this.selectSuggestion,t)}this.$emit("select",this.selectSuggestion)},handleUpdateModelValue(t){this.$emit("update:modelValue",t)}}}),Nt={class:"company-autocomplete__input"},jt=["placeholder"],Pt={key:0,class:"company-autocomplete__clear"},$t=["innerHTML"],qt={key:0,class:"company-autocomplete__submit"},Ut={class:"suggestion-popper__body"},Wt=["onClick"],Kt={class:"suggestion__avatar"},Qt=["innerHTML"],Gt=["alt","src"],Jt=["innerHTML"],Xt=e.createElementVNode("div",{class:"suggestion__extra"},null,-1),Yt={class:"suggestion-popper__footer"},Zt=["innerHTML"];const te=Ft(Ht,[["render",function(t,n,o,i,r,s){const a=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",{ref:"reference",class:e.normalizeClass(["company-autocomplete",[{"company-autocomplete--show-submit":t.showSubmitButton,"company-autocomplete--words":t.nativeInputValue.length>0,"company-autocomplete--activated":t.suggestionVisible}]]),onKeydown:n[8]||(n[8]=(...e)=>t.handleKeyDown&&t.handleKeyDown(...e))},[e.createElementVNode("div",Nt,[e.createElementVNode("input",e.mergeProps({ref:"input",type:"text"},t.$attrs,{placeholder:t.placeholder,onInput:n[0]||(n[0]=(...e)=>t.handleInput&&t.handleInput(...e)),onClick:n[1]||(n[1]=(...e)=>t.handleInputClick&&t.handleInputClick(...e)),onChange:n[2]||(n[2]=(...e)=>t.handleInputChange&&t.handleInputChange(...e)),onFocus:n[3]||(n[3]=(...e)=>t.handleInputFocus&&t.handleInputFocus(...e)),onBlur:n[4]||(n[4]=(...e)=>t.handleInputBlur&&t.handleInputBlur(...e))}),null,16,jt),t.clearable?(e.openBlock(),e.createElementBlock("div",Pt,[e.createElementVNode("i",{class:"company-autocomplete__clear-icon",onClick:n[5]||(n[5]=(...e)=>t.handleInputClear&&t.handleInputClear(...e)),innerHTML:t.clearIcon},null,8,$t)])):e.createCommentVNode("",!0)]),t.showSubmitButton?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("button",{type:"button",onClick:n[6]||(n[6]=(...e)=>t.handleSubmit&&t.handleSubmit(...e))},e.toDisplayString(t.submitButtonLabel),1)])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!t.popupAppendToBody},[e.createElementVNode("div",{ref:"floating",class:e.normalizeClass(["suggestion-popper",[{"suggestion-popper--activated":t.suggestionVisible}]]),style:e.normalizeStyle(t.floatingStyles)},[e.createElementVNode("div",Ut,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.suggestions,((n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["suggestion",[{"suggestion--keyboard-active":t.keyboardActiveIndex===o}]]),key:`${n.name}-${o}`,onClick:e=>t.handleSuggestionClick(n)},[e.createElementVNode("div",Kt,["history"===t.suggestionType?(e.openBlock(),e.createElementBlock("i",{key:0,class:"suggestion__avatar-icon",innerHTML:t.historyItemIcon},null,8,Qt)):n.avatar?(e.openBlock(),e.createElementBlock("img",{key:1,alt:n.id,src:n.avatar},null,8,Gt)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"suggestion__label",innerHTML:n.name},null,8,Jt),Xt],10,Wt)))),128))]),e.withDirectives(e.createElementVNode("div",Yt,[e.createElementVNode("a",{href:"javascript:;",onClick:n[7]||(n[7]=(...e)=>t.handleHistoryClear&&t.handleHistoryClear(...e))},[e.createElementVNode("i",{class:"suggestion-popper__icon",innerHTML:t.historyClearIcon},null,8,Zt),e.createTextVNode(" 删除历史 ")])],512),[[e.vShow,t.historyClearable&&"history"===t.suggestionType]])],6)],8,["disabled"]))],34)),[[a,t.handleClickOutside]])}]]),ee={install(t){t.component(te.name,te),t.component(Rt.name,Rt)}};t.autocomplete=te,t.default=ee,t.teleport=Rt,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
//# sourceMappingURL=index.full.prod.js.map