@nyaruka/temba-components 0.83.0 → 0.84.0

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/CHANGELOG.md CHANGED
@@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.84.0](https://github.com/nyaruka/temba-components/compare/v0.83.0...v0.84.0)
8
+
9
+ - Set selected option by value [`#418`](https://github.com/nyaruka/temba-components/pull/418)
10
+ - Allow selecting text from contacts history events [`#417`](https://github.com/nyaruka/temba-components/pull/417)
11
+ - Remove logging [`1b7272d`](https://github.com/nyaruka/temba-components/commit/1b7272d3d93eac7b13e1a1b2284f2c3544751460)
12
+
7
13
  #### [v0.83.0](https://github.com/nyaruka/temba-components/compare/v0.82.0...v0.83.0)
8
14
 
15
+ > 18 April 2024
16
+
9
17
  - Fix static options race for select [`#416`](https://github.com/nyaruka/temba-components/pull/416)
10
18
 
11
19
  #### [v0.82.0](https://github.com/nyaruka/temba-components/compare/v0.81.0...v0.82.0)
@@ -21,7 +21,7 @@ const k=globalThis,S=k.trustedTypes,$=S?S.createPolicy("lit-html",{createHTML:t=
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
23
  */
24
- let rt=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const o=i?.renderBefore??e;let n=o._$litPart$;if(void 0===n){const t=i?.renderBefore??null;o._$litPart$=n=new Q(e.insertBefore(M(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};rt._$litElement$=!0,rt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:rt});const at=globalThis.litElementPolyfillSupport;at?.({LitElement:rt}),(globalThis.litElementVersions??=[]).push("4.0.4");var lt,ht,ct,dt,ut,pt,mt,gt,ft,vt,bt,yt,_t,xt,wt,kt,St,$t,Ct=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Et=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Tt=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let o=0;o<t.length;o++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(o);return e},At="0123456789abcdef".split(""),Lt=[-2147483648,8388608,32768,128],Ot=[24,16,8,0],Mt=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],zt=[];class Pt{constructor(t=!1,e=!1){lt.set(this,void 0),ht.set(this,void 0),ct.set(this,void 0),dt.set(this,void 0),ut.set(this,void 0),pt.set(this,void 0),mt.set(this,void 0),gt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),bt.set(this,void 0),yt.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),St.set(this,0),$t.set(this,void 0),this.init(t,e)}init(t,e){e?(zt[0]=zt[16]=zt[1]=zt[2]=zt[3]=zt[4]=zt[5]=zt[6]=zt[7]=zt[8]=zt[9]=zt[10]=zt[11]=zt[12]=zt[13]=zt[14]=zt[15]=0,Ct(this,ht,zt)):Ct(this,ht,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Ct(this,pt,3238371032),Ct(this,mt,914150663),Ct(this,gt,812702999),Ct(this,ft,4144912697),Ct(this,vt,4290775857),Ct(this,bt,1750603025),Ct(this,yt,1694076839),Ct(this,_t,3204075428)):(Ct(this,pt,1779033703),Ct(this,mt,3144134277),Ct(this,gt,1013904242),Ct(this,ft,2773480762),Ct(this,vt,1359893119),Ct(this,bt,2600822924),Ct(this,yt,528734635),Ct(this,_t,1541459225)),Ct(this,lt,Ct(this,$t,Ct(this,ct,Ct(this,wt,0)))),Ct(this,dt,Ct(this,xt,!1)),Ct(this,ut,!0),Ct(this,kt,t)}update(t){if(Et(this,dt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=Et(this,ht);for(;i<o;){let t;if(Et(this,xt)&&(Ct(this,xt,!1),n[0]=Et(this,lt),n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),"string"!=typeof e)for(t=Et(this,$t);i<o&&t<64;++i)n[t>>2]|=e[i]<<Ot[3&t++];else for(t=Et(this,$t);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<Ot[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<Ot[3&t++],n[t>>2]|=(128|63&o)<<Ot[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<Ot[3&t++],n[t>>2]|=(128|o>>6&63)<<Ot[3&t++],n[t>>2]|=(128|63&o)<<Ot[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<Ot[3&t++],n[t>>2]|=(128|o>>12&63)<<Ot[3&t++],n[t>>2]|=(128|o>>6&63)<<Ot[3&t++],n[t>>2]|=(128|63&o)<<Ot[3&t++])}Ct(this,St,t),Ct(this,ct,Et(this,ct)+(t-Et(this,$t))),t>=64?(Ct(this,lt,n[16]),Ct(this,$t,t-64),this.hash(),Ct(this,xt,!0)):Ct(this,$t,t)}return Et(this,ct)>4294967295&&(Ct(this,wt,Et(this,wt)+(Et(this,ct)/4294967296|0)),Ct(this,ct,Et(this,ct)%4294967296)),this}finalize(){if(Et(this,dt))return;Ct(this,dt,!0);const t=Et(this,ht),e=Et(this,St);t[16]=Et(this,lt),t[e>>2]|=Lt[3&e],Ct(this,lt,t[16]),e>=56&&(Et(this,xt)||this.hash(),t[0]=Et(this,lt),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=Et(this,wt)<<3|Et(this,ct)>>>29,t[15]=Et(this,ct)<<3,this.hash()}hash(){let t=Et(this,pt),e=Et(this,mt),i=Et(this,gt),o=Et(this,ft),n=Et(this,vt),s=Et(this,bt),r=Et(this,yt),a=Et(this,_t);const l=Et(this,ht);let h,c,d,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],h=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],c=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+h+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)Et(this,ut)?(Et(this,kt)?(g=300032,u=l[0]-1413257819,a=u-150054599|0,o=u+24177077|0):(g=704751109,u=l[0]-210244248,a=u-1521486534|0,o=u+143694565|0),Ct(this,ut,!1)):(h=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),c=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),g=t&e,d=g^t&i^b,m=n&s^~n&r,u=a+c+m+Mt[y]+l[y],p=h+d,a=o+u|0,o=u+p|0),h=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),c=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),f=o&t,d=f^o&e^g,m=a&n^~a&s,u=r+c+m+Mt[y+1]+l[y+1],p=h+d,r=i+u|0,i=u+p|0,h=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),c=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&o,d=v^i&t^f,m=r&a^~r&n,u=s+c+m+Mt[y+2]+l[y+2],p=h+d,s=e+u|0,e=u+p|0,h=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),c=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=e&i,d=b^e&o^v,m=s&r^~s&a,u=n+c+m+Mt[y+3]+l[y+3],p=h+d,n=t+u|0,t=u+p|0;Ct(this,pt,Et(this,pt)+t|0),Ct(this,mt,Et(this,mt)+e|0),Ct(this,gt,Et(this,gt)+i|0),Ct(this,ft,Et(this,ft)+o|0),Ct(this,vt,Et(this,vt)+n|0),Ct(this,bt,Et(this,bt)+s|0),Ct(this,yt,Et(this,yt)+r|0),Ct(this,_t,Et(this,_t)+a|0)}hex(){this.finalize();const t=Et(this,pt),e=Et(this,mt),i=Et(this,gt),o=Et(this,ft),n=Et(this,vt),s=Et(this,bt),r=Et(this,yt),a=Et(this,_t);let l=At[t>>28&15]+At[t>>24&15]+At[t>>20&15]+At[t>>16&15]+At[t>>12&15]+At[t>>8&15]+At[t>>4&15]+At[15&t]+At[e>>28&15]+At[e>>24&15]+At[e>>20&15]+At[e>>16&15]+At[e>>12&15]+At[e>>8&15]+At[e>>4&15]+At[15&e]+At[i>>28&15]+At[i>>24&15]+At[i>>20&15]+At[i>>16&15]+At[i>>12&15]+At[i>>8&15]+At[i>>4&15]+At[15&i]+At[o>>28&15]+At[o>>24&15]+At[o>>20&15]+At[o>>16&15]+At[o>>12&15]+At[o>>8&15]+At[o>>4&15]+At[15&o]+At[n>>28&15]+At[n>>24&15]+At[n>>20&15]+At[n>>16&15]+At[n>>12&15]+At[n>>8&15]+At[n>>4&15]+At[15&n]+At[s>>28&15]+At[s>>24&15]+At[s>>20&15]+At[s>>16&15]+At[s>>12&15]+At[s>>8&15]+At[s>>4&15]+At[15&s]+At[r>>28&15]+At[r>>24&15]+At[r>>20&15]+At[r>>16&15]+At[r>>12&15]+At[r>>8&15]+At[r>>4&15]+At[15&r];return Et(this,kt)||(l+=At[a>>28&15]+At[a>>24&15]+At[a>>20&15]+At[a>>16&15]+At[a>>12&15]+At[a>>8&15]+At[a>>4&15]+At[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=Et(this,pt),e=Et(this,mt),i=Et(this,gt),o=Et(this,ft),n=Et(this,vt),s=Et(this,bt),r=Et(this,yt),a=Et(this,_t),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return Et(this,kt)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(Et(this,kt)?28:32),e=new DataView(t);return e.setUint32(0,Et(this,pt)),e.setUint32(4,Et(this,mt)),e.setUint32(8,Et(this,gt)),e.setUint32(12,Et(this,ft)),e.setUint32(16,Et(this,vt)),e.setUint32(20,Et(this,bt)),e.setUint32(24,Et(this,yt)),Et(this,kt)||e.setUint32(28,Et(this,_t)),t}}function It(t){const e=new Pt;return e.update(t),parseInt(e.hex().substring(0,8),16)}lt=new WeakMap,ht=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,mt=new WeakMap,gt=new WeakMap,ft=new WeakMap,vt=new WeakMap,bt=new WeakMap,yt=new WeakMap,_t=new WeakMap,xt=new WeakMap,wt=new WeakMap,kt=new WeakMap,St=new WeakMap,$t=new WeakMap;const Dt=function(t,e,i){var o=i<.5?i*(1+e):i+e-i*e,n=2*i-o;return[(t/=360)+1/3,t,t-1/3].map((function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(o-n)*t:t<.5?o:t<2/3?n+6*(o-n)*(2/3-t):n,Math.round(255*t)}))};const Nt="/api/v2/media.json",Rt=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map((function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]}));this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map((function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}})),this.hash=It,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Tt)}hsl(t){var e,i,o=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[o%this.hueRanges.length];e=o/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=o%359;return o=Math.ceil(o/360),i=this.S[o%this.S.length],o=Math.ceil(o/this.S.length),[e,i,this.L[o%this.L.length]]}rgb(t){var e=this.hsl(t);return Dt.apply(this,e)}hex(t){var e,i=this.rgb(t);return e="#",i.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}};var Bt;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(Bt||(Bt={}));const qt=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},Ut=(t={})=>{const e=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let o=e.substr(0,i),n=e.substr(i+1);if(o=o.trim(),n=n.trim(),o===t)return n}return null})("csrftoken"),i=e?{"X-CSRFToken":e}:{};return i["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{i[e]=t[e]})),i},Ft=(t,e=null,i={})=>new Promise(((o,n)=>{const s={method:"GET",headers:Ut(i)};e&&(s.signal=e.signal),fetch(t,s).then((t=>{t.text().then((i=>{let n={};try{n=JSON.parse(i)}catch(t){}o({controller:e,body:i,json:n,url:t.url,headers:t.headers,status:t.status})}))})).catch((t=>{n(t)}))})),Zt=t=>{const e=[];Object.keys(t).forEach((i=>{t[i]&&e.push(i)}));let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},Vt=(t,e=null)=>new Promise(((i,o)=>{Ft(t,e).then((t=>{i({results:t.json.results,next:t.json.next})})).catch((t=>o(t)))})),jt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Vt(i);t.results&&(e=e.concat(t.results)),i=t.next}return e},Ht=t=>new Promise(((e,i)=>{Ft(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),Wt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Ht(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},Gt=(t,e,i={},o=null)=>{const n=Ut(i);o&&(n["Content-Type"]=o);const s={method:"POST",headers:n,body:e};return console.log(s),new Promise(((e,i)=>{fetch(t,s).then((async t=>{t.status>=500?i(t):t.text().then((i=>{let o={};try{o=JSON.parse(i)}catch(t){}e({body:i,json:o,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})}))})).catch((t=>{i(t)}))}))},Kt=(t,e)=>Gt(t,JSON.stringify(e),!1,"application/json"),Yt=(t,e,i={})=>new Promise(((o,n)=>{Gt(t,e,i).then((e=>{e.status>=200&&e.status<400?o(e):n(t===Nt?e:"Server failure")})).catch((t=>{console.error(t),n(t)}))})),Jt=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:Jt(e):null}return null},Xt=(t,e,i=!1)=>{let o;return function(...n){const s=this,r=i&&!o;clearTimeout(o),o=setTimeout((function(){o=null,i||t.apply(s,n)}),e),r&&t.apply(s,n)}},Qt=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout((()=>{i=!0}),e))}},te=(t,e="and")=>1===t.length?t[0]:2===t.length?"object"==typeof t[0]?Z`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" "):"object"==typeof t[0]?t.map(((i,o)=>o<t.length-1?Z`${i}, `:Z`${e} ${i}`)):t.join(", ")+e+t[t.length-1],ee=(t,e,i="and")=>te(t.map(e),i);var ie;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(ie||(ie={}));const oe=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),ne=(t,e)=>{if(0==t)return"0 KB";const i=e||2,o=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,o)).toFixed(i))+" "+["B","KB","MB","GB"][o]},se=t=>{t&&(t.stopPropagation(),t.preventDefault())},re=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map((t=>t.substring(0,1))),o=i.filter(((t,e)=>t==t.toUpperCase()||0==e));return o.length>=2?(o[0]+o[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},ae=(t,e,i)=>{i/=100;const o=e*Math.min(i,1-i)/100,n=e=>{const n=(e+t/30)%12,s=i-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`},le=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){const o={};for(const i of e.keys())o[i]=[e[i],t[i]];qt(t.tagName,Bt.PURPLE,[i?"<first-updated>":"<updated>",o])}},he=(t,e,i=void 0)=>{(t.DEBUG_EVENTS||t.DEBUG)&&qt(t.tagName,Bt.GREEN,void 0!==i?[e,i]:[e])};class ce extends rt{constructor(){super(...arguments),this.DEBUG=!1,this.DEBUG_UPDATES=!1,this.DEBUG_EVENTS=!1,this.eles={}}getEventHandlers(){return[]}connectedCallback(){super.connectedCallback();for(const t of this.getEventHandlers())t.isDocument?document.addEventListener(t.event,t.method.bind(this)):t.isWindow?window.addEventListener(t.event,t.method.bind(this)):this.addEventListener(t.event,t.method.bind(this))}disconnectedCallback(){for(const t of this.getEventHandlers())t.isDocument?document.removeEventListener(t.event,t.method):t.isWindow?window.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),le(this,t,!0)}updated(t){super.updated(t),le(this,t,!1)}fireEvent(t){return he(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}swallowEvent(t){t.stopPropagation(),t.preventDefault()}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&he(this,t,e);const i=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});return this.dispatchEvent(i)}dispatchEvent(t){super.dispatchEvent(t);const e=t.target;if(e){const i=e["-"+t.type];if(i)return i(t);return new Function("event",`\n with(document) {\n with(this) {\n let handler = ${e.getAttribute("-"+t.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `).call(e,t)}}closestElement(t,e=this){return function e(i){if(!i||i===document||i===window)return null;i.assignedSlot&&(i=i.assignedSlot);const o=i.closest(t);return o||e(i.getRootNode().host)}(e)}getDiv(t){let e=this.eles[t];return e||(e=this.shadowRoot.querySelector(t),e&&(this.eles[t]=e),e)}stopEvent(t){t&&(t.stopPropagation(),t.preventDefault())}isMobile(){const t=window;return!!t.isMobile&&t.isMobile()}}
24
+ let rt=class extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const o=i?.renderBefore??e;let n=o._$litPart$;if(void 0===n){const t=i?.renderBefore??null;o._$litPart$=n=new Q(e.insertBefore(M(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};rt._$litElement$=!0,rt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:rt});const at=globalThis.litElementPolyfillSupport;at?.({LitElement:rt}),(globalThis.litElementVersions??=[]).push("4.0.4");var lt,ht,ct,dt,ut,pt,mt,gt,ft,vt,bt,yt,_t,xt,wt,kt,St,$t,Ct=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Et=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Tt=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let o=0;o<t.length;o++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(o);return e},At="0123456789abcdef".split(""),Lt=[-2147483648,8388608,32768,128],Ot=[24,16,8,0],Mt=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],zt=[];class Pt{constructor(t=!1,e=!1){lt.set(this,void 0),ht.set(this,void 0),ct.set(this,void 0),dt.set(this,void 0),ut.set(this,void 0),pt.set(this,void 0),mt.set(this,void 0),gt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),bt.set(this,void 0),yt.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),St.set(this,0),$t.set(this,void 0),this.init(t,e)}init(t,e){e?(zt[0]=zt[16]=zt[1]=zt[2]=zt[3]=zt[4]=zt[5]=zt[6]=zt[7]=zt[8]=zt[9]=zt[10]=zt[11]=zt[12]=zt[13]=zt[14]=zt[15]=0,Ct(this,ht,zt)):Ct(this,ht,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Ct(this,pt,3238371032),Ct(this,mt,914150663),Ct(this,gt,812702999),Ct(this,ft,4144912697),Ct(this,vt,4290775857),Ct(this,bt,1750603025),Ct(this,yt,1694076839),Ct(this,_t,3204075428)):(Ct(this,pt,1779033703),Ct(this,mt,3144134277),Ct(this,gt,1013904242),Ct(this,ft,2773480762),Ct(this,vt,1359893119),Ct(this,bt,2600822924),Ct(this,yt,528734635),Ct(this,_t,1541459225)),Ct(this,lt,Ct(this,$t,Ct(this,ct,Ct(this,wt,0)))),Ct(this,dt,Ct(this,xt,!1)),Ct(this,ut,!0),Ct(this,kt,t)}update(t){if(Et(this,dt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const o=e.length,n=Et(this,ht);for(;i<o;){let t;if(Et(this,xt)&&(Ct(this,xt,!1),n[0]=Et(this,lt),n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),"string"!=typeof e)for(t=Et(this,$t);i<o&&t<64;++i)n[t>>2]|=e[i]<<Ot[3&t++];else for(t=Et(this,$t);i<o&&t<64;++i){let o=e.charCodeAt(i);o<128?n[t>>2]|=o<<Ot[3&t++]:o<2048?(n[t>>2]|=(192|o>>6)<<Ot[3&t++],n[t>>2]|=(128|63&o)<<Ot[3&t++]):o<55296||o>=57344?(n[t>>2]|=(224|o>>12)<<Ot[3&t++],n[t>>2]|=(128|o>>6&63)<<Ot[3&t++],n[t>>2]|=(128|63&o)<<Ot[3&t++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++i)),n[t>>2]|=(240|o>>18)<<Ot[3&t++],n[t>>2]|=(128|o>>12&63)<<Ot[3&t++],n[t>>2]|=(128|o>>6&63)<<Ot[3&t++],n[t>>2]|=(128|63&o)<<Ot[3&t++])}Ct(this,St,t),Ct(this,ct,Et(this,ct)+(t-Et(this,$t))),t>=64?(Ct(this,lt,n[16]),Ct(this,$t,t-64),this.hash(),Ct(this,xt,!0)):Ct(this,$t,t)}return Et(this,ct)>4294967295&&(Ct(this,wt,Et(this,wt)+(Et(this,ct)/4294967296|0)),Ct(this,ct,Et(this,ct)%4294967296)),this}finalize(){if(Et(this,dt))return;Ct(this,dt,!0);const t=Et(this,ht),e=Et(this,St);t[16]=Et(this,lt),t[e>>2]|=Lt[3&e],Ct(this,lt,t[16]),e>=56&&(Et(this,xt)||this.hash(),t[0]=Et(this,lt),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=Et(this,wt)<<3|Et(this,ct)>>>29,t[15]=Et(this,ct)<<3,this.hash()}hash(){let t=Et(this,pt),e=Et(this,mt),i=Et(this,gt),o=Et(this,ft),n=Et(this,vt),s=Et(this,bt),r=Et(this,yt),a=Et(this,_t);const l=Et(this,ht);let h,c,d,u,p,m,g,f,v,b;for(let t=16;t<64;++t)u=l[t-15],h=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],c=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+h+l[t-7]+c|0;b=e&i;for(let y=0;y<64;y+=4)Et(this,ut)?(Et(this,kt)?(g=300032,u=l[0]-1413257819,a=u-150054599|0,o=u+24177077|0):(g=704751109,u=l[0]-210244248,a=u-1521486534|0,o=u+143694565|0),Ct(this,ut,!1)):(h=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),c=(n>>>6|n<<26)^(n>>>11|n<<21)^(n>>>25|n<<7),g=t&e,d=g^t&i^b,m=n&s^~n&r,u=a+c+m+Mt[y]+l[y],p=h+d,a=o+u|0,o=u+p|0),h=(o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10),c=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),f=o&t,d=f^o&e^g,m=a&n^~a&s,u=r+c+m+Mt[y+1]+l[y+1],p=h+d,r=i+u|0,i=u+p|0,h=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),c=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&o,d=v^i&t^f,m=r&a^~r&n,u=s+c+m+Mt[y+2]+l[y+2],p=h+d,s=e+u|0,e=u+p|0,h=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),c=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=e&i,d=b^e&o^v,m=s&r^~s&a,u=n+c+m+Mt[y+3]+l[y+3],p=h+d,n=t+u|0,t=u+p|0;Ct(this,pt,Et(this,pt)+t|0),Ct(this,mt,Et(this,mt)+e|0),Ct(this,gt,Et(this,gt)+i|0),Ct(this,ft,Et(this,ft)+o|0),Ct(this,vt,Et(this,vt)+n|0),Ct(this,bt,Et(this,bt)+s|0),Ct(this,yt,Et(this,yt)+r|0),Ct(this,_t,Et(this,_t)+a|0)}hex(){this.finalize();const t=Et(this,pt),e=Et(this,mt),i=Et(this,gt),o=Et(this,ft),n=Et(this,vt),s=Et(this,bt),r=Et(this,yt),a=Et(this,_t);let l=At[t>>28&15]+At[t>>24&15]+At[t>>20&15]+At[t>>16&15]+At[t>>12&15]+At[t>>8&15]+At[t>>4&15]+At[15&t]+At[e>>28&15]+At[e>>24&15]+At[e>>20&15]+At[e>>16&15]+At[e>>12&15]+At[e>>8&15]+At[e>>4&15]+At[15&e]+At[i>>28&15]+At[i>>24&15]+At[i>>20&15]+At[i>>16&15]+At[i>>12&15]+At[i>>8&15]+At[i>>4&15]+At[15&i]+At[o>>28&15]+At[o>>24&15]+At[o>>20&15]+At[o>>16&15]+At[o>>12&15]+At[o>>8&15]+At[o>>4&15]+At[15&o]+At[n>>28&15]+At[n>>24&15]+At[n>>20&15]+At[n>>16&15]+At[n>>12&15]+At[n>>8&15]+At[n>>4&15]+At[15&n]+At[s>>28&15]+At[s>>24&15]+At[s>>20&15]+At[s>>16&15]+At[s>>12&15]+At[s>>8&15]+At[s>>4&15]+At[15&s]+At[r>>28&15]+At[r>>24&15]+At[r>>20&15]+At[r>>16&15]+At[r>>12&15]+At[r>>8&15]+At[r>>4&15]+At[15&r];return Et(this,kt)||(l+=At[a>>28&15]+At[a>>24&15]+At[a>>20&15]+At[a>>16&15]+At[a>>12&15]+At[a>>8&15]+At[a>>4&15]+At[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=Et(this,pt),e=Et(this,mt),i=Et(this,gt),o=Et(this,ft),n=Et(this,vt),s=Et(this,bt),r=Et(this,yt),a=Et(this,_t),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,n>>24&255,n>>16&255,n>>8&255,255&n,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return Et(this,kt)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(Et(this,kt)?28:32),e=new DataView(t);return e.setUint32(0,Et(this,pt)),e.setUint32(4,Et(this,mt)),e.setUint32(8,Et(this,gt)),e.setUint32(12,Et(this,ft)),e.setUint32(16,Et(this,vt)),e.setUint32(20,Et(this,bt)),e.setUint32(24,Et(this,yt)),Et(this,kt)||e.setUint32(28,Et(this,_t)),t}}function It(t){const e=new Pt;return e.update(t),parseInt(e.hex().substring(0,8),16)}lt=new WeakMap,ht=new WeakMap,ct=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,mt=new WeakMap,gt=new WeakMap,ft=new WeakMap,vt=new WeakMap,bt=new WeakMap,yt=new WeakMap,_t=new WeakMap,xt=new WeakMap,wt=new WeakMap,kt=new WeakMap,St=new WeakMap,$t=new WeakMap;const Dt=function(t,e,i){var o=i<.5?i*(1+e):i+e-i*e,n=2*i-o;return[(t/=360)+1/3,t,t-1/3].map((function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(o-n)*t:t<.5?o:t<2/3?n+6*(o-n)*(2/3-t):n,Math.round(255*t)}))};const Nt="/api/v2/media.json",Rt=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map((function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]}));this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map((function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}})),this.hash=It,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Tt)}hsl(t){var e,i,o=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[o%this.hueRanges.length];e=o/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=o%359;return o=Math.ceil(o/360),i=this.S[o%this.S.length],o=Math.ceil(o/this.S.length),[e,i,this.L[o%this.L.length]]}rgb(t){var e=this.hsl(t);return Dt.apply(this,e)}hex(t){var e,i=this.rgb(t);return e="#",i.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}};var Bt;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(Bt||(Bt={}));const qt=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},Ut=(t={})=>{const e=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let o=e.substr(0,i),n=e.substr(i+1);if(o=o.trim(),n=n.trim(),o===t)return n}return null})("csrftoken"),i=e?{"X-CSRFToken":e}:{};return i["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{i[e]=t[e]})),i},Ft=(t,e=null,i={})=>new Promise(((o,n)=>{const s={method:"GET",headers:Ut(i)};e&&(s.signal=e.signal),fetch(t,s).then((t=>{t.text().then((i=>{let n={};try{n=JSON.parse(i)}catch(t){}o({controller:e,body:i,json:n,url:t.url,headers:t.headers,status:t.status})}))})).catch((t=>{n(t)}))})),Zt=t=>{const e=[];Object.keys(t).forEach((i=>{t[i]&&e.push(i)}));let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},Vt=(t,e=null)=>new Promise(((i,o)=>{Ft(t,e).then((t=>{i({results:t.json.results,next:t.json.next})})).catch((t=>o(t)))})),jt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Vt(i);t.results&&(e=e.concat(t.results)),i=t.next}return e},Ht=t=>new Promise(((e,i)=>{Ft(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),Wt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Ht(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},Gt=(t,e,i={},o=null)=>{const n=Ut(i);o&&(n["Content-Type"]=o);const s={method:"POST",headers:n,body:e};return new Promise(((e,i)=>{fetch(t,s).then((async t=>{t.status>=500?i(t):t.text().then((i=>{let o={};try{o=JSON.parse(i)}catch(t){}e({body:i,json:o,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})}))})).catch((t=>{i(t)}))}))},Kt=(t,e)=>Gt(t,JSON.stringify(e),!1,"application/json"),Yt=(t,e,i={})=>new Promise(((o,n)=>{Gt(t,e,i).then((e=>{e.status>=200&&e.status<400?o(e):n(t===Nt?e:"Server failure")})).catch((t=>{console.error(t),n(t)}))})),Jt=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:Jt(e):null}return null},Xt=(t,e,i=!1)=>{let o;return function(...n){const s=this,r=i&&!o;clearTimeout(o),o=setTimeout((function(){o=null,i||t.apply(s,n)}),e),r&&t.apply(s,n)}},Qt=(t,e)=>{let i=!0;return function(...o){i&&(i=!1,t.apply(this,o),setTimeout((()=>{i=!0}),e))}},te=(t,e="and")=>1===t.length?t[0]:2===t.length?"object"==typeof t[0]?Z`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" "):"object"==typeof t[0]?t.map(((i,o)=>o<t.length-1?Z`${i}, `:Z`${e} ${i}`)):t.join(", ")+e+t[t.length-1],ee=(t,e,i="and")=>te(t.map(e),i);var ie;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(ie||(ie={}));const oe=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),ne=(t,e)=>{if(0==t)return"0 KB";const i=e||2,o=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,o)).toFixed(i))+" "+["B","KB","MB","GB"][o]},se=t=>{t&&(t.stopPropagation(),t.preventDefault())},re=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map((t=>t.substring(0,1))),o=i.filter(((t,e)=>t==t.toUpperCase()||0==e));return o.length>=2?(o[0]+o[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},ae=(t,e,i)=>{i/=100;const o=e*Math.min(i,1-i)/100,n=e=>{const n=(e+t/30)%12,s=i-o*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${n(0)}${n(8)}${n(4)}`},le=(t,e,i=!1)=>{if((t.DEBUG_UPDATES||t.DEBUG)&&e.size>0){const o={};for(const i of e.keys())o[i]=[e[i],t[i]];qt(t.tagName,Bt.PURPLE,[i?"<first-updated>":"<updated>",o])}},he=(t,e,i=void 0)=>{(t.DEBUG_EVENTS||t.DEBUG)&&qt(t.tagName,Bt.GREEN,void 0!==i?[e,i]:[e])};class ce extends rt{constructor(){super(...arguments),this.DEBUG=!1,this.DEBUG_UPDATES=!1,this.DEBUG_EVENTS=!1,this.eles={}}getEventHandlers(){return[]}connectedCallback(){super.connectedCallback();for(const t of this.getEventHandlers())t.isDocument?document.addEventListener(t.event,t.method.bind(this)):t.isWindow?window.addEventListener(t.event,t.method.bind(this)):this.addEventListener(t.event,t.method.bind(this))}disconnectedCallback(){for(const t of this.getEventHandlers())t.isDocument?document.removeEventListener(t.event,t.method):t.isWindow?window.removeEventListener(t.event,t.method):this.removeEventListener(t.event,t.method);super.disconnectedCallback()}firstUpdated(t){super.firstUpdated(t),le(this,t,!0)}updated(t){super.updated(t),le(this,t,!1)}fireEvent(t){return he(this,t),this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))}swallowEvent(t){t.stopPropagation(),t.preventDefault()}fireCustomEvent(t,e={}){this.DEBUG_EVENTS&&he(this,t,e);const i=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0});return this.dispatchEvent(i)}dispatchEvent(t){super.dispatchEvent(t);const e=t.target;if(e){const i=e["-"+t.type];if(i)return i(t);return new Function("event",`\n with(document) {\n with(this) {\n let handler = ${e.getAttribute("-"+t.type)};\n if(typeof handler === 'function') { \n handler(event);\n }\n }\n }\n `).call(e,t)}}closestElement(t,e=this){return function e(i){if(!i||i===document||i===window)return null;i.assignedSlot&&(i=i.assignedSlot);const o=i.closest(t);return o||e(i.getRootNode().host)}(e)}getDiv(t){let e=this.eles[t];return e||(e=this.shadowRoot.querySelector(t),e&&(this.eles[t]=e),e)}stopEvent(t){t&&(t.stopPropagation(),t.preventDefault())}isMobile(){const t=window;return!!t.isMobile&&t.isMobile()}}
25
25
  /**
26
26
  * @license
27
27
  * Copyright 2017 Google LLC
@@ -876,7 +876,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
876
876
  pointer-events: none;
877
877
  padding: 0px;
878
878
  }
879
- `}handleSlotChange(){if(0===this.staticOptions.length)for(const t of this.children)if("TEMBA-OPTION"===t.tagName){const e={};for(const i of t.attributes)e[i.name]=i.value;e&&(this.staticOptions.push(e),null===t.getAttribute("selected")&&this.getValue(e)!=this.value||(null!==this.getAttribute("multi")?this.addValue(e):this.setValues([e])))}this.checkSelectedOption(),this.searchable&&0===this.staticOptions.length&&(this.quietMillis=200)}checkSelectedOption(){if(0===this.values.length&&(!this.placeholder||this.value))if(0==this.staticOptions.length&&this.endpoint){const t=this.value;jt(this.endpoint).then((e=>{if(e&&e.length>0){if(t){const i=e.find((e=>this.getValue(e)===t));if(i)return void this.setValues([i])}this.setValues([e[0]])}}))}else this.staticOptions.length>0&&(null!==this.getAttribute("multi")?this.addValue(this.staticOptions[0]):this.setValues([this.staticOptions[0]]))}firstUpdated(t){super.firstUpdated(t),this.anchorElement=this.shadowRoot.querySelector(".select-container"),this.anchorExpressions=this.shadowRoot.querySelector("#anchor"),this.shadowRoot.addEventListener("slotchange",this.handleSlotChange.bind(this)),this.checkSelectedOption()}updated(t){if(super.updated(t),t.has("values")&&(this.updateInputs(),(this.multi||1===this.values.length||0==this.values.length&&t.get("values")&&t.get("values").length>0)&&this.fireEvent("change")),t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(Ae.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&this.fetchOptions(this.query,this.page+1),t.has("value")&&this.value&&!this.values.length&&this.staticOptions.length>0){const t=this.staticOptions.find((t=>this.getValue(t)===this.value));t&&this.setValues([t])}0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&(this.multi||1!==this.values.length?this.inputRoot.parentElement&&this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)})):(this.selection=this.values[0],this.value=this.serializeValue(this.values[0])))}}setSelectedOption(t){this.multi?this.addValue(t):this.setValues([t]),this.multi&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1}isPastFetchThreshold(){return(this.visibleOptions.length>0||this.next)&&!this.complete&&(this.cursorIndex||0)>this.visibleOptions.length-20}handleOptionSelection(t){const e=t.detail.selected;e.post&&this.endpoint?Kt(this.endpoint,e).then((t=>{t.status>=200&&t.status<300?(this.setSelectedOption(t.json),this.lruCache=Me(20,6e4)):this.blur()})):this.setSelectedOption(e)}handleExpressionSelection(t){const e=t.detail.selected,i=t.detail.tabbed,o=this.shadowRoot.querySelector(".searchbox");ja(this.query,o,e),this.query="",this.completionOptions=[],i?this.fetchExpressions():-1===this.input.indexOf("(")&&this.addInputAsValue()}getOptionsDefault(t){return t.json.results}isCompleteDefault(t,e){const i=e.json;return!i.more&&!i.next}handleRemoveSelection(t){this.removeValue(t),this.visibleOptions=[]}createArbitraryOptionDefault(){return null}open(){this.requestUpdate("input")}isOpen(){return this.visibleOptions.length>0}setOptions(t){this.staticOptions=t}setVisibleOptions(t){if(t=t.filter((t=>!!this.getNameInternal(t)&&(!this.shouldExclude||!this.shouldExclude(t)))),this.input){if(this.searchable&&!this.queryParam){const e=this.input.trim().toLowerCase();t=t.filter((t=>this.isMatch(t,e)))}const e=this.createArbitraryOption(this.input,t);if(e){e.arbitrary=!0;t.find((t=>this.getValue(t)===this.getValue(e)))||(t.length>0&&t[0].arbitrary?t[0]=e:t.unshift(e))}}this.values.length>0&&(this.multi?t=t.filter((t=>!this.values.find((e=>this.getValue(e)===this.getValue(t))))):(this.input?this.cursorIndex=0:this.cursorIndex=t.findIndex((t=>this.getValue(t)===this.getValue(this.values[0]))),this.requestUpdate("cursorIndex"))),this.sortFunction&&t.sort(this.sortFunction),this.visibleOptions=t,this.fireCustomEvent(Ae.ContentChanged,{options:this.visibleOptions})}fetchExpressions(){const t=document.querySelector("temba-store");if(this.expressions&&t){const e=this.shadowRoot.querySelector(".searchbox"),i=Ha(e,t,"session"===this.expressions);return this.query=i.query,this.completionOptions=i.options,this.visibleOptions=[],this.anchorPosition=i.anchorPosition,void this.fireCustomEvent(Ae.FetchComplete)}}fetchOptions(t,e=0){if(this.completionOptions=[],!this.fetching){this.fetching=!0;const i=[...this.staticOptions],o=(t||"").trim().toLowerCase();if(this.tags&&o&&(i.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===o))||i.splice(0,0,{name:t,value:t})),this.endpoint){let n=this.endpoint;t&&this.queryParam&&(n.indexOf("?")>-1?n+="&":n+="?",n+=this.queryParam+"="+encodeURIComponent(t)),e&&(n.indexOf("?")>-1?n+="&":n+="?",n+="page="+e),this.next&&(n=this.next);const s=this.lruCache.get(n);if(this.cache&&!this.tags&&s)return 0!==e||this.next?this.setVisibleOptions([...this.visibleOptions,...s.options]):(this.cursorIndex=0,this.setVisibleOptions([...i,...s.options])),this.complete=s.complete,this.next=s.next,void(this.fetching=!1);this.searchable&&!this.queryParam?jt(n).then((t=>{this.cache&&!this.tags&&(this.lruCache.set(n,{options:t,complete:!0,next:null}),this.complete=!0,this.next=null,this.setVisibleOptions([...i,...t]),this.fetching=!1)})):Ft(n).then((s=>{const r=this.getOptions(s).filter((t=>this.isMatch(t,o))),a=s.json;a.next&&(this.next=a.next),0!==e||this.next?(r.length>0&&this.setVisibleOptions([...this.visibleOptions,...r]),this.complete=this.isComplete(r,s)):(this.cursorIndex=0,this.setVisibleOptions([...i,...r]),this.query=t,this.complete=this.isComplete(this.visibleOptions,s)),this.cache&&!this.tags&&this.lruCache.set(n,{options:r,complete:this.complete,next:this.next}),this.fetching=!1,this.page=e})).catch((t=>{this.fetching=!1,console.error(t)}))}else this.fetching=!1,this.setVisibleOptions(i)}}handleFocus(){this.focused||0!==this.visibleOptions.length||(this.focused=!0,this.searchOnFocus&&!this.removingSelection&&this.requestUpdate("input"))}handleBlur(){this.focused=!1,this.visibleOptions.length>0&&(this.input="",this.next=null,this.complete=!0,this.visibleOptions=[],this.cursorIndex=0)}handleClick(){this.selectedIndex=-1,this.requestUpdate("input")}addInputAsValue(){const t=this.shadowRoot.querySelector(".searchbox"),e={name:t.value,value:t.value,expression:!0};this.multi?this.values.find((t=>t.expression&&t.value&&e.value&&t.value.toLowerCase().trim()==e.value.toLowerCase().trim()))||this.addValue(e):this.setValues([e]),this.input="",this.multi||this.blur()}handleKeyDown(t){if("Enter"===t.key&&this.expressions&&0===this.completionOptions.length&&this.input.indexOf("@")>-1&&this.addInputAsValue(),("Enter"===t.key||"ArrowDown"===t.key||"n"===t.key&&t.ctrlKey)&&0===this.visibleOptions.length&&0===this.completionOptions.length)this.requestUpdate("input");else if(this.multi&&"Backspace"===t.key&&!this.input){if(this.visibleOptions.length>0)return void(this.visibleOptions=[]);-1===this.selectedIndex?(this.selectedIndex=this.values.length-1,this.visibleOptions=[]):(this.popValue(),this.selectedIndex=-1)}else this.selectedIndex=-1}getStaticOptions(){return this.staticOptions}handleInput(t){const e=t.currentTarget;this.input=e.value}handleCancel(){this.visibleOptions=[]}handleCursorChanged(t){this.cursorIndex=t.detail.index}handleContainerClick(t){if(this.focused=!0,"INPUT"!==t.target.tagName){const e=this.shadowRoot.querySelector("input");if(e)return e.click(),void e.focus();this.visibleOptions.length>0?(this.visibleOptions=[],t.preventDefault(),t.stopPropagation()):this.requestUpdate("input")}}getEventHandlers(){return[{event:Ae.Canceled,method:this.handleCancel},{event:Ae.CursorChanged,method:this.handleCursorChanged},{event:"blur",method:this.handleBlur},{event:"focus",method:this.handleFocus}]}handleArrowClick(t){this.visibleOptions.length>0&&(this.visibleOptions=[],t.preventDefault(),t.stopPropagation())}renderSelectedItemDefault(t){return t?Z`
879
+ `}handleSlotChange(){if(0===this.staticOptions.length)for(const t of this.children)if("TEMBA-OPTION"===t.tagName){const e={};for(const i of t.attributes)e[i.name]=i.value;e&&(this.staticOptions.push(e),null===t.getAttribute("selected")&&this.getValue(e)!=this.value||(null!==this.getAttribute("multi")?this.addValue(e):this.setValues([e])))}this.checkSelectedOption(),this.searchable&&0===this.staticOptions.length&&(this.quietMillis=200)}checkSelectedOption(){if(0===this.values.length&&(!this.placeholder||this.value))if(0==this.staticOptions.length&&this.endpoint){const t=this.value;jt(this.endpoint).then((e=>{if(e&&e.length>0){if(t){const i=e.find((e=>this.getValue(e)===t));if(i)return void this.setValues([i])}this.setValues([e[0]])}}))}else this.staticOptions.length>0&&(null!==this.getAttribute("multi")?this.addValue(this.staticOptions[0]):this.setValues([this.staticOptions[0]]))}firstUpdated(t){super.firstUpdated(t),this.anchorElement=this.shadowRoot.querySelector(".select-container"),this.anchorExpressions=this.shadowRoot.querySelector("#anchor"),this.shadowRoot.addEventListener("slotchange",this.handleSlotChange.bind(this)),this.checkSelectedOption()}updated(t){super.updated(t),t.has("values")&&(this.updateInputs(),(this.multi||1===this.values.length||0==this.values.length&&t.get("values")&&t.get("values").length>0)&&this.fireEvent("change")),t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(Ae.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&this.fetchOptions(this.query,this.page+1),t.has("value")&&this.value&&!this.values.length&&this.setSelectedValue(this.value),0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}setSelectedValue(t){if(this.staticOptions.length>0){const e=this.staticOptions.find((e=>this.getValue(e)===t));e&&this.setValues([e])}}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&(this.multi||1!==this.values.length?this.inputRoot.parentElement&&this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)})):(this.selection=this.values[0],this.value=this.serializeValue(this.values[0])))}}setSelectedOption(t){this.multi?this.addValue(t):this.setValues([t]),this.multi&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1}isPastFetchThreshold(){return(this.visibleOptions.length>0||this.next)&&!this.complete&&(this.cursorIndex||0)>this.visibleOptions.length-20}handleOptionSelection(t){const e=t.detail.selected;e.post&&this.endpoint?Kt(this.endpoint,e).then((t=>{t.status>=200&&t.status<300?(this.setSelectedOption(t.json),this.lruCache=Me(20,6e4)):this.blur()})):this.setSelectedOption(e)}handleExpressionSelection(t){const e=t.detail.selected,i=t.detail.tabbed,o=this.shadowRoot.querySelector(".searchbox");ja(this.query,o,e),this.query="",this.completionOptions=[],i?this.fetchExpressions():-1===this.input.indexOf("(")&&this.addInputAsValue()}getOptionsDefault(t){return t.json.results}isCompleteDefault(t,e){const i=e.json;return!i.more&&!i.next}handleRemoveSelection(t){this.removeValue(t),this.visibleOptions=[]}createArbitraryOptionDefault(){return null}open(){this.requestUpdate("input")}isOpen(){return this.visibleOptions.length>0}setOptions(t){this.staticOptions=t}setVisibleOptions(t){if(t=t.filter((t=>!!this.getNameInternal(t)&&(!this.shouldExclude||!this.shouldExclude(t)))),this.input){if(this.searchable&&!this.queryParam){const e=this.input.trim().toLowerCase();t=t.filter((t=>this.isMatch(t,e)))}const e=this.createArbitraryOption(this.input,t);if(e){e.arbitrary=!0;t.find((t=>this.getValue(t)===this.getValue(e)))||(t.length>0&&t[0].arbitrary?t[0]=e:t.unshift(e))}}this.values.length>0&&(this.multi?t=t.filter((t=>!this.values.find((e=>this.getValue(e)===this.getValue(t))))):(this.input?this.cursorIndex=0:this.cursorIndex=t.findIndex((t=>this.getValue(t)===this.getValue(this.values[0]))),this.requestUpdate("cursorIndex"))),this.sortFunction&&t.sort(this.sortFunction),this.visibleOptions=t,this.fireCustomEvent(Ae.ContentChanged,{options:this.visibleOptions})}fetchExpressions(){const t=document.querySelector("temba-store");if(this.expressions&&t){const e=this.shadowRoot.querySelector(".searchbox"),i=Ha(e,t,"session"===this.expressions);return this.query=i.query,this.completionOptions=i.options,this.visibleOptions=[],this.anchorPosition=i.anchorPosition,void this.fireCustomEvent(Ae.FetchComplete)}}fetchOptions(t,e=0){if(this.completionOptions=[],!this.fetching){this.fetching=!0;const i=[...this.staticOptions],o=(t||"").trim().toLowerCase();if(this.tags&&o&&(i.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===o))||i.splice(0,0,{name:t,value:t})),this.endpoint){let n=this.endpoint;t&&this.queryParam&&(n.indexOf("?")>-1?n+="&":n+="?",n+=this.queryParam+"="+encodeURIComponent(t)),e&&(n.indexOf("?")>-1?n+="&":n+="?",n+="page="+e),this.next&&(n=this.next);const s=this.lruCache.get(n);if(this.cache&&!this.tags&&s)return 0!==e||this.next?this.setVisibleOptions([...this.visibleOptions,...s.options]):(this.cursorIndex=0,this.setVisibleOptions([...i,...s.options])),this.complete=s.complete,this.next=s.next,void(this.fetching=!1);this.searchable&&!this.queryParam?jt(n).then((t=>{this.cache&&!this.tags&&(this.lruCache.set(n,{options:t,complete:!0,next:null}),this.complete=!0,this.next=null,this.setVisibleOptions([...i,...t]),this.fetching=!1)})):Ft(n).then((s=>{const r=this.getOptions(s).filter((t=>this.isMatch(t,o))),a=s.json;a.next&&(this.next=a.next),0!==e||this.next?(r.length>0&&this.setVisibleOptions([...this.visibleOptions,...r]),this.complete=this.isComplete(r,s)):(this.cursorIndex=0,this.setVisibleOptions([...i,...r]),this.query=t,this.complete=this.isComplete(this.visibleOptions,s)),this.cache&&!this.tags&&this.lruCache.set(n,{options:r,complete:this.complete,next:this.next}),this.fetching=!1,this.page=e})).catch((t=>{this.fetching=!1,console.error(t)}))}else this.fetching=!1,this.setVisibleOptions(i)}}handleFocus(){this.focused||0!==this.visibleOptions.length||(this.focused=!0,this.searchOnFocus&&!this.removingSelection&&this.requestUpdate("input"))}handleBlur(){this.focused=!1,this.visibleOptions.length>0&&(this.input="",this.next=null,this.complete=!0,this.visibleOptions=[],this.cursorIndex=0)}handleClick(){this.selectedIndex=-1,this.requestUpdate("input")}addInputAsValue(){const t=this.shadowRoot.querySelector(".searchbox"),e={name:t.value,value:t.value,expression:!0};this.multi?this.values.find((t=>t.expression&&t.value&&e.value&&t.value.toLowerCase().trim()==e.value.toLowerCase().trim()))||this.addValue(e):this.setValues([e]),this.input="",this.multi||this.blur()}handleKeyDown(t){if("Enter"===t.key&&this.expressions&&0===this.completionOptions.length&&this.input.indexOf("@")>-1&&this.addInputAsValue(),("Enter"===t.key||"ArrowDown"===t.key||"n"===t.key&&t.ctrlKey)&&0===this.visibleOptions.length&&0===this.completionOptions.length)this.requestUpdate("input");else if(this.multi&&"Backspace"===t.key&&!this.input){if(this.visibleOptions.length>0)return void(this.visibleOptions=[]);-1===this.selectedIndex?(this.selectedIndex=this.values.length-1,this.visibleOptions=[]):(this.popValue(),this.selectedIndex=-1)}else this.selectedIndex=-1}getStaticOptions(){return this.staticOptions}handleInput(t){const e=t.currentTarget;this.input=e.value}handleCancel(){this.visibleOptions=[]}handleCursorChanged(t){this.cursorIndex=t.detail.index}handleContainerClick(t){if(this.focused=!0,"INPUT"!==t.target.tagName){const e=this.shadowRoot.querySelector("input");if(e)return e.click(),void e.focus();this.visibleOptions.length>0?(this.visibleOptions=[],t.preventDefault(),t.stopPropagation()):this.requestUpdate("input")}}getEventHandlers(){return[{event:Ae.Canceled,method:this.handleCancel},{event:Ae.CursorChanged,method:this.handleCursorChanged},{event:"blur",method:this.handleBlur},{event:"focus",method:this.handleFocus}]}handleArrowClick(t){this.visibleOptions.length>0&&(this.visibleOptions=[],t.preventDefault(),t.stopPropagation())}renderSelectedItemDefault(t){return t?Z`
880
880
  <div class="option-name" style="display:flex">
881
881
  ${t.icon?Z`<temba-icon
882
882
  name="${t.icon}"
@@ -2076,7 +2076,7 @@ class rr extends xe{constructor(t){if(super(t),this.it=j,t.type!==ye)throw Error
2076
2076
  max-height: 0;
2077
2077
  display: flex;
2078
2078
  flex-direction: column;
2079
- user-select: none;
2079
+ user-select: auto;
2080
2080
  }
2081
2081
 
2082
2082
  .grouping.flows .items {