@encheres-immo/auction-widget
Advanced tools
Comparing version 0.3.1 to 0.4.0
# @encheres-immo/auction-widget | ||
## 0.4.0 | ||
### Minor Changes | ||
- 65b24d5: Add an optional attribute to allow users to register for the auction—This registration must be accepted by the agent later, or the user will not be able to place bids. If set to false, agent's contact information will be displayed instead. | ||
```html | ||
<div | ||
id="auction-widget" | ||
[... | ||
other | ||
attributes] | ||
allow-user-registration="false" | ||
></div> | ||
``` | ||
Default value is `true`. | ||
### Patch Changes | ||
- ec8113d: Fixed an issue where bid history was visible to non-participants in private auctions. | ||
- 582816d: Fixes several edge cases where the information displayed did not match the user's permissions/state. | ||
- Updated dependencies [65b24d5] | ||
- @encheres-immo/widget-client@0.4.0 | ||
## 0.3.1 | ||
@@ -4,0 +29,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";(()=>{var D={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return gt(this.context.count)},getNextContextId(){return gt(this.context.count++)}};function gt(e){let t=String(e),n=t.length-1;return D.context.id+(n?String.fromCharCode(96+n):"")+t}function mt(e){D.context=e}function mn(){return{...D.context,id:D.getNextContextId(),count:0}}var pn=(e,t)=>e===t,ne=Symbol("solid-proxy");var Re=Symbol("solid-track"),Mi=Symbol("solid-dev-component"),Pe={equals:pn},pt=null,wn=Ct,F=1,ve=2,St={owned:null,cleanups:null,context:null,owner:null};var v=null,f=null,Se=null,fe=null,$=null,O=null,L=null,De=0;function ye(e,t){let n=$,i=v,s=e.length===0,r=t===void 0?i:t,l=s?St:{owned:null,cleanups:null,context:r?r.context:null,owner:r},o=s?e:()=>e(()=>H(()=>te(l)));v=l,$=null;try{return K(o,!0)}finally{$=n,v=i}}function S(e,t){t=t?Object.assign({},Pe,t):Pe;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=s=>(typeof s=="function"&&(f&&f.running&&f.sources.has(n)?s=s(n.tValue):s=s(n.value)),_t(n,s));return[$t.bind(n),i]}function q(e,t,n){let i=At(e,t,!1,F);Se&&f&&f.running?O.push(i):Le(i)}function T(e,t,n){n=n?Object.assign({},Pe,n):Pe;let i=At(e,t,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,Se&&f&&f.running?(i.tState=F,O.push(i)):Le(i),$t.bind(i)}function xt(e){return K(e,!1)}function H(e){if(!fe&&$===null)return e();let t=$;$=null;try{return fe?fe.untrack(e):e()}finally{$=t}}function Je(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function Ie(){return $}function bn(e){if(f&&f.running)return e(),f.done;let t=$,n=v;return Promise.resolve().then(()=>{$=t,v=n;let i;return(Se||vn)&&(i=f||(f={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),i.done||(i.done=new Promise(s=>i.resolve=s)),i.running=!0),K(e,!1),$=v=null,i?i.done:void 0})}var[Ni,wt]=S(!1);function yn(e){let t=T(e),n=T(()=>Ge(t()));return n.toArray=()=>{let i=n();return Array.isArray(i)?i:i!=null?[i]:[]},n}var vn;function $t(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===F)Le(this);else{let t=O;O=null,K(()=>je(this),!1),O=t}if($){let t=this.observers?this.observers.length:0;$.sources?($.sources.push(this),$.sourceSlots.push(t)):($.sources=[this],$.sourceSlots=[t]),this.observers?(this.observers.push($),this.observerSlots.push($.sources.length-1)):(this.observers=[$],this.observerSlots=[$.sources.length-1])}return e&&f.sources.has(this)?this.tValue:this.value}function _t(e,t,n){let i=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(i,t)){if(f){let s=f.running;(s||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&K(()=>{for(let s=0;s<e.observers.length;s+=1){let r=e.observers[s],l=f&&f.running;l&&f.disposed.has(r)||((l?!r.tState:!r.state)&&(r.pure?O.push(r):L.push(r),r.observers&&kt(r)),l?r.tState=F:r.state=F)}if(O.length>1e6)throw O=[],new Error},!1)}return t}function Le(e){if(!e.fn)return;te(e);let t=De;bt(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{K(()=>{f&&(f.running=!0),$=v=e,bt(e,e.tValue,t),$=v=null},!1)})}function bt(e,t,n){let i,s=v,r=$;$=v=e;try{i=e.fn(t)}catch(l){return e.pure&&(f&&f.running?(e.tState=F,e.tOwned&&e.tOwned.forEach(te),e.tOwned=void 0):(e.state=F,e.owned&&e.owned.forEach(te),e.owned=null)),e.updatedAt=n+1,Xe(l)}finally{$=r,v=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?_t(e,i,!0):f&&f.running&&e.pure?(f.sources.add(e),e.tValue=i):e.value=i,e.updatedAt=n)}function At(e,t,n,i=F,s){let r={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};if(f&&f.running&&(r.state=0,r.tState=i),v===null||v!==St&&(f&&f.running&&v.pure?v.tOwned?v.tOwned.push(r):v.tOwned=[r]:v.owned?v.owned.push(r):v.owned=[r]),fe&&r.fn){let[l,o]=S(void 0,{equals:!1}),a=fe.factory(r.fn,o);Je(()=>a.dispose());let u=()=>bn(o).then(()=>d.dispose()),d=fe.factory(r.fn,u);r.fn=c=>(l(),f&&f.running?d.track(c):a.track(c))}return r}function Ye(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===ve)return je(e);if(e.suspense&&H(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<De);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let i=n.length-1;i>=0;i--){if(e=n[i],t){let s=e,r=n[i+1];for(;(s=s.owner)&&s!==r;)if(f.disposed.has(s))return}if((t?e.tState:e.state)===F)Le(e);else if((t?e.tState:e.state)===ve){let s=O;O=null,K(()=>je(e,n[0]),!1),O=s}}}function K(e,t){if(O)return e();let n=!1;t||(O=[]),L?n=!0:L=[],De++;try{let i=e();return Sn(n),i}catch(i){n||(L=null),O=null,Xe(i)}}function Sn(e){if(O&&(Se&&f&&f.running?xn(O):Ct(O),O=null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let i=f.sources,s=f.disposed;L.push.apply(L,f.effects),t=f.resolve;for(let r of L)"tState"in r&&(r.state=r.tState),delete r.tState;f=null,K(()=>{for(let r of s)te(r);for(let r of i){if(r.value=r.tValue,r.owned)for(let l=0,o=r.owned.length;l<o;l++)te(r.owned[l]);r.tOwned&&(r.owned=r.tOwned),delete r.tValue,delete r.tOwned,r.tState=0}wt(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,L),L=null,wt(!0);return}}let n=L;L=null,n.length&&K(()=>wn(n),!1),t&&t()}function Ct(e){for(let t=0;t<e.length;t++)Ye(e[t])}function xn(e){for(let t=0;t<e.length;t++){let n=e[t],i=f.queue;i.has(n)||(i.add(n),Se(()=>{i.delete(n),K(()=>{f.running=!0,Ye(n)},!1),f&&(f.running=!1)}))}}function je(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let i=0;i<e.sources.length;i+=1){let s=e.sources[i];if(s.sources){let r=n?s.tState:s.state;r===F?s!==t&&(!s.updatedAt||s.updatedAt<De)&&Ye(s):r===ve&&je(s,t)}}}function kt(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let i=e.observers[n];(t?!i.tState:!i.state)&&(t?i.tState=ve:i.state=ve,i.pure?O.push(i):L.push(i),i.observers&&kt(i))}}function te(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),i=e.sourceSlots.pop(),s=n.observers;if(s&&s.length){let r=s.pop(),l=n.observerSlots.pop();i<s.length&&(r.sourceSlots[l]=i,s[i]=r,n.observerSlots[i]=l)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)te(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)Tt(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)te(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function Tt(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let n=0;n<e.owned.length;n++)Tt(e.owned[n])}function $n(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function yt(e,t,n){try{for(let i of t)i(e)}catch(i){Xe(i,n&&n.owner||null)}}function Xe(e,t=v){let n=pt&&t&&t.context&&t.context[pt],i=$n(e);if(!n)throw i;L?L.push({fn(){yt(i,n,t)},state:F}):yt(i,n,t)}function Ge(e){if(typeof e=="function"&&!e.length)return Ge(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let i=Ge(e[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}return e}var _n=Symbol("fallback");function vt(e){for(let t=0;t<e.length;t++)e[t]()}function An(e,t,n={}){let i=[],s=[],r=[],l=0,o=t.length>1?[]:null;return Je(()=>vt(r)),()=>{let a=e()||[],u=a.length,d,c;return a[Re],H(()=>{let b,x,C,j,B,_,R,I,W;if(u===0)l!==0&&(vt(r),r=[],i=[],s=[],l=0,o&&(o=[])),n.fallback&&(i=[_n],s[0]=ye(pe=>(r[0]=pe,n.fallback())),l=1);else if(l===0){for(s=new Array(u),c=0;c<u;c++)i[c]=a[c],s[c]=ye(w);l=u}else{for(C=new Array(u),j=new Array(u),o&&(B=new Array(u)),_=0,R=Math.min(l,u);_<R&&i[_]===a[_];_++);for(R=l-1,I=u-1;R>=_&&I>=_&&i[R]===a[I];R--,I--)C[I]=s[R],j[I]=r[R],o&&(B[I]=o[R]);for(b=new Map,x=new Array(I+1),c=I;c>=_;c--)W=a[c],d=b.get(W),x[c]=d===void 0?-1:d,b.set(W,c);for(d=_;d<=R;d++)W=i[d],c=b.get(W),c!==void 0&&c!==-1?(C[c]=s[d],j[c]=r[d],o&&(B[c]=o[d]),c=x[c],b.set(W,c)):r[d]();for(c=_;c<u;c++)c in C?(s[c]=C[c],r[c]=j[c],o&&(o[c]=B[c],o[c](c))):s[c]=ye(w);s=s.slice(0,l=u),i=a.slice(0)}return s});function w(b){if(r[c]=b,o){let[x,C]=S(c);return o[c]=C,t(a[c],x)}return t(a[c])}}}var Cn=!1;function m(e,t){if(Cn&&D.context){let n=D.context;mt(mn());let i=H(()=>e(t||{}));return mt(n),i}return H(()=>e(t||{}))}var Et=e=>`Stale read from <${e}>.`;function Qe(e){let t="fallback"in e&&{fallback:()=>e.fallback};return T(An(()=>e.each,e.children,t||void 0))}function A(e){let t=e.keyed,n=T(()=>e.when,void 0,{equals:(i,s)=>t?i===s:!i==!s});return T(()=>{let i=n();if(i){let s=e.children;return typeof s=="function"&&s.length>0?H(()=>s(t?i:()=>{if(!H(n))throw Et("Show");return e.when})):s}return e.fallback},void 0,void 0)}function Ze(e){let t=!1,n=(r,l)=>(t?r[1]===l[1]:!r[1]==!l[1])&&r[2]===l[2],i=yn(()=>e.children),s=T(()=>{let r=i();Array.isArray(r)||(r=[r]);for(let l=0;l<r.length;l++){let o=r[l].when;if(o)return t=!!r[l].keyed,[l,o,r[l]]}return[-1]},void 0,{equals:n});return T(()=>{let[r,l,o]=s();if(r<0)return e.fallback;let a=o.children;return typeof a=="function"&&a.length>0?H(()=>a(t?l:()=>{if(H(s)[0]!==r)throw Et("Match");return o.when})):a},void 0,void 0)}function Y(e){return e}var Tn=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Xi=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Tn]);function En(e,t,n){let i=n.length,s=t.length,r=i,l=0,o=0,a=t[s-1].nextSibling,u=null;for(;l<s||o<r;){if(t[l]===n[o]){l++,o++;continue}for(;t[s-1]===n[r-1];)s--,r--;if(s===l){let d=r<i?o?n[o-1].nextSibling:n[r-o]:a;for(;o<r;)e.insertBefore(n[o++],d)}else if(r===o)for(;l<s;)(!u||!u.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[r-1]&&n[o]===t[s-1]){let d=t[--s].nextSibling;e.insertBefore(n[o++],t[l++].nextSibling),e.insertBefore(n[--r],d),t[s]=n[r]}else{if(!u){u=new Map;let c=o;for(;c<r;)u.set(n[c],c++)}let d=u.get(t[l]);if(d!=null)if(o<d&&d<r){let c=l,w=1,b;for(;++c<s&&c<r&&!((b=u.get(t[c]))==null||b!==d+w);)w++;if(w>d-o){let x=t[l];for(;o<d;)e.insertBefore(n[o++],x)}else e.replaceChild(n[o++],t[l++])}else l++;else t[l++].remove()}}}var Ot="_$DX_DELEGATE";function jt(e,t,n,i={}){let s;return ye(r=>{s=r,t===document?e():g(t,e(),t.firstChild?null:void 0,n)},i.owner),()=>{s(),t.textContent=""}}function p(e,t,n){let i,s=()=>{let l=document.createElement("template");return l.innerHTML=e,n?l.content.firstChild.firstChild:l.content.firstChild},r=t?()=>H(()=>document.importNode(i||(i=s()),!0)):()=>(i||(i=s())).cloneNode(!0);return r.cloneNode=r,r}function Me(e,t=window.document){let n=t[Ot]||(t[Ot]=new Set);for(let i=0,s=e.length;i<s;i++){let r=e[i];n.has(r)||(n.add(r),t.addEventListener(r,On))}}function tt(e,t,n){nt(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Rt(e,t){nt(e)||(t==null?e.removeAttribute("class"):e.className=t)}function X(e,t,n,i){if(i)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let s=n[0];e.addEventListener(t,n[0]=r=>s.call(e,n[1],r))}else e.addEventListener(t,n,typeof n!="function"&&n)}function g(e,t,n,i){if(n!==void 0&&!i&&(i=[]),typeof t!="function")return Be(e,t,i,n);q(s=>Be(e,t(),s,n),i)}function nt(e){return!!D.context&&!D.done&&(!e||e.isConnected)}function On(e){if(D.registry&&D.events&&D.events.find(([a,u])=>u===e))return;let t=e.target,n=`$$${e.type}`,i=e.target,s=e.currentTarget,r=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),l=()=>{let a=t[n];if(a&&!t.disabled){let u=t[`${n}Data`];if(u!==void 0?a.call(t,u,e):a.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&r(t.host),!0},o=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),D.registry&&!D.done&&(D.done=_$HY.done=!0),e.composedPath){let a=e.composedPath();r(a[0]);for(let u=0;u<a.length-2&&(t=a[u],!!l());u++){if(t._$host){t=t._$host,o();break}if(t.parentNode===s)break}}else o();r(i)}function Be(e,t,n,i,s){let r=nt(e);if(r){!n&&(n=[...e.childNodes]);let a=[];for(let u=0;u<n.length;u++){let d=n[u];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():a.push(d)}n=a}for(;typeof n=="function";)n=n();if(t===n)return n;let l=typeof t,o=i!==void 0;if(e=o&&n[0]&&n[0].parentNode||e,l==="string"||l==="number"){if(r||l==="number"&&(t=t.toString(),t===n))return n;if(o){let a=n[0];a&&a.nodeType===3?a.data!==t&&(a.data=t):a=document.createTextNode(t),n=de(e,n,i,a)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||l==="boolean"){if(r)return n;n=de(e,n,i)}else{if(l==="function")return q(()=>{let a=t();for(;typeof a=="function";)a=a();n=Be(e,a,n,i)}),()=>n;if(Array.isArray(t)){let a=[],u=n&&Array.isArray(n);if(et(a,t,n,s))return q(()=>n=Be(e,a,n,i,!0)),()=>n;if(r){if(!a.length)return n;if(i===void 0)return n=[...e.childNodes];let d=a[0];if(d.parentNode!==e)return n;let c=[d];for(;(d=d.nextSibling)!==i;)c.push(d);return n=c}if(a.length===0){if(n=de(e,n,i),o)return n}else u?n.length===0?Pt(e,a,i):En(e,n,a):(n&&de(e),Pt(e,a));n=a}else if(t.nodeType){if(r&&t.parentNode)return n=o?[t]:t;if(Array.isArray(n)){if(o)return n=de(e,n,i,t);de(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function et(e,t,n,i){let s=!1;for(let r=0,l=t.length;r<l;r++){let o=t[r],a=n&&n[e.length],u;if(!(o==null||o===!0||o===!1))if((u=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))s=et(e,o,a)||s;else if(u==="function")if(i){for(;typeof o=="function";)o=o();s=et(e,Array.isArray(o)?o:[o],Array.isArray(a)?a:[a])||s}else e.push(o),s=!0;else{let d=String(o);a&&a.nodeType===3&&a.data===d?e.push(a):e.push(document.createTextNode(d))}}return s}function Pt(e,t,n=null){for(let i=0,s=t.length;i<s;i++)e.insertBefore(t[i],n)}function de(e,t,n,i){if(n===void 0)return e.textContent="";let s=i||document.createTextNode("");if(t.length){let r=!1;for(let l=t.length-1;l>=0;l--){let o=t[l];if(s!==o){let a=o.parentNode===e;!r&&!l?a?e.replaceChild(s,o):e.insertBefore(s,n):a&&o.remove()}else r=!0}}else e.insertBefore(s,n);return[s]}var Qi=Symbol();var it=Symbol("store-raw"),he=Symbol("store-node"),Q=Symbol("store-has"),Dt=Symbol("store-self");function It(e){let t=e[ne];if(!t&&(Object.defineProperty(e,ne,{value:t=new Proxy(e,Rn)}),!Array.isArray(e))){let n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);for(let s=0,r=n.length;s<r;s++){let l=n[s];i[l].get&&Object.defineProperty(e,l,{enumerable:i[l].enumerable,get:i[l].get.bind(t)})}}return t}function Ne(e){let t;return e!=null&&typeof e=="object"&&(e[ne]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function $e(e,t=new Set){let n,i,s,r;if(n=e!=null&&e[it])return n;if(!Ne(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let l=0,o=e.length;l<o;l++)s=e[l],(i=$e(s,t))!==s&&(e[l]=i)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let l=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let a=0,u=l.length;a<u;a++)r=l[a],!o[r].get&&(s=e[r],(i=$e(s,t))!==s&&(e[r]=i))}return e}function Ue(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function _e(e,t,n){if(e[t])return e[t];let[i,s]=S(n,{equals:!1,internal:!0});return i.$=s,e[t]=i}function Pn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===ne||t===he||(delete n.value,delete n.writable,n.get=()=>e[ne][t]),n}function Lt(e){Ie()&&_e(Ue(e,he),Dt)()}function jn(e){return Lt(e),Reflect.ownKeys(e)}var Rn={get(e,t,n){if(t===it)return e;if(t===ne)return n;if(t===Re)return Lt(e),n;let i=Ue(e,he),s=i[t],r=s?s():e[t];if(t===he||t===Q||t==="__proto__")return r;if(!s){let l=Object.getOwnPropertyDescriptor(e,t);Ie()&&(typeof r!="function"||e.hasOwnProperty(t))&&!(l&&l.get)&&(r=_e(i,t,r)())}return Ne(r)?It(r):r},has(e,t){return t===it||t===ne||t===Re||t===he||t===Q||t==="__proto__"?!0:(Ie()&&_e(Ue(e,Q),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:jn,getOwnPropertyDescriptor:Pn};function He(e,t,n,i=!1){if(!i&&e[t]===n)return;let s=e[t],r=e.length;n===void 0?(delete e[t],e[Q]&&e[Q][t]&&s!==void 0&&e[Q][t].$()):(e[t]=n,e[Q]&&e[Q][t]&&s===void 0&&e[Q][t].$());let l=Ue(e,he),o;if((o=_e(l,t,s))&&o.$(()=>n),Array.isArray(e)&&e.length!==r){for(let a=e.length;a<r;a++)(o=l[a])&&o.$();(o=_e(l,"length",r))&&o.$(e.length)}(o=l[Dt])&&o.$()}function Bt(e,t){let n=Object.keys(t);for(let i=0;i<n.length;i+=1){let s=n[i];He(e,s,t[s])}}function Dn(e,t){if(typeof t=="function"&&(t=t(e)),t=$e(t),Array.isArray(t)){if(e===t)return;let n=0,i=t.length;for(;n<i;n++){let s=t[n];e[n]!==s&&He(e,n,s)}He(e,"length",i)}else Bt(e,t)}function xe(e,t,n=[]){let i,s=e;if(t.length>1){i=t.shift();let l=typeof i,o=Array.isArray(e);if(Array.isArray(i)){for(let a=0;a<i.length;a++)xe(e,[i[a]].concat(t),n);return}else if(o&&l==="function"){for(let a=0;a<e.length;a++)i(e[a],a)&&xe(e,[a].concat(t),n);return}else if(o&&l==="object"){let{from:a=0,to:u=e.length-1,by:d=1}=i;for(let c=a;c<=u;c+=d)xe(e,[c].concat(t),n);return}else if(t.length>1){xe(e[i],t,[i].concat(n));return}s=e[i],n=[i].concat(n)}let r=t[0];typeof r=="function"&&(r=r(s,n),r===s)||i===void 0&&r==null||(r=$e(r),i===void 0||Ne(s)&&Ne(r)&&!Array.isArray(r)?Bt(s,r):He(e,i,r))}function rt(...[e,t]){let n=$e(e||{}),i=Array.isArray(n),s=It(n);function r(...l){xt(()=>{i&&l.length===1?Dn(n,l[0]):xe(n,l)})}return[s,r]}var nr=Symbol("store-root");async function Nt(){let e=window.location.href||"",t=new URL(e),i=t.searchParams.get("code"),s=window.location.href;if(i)return t.search="",window.history.replaceState({},"",t),fetch(`${h.BASE_URL}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",client_id:h.clientId,code:i,redirect_uri:window.location.href,code_verifier:localStorage.getItem("pkce_code_verifier")})}).then(r=>r.json()).then(r=>(localStorage.removeItem("pkce_code_verifier"),h.accessToken=r.access_token,null)).catch(r=>{console.error(r)});{let r=Mt(),l="S256",o=Mt();localStorage.setItem("pkce_code_verifier",o);let a=await Bn(o),u=`${h.BASE_URL}/oauth/authorize?response_type=code&client_id=${h.clientId}&redirect_uri=${s}&state=${encodeURIComponent(r)}&code_challenge=${encodeURIComponent(a)}&code_challenge_method=${l}`;window.location.assign(u)}}async function Ut(){try{let e=await fetch(`${h.BASE_URL}/api/v1/me`,{headers:{Authorization:`Bearer ${h.accessToken}`}});if(!e.ok){let n=await e.json();console.error(n.error||"Error fetching user details");return}let t=await e.json();if(!t||!t.id){console.error("Invalid user data");return}return{id:t.id}}catch(e){console.error("Error fetching user details:",e);return}}function In(e){let n=new TextEncoder().encode(e);return window.crypto.subtle.digest("SHA-256",n)}function Ln(e){return btoa(String.fromCharCode.apply(null,Array.from(new Uint8Array(e)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Bn(e){let t=await In(e);return Ln(t)}function Mt(){let e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,t=>("0"+t.toString(16)).substr(-2)).join("")}var ke=e=>typeof e=="function"?e:function(){return e},Mn=typeof self<"u"?self:null,Ce=typeof window<"u"?window:null,ce=Mn||Ce||ce,Nn="2.0.0",G={connecting:0,open:1,closing:2,closed:3},Un=1e4,Hn=1e3,N={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Z={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},st={longpoll:"longpoll",websocket:"websocket"},Vn={complete:4},Ve=class{constructor(e,t,n,i){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Ht=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},zn=class{constructor(e,t,n){this.state=N.closed,this.topic=e,this.params=ke(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ve(this,Z.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ht(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=N.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=N.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=N.closed,this.socket.remove(this)}),this.onError(i=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,i),this.isJoining()&&this.joinPush.reset(),this.state=N.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Ve(this,Z.leave,ke({}),this.timeout).send(),this.state=N.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Z.reply,(i,s)=>{this.trigger(this.replyEventName(s),i)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Z.close,e)}onError(e){return this.on(Z.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new Ve(this,e,function(){return t},n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=N.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Z.close,"leave")},n=new Ve(this,Z.leave,ke({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,i){return this.topic!==e?!1:i&&i!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:i}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=N.joining,this.joinPush.resend(e))}trigger(e,t,n,i){let s=this.onMessage(e,t,n,i);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(l=>l.event===e);for(let l=0;l<r.length;l++)r[l].callback(s,n,i||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===N.closed}isErrored(){return this.state===N.errored}isJoined(){return this.state===N.joined}isJoining(){return this.state===N.joining}isLeaving(){return this.state===N.leaving}},Fe=class{static request(e,t,n,i,s,r,l){if(ce.XDomainRequest){let o=new ce.XDomainRequest;return this.xdomainRequest(o,e,t,i,s,r,l)}else{let o=new ce.XMLHttpRequest;return this.xhrRequest(o,e,t,n,i,s,r,l)}}static xdomainRequest(e,t,n,i,s,r,l){return e.timeout=s,e.open(t,n),e.onload=()=>{let o=this.parseJSON(e.responseText);l&&l(o)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,n,i,s,r,l,o){return e.open(t,n,!0),e.timeout=r,e.setRequestHeader("Content-Type",i),e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Vn.complete&&o){let a=this.parseJSON(e.responseText);o(a)}},l&&(e.ontimeout=l),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let s=t?`${t}[${i}]`:i,r=e[i];typeof r=="object"?n.push(this.serialize(r,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Fn=e=>{let t="",n=new Uint8Array(e),i=n.byteLength;for(let s=0;s<i;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ae=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=G.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+st.websocket),"$1/"+st.longpoll)}endpointURL(){return Fe.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=G.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===G.open||this.readyState===G.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:i}=e;this.token=n}else t=0;switch(t){case 200:i.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=G.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){typeof e!="string"&&(e=Fn(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(` | ||
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=G.closed;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,n,i,s){let r,l=()=>{this.reqs.delete(r),i()};r=Fe.request(e,this.endpointURL(),t,n,this.timeout,l,o=>{this.reqs.delete(r),this.isActive()&&s(o)}),this.reqs.add(r)}};var ze={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,i,s,r,l]=JSON.parse(e);return t({join_ref:n,ref:i,topic:s,event:r,payload:l})}},binaryEncode(e){let{join_ref:t,ref:n,event:i,topic:s,payload:r}=e,l=this.META_LENGTH+t.length+n.length+s.length+i.length,o=new ArrayBuffer(this.HEADER_LENGTH+l),a=new DataView(o),u=0;a.setUint8(u++,this.KINDS.push),a.setUint8(u++,t.length),a.setUint8(u++,n.length),a.setUint8(u++,s.length),a.setUint8(u++,i.length),Array.from(t,c=>a.setUint8(u++,c.charCodeAt(0))),Array.from(n,c=>a.setUint8(u++,c.charCodeAt(0))),Array.from(s,c=>a.setUint8(u++,c.charCodeAt(0))),Array.from(i,c=>a.setUint8(u++,c.charCodeAt(0)));var d=new Uint8Array(o.byteLength+r.byteLength);return d.set(new Uint8Array(o),0),d.set(new Uint8Array(r),o.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),l=this.HEADER_LENGTH+this.META_LENGTH-1,o=n.decode(e.slice(l,l+i));l=l+i;let a=n.decode(e.slice(l,l+s));l=l+s;let u=n.decode(e.slice(l,l+r));l=l+r;let d=e.slice(l,e.byteLength);return{join_ref:o,ref:null,topic:a,event:u,payload:d}},decodeReply(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),l=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,a=n.decode(e.slice(o,o+i));o=o+i;let u=n.decode(e.slice(o,o+s));o=o+s;let d=n.decode(e.slice(o,o+r));o=o+r;let c=n.decode(e.slice(o,o+l));o=o+l;let w=e.slice(o,e.byteLength),b={status:c,response:w};return{join_ref:a,ref:u,topic:d,event:Z.reply,payload:b}},decodeBroadcast(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=this.HEADER_LENGTH+2,l=n.decode(e.slice(r,r+i));r=r+i;let o=n.decode(e.slice(r,r+s));r=r+s;let a=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:l,event:o,payload:a}}},Vt=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Un,this.transport=t.transport||ce.WebSocket||Ae,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||ce&&ce.sessionStorage,this.establishedConnections=0,this.defaultEncoder=ze.encode.bind(ze),this.defaultDecoder=ze.decode.bind(ze),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ae?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Ce&&Ce.addEventListener&&(Ce.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Ce.addEventListener("pageshow",i=>{n===this.connectClock&&(n=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,s,r)=>{console.log(`${i}: ${s}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ke(t.params||{}),this.endPoint=`${e}/${st.websocket}`,this.vsn=t.vsn||Nn,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ht(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Ae}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Fe.appendParams(Fe.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ke(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==Ae?this.connectWithFallback(Ae,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(s=>{s.ref===t&&(this.off([i]),e(Date.now()-n))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,i=!0,s,r,l=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([s,r]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),r=this.onError(o=>{this.log("transport","error",o),i&&!n&&(clearTimeout(this.fallbackTimer),l(o))}),this.onOpen(()=>{if(n=!0,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(o=>{this.log("transport","connected to primary after",o),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Hn,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===G.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,n])=>n(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Z.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case G.connecting:return"connecting";case G.open:return"open";case G.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new zn(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:i,ref:s,join_ref:r}=e;this.log("push",`${t} ${n} (${r}, ${s})`,i)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:i,payload:s,ref:r,join_ref:l}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${i} ${r&&"("+r+")"||""}`,s);for(let o=0;o<this.channels.length;o++){let a=this.channels[o];a.isMember(n,i,s,l)&&a.trigger(i,s,r,l)}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,a]=this.stateChangeCallbacks.message[o];a(t)}})}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};async function zt(e){let t=e.propertyId?`${h.BASE_URL}/api/v1/next_auction/${e.propertyId}`:`${h.BASE_URL}/api/v1/next_auction/${e.source}/${e.sourceAgencyId}/${e.sourceId}`;return fetch(t,{headers:{Authorization:"Bearer "+h.accessToken}}).then(n=>{if(n.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return n.json()}).then(n=>{let s=(Array.isArray(n.bids)?n.bids:[]).map(o=>({id:o.id,amount:o.amount,createdAt:o.createdAt,newEndDate:o.newEndDate,userAnonymousId:o.userAnonymousId,participantId:o.participantId})),r=s.reduce((o,a)=>a.amount>o.amount?a:o,{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:""}),l=n.registration?{isUserAllowed:n.registration.isUserAllowed,isRegistrationAccepted:n.registration.isRegistrationAccepted,isParticipant:n.registration.isParticipant}:null;return{id:n.id,startDate:n.startDate,endDate:n.endDate,startingPrice:n.startingPrice,step:n.step,bids:s,highestBid:r,agentEmail:n.agentEmail,agentPhone:n.agentPhone,registration:l,isPrivate:n.isPrivate,currency:{symbol:n.currency.symbol,code:n.currency.code,isBefore:n.currency.isBefore}}}).catch(n=>{throw console.error("err",n),n})}function Ft(e,t){return new Promise((n,i)=>{h.socket!=null&&h.socket.disconnect(),h.socket=new Vt(h.WS_URL,{params:{token:h.accessToken}}),h.socket.connect();let s=h.socket.channel(`auction:${e}`,{});s.on("outbid",r=>{t&&t(r.bid)}),s.join().receive("ok",r=>{n(s)}).receive("error",r=>{console.error("Unable to join",r),h.socket!=null&&h.socket.disconnect(),i(r)})})}async function qt(e,t){return fetch(`${h.BASE_URL}/api/v1/bid`,{method:"POST",body:JSON.stringify({auctionId:e.id,amount:t}),headers:{Authorization:"Bearer "+h.accessToken,"Content-Type":"application/json"}}).then(n=>{if(n.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return n.status===422?n.json().then(i=>{throw i}):n.json()}).then(n=>({id:n.id,amount:n.amount,createdAt:n.createdAt,newEndDate:n.newEndDate,userAnonymousId:n.userAnonymousId,participantId:n.participantId})).catch(n=>{throw console.error("err",n),n})}var h={BASE_URL:"",WS_URL:"",accessToken:null,socket:null,DOMAIN:"",clientId:null};function qn(e,t="production"){switch(h.clientId=e,t){case"local":h.DOMAIN="localhost:4000",h.BASE_URL=`http://${h.DOMAIN}`,h.WS_URL=`ws://${h.DOMAIN}/api/socket`;break;case"staging":h.DOMAIN="staging.encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break;case"production":h.DOMAIN="encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break;default:console.log("Widget client: Unknown environment, defaulting to production."),h.DOMAIN="encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break}}var ee={initEIClient:qn,getNextAuctionById:zt,authenticate:Nt,subscribeToAuction:Ft,me:Ut,placeBidOnAuction:qt};function ie(e){let t=new Date().setMilliseconds(0),n=new Date(e.startDate).setMilliseconds(0);return t<n}function re(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0),i=new Date(e.startDate).setMilliseconds(0);return t<=n&&t>=i}function ge(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0);return t>n}function V(e,t){let n=e==null?"--":e.toString();return t?t.isBefore?`${qe(t)} ${n}`:`${n} ${qe(t)}`:`${n} \u20AC`}function qe(e){return e.symbol||e.code||""}function ot(e){return new Date(e)}function me(e){return ot(e).toLocaleString()}var Wn=p("<div><p id=auction-widget-status>D\xE9marre dans</p><p id=auction-widget-countdown>"),Kn=p("<div><p id=auction-widget-status>Se termine dans</p><p id=auction-widget-countdown>"),Gn=p("<p id=auction-widget-status>Vente termin\xE9e"),Jn=p('<p class="auction-widget-detail auction-widget-label">Meilleure offre'),Yn=p('<p class="auction-widget-detail auction-widget-accent">'),Xn=p('<div><div id=auction-widget-header></div><div><div id=auction-widget-description><div><p class="auction-widget-detail auction-widget-label">D\xE9but</p><p class=auction-widget-detail> </p></div><div><p class="auction-widget-detail auction-widget-label">Fin</p><p class=auction-widget-detail></p></div><div><p class="auction-widget-detail auction-widget-label">Prix de d\xE9part</p><p class="auction-widget-detail auction-widget-accent"> </p></div><div><p class="auction-widget-detail auction-widget-label">Palier</p><p class="auction-widget-detail auction-widget-accent"></p></div></div><div class="auction-widget-section auction-widget-border-t"><div>'),Qn=p('<div><p class="auction-widget-detail auction-widget-label">Vente priv\xE9e</p><p class=auction-widget-detail>Inscrivez-vous pour voir les participations'),Zn=e=>{let[t,n]=S(""),[i,s]=S(ie(e.auction)),[r,l]=S(re(e.auction)),[o,a]=S(ge(e.auction));function u(w,b){let x=(w.getTime()-b.getTime())/1e3,C=Math.floor(x/(3600*24)),j=Math.floor(x%(3600*24)/3600),B=Math.floor(x%3600/60),_=Math.floor(x%60);return{days:C,hours:j,minutes:B,seconds:_}}function d(w){if(a(ge(e.auction)),l(re(e.auction)),s(ie(e.auction)),ge(w)){clearInterval(c);return}let b=ie(w)?w.startDate:w.endDate,x=new Date,C=u(ot(b),x);n(`${C.days}j ${C.hours}h ${C.minutes}m ${C.seconds}s`)}let c=setInterval(()=>{d(e.auction)},1e3);return(()=>{var w=Xn(),b=w.firstChild,x=b.nextSibling,C=x.firstChild,j=C.firstChild,B=j.firstChild,_=B.nextSibling,R=_.firstChild,I=j.nextSibling,W=I.firstChild,pe=W.nextSibling,J=I.nextSibling,E=J.firstChild,k=E.nextSibling,P=k.firstChild,M=J.nextSibling,Ee=M.firstChild,we=Ee.nextSibling,ut=C.nextSibling,Oe=ut.firstChild;return g(b,m(A,{get when(){return i()},get children(){var U=Wn(),ue=U.firstChild,be=ue.nextSibling;return g(be,t),U}}),null),g(b,m(A,{get when(){return r()},get children(){var U=Kn(),ue=U.firstChild,be=ue.nextSibling;return g(be,t),U}}),null),g(b,m(A,{get when(){return o()},get children(){return Gn()}}),null),g(_,()=>me(e.auction.startDate),R),g(pe,()=>me(e.auction.endDate)),g(k,()=>V(e.auction.startingPrice),P),g(we,()=>V(e.auction.step)),g(Oe,m(A,{get when(){return!e.auction.isPrivate||e.auction.isPrivate&&e.auction.registration&&e.auction.registration.isUserAllowed},get fallback(){return Qn()},get children(){return[Jn(),(()=>{var U=Yn();return g(U,(()=>{var ue=T(()=>!!e.auction.highestBid.participantId);return()=>ue()?V(e.auction.highestBid.amount,e.auction.currency):V(null,e.auction.currency)})()),U})()]}})),w})()},Wt=Zn;var ei=p('<div class=auction-widget-icon><i class="fas fa-check">'),ti=p("<div class=auction-widget-icon><i>"),ni=p("<h3>"),ii=p("<div><div id=auction-widget-modal-background></div><div class=auction-widget-modal><div id=auction-widget-modal-content><div><div><div>"),ri=e=>(()=>{var t=ii(),n=t.firstChild,i=n.nextSibling,s=i.firstChild,r=s.firstChild,l=r.firstChild,o=l.firstChild;return g(r,m(A,{get when(){return e.success},get children(){return ei()}}),l),g(r,m(A,{get when(){return e.icon_class},get children(){var a=ti(),u=a.firstChild;return q(()=>Rt(u,e.icon_class)),a}}),l),g(l,m(A,{get when(){return e.title},get children(){var a=ni();return g(a,()=>e.title),a}}),o),g(o,()=>e.children),t})(),Te=ri;var si=p("<tr><td class=auction-widget-td>Offre pr\xE9c\xE9dente</td><td class=auction-widget-amount>"),oi=p("<table id=auction-widget-table><tbody><tr><td class=auction-widget-td>Votre offre</td><td class=auction-widget-amount>"),li=p("<p class=auction-widget-modal-note>Votre offre est sensiblement sup\xE9rieure \xE0 l'offre pr\xE9c\xE9dente. \xCAtes-vous s\xFBr de vouloir continuer ?"),ai=p("<p id=email-error class=auction-widget-modal-note>Vous devez au moins ench\xE9rir <!>."),ci=p('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Confirmer</button><button class=auction-widget-btn>Annuler'),ui=p('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-bid><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Ench\xE8re rapide</p><div id=auction-widget-fast-bid><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span></div><div class=auction-widget-history-area><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Votre montant</p><div id=auction-widget-bid-form><input type=number min=0 step=1><div id=auction-widget-currency><span></span></div><button class="auction-widget-btn auction-widget-custom">Ench\xE9rir'),fi=e=>{let t=e.auction.highestBid?e.auction.highestBid.amount+e.auction.step:e.auction.startingPrice,[n,i]=S(t),[s,r]=S(!1),[l,o]=S(!1),[a,u]=S(!1),[d,c]=S(J(1,!1,e.auction)),[w,b]=S(J(2,!1,e.auction)),[x,C]=S(J(3,!1,e.auction)),[j,B]=S(0);function _(E,k){let P=E.highestBid?E.highestBid.amount:E.startingPrice-E.step;k>P+E.step*3?u(!0):u(!1)}function R(E,k){return()=>{let P=k.highestBid?k.highestBid.amount:null,M;P!==null?M=P+E*k.step:M=k.startingPrice+k.step*(E-1),i(M),_(k,M),r(!0)}}function I(){return()=>{_(e.auction,n()),r(!0)}}function W(){return()=>{o(!1),r(!1)}}function pe(E,k){return()=>{ee.placeBidOnAuction(k,E).then(P=>{r(!1),o(!1),c(J(1,!0,k)),b(J(2,!0,k)),C(J(3,!0,k))}).catch(P=>{P.code=="bid_amount_too_low"&&(o(!0),B(P.min))})}}function J(E,k,P){let M;return k||P.bids&&P.bids.length>0?M=E*P.step:M=(E-1)*P.step,V(M,P.currency)}return(()=>{var E=ui(),k=E.firstChild,P=k.firstChild,M=P.nextSibling,Ee=M.firstChild,we=Ee.firstChild,ut=we.firstChild,Oe=Ee.nextSibling,U=Oe.firstChild,ue=U.firstChild,be=Oe.nextSibling,We=be.firstChild,Bi=We.firstChild,ln=M.nextSibling,an=ln.firstChild,cn=an.nextSibling,Ke=cn.firstChild,ft=Ke.nextSibling,un=ft.firstChild,fn=ft.nextSibling;return X(we,"click",R(1,e.auction),!0),g(we,d,null),X(U,"click",R(2,e.auction),!0),g(U,w,null),X(We,"click",R(3,e.auction),!0),g(We,x,null),Ke.$$input=z=>i(parseInt(z.currentTarget.value)),g(un,()=>qe(e.auction.currency)),X(fn,"click",I(),!0),g(E,m(A,{get when(){return s()},get children(){return m(Te,{title:"Vous \xEAtes sur le point d'ench\xE9rir",success:!1,icon_class:"fas fa-gavel",get children(){return[(()=>{var z=oi(),le=z.firstChild,ae=le.firstChild,dt=ae.firstChild,dn=dt.nextSibling;return g(le,m(A,{get when(){return e.auction.highestBid.participantId},get children(){var ht=si(),hn=ht.firstChild,gn=hn.nextSibling;return g(gn,()=>V(e.auction.highestBid.amount)),ht}}),ae),g(dn,()=>V(n())),z})(),m(A,{get when(){return a()},get children(){return li()}}),m(A,{get when(){return l()},get children(){var z=ai(),le=z.firstChild,ae=le.nextSibling,dt=ae.nextSibling;return g(z,()=>V(j()),ae),z}}),(()=>{var z=ci(),le=z.firstChild,ae=le.nextSibling;return X(le,"click",pe(n(),e.auction),!0),X(ae,"click",W(),!0),z})()]}})}}),null),q(()=>Ke.value=n()),E})()},Kt=fi;Me(["click","input"]);var di=p('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-history-area><p class="auction-widget-label auction-widget-detail">Historique des offres</p><ul id=auction-widget-scroll>'),hi=p('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i>Vous</span>avez ench\xE9ri'),gi=p("<li><p id=auction-widget-bid-amount>"),mi=p('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i></span>a ench\xE9ri'),pi=e=>(()=>{var t=di(),n=t.firstChild,i=n.firstChild,s=i.nextSibling;return g(s,m(Qe,{get each(){return[...e.bids].sort((r,l)=>l.amount-r.amount)},children:(r,l)=>(()=>{var o=gi(),a=o.firstChild;return g(o,m(A,{get when(){return r.participantId===e.user.id},get fallback(){return(()=>{var u=mi(),d=u.firstChild,c=d.firstChild,w=d.nextSibling,b=w.firstChild;return g(d,()=>me(r.createdAt),null),g(w,()=>r.userAnonymousId,null),u})()},get children(){var u=hi(),d=u.firstChild,c=d.firstChild;return g(d,()=>me(r.createdAt),null),u}}),a),g(a,()=>V(r.amount,e.auction.currency)),o})()})),t})(),Gt=pi;var wi=p('<div><div class=auction-widget-section><button class="auction-widget-btn auction-widget-custom">Je veux participer'),bi=p('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Se connecter</button><button class=auction-widget-btn>Annuler'),yi=p("<div id=auction-widget-agent-link><p class=auction-widget-modal-note>Pas encore de compte ?</p><button id=auction-widget-link>Contacter l'agent"),vi=p("<div>"),Si=p('<div class=auction-widget-contact><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-envelope"></i></a><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-phone">'),xi=p("<div class=auction-widget-action><button class=auction-widget-btn>Fermer"),$i=e=>{e.isLogging&&n();function t(){return()=>{n()}}function n(){ee.authenticate().then(()=>{e.setterIsLogged(!0),ee.me().then(o=>{e.updateUser(o)})})}let[i,s]=S(!1),[r,l]=S(!1);return(()=>{var o=wi(),a=o.firstChild,u=a.firstChild;return u.$$click=()=>s(!i()),g(o,(()=>{var d=T(()=>!!i());return()=>d()&&(()=>{var c=vi();return g(c,m(Te,{title:"Vous devez \xEAtre connect\xE9",icon_class:"fas fa-user-lock",success:!1,get children(){return[(()=>{var w=bi(),b=w.firstChild,x=b.nextSibling;return X(b,"click",t(),!0),x.$$click=()=>s(!1),w})(),(()=>{var w=yi(),b=w.firstChild,x=b.nextSibling;return x.$$click=()=>{l(!0),s(!1)},w})()]}})),c})()})(),null),g(o,(()=>{var d=T(()=>!!r());return()=>d()&&m(Te,{title:"Demande de participation",icon_class:"fas fa-gavel",success:!1,get children(){return[(()=>{var c=Si(),w=c.firstChild,b=w.firstChild,x=w.nextSibling,C=x.firstChild;return g(w,()=>e.auction.agentEmail,null),g(x,()=>e.auction.agentPhone,null),q(j=>{var B="mailto:"+e.auction.agentEmail,_="tel:"+e.auction.agentPhone;return B!==j.e&&tt(w,"href",j.e=B),_!==j.t&&tt(x,"href",j.t=_),j},{e:void 0,t:void 0}),c})(),(()=>{var c=xi(),w=c.firstChild;return w.$$click=()=>l(!1),c})()]}})})(),null),o})()},Jt=$i;Me(["click"]);var _i=p("<p class=auction-widget-note>Vous \xEAtes observateur pour cette vente. Vous ne pouvez pas ench\xE9rir."),Ai=p("<p class=auction-widget-note>Votre demande d'observation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour voir les participations."),Ci=p("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour ench\xE9rir."),ki=p("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 refus\xE9e."),Ti=p("<p class=auction-widget-note>Votre demande de participation a \xE9t\xE9 transmise \xE0 l'agent responsable du bien. Vous serez inform\xE9 par email lorsqu'elle sera valid\xE9e."),Ei=p("<p class=auction-widget-note>Vous n'\xEAtes pas inscrit \xE0 cette vente, veuillez contacter l'agent responsable."),Oi=p("<div id=auction-widget-box><div><div>"),[se,Pi]=S(!1),[Yt,Zt]=S(!1),[lt,ji]=S({id:""}),[at,Xt]=rt([]),[y,Qt]=rt({id:"",startDate:0,endDate:0,startingPrice:0,step:0,bids:[],registration:{isUserAllowed:!1,isRegistrationAccepted:null,isParticipant:!1},isPrivate:!1,highestBid:{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:"",participantId:""},agentEmail:"",agentPhone:"",currency:{symbol:"",code:"",isBefore:!1}});function en(e){ee.getNextAuctionById(e).then(t=>{Qt(t),Xt(t.bids),ee.subscribeToAuction(t.id,n=>{Xt([...at,n]);let i=n.newEndDate||t.endDate;Qt({...t,highestBid:n,endDate:i})}).catch(n=>{console.error("Error subscribing to auction:",n)})})}function Ri(e,t){ji(e),en(t),Zt(!1)}var Di=e=>{let{apiKey:t,propertyInfo:n,environment:i="production"}=e;ee.initEIClient(t,i),en(n);let s=window.location.href,l=new URLSearchParams(s.split("?")[1]).get("code");return l!=""&&l!=null&&Zt(!0),(()=>{var o=Oi(),a=o.firstChild,u=a.firstChild;return g(u,m(A,{get when(){return y.id!=""},get children(){return[m(Wt,{auction:y,get user(){return lt()}}),m(A,{get when(){return T(()=>!!(!se()||Yt()))()&&(re(y)||ie(y))},get children(){return m(Jt,{setterIsLogged:Pi,get isLogging(){return Yt()},auction:y,get updateUser(){return Ri(lt(),n)}})}}),m(Ze,{get children(){return[m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted&&y.registration.isParticipant))()&&re(y)},get children(){return m(Kt,{auction:y})}}),m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted&&!y.registration.isParticipant))()&&re(y)},get children(){return _i()}}),m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted&&!y.registration.isParticipant))()&&ie(y)},get children(){return Ai()}}),m(Y,{get when(){return T(()=>!!(se()&&y.registration&&y.registration.isRegistrationAccepted===!0))()&&ie(y)},get children(){return Ci()}}),m(Y,{get when(){return se()&&y.registration&&y.registration.isRegistrationAccepted===!1},get children(){return ki()}}),m(Y,{get when(){return se()&&y.registration&&y.registration.isRegistrationAccepted==null},get children(){return Ti()}}),m(Y,{get when(){return se()&&!y.registration},get children(){return Ei()}})]}}),m(A,{get when(){return ge(y)||re(y)&&at.length>0},get children(){return m(Gt,{bids:at,auction:y,get user(){return lt()}})}})]}})),o})()},tn=Di;var oe=document.getElementById("auction-widget"),nn=oe?.getAttribute("api-key")||"",Ii=oe?.getAttribute("api-env")||"production",ct=oe?.getAttribute("property-id")||"",rn=oe?.getAttribute("source")||"",sn=oe?.getAttribute("source-agency-id")||"",on=oe?.getAttribute("source-id")||"";if(!(oe instanceof HTMLElement))throw new Error("Auction widget: No root element found with id 'auction-widget'. Did you forget to add it? Or maybe the id attribute got misspelled?");if(nn=="")throw new Error("Auction widget: No 'api-key' attribute found. Did you forget to add it? Or maybe the attribute got misspelled?");if(ct==""&&(rn==""||sn==""||on==""))throw new Error("Auction widget: Either 'property-id' or 'source', 'source-agency-id', and 'source-id' must be provided. Did you forget to add them? Or maybe the attributes got misspelled?");var Li=ct?{propertyId:ct}:{source:rn,sourceAgencyId:sn,sourceId:on};jt(()=>m(tn,{apiKey:nn,propertyInfo:Li,environment:Ii}),oe);})(); | ||
"use strict";(()=>{var j={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return gt(this.context.count)},getNextContextId(){return gt(this.context.count++)}};function gt(e){let t=String(e),n=t.length-1;return j.context.id+(n?String.fromCharCode(96+n):"")+t}function mt(e){j.context=e}function yn(){return{...j.context,id:j.getNextContextId(),count:0}}var vn=(e,t)=>e===t,ne=Symbol("solid-proxy");var je=Symbol("solid-track"),qi=Symbol("solid-dev-component"),Oe={equals:vn},pt=null,Sn=Ct,z=1,ve=2,St={owned:null,cleanups:null,context:null,owner:null};var b=null,f=null,Se=null,ce=null,v=null,k=null,D=null,Re=0;function ye(e,t){let n=v,i=b,s=e.length===0,r=t===void 0?i:t,o=s?St:{owned:null,cleanups:null,context:r?r.context:null,owner:r},a=s?e:()=>e(()=>B(()=>te(o)));b=o,v=null;try{return W(a,!0)}finally{v=n,b=i}}function y(e,t){t=t?Object.assign({},Oe,t):Oe;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},i=s=>(typeof s=="function"&&(f&&f.running&&f.sources.has(n)?s=s(n.tValue):s=s(n.value)),_t(n,s));return[xt.bind(n),i]}function N(e,t,n){let i=At(e,t,!1,z);Se&&f&&f.running?k.push(i):Le(i)}function T(e,t,n){n=n?Object.assign({},Oe,n):Oe;let i=At(e,t,!0,0);return i.observers=null,i.observerSlots=null,i.comparator=n.equals||void 0,Se&&f&&f.running?(i.tState=z,k.push(i)):Le(i),xt.bind(i)}function $t(e){return W(e,!1)}function B(e){if(!ce&&v===null)return e();let t=v;v=null;try{return ce?ce.untrack(e):e()}finally{v=t}}function Je(e){return b===null||(b.cleanups===null?b.cleanups=[e]:b.cleanups.push(e)),e}function De(){return v}function $n(e){if(f&&f.running)return e(),f.done;let t=v,n=b;return Promise.resolve().then(()=>{v=t,b=n;let i;return(Se||_n)&&(i=f||(f={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),i.done||(i.done=new Promise(s=>i.resolve=s)),i.running=!0),W(e,!1),v=b=null,i?i.done:void 0})}var[Wi,wt]=y(!1);function xn(e){let t=T(e),n=T(()=>Ge(t()));return n.toArray=()=>{let i=n();return Array.isArray(i)?i:i!=null?[i]:[]},n}var _n;function xt(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===z)Le(this);else{let t=k;k=null,W(()=>Pe(this),!1),k=t}if(v){let t=this.observers?this.observers.length:0;v.sources?(v.sources.push(this),v.sourceSlots.push(t)):(v.sources=[this],v.sourceSlots=[t]),this.observers?(this.observers.push(v),this.observerSlots.push(v.sources.length-1)):(this.observers=[v],this.observerSlots=[v.sources.length-1])}return e&&f.sources.has(this)?this.tValue:this.value}function _t(e,t,n){let i=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(i,t)){if(f){let s=f.running;(s||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&W(()=>{for(let s=0;s<e.observers.length;s+=1){let r=e.observers[s],o=f&&f.running;o&&f.disposed.has(r)||((o?!r.tState:!r.state)&&(r.pure?k.push(r):D.push(r),r.observers&&kt(r)),o?r.tState=z:r.state=z)}if(k.length>1e6)throw k=[],new Error},!1)}return t}function Le(e){if(!e.fn)return;te(e);let t=Re;bt(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{W(()=>{f&&(f.running=!0),v=b=e,bt(e,e.tValue,t),v=b=null},!1)})}function bt(e,t,n){let i,s=b,r=v;v=b=e;try{i=e.fn(t)}catch(o){return e.pure&&(f&&f.running?(e.tState=z,e.tOwned&&e.tOwned.forEach(te),e.tOwned=void 0):(e.state=z,e.owned&&e.owned.forEach(te),e.owned=null)),e.updatedAt=n+1,Xe(o)}finally{v=r,b=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?_t(e,i,!0):f&&f.running&&e.pure?(f.sources.add(e),e.tValue=i):e.value=i,e.updatedAt=n)}function At(e,t,n,i=z,s){let r={fn:e,state:i,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:b,context:b?b.context:null,pure:n};if(f&&f.running&&(r.state=0,r.tState=i),b===null||b!==St&&(f&&f.running&&b.pure?b.tOwned?b.tOwned.push(r):b.tOwned=[r]:b.owned?b.owned.push(r):b.owned=[r]),ce&&r.fn){let[o,a]=y(void 0,{equals:!1}),l=ce.factory(r.fn,a);Je(()=>l.dispose());let c=()=>$n(a).then(()=>d.dispose()),d=ce.factory(r.fn,c);r.fn=u=>(o(),f&&f.running?d.track(u):l.track(u))}return r}function Ye(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===ve)return Pe(e);if(e.suspense&&B(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Re);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let i=n.length-1;i>=0;i--){if(e=n[i],t){let s=e,r=n[i+1];for(;(s=s.owner)&&s!==r;)if(f.disposed.has(s))return}if((t?e.tState:e.state)===z)Le(e);else if((t?e.tState:e.state)===ve){let s=k;k=null,W(()=>Pe(e,n[0]),!1),k=s}}}function W(e,t){if(k)return e();let n=!1;t||(k=[]),D?n=!0:D=[],Re++;try{let i=e();return An(n),i}catch(i){n||(D=null),k=null,Xe(i)}}function An(e){if(k&&(Se&&f&&f.running?Cn(k):Ct(k),k=null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let i=f.sources,s=f.disposed;D.push.apply(D,f.effects),t=f.resolve;for(let r of D)"tState"in r&&(r.state=r.tState),delete r.tState;f=null,W(()=>{for(let r of s)te(r);for(let r of i){if(r.value=r.tValue,r.owned)for(let o=0,a=r.owned.length;o<a;o++)te(r.owned[o]);r.tOwned&&(r.owned=r.tOwned),delete r.tValue,delete r.tOwned,r.tState=0}wt(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,D),D=null,wt(!0);return}}let n=D;D=null,n.length&&W(()=>Sn(n),!1),t&&t()}function Ct(e){for(let t=0;t<e.length;t++)Ye(e[t])}function Cn(e){for(let t=0;t<e.length;t++){let n=e[t],i=f.queue;i.has(n)||(i.add(n),Se(()=>{i.delete(n),W(()=>{f.running=!0,Ye(n)},!1),f&&(f.running=!1)}))}}function Pe(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let i=0;i<e.sources.length;i+=1){let s=e.sources[i];if(s.sources){let r=n?s.tState:s.state;r===z?s!==t&&(!s.updatedAt||s.updatedAt<Re)&&Ye(s):r===ve&&Pe(s,t)}}}function kt(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let i=e.observers[n];(t?!i.tState:!i.state)&&(t?i.tState=ve:i.state=ve,i.pure?k.push(i):D.push(i),i.observers&&kt(i))}}function te(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),i=e.sourceSlots.pop(),s=n.observers;if(s&&s.length){let r=s.pop(),o=n.observerSlots.pop();i<s.length&&(r.sourceSlots[o]=i,s[i]=r,n.observerSlots[i]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)te(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)Tt(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)te(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function Tt(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let n=0;n<e.owned.length;n++)Tt(e.owned[n])}function kn(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function yt(e,t,n){try{for(let i of t)i(e)}catch(i){Xe(i,n&&n.owner||null)}}function Xe(e,t=b){let n=pt&&t&&t.context&&t.context[pt],i=kn(e);if(!n)throw i;D?D.push({fn(){yt(i,n,t)},state:z}):yt(i,n,t)}function Ge(e){if(typeof e=="function"&&!e.length)return Ge(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let i=Ge(e[n]);Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}return e}var Tn=Symbol("fallback");function vt(e){for(let t=0;t<e.length;t++)e[t]()}function En(e,t,n={}){let i=[],s=[],r=[],o=0,a=t.length>1?[]:null;return Je(()=>vt(r)),()=>{let l=e()||[],c=l.length,d,u;return l[je],B(()=>{let w,_,x,H,F,E,P,R,q;if(c===0)o!==0&&(vt(r),r=[],i=[],s=[],o=0,a&&(a=[])),n.fallback&&(i=[Tn],s[0]=ye(pe=>(r[0]=pe,n.fallback())),o=1);else if(o===0){for(s=new Array(c),u=0;u<c;u++)i[u]=l[u],s[u]=ye($);o=c}else{for(x=new Array(c),H=new Array(c),a&&(F=new Array(c)),E=0,P=Math.min(o,c);E<P&&i[E]===l[E];E++);for(P=o-1,R=c-1;P>=E&&R>=E&&i[P]===l[R];P--,R--)x[R]=s[P],H[R]=r[P],a&&(F[R]=a[P]);for(w=new Map,_=new Array(R+1),u=R;u>=E;u--)q=l[u],d=w.get(q),_[u]=d===void 0?-1:d,w.set(q,u);for(d=E;d<=P;d++)q=i[d],u=w.get(q),u!==void 0&&u!==-1?(x[u]=s[d],H[u]=r[d],a&&(F[u]=a[d]),u=_[u],w.set(q,u)):r[d]();for(u=E;u<c;u++)u in x?(s[u]=x[u],r[u]=H[u],a&&(a[u]=F[u],a[u](u))):s[u]=ye($);s=s.slice(0,o=c),i=l.slice(0)}return s});function $(w){if(r[u]=w,a){let[_,x]=y(u);return a[u]=x,t(l[u],_)}return t(l[u])}}}var On=!1;function g(e,t){if(On&&j.context){let n=j.context;mt(yn());let i=B(()=>e(t||{}));return mt(n),i}return B(()=>e(t||{}))}var Et=e=>`Stale read from <${e}>.`;function Qe(e){let t="fallback"in e&&{fallback:()=>e.fallback};return T(En(()=>e.each,e.children,t||void 0))}function S(e){let t=e.keyed,n=T(()=>e.when,void 0,{equals:(i,s)=>t?i===s:!i==!s});return T(()=>{let i=n();if(i){let s=e.children;return typeof s=="function"&&s.length>0?B(()=>s(t?i:()=>{if(!B(n))throw Et("Show");return e.when})):s}return e.fallback},void 0,void 0)}function Ze(e){let t=!1,n=(r,o)=>(t?r[1]===o[1]:!r[1]==!o[1])&&r[2]===o[2],i=xn(()=>e.children),s=T(()=>{let r=i();Array.isArray(r)||(r=[r]);for(let o=0;o<r.length;o++){let a=r[o].when;if(a)return t=!!r[o].keyed,[o,a,r[o]]}return[-1]},void 0,{equals:n});return T(()=>{let[r,o,a]=s();if(r<0)return e.fallback;let l=a.children;return typeof l=="function"&&l.length>0?B(()=>l(t?o:()=>{if(B(s)[0]!==r)throw Et("Match");return a.when})):l},void 0,void 0)}function se(e){return e}var jn=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],rr=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...jn]);function Rn(e,t,n){let i=n.length,s=t.length,r=i,o=0,a=0,l=t[s-1].nextSibling,c=null;for(;o<s||a<r;){if(t[o]===n[a]){o++,a++;continue}for(;t[s-1]===n[r-1];)s--,r--;if(s===o){let d=r<i?a?n[a-1].nextSibling:n[r-a]:l;for(;a<r;)e.insertBefore(n[a++],d)}else if(r===a)for(;o<s;)(!c||!c.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[r-1]&&n[a]===t[s-1]){let d=t[--s].nextSibling;e.insertBefore(n[a++],t[o++].nextSibling),e.insertBefore(n[--r],d),t[s]=n[r]}else{if(!c){c=new Map;let u=a;for(;u<r;)c.set(n[u],u++)}let d=c.get(t[o]);if(d!=null)if(a<d&&d<r){let u=o,$=1,w;for(;++u<s&&u<r&&!((w=c.get(t[u]))==null||w!==d+$);)$++;if($>d-a){let _=t[o];for(;a<d;)e.insertBefore(n[a++],_)}else e.replaceChild(n[a++],t[o++])}else o++;else t[o++].remove()}}}var Ot="_$DX_DELEGATE";function jt(e,t,n,i={}){let s;return ye(r=>{s=r,t===document?e():p(t,e(),t.firstChild?null:void 0,n)},i.owner),()=>{s(),t.textContent=""}}function m(e,t,n){let i,s=()=>{let o=document.createElement("template");return o.innerHTML=e,n?o.content.firstChild.firstChild:o.content.firstChild},r=t?()=>B(()=>document.importNode(i||(i=s()),!0)):()=>(i||(i=s())).cloneNode(!0);return r.cloneNode=r,r}function Me(e,t=window.document){let n=t[Ot]||(t[Ot]=new Set);for(let i=0,s=e.length;i<s;i++){let r=e[i];n.has(r)||(n.add(r),t.addEventListener(r,Dn))}}function Be(e,t,n){tt(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Rt(e,t){tt(e)||(t==null?e.removeAttribute("class"):e.className=t)}function X(e,t,n,i){if(i)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let s=n[0];e.addEventListener(t,n[0]=r=>s.call(e,n[1],r))}else e.addEventListener(t,n,typeof n!="function"&&n)}function p(e,t,n,i){if(n!==void 0&&!i&&(i=[]),typeof t!="function")return Ie(e,t,i,n);N(s=>Ie(e,t(),s,n),i)}function tt(e){return!!j.context&&!j.done&&(!e||e.isConnected)}function Dn(e){if(j.registry&&j.events&&j.events.find(([l,c])=>c===e))return;let t=e.target,n=`$$${e.type}`,i=e.target,s=e.currentTarget,r=l=>Object.defineProperty(e,"target",{configurable:!0,value:l}),o=()=>{let l=t[n];if(l&&!t.disabled){let c=t[`${n}Data`];if(c!==void 0?l.call(t,c,e):l.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&r(t.host),!0},a=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),j.registry&&!j.done&&(j.done=_$HY.done=!0),e.composedPath){let l=e.composedPath();r(l[0]);for(let c=0;c<l.length-2&&(t=l[c],!!o());c++){if(t._$host){t=t._$host,a();break}if(t.parentNode===s)break}}else a();r(i)}function Ie(e,t,n,i,s){let r=tt(e);if(r){!n&&(n=[...e.childNodes]);let l=[];for(let c=0;c<n.length;c++){let d=n[c];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():l.push(d)}n=l}for(;typeof n=="function";)n=n();if(t===n)return n;let o=typeof t,a=i!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(r||o==="number"&&(t=t.toString(),t===n))return n;if(a){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=ue(e,n,i,l)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(r)return n;n=ue(e,n,i)}else{if(o==="function")return N(()=>{let l=t();for(;typeof l=="function";)l=l();n=Ie(e,l,n,i)}),()=>n;if(Array.isArray(t)){let l=[],c=n&&Array.isArray(n);if(et(l,t,n,s))return N(()=>n=Ie(e,l,n,i,!0)),()=>n;if(r){if(!l.length)return n;if(i===void 0)return n=[...e.childNodes];let d=l[0];if(d.parentNode!==e)return n;let u=[d];for(;(d=d.nextSibling)!==i;)u.push(d);return n=u}if(l.length===0){if(n=ue(e,n,i),a)return n}else c?n.length===0?Pt(e,l,i):Rn(e,n,l):(n&&ue(e),Pt(e,l));n=l}else if(t.nodeType){if(r&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=ue(e,n,i,t);ue(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function et(e,t,n,i){let s=!1;for(let r=0,o=t.length;r<o;r++){let a=t[r],l=n&&n[e.length],c;if(!(a==null||a===!0||a===!1))if((c=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))s=et(e,a,l)||s;else if(c==="function")if(i){for(;typeof a=="function";)a=a();s=et(e,Array.isArray(a)?a:[a],Array.isArray(l)?l:[l])||s}else e.push(a),s=!0;else{let d=String(a);l&&l.nodeType===3&&l.data===d?e.push(l):e.push(document.createTextNode(d))}}return s}function Pt(e,t,n=null){for(let i=0,s=t.length;i<s;i++)e.insertBefore(t[i],n)}function ue(e,t,n,i){if(n===void 0)return e.textContent="";let s=i||document.createTextNode("");if(t.length){let r=!1;for(let o=t.length-1;o>=0;o--){let a=t[o];if(s!==a){let l=a.parentNode===e;!r&&!o?l?e.replaceChild(s,a):e.insertBefore(s,n):l&&a.remove()}else r=!0}}else e.insertBefore(s,n);return[s]}var sr=Symbol();var nt=Symbol("store-raw"),fe=Symbol("store-node"),Q=Symbol("store-has"),Dt=Symbol("store-self");function Lt(e){let t=e[ne];if(!t&&(Object.defineProperty(e,ne,{value:t=new Proxy(e,Mn)}),!Array.isArray(e))){let n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);for(let s=0,r=n.length;s<r;s++){let o=n[s];i[o].get&&Object.defineProperty(e,o,{enumerable:i[o].enumerable,get:i[o].get.bind(t)})}}return t}function Ne(e){let t;return e!=null&&typeof e=="object"&&(e[ne]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function xe(e,t=new Set){let n,i,s,r;if(n=e!=null&&e[nt])return n;if(!Ne(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let o=0,a=e.length;o<a;o++)s=e[o],(i=xe(s,t))!==s&&(e[o]=i)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let o=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let l=0,c=o.length;l<c;l++)r=o[l],!a[r].get&&(s=e[r],(i=xe(s,t))!==s&&(e[r]=i))}return e}function Ue(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function _e(e,t,n){if(e[t])return e[t];let[i,s]=y(n,{equals:!1,internal:!0});return i.$=s,e[t]=i}function Ln(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===ne||t===fe||(delete n.value,delete n.writable,n.get=()=>e[ne][t]),n}function It(e){De()&&_e(Ue(e,fe),Dt)()}function In(e){return It(e),Reflect.ownKeys(e)}var Mn={get(e,t,n){if(t===nt)return e;if(t===ne)return n;if(t===je)return It(e),n;let i=Ue(e,fe),s=i[t],r=s?s():e[t];if(t===fe||t===Q||t==="__proto__")return r;if(!s){let o=Object.getOwnPropertyDescriptor(e,t);De()&&(typeof r!="function"||e.hasOwnProperty(t))&&!(o&&o.get)&&(r=_e(i,t,r)())}return Ne(r)?Lt(r):r},has(e,t){return t===nt||t===ne||t===je||t===fe||t===Q||t==="__proto__"?!0:(De()&&_e(Ue(e,Q),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:In,getOwnPropertyDescriptor:Ln};function He(e,t,n,i=!1){if(!i&&e[t]===n)return;let s=e[t],r=e.length;n===void 0?(delete e[t],e[Q]&&e[Q][t]&&s!==void 0&&e[Q][t].$()):(e[t]=n,e[Q]&&e[Q][t]&&s===void 0&&e[Q][t].$());let o=Ue(e,fe),a;if((a=_e(o,t,s))&&a.$(()=>n),Array.isArray(e)&&e.length!==r){for(let l=e.length;l<r;l++)(a=o[l])&&a.$();(a=_e(o,"length",r))&&a.$(e.length)}(a=o[Dt])&&a.$()}function Mt(e,t){let n=Object.keys(t);for(let i=0;i<n.length;i+=1){let s=n[i];He(e,s,t[s])}}function Bn(e,t){if(typeof t=="function"&&(t=t(e)),t=xe(t),Array.isArray(t)){if(e===t)return;let n=0,i=t.length;for(;n<i;n++){let s=t[n];e[n]!==s&&He(e,n,s)}He(e,"length",i)}else Mt(e,t)}function $e(e,t,n=[]){let i,s=e;if(t.length>1){i=t.shift();let o=typeof i,a=Array.isArray(e);if(Array.isArray(i)){for(let l=0;l<i.length;l++)$e(e,[i[l]].concat(t),n);return}else if(a&&o==="function"){for(let l=0;l<e.length;l++)i(e[l],l)&&$e(e,[l].concat(t),n);return}else if(a&&o==="object"){let{from:l=0,to:c=e.length-1,by:d=1}=i;for(let u=l;u<=c;u+=d)$e(e,[u].concat(t),n);return}else if(t.length>1){$e(e[i],t,[i].concat(n));return}s=e[i],n=[i].concat(n)}let r=t[0];typeof r=="function"&&(r=r(s,n),r===s)||i===void 0&&r==null||(r=xe(r),i===void 0||Ne(s)&&Ne(r)&&!Array.isArray(r)?Mt(s,r):He(e,i,r))}function it(...[e,t]){let n=xe(e||{}),i=Array.isArray(n),s=Lt(n);function r(...o){$t(()=>{i&&o.length===1?Bn(n,o[0]):$e(n,o)})}return[s,r]}var cr=Symbol("store-root");async function Nt(){let e=window.location.href||"",t=new URL(e),i=t.searchParams.get("code"),s=window.location.href;if(i)return t.search="",window.history.replaceState({},"",t),fetch(`${h.BASE_URL}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",client_id:h.clientId,code:i,redirect_uri:window.location.href,code_verifier:localStorage.getItem("pkce_code_verifier")})}).then(r=>r.json()).then(r=>(localStorage.removeItem("pkce_code_verifier"),h.accessToken=r.access_token,null)).catch(r=>{console.error(r)});{let r=Bt(),o="S256",a=Bt();localStorage.setItem("pkce_code_verifier",a);let l=await Hn(a),c=`${h.BASE_URL}/oauth/authorize?response_type=code&client_id=${h.clientId}&redirect_uri=${s}&state=${encodeURIComponent(r)}&code_challenge=${encodeURIComponent(l)}&code_challenge_method=${o}`;window.location.assign(c)}}async function Ut(){try{let e=await fetch(`${h.BASE_URL}/api/v1/me`,{headers:{Authorization:`Bearer ${h.accessToken}`}});if(!e.ok){let n=await e.json();console.error(n.error||"Error fetching user details");return}let t=await e.json();if(!t||!t.id){console.error("Invalid user data");return}return{id:t.id}}catch(e){console.error("Error fetching user details:",e);return}}function Nn(e){let n=new TextEncoder().encode(e);return window.crypto.subtle.digest("SHA-256",n)}function Un(e){return btoa(String.fromCharCode.apply(null,Array.from(new Uint8Array(e)))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Hn(e){let t=await Nn(e);return Un(t)}function Bt(){let e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,t=>("0"+t.toString(16)).substr(-2)).join("")}var ke=e=>typeof e=="function"?e:function(){return e},Vn=typeof self<"u"?self:null,Ce=typeof window<"u"?window:null,oe=Vn||Ce||oe,zn="2.0.0",K={connecting:0,open:1,closing:2,closed:3},Fn=1e4,qn=1e3,I={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Z={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},rt={longpoll:"longpoll",websocket:"websocket"},Wn={complete:4},Ve=class{constructor(e,t,n,i){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(i=>i.status===e).forEach(i=>i.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Ht=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Kn=class{constructor(e,t,n){this.state=I.closed,this.topic=e,this.params=ke(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Ve(this,Z.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ht(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=I.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(i=>i.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=I.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=I.closed,this.socket.remove(this)}),this.onError(i=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,i),this.isJoining()&&this.joinPush.reset(),this.state=I.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Ve(this,Z.leave,ke({}),this.timeout).send(),this.state=I.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Z.reply,(i,s)=>{this.trigger(this.replyEventName(s),i)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Z.close,e)}onError(e){return this.on(Z.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new Ve(this,e,function(){return t},n);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=I.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Z.close,"leave")},n=new Ve(this,Z.leave,ke({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,i){return this.topic!==e?!1:i&&i!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:i}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=I.joining,this.joinPush.resend(e))}trigger(e,t,n,i){let s=this.onMessage(e,t,n,i);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===e);for(let o=0;o<r.length;o++)r[o].callback(s,n,i||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===I.closed}isErrored(){return this.state===I.errored}isJoined(){return this.state===I.joined}isJoining(){return this.state===I.joining}isLeaving(){return this.state===I.leaving}},Fe=class{static request(e,t,n,i,s,r,o){if(oe.XDomainRequest){let a=new oe.XDomainRequest;return this.xdomainRequest(a,e,t,i,s,r,o)}else{let a=new oe.XMLHttpRequest;return this.xhrRequest(a,e,t,n,i,s,r,o)}}static xdomainRequest(e,t,n,i,s,r,o){return e.timeout=s,e.open(t,n),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},r&&(e.ontimeout=r),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,n,i,s,r,o,a){return e.open(t,n,!0),e.timeout=r,e.setRequestHeader("Content-Type",i),e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===Wn.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let s=t?`${t}[${i}]`:i,r=e[i];typeof r=="object"?n.push(this.serialize(r,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(r))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Gn=e=>{let t="",n=new Uint8Array(e),i=n.byteLength;for(let s=0;s<i;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ae=class{constructor(e){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=K.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+rt.websocket),"$1/"+rt.longpoll)}endpointURL(){return Fe.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=K.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===K.open||this.readyState===K.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:i}=e;this.token=n}else t=0;switch(t){case 200:i.forEach(s=>{setTimeout(()=>this.onmessage({data:s}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=K.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){typeof e!="string"&&(e=Gn(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",e.join(` | ||
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=K.closed;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,n,i,s){let r,o=()=>{this.reqs.delete(r),i()};r=Fe.request(e,this.endpointURL(),t,n,this.timeout,o,a=>{this.reqs.delete(r),this.isActive()&&s(a)}),this.reqs.add(r)}};var ze={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,i,s,r,o]=JSON.parse(e);return t({join_ref:n,ref:i,topic:s,event:r,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:i,topic:s,payload:r}=e,o=this.META_LENGTH+t.length+n.length+s.length+i.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),l.setUint8(c++,i.length),Array.from(t,u=>l.setUint8(c++,u.charCodeAt(0))),Array.from(n,u=>l.setUint8(c++,u.charCodeAt(0))),Array.from(s,u=>l.setUint8(c++,u.charCodeAt(0))),Array.from(i,u=>l.setUint8(c++,u.charCodeAt(0)));var d=new Uint8Array(a.byteLength+r.byteLength);return d.set(new Uint8Array(a),0),d.set(new Uint8Array(r),a.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+i));o=o+i;let l=n.decode(e.slice(o,o+s));o=o+s;let c=n.decode(e.slice(o,o+r));o=o+r;let d=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:d}},decodeReply(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(a,a+i));a=a+i;let c=n.decode(e.slice(a,a+s));a=a+s;let d=n.decode(e.slice(a,a+r));a=a+r;let u=n.decode(e.slice(a,a+o));a=a+o;let $=e.slice(a,e.byteLength),w={status:u,response:$};return{join_ref:l,ref:c,topic:d,event:Z.reply,payload:w}},decodeBroadcast(e,t,n){let i=t.getUint8(1),s=t.getUint8(2),r=this.HEADER_LENGTH+2,o=n.decode(e.slice(r,r+i));r=r+i;let a=n.decode(e.slice(r,r+s));r=r+s;let l=e.slice(r,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Vt=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||Fn,this.transport=t.transport||oe.WebSocket||Ae,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||oe&&oe.sessionStorage,this.establishedConnections=0,this.defaultEncoder=ze.encode.bind(ze),this.defaultDecoder=ze.decode.bind(ze),this.closeWasClean=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ae?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Ce&&Ce.addEventListener&&(Ce.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Ce.addEventListener("pageshow",i=>{n===this.connectClock&&(n=null,this.connect())})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=i=>t.rejoinAfterMs?t.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>t.reconnectAfterMs?t.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(i,s,r)=>{console.log(`${i}: ${s}`,r)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=ke(t.params||{}),this.endPoint=`${e}/${rt.websocket}`,this.vsn=t.vsn||zn,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ht(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Ae}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Fe.appendParams(Fe.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(e,t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ke(e)),!this.conn&&(this.longPollFallbackMs&&this.transport!==Ae?this.connectWithFallback(Ae,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(s=>{s.ref===t&&(this.off([i]),e(Date.now()-n))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,i=!0,s,r,o=a=>{this.log("transport",`falling back to ${e.name}...`,a),this.off([s,r]),i=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),r=this.onError(a=>{this.log("transport","error",a),i&&!n&&(clearTimeout(this.fallbackTimer),o(a))}),this.onOpen(()=>{if(n=!0,!i)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping(a=>{this.log("transport","connected to primary after",a),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),qn,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();this.waitForBufferDone(()=>{this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1)},150*t)}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===K.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1)},150*t)}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,n])=>n(e))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,i])=>{i(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Z.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case K.connecting:return"connecting";case K.open:return"open";case K.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new Kn(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:i,ref:s,join_ref:r}=e;this.log("push",`${t} ${n} (${r}, ${s})`,i)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:i,payload:s,ref:r,join_ref:o}=t;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${s.status||""} ${n} ${i} ${r&&"("+r+")"||""}`,s);for(let a=0;a<this.channels.length;a++){let l=this.channels[a];l.isMember(n,i,s,o)&&l.trigger(i,s,r,o)}for(let a=0;a<this.stateChangeCallbacks.message.length;a++){let[,l]=this.stateChangeCallbacks.message[a];l(t)}})}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};async function zt(e){let t=e.propertyId?`${h.BASE_URL}/api/v1/next_auction/${e.propertyId}`:`${h.BASE_URL}/api/v1/next_auction/${e.source}/${e.sourceAgencyId}/${e.sourceId}`;return fetch(t,{headers:{Authorization:"Bearer "+h.accessToken}}).then(n=>{if(n.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return n.json()}).then(Wt).catch(n=>{throw console.error("err",n),n})}function Ft(e,t){return new Promise((n,i)=>{h.socket!=null&&h.socket.disconnect(),h.socket=new Vt(h.WS_URL,{params:{token:h.accessToken}}),h.socket.connect();let s=h.socket.channel(`auction:${e}`,{});s.on("outbid",r=>{t&&t(r.bid)}),s.join().receive("ok",r=>{n(s)}).receive("error",r=>{console.error("Unable to join",r),h.socket!=null&&h.socket.disconnect(),i(r)})})}function qt(e){return fetch(`${h.BASE_URL}/api/v1/auction_registration`,{method:"POST",body:JSON.stringify({auctionId:e}),headers:{Authorization:"Bearer "+h.accessToken,"Content-Type":"application/json"}}).then(t=>{if(t.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return t.json()}).then(Wt).catch(t=>{throw console.error("err",t),t})}function Wt(e){let n=(Array.isArray(e.bids)?e.bids:[]).map(r=>({id:r.id,amount:r.amount,createdAt:r.createdAt,newEndDate:r.newEndDate,userAnonymousId:r.userAnonymousId,participantId:r.participantId})),i=n.reduce((r,o)=>o.amount>r.amount?o:r,{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:""}),s=e.registration?{isUserAllowed:e.registration.isUserAllowed,isRegistrationAccepted:e.registration.isRegistrationAccepted,isParticipant:e.registration.isParticipant}:null;return{id:e.id,startDate:e.startDate,endDate:e.endDate,startingPrice:e.startingPrice,step:e.step,bids:n,highestBid:i,agentEmail:e.agentEmail,agentPhone:e.agentPhone,registration:s,isPrivate:e.isPrivate,currency:{symbol:e.currency.symbol,code:e.currency.code,isBefore:e.currency.isBefore}}}async function Kt(e,t){return fetch(`${h.BASE_URL}/api/v1/bid`,{method:"POST",body:JSON.stringify({auctionId:e.id,amount:t}),headers:{Authorization:"Bearer "+h.accessToken,"Content-Type":"application/json"}}).then(n=>{if(n.status===401)throw console.error("Unauthorized"),new Error("Unauthorized");return n.status===422?n.json().then(i=>{throw i}):n.json()}).then(n=>({id:n.id,amount:n.amount,createdAt:n.createdAt,newEndDate:n.newEndDate,userAnonymousId:n.userAnonymousId,participantId:n.participantId})).catch(n=>{throw console.error("err",n),n})}var h={BASE_URL:"",WS_URL:"",accessToken:null,socket:null,DOMAIN:"",clientId:null};function Jn(e,t="production"){switch(h.clientId=e,t){case"local":h.DOMAIN="localhost:4000",h.BASE_URL=`http://${h.DOMAIN}`,h.WS_URL=`ws://${h.DOMAIN}/api/socket`;break;case"staging":h.DOMAIN="staging.encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break;case"production":h.DOMAIN="encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break;default:console.log("Widget client: Unknown environment, defaulting to production."),h.DOMAIN="encheres-immo.com",h.BASE_URL=`https://${h.DOMAIN}`,h.WS_URL=`wss://${h.DOMAIN}/api/socket`;break}}var G={initEIClient:Jn,getNextAuctionById:zt,authenticate:Nt,subscribeToAuction:Ft,registerUserToAuction:qt,me:Ut,placeBidOnAuction:Kt};function ae(e){let t=new Date().setMilliseconds(0),n=new Date(e.startDate).setMilliseconds(0);return t<n}function ee(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0),i=new Date(e.startDate).setMilliseconds(0);return t<=n&&t>=i}function de(e){let t=new Date().setMilliseconds(0),n=new Date(e.endDate).setMilliseconds(0);return t>n}function U(e,t){let n=e==null?"--":e.toString();return t?t.isBefore?`${qe(t)} ${n}`:`${n} ${qe(t)}`:`${n} \u20AC`}function qe(e){return e.symbol||e.code||""}function st(e){return new Date(e)}function he(e){return st(e).toLocaleString()}var Yn=m("<div><p id=auction-widget-status>D\xE9marre dans</p><p id=auction-widget-countdown>"),Xn=m("<div><p id=auction-widget-status>Se termine dans</p><p id=auction-widget-countdown>"),Qn=m("<p id=auction-widget-status>Vente termin\xE9e"),Zn=m('<p class="auction-widget-detail auction-widget-label">Meilleure offre'),ei=m('<p class="auction-widget-detail auction-widget-accent">'),ti=m('<div><div id=auction-widget-header></div><div><div id=auction-widget-description><div><p class="auction-widget-detail auction-widget-label">D\xE9but</p><p class=auction-widget-detail> </p></div><div><p class="auction-widget-detail auction-widget-label">Fin</p><p class=auction-widget-detail></p></div><div><p class="auction-widget-detail auction-widget-label">Prix de d\xE9part</p><p class="auction-widget-detail auction-widget-accent"> </p></div><div><p class="auction-widget-detail auction-widget-label">Palier</p><p class="auction-widget-detail auction-widget-accent"></p></div></div><div class="auction-widget-section auction-widget-border-t"><div>'),ni=m('<div><p class="auction-widget-detail auction-widget-label">Vente priv\xE9e</p><p class=auction-widget-detail>Inscrivez-vous pour voir les participations'),ii=e=>{let[t,n]=y(""),[i,s]=y(ae(e.auction)),[r,o]=y(ee(e.auction)),[a,l]=y(de(e.auction));function c($,w){let _=($.getTime()-w.getTime())/1e3,x=Math.floor(_/(3600*24)),H=Math.floor(_%(3600*24)/3600),F=Math.floor(_%3600/60),E=Math.floor(_%60);return{days:x,hours:H,minutes:F,seconds:E}}function d($){if(l(de(e.auction)),o(ee(e.auction)),s(ae(e.auction)),de($)){clearInterval(u);return}let w=ae($)?$.startDate:$.endDate,_=new Date,x=c(st(w),_);n(`${x.days}j ${x.hours}h ${x.minutes}m ${x.seconds}s`)}let u=setInterval(()=>{d(e.auction)},1e3);return(()=>{var $=ti(),w=$.firstChild,_=w.nextSibling,x=_.firstChild,H=x.firstChild,F=H.firstChild,E=F.nextSibling,P=E.firstChild,R=H.nextSibling,q=R.firstChild,pe=q.nextSibling,Y=R.nextSibling,C=Y.firstChild,A=C.nextSibling,O=A.firstChild,L=Y.nextSibling,Te=L.firstChild,we=Te.nextSibling,ut=x.nextSibling,Ee=ut.firstChild;return p(w,g(S,{get when(){return i()},get children(){var M=Yn(),le=M.firstChild,be=le.nextSibling;return p(be,t),M}}),null),p(w,g(S,{get when(){return r()},get children(){var M=Xn(),le=M.firstChild,be=le.nextSibling;return p(be,t),M}}),null),p(w,g(S,{get when(){return a()},get children(){return Qn()}}),null),p(E,()=>he(e.auction.startDate),P),p(pe,()=>he(e.auction.endDate)),p(A,()=>U(e.auction.startingPrice),O),p(we,()=>U(e.auction.step)),p(Ee,g(S,{get when(){return!e.auction.isPrivate||e.auction.isPrivate&&e.auction.registration&&e.auction.registration.isUserAllowed&&e.auction.registration.isRegistrationAccepted},get fallback(){return ni()},get children(){return[Zn(),(()=>{var M=ei();return p(M,(()=>{var le=T(()=>!!e.auction.highestBid.participantId);return()=>le()?U(e.auction.highestBid.amount,e.auction.currency):U(null,e.auction.currency)})()),M})()]}})),$})()},Gt=ii;var ri=m('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-history-area><p class="auction-widget-label auction-widget-detail">Historique des offres</p><ul id=auction-widget-scroll>'),si=m('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i>Vous</span>avez ench\xE9ri'),oi=m("<li><p id=auction-widget-bid-amount>"),ai=m('<div><p class=auction-widget-date>Le </p><span class=auction-widget-user><i class="fas fa-user"></i></span>a ench\xE9ri'),li=e=>g(S,{get when(){return(de(e.auction)||ee(e.auction)&&e.bids.length>0)&&(!e.auction.isPrivate||e.auction.isPrivate&&e.auction.registration&&e.auction.registration.isUserAllowed&&e.auction.registration.isRegistrationAccepted)},get children(){var t=ri(),n=t.firstChild,i=n.firstChild,s=i.nextSibling;return p(s,g(Qe,{get each(){return[...e.bids].sort((r,o)=>o.amount-r.amount)},children:(r,o)=>(()=>{var a=oi(),l=a.firstChild;return p(a,g(S,{get when(){return r.participantId===e.user.id},get fallback(){return(()=>{var c=ai(),d=c.firstChild,u=d.firstChild,$=d.nextSibling,w=$.firstChild;return p(d,()=>he(r.createdAt),null),p($,()=>r.userAnonymousId,null),c})()},get children(){var c=si(),d=c.firstChild,u=d.firstChild;return p(d,()=>he(r.createdAt),null),c}}),l),p(l,()=>U(r.amount,e.auction.currency)),a})()})),t}}),Jt=li;var ci=m('<div class=auction-widget-icon><i class="fas fa-check">'),ui=m("<div class=auction-widget-icon><i>"),fi=m("<h3>"),di=m("<div><div id=auction-widget-modal-background></div><div class=auction-widget-modal><div id=auction-widget-modal-content><div><div><div>"),hi=e=>(()=>{var t=di(),n=t.firstChild,i=n.nextSibling,s=i.firstChild,r=s.firstChild,o=r.firstChild,a=o.firstChild;return p(r,g(S,{get when(){return e.success},get children(){return ci()}}),o),p(r,g(S,{get when(){return e.icon_class},get children(){var l=ui(),c=l.firstChild;return N(()=>Rt(c,e.icon_class)),l}}),o),p(o,g(S,{get when(){return e.title},get children(){var l=fi();return p(l,()=>e.title),l}}),a),p(a,()=>e.children),t})(),ge=hi;var gi=m("<tr><td class=auction-widget-td>Offre pr\xE9c\xE9dente</td><td class=auction-widget-amount>"),mi=m("<table id=auction-widget-table><tbody><tr><td class=auction-widget-td>Votre offre</td><td class=auction-widget-amount>"),pi=m("<p class=auction-widget-modal-note>Votre offre est sensiblement sup\xE9rieure \xE0 l'offre pr\xE9c\xE9dente. \xCAtes-vous s\xFBr de vouloir continuer ?"),wi=m("<p id=email-error class=auction-widget-modal-note>Vous devez au moins ench\xE9rir <!>."),bi=m('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Confirmer</button><button class=auction-widget-btn>Annuler'),yi=m('<div class="auction-widget-section auction-widget-border-t"><div id=auction-widget-bid data-testid=auction-widget-bid><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Ench\xE8re rapide</p><div id=auction-widget-fast-bid><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span><span><button class="auction-widget-btn auction-widget-custom">+ </button></span></div><div class=auction-widget-history-area><p class="auction-widget-detail auction-widget-label auction-widget-text-left">Votre montant</p><div id=auction-widget-bid-form><input type=number min=0 step=1><div id=auction-widget-currency><span></span></div><button class="auction-widget-btn auction-widget-custom">Ench\xE9rir'),vi=e=>{let t=e.auction.highestBid?e.auction.highestBid.amount+e.auction.step:e.auction.startingPrice,[n,i]=y(t),[s,r]=y(!1),[o,a]=y(!1),[l,c]=y(!1),[d,u]=y(Y(1,!1,e.auction)),[$,w]=y(Y(2,!1,e.auction)),[_,x]=y(Y(3,!1,e.auction)),[H,F]=y(0);function E(C,A){let O=C.highestBid?C.highestBid.amount:C.startingPrice-C.step;A>O+C.step*3?c(!0):c(!1)}function P(C,A){return()=>{let O=A.highestBid?A.highestBid.amount:null,L;O!==null?L=O+C*A.step:L=A.startingPrice+A.step*(C-1),i(L),E(A,L),r(!0)}}function R(){return()=>{E(e.auction,n()),r(!0)}}function q(){return()=>{a(!1),r(!1)}}function pe(C,A){return()=>{G.placeBidOnAuction(A,C).then(O=>{r(!1),a(!1),u(Y(1,!0,A)),w(Y(2,!0,A)),x(Y(3,!0,A))}).catch(O=>{O.code=="bid_amount_too_low"&&(a(!0),F(O.min))})}}function Y(C,A,O){let L;return A||O.bids&&O.bids.length>0?L=C*O.step:L=(C-1)*O.step,U(L,O.currency)}return g(S,{get when(){return T(()=>!!(e.isLogged()&&e.auction.registration&&e.auction.registration.isRegistrationAccepted&&e.auction.registration.isParticipant))()&&ee(e.auction)},get children(){var C=yi(),A=C.firstChild,O=A.firstChild,L=O.nextSibling,Te=L.firstChild,we=Te.firstChild,ut=we.firstChild,Ee=Te.nextSibling,M=Ee.firstChild,le=M.firstChild,be=Ee.nextSibling,We=be.firstChild,Fi=We.firstChild,fn=L.nextSibling,dn=fn.firstChild,hn=dn.nextSibling,Ke=hn.firstChild,ft=Ke.nextSibling,gn=ft.firstChild,mn=ft.nextSibling;return X(we,"click",P(1,e.auction),!0),p(we,d,null),X(M,"click",P(2,e.auction),!0),p(M,$,null),X(We,"click",P(3,e.auction),!0),p(We,_,null),Ke.$$input=V=>i(parseInt(V.currentTarget.value)),p(gn,()=>qe(e.auction.currency)),X(mn,"click",R(),!0),p(C,g(S,{get when(){return s()},get children(){return g(ge,{title:"Vous \xEAtes sur le point d'ench\xE9rir",success:!1,icon_class:"fas fa-gavel",get children(){return[(()=>{var V=mi(),ie=V.firstChild,re=ie.firstChild,dt=re.firstChild,pn=dt.nextSibling;return p(ie,g(S,{get when(){return e.auction.highestBid.participantId},get children(){var ht=gi(),wn=ht.firstChild,bn=wn.nextSibling;return p(bn,()=>U(e.auction.highestBid.amount)),ht}}),re),p(pn,()=>U(n())),V})(),g(S,{get when(){return l()},get children(){return pi()}}),g(S,{get when(){return o()},get children(){var V=wi(),ie=V.firstChild,re=ie.nextSibling,dt=re.nextSibling;return p(V,()=>U(H()),re),V}}),(()=>{var V=bi(),ie=V.firstChild,re=ie.nextSibling;return X(ie,"click",pe(n(),e.auction),!0),X(re,"click",q(),!0),V})()]}})}}),null),N(()=>Ke.value=n()),C}})},Yt=vi;Me(["click","input"]);var Si=m('<div class=auction-widget-section><button class="auction-widget-btn auction-widget-custom">Je veux participer'),$i=m('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Se connecter</button><button class=auction-widget-btn>Annuler'),xi=m("<div id=auction-widget-agent-link><p class=auction-widget-modal-note>Pas encore de compte ?</p><button id=auction-widget-link>Contacter l'agent"),_i=m("<a target=_blank>les conditions g\xE9n\xE9rales d'utilisation"),Ai=m('<div class=auction-widget-action><button class="auction-widget-btn auction-widget-custom">Valider</button><button class=auction-widget-btn>Annuler'),Ci=m('<div class=auction-widget-contact><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-envelope"></i></a><a class="auction-widget-btn auction-widget-custom"><i class="fas fa-phone">'),ki=m("<div class=auction-widget-action><button class=auction-widget-btn>Fermer"),Ti=e=>{e.isLogging()&&n();function t(){return()=>{n()}}function n(){G.authenticate().then(()=>{e.setIsLogged(!0),G.me().then(l=>{e.updateUser(l)})})}function i(){G.registerUserToAuction(e.auction.id).then(l=>{e.setAuction(l)})}let[s,r]=y(!1),[o,a]=y(!1);return g(S,{get when(){return!e.isLogged()||!e.auction.registration},get children(){return[(()=>{var l=Si(),c=l.firstChild;return c.$$click=()=>r(!0),l})(),g(S,{get when(){return T(()=>!!s())()&&!e.isLogged()},get children(){return g(ge,{title:"Vous devez \xEAtre connect\xE9",icon_class:"fas fa-user-lock",success:!1,get children(){return[(()=>{var l=$i(),c=l.firstChild,d=c.nextSibling;return X(c,"click",t(),!0),d.$$click=()=>r(!1),l})(),(()=>{var l=xi(),c=l.firstChild,d=c.nextSibling;return d.$$click=()=>{a(!0),r(!1)},l})()]}})}}),g(S,{get when(){return s()&&e.isLogged()&&!e.auction.registration&&e.allowUserRegistration},get children(){return g(ge,{title:"Demande de participation",success:!1,icon_class:"fas fa-gavel",get children(){return["En cliquant sur Valider, je reconnais avoir lu et accept\xE9"," ",(()=>{var l=_i();return N(()=>Be(l,"href",e.tosUrl)),l})(),".",(()=>{var l=Ai(),c=l.firstChild,d=c.nextSibling;return c.$$click=()=>{i(),r(!1)},d.$$click=()=>r(!1),l})()]}})}}),g(S,{get when(){return s()&&e.isLogged()&&!e.auction.registration&&!e.allowUserRegistration||o()},get children(){return g(ge,{title:"Demande de participation",icon_class:"fas fa-gavel",success:!1,get children(){return[(()=>{var l=Ci(),c=l.firstChild,d=c.firstChild,u=c.nextSibling,$=u.firstChild;return p(c,()=>e.auction.agentEmail,null),p(u,()=>e.auction.agentPhone,null),N(w=>{var _="mailto:"+e.auction.agentEmail,x="tel:"+e.auction.agentPhone;return _!==w.e&&Be(c,"href",w.e=_),x!==w.t&&Be(u,"href",w.t=x),w},{e:void 0,t:void 0}),l})(),(()=>{var l=ki(),c=l.firstChild;return c.$$click=()=>a(!1)&&r(!1),l})()]}})}})]}})},Xt=Ti;Me(["click"]);var Ei=m("<p class=auction-widget-note>Vous \xEAtes observateur pour cette vente. Vous ne pouvez pas ench\xE9rir."),Oi=m("<p class=auction-widget-note>Votre demande d'observation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour voir les participations."),Pi=m("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 accept\xE9e. Attendez le d\xE9but de l'ench\xE8re pour ench\xE9rir."),ji=m("<p class=auction-widget-note>Votre demande de participation pour cette vente a \xE9t\xE9 refus\xE9e."),Ri=m("<p class=auction-widget-note>Votre demande de participation a \xE9t\xE9 transmise \xE0 l'agent responsable du bien. Vous serez inform\xE9 par email lorsqu'elle sera valid\xE9e."),Di=e=>{let{isLogged:t,auction:n}=e;return g(Ze,{get children(){return[g(se,{get when(){return T(()=>!!(t()&&n.registration&&n.registration.isRegistrationAccepted&&!n.registration.isParticipant))()&&ee(n)},get children(){return Ei()}}),g(se,{get when(){return T(()=>!!(t()&&n.registration&&n.registration.isRegistrationAccepted&&!n.registration.isParticipant))()&&ae(n)},get children(){return Oi()}}),g(se,{get when(){return T(()=>!!(t()&&n.registration&&n.registration.isRegistrationAccepted===!0))()&&ae(n)},get children(){return Pi()}}),g(se,{get when(){return t()&&n.registration&&n.registration.isRegistrationAccepted===!1},get children(){return ji()}}),g(se,{get when(){return t()&&n.registration&&n.registration.isRegistrationAccepted==null},get children(){return Ri()}})]}})},Qt=Di;var Li=m("<div id=auction-widget-box>"),[ot,Ii]=y(!1),[Mi,en]=y(!1),[Us,Bi]=y(!1),[at,Ni]=y({id:""}),[tn,Zt]=it([]),[me,lt]=it({id:"",startDate:0,endDate:0,startingPrice:0,step:0,bids:[],registration:{isUserAllowed:!1,isRegistrationAccepted:null,isParticipant:!1},isPrivate:!1,highestBid:{id:"",amount:0,createdAt:0,newEndDate:0,userAnonymousId:"",participantId:""},agentEmail:"",agentPhone:"",currency:{symbol:"",code:"",isBefore:!1}});function nn(e){G.getNextAuctionById(e).then(t=>{lt(t),Zt(t.bids),G.subscribeToAuction(t.id,n=>{Zt([...tn,n]);let i=n.newEndDate||t.endDate;lt({...t,highestBid:n,endDate:i})}).catch(n=>{console.error("Error subscribing to auction:",n)})})}function Ui(e,t){Ni(e),nn(t),en(!1)}var Hi=e=>{let{apiKey:t,propertyInfo:n,environment:i="production",allowUserRegistration:s,tosUrl:r}=e;G.initEIClient(t,i),nn(n);let o=window.location.href,l=new URLSearchParams(o.split("?")[1]).get("code");return l!=""&&l!=null&&(en(!0),Bi(!0)),(()=>{var c=Li();return p(c,g(S,{get when(){return me.id!=""},get children(){return[g(Gt,{auction:me,get user(){return at()}}),g(Xt,{auction:me,setAuction:lt,isLogged:ot,setIsLogged:Ii,isLogging:Mi,get updateUser(){return Ui(at(),n)},allowUserRegistration:s,tosUrl:r}),g(Qt,{isLogged:ot,auction:me}),g(Yt,{auction:me,isLogged:ot}),g(Jt,{bids:tn,auction:me,get user(){return at()}})]}})),c})()},rn=Hi;var J=document.getElementById("auction-widget"),sn=J?.getAttribute("api-key")||"",Vi=J?.getAttribute("api-env")||"production",ct=J?.getAttribute("property-id")||"",on=J?.getAttribute("source")||"",an=J?.getAttribute("source-agency-id")||"",ln=J?.getAttribute("source-id")||"",cn=J?.getAttribute("allow-user-registration")==="true",un=J?.getAttribute("tos-url")||"";if(cn&&un==="")throw new Error("Auction widget: 'tos-url' attribute must be provided when 'allow-user-registration' is set to true. Did you forget to add it? Or maybe the attribute got misspelled?");if(!(J instanceof HTMLElement))throw new Error("Auction widget: No root element found with id 'auction-widget'. Did you forget to add it? Or maybe the id attribute got misspelled?");if(sn=="")throw new Error("Auction widget: No 'api-key' attribute found. Did you forget to add it? Or maybe the attribute got misspelled?");if(ct==""&&(on==""||an==""||ln==""))throw new Error("Auction widget: Either 'property-id' or 'source', 'source-agency-id', and 'source-id' must be provided. Did you forget to add them? Or maybe the attributes got misspelled?");var zi=ct?{propertyId:ct}:{source:on,sourceAgencyId:an,sourceId:ln};jt(()=>g(rn,{apiKey:sn,propertyInfo:zi,environment:Vi,allowUserRegistration:cn,tosUrl:un}),J);})(); |
{ | ||
"name": "@encheres-immo/auction-widget", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"type": "module", | ||
@@ -32,3 +32,3 @@ "description": "Bring our real-estate auction widget to your website, powered by SolidJS & Enchères Immo's API", | ||
"solid-js": "^1.9.3", | ||
"@encheres-immo/widget-client": "0.3.1" | ||
"@encheres-immo/widget-client": "0.4.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "scripts": { |
@@ -43,4 +43,14 @@ # Enchères Immo's auction widget | ||
## Customization | ||
## Configuration | ||
### Features | ||
You can enable or disable features of the widget by setting the corresponding attributes on the HTML tag. Here are the available features: | ||
| Attribute | Default | Description | | ||
| ------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `allow-user-registration` | `true` | Display a button to allow users to register for the auction—This registration must be accepted by the agent later, or the user will not be able to place bids. If set to `false`, agent's contact information will be displayed instead. | | ||
### Styling | ||
You can customize the widget by setting CSS variables in your website's stylesheet. Here are the available variables: | ||
@@ -47,0 +57,0 @@ |
import { | ||
AuctionType, | ||
BidType, | ||
RegistrationType, | ||
UserType, | ||
@@ -66,1 +67,15 @@ } from "@encheres-immo/widget-client/types"; | ||
} | ||
/** | ||
* Factory function to create a registration, pass only the properties you want to override. | ||
*/ | ||
export function factoryRegistration( | ||
registrationParams: Partial<RegistrationType> = {} | ||
): RegistrationType { | ||
const baseRegistration: RegistrationType = { | ||
isUserAllowed: true, | ||
isRegistrationAccepted: true, | ||
isParticipant: true, | ||
}; | ||
return { ...baseRegistration, ...registrationParams }; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
148762
24
2563
100
5
+ Added@encheres-immo/widget-client@0.4.0(transitive)
- Removed@encheres-immo/widget-client@0.3.1(transitive)