@roxyapi/ui 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components-catalog.json +109 -109
- package/dist/cdn/components/endpoint-form.js +1 -1
- package/dist/cdn/components/endpoint-form.js.map +2 -2
- package/dist/cdn/components/location-search.js +1 -1
- package/dist/cdn/components/location-search.js.map +2 -2
- package/dist/cdn/roxy-ui.js +2 -2
- package/dist/cdn/roxy-ui.js.map +2 -2
- package/dist/components/endpoint-form.d.ts +3 -1
- package/dist/components/endpoint-form.d.ts.map +1 -1
- package/dist/components/endpoint-form.js +1 -1
- package/dist/components/endpoint-form.js.map +2 -2
- package/dist/components/location-search.d.ts.map +1 -1
- package/dist/components/location-search.js +1 -1
- package/dist/components/location-search.js.map +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/endpoint-form.ts +4 -2
- package/src/components/location-search.ts +8 -1
- package/src/version.ts +1 -1
|
@@ -261,7 +261,7 @@ var RoxyUI_location_search=(()=>{var z=Object.defineProperty;var ae=Object.getOw
|
|
|
261
261
|
}
|
|
262
262
|
`;var I="roxy-ui-tokens";function q(){if(typeof document>"u")return null;let s=document.getElementById(I);if(s)return s;let e=document.createElement("style");return e.id=I,e.textContent=le,document.head.prepend(e),e}var K=globalThis,L=K.ShadowRoot&&(K.ShadyCSS===void 0||K.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),he=new WeakMap,O=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==G)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(L&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=he.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&he.set(t,e))}return e}toString(){return this.cssText}},ce=s=>new O(typeof s=="string"?s:s+"",void 0,G),T=(s,...e)=>{let t=s.length===1?s[0]:e.reduce((r,o,i)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+s[i+1],s[0]);return new O(t,s,G)},de=(s,e)=>{if(L)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),o=K.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=t.cssText,s.appendChild(r)}},X=L?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return ce(t)})(s):s;var{is:He,defineProperty:Ne,getOwnPropertyDescriptor:je,getOwnPropertyNames:ze,getOwnPropertySymbols:Ie,getPrototypeOf:qe}=Object,B=globalThis,pe=B.trustedTypes,Ke=pe?pe.emptyScript:"",Le=B.reactiveElementPolyfillSupport,P=(s,e)=>s,U={toAttribute(s,e){switch(e){case Boolean:s=s?Ke:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},F=(s,e)=>!He(s,e),ue={attribute:!0,type:String,converter:U,reflect:!1,useDefault:!1,hasChanged:F};Symbol.metadata??=Symbol("metadata"),B.litPropertyMetadata??=new WeakMap;var m=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ue){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,t);o!==void 0&&Ne(this.prototype,e,o)}}static getPropertyDescriptor(e,t,r){let{get:o,set:i}=je(this.prototype,e)??{get(){return this[t]},set(n){this[t]=n}};return{get:o,set(n){let l=o?.call(this);i?.call(this,n),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ue}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;let e=qe(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){let t=this.properties,r=[...ze(t),...Ie(t)];for(let o of r)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,o]of t)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let o=this._$Eu(t,r);o!==void 0&&this._$Eh.set(o,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(X(o))}else e!==void 0&&t.push(X(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return de(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,r);if(o!==void 0&&r.reflect===!0){let i=(r.converter?.toAttribute!==void 0?r.converter:U).toAttribute(t,r.type);this._$Em=e,i==null?this.removeAttribute(o):this.setAttribute(o,i),this._$Em=null}}_$AK(e,t){let r=this.constructor,o=r._$Eh.get(e);if(o!==void 0&&this._$Em!==o){let i=r.getPropertyOptions(o),n=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:U;this._$Em=o;let l=n.fromAttribute(t,i.type);this[o]=l??this._$Ej?.get(o)??l,this._$Em=null}}requestUpdate(e,t,r,o=!1,i){if(e!==void 0){let n=this.constructor;if(o===!1&&(i=this[e]),r??=n.getPropertyOptions(e),!((r.hasChanged??F)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:o,wrapped:i},n){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),i!==!0||n!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),o===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,i]of this._$Ep)this[o]=i;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,i]of r){let{wrapped:n}=i,l=this[o];n!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,i,l)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};m.elementStyles=[],m.shadowRootOptions={mode:"open"},m[P("elementProperties")]=new Map,m[P("finalized")]=new Map,Le?.({ReactiveElement:m}),(B.reactiveElementVersions??=[]).push("2.1.2");var oe=globalThis,ye=s=>s,W=oe.trustedTypes,fe=W?W.createPolicy("lit-html",{createHTML:s=>s}):void 0,$e="$lit$",g=`lit$${Math.random().toFixed(9).slice(2)}$`,_e="?"+g,Be=`<${_e}>`,A=document,R=()=>A.createComment(""),D=s=>s===null||typeof s!="object"&&typeof s!="function",se=Array.isArray,Fe=s=>se(s)||typeof s?.[Symbol.iterator]=="function",J=`[
|
|
263
263
|
\f\r]`,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,me=/-->/g,xe=/>/g,_=RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
|
|
264
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),ge=/'/g,be=/"/g,we=/^(?:script|style|textarea|title)$/i,ie=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),b=ie(1),nt=ie(2),at=ie(3),k=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),ve=new WeakMap,w=A.createTreeWalker(A,129);function Ae(s,e){if(!se(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return fe!==void 0?fe.createHTML(e):e}var We=(s,e)=>{let t=s.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",n=M;for(let l=0;l<t;l++){let a=s[l],d,u,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,u=n.exec(a),u!==null);)f=n.lastIndex,n===M?u[1]==="!--"?n=me:u[1]!==void 0?n=xe:u[2]!==void 0?(we.test(u[2])&&(o=RegExp("</"+u[2],"g")),n=_):u[3]!==void 0&&(n=_):n===_?u[0]===">"?(n=o??M,h=-1):u[1]===void 0?h=-2:(h=n.lastIndex-u[2].length,d=u[1],n=u[3]===void 0?_:u[3]==='"'?be:ge):n===be||n===ge?n=_:n===me||n===xe?n=M:(n=_,o=void 0);let x=n===_&&s[l+1].startsWith("/>")?" ":"";i+=n===M?a+Be:h>=0?(r.push(d),a.slice(0,h)+$e+a.slice(h)+g+x):a+g+(h===-2?l:x)}return[Ae(s,i+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},H=class s{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let i=0,n=0,l=e.length-1,a=this.parts,[d,u]=We(e,t);if(this.el=s.createElement(d,r),w.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=w.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith($e)){let f=u[n++],x=o.getAttribute(h).split(g),j=/([.?@])?(.*)/.exec(f);a.push({type:1,index:i,name:j[2],strings:x,ctor:j[1]==="."?Q:j[1]==="?"?ee:j[1]==="@"?te:C}),o.removeAttribute(h)}else h.startsWith(g)&&(a.push({type:6,index:i}),o.removeAttribute(h));if(we.test(o.tagName)){let h=o.textContent.split(g),f=h.length-1;if(f>0){o.textContent=W?W.emptyScript:"";for(let x=0;x<f;x++)o.append(h[x],R()),w.nextNode(),a.push({type:2,index:++i});o.append(h[f],R())}}}else if(o.nodeType===8)if(o.data===_e)a.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(g,h+1))!==-1;)a.push({type:7,index:i}),h+=g.length-1}i++}}static createElement(e,t){let r=A.createElement("template");return r.innerHTML=e,r}};function S(s,e,t=s,r){if(e===k)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,i=D(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(s),o._$AT(s,t,r)),r!==void 0?(t._$Co??=[])[r]=o:t._$Cl=o),o!==void 0&&(e=S(s,o._$AS(s,e.values),o,r)),e}var Z=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??A).importNode(t,!0);w.currentNode=o;let i=w.nextNode(),n=0,l=0,a=r[0];for(;a!==void 0;){if(n===a.index){let d;a.type===2?d=new N(i,i.nextSibling,this,e):a.type===1?d=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(d=new re(i,this,e)),this._$AV.push(d),a=r[++l]}n!==a?.index&&(i=w.nextNode(),n++)}return w.currentNode=A,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},N=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=S(this,e,t),D(e)?e===c||e==null||e===""?(this._$AH!==c&&this._$AR(),this._$AH=c):e!==this._$AH&&e!==k&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Fe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==c&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(A.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=H.createElement(Ae(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Z(o,this),n=i.u(this.options);i.p(t),this.T(n),this._$AH=i}}_$AC(e){let t=ve.get(e.strings);return t===void 0&&ve.set(e.strings,t=new H(e)),t}k(e){se(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let i of e)o===t.length?t.push(r=new s(this.O(R()),this.O(R()),this,this.options)):r=t[o],r._$AI(i),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=ye(e).nextSibling;ye(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},C=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,i){this.type=1,this._$AH=c,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=c}_$AI(e,t=this,r,o){let i=this.strings,n=!1;if(i===void 0)e=S(this,e,t,0),n=!D(e)||e!==this._$AH&&e!==k,n&&(this._$AH=e);else{let l=e,a,d;for(e=i[0],a=0;a<i.length-1;a++)d=S(this,l[r+a],t,a),d===k&&(d=this._$AH[a]),n||=!D(d)||d!==this._$AH[a],d===c?e=c:e!==c&&(e+=(d??"")+i[a+1]),this._$AH[a]=d}n&&!o&&this.j(e)}j(e){e===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Q=class extends C{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===c?void 0:e}},ee=class extends C{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==c)}},te=class extends C{constructor(e,t,r,o,i){super(e,t,r,o,i),this.type=5}_$AI(e,t=this){if((e=S(this,e,t,0)??c)===k)return;let r=this._$AH,o=e===c&&r!==c||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==c&&(r===c||o);o&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},re=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){S(this,e)}};var Ye=oe.litHtmlPolyfillSupport;Ye?.(H,N),(oe.litHtmlVersions??=[]).push("3.3.3");var ke=(s,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let i=t?.renderBefore??null;r._$litPart$=o=new N(e.insertBefore(R(),i),i,void 0,t??{})}return o._$AI(s),o};var ne=globalThis,v=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ke(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return k}};v._$litElement$=!0,v.finalized=!0,ne.litElementHydrateSupport?.({LitElement:v});var Ve=ne.litElementPolyfillSupport;Ve?.({LitElement:v});(ne.litElementVersions??=[]).push("4.2.2");var Ee=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};var Ge={attribute:!0,type:String,converter:U,reflect:!1,hasChanged:F},Xe=(s=Ge,e,t)=>{let{kind:r,metadata:o}=t,i=globalThis.litPropertyMetadata.get(o);if(i===void 0&&globalThis.litPropertyMetadata.set(o,i=new Map),r==="setter"&&((s=Object.create(s)).wrapped=!0),i.set(t.name,s),r==="accessor"){let{name:n}=t;return{set(l){let a=e.get.call(this);e.set.call(this,l),this.requestUpdate(n,a,s,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,s,l),l}}}if(r==="setter"){let{name:n}=t;return function(l){let a=this[n];e.call(this,l),this.requestUpdate(n,a,s,!0,l)}}throw Error("Unsupported decorator location: "+r)};function $(s){return(e,t)=>typeof t=="object"?Xe(s,e,t):((r,o,i)=>{let n=o.hasOwnProperty(i);return o.constructor.createProperty(i,r),n?Object.getOwnPropertyDescriptor(o,i):void 0})(s,e,t)}function E(s){return $({...s,state:!0,attribute:!1})}var Se=T`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function Ce(s,e){let t,r=((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,s(...o)},e)});return r.cancel=()=>{t&&(clearTimeout(t),t=void 0)},r}var V="Client-side components accept a pk_ publishable key only. Use a publishable key with an origin allowlist, or render server-side.";function Oe(s){return!!s&&!s.startsWith("pk_")}function Te(s,e={}){e.warn&&console.warn(V),s.dispatchEvent(new CustomEvent("roxy-validation-error",{detail:{reason:"possible-secret-key",message:V},bubbles:!0,composed:!0}))}var p=class extends v{constructor(){super(...arguments);this.endpoint="https://roxyapi.com/api/v2/location/search";this.placeholder="Search city";this.defaultValue="";this.query="";this.results=[];this.isOpen=!1;this.isLoading=!1;this.highlight=-1;this.keyBlocked=!1;this.debouncedFetch=Ce(t=>{this.fetchResults(t)},300);this.onInput=t=>{let r=t.target.value;if(this.query=r,r.length<2){this.results=[],this.isOpen=!1,this.highlight=-1;return}this.debouncedFetch(r)};this.onKeyDown=t=>{if(!this.isOpen||this.results.length===0){t.key==="ArrowDown"&&this.query.length>=2&&(this.fetchResults(this.query),t.preventDefault());return}if(t.key==="ArrowDown")t.preventDefault(),this.highlight=(this.highlight+1)%this.results.length;else if(t.key==="ArrowUp")t.preventDefault(),this.highlight=(this.highlight-1+this.results.length)%this.results.length;else if(t.key==="Enter"){t.preventDefault();let r=this.results[this.highlight]??this.results[0];r&&this.select(r)}else t.key==="Escape"&&(this.isOpen=!1)}}connectedCallback(){super.connectedCallback(),this.query=this.defaultValue,this.clickOutsideHandler=t=>{t.composedPath().includes(this)||(this.isOpen=!1)},document.addEventListener("mousedown",this.clickOutsideHandler)}willUpdate(t){if(t.has("publishableKey")||t.has("apiKey")){let r=Oe(this.publishableKey??this.apiKey);r&&!this.keyBlocked&&Te(this,{warn:!0}),this.keyBlocked=r}}disconnectedCallback(){super.disconnectedCallback(),this.clickOutsideHandler&&document.removeEventListener("mousedown",this.clickOutsideHandler),this.debouncedFetch.cancel(),this.abortController&&(this.abortController.abort(),this.abortController=void 0)}async fetchResults(t){if(this.keyBlocked)return;this.abortController&&this.abortController.abort();let r=new AbortController;this.abortController=r,this.isLoading=!0;try{let o=new URL(this.endpoint);o.searchParams.set("q",t),o.searchParams.set("limit","8");let i={Accept:"application/json"};this.apiKey&&this.publishableKey&&console.warn("[roxy-location-search] both api-key and publishable-key set; using publishable-key. Remove api-key from your widget markup.");let n=this.publishableKey??this.apiKey;n&&(i["X-API-Key"]=n);let l=await fetch(o,{headers:i,signal:r.signal});if(!l.ok)throw new Error(`HTTP ${l.status}`);let a=await l.json();if(r.signal.aborted)return;this.results=a.cities??[],this.isOpen=this.results.length>0,this.highlight=this.results.length>0?0:-1}catch(o){if(o?.name==="AbortError")return;this.results=[],this.isOpen=!1}finally{this.abortController===r&&(this.abortController=void 0),r.signal.aborted||(this.isLoading=!1)}}select(t){this.query=`${t.city}${t.province?`, ${t.province}`:""}, ${t.country}`,this.isOpen=!1,this.results=[],this.dispatchEvent(new CustomEvent("roxy-location-select",{detail:t,bubbles:!0,composed:!0}))}render(){return this.keyBlocked?b`<div class="roxy-error" role="alert">${V}</div>`:b`<div class="field"><input type="text" role="combobox" aria-expanded="${this.isOpen?"true":"false"}" aria-controls="roxy-location-listbox" aria-activedescendant="${this.isOpen&&this.highlight>=0?`roxy-location-option-${this.highlight}`:""}" aria-autocomplete="list" autocomplete="off" placeholder="${this.placeholder}" .value="${this.query}" @input="${this.onInput}" @keydown="${this.onKeyDown}" @focus="${()=>{this.results.length>0&&(this.isOpen=!0)}}"> ${this.isLoading?b`<span class="spinner" role="status" aria-label="Loading"></span>`:c} ${this.isOpen?b`<ul id="roxy-location-listbox" class="results" role="listbox">${this.results.length===0?b`<li class="empty" role="status">No cities found</li>`:this.results.map((t,r)=>b`<li role="presentation"><button type="button" class="option" role="option" id="${`roxy-location-option-${r}`}" aria-selected="${this.highlight===r?"true":"false"}" @click="${()=>this.select(t)}" @mouseenter="${()=>{this.highlight=r}}"><span class="city">${t.city}</span> <span class="where">${t.province?b`${t.province},`:""}${t.country}</span> <span class="tz">UTC${t.utcOffset>=0?"+":""}${t.utcOffset}</span></button></li>`)}</ul>`:c}</div>`}};p.styles=[Se,T`:host{display:block;position:relative}.field{position:relative}input{width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));box-sizing:border-box;font-family:inherit}input:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.spinner{border:2px solid var(--roxy-muted,#71717a);border-top-color:#0000;border-radius:50%;width:14px;height:14px;animation:.7s linear infinite roxy-spin;position:absolute;top:50%;right:12px;transform:translateY(-50%)}@keyframes roxy-spin{to{transform:translateY(-50%)rotate(360deg)}}@media (prefers-reduced-motion:reduce){.spinner{animation:none}}.results{z-index:50;background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);box-shadow:var(--roxy-shadow-md);max-height:22rem;animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto}.option{align-items:baseline;gap:var(--roxy-space-sm,.5rem);width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);text-align:left;font-family:inherit;font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);cursor:pointer;transition:background-color var(--roxy-motion-duration,.2s);background:0 0;border:0;display:flex}.option:hover,.option[aria-selected=true]{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 10%, transparent)}.option .city{font-weight:var(--roxy-weight-bold,600)}.option .where{color:var(--roxy-muted,#71717a);flex-grow:1}.option .tz{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);font-variant-numeric:tabular-nums}.empty{padding:var(--roxy-space-md,1rem);color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}`],y([$({type:String,attribute:"api-key"})],p.prototype,"apiKey",2),y([$({type:String,attribute:"publishable-key"})],p.prototype,"publishableKey",2),y([$({type:String})],p.prototype,"endpoint",2),y([$({type:String})],p.prototype,"placeholder",2),y([$({type:String,attribute:"default-value"})],p.prototype,"defaultValue",2),y([E()],p.prototype,"query",2),y([E()],p.prototype,"results",2),y([E()],p.prototype,"isOpen",2),y([E()],p.prototype,"isLoading",2),y([E()],p.prototype,"highlight",2),y([E()],p.prototype,"keyBlocked",2),p=y([Ee("roxy-location-search")],p);q();return De(Je);})();
|
|
264
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ge=/'/g,be=/"/g,we=/^(?:script|style|textarea|title)$/i,ie=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),b=ie(1),nt=ie(2),at=ie(3),k=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),ve=new WeakMap,w=A.createTreeWalker(A,129);function Ae(s,e){if(!se(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return fe!==void 0?fe.createHTML(e):e}var We=(s,e)=>{let t=s.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",n=M;for(let l=0;l<t;l++){let a=s[l],d,u,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,u=n.exec(a),u!==null);)f=n.lastIndex,n===M?u[1]==="!--"?n=me:u[1]!==void 0?n=xe:u[2]!==void 0?(we.test(u[2])&&(o=RegExp("</"+u[2],"g")),n=_):u[3]!==void 0&&(n=_):n===_?u[0]===">"?(n=o??M,h=-1):u[1]===void 0?h=-2:(h=n.lastIndex-u[2].length,d=u[1],n=u[3]===void 0?_:u[3]==='"'?be:ge):n===be||n===ge?n=_:n===me||n===xe?n=M:(n=_,o=void 0);let x=n===_&&s[l+1].startsWith("/>")?" ":"";i+=n===M?a+Be:h>=0?(r.push(d),a.slice(0,h)+$e+a.slice(h)+g+x):a+g+(h===-2?l:x)}return[Ae(s,i+(s[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},H=class s{constructor({strings:e,_$litType$:t},r){let o;this.parts=[];let i=0,n=0,l=e.length-1,a=this.parts,[d,u]=We(e,t);if(this.el=s.createElement(d,r),w.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=w.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith($e)){let f=u[n++],x=o.getAttribute(h).split(g),j=/([.?@])?(.*)/.exec(f);a.push({type:1,index:i,name:j[2],strings:x,ctor:j[1]==="."?Q:j[1]==="?"?ee:j[1]==="@"?te:C}),o.removeAttribute(h)}else h.startsWith(g)&&(a.push({type:6,index:i}),o.removeAttribute(h));if(we.test(o.tagName)){let h=o.textContent.split(g),f=h.length-1;if(f>0){o.textContent=W?W.emptyScript:"";for(let x=0;x<f;x++)o.append(h[x],R()),w.nextNode(),a.push({type:2,index:++i});o.append(h[f],R())}}}else if(o.nodeType===8)if(o.data===_e)a.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(g,h+1))!==-1;)a.push({type:7,index:i}),h+=g.length-1}i++}}static createElement(e,t){let r=A.createElement("template");return r.innerHTML=e,r}};function S(s,e,t=s,r){if(e===k)return e;let o=r!==void 0?t._$Co?.[r]:t._$Cl,i=D(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(s),o._$AT(s,t,r)),r!==void 0?(t._$Co??=[])[r]=o:t._$Cl=o),o!==void 0&&(e=S(s,o._$AS(s,e.values),o,r)),e}var Z=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,o=(e?.creationScope??A).importNode(t,!0);w.currentNode=o;let i=w.nextNode(),n=0,l=0,a=r[0];for(;a!==void 0;){if(n===a.index){let d;a.type===2?d=new N(i,i.nextSibling,this,e):a.type===1?d=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(d=new re(i,this,e)),this._$AV.push(d),a=r[++l]}n!==a?.index&&(i=w.nextNode(),n++)}return w.currentNode=A,o}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},N=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,o){this.type=2,this._$AH=c,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=S(this,e,t),D(e)?e===c||e==null||e===""?(this._$AH!==c&&this._$AR(),this._$AH=c):e!==this._$AH&&e!==k&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Fe(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==c&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(A.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=H.createElement(Ae(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Z(o,this),n=i.u(this.options);i.p(t),this.T(n),this._$AH=i}}_$AC(e){let t=ve.get(e.strings);return t===void 0&&ve.set(e.strings,t=new H(e)),t}k(e){se(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,o=0;for(let i of e)o===t.length?t.push(r=new s(this.O(R()),this.O(R()),this,this.options)):r=t[o],r._$AI(i),o++;o<t.length&&(this._$AR(r&&r._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=ye(e).nextSibling;ye(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},C=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,o,i){this.type=1,this._$AH=c,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=c}_$AI(e,t=this,r,o){let i=this.strings,n=!1;if(i===void 0)e=S(this,e,t,0),n=!D(e)||e!==this._$AH&&e!==k,n&&(this._$AH=e);else{let l=e,a,d;for(e=i[0],a=0;a<i.length-1;a++)d=S(this,l[r+a],t,a),d===k&&(d=this._$AH[a]),n||=!D(d)||d!==this._$AH[a],d===c?e=c:e!==c&&(e+=(d??"")+i[a+1]),this._$AH[a]=d}n&&!o&&this.j(e)}j(e){e===c?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Q=class extends C{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===c?void 0:e}},ee=class extends C{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==c)}},te=class extends C{constructor(e,t,r,o,i){super(e,t,r,o,i),this.type=5}_$AI(e,t=this){if((e=S(this,e,t,0)??c)===k)return;let r=this._$AH,o=e===c&&r!==c||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==c&&(r===c||o);o&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},re=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){S(this,e)}};var Ye=oe.litHtmlPolyfillSupport;Ye?.(H,N),(oe.litHtmlVersions??=[]).push("3.3.3");var ke=(s,e,t)=>{let r=t?.renderBefore??e,o=r._$litPart$;if(o===void 0){let i=t?.renderBefore??null;r._$litPart$=o=new N(e.insertBefore(R(),i),i,void 0,t??{})}return o._$AI(s),o};var ne=globalThis,v=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ke(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return k}};v._$litElement$=!0,v.finalized=!0,ne.litElementHydrateSupport?.({LitElement:v});var Ve=ne.litElementPolyfillSupport;Ve?.({LitElement:v});(ne.litElementVersions??=[]).push("4.2.2");var Ee=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};var Ge={attribute:!0,type:String,converter:U,reflect:!1,hasChanged:F},Xe=(s=Ge,e,t)=>{let{kind:r,metadata:o}=t,i=globalThis.litPropertyMetadata.get(o);if(i===void 0&&globalThis.litPropertyMetadata.set(o,i=new Map),r==="setter"&&((s=Object.create(s)).wrapped=!0),i.set(t.name,s),r==="accessor"){let{name:n}=t;return{set(l){let a=e.get.call(this);e.set.call(this,l),this.requestUpdate(n,a,s,!0,l)},init(l){return l!==void 0&&this.C(n,void 0,s,l),l}}}if(r==="setter"){let{name:n}=t;return function(l){let a=this[n];e.call(this,l),this.requestUpdate(n,a,s,!0,l)}}throw Error("Unsupported decorator location: "+r)};function $(s){return(e,t)=>typeof t=="object"?Xe(s,e,t):((r,o,i)=>{let n=o.hasOwnProperty(i);return o.constructor.createProperty(i,r),n?Object.getOwnPropertyDescriptor(o,i):void 0})(s,e,t)}function E(s){return $({...s,state:!0,attribute:!1})}var Se=T`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;function Ce(s,e){let t,r=((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,s(...o)},e)});return r.cancel=()=>{t&&(clearTimeout(t),t=void 0)},r}var V="Client-side components accept a pk_ publishable key only. Use a publishable key with an origin allowlist, or render server-side.";function Oe(s){return!!s&&!s.startsWith("pk_")}function Te(s,e={}){e.warn&&console.warn(V),s.dispatchEvent(new CustomEvent("roxy-validation-error",{detail:{reason:"possible-secret-key",message:V},bubbles:!0,composed:!0}))}var p=class extends v{constructor(){super(...arguments);this.endpoint="https://roxyapi.com/api/v2/location/search";this.placeholder="Search city";this.defaultValue="";this.query="";this.results=[];this.isOpen=!1;this.isLoading=!1;this.highlight=-1;this.keyBlocked=!1;this.debouncedFetch=Ce(t=>{this.fetchResults(t)},300);this.onInput=t=>{let r=t.target.value;if(this.query=r,r.length<2){this.results=[],this.isOpen=!1,this.highlight=-1;return}this.debouncedFetch(r)};this.onKeyDown=t=>{if(!this.isOpen||this.results.length===0){t.key==="ArrowDown"&&this.query.length>=2&&(this.fetchResults(this.query),t.preventDefault());return}if(t.key==="ArrowDown")t.preventDefault(),this.highlight=(this.highlight+1)%this.results.length;else if(t.key==="ArrowUp")t.preventDefault(),this.highlight=(this.highlight-1+this.results.length)%this.results.length;else if(t.key==="Enter"){t.preventDefault();let r=this.results[this.highlight]??this.results[0];r&&this.select(r)}else t.key==="Escape"&&(this.isOpen=!1)}}connectedCallback(){super.connectedCallback(),this.query=this.defaultValue,this.clickOutsideHandler=t=>{t.composedPath().includes(this)||(this.isOpen=!1)},document.addEventListener("mousedown",this.clickOutsideHandler)}willUpdate(t){if(t.has("publishableKey")||t.has("apiKey")){let r=Oe(this.publishableKey??this.apiKey);r&&!this.keyBlocked&&Te(this,{warn:!0}),this.keyBlocked=r}}disconnectedCallback(){super.disconnectedCallback(),this.clickOutsideHandler&&document.removeEventListener("mousedown",this.clickOutsideHandler),this.debouncedFetch.cancel(),this.abortController&&(this.abortController.abort(),this.abortController=void 0)}async fetchResults(t){if(this.keyBlocked)return;this.abortController&&this.abortController.abort();let r=new AbortController;this.abortController=r,this.isLoading=!0;try{let o=new URL(this.endpoint);o.searchParams.set("q",t),o.searchParams.set("limit","8");let i={Accept:"application/json"};this.apiKey&&this.publishableKey&&console.warn("[roxy-location-search] both api-key and publishable-key set; using publishable-key. Remove api-key from your widget markup.");let n=this.publishableKey??this.apiKey;n&&(i["X-API-Key"]=n);let l=await fetch(o,{headers:i,signal:r.signal});if(!l.ok)throw new Error(`HTTP ${l.status}`);let a=await l.json();if(r.signal.aborted)return;this.results=a.cities??[],this.isOpen=this.results.length>0,this.highlight=this.results.length>0?0:-1}catch(o){if(o?.name==="AbortError")return;this.results=[],this.isOpen=!1}finally{this.abortController===r&&(this.abortController=void 0),r.signal.aborted||(this.isLoading=!1)}}select(t){this.query=`${t.city}${t.province?`, ${t.province}`:""}, ${t.country}`,this.isOpen=!1,this.results=[],this.dispatchEvent(new CustomEvent("roxy-location-select",{detail:t,bubbles:!0,composed:!0}))}render(){return this.keyBlocked?b`<div class="roxy-error" role="alert">${V}</div>`:b`<div class="field"><input type="text" role="combobox" aria-expanded="${this.isOpen?"true":"false"}" aria-controls="roxy-location-listbox" aria-activedescendant="${this.isOpen&&this.highlight>=0?`roxy-location-option-${this.highlight}`:""}" aria-autocomplete="list" autocomplete="off" placeholder="${this.placeholder}" .value="${this.query}" @input="${this.onInput}" @keydown="${this.onKeyDown}" @focus="${()=>{this.results.length>0&&(this.isOpen=!0)}}"> ${this.isLoading?b`<span class="spinner" role="status" aria-label="Loading"></span>`:c} ${this.isOpen?b`<ul id="roxy-location-listbox" class="results" role="listbox">${this.results.length===0?b`<li class="empty" role="status">No cities found</li>`:this.results.map((t,r)=>b`<li role="presentation"><button type="button" class="option" role="option" id="${`roxy-location-option-${r}`}" aria-selected="${this.highlight===r?"true":"false"}" @click="${()=>this.select(t)}" @mouseenter="${()=>{this.highlight=r}}"><span class="city">${t.city}</span> <span class="where">${t.province?b`${t.province},`:""}${t.country}</span> <span class="tz">UTC${t.utcOffset>=0?"+":""}${t.utcOffset}</span></button></li>`)}</ul>`:c}</div>`}};p.styles=[Se,T`:host{display:block;position:relative}.field{position:relative}input{width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);transition:border-color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));box-sizing:border-box;font-family:inherit}input:focus{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-color:var(--roxy-accent-ink,#b45309)}.spinner{border:2px solid var(--roxy-muted,#71717a);border-top-color:#0000;border-radius:50%;width:14px;height:14px;animation:.7s linear infinite roxy-spin;position:absolute;top:50%;right:12px;transform:translateY(-50%)}@keyframes roxy-spin{to{transform:translateY(-50%)rotate(360deg)}}@media (prefers-reduced-motion:reduce){.spinner{animation:none}}.results{z-index:50;padding:var(--roxy-space-xs,.25rem);background:var(--roxy-bg,#fff);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);box-shadow:var(--roxy-shadow-md);max-height:22rem;animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1));margin:0;list-style:none;position:absolute;top:calc(100% + 4px);left:0;right:0;overflow-y:auto}.option{align-items:center;gap:var(--roxy-space-sm,.5rem);width:100%;padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);border-radius:var(--roxy-radius-sm,6px);text-align:left;font-family:inherit;font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);cursor:pointer;transition:background-color var(--roxy-motion-duration,.2s);background:0 0;border:0;display:flex}.option:hover,.option[aria-selected=true]{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 10%, transparent)}.option .city{font-weight:var(--roxy-weight-bold,600)}.option .where{color:var(--roxy-muted,#71717a);flex-grow:1}.option .tz{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);font-variant-numeric:tabular-nums}.empty{padding:var(--roxy-space-md,1rem);color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}`],y([$({type:String,attribute:"api-key"})],p.prototype,"apiKey",2),y([$({type:String,attribute:"publishable-key"})],p.prototype,"publishableKey",2),y([$({type:String})],p.prototype,"endpoint",2),y([$({type:String})],p.prototype,"placeholder",2),y([$({type:String,attribute:"default-value"})],p.prototype,"defaultValue",2),y([E()],p.prototype,"query",2),y([E()],p.prototype,"results",2),y([E()],p.prototype,"isOpen",2),y([E()],p.prototype,"isLoading",2),y([E()],p.prototype,"highlight",2),y([E()],p.prototype,"keyBlocked",2),p=y([Ee("roxy-location-search")],p);q();return De(Je);})();
|
|
265
265
|
/*! Bundled license information:
|
|
266
266
|
|
|
267
267
|
@lit/reactive-element/css-tag.js:
|