@photonhealth/elements 0.17.4 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1054,7 +1054,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1054
1054
  }
1055
1055
  }
1056
1056
  }
1057
- `,ma=e=>(()=>{var t=nH(),r=t.firstChild,n=r.nextSibling;return E(r,b(xe,{size:"sm",color:"gray",get children(){return e.label}})),E(n,()=>e.children),t})(),lH=e=>{const[t,r,n]=e.split("-");return`${r}-${n}-${t}`};function dH(e){const t=Ln(),[r,n]=B(void 0),i=async()=>{const{data:s}=await t.apollo.query({query:sH,variables:{id:e.patientId}});s?.patient&&n(s?.patient)};pe(()=>{e.patientId&&i()});const a=N(()=>e.address||r()?.address),o=N(()=>{if(r()?.phone){const s=rH(r()?.phone);return s.valid?s.number.national:r()?.phone}return""});return b(Rr,{addChildrenDivider:!0,get children(){return[(()=>{var s=iH();return E(s,b(xe,{color:"gray",children:"Patient Info"}),null),E(s,b(X,{get when(){return e?.editPatient},get children(){return b(st,{variant:"secondary",size:"sm",get onClick(){return e?.editPatient},children:"Edit Patient"})}}),null),s})(),(()=>{var s=aH(),l=s.firstChild,d=l.firstChild,u=d.firstChild,c=d.nextSibling,h=c.firstChild;return E(s,b(xe,{size:"lg",bold:!0,get loading(){return!r()},sampleLoadingText:"Sally Patient",get children(){return r()?.name.full||"N/A"}}),l),E(u,b(ma,{label:"Email",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"fake@email.com",get children(){return r()?.email||"N/A"}})}}),null),E(u,b(ma,{label:"Phone",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"555-555-5555",get children(){return o()||"N/A"}})}}),null),E(u,b(ma,{label:"Address",get children(){return b(X,{get when(){return!r()||a()},get fallback(){return oH()},get children(){return[(()=>{var f=g1();return E(f,b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"123 Fake St",get children(){return a()?.street1}})),f})(),b(X,{get when(){return!r()||a()?.street2},get children(){var f=g1();return E(f,b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"Apt 3",get children(){return a()?.street2}})),f}}),(()=>{var f=g1();return E(f,b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"Brooklyn, NY 11221",get children(){return[N(()=>a()?.city),", ",N(()=>a()?.state)," ",N(()=>a()?.postalCode)]}})),f})()]}})}}),null),E(h,b(ma,{label:"DOB",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"female",get children(){return lH(r()?.dateOfBirth||"N/A")}})}}),null),E(h,b(ma,{label:"Weight",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"150 lbs",get children(){return e?.weight?`${e.weight} ${e.weightUnit}`:"N/A"}})}}),null),E(h,b(ma,{label:"Sex",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"female",get children(){return r()?.sex||"N/A"}})}}),null),E(h,b(ma,{label:"Gender",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"female",get children(){return r()?.gender||"N/A"}})}}),null),s})()]}})}var uH=x('<div class="group relative w-max"><span class="pointer-events-none absolute -bottom-8 left-0 w-max rounded bg-gray-900 px-2 py-1 text-sm font-medium text-gray-50 opacity-0 shadow transition-opacity group-hover:opacity-100">');function O6(e){return(()=>{var t=uH(),r=t.firstChild;return E(t,()=>e.children,r),E(r,()=>e.text),t})()}var cH=x('<button class="text-gray-700 hover:text-gray-900 hover:bg-blue-50 rounded-md p-2 disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-gray-700 disabled:cursor-not-allowed"type=button>');const hH=e=>{const t=Be({size:"md"},e),r=(()=>{var n=cH();return n.$$click=()=>{e.loading||e.onClick()},E(n,b(X,{get when(){return!e.loading},get children(){return b(at,{get name(){return e.iconName},get size(){return t.iconSize}})}}),null),E(n,b(X,{get when(){return e.loading},get children(){return b(ni,{get size(){return t.iconSize}})}}),null),J(i=>{var a=e.label,o=e.disabled;return a!==i.e&&pt(n,"aria-label",i.e=a),o!==i.t&&(n.disabled=i.t=o),i},{e:void 0,t:void 0}),n})();return N(()=>N(()=>!!e.disabled)()?r:b(O6,{get text(){return e.label},children:r}))};hn(["click"]);var fH=x('<div class="px-4 sm:px-6 py-3.5">Actions'),pH=x('<div class="px-4 sm:px-6 py-4 col-span-3 text-center">'),mH=x('<div class="grid w-full text-xs relative"><div><div class="px-4 sm:px-6 py-3.5">Medication</div><div class="px-4 sm:px-6 py-3.5 cursor-pointer flex">Written<div class=ml-1>'),gH=x('<div class="px-4 sm:px-6 py-4 truncate"><div class="flex-col flex-1 min-w-0 whitespace-normal"><div class="text-gray-500 text-ellipsis overflow-hidden">'),vH=x('<div class="px-4 sm:px-6 py-4 self-center">'),yH=x('<div class="px-4 sm:px-6 py-4 m-auto">'),v1=x('<div class="px-4 sm:px-6 py-4 select-none">'),bH=x('<div class="text-ellipsis overflow-hidden">'),$H=x('<a class="text-ellipsis block overflow-hidden text-blue-500 underline"target=_blank>');function wH(e){const t=rB(),[r,n]=B(void 0),i=N(()=>e.enableRefillButton),a=N(()=>Zt("grid grid-cols-subgrid border-b text-xs font-semibold text-gray-900 sticky top-0 bg-white z-10",{"col-span-3":i(),"col-span-2":!i()})),o=async(s,l)=>{if(r()===void 0){if(n(s.id),!t)throw new Error("Refill requires <PrescribeProvider>");try{await t.tryCreatePrescription({...s,treatment:l,effectiveDate:If(new Date,"yyyy-MM-dd").toString(),diagnoseCodes:s.diagnoses?.map(d=>d.code)||[]})}finally{n(void 0)}}};return(()=>{var s=mH(),l=s.firstChild,d=l.firstChild,u=d.nextSibling,c=u.firstChild,h=c.nextSibling;return u.$$click=()=>e.onSortOrderToggle(),E(h,b(X,{get when(){return e.sortOrder==="desc"},get children(){return b(at,{name:"chevronDown",size:"sm"})}}),null),E(h,b(X,{get when(){return e.sortOrder==="asc"},get children(){return b(at,{name:"chevronUp",size:"sm"})}}),null),E(l,b(X,{get when(){return e.enableRefillButton},get children(){return fH()}}),null),E(s,b(X,{get when(){return!e.isLoading&&e.rowItems},get fallback(){return[b(y1,{get enableRefill(){return e.enableRefillButton}}),b(y1,{get enableRefill(){return e.enableRefillButton}}),b(y1,{get enableRefill(){return e.enableRefillButton}})]},get children(){return b(xt,{get each(){return e.rowItems},children:f=>[(()=>{var p=gH(),g=p.firstChild,v=g.firstChild;return E(g,b(kH,{get treatmentName(){return f.treatment.name},get prescriptionId(){return f.prescription?.id},get enableLinks(){return e.enableLinks},get linkBaseUrl(){return e.baseURL}}),v),E(v,()=>aQ(f.prescription)),p})(),(()=>{var p=vH();return E(p,()=>xH(f)),p})(),b(X,{get when(){return e.enableRefillButton},get children(){var p=yH();return E(p,b(hH,{iconName:"documentPlus",iconSize:"sm",label:"Refill",onClick:()=>{f.prescription&&o(f.prescription,f.treatment)},get disabled(){return!f.prescription},get loading(){return N(()=>!!f.prescription)()&&r()===f.prescription.id}})),p}})]})}}),null),E(s,b(X,{get when(){return!e.isLoading&&e.rowItems&&e.rowItems.length===0},get children(){var f=pH();return E(f,b(xe,{color:"gray",children:"No medication history found."})),f}}),null),J(f=>{var p=`1fr min-content ${i()?"min-content":""}`,g=a();return p!==f.e&&((f.e=p)!=null?s.style.setProperty("grid-template-columns",p):s.style.removeProperty("grid-template-columns")),g!==f.t&&ot(l,f.t=g),f},{e:void 0,t:void 0}),s})()}const y1=e=>[(()=>{var t=v1();return E(t,b(xe,{get sampleLoadingText(){return iQ(10,25)},loading:!0})),t})(),(()=>{var t=v1();return E(t,b(xe,{sampleLoadingText:"aaaaa",loading:!0})),t})(),b(X,{get when(){return e.enableRefill},get children(){var t=v1();return E(t,b(xe,{sampleLoadingText:"aaa",loading:!0})),t}})];function xH(e){return e.prescription?R6(e.prescription?.writtenAt)||"N/A":"External"}const kH=e=>{const t=N(()=>e.enableLinks&&!!e.prescriptionId);return[b(X,{get when(){return!t()},get children(){var r=bH();return E(r,()=>e.treatmentName),r}}),b(X,{get when(){return t()},get children(){var r=$H();return E(r,()=>e.treatmentName),J(()=>pt(r,"href",`${e.linkBaseUrl}${e.prescriptionId}`)),r}})]};hn(["click"]);var _H=x('<div class="flex items-center justify-between px-4 py-3 sm:px-6 sm:py-4">'),CH=x('<div class="max-h-80 overflow-y-auto">');const eu=Le`
1057
+ `,ma=e=>(()=>{var t=nH(),r=t.firstChild,n=r.nextSibling;return E(r,b(xe,{size:"sm",color:"gray",get children(){return e.label}})),E(n,()=>e.children),t})(),lH=e=>{const[t,r,n]=e.split("-");return`${r}-${n}-${t}`};function dH(e){const t=Ln(),[r,n]=B(void 0),i=async()=>{const{data:s}=await t.apollo.query({query:sH,variables:{id:e.patientId}});s?.patient&&n(s?.patient)};pe(()=>{e.patientId&&i()});const a=N(()=>e.address||r()?.address),o=N(()=>{if(r()?.phone){const s=rH(r()?.phone);return s.valid?s.number.national:r()?.phone}return""});return b(Rr,{addChildrenDivider:!0,get children(){return[(()=>{var s=iH();return E(s,b(xe,{color:"gray",children:"Patient Info"}),null),E(s,b(X,{get when(){return e?.editPatient},get children(){return b(st,{variant:"secondary",size:"sm",get onClick(){return e?.editPatient},children:"Edit patient"})}}),null),s})(),(()=>{var s=aH(),l=s.firstChild,d=l.firstChild,u=d.firstChild,c=d.nextSibling,h=c.firstChild;return E(s,b(xe,{size:"lg",bold:!0,get loading(){return!r()},sampleLoadingText:"Sally Patient",get children(){return r()?.name.full||"N/A"}}),l),E(u,b(ma,{label:"Email",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"fake@email.com",get children(){return r()?.email||"N/A"}})}}),null),E(u,b(ma,{label:"Phone",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"555-555-5555",get children(){return o()||"N/A"}})}}),null),E(u,b(ma,{label:"Address",get children(){return b(X,{get when(){return!r()||a()},get fallback(){return oH()},get children(){return[(()=>{var f=g1();return E(f,b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"123 Fake St",get children(){return a()?.street1}})),f})(),b(X,{get when(){return!r()||a()?.street2},get children(){var f=g1();return E(f,b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"Apt 3",get children(){return a()?.street2}})),f}}),(()=>{var f=g1();return E(f,b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"Brooklyn, NY 11221",get children(){return[N(()=>a()?.city),", ",N(()=>a()?.state)," ",N(()=>a()?.postalCode)]}})),f})()]}})}}),null),E(h,b(ma,{label:"DOB",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"female",get children(){return lH(r()?.dateOfBirth||"N/A")}})}}),null),E(h,b(ma,{label:"Weight",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"150 lbs",get children(){return e?.weight?`${e.weight} ${e.weightUnit}`:"N/A"}})}}),null),E(h,b(ma,{label:"Sex",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"female",get children(){return r()?.sex||"N/A"}})}}),null),E(h,b(ma,{label:"Gender",get children(){return b(xe,{size:"sm",get loading(){return!r()},sampleLoadingText:"female",get children(){return r()?.gender||"N/A"}})}}),null),s})()]}})}var uH=x('<div class="group relative w-max"><span class="pointer-events-none absolute -bottom-8 left-0 w-max rounded bg-gray-900 px-2 py-1 text-sm font-medium text-gray-50 opacity-0 shadow transition-opacity group-hover:opacity-100">');function O6(e){return(()=>{var t=uH(),r=t.firstChild;return E(t,()=>e.children,r),E(r,()=>e.text),t})()}var cH=x('<button class="text-gray-700 hover:text-gray-900 hover:bg-blue-50 rounded-md p-2 disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-gray-700 disabled:cursor-not-allowed"type=button>');const hH=e=>{const t=Be({size:"md"},e),r=(()=>{var n=cH();return n.$$click=()=>{e.loading||e.onClick()},E(n,b(X,{get when(){return!e.loading},get children(){return b(at,{get name(){return e.iconName},get size(){return t.iconSize}})}}),null),E(n,b(X,{get when(){return e.loading},get children(){return b(ni,{get size(){return t.iconSize}})}}),null),J(i=>{var a=e.label,o=e.disabled;return a!==i.e&&pt(n,"aria-label",i.e=a),o!==i.t&&(n.disabled=i.t=o),i},{e:void 0,t:void 0}),n})();return N(()=>N(()=>!!e.disabled)()?r:b(O6,{get text(){return e.label},children:r}))};hn(["click"]);var fH=x('<div class="px-4 sm:px-6 py-3.5">Actions'),pH=x('<div class="px-4 sm:px-6 py-4 col-span-3 text-center">'),mH=x('<div class="grid w-full text-xs relative"><div><div class="px-4 sm:px-6 py-3.5">Medication</div><div class="px-4 sm:px-6 py-3.5 cursor-pointer flex">Written<div class=ml-1>'),gH=x('<div class="px-4 sm:px-6 py-4 truncate"><div class="flex-col flex-1 min-w-0 whitespace-normal"><div class="text-gray-500 text-ellipsis overflow-hidden">'),vH=x('<div class="px-4 sm:px-6 py-4 self-center">'),yH=x('<div class="px-4 sm:px-6 py-4 m-auto">'),v1=x('<div class="px-4 sm:px-6 py-4 select-none">'),bH=x('<div class="text-ellipsis overflow-hidden">'),$H=x('<a class="text-ellipsis block overflow-hidden text-blue-500 underline"target=_blank>');function wH(e){const t=rB(),[r,n]=B(void 0),i=N(()=>e.enableRefillButton),a=N(()=>Zt("grid grid-cols-subgrid border-b text-xs font-semibold text-gray-900 sticky top-0 bg-white z-10",{"col-span-3":i(),"col-span-2":!i()})),o=async(s,l)=>{if(r()===void 0){if(n(s.id),!t)throw new Error("Refill requires <PrescribeProvider>");try{await t.tryCreatePrescription({...s,treatment:l,effectiveDate:If(new Date,"yyyy-MM-dd").toString(),diagnoseCodes:s.diagnoses?.map(d=>d.code)||[]})}finally{n(void 0)}}};return(()=>{var s=mH(),l=s.firstChild,d=l.firstChild,u=d.nextSibling,c=u.firstChild,h=c.nextSibling;return u.$$click=()=>e.onSortOrderToggle(),E(h,b(X,{get when(){return e.sortOrder==="desc"},get children(){return b(at,{name:"chevronDown",size:"sm"})}}),null),E(h,b(X,{get when(){return e.sortOrder==="asc"},get children(){return b(at,{name:"chevronUp",size:"sm"})}}),null),E(l,b(X,{get when(){return e.enableRefillButton},get children(){return fH()}}),null),E(s,b(X,{get when(){return!e.isLoading&&e.rowItems},get fallback(){return[b(y1,{get enableRefill(){return e.enableRefillButton}}),b(y1,{get enableRefill(){return e.enableRefillButton}}),b(y1,{get enableRefill(){return e.enableRefillButton}})]},get children(){return b(xt,{get each(){return e.rowItems},children:f=>[(()=>{var p=gH(),g=p.firstChild,v=g.firstChild;return E(g,b(kH,{get treatmentName(){return f.treatment.name},get prescriptionId(){return f.prescription?.id},get enableLinks(){return e.enableLinks},get linkBaseUrl(){return e.baseURL}}),v),E(v,()=>aQ(f.prescription)),p})(),(()=>{var p=vH();return E(p,()=>xH(f)),p})(),b(X,{get when(){return e.enableRefillButton},get children(){var p=yH();return E(p,b(hH,{iconName:"documentPlus",iconSize:"sm",label:"Refill",onClick:()=>{f.prescription&&o(f.prescription,f.treatment)},get disabled(){return!f.prescription},get loading(){return N(()=>!!f.prescription)()&&r()===f.prescription.id}})),p}})]})}}),null),E(s,b(X,{get when(){return!e.isLoading&&e.rowItems&&e.rowItems.length===0},get children(){var f=pH();return E(f,b(xe,{color:"gray",children:"No medication history found."})),f}}),null),J(f=>{var p=`1fr min-content ${i()?"min-content":""}`,g=a();return p!==f.e&&((f.e=p)!=null?s.style.setProperty("grid-template-columns",p):s.style.removeProperty("grid-template-columns")),g!==f.t&&ot(l,f.t=g),f},{e:void 0,t:void 0}),s})()}const y1=e=>[(()=>{var t=v1();return E(t,b(xe,{get sampleLoadingText(){return iQ(10,25)},loading:!0})),t})(),(()=>{var t=v1();return E(t,b(xe,{sampleLoadingText:"aaaaa",loading:!0})),t})(),b(X,{get when(){return e.enableRefill},get children(){var t=v1();return E(t,b(xe,{sampleLoadingText:"aaa",loading:!0})),t}})];function xH(e){return e.prescription?R6(e.prescription?.writtenAt)||"N/A":"External"}const kH=e=>{const t=N(()=>e.enableLinks&&!!e.prescriptionId);return[b(X,{get when(){return!t()},get children(){var r=bH();return E(r,()=>e.treatmentName),r}}),b(X,{get when(){return t()},get children(){var r=$H();return E(r,()=>e.treatmentName),J(()=>pt(r,"href",`${e.linkBaseUrl}${e.prescriptionId}`)),r}})]};hn(["click"]);var _H=x('<div class="flex items-center justify-between px-4 py-3 sm:px-6 sm:py-4">'),CH=x('<div class="max-h-80 overflow-y-auto">');const eu=Le`
1058
1058
  query GetPatient($id: ID!) {
1059
1059
  patient(id: $id) {
1060
1060
  id
@@ -1473,7 +1473,7 @@ Description:
1473
1473
  }
1474
1474
  }
1475
1475
  }
1476
- `,$Q={CatalogTreatmentsFieldsComponentFragment:bQ};class wQ{sdk;setStore;store;authentication;getSDK;clinical;autoLogin;constructor(t,r=!1){this.sdk=t,this.autoLogin=r;const[n,i]=da({authentication:{isAuthenticated:!1,isInOrg:!1,permissions:[],isLoading:!0,error:void 0,user:void 0},catalog:{isLoading:!1,treatments:[],templates:[]},catalogs:{isLoading:!1,catalogs:[]},dispenseUnits:{isLoading:!1,dispenseUnits:new Array},patients:{isLoading:!1,patients:[],finished:!1},patient:{isLoading:!1,patient:void 0},prescription:{isLoading:!1,errors:[],error:void 0,data:void 0}});this.setStore=i,this.store=n,this.authentication={state:n.authentication,handleRedirect:async a=>{try{const o=await this.sdk.authentication.handleRedirect(a);yQ(o?.appState),await this.authentication.checkSession()}catch(o){const s=new URLSearchParams(window.location.search).get("error_description");o.message.includes("must be an organization id")?this.setStore("authentication",{...this.store.authentication,error:"The provided organization id is invalid or does not exist"}):s?.includes("is not part of the org")?this.setStore("authentication",{...this.store.authentication,error:"User is not authorized",isLoading:!1}):this.setStore("authentication",{...this.store.authentication,error:o.message})}},checkSession:this.checkSession.bind(this),login:this.login.bind(this),logout:this.logout.bind(this)},this.getSDK=this._getSDK.bind(this),this.clinical={catalog:{state:n.catalog,getCatalog:this.getCatalog.bind(this)},catalogs:{state:n.catalogs,getCatalogs:this.getCatalogs.bind(this)},dispenseUnits:{state:n.dispenseUnits,getDispenseUnits:this.getDispenseUnits.bind(this)},patients:{state:n.patients,getPatients:this.getPatients.bind(this)},patient:{state:n.patient,getPatient:this.getPatient.bind(this)},prescription:{state:n.prescription,createPrescription:this.createPrescription.bind(this)}}}_getSDK(){return this.sdk}async checkSession(){try{await this.sdk.authentication.checkSession();const t=await this.sdk.authentication.isAuthenticated();this.setStore("authentication",{...this.store.authentication,isAuthenticated:t});const r=await this.sdk.authentication.getUser(),n=!!this.sdk?.organization&&!!r?.org_id;let i=[];if(this.autoLogin||t)try{const o=await this.sdk.authentication.getAccessToken();i=vQ(o)?.permissions||[]}catch{i=[]}const a=t&&n&&this.sdk.organization===r.org_id;this.setStore("authentication",{...this.store.authentication,user:r,isLoading:!1,isInOrg:a,permissions:i||[]})}catch{this.setStore("authentication",{...this.store.authentication,isLoading:!1})}}async login(t={}){await this.sdk.authentication.login(t),await this.checkSession()}async logout(t={}){await this.sdk.authentication.logout(t),this.setStore("authentication",{...this.store.authentication,isAuthenticated:!1,isInOrg:!1,permissions:[],user:void 0})}async getPatients(t){t||(t={}),this.setStore("patients",{...this.store.patients,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatients(t);this.setStore("patients",{...this.store.patients,isLoading:!1,patients:t.clear?r.patients:this.store.patients.patients.concat(r.patients),finished:r.patients.length==0})}async getPatient(t){this.setStore("patient",{...this.store.patient,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatient(t);return this.setStore("patient",{...this.store.patient,isLoading:!1,patient:r.patient}),r.patient}async getCatalog(t){this.setStore("catalog",{...this.store.catalog,isLoading:!0});const{data:r}=await this.sdk.clinical.catalog.getCatalog({id:t.id,fragment:$Q});this.setStore("catalog",{...this.store.catalog,isLoading:!1,treatments:r.catalog.treatments.map(n=>n)||[],templates:r.catalog.templates.map(n=>n)||[]})}async getCatalogs(){this.setStore("catalogs",{...this.store.catalogs,isLoading:!0});const{data:t}=await this.sdk.clinical.catalog.getCatalogs();this.setStore("catalogs",{...this.store.catalogs,isLoading:!1,catalogs:t.catalogs})}async getDispenseUnits(){this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!0});const{data:t}=await this.sdk.clinical.prescription.getDispenseUnits();this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!1,dispenseUnits:t.dispenseUnits.map((r,n)=>({id:String(n),...r}))})}async createPrescription(t){this.setStore("prescription",{...this.store.prescription,isLoading:!0});const r=this.sdk.clinical.prescription.createPrescription({});try{const{data:n,errors:i}=await r({variables:t,refetchQueries:[],awaitRefetchQueries:!1});return i&&i.length>0&&this.setStore("prescription",{...this.store.prescription,errors:[...i]}),n?.createPrescription&&this.setStore("prescription",{...this.store.prescription,data:n.createPrescription}),this.setStore("prescription",{...this.store.prescription,isLoading:!1}),{data:n,errors:i}}catch(n){return this.setStore("prescription",{...this.store.prescription,error:n,isLoading:!1}),{data:null,errors:[]}}}}const xQ=(e,t,r)=>{const n=r(e,t);return xr(()=>clearInterval(n))},B6="%[a-f0-9]{2}",vg=new RegExp("("+B6+")|([^%]+?)","gi"),yg=new RegExp("("+B6+")+","gi");function kh(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],kh(r),kh(n))}function kQ(e){try{return decodeURIComponent(e)}catch{let t=e.match(vg)||[];for(let r=1;r<t.length;r++)e=kh(t,r).join(""),t=e.match(vg)||[];return e}}function _Q(e){const t={"%FE%FF":"��","%FF%FE":"��"};let r=yg.exec(e);for(;r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{const i=kQ(r[0]);i!==r[0]&&(t[r[0]]=i)}r=yg.exec(e)}t["%C2"]="�";const n=Object.keys(t);for(const i of n)e=e.replace(new RegExp(i,"g"),t[i]);return e}function CQ(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return _Q(e)}}function SQ(e,t){const r={};if(Array.isArray(t))for(const n of t){const i=Object.getOwnPropertyDescriptor(e,n);i?.enumerable&&Object.defineProperty(r,n,i)}else for(const n of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,n);if(i.enumerable){const a=e[n];t(n,a,e)&&Object.defineProperty(r,n,i)}}return r}function H6(e,t){if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||t==="")return[];const r=e.indexOf(t);return r===-1?[]:[e.slice(0,r),e.slice(r+t.length)]}const EQ=e=>e==null,TQ=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),_h=Symbol("encodeFragmentIdentifier");function AQ(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Jt(t,e),"[",i,"]"].join("")]:[...r,[Jt(t,e),"[",Jt(i,e),"]=",Jt(n,e)].join("")]};case"bracket":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Jt(t,e),"[]"].join("")]:[...r,[Jt(t,e),"[]=",Jt(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Jt(t,e),":list="].join("")]:[...r,[Jt(t,e),":list=",Jt(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Jt(r,e),t,Jt(i,e)].join("")]:[[n,Jt(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,Jt(t,e)]:[...r,[Jt(t,e),"=",Jt(n,e)].join("")]}}function OQ(e){let t;switch(e.arrayFormat){case"index":return(r,n,i)=>{if(t=/\[(\d*)]$/.exec(r),r=r.replace(/\[\d*]$/,""),!t){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][t[1]]=n};case"bracket":return(r,n,i)=>{if(t=/(\[])$/.exec(r),r=r.replace(/\[]$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"colon-list-separator":return(r,n,i)=>{if(t=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"comma":case"separator":return(r,n,i)=>{const a=typeof n=="string"&&n.includes(e.arrayFormatSeparator),o=typeof n=="string"&&!a&&mi(n,e).includes(e.arrayFormatSeparator);n=o?mi(n,e):n;const s=a||o?n.split(e.arrayFormatSeparator).map(l=>mi(l,e)):n===null?n:mi(n,e);i[r]=s};case"bracket-separator":return(r,n,i)=>{const a=/(\[])$/.test(r);if(r=r.replace(/\[]$/,""),!a){i[r]=n&&mi(n,e);return}const o=n===null?[]:mi(n,e).split(e.arrayFormatSeparator);if(i[r]===void 0){i[r]=o;return}i[r]=[...i[r],...o]};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[...[i[r]].flat(),n]}}}function W6(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Jt(e,t){return t.encode?t.strict?TQ(e):encodeURIComponent(e):e}function mi(e,t){return t.decode?CQ(e):e}function Q6(e){return Array.isArray(e)?e.sort():typeof e=="object"?Q6(Object.keys(e)).sort((t,r)=>Number(t)-Number(r)).map(t=>e[t]):e}function G6(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function IQ(e){let t="";const r=e.indexOf("#");return r!==-1&&(t=e.slice(r)),t}function bg(e,t,r){return r==="string"&&typeof e=="string"?e:typeof r=="function"&&typeof e=="string"?r(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""||t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function Zf(e){e=G6(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function Xf(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...t},W6(t.arrayFormatSeparator);const r=OQ(t),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const i of e.split("&")){if(i==="")continue;const a=t.decode?i.replaceAll("+"," "):i;let[o,s]=H6(a,"=");o===void 0&&(o=a),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:mi(s,t),r(mi(o,t),s,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&t.types[i]!=="string")for(const[o,s]of Object.entries(a)){const l=t.types[i]?t.types[i].replace("[]",""):void 0;a[o]=bg(s,t,l)}else typeof a=="object"&&a!==null&&t.types[i]==="string"?n[i]=Object.values(a).join(t.arrayFormatSeparator):n[i]=bg(a,t,t.types[i]);return t.sort===!1?n:(t.sort===!0?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((i,a)=>{const o=n[a];return i[a]=o&&typeof o=="object"&&!Array.isArray(o)?Q6(o):o,i},Object.create(null))}function Y6(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},W6(t.arrayFormatSeparator);const r=o=>t.skipNull&&EQ(e[o])||t.skipEmptyString&&e[o]==="",n=AQ(t),i={};for(const[o,s]of Object.entries(e))r(o)||(i[o]=s);const a=Object.keys(i);return t.sort!==!1&&a.sort(t.sort),a.map(o=>{const s=e[o];return s===void 0?"":s===null?Jt(o,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Jt(o,t)+"[]":s.reduce(n(o),[]).join("&"):Jt(o,t)+"="+Jt(s,t)}).filter(o=>o.length>0).join("&")}function K6(e,t){t={decode:!0,...t};let[r,n]=H6(e,"#");return r===void 0&&(r=e),{url:r?.split("?")?.[0]??"",query:Xf(Zf(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:mi(n,t)}:{}}}function Z6(e,t){t={encode:!0,strict:!0,[_h]:!0,...t};const r=G6(e.url).split("?")[0]||"",n=Zf(e.url),i={...Xf(n,{sort:!1}),...e.query};let a=Y6(i,t);a&&=`?${a}`;let o=IQ(e.url);if(typeof e.fragmentIdentifier=="string"){const s=new URL(r);s.hash=e.fragmentIdentifier,o=t[_h]?s.hash:`#${e.fragmentIdentifier}`}return`${r}${a}${o}`}function X6(e,t,r){r={parseFragmentIdentifier:!0,[_h]:!1,...r};const{url:n,query:i,fragmentIdentifier:a}=K6(e,r);return Z6({url:n,query:SQ(i,t),fragmentIdentifier:a},r)}function PQ(e,t,r){const n=Array.isArray(t)?i=>!t.includes(i):(i,a)=>!t(i,a);return X6(e,n,r)}const J6=Object.freeze(Object.defineProperty({__proto__:null,exclude:PQ,extract:Zf,parse:Xf,parseUrl:K6,pick:X6,stringify:Y6,stringifyUrl:Z6},Symbol.toStringTag,{value:"Module"})),DQ=(e=window.location.search)=>{if(!e)return!1;const t=J6.parse(e);return"state"in t&&"photon"in t&&("code"in t||"error"in t)},MQ=e=>/^\d+$/.test(e)&&e.length>=5;function Ch(e,t){return e.every(r=>t.includes(r))}const NQ="0.17.4",LQ={version:NQ};var FQ=K("<slot>"),RQ=K("<div>");const zQ=LQ?.version,jQ=e=>{let t;const r=e.redirectUri?e.redirectUri:window.location.origin,n=J6.stringifyUrl({url:r,query:{photon:!0}}),i=new Hk({env:e.env,domain:e.domain,audience:e.audience,connection:e.connection,uri:e.uri,clientId:e.id,redirectURI:n,organization:e.org,developmentMode:e.developmentMode},zQ),a=new wQ(i,e.autoLogin);e.developmentMode&&console.info("[PhotonClient]: Development mode enabled");const[o]=B(a),s=async()=>{await o()?.authentication.handleRedirect(),e.redirectPath&&window.location.replace(e.redirectPath)},l=async()=>{await o()?.authentication.checkSession(),xQ(async()=>{await o()?.authentication.checkSession()},6e4,setInterval)};return pe(()=>{DQ()&&o()?s():o()&&l()}),pe(()=>{if(!o()?.authentication.state.isLoading){if(!o()?.authentication.state.isAuthenticated&&e.autoLogin){const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}else if(e.externalUserId!=null&&o().authentication.state.user?.sub?.split("|").reverse()[0]!==e.externalUserId){o()?.authentication.logout();const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}}}),(()=>{var d=RQ(),u=t;return typeof u=="function"?Re(u,d):t=d,O(d,b(q6.Provider,{get value(){return o()},get children(){return b(eB,{get children(){return b(DR,{client:i,get children(){var c=FQ();return c._$owner=fe(),c}})}})}})),d})()};Et("photon-client",{domain:{attribute:"domain",value:void 0,reflect:!1,notify:!1,parse:!1},id:{attribute:"id",value:void 0,reflect:!1,notify:!1,parse:!1},redirectUri:{attribute:"redirect-uri",value:void 0,reflect:!1,notify:!1,parse:!1},redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1},org:{attribute:"org",value:void 0,reflect:!1,notify:!1,parse:!1},audience:{attribute:"audience",value:void 0,reflect:!1,notify:!1,parse:!1},connection:{attribute:"connection",value:void 0,reflect:!1,notify:!1,parse:!1},uri:{attribute:"uri",value:void 0,reflect:!1,notify:!1,parse:!1},developmentMode:{attribute:"dev-mode",value:!1,reflect:!0,notify:!1,parse:!0},errorMessage:{attribute:"error-message",value:"Oh snap! There was an error loading. Please contact your site's administrator",reflect:!1,notify:!1,parse:!1},autoLogin:{attribute:"auto-login",value:!1,reflect:!1,notify:!1,parse:!0},env:{attribute:"env",value:void 0,reflect:!1,notify:!1,parse:!1},externalUserId:{attribute:"user-id",value:void 0,reflect:!0,notify:!0,parse:!1}},jQ);const Rt='*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(21 112 239 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(21 112 239 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 475px){.container{max-width:475px}}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.bottom-0{bottom:0}.left-0{left:0}.top-0{top:0}.z-2000{z-index:2000}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.order-last{order:9999}.m-3{margin:.75rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.mr-1{margin-right:.25rem}.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.h-10{height:2.5rem}.h-\\[21px\\]{height:21px}.h-\\[28px\\]{height:28px}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-2\\/5{width:40%}.w-\\[44px\\]{width:44px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\\[40\\%\\]{min-width:40%}.min-w-\\[48\\%\\]{min-width:48%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * (1 - var(--tw-space-x-reverse)))}.self-start{align-self:flex-start}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-none{border-style:none}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229,231,235,var(--tw-border-opacity))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity))}.bg-\\[\\#F9FAFB\\]{--tw-bg-opacity: 1;background-color:rgb(249,250,251,var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(21,112,239,var(--tw-bg-opacity))}.bg-photon-blue{--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254,226,226,var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255,255,255,var(--tw-bg-opacity))}.p-0{padding:0}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-40{padding-bottom:10rem}.pb-5{padding-bottom:1.25rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pl-\\[19\\.75px\\]{padding-left:19.75px}.pr-2{padding-right:.5rem}.pr-5{padding-right:1.25rem}.pt-1{padding-top:.25rem}.pt-14{padding-top:3.5rem}.pt-3{padding-top:.75rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-black{--tw-text-opacity: 1;color:rgb(0,0,0,var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(23,92,211,var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156,163,175,var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107,114,128,var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55,65,81,var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239,68,68,var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185,28,28,var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100,116,139,var(--tw-text-opacity))}.text-teal-600{--tw-text-opacity: 1;color:rgb(13,148,136,var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.opacity-50{opacity:.5}.shadow-card{--tw-shadow: 0px 0px 1px rgba(48, 49, 51, .05),0px 2px 4px rgba(48, 49, 51, .1);--tw-shadow-colored: 0px 0px 1px var(--tw-shadow-color), 0px 2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:cursor-pointer:hover{cursor:pointer}.hover\\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(24,73,169,var(--tw-bg-opacity))}.hover\\:bg-photon-blue-dark:hover{--tw-bg-opacity: 1;background-color:rgb(43,108,176,var(--tw-bg-opacity))}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.disabled\\:bg-gray-500:disabled{--tw-bg-opacity: 1;background-color:rgb(107,114,128,var(--tw-bg-opacity))}@media (min-width: 475px){.xs\\:mx-auto{margin-left:auto;margin-right:auto}.xs\\:\\!w-auto{width:auto!important}.xs\\:w-fit{width:-moz-fit-content;width:fit-content}.xs\\:min-w-\\[40\\%\\]{min-width:40%}.xs\\:min-w-\\[48\\%\\]{min-width:48%}.xs\\:flex-row{flex-direction:row}.xs\\:flex-row-reverse{flex-direction:row-reverse}.xs\\:justify-start{justify-content:flex-start}.xs\\:gap-4{gap:1rem}.xs\\:pb-2{padding-bottom:.5rem}.xs\\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 640px){.sm\\:order-first{order:-9999}.sm\\:mt-0{margin-top:0}.sm\\:inline{display:inline}.sm\\:grid{display:grid}.sm\\:w-\\[600px\\]{width:600px}.sm\\:w-auto{width:auto}.sm\\:flex-none{flex:none}.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\\:gap-3{gap:.75rem}.sm\\:gap-4{gap:1rem}.sm\\:px-4{padding-left:1rem;padding-right:1rem}.sm\\:py-2{padding-top:.5rem;padding-bottom:.5rem}}@media (min-width: 768px){.md\\:flex{display:flex}.md\\:px-4{padding-left:1rem;padding-right:1rem}.md\\:px-8{padding-left:2rem;padding-right:2rem}.md\\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\\:py-3{padding-top:.75rem;padding-bottom:.75rem}.md\\:pb-52{padding-bottom:13rem}.md\\:pr-2{padding-right:.5rem}.md\\:pt-4{padding-top:1rem}.md\\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\\:text-xl{font-size:1.25rem;line-height:1.75rem}}';var VQ=K("<style>"),UQ=K('<button class="w-full disabled:bg-gray-500 bg-photon-blue hover:bg-blue-700 text-white h-10 px-4 rounded-lg font-sans hover:bg-photon-blue-dark transition ease-in-out delay-50">');const qQ=e=>{const t=Jr();return pe(()=>{t||console.error("[photon-auth-button] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=VQ();return O(r,Rt),r})(),t?(()=>{var r=UQ();return r.$$click=async()=>{const n={appState:{}};e.redirectPath&&(n.appState.returnTo=e.redirectPath),t.authentication.state.isAuthenticated?await t.authentication.logout():await t.authentication.login(n)},O(r,()=>t.authentication.state.isAuthenticated?"Log out":"Log in"),J(()=>r.disabled=t.authentication.state.isLoading),r})():null]};Et("photon-auth-button",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},qQ);to(["click"]);var BQ=K("<style>"),HQ=K(`<div class="flex flex-col w-screen max-w-sm"><svg viewBox="0 0 305 62.61"xmlns=http://www.w3.org/2000/svg class="h-[28px] pl-[19.75px]"><g fill=#273D52><path d="M0 54.1169H6.81375V35.7722H18.0826C29.5481 35.7722 34.3963 30.3343 34.3963 18.7378V17.4275C34.3963 5.76548 29.417 0.655167 18.0826 0.655167H0V54.1169ZM6.81375 30.1377V6.28961H18.2792C24.7653 6.28961 27.386 8.9758 27.386 16.0516V20.0481C27.386 27.1895 24.7653 30.1377 18.2792 30.1377H6.81375Z"></path><path d="M70.9593 54.1169H77.773V0.655167H70.9593V24.4378H50.8456V0.655167H44.0319V54.1169H50.8456V30.3343H70.9593V54.1169Z"></path><path d="M107.146 54.772C119.528 54.772 125.687 46.5169 125.687 34.9205V19.7861C125.687 8.25511 119.528 0 107.146 0C94.6974 0 88.5388 8.25511 88.5388 19.7861V34.9205C88.5388 46.5169 94.6974 54.772 107.146 54.772ZM95.5491 35.9687V18.8033C95.5491 10.7448 99.4801 5.89651 107.146 5.89651C114.745 5.89651 118.677 10.7448 118.677 18.8033V35.9687C118.677 44.0928 114.745 48.8755 107.146 48.8755C99.4801 48.8755 95.5491 44.0928 95.5491 35.9687Z"></path><path d="M144.295 54.1169H151.109V6.48616H164.54V0.655167H130.864V6.48616H144.295V54.1169Z"></path><path d="M188.299 54.772C200.682 54.772 206.841 46.5169 206.841 34.9205V19.7861C206.841 8.25511 200.682 0 188.299 0C175.851 0 169.693 8.25511 169.693 19.7861V34.9205C169.693 46.5169 175.851 54.772 188.299 54.772ZM176.703 35.9687V18.8033C176.703 10.7448 180.634 5.89651 188.299 5.89651C195.899 5.89651 199.83 10.7448 199.83 18.8033V35.9687C199.83 44.0928 195.899 48.8755 188.299 48.8755C180.634 48.8755 176.703 44.0928 176.703 35.9687Z"></path><path d="M217.6 54.1169H224.021V14.3482L245.576 54.1169H252.608L248.058 45.1084L245.641 40.4239L224.086 0.655167H217.6V54.1169Z"></path></g><g fill=#B35724><circle cx=249.798 cy=5.202 r=5.202></circle></g></svg><h1 class="font-medium text-3xl text-center font-sans mt-6 mb-3">Log in to your account</h1><p class="text-gray-500 font-sans text-center mb-8">Don't have an account? <a href=mailto:support@photon.health class="text-teal-600 hover:underline hover:cursor-pointer font-sans font-light">Contact Support</a></p><photon-auth-button>`,!0,!1,!1);const WQ=e=>{const t=Jr();return pe(()=>{t||console.error("[photon-login] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=BQ();return O(r,Rt),r})(),(()=>{var r=HQ(),n=r.firstChild,i=n.nextSibling,a=i.nextSibling,o=a.nextSibling;return o._$owner=fe(),J(()=>o.redirectPath=e.redirectPath),r})()]};Et("photon-login",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},WQ);const $d=(e,t)=>{let r;const n=()=>clearTimeout(r);return fe()&&xr(n),Object.assign((...a)=>{r!==void 0&&n(),r=setTimeout(()=>e(...a),t)},{clear:n})};/**
1476
+ `,$Q={CatalogTreatmentsFieldsComponentFragment:bQ};class wQ{sdk;setStore;store;authentication;getSDK;clinical;autoLogin;constructor(t,r=!1){this.sdk=t,this.autoLogin=r;const[n,i]=da({authentication:{isAuthenticated:!1,isInOrg:!1,permissions:[],isLoading:!0,error:void 0,user:void 0},catalog:{isLoading:!1,treatments:[],templates:[]},catalogs:{isLoading:!1,catalogs:[]},dispenseUnits:{isLoading:!1,dispenseUnits:new Array},patients:{isLoading:!1,patients:[],finished:!1},patient:{isLoading:!1,patient:void 0},prescription:{isLoading:!1,errors:[],error:void 0,data:void 0}});this.setStore=i,this.store=n,this.authentication={state:n.authentication,handleRedirect:async a=>{try{const o=await this.sdk.authentication.handleRedirect(a);yQ(o?.appState),await this.authentication.checkSession()}catch(o){const s=new URLSearchParams(window.location.search).get("error_description");o.message.includes("must be an organization id")?this.setStore("authentication",{...this.store.authentication,error:"The provided organization id is invalid or does not exist"}):s?.includes("is not part of the org")?this.setStore("authentication",{...this.store.authentication,error:"User is not authorized",isLoading:!1}):this.setStore("authentication",{...this.store.authentication,error:o.message})}},checkSession:this.checkSession.bind(this),login:this.login.bind(this),logout:this.logout.bind(this)},this.getSDK=this._getSDK.bind(this),this.clinical={catalog:{state:n.catalog,getCatalog:this.getCatalog.bind(this)},catalogs:{state:n.catalogs,getCatalogs:this.getCatalogs.bind(this)},dispenseUnits:{state:n.dispenseUnits,getDispenseUnits:this.getDispenseUnits.bind(this)},patients:{state:n.patients,getPatients:this.getPatients.bind(this)},patient:{state:n.patient,getPatient:this.getPatient.bind(this)},prescription:{state:n.prescription,createPrescription:this.createPrescription.bind(this)}}}_getSDK(){return this.sdk}async checkSession(){try{await this.sdk.authentication.checkSession();const t=await this.sdk.authentication.isAuthenticated();this.setStore("authentication",{...this.store.authentication,isAuthenticated:t});const r=await this.sdk.authentication.getUser(),n=!!this.sdk?.organization&&!!r?.org_id;let i=[];if(this.autoLogin||t)try{const o=await this.sdk.authentication.getAccessToken();i=vQ(o)?.permissions||[]}catch{i=[]}const a=t&&n&&this.sdk.organization===r.org_id;this.setStore("authentication",{...this.store.authentication,user:r,isLoading:!1,isInOrg:a,permissions:i||[]})}catch{this.setStore("authentication",{...this.store.authentication,isLoading:!1})}}async login(t={}){await this.sdk.authentication.login(t),await this.checkSession()}async logout(t={}){await this.sdk.authentication.logout(t),this.setStore("authentication",{...this.store.authentication,isAuthenticated:!1,isInOrg:!1,permissions:[],user:void 0})}async getPatients(t){t||(t={}),this.setStore("patients",{...this.store.patients,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatients(t);this.setStore("patients",{...this.store.patients,isLoading:!1,patients:t.clear?r.patients:this.store.patients.patients.concat(r.patients),finished:r.patients.length==0})}async getPatient(t){this.setStore("patient",{...this.store.patient,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatient(t);return this.setStore("patient",{...this.store.patient,isLoading:!1,patient:r.patient}),r.patient}async getCatalog(t){this.setStore("catalog",{...this.store.catalog,isLoading:!0});const{data:r}=await this.sdk.clinical.catalog.getCatalog({id:t.id,fragment:$Q});this.setStore("catalog",{...this.store.catalog,isLoading:!1,treatments:r.catalog.treatments.map(n=>n)||[],templates:r.catalog.templates.map(n=>n)||[]})}async getCatalogs(){this.setStore("catalogs",{...this.store.catalogs,isLoading:!0});const{data:t}=await this.sdk.clinical.catalog.getCatalogs();this.setStore("catalogs",{...this.store.catalogs,isLoading:!1,catalogs:t.catalogs})}async getDispenseUnits(){this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!0});const{data:t}=await this.sdk.clinical.prescription.getDispenseUnits();this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!1,dispenseUnits:t.dispenseUnits.map((r,n)=>({id:String(n),...r}))})}async createPrescription(t){this.setStore("prescription",{...this.store.prescription,isLoading:!0});const r=this.sdk.clinical.prescription.createPrescription({});try{const{data:n,errors:i}=await r({variables:t,refetchQueries:[],awaitRefetchQueries:!1});return i&&i.length>0&&this.setStore("prescription",{...this.store.prescription,errors:[...i]}),n?.createPrescription&&this.setStore("prescription",{...this.store.prescription,data:n.createPrescription}),this.setStore("prescription",{...this.store.prescription,isLoading:!1}),{data:n,errors:i}}catch(n){return this.setStore("prescription",{...this.store.prescription,error:n,isLoading:!1}),{data:null,errors:[]}}}}const xQ=(e,t,r)=>{const n=r(e,t);return xr(()=>clearInterval(n))},B6="%[a-f0-9]{2}",vg=new RegExp("("+B6+")|([^%]+?)","gi"),yg=new RegExp("("+B6+")+","gi");function kh(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],kh(r),kh(n))}function kQ(e){try{return decodeURIComponent(e)}catch{let t=e.match(vg)||[];for(let r=1;r<t.length;r++)e=kh(t,r).join(""),t=e.match(vg)||[];return e}}function _Q(e){const t={"%FE%FF":"��","%FF%FE":"��"};let r=yg.exec(e);for(;r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{const i=kQ(r[0]);i!==r[0]&&(t[r[0]]=i)}r=yg.exec(e)}t["%C2"]="�";const n=Object.keys(t);for(const i of n)e=e.replace(new RegExp(i,"g"),t[i]);return e}function CQ(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return _Q(e)}}function SQ(e,t){const r={};if(Array.isArray(t))for(const n of t){const i=Object.getOwnPropertyDescriptor(e,n);i?.enumerable&&Object.defineProperty(r,n,i)}else for(const n of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,n);if(i.enumerable){const a=e[n];t(n,a,e)&&Object.defineProperty(r,n,i)}}return r}function H6(e,t){if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||t==="")return[];const r=e.indexOf(t);return r===-1?[]:[e.slice(0,r),e.slice(r+t.length)]}const EQ=e=>e==null,TQ=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),_h=Symbol("encodeFragmentIdentifier");function AQ(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Jt(t,e),"[",i,"]"].join("")]:[...r,[Jt(t,e),"[",Jt(i,e),"]=",Jt(n,e)].join("")]};case"bracket":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Jt(t,e),"[]"].join("")]:[...r,[Jt(t,e),"[]=",Jt(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Jt(t,e),":list="].join("")]:[...r,[Jt(t,e),":list=",Jt(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Jt(r,e),t,Jt(i,e)].join("")]:[[n,Jt(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,Jt(t,e)]:[...r,[Jt(t,e),"=",Jt(n,e)].join("")]}}function OQ(e){let t;switch(e.arrayFormat){case"index":return(r,n,i)=>{if(t=/\[(\d*)]$/.exec(r),r=r.replace(/\[\d*]$/,""),!t){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][t[1]]=n};case"bracket":return(r,n,i)=>{if(t=/(\[])$/.exec(r),r=r.replace(/\[]$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"colon-list-separator":return(r,n,i)=>{if(t=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"comma":case"separator":return(r,n,i)=>{const a=typeof n=="string"&&n.includes(e.arrayFormatSeparator),o=typeof n=="string"&&!a&&mi(n,e).includes(e.arrayFormatSeparator);n=o?mi(n,e):n;const s=a||o?n.split(e.arrayFormatSeparator).map(l=>mi(l,e)):n===null?n:mi(n,e);i[r]=s};case"bracket-separator":return(r,n,i)=>{const a=/(\[])$/.test(r);if(r=r.replace(/\[]$/,""),!a){i[r]=n&&mi(n,e);return}const o=n===null?[]:mi(n,e).split(e.arrayFormatSeparator);if(i[r]===void 0){i[r]=o;return}i[r]=[...i[r],...o]};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[...[i[r]].flat(),n]}}}function W6(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Jt(e,t){return t.encode?t.strict?TQ(e):encodeURIComponent(e):e}function mi(e,t){return t.decode?CQ(e):e}function Q6(e){return Array.isArray(e)?e.sort():typeof e=="object"?Q6(Object.keys(e)).sort((t,r)=>Number(t)-Number(r)).map(t=>e[t]):e}function G6(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function IQ(e){let t="";const r=e.indexOf("#");return r!==-1&&(t=e.slice(r)),t}function bg(e,t,r){return r==="string"&&typeof e=="string"?e:typeof r=="function"&&typeof e=="string"?r(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""||t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function Zf(e){e=G6(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function Xf(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...t},W6(t.arrayFormatSeparator);const r=OQ(t),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const i of e.split("&")){if(i==="")continue;const a=t.decode?i.replaceAll("+"," "):i;let[o,s]=H6(a,"=");o===void 0&&(o=a),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:mi(s,t),r(mi(o,t),s,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&t.types[i]!=="string")for(const[o,s]of Object.entries(a)){const l=t.types[i]?t.types[i].replace("[]",""):void 0;a[o]=bg(s,t,l)}else typeof a=="object"&&a!==null&&t.types[i]==="string"?n[i]=Object.values(a).join(t.arrayFormatSeparator):n[i]=bg(a,t,t.types[i]);return t.sort===!1?n:(t.sort===!0?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((i,a)=>{const o=n[a];return i[a]=o&&typeof o=="object"&&!Array.isArray(o)?Q6(o):o,i},Object.create(null))}function Y6(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},W6(t.arrayFormatSeparator);const r=o=>t.skipNull&&EQ(e[o])||t.skipEmptyString&&e[o]==="",n=AQ(t),i={};for(const[o,s]of Object.entries(e))r(o)||(i[o]=s);const a=Object.keys(i);return t.sort!==!1&&a.sort(t.sort),a.map(o=>{const s=e[o];return s===void 0?"":s===null?Jt(o,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Jt(o,t)+"[]":s.reduce(n(o),[]).join("&"):Jt(o,t)+"="+Jt(s,t)}).filter(o=>o.length>0).join("&")}function K6(e,t){t={decode:!0,...t};let[r,n]=H6(e,"#");return r===void 0&&(r=e),{url:r?.split("?")?.[0]??"",query:Xf(Zf(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:mi(n,t)}:{}}}function Z6(e,t){t={encode:!0,strict:!0,[_h]:!0,...t};const r=G6(e.url).split("?")[0]||"",n=Zf(e.url),i={...Xf(n,{sort:!1}),...e.query};let a=Y6(i,t);a&&=`?${a}`;let o=IQ(e.url);if(typeof e.fragmentIdentifier=="string"){const s=new URL(r);s.hash=e.fragmentIdentifier,o=t[_h]?s.hash:`#${e.fragmentIdentifier}`}return`${r}${a}${o}`}function X6(e,t,r){r={parseFragmentIdentifier:!0,[_h]:!1,...r};const{url:n,query:i,fragmentIdentifier:a}=K6(e,r);return Z6({url:n,query:SQ(i,t),fragmentIdentifier:a},r)}function PQ(e,t,r){const n=Array.isArray(t)?i=>!t.includes(i):(i,a)=>!t(i,a);return X6(e,n,r)}const J6=Object.freeze(Object.defineProperty({__proto__:null,exclude:PQ,extract:Zf,parse:Xf,parseUrl:K6,pick:X6,stringify:Y6,stringifyUrl:Z6},Symbol.toStringTag,{value:"Module"})),DQ=(e=window.location.search)=>{if(!e)return!1;const t=J6.parse(e);return"state"in t&&"photon"in t&&("code"in t||"error"in t)},MQ=e=>/^\d+$/.test(e)&&e.length>=5;function Ch(e,t){return e.every(r=>t.includes(r))}const NQ="0.17.5",LQ={version:NQ};var FQ=K("<slot>"),RQ=K("<div>");const zQ=LQ?.version,jQ=e=>{let t;const r=e.redirectUri?e.redirectUri:window.location.origin,n=J6.stringifyUrl({url:r,query:{photon:!0}}),i=new Hk({env:e.env,domain:e.domain,audience:e.audience,connection:e.connection,uri:e.uri,clientId:e.id,redirectURI:n,organization:e.org,developmentMode:e.developmentMode},zQ),a=new wQ(i,e.autoLogin);e.developmentMode&&console.info("[PhotonClient]: Development mode enabled");const[o]=B(a),s=async()=>{await o()?.authentication.handleRedirect(),e.redirectPath&&window.location.replace(e.redirectPath)},l=async()=>{await o()?.authentication.checkSession(),xQ(async()=>{await o()?.authentication.checkSession()},6e4,setInterval)};return pe(()=>{DQ()&&o()?s():o()&&l()}),pe(()=>{if(!o()?.authentication.state.isLoading){if(!o()?.authentication.state.isAuthenticated&&e.autoLogin){const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}else if(e.externalUserId!=null&&o().authentication.state.user?.sub?.split("|").reverse()[0]!==e.externalUserId){o()?.authentication.logout();const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}}}),(()=>{var d=RQ(),u=t;return typeof u=="function"?Re(u,d):t=d,O(d,b(q6.Provider,{get value(){return o()},get children(){return b(eB,{get children(){return b(DR,{client:i,get children(){var c=FQ();return c._$owner=fe(),c}})}})}})),d})()};Et("photon-client",{domain:{attribute:"domain",value:void 0,reflect:!1,notify:!1,parse:!1},id:{attribute:"id",value:void 0,reflect:!1,notify:!1,parse:!1},redirectUri:{attribute:"redirect-uri",value:void 0,reflect:!1,notify:!1,parse:!1},redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1},org:{attribute:"org",value:void 0,reflect:!1,notify:!1,parse:!1},audience:{attribute:"audience",value:void 0,reflect:!1,notify:!1,parse:!1},connection:{attribute:"connection",value:void 0,reflect:!1,notify:!1,parse:!1},uri:{attribute:"uri",value:void 0,reflect:!1,notify:!1,parse:!1},developmentMode:{attribute:"dev-mode",value:!1,reflect:!0,notify:!1,parse:!0},errorMessage:{attribute:"error-message",value:"Oh snap! There was an error loading. Please contact your site's administrator",reflect:!1,notify:!1,parse:!1},autoLogin:{attribute:"auto-login",value:!1,reflect:!1,notify:!1,parse:!0},env:{attribute:"env",value:void 0,reflect:!1,notify:!1,parse:!1},externalUserId:{attribute:"user-id",value:void 0,reflect:!0,notify:!0,parse:!1}},jQ);const Rt='*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(21 112 239 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(21 112 239 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 475px){.container{max-width:475px}}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.bottom-0{bottom:0}.left-0{left:0}.top-0{top:0}.z-2000{z-index:2000}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.order-last{order:9999}.m-3{margin:.75rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.mr-1{margin-right:.25rem}.mt-0{margin-top:0}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.h-10{height:2.5rem}.h-\\[21px\\]{height:21px}.h-\\[28px\\]{height:28px}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-2\\/5{width:40%}.w-\\[44px\\]{width:44px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\\[40\\%\\]{min-width:40%}.min-w-\\[48\\%\\]{min-width:48%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * (1 - var(--tw-space-x-reverse)))}.self-start{align-self:flex-start}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-none{border-style:none}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229,231,235,var(--tw-border-opacity))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity))}.bg-\\[\\#F9FAFB\\]{--tw-bg-opacity: 1;background-color:rgb(249,250,251,var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(21,112,239,var(--tw-bg-opacity))}.bg-photon-blue{--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254,226,226,var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255,255,255,var(--tw-bg-opacity))}.p-0{padding:0}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-40{padding-bottom:10rem}.pb-5{padding-bottom:1.25rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pl-\\[19\\.75px\\]{padding-left:19.75px}.pr-2{padding-right:.5rem}.pr-5{padding-right:1.25rem}.pt-1{padding-top:.25rem}.pt-14{padding-top:3.5rem}.pt-3{padding-top:.75rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-black{--tw-text-opacity: 1;color:rgb(0,0,0,var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(23,92,211,var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156,163,175,var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107,114,128,var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55,65,81,var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239,68,68,var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185,28,28,var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100,116,139,var(--tw-text-opacity))}.text-teal-600{--tw-text-opacity: 1;color:rgb(13,148,136,var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.opacity-50{opacity:.5}.shadow-card{--tw-shadow: 0px 0px 1px rgba(48, 49, 51, .05),0px 2px 4px rgba(48, 49, 51, .1);--tw-shadow-colored: 0px 0px 1px var(--tw-shadow-color), 0px 2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:cursor-pointer:hover{cursor:pointer}.hover\\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(24,73,169,var(--tw-bg-opacity))}.hover\\:bg-photon-blue-dark:hover{--tw-bg-opacity: 1;background-color:rgb(43,108,176,var(--tw-bg-opacity))}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.disabled\\:bg-gray-500:disabled{--tw-bg-opacity: 1;background-color:rgb(107,114,128,var(--tw-bg-opacity))}@media (min-width: 475px){.xs\\:mx-auto{margin-left:auto;margin-right:auto}.xs\\:\\!w-auto{width:auto!important}.xs\\:w-fit{width:-moz-fit-content;width:fit-content}.xs\\:min-w-\\[40\\%\\]{min-width:40%}.xs\\:min-w-\\[48\\%\\]{min-width:48%}.xs\\:flex-row{flex-direction:row}.xs\\:flex-row-reverse{flex-direction:row-reverse}.xs\\:justify-start{justify-content:flex-start}.xs\\:gap-4{gap:1rem}.xs\\:pb-2{padding-bottom:.5rem}.xs\\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 640px){.sm\\:order-first{order:-9999}.sm\\:mt-0{margin-top:0}.sm\\:inline{display:inline}.sm\\:grid{display:grid}.sm\\:w-\\[600px\\]{width:600px}.sm\\:w-auto{width:auto}.sm\\:flex-none{flex:none}.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\\:gap-3{gap:.75rem}.sm\\:gap-4{gap:1rem}.sm\\:px-4{padding-left:1rem;padding-right:1rem}.sm\\:py-2{padding-top:.5rem;padding-bottom:.5rem}}@media (min-width: 768px){.md\\:flex{display:flex}.md\\:px-4{padding-left:1rem;padding-right:1rem}.md\\:px-8{padding-left:2rem;padding-right:2rem}.md\\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\\:py-3{padding-top:.75rem;padding-bottom:.75rem}.md\\:pb-52{padding-bottom:13rem}.md\\:pr-2{padding-right:.5rem}.md\\:pt-4{padding-top:1rem}.md\\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\\:text-xl{font-size:1.25rem;line-height:1.75rem}}';var VQ=K("<style>"),UQ=K('<button class="w-full disabled:bg-gray-500 bg-photon-blue hover:bg-blue-700 text-white h-10 px-4 rounded-lg font-sans hover:bg-photon-blue-dark transition ease-in-out delay-50">');const qQ=e=>{const t=Jr();return pe(()=>{t||console.error("[photon-auth-button] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=VQ();return O(r,Rt),r})(),t?(()=>{var r=UQ();return r.$$click=async()=>{const n={appState:{}};e.redirectPath&&(n.appState.returnTo=e.redirectPath),t.authentication.state.isAuthenticated?await t.authentication.logout():await t.authentication.login(n)},O(r,()=>t.authentication.state.isAuthenticated?"Log out":"Log in"),J(()=>r.disabled=t.authentication.state.isLoading),r})():null]};Et("photon-auth-button",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},qQ);to(["click"]);var BQ=K("<style>"),HQ=K(`<div class="flex flex-col w-screen max-w-sm"><svg viewBox="0 0 305 62.61"xmlns=http://www.w3.org/2000/svg class="h-[28px] pl-[19.75px]"><g fill=#273D52><path d="M0 54.1169H6.81375V35.7722H18.0826C29.5481 35.7722 34.3963 30.3343 34.3963 18.7378V17.4275C34.3963 5.76548 29.417 0.655167 18.0826 0.655167H0V54.1169ZM6.81375 30.1377V6.28961H18.2792C24.7653 6.28961 27.386 8.9758 27.386 16.0516V20.0481C27.386 27.1895 24.7653 30.1377 18.2792 30.1377H6.81375Z"></path><path d="M70.9593 54.1169H77.773V0.655167H70.9593V24.4378H50.8456V0.655167H44.0319V54.1169H50.8456V30.3343H70.9593V54.1169Z"></path><path d="M107.146 54.772C119.528 54.772 125.687 46.5169 125.687 34.9205V19.7861C125.687 8.25511 119.528 0 107.146 0C94.6974 0 88.5388 8.25511 88.5388 19.7861V34.9205C88.5388 46.5169 94.6974 54.772 107.146 54.772ZM95.5491 35.9687V18.8033C95.5491 10.7448 99.4801 5.89651 107.146 5.89651C114.745 5.89651 118.677 10.7448 118.677 18.8033V35.9687C118.677 44.0928 114.745 48.8755 107.146 48.8755C99.4801 48.8755 95.5491 44.0928 95.5491 35.9687Z"></path><path d="M144.295 54.1169H151.109V6.48616H164.54V0.655167H130.864V6.48616H144.295V54.1169Z"></path><path d="M188.299 54.772C200.682 54.772 206.841 46.5169 206.841 34.9205V19.7861C206.841 8.25511 200.682 0 188.299 0C175.851 0 169.693 8.25511 169.693 19.7861V34.9205C169.693 46.5169 175.851 54.772 188.299 54.772ZM176.703 35.9687V18.8033C176.703 10.7448 180.634 5.89651 188.299 5.89651C195.899 5.89651 199.83 10.7448 199.83 18.8033V35.9687C199.83 44.0928 195.899 48.8755 188.299 48.8755C180.634 48.8755 176.703 44.0928 176.703 35.9687Z"></path><path d="M217.6 54.1169H224.021V14.3482L245.576 54.1169H252.608L248.058 45.1084L245.641 40.4239L224.086 0.655167H217.6V54.1169Z"></path></g><g fill=#B35724><circle cx=249.798 cy=5.202 r=5.202></circle></g></svg><h1 class="font-medium text-3xl text-center font-sans mt-6 mb-3">Log in to your account</h1><p class="text-gray-500 font-sans text-center mb-8">Don't have an account? <a href=mailto:support@photon.health class="text-teal-600 hover:underline hover:cursor-pointer font-sans font-light">Contact Support</a></p><photon-auth-button>`,!0,!1,!1);const WQ=e=>{const t=Jr();return pe(()=>{t||console.error("[photon-login] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=BQ();return O(r,Rt),r})(),(()=>{var r=HQ(),n=r.firstChild,i=n.nextSibling,a=i.nextSibling,o=a.nextSibling;return o._$owner=fe(),J(()=>o.redirectPath=e.redirectPath),r})()]};Et("photon-login",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},WQ);const $d=(e,t)=>{let r;const n=()=>clearTimeout(r);return fe()&&xr(n),Object.assign((...a)=>{r!==void 0&&n(),r=setTimeout(()=>e(...a),t)},{clear:n})};/**
1477
1477
  * @license
1478
1478
  * Copyright 2019 Google LLC
1479
1479
  * SPDX-License-Identifier: BSD-3-Clause
@@ -4377,7 +4377,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4377
4377
  `.concat(JSON.stringify(h,null,2)))}}return l?{partialMatch:!0}:void 0;case"[]":for(var f=Iv(t.args),p;!(p=f()).done;){var g=p.value;if(e[0]===g)return e.length===1?{match:!0,matchedChars:e}:r?{overflow:!0}:{match:!0,matchedChars:[g]}}return;default:throw new Error("Unsupported instruction tree: ".concat(t))}}function Dv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=ene(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4378
4378
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ene(e,t){if(e){if(typeof e=="string")return Mv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mv(e,t)}}function Mv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function nne(e,t,r){return t&&rne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Qh="9",ine=15,ane=Iu(Qh,ine),one=/[- ]/,sne=function(){return/\[([^\[\]])*\]/g},lne=function(){return/\d(?=[^,}][^,}])/g},dne=new RegExp("["+On+"]*\\$1["+On+"]*(\\$\\d["+On+"]*)*$"),Nv=3,une=function(){function e(t){t.state;var r=t.metadata;tne(this,e),this.metadata=r,this.resetFormat()}return nne(e,[{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.nationalNumberTemplate=void 0,this.populatedNationalNumberTemplate=void 0,this.populatedNationalNumberTemplatePosition=-1}},{key:"reset",value:function(r,n){this.resetFormat(),r?(this.isNANP=r.callingCode()==="1",this.matchingFormats=r.formats(),n.nationalSignificantNumber&&this.narrowDownMatchingFormats(n)):(this.isNANP=void 0,this.matchingFormats=[])}},{key:"format",value:function(r,n){var i=this;if(zre(n.nationalSignificantNumber,this.metadata))for(var a=Dv(this.matchingFormats),o;!(o=a()).done;){var s=o.value,l=Rre(n,s,{metadata:this.metadata,shouldTryNationalPrefixFormattingRule:function(u){return i.shouldTryNationalPrefixFormattingRule(u,{international:n.international,nationalPrefix:n.nationalPrefix})},getSeparatorAfterNationalPrefix:function(u){return i.getSeparatorAfterNationalPrefix(u)}});if(l)return this.resetFormat(),this.chosenFormat=s,this.setNationalNumberTemplate(l.replace(/\d/g,kn),n),this.populatedNationalNumberTemplate=l,this.populatedNationalNumberTemplatePosition=this.template.lastIndexOf(kn),l}return this.formatNationalNumberWithNextDigits(r,n)}},{key:"formatNationalNumberWithNextDigits",value:function(r,n){var i=this.chosenFormat,a=this.chooseFormat(n);if(a)return a===i?this.formatNextNationalNumberDigits(r):this.formatNextNationalNumberDigits(n.getNationalDigits())}},{key:"narrowDownMatchingFormats",value:function(r){var n=this,i=r.nationalSignificantNumber,a=r.nationalPrefix,o=r.international,s=i,l=s.length-Nv;l<0&&(l=0),this.matchingFormats=this.matchingFormats.filter(function(d){return n.formatSuits(d,o,a)&&n.formatMatches(d,s,l)}),this.chosenFormat&&this.matchingFormats.indexOf(this.chosenFormat)===-1&&this.resetFormat()}},{key:"formatSuits",value:function(r,n,i){return!(i&&!r.usesNationalPrefix()&&!r.nationalPrefixIsOptionalWhenFormattingInNationalFormat()||!n&&!i&&r.nationalPrefixIsMandatoryWhenFormattingInNationalFormat())}},{key:"formatMatches",value:function(r,n,i){var a=r.leadingDigitsPatterns().length;if(a===0)return!0;i=Math.min(i,a-1);var o=r.leadingDigitsPatterns()[i];if(n.length<Nv)try{return new Jre(o).match(n,{allowOverflow:!0})!==void 0}catch(s){return console.error(s),!0}return new RegExp("^(".concat(o,")")).test(n)}},{key:"getFormatFormat",value:function(r,n){return n?r.internationalFormat():r.format()}},{key:"chooseFormat",value:function(r){for(var n=this,i=function(){var d=o.value;return n.chosenFormat===d?"break":dne.test(n.getFormatFormat(d,r.international))?n.createTemplateForFormat(d,r)?(n.chosenFormat=d,"break"):(n.matchingFormats=n.matchingFormats.filter(function(u){return u!==d}),"continue"):"continue"},a=Dv(this.matchingFormats.slice()),o;!(o=a()).done;){var s=i();if(s==="break")break}return this.chosenFormat||this.resetFormat(),this.chosenFormat}},{key:"createTemplateForFormat",value:function(r,n){if(!(r.pattern().indexOf("|")>=0)){var i=this.getTemplateForFormat(r,n);if(i)return this.setNationalNumberTemplate(i,n),!0}}},{key:"getSeparatorAfterNationalPrefix",value:function(r){return this.isNANP||r&&r.nationalPrefixFormattingRule()&&one.test(r.nationalPrefixFormattingRule())?" ":""}},{key:"getInternationalPrefixBeforeCountryCallingCode",value:function(r,n){var i=r.IDDPrefix,a=r.missingPlus;return i?n&&n.spacing===!1?i:i+" ":a?"":"+"}},{key:"getTemplate",value:function(r){if(this.template){for(var n=-1,i=0,a=r.international?this.getInternationalPrefixBeforeCountryCallingCode(r,{spacing:!1}):"";i<a.length+r.getDigitsWithoutInternationalPrefix().length;)n=this.template.indexOf(kn,n+1),i++;return Av(this.template,n+1)}}},{key:"setNationalNumberTemplate",value:function(r,n){this.nationalNumberTemplate=r,this.populatedNationalNumberTemplate=r,this.populatedNationalNumberTemplatePosition=-1,n.international?this.template=this.getInternationalPrefixBeforeCountryCallingCode(n).replace(/[\d\+]/g,kn)+Iu(kn,n.callingCode.length)+" "+r:this.template=r}},{key:"getTemplateForFormat",value:function(r,n){var i=n.nationalSignificantNumber,a=n.international,o=n.nationalPrefix,s=n.complexPrefixBeforeNationalSignificantNumber,l=r.pattern();l=l.replace(sne(),"\\d").replace(lne(),"\\d");var d=ane.match(l)[0];if(!(i.length>d.length)){var u=new RegExp("^"+l+"$"),c=i.replace(/\d/g,Qh);u.test(c)&&(d=c);var h=this.getFormatFormat(r,a),f;if(this.shouldTryNationalPrefixFormattingRule(r,{international:a,nationalPrefix:o})){var p=h.replace(uy,r.nationalPrefixFormattingRule());if(kc(r.nationalPrefixFormattingRule())===(o||"")+kc("$1")&&(h=p,f=!0,o))for(var g=o.length;g>0;)h=h.replace(/\d/,kn),g--}var v=d.replace(new RegExp(l),h).replace(new RegExp(Qh,"g"),kn);return f||(s?v=Iu(kn,s.length)+" "+v:o&&(v=Iu(kn,o.length)+this.getSeparatorAfterNationalPrefix(r)+v)),a&&(v=dy(v)),v}}},{key:"formatNextNationalNumberDigits",value:function(r){var n=Fre(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition,r);if(!n){this.resetFormat();return}return this.populatedNationalNumberTemplate=n[0],this.populatedNationalNumberTemplatePosition=n[1],Av(this.populatedNationalNumberTemplate,this.populatedNationalNumberTemplatePosition+1)}},{key:"shouldTryNationalPrefixFormattingRule",value:function(r,n){var i=n.international,a=n.nationalPrefix;if(r.nationalPrefixFormattingRule()){var o=r.usesNationalPrefix();if(o&&a||!o&&!i)return!0}}}]),e}();function $y(e,t){return pne(e)||fne(e,t)||hne(e,t)||cne()}function cne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4379
4379
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hne(e,t){if(e){if(typeof e=="string")return Lv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lv(e,t)}}function Lv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function fne(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,a=!1,o,s;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(l){a=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function pne(e){if(Array.isArray(e))return e}function mne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function vne(e,t,r){return t&&gne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var yne="["+On+jr+"]+",bne=new RegExp("^"+yne+"$","i"),$ne="(?:["+g0+"]["+On+jr+"]*|["+On+jr+"]+)",wne=new RegExp("[^"+On+jr+"]+.*$"),xne=/[^\d\[\]]/,kne=function(){function e(t){var r=t.defaultCountry,n=t.defaultCallingCode,i=t.metadata,a=t.onNationalSignificantNumberChange;mne(this,e),this.defaultCountry=r,this.defaultCallingCode=n,this.metadata=i,this.onNationalSignificantNumberChange=a}return vne(e,[{key:"input",value:function(r,n){var i=Sne(r),a=$y(i,2),o=a[0],s=a[1],l=kc(o),d;return s&&(n.digits||(n.startInternationalNumber(),l||(d=!0))),l&&this.inputDigits(l,n),{digits:l,justLeadingPlus:d}}},{key:"inputDigits",value:function(r,n){var i=n.digits,a=i.length<3&&i.length+r.length>=3;if(n.appendDigits(r),a&&this.extractIddPrefix(n),this.isWaitingForCountryCallingCode(n)){if(!this.extractCountryCallingCode(n))return}else n.appendNationalSignificantNumberDigits(r);n.international||this.hasExtractedNationalSignificantNumber||this.extractNationalSignificantNumber(n.getNationalDigits(),function(o){return n.update(o)})}},{key:"isWaitingForCountryCallingCode",value:function(r){var n=r.international,i=r.callingCode;return n&&!i}},{key:"extractCountryCallingCode",value:function(r){var n=Tp("+"+r.getDigitsWithoutInternationalPrefix(),this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),i=n.countryCallingCode,a=n.number;if(i)return r.setCallingCode(i),r.update({nationalSignificantNumber:a}),!0}},{key:"reset",value:function(r){if(r){this.hasSelectedNumberingPlan=!0;var n=r._nationalPrefixForParsing();this.couldPossiblyExtractAnotherNationalSignificantNumber=n&&xne.test(n)}else this.hasSelectedNumberingPlan=void 0,this.couldPossiblyExtractAnotherNationalSignificantNumber=void 0}},{key:"extractNationalSignificantNumber",value:function(r,n){if(this.hasSelectedNumberingPlan){var i=jh(r,this.metadata),a=i.nationalPrefix,o=i.nationalNumber,s=i.carrierCode;if(o!==r)return this.onExtractedNationalNumber(a,s,o,r,n),!0}}},{key:"extractAnotherNationalSignificantNumber",value:function(r,n,i){if(!this.hasExtractedNationalSignificantNumber)return this.extractNationalSignificantNumber(r,i);if(this.couldPossiblyExtractAnotherNationalSignificantNumber){var a=jh(r,this.metadata),o=a.nationalPrefix,s=a.nationalNumber,l=a.carrierCode;if(s!==n)return this.onExtractedNationalNumber(o,l,s,r,i),!0}}},{key:"onExtractedNationalNumber",value:function(r,n,i,a,o){var s,l,d=a.lastIndexOf(i);if(d>=0&&d===a.length-i.length){l=!0;var u=a.slice(0,d);u!==r&&(s=u)}o({nationalPrefix:r,carrierCode:n,nationalSignificantNumber:i,nationalSignificantNumberMatchesInput:l,complexPrefixBeforeNationalSignificantNumber:s}),this.hasExtractedNationalSignificantNumber=!0,this.onNationalSignificantNumberChange()}},{key:"reExtractNationalSignificantNumber",value:function(r){if(this.extractAnotherNationalSignificantNumber(r.getNationalDigits(),r.nationalSignificantNumber,function(n){return r.update(n)}))return!0;if(this.extractIddPrefix(r))return this.extractCallingCodeAndNationalSignificantNumber(r),!0;if(this.fixMissingPlus(r))return this.extractCallingCodeAndNationalSignificantNumber(r),!0}},{key:"extractIddPrefix",value:function(r){var n=r.international,i=r.IDDPrefix,a=r.digits;if(r.nationalSignificantNumber,!(n||i)){var o=sy(a,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata);if(o!==void 0&&o!==a)return r.update({IDDPrefix:a.slice(0,a.length-o.length)}),this.startInternationalNumber(r,{country:void 0,callingCode:void 0}),!0}}},{key:"fixMissingPlus",value:function(r){if(!r.international){var n=ly(r.digits,this.defaultCountry,this.defaultCallingCode,this.metadata.metadata),i=n.countryCallingCode;if(n.number,i)return r.update({missingPlus:!0}),this.startInternationalNumber(r,{country:r.country,callingCode:i}),!0}}},{key:"startInternationalNumber",value:function(r,n){var i=n.country,a=n.callingCode;r.startInternationalNumber(i,a),r.nationalSignificantNumber&&(r.resetNationalSignificantNumber(),this.onNationalSignificantNumberChange(),this.hasExtractedNationalSignificantNumber=void 0)}},{key:"extractCallingCodeAndNationalSignificantNumber",value:function(r){this.extractCountryCallingCode(r)&&this.extractNationalSignificantNumber(r.getNationalDigits(),function(n){return r.update(n)})}}]),e}();function _ne(e){var t=e.search($ne);if(!(t<0)){e=e.slice(t);var r;return e[0]==="+"&&(r=!0,e=e.slice(1)),e=e.replace(wne,""),r&&(e="+"+e),e}}function Cne(e){var t=_ne(e)||"";return t[0]==="+"?[t.slice(1),!0]:[t]}function Sne(e){var t=Cne(e),r=$y(t,2),n=r[0],i=r[1];return bne.test(n)||(n=""),[n,i]}function Ene(e,t){return Ine(e)||One(e,t)||Ane(e,t)||Tne()}function Tne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4380
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ane(e,t){if(e){if(typeof e=="string")return Fv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fv(e,t)}}function Fv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function One(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,a=!1,o,s;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(l){a=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function Ine(e){if(Array.isArray(e))return e}function Pne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Mne(e,t,r){return t&&Dne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var wy=function(){function e(t,r){Pne(this,e),this.metadata=new kr(r);var n=this.getCountryAndCallingCode(t),i=Ene(n,2),a=i[0],o=i[1];this.defaultCountry=a,this.defaultCallingCode=o,this.reset()}return Mne(e,[{key:"getCountryAndCallingCode",value:function(r){var n,i;return r&&(ja(r)?(n=r.defaultCountry,i=r.defaultCallingCode):n=r),n&&!this.metadata.hasCountry(n)&&(n=void 0),[n,i]}},{key:"input",value:function(r){var n=this.parser.input(r,this.state),i=n.digits,a=n.justLeadingPlus;if(a)this.formattedOutput="+";else if(i){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var o;if(this.metadata.hasSelectedNumberingPlan()&&(o=this.formatter.format(i,this.state)),o===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var s=this.state.getNationalDigits();s&&(o=this.formatter.format(s,this.state))}this.formattedOutput=o?this.getFullNumber(o):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var r=this;return this.state=new Dre({onCountryChange:function(i){r.country=i},onCallingCodeChange:function(i,a){r.metadata.selectNumberingPlan(a,i),r.formatter.reset(r.metadata.numberingPlan,r.state),r.parser.reset(r.metadata.numberingPlan)}}),this.formatter=new une({state:this.state,metadata:this.metadata}),this.parser=new kne({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){r.determineTheCountryIfNeeded(),r.formatter.reset(r.metadata.numberingPlan,r.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){var r=this.state.digits;if(r)return this._getCountry()}},{key:"_getCountry",value:function(){var r=this.state.country;return r}},{key:"determineTheCountryIfNeeded",value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:"getFullNumber",value:function(r){var n=this;if(this.isInternational()){var i=function(s){return n.formatter.getInternationalPrefixBeforeCountryCallingCode(n.state,{spacing:!!s})+s},a=this.state.callingCode;return i(a?r?"".concat(a," ").concat(r):a:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return r}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var r=this.state,n=r.nationalSignificantNumber,i=r.complexPrefixBeforeNationalSignificantNumber,a=r.nationalPrefix,o=n,s=i||a;return s&&(o=s+o),o}},{key:"getNonFormattedNumber",value:function(){var r=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(r?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var r=this.getNonFormattedNumber();if(r)return r.replace(/[\+\d]/g,kn)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var r=this.state.callingCode,n=this.metadata.getCountryCodesForCallingCode(r);return n&&n.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(yy(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var r=this.state,n=r.digits,i=r.callingCode,a=r.country,o=r.nationalSignificantNumber;if(n){if(this.isInternational())return i?"+"+i+o:"+"+n;if(a||i){var s=a?this.metadata.countryCallingCode():i;return"+"+s+o}}}},{key:"getNumber",value:function(){var r=this.state,n=r.nationalSignificantNumber,i=r.carrierCode,a=r.callingCode,o=this._getCountry();if(n&&!(!o&&!a)){if(o&&o===this.defaultCountry){var s=new kr(this.metadata.metadata);s.selectNumberingPlan(o);var l=s.numberingPlan.callingCode(),d=this.metadata.getCountryCodesForCallingCode(l);if(d.length>1){var u=vy(n,{countries:d,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});u&&(o=u)}}var c=new fy(o||a,n,this.metadata.metadata);return i&&(c.carrierCode=i),c}}},{key:"isPossible",value:function(){var r=this.getNumber();return r?r.isPossible():!1}},{key:"isValid",value:function(){var r=this.getNumber();return r?r.isValid():!1}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function R1(){return zee(Are,arguments)}function _c(e){return wy.call(this,e,ny)}_c.prototype=Object.create(wy.prototype,{});_c.prototype.constructor=_c;const Nne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}.input{--sl-input-required-content-color: #f87171;--sl-input-label-font-size-medium: .875rem;--sl-input-label-color: #374151}.input::part(form-control-label){padding-bottom:.5rem}";var lu=K("<style>"),Lne=K('<div class="md:py-2 flex flex-col font-sans"><sl-input class=input type=tel placeholder="( ) ___-____"><p slot=help-text class="text-red-400 pt-1 h-[21px] font-sans">',!0,!1,!1);Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Fne=e=>{let t;const r=i=>{const a=new CustomEvent("photon-phone-changed",{composed:!0,bubbles:!0,detail:{phone:i}});t?.dispatchEvent(a)};St(()=>{e.value&&r(R1(e.value,"US").format("E.164"))});const n=N(()=>e.value?e.value.length>2?new _c("US").input(R1(e.value,"US").formatNational()):e.value:"");return[(()=>{var i=lu();return O(i,Rt),i})(),(()=>{var i=lu();return O(i,qr),i})(),(()=>{var i=lu();return O(i,Br),i})(),(()=>{var i=lu();return O(i,Nne),i})(),(()=>{var i=Lne(),a=i.firstChild,o=a.firstChild,s=t;return typeof s=="function"?Re(s,i):t=i,ce(a,"sl-input",l=>{try{const d=R1(l.target.value,"US").format("E.164");r(d)}catch{r(l.target?.value||"")}}),a._$owner=fe(),O(o,()=>e.helpText),J(l=>{var d=!!e.invalid,u=e.disabled,c=e.label,h=e.required,f=e.invalid;return d!==l.e&&a.classList.toggle("invalid",l.e=d),u!==l.t&&(a.disabled=l.t=u),c!==l.a&&(a.label=l.a=c),h!==l.o&&(a.required=l.o=h),f!==l.i&&(a.invalid=l.i=f),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),J(()=>a.value=n()),i})()]};Et("photon-phone-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1},Fne);const Rne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}";var zne=K("<div><style></style><style>");const Gh=[{id:"1",name:"Male"},{id:"2",name:"Female"},{id:"3",name:"Unknown"}],jne=e=>{let t;const r=n=>{const i=new CustomEvent("photon-sex-selected",{composed:!0,bubbles:!0,detail:{sex:n}});t?.dispatchEvent(i)};return(()=>{var n=zne(),i=n.firstChild,a=i.nextSibling;ce(n,"photon-data-selected",s=>{r(s.detail.data.name.toUpperCase())});var o=t;return typeof o=="function"?Re(o,n):t=n,O(i,Rt),O(a,Rne),O(n,b(lo,{data:Gh,get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:s=>s?.name||"",showOverflow:!0,noDataMsg:"",optional:!1,get helpText(){return e.helpText},get selectedData(){return Gh.filter(s=>s.name.toUpperCase()===e.selected)?.[0]}}),null),n})()};Et("photon-sex-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},jne);const Vne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}";var Une=K("<div><style></style><style>");const z1=[{id:"1",name:"Male/Man"},{id:"2",name:"Female/Woman"},{id:"3",name:"TransMale/TransMan"},{id:"4",name:"TransFemale/TransWoman"},{id:"5",name:"Genderqueery/Gender nonconforming"},{id:"6",name:"Something else"},{id:"7",name:"Decline to answer"}],qne=e=>{const[t,r]=B("");let n;const i=s=>s.length===0?z1:z1.filter(l=>l.name.toLowerCase().includes(s.toLowerCase())),a=s=>{const l=new CustomEvent("photon-gender-selected",{composed:!0,bubbles:!0,detail:{gender:s}});n?.dispatchEvent(l)},o=()=>{const s=new CustomEvent("photon-gender-deselected",{composed:!0,bubbles:!0,detail:{}});n?.dispatchEvent(s)};return(()=>{var s=Une(),l=s.firstChild,d=l.nextSibling;ce(s,"photon-data-unselected",()=>{o()}),ce(s,"photon-data-selected",c=>{a(c.detail.data.name)});var u=n;return typeof u=="function"?Re(u,s):n=s,O(l,Rt),O(d,Vne),O(s,b(lo,{get data(){return i(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:c=>c?.name||"",showOverflow:!0,onSearchChange:async c=>{r(c)},onHide:async()=>{r("")},noDataMsg:"",get optional(){return!e.required},get helpText(){return e.helpText},get selectedData(){return z1.filter(c=>c.name===e.selected)?.[0]}}),null),s})()};Et("photon-gender-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},qne);var Bne=K('<div class="w-full flex justify-center">'),Hne=K('<div><p class="font-sans text-lg flex-grow">Patient Info</p><div class="flex flex-col xs:flex-row xs:gap-4"><photon-text-input class="flex-grow min-w-[40%]"debounce-time=0 label="First Name"required=true></photon-text-input><photon-text-input class=min-w-[48%] debounce-time=0 label="Last Name"required=true></photon-text-input></div><div class="flex flex-col xs:flex-row items-center xs:gap-4"><photon-datepicker no-initial-date=true class="flex-grow w-full xs:min-w-[40%]"label="Date of Birth"required=true></photon-datepicker><photon-phone-input class="w-full xs:min-w-[48%]"label="Mobile Number"required=true></photon-phone-input></div><div class="flex flex-col xs:flex-row justify-between xs:gap-4"><div class="flex-grow w-full xs:min-w-[40%]"><photon-sex-input label="Sex at Birth"required=true></photon-sex-input></div><div class="flex-grow w-full xs:min-w-[40%]"><photon-gender-input label=Gender required=false></photon-gender-input></div></div><div class=mt-2><photon-text-input debounce-time=0 label=Email>',!0,!1,!1),Wne=K('<div><p class="font-sans text-lg flex-grow">Address</p><photon-text-input debounce-time=0 label="Street 1"required=true></photon-text-input><photon-text-input debounce-time=0 label="Street 2"></photon-text-input><photon-text-input debounce-time=0 label=City required=true></photon-text-input><div class="flex gap-4 pb-5 xs:pb-2"><photon-state-input class="flex-grow min-w-[40%]"label=State required=true></photon-state-input><photon-text-input debounce-time=0 class="flex-grow min-w-[40%]"label="Zip Code"required=true>',!0,!1,!1),Qne=K('<div><div class="flex items-baseline gap-2"><p class="font-sans text-lg">Preferred Pharmacy</p><p class="font-sans text-sm text-gray-500">Optional'),Gne=K('<div class="flex flex-col gap-8">'),Yne=K('<div class="w-full h-full relative"><style></style><style></style><style></style><style>');Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Kne=(e,t)=>{const r=e.selectedPatient.data?.address;return t.address_zip?.value&&MQ(t.address_zip?.value)&&t.address_zip?.value!=r?.postalCode?t.address_zip?.value:r?`${r.street1} ${r.street2??""} ${r.city}, ${r.state} ${r.postalCode}`:""},Zne=e=>{let t;const r=Jr(),{store:n,actions:i}=_d,{store:a,actions:o}=M8({firstName:void 0,lastName:void 0,dateOfBirth:void 0,phone:void 0,gender:void 0,sex:void 0,email:void 0,address_street1:void 0,address_street2:void 0,address_city:void 0,address_state:void 0,address_zip:void 0,preferredPharmacy:void 0});o.registerValidator({key:"firstName",validator:sr(_a(ln(),1,1/0),"Please enter a first name.")}),o.registerValidator({key:"lastName",validator:sr(_a(ln(),1,1/0),"Please enter a last name.")}),o.registerValidator({key:"dateOfBirth",validator:sr(Wg([YX,rv()]),"Please enter a valid date of birth.")}),o.registerValidator({key:"sex",validator:sr(LK(Gh.map(d=>d.name.toUpperCase())),"Please enter Sex at Birth.")}),o.registerValidator({key:"phone",validator:sr(_a(ln(),12),"Please enter a valid mobile number.")}),o.registerValidator({key:"email",validator:sr(Wg([XX(),rv()]),"Please enter a valid email.")}),o.registerValidator({key:"address_street1",validator:sr(_a(ln(),1,1/0),"Please enter a valid Street 1.")}),o.registerValidator({key:"address_city",validator:sr(_a(ln(),1,1/0),"Please enter a valid City.")}),o.registerValidator({key:"address_state",validator:sr(_a(ln(),2,2),"Please enter a valid State.")}),o.registerValidator({key:"address_zip",validator:sr(ZX(),"Please enter a valid zip code.")}),St(()=>{e.patientId?i.getSelectedPatient(r.getSDK(),e.patientId):i.clearSelectedPatient()});const s=d=>{const u=new CustomEvent("photon-form-updated",{composed:!0,bubbles:!0,detail:{form:d,actions:o,selected:n,reset:()=>{o.reset(),i.reset()}}});t?.dispatchEvent(u)};pe(()=>{n.selectedPatient.data&&(o.updateFormValue({key:"firstName",value:n.selectedPatient.data.name.first}),o.updateFormValue({key:"lastName",value:n.selectedPatient.data.name.last}),o.updateFormValue({key:"phone",value:n.selectedPatient.data.phone}),o.updateFormValue({key:"gender",value:n.selectedPatient.data.gender}),o.updateFormValue({key:"sex",value:n.selectedPatient.data.sex}),o.updateFormValue({key:"email",value:n.selectedPatient.data.email}),o.updateFormValue({key:"address_street1",value:n.selectedPatient.data.address?.street1}),o.updateFormValue({key:"address_street2",value:n.selectedPatient.data.address?.street2}),o.updateFormValue({key:"address_city",value:n.selectedPatient.data.address?.city}),o.updateFormValue({key:"address_state",value:n.selectedPatient.data.address?.state}),o.updateFormValue({key:"address_zip",value:n.selectedPatient.data.address?.postalCode}),o.updateFormValue({key:"preferredPharmacy",value:n.selectedPatient.data.preferredPharmacies?.[0]?.id}))}),pe(()=>{s(a)}),xr(()=>{i.clearSelectedPatient(),o.reset()});const l=N(()=>{const d=n.selectedPatient.data?.preferredPharmacies?.[0];if(!d)return;const u=d.address;return{...d,address:u,isPrevious:!0,isPreferred:!0}});return(()=>{var d=Yne(),u=d.firstChild,c=u.nextSibling,h=c.nextSibling,f=h.nextSibling,p=t;return typeof p=="function"?Re(p,d):t=d,O(u,Rt),O(c,qr),O(h,Br),O(f,oi),O(d,b(X,{get when(){return n.selectedPatient.isLoading},get children(){var g=Bne();return O(g,b(ni,{color:"green"})),g}}),null),O(d,b(X,{get when(){return!n.selectedPatient.isLoading},get children(){return b(F8,{permissions:["write:patient"],get children(){var g=Gne();return O(g,b(Rr,{get children(){var v=Hne(),m=v.firstChild,$=m.nextSibling,w=$.firstChild,k=w.nextSibling,C=$.nextSibling,S=C.firstChild,M=S.nextSibling,T=C.nextSibling,U=T.firstChild,z=U.firstChild,P=U.nextSibling,D=P.firstChild,j=T.nextSibling,W=j.firstChild;return ce(w,"photon-input-changed",async H=>{o.updateFormValue({key:"firstName",value:H.detail.input})}),w._$owner=fe(),ce(k,"photon-input-changed",async H=>{o.updateFormValue({key:"lastName",value:H.detail.input})}),k._$owner=fe(),ce(S,"photon-datepicker-selected",async H=>{o.updateFormValue({key:"dateOfBirth",value:H.detail.date})}),S._$owner=fe(),ce(M,"photon-phone-changed",async H=>{o.updateFormValue({key:"phone",value:H.detail.phone})}),M._$owner=fe(),ce(z,"photon-sex-deselected",()=>{o.updateFormValue({key:"sex",value:void 0})}),ce(z,"photon-sex-selected",H=>{o.updateFormValue({key:"sex",value:H.detail.sex})}),z._$owner=fe(),ce(D,"photon-gender-deselected",()=>{o.updateFormValue({key:"gender",value:void 0})}),ce(D,"photon-gender-selected",H=>{o.updateFormValue({key:"gender",value:H.detail.gender})}),D._$owner=fe(),ce(W,"photon-input-changed",async H=>{o.updateFormValue({key:"email",value:H.detail.input})}),W._$owner=fe(),J(H=>{var ue=a.firstName?.error,se=a.firstName?.error,G=a.lastName?.error,F=a.lastName?.error,Z=a.dateOfBirth?.error,ee=a.dateOfBirth?.error,L=a.phone?.error,le=a.phone?.error,me=a.sex?.error,re=a.sex?.error!==void 0,oe=n.selectedPatient.data?.sex,Ie=a.gender?.error,Pe=a.gender?.error!==void 0,it=n.selectedPatient.data?.gender,Ke=a.email?.error,ft=a.email?.error;return ue!==H.e&&(w.invalid=H.e=ue),se!==H.t&&(w.helpText=H.t=se),G!==H.a&&(k.invalid=H.a=G),F!==H.o&&(k.helpText=H.o=F),Z!==H.i&&(S.invalid=H.i=Z),ee!==H.n&&(S.helpText=H.n=ee),L!==H.s&&(M.invalid=H.s=L),le!==H.h&&(M.helpText=H.h=le),me!==H.r&&(z.helpText=H.r=me),re!==H.d&&(z.invalid=H.d=re),oe!==H.l&&(z.selected=H.l=oe),Ie!==H.u&&(D.helpText=H.u=Ie),Pe!==H.c&&(D.invalid=H.c=Pe),it!==H.w&&(D.selected=H.w=it),Ke!==H.m&&(W.invalid=H.m=Ke),ft!==H.f&&(W.helpText=H.f=ft),H},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0}),J(()=>w.value=a.firstName?.value??n.selectedPatient.data?.name.first),J(()=>k.value=a.lastName?.value??n.selectedPatient.data?.name.last),J(()=>S.value=e.patientId?n.selectedPatient.data?.dateOfBirth:a.dateOfBirth?.value),J(()=>M.value=a.phone?.value??n.selectedPatient.data?.phone),J(()=>W.value=a.email?.value??n.selectedPatient.data?.email),v}}),null),O(g,b(Rr,{get children(){var v=Wne(),m=v.firstChild,$=m.nextSibling,w=$.nextSibling,k=w.nextSibling,C=k.nextSibling,S=C.firstChild,M=S.nextSibling;return ce($,"photon-input-changed",async T=>{o.updateFormValue({key:"address_street1",value:T.detail.input})}),$._$owner=fe(),ce(w,"photon-input-changed",async T=>{o.updateFormValue({key:"address_street2",value:T.detail.input})}),w.optional=!0,w._$owner=fe(),ce(k,"photon-input-changed",async T=>{o.updateFormValue({key:"address_city",value:T.detail.input})}),k._$owner=fe(),ce(S,"photon-state-selected",T=>{o.updateFormValue({key:"address_state",value:T.detail.state})}),S._$owner=fe(),ce(M,"photon-input-changed",async T=>{o.updateFormValue({key:"address_zip",value:T.detail.input})}),M._$owner=fe(),J(T=>{var U=a.address_street1?.error,z=a.address_street1?.error,P=a.address_street2?.error,D=a.address_street2?.error,j=a.address_city?.error,W=a.address_city?.error,H=a.address_state?.error,ue=a.address_state?.error!==void 0,se=a.state?.value??n.selectedPatient.data?.address?.state,G=a.address_zip?.error,F=a.address_zip?.error;return U!==T.e&&($.invalid=T.e=U),z!==T.t&&($.helpText=T.t=z),P!==T.a&&(w.invalid=T.a=P),D!==T.o&&(w.helpText=T.o=D),j!==T.i&&(k.invalid=T.i=j),W!==T.n&&(k.helpText=T.n=W),H!==T.s&&(S.helpText=T.s=H),ue!==T.h&&(S.invalid=T.h=ue),se!==T.r&&(S.selected=T.r=se),G!==T.d&&(M.invalid=T.d=G),F!==T.l&&(M.helpText=T.l=F),T},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),J(()=>$.value=a.address_street1?.value??n.selectedPatient.data?.address?.street1),J(()=>w.value=a.address_street2?.value??n.selectedPatient.data?.address?.street2),J(()=>k.value=a.address_city?.value??n.selectedPatient.data?.address?.city),J(()=>M.value=a.address_zip?.value??n.selectedPatient.data?.address?.postalCode),v}}),null),O(g,b(Rr,{get children(){var v=Qne();return v.firstChild,O(v,b(N6,{get address(){return Kne(n,a)},setPharmacy:m=>{o.updateFormValue({key:"preferredPharmacy",value:m.id})},get patientId(){return e.patientId},get initialValue(){return l()},hidePreferred:!0}),null),v}}),null),g}})}}),null),d})()};Et("photon-patient-form",{patientId:""},Zne);const Xne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}";var Jne=K("<div><style></style><style>");const j1=[{id:"1",name:"AL"},{id:"2",name:"AK"},{id:"3",name:"AZ"},{id:"4",name:"AR"},{id:"5",name:"CA"},{id:"6",name:"CO"},{id:"7",name:"CT"},{id:"8",name:"DE"},{id:"9",name:"DC"},{id:"10",name:"FL"},{id:"11",name:"GA"},{id:"12",name:"HI"},{id:"13",name:"ID"},{id:"14",name:"IL"},{id:"15",name:"IN"},{id:"16",name:"IA"},{id:"17",name:"KS"},{id:"18",name:"KY"},{id:"19",name:"LA"},{id:"20",name:"ME"},{id:"21",name:"MD"},{id:"22",name:"MA"},{id:"23",name:"MI"},{id:"24",name:"MN"},{id:"25",name:"MS"},{id:"26",name:"MO"},{id:"27",name:"MT"},{id:"28",name:"NE"},{id:"29",name:"NV"},{id:"30",name:"NH"},{id:"31",name:"NJ"},{id:"32",name:"NM"},{id:"33",name:"NY"},{id:"34",name:"NC"},{id:"35",name:"ND"},{id:"36",name:"OH"},{id:"37",name:"OK"},{id:"38",name:"OR"},{id:"39",name:"PA"},{id:"40",name:"PR"},{id:"41",name:"RI"},{id:"42",name:"SC"},{id:"43",name:"SD"},{id:"44",name:"TN"},{id:"45",name:"TX"},{id:"46",name:"UT"},{id:"47",name:"VT"},{id:"48",name:"VA"},{id:"49",name:"WA"},{id:"50",name:"WV"},{id:"51",name:"WI"},{id:"52",name:"WY"}],eie=e=>{const[t,r]=B("");let n;const i=o=>{const s=new CustomEvent("photon-state-selected",{composed:!0,bubbles:!0,detail:{state:o}});n?.dispatchEvent(s)},a=o=>o.length===0?j1:j1.filter(s=>s.name.toLowerCase().includes(o.toLowerCase()));return(()=>{var o=Jne(),s=o.firstChild,l=s.nextSibling;ce(o,"photon-data-selected",u=>{i(u.detail.data.name)});var d=n;return typeof d=="function"?Re(d,o):n=o,O(s,Rt),O(l,Xne),O(o,b(lo,{get data(){return a(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:u=>u?.name||"",showOverflow:!0,onSearchChange:async u=>{r(u)},onHide:async()=>{r("")},noDataMsg:"",optional:!1,get helpText(){return e.helpText},get selectedData(){return j1.filter(u=>u.name===e.selected)?.[0]}}),null),o})()};Et("photon-state-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},eie);var tie=K('<div class="text-black text-xl md:text-3xl">'),rie=K("<sl-icon class=flex-shrink-0>",!0,!1,!1),nie=K('<footer class="z-40 fixed bottom-0 w-full bg-white shadow-card px-4 py-4 md:px-8"><div class="flex flex-col xs:flex-row-reverse xs:justify-start gap-2 items-center w-full sm:w-[600px] xs:mx-auto sm:px-4">'),iie=K('<div class="z-50 fixed top-0 left-0 w-full h-screen overflow-y-scroll bg-[#F9FAFB]"><style></style><photon-dialog confirm-text="Yes, Close"cancel-text="Keep Editing"><p class="font-sans text-lg xs:text-base"></p></photon-dialog><header class="z-40 flex items-center px-4 py-2 md:px-8 md:py-3 bg-white fixed w-full shadow-card"><div class="flex items-center"></div><div class="flex-1 flex justify-center items-center min-w-0 px-2"><p class="ml-1 font-sans text-lg md:text-xl font-medium truncate"></p></div><div class="flex items-center w-[44px]"></div></header><div class="z-30 w-full min-h-screen bg-[#F9FAFB] pt-14"><div class="px-4 pb-40 md:pt-4 md:pb-52 md:px-4 w-full h-full sm:w-[600px] xs:mx-auto">',!0,!1,!1);const xy=e=>{const t=Be({closeTitle:"Lose unsaved changes?",closeBody:"You will not be able to recover unsaved changes.",checkShouldWarn:()=>!1},e);let r;const[n,i]=B(!1),a=()=>{i(!1),t.onClosed()},o=()=>i(!1);return(()=>{var s=iie(),l=s.firstChild,d=l.nextSibling,u=d.firstChild,c=d.nextSibling,h=c.firstChild,f=h.nextSibling,p=f.firstChild,g=c.nextSibling,v=g.firstChild,m=r;return typeof m=="function"?Re(m,s):r=s,O(l,Rt),ce(d,"photon-dialog-alt",o),ce(d,"photon-dialog-canceled",o),ce(d,"photon-dialog-confirmed",a),d._$owner=fe(),O(u,()=>t.closeBody),O(h,b(st,{variant:"naked",size:"sm",onClick:()=>{t.checkShouldWarn()?i(!0):t.onClosed()},get children(){var $=tie();return O($,b(at,{name:"xMark"})),$}})),O(f,b(X,{get when(){return t.titleIconName},get children(){var $=rie();return $._$owner=fe(),J(()=>$.name=t.titleIconName),$}}),p),O(p,()=>t.title),O(v,()=>t.form),O(s,b(X,{get when(){return t.footer},get children(){var $=nie(),w=$.firstChild;return O(w,()=>t.footer),$}}),null),J($=>{var w=t.closeTitle,k=n();return w!==$.e&&(d.label=$.e=w),k!==$.t&&(d.open=$.t=k),$},{e:void 0,t:void 0}),s})()};var aie=K("<div><style>"),oie=K('<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4"role=alert><span class="block sm:inline">'),sie=K("<photon-patient-form slot=form>",!0,!1,!1);const lie=e=>{let t;const r=Jr(),[n,i]=B(!1),[a,o]=B(!1),[s,l]=B(void 0),[d,u]=B(void 0),[c,h]=B(void 0),[f,p]=B(void 0),g=(w,k=!1)=>{const C=new CustomEvent("photon-patient-updated",{composed:!0,bubbles:!0,detail:{patientId:w,createPrescription:k}});t?.dispatchEvent(C)},v=(w,k=!1)=>{const C=new CustomEvent("photon-patient-created",{composed:!0,bubbles:!0,detail:{patientId:w,createPrescription:k}});t?.dispatchEvent(C)},m=()=>{const w=new CustomEvent("photon-patient-closed",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(w)},$=async(w,k,C,S=!1)=>{p(void 0),o(S),i(!0);const M=["firstName","lastName","dateOfBirth","phone","sex","email","address_street1","address_city","address_state","address_zip"];if(k.validate(M),k.hasErrors(M))return i(!1),!0;w.preferredPharmacy.value&&C.selectedPatient.data?.preferredPharmacies&&C.selectedPatient.data?.preferredPharmacies.length!==0&&!C.selectedPatient.data?.preferredPharmacies?.map(U=>U?.id).filter(U=>U!==null).includes(w.preferredPharmacy.value)&&await r.getSDK().clinical.patient.removePatientPreferredPharmacy({})({variables:{patientId:e.patientId,pharmacyId:C.selectedPatient.data?.preferredPharmacies[0].id},awaitRefetchQueries:!1});const T={...e?.patientId?{id:e.patientId}:{},name:{first:w.firstName.value,last:w.lastName.value},gender:w.gender.value,email:w.email.value?w.email.value:void 0,phone:w.phone.value,dateOfBirth:w.dateOfBirth.value,sex:w.sex.value,address:w.address_street1.value!==void 0?{street1:w.address_street1.value,street2:w.address_street2.value,city:w.address_city.value,state:w.address_state.value,postalCode:w.address_zip.value,country:"US"}:void 0,preferredPharmacies:w.preferredPharmacy.value?[w.preferredPharmacy.value]:[]};try{if(e?.patientId)await r.getSDK().clinical.patient.updatePatient({})({variables:T,awaitRefetchQueries:!1}),g(e.patientId,S);else{const z=await r.getSDK().clinical.patient.createPatient({})({variables:T,awaitRefetchQueries:!1});v(z?.data?.createPatient?.id||"",S)}i(!1),k.resetStores(),e.open=!1}catch(U){i(!1),p(U?.message||"An error occurred while saving the patient.")}};return(()=>{var w=aie(),k=w.firstChild,C=t;return typeof C=="function"?Re(C,w):t=w,O(k,oi),O(w,b(X,{get when(){return e.open},get children(){return b(xy,{onClosed:()=>{m(),c().resetStores(),e.open=!1},get title(){return e?.patientId?"Update patient":"New patient"},get titleIconName(){return e?.patientId?"pencil-square":"person-plus"},get footer(){return[b(X,{get when(){return!e?.hideCreatePrescription},get children(){return b(st,{class:"w-full xs:w-fit",size:"lg",get disabled(){return n()},get loading(){return N(()=>!!n())()&&a()},onClick:()=>$(s(),c(),d(),!0),get children(){return[N(()=>e?.patientId?"Update":"Create")," and start prescription"]}})}}),b(st,{class:"w-full xs:w-fit",size:"lg",get variant(){return e?.hideCreatePrescription?"primary":"secondary"},get disabled(){return n()},get loading(){return N(()=>!!n())()&&!a()},onClick:()=>$(s(),c(),d(),!1),get children(){return[N(()=>e?.patientId?"Update":"Create")," patient"]}})]},get form(){return[b(X,{get when(){return f()},get children(){var S=oie(),M=S.firstChild;return O(M,f),S}}),(()=>{var S=sie();return ce(S,"photon-form-updated",M=>{l(M.detail.form),h(Object.assign({},M.detail.actions,{resetStores:M.detail.reset})),u(M.detail.selected)}),S._$owner=fe(),J(()=>S.patientId=e.patientId),S})()]}})}}),null),w})()};Et("photon-patient-dialog",{patientId:"",hideCreatePrescription:!1,open:!1},lie);var die=K("<photon-patient-dialog>",!0,!1,!1);const uie=e=>(console.warn("photon-update-patient-dialog will be deprecated soon. Please use photon-patient-dialog instead."),(()=>{var t=die();return t._$owner=fe(),J(r=>{var n=e.patientId,i=e.open;return n!==r.e&&(t.patientId=r.e=n),i!==r.t&&(t.open=r.t=i),r},{e:void 0,t:void 0}),t})());Et("photon-update-patient-dialog",{patientId:"",open:!1},uie);const cie=".invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.input::part(base):hover{cursor:pointer}.disabled::part(base):hover{cursor:not-allowed}.selected::part(base){--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.default::part(base):hover{--tw-bg-opacity: 1;background-color:rgb(229,231,235,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity))}.default::part(label){width:100%;overflow:hidden}.group-member::part(base){padding-left:1rem;font-weight:500}.group{background:#d1e9ff;padding-top:.25rem;padding-bottom:.25rem;--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity));font-size:.75rem;font-weight:500}.treatment-option::part(checked-icon){display:none;width:0px}.full-screen-close-btn::part(base){padding:0}.treatment-search::part(input){padding-right:0}.treatment-search::part(input)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(209,213,219,var(--tw-text-opacity))}.treatment-search::part(input)::placeholder{--tw-text-opacity: 1;color:rgb(209,213,219,var(--tw-text-opacity))}.dropdown::part(panel){box-shadow:none}.dropdown-container{height:100vh;height:100dvh;max-height:100dvh}.dropdown-container-list-items{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-y}";var hie=K('<div slot=suffix class=flex><sl-icon class="text-gray-400 hover:text-gray-600"name=x-circle-fill>',!0,!1,!1),fie=K('<div><style></style><style></style><style></style><style></style><div class="dropdown-container fixed top-0 left-0 w-full bg-white overflow-hidden z-2000 flex flex-col"><div class="flex items-center pb-2 pl-5 pr-5 pt-3 flex-shrink-0"><div class="flex items-center"><sl-icon-button name=x label="Close medication search"class=full-screen-close-btn></sl-icon-button></div></div><div class=flex-shrink-0><sl-input slot=trigger clearable autocomplete=off size=medium class="treatment-search input mb-2 px-4"><p slot=help-text class="text-red-400 pt-1 font-sans"></p><div slot=suffix class=flex><sl-spinner slot=suffix></sl-spinner></div></sl-input></div><div class="w-full flex-1 overflow-y-auto .dropdown-container-list-items">',!0,!1,!1),pie=K('<div class="md:flex flex-1 justify-center items-center pl-2"><div class="flex items-center space-x-2"><p class="text-gray-700 text-sm font-sans inline font-medium">'),mie=K('<p class="pl-1 text-red-400">*'),gie=K('<p class="text-gray-400 text-xs pl-2 font-sans">Optional'),vie=K("<div class=px-4><p class=text-gray-400>Loading..."),yie=K("<div class=px-4><p class=text-gray-400>No treatments found"),bie=K('<div class="group uppercase px-4">'),$ie=K("<div class=treatment-option>"),wie=K('<p class="text-center text-gray-400 italic px-3">Loading...'),xie=K('<p class="text-center text-gray-400 italic px-3">Nothing more to load'),kie=K('<div class="px-4 py-1">');Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const _ie=e=>{let t,r,n;e.actionRef&&(e.actionRef.clear=()=>{n.value="",i(""),s()});const i=$d(async u=>{e.onSearchChange&&await e.onSearchChange(u)},500),a=u=>{if(u)return e.helpText?e.helpText:e.required?"Please select data...":void 0},o=u=>{const c=new CustomEvent("photon-data-selected",{composed:!0,bubbles:!0,detail:{data:u}});t?.dispatchEvent(c)},s=()=>{const u=new CustomEvent("photon-data-unselected",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(u)};St(()=>{n&&(n.addEventListener("keydown",u=>{(u.code=="Space"||u.key==" ")&&u.stopImmediatePropagation()}),setTimeout(()=>{n.focus()},100))}),pe(()=>{if(e.open){const u=window.scrollY;document.body.style.position="fixed",document.body.style.top=`-${u}px`,document.body.style.width="100%",document.body.style.overflow="hidden",xr(()=>{const c=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflow="",window.scrollTo(0,parseInt(c||"0")*-1)})}});const l=N(()=>e.groups?e.groups.map(u=>{const c=e.data.map((h,f)=>({data:h,allItemsIdx:f})).filter(h=>u.filter(h.data));return c.length>0?[{title:u.label},...c]:[]}).flat():e.data.map((u,c)=>({data:u,allItemsIdx:c}))),d=N(()=>yp({count:l().length,getScrollElement:()=>r??null,estimateSize:()=>42,overscan:100}));return(()=>{var u=fie(),c=u.firstChild,h=c.nextSibling,f=h.nextSibling,p=f.nextSibling,g=p.nextSibling,v=g.firstChild,m=v.firstChild,$=m.firstChild,w=v.nextSibling,k=w.firstChild,C=k.firstChild,S=C.nextSibling,M=S.firstChild,T=w.nextSibling,U=t;typeof U=="function"?Re(U,u):t=u,O(c,Rt),O(h,qr),O(f,Br),O(p,cie),g.$$touchstart=D=>D.stopPropagation(),g.$$touchmove=D=>D.stopPropagation(),v.style.setProperty("touch-action","none"),m.style.setProperty("font-size","26px"),ce($,"click",()=>{e.onClose&&e.onClose()}),$.style.setProperty("padding","0px"),$._$owner=fe(),O(v,(()=>{var D=N(()=>!!e.label);return()=>D()?(()=>{var j=pie(),W=j.firstChild,H=W.firstChild;return O(H,()=>e.label),j})():null})(),null),O(v,(()=>{var D=N(()=>!!e.required);return()=>D()?mie():null})(),null),O(v,(()=>{var D=N(()=>!!e.optional);return()=>D()?gie():null})(),null),w.$$touchstart=D=>D.stopPropagation(),w.$$touchmove=D=>D.stopPropagation(),w.style.setProperty("touch-action","none"),ce(k,"sl-clear",()=>{n.value="",i(""),s()}),ce(k,"input",D=>{i(D.target.value)});var z=n;typeof z=="function"?Re(z,k):n=k,k.style.setProperty("border-radius","0px"),k.style.setProperty("border","0px"),k._$owner=fe(),O(C,()=>a(e.invalid??!1)),M._$owner=fe(),O(k,b(X,{get when(){return e.clearable},get children(){var D=hie(),j=D.firstChild;return ce(j,"click",W=>{W.stopImmediatePropagation(),n.value="",i(""),s()}),j._$owner=fe(),J(()=>D.classList.toggle("hidden",!!(e.isLoading||!e.selectedData))),D}}),null);var P=r;return typeof P=="function"?Re(P,T):r=T,O(T,b(xt,{get each(){return d().getVirtualItems()},get fallback(){return b(Cie,{get isLoading(){return e.isLoading}})},children:D=>{const j=D.index>l().length-1,W=l()[D.index],H=e.selectedData,ue=!j&&!!H&&"id"in H&&"data"in W&&H.id===W.data.id,se="title"in W?Sie:Eie,G="title"in W?{item:W}:{item:D,isLoader:j,isSelected:ue,index:D.index,hasMore:e.hasMore,showOverflow:e.showOverflow,onClick:()=>{j||(n.value="",i(""),o(W.data))}};return b(gb,Be({component:se},G,{get children(){return N(()=>"data"in W)()&&e.displayAccessor(W.data,!0)}}))}})),J(D=>{var j=e.placeholder,W=e.disabled??!1,H=!!(e.invalid??!1),ue=!!(e.disabled??!1),se=e.required,G=!!e.forceLabelSize,F=!e.isLoading;return j!==D.e&&(k.placeholder=D.e=j),W!==D.t&&(k.disabled=D.t=W),H!==D.a&&k.classList.toggle("invalid",D.a=H),ue!==D.o&&k.classList.toggle("disabled",D.o=ue),se!==D.i&&(k.required=D.i=se),G!==D.n&&C.classList.toggle("h-[21px]",D.n=G),F!==D.s&&S.classList.toggle("hidden",D.s=F),D},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),J(()=>k.value=e.searchText),u})()},Cie=e=>b(X,{get when(){return e.isLoading},get fallback(){return yie()},get children(){return vie()}}),Sie=e=>(()=>{var t=bie();return t.style.setProperty("position","sticky"),t.style.setProperty("top","0px"),t.style.setProperty("z-index","10"),O(t,()=>e.item.title),t})(),Eie=e=>(()=>{var t=$ie();return t.$$click=()=>e.onClick(),O(t,(()=>{var r=N(()=>!!e.isLoader);return()=>r()?N(()=>!!e.hasMore)()?wie():xie():(()=>{var n=kie();return O(n,()=>e.children),n})()})()),J(r=>{var n=!!e.isSelected,i=!!e.isSelected;return n!==r.e&&t.classList.toggle("bg-blue-500",r.e=n),i!==r.t&&t.classList.toggle("text-white",r.t=i),r},{e:void 0,t:void 0}),t})();to(["touchmove","touchstart","click"]);const Tie=".invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.input::part(base):hover{cursor:pointer}.input::part(input){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.disabled::part(base):hover{cursor:not-allowed}.selected::part(base){--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.default::part(base):hover{--tw-bg-opacity: 1;background-color:rgb(229,231,235,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity))}.default::part(label){width:100%;overflow:hidden}.group-member::part(base){padding-left:1rem;font-weight:500}.group::part(base){background:#d1e9ff;padding-top:.25rem;padding-bottom:.25rem;--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity));font-size:.75rem;font-weight:600}.dropdown::part(panel){border-radius:var(--photon-border-radius, .5rem)}.dropdown-container{border-radius:var(--photon-border-radius, .5rem)}.group::part(checked-icon){display:none;width:0px}.group::part(label){padding-left:12px;padding-right:12px}.treatment-option::part(checked-icon){display:none;width:0px}";var Aie=K('<div slot=suffix class=flex><sl-icon class="text-gray-400 hover:text-gray-600"name=x-circle-fill>',!0,!1,!1),Oie=K('<div><style></style><style></style><style></style><style></style><sl-dropdown class="dropdown relative"hoist><sl-input clearable slot=trigger autocomplete=off size=medium class=input><p slot=help-text class="text-red-400 pt-1 font-sans"></p><div slot=suffix class=flex><sl-spinner slot=suffix></sl-spinner></div><div slot=suffix class=flex><sl-icon></sl-icon></div></sl-input><div class="border border-gray-200 dropdown-container overflow-hidden relative"><div class="bg-white overflow-x-hidden overflow-y-auto relative"><div>',!0,!1,!1),Iie=K('<div class="flex items-center pb-2"><p class="text-gray-700 text-sm font-sans">'),Pie=K('<p class="pl-1 text-red-400">*'),Die=K('<p class="text-gray-400 text-xs pl-2 font-sans">Optional'),Mie=K('<sl-menu-item><p class="text-center text-gray-400 italic">Loading...',!0,!1,!1),Nie=K("<sl-menu-item>",!0,!1,!1),Lie=K('<sl-menu-item class="group uppercase">',!0,!1,!1),Fie=K("<sl-menu-item class=treatment-option>",!0,!1,!1),Rie=K('<p class="text-center text-gray-400 italic">Loading...'),zie=K('<p class="text-center text-gray-400 italic">Nothing more to load'),jie=K('<p class="break-words px-3">');Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Vie=e=>{let t,r,n,i,a;e.actionRef&&(e.actionRef.clear=()=>{d(void 0),c(-1),i.value="",p(""),$()});const[o,s]=B(!1),[l,d]=B(void 0),[u,c]=B(-1),[h,f]=B(),p=$d(async C=>{e.onSearchChange&&await e.onSearchChange(C)},250),g=new IntersectionObserver(async C=>{C?.at(-1)?.isIntersecting&&e.hasMore&&e.fetchMore&&await e.fetchMore()});pe(()=>{e.data.length===0&&d(void 0)}),pe(()=>{h()&&g.observe(h())});const v=C=>{if(C)return e.helpText?e.helpText:e.required?"Please select data...":void 0},m=C=>{const S=new CustomEvent("photon-data-selected",{composed:!0,bubbles:!0,detail:{data:C}});t?.dispatchEvent(S)},$=()=>{const C=new CustomEvent("photon-data-unselected",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(C)};pe(()=>{e.selectedData&&d(e.selectedData),e.selectedData===void 0&&d(void 0)}),St(()=>{i&&i.addEventListener("keydown",C=>{(C.code=="Space"||C.key==" ")&&C.stopImmediatePropagation()})});const w=N(()=>e.groups?e.groups.map(C=>{const S=e.data.map((M,T)=>({data:M,allItemsIdx:T})).filter(M=>C.filter(M.data));return S.length>0?[{title:C.label},...S]:[]}).flat():e.data.map((C,S)=>({data:C,allItemsIdx:S}))),k=N(()=>yp({count:w().length,getScrollElement:()=>n??null,estimateSize:()=>36.8,overscan:100}));return(()=>{var C=Oie(),S=C.firstChild,M=S.nextSibling,T=M.nextSibling,U=T.nextSibling,z=U.nextSibling,P=z.firstChild,D=P.firstChild,j=D.nextSibling,W=j.firstChild,H=j.nextSibling,ue=H.firstChild,se=P.nextSibling,G=se.firstChild,F=G.firstChild,Z=t;typeof Z=="function"?Re(Z,C):t=C,O(S,Rt),O(M,qr),O(T,Br),O(U,Tie),O(C,(()=>{var re=N(()=>!!e.label);return()=>re()?(()=>{var oe=Iie(),Ie=oe.firstChild;return O(Ie,()=>e.label),O(oe,(()=>{var Pe=N(()=>!!e.required);return()=>Pe()?Pie():null})(),null),O(oe,(()=>{var Pe=N(()=>!!e.optional);return()=>Pe()?Die():null})(),null),oe})():null})(),z),ce(z,"sl-show",async()=>{s(!0),e.onOpen&&await e.onOpen()}),ce(z,"sl-hide",async()=>{l()||(i.value="",e.onHide&&await e.onHide()),s(!1)});var ee=r;typeof ee=="function"?Re(ee,z):r=z,z.style.setProperty("width","100%"),z._$owner=fe(),ce(P,"sl-clear",()=>{d(void 0),c(-1),i.value="",p(""),$()}),ce(P,"sl-focus",re=>{e.onInputFocus?(e.onInputFocus(),re.stopImmediatePropagation()):(r.children[1].style.width=`${i.clientWidth}px`,u()>0&&k().scrollToIndex(u()))}),ce(P,"sl-input",re=>{o()||r.show(),p(re.target.value)});var L=i;typeof L=="function"?Re(L,P):i=P,P._$owner=fe(),O(D,()=>v(e.invalid??!1)),W._$owner=fe(),O(P,b(X,{get when(){return e.clearable},get children(){var re=Aie(),oe=re.firstChild;return ce(oe,"click",Ie=>{Ie.stopImmediatePropagation(),d(void 0),c(-1),i.value="",p(""),$(),r.hide()}),oe._$owner=fe(),J(()=>re.classList.toggle("hidden",!!(e.isLoading||l()==null))),re}}),H),ue._$owner=fe(),se.style.setProperty("width","518px");var le=a;typeof le=="function"?Re(le,G):a=G,G.style.setProperty("max-height","500px"),G.style.setProperty("min-height","37px"),G.style.setProperty("width","100%"),G.style.setProperty("display","flex"),G.style.setProperty("flex-direction","column"),G.style.setProperty("justify-content","start");var me=n;return typeof me=="function"?Re(me,F):n=F,F.style.setProperty("width","100%"),O(F,b(xt,{get each(){return k().getVirtualItems()},get fallback(){return b(Uie,{get noDataMsg(){return e.noDataMsg},get isLoading(){return e.isLoading}})},children:re=>{const oe=re.index>w().length-1,Ie=w()[re.index],Pe=l(),it=!oe&&!!Pe&&"id"in Pe&&"data"in Ie&&Pe.id===Ie.data.id;return b(Ac,{get children(){return[b(vn,{get when(){return"title"in Ie},get children(){return b(qie,{item:Ie})}}),b(vn,{get when(){return"data"in Ie},get children(){return b(Bie,{item:re,isLoader:oe,isSelected:it,get index(){return re.index},get hasMore(){return e.hasMore},get showOverflow(){return e.showOverflow},onClick:()=>{oe||(d(Ie.data),c(Ie.allItemsIdx),m(Ie.data),r.hide())},setLastIndex:f,get children(){return e.displayAccessor(Ie.data,!0)}})}})]}})}})),J(re=>{var oe=e.forceLabelSize&&!e.invalid?-20:e.invalid?-18:0,Ie=e.disabled??!1,Pe=e.placeholder??void 0,it=e.disabled??!1,Ke=!!(e.invalid??!1),ft=!!(e.disabled??!1),Ot=!l()&&i.value==="",de=e.required,Y=!!e.forceLabelSize,we=!e.isLoading,Ce=!!e.isLoading,et=o()?"chevron-up":"chevron-down",Ue=`${k().getTotalSize()}px`;return oe!==re.e&&(z.distance=re.e=oe),Ie!==re.t&&(z.disabled=re.t=Ie),Pe!==re.a&&(P.placeholder=re.a=Pe),it!==re.o&&(P.disabled=re.o=it),Ke!==re.i&&P.classList.toggle("invalid",re.i=Ke),ft!==re.n&&P.classList.toggle("disabled",re.n=ft),Ot!==re.s&&P.classList.toggle("placeholder",re.s=Ot),de!==re.h&&(P.required=re.h=de),Y!==re.r&&D.classList.toggle("h-[21px]",re.r=Y),we!==re.d&&j.classList.toggle("hidden",re.d=we),Ce!==re.l&&H.classList.toggle("hidden",re.l=Ce),et!==re.u&&(ue.name=re.u=et),Ue!==re.c&&((re.c=Ue)!=null?F.style.setProperty("height",Ue):F.style.removeProperty("height")),re},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),J(()=>P.value=e.searchText),C})()},Uie=e=>b(X,{get when(){return e.isLoading},get fallback(){return(()=>{var t=Nie();return t._$owner=fe(),O(t,()=>e.noDataMsg?e.noDataMsg:"No data found"),t})()},get children(){var t=Mie();return t._$owner=fe(),t}}),qie=e=>(()=>{var t=Lie();return t._$owner=fe(),O(t,()=>e.item.title),t})(),Bie=e=>(()=>{var t=Fie();return Re(r=>{e.isLoader&&e.index>0&&e.setLastIndex(r)},t),t.$$click=()=>e.onClick(),t.style.setProperty("width","100%"),t.style.setProperty("white-space","normal"),t._$owner=fe(),O(t,(()=>{var r=N(()=>!!e.isLoader);return()=>r()?N(()=>!!e.hasMore)()?Rie():zie():(()=>{var n=jie();return O(n,()=>e.children),J(i=>{var a=!e.showOverflow,o=!e.showOverflow,s=!e.showOverflow,l=!!e.showOverflow;return a!==i.e&&n.classList.toggle("overflow-hidden",i.e=a),o!==i.t&&n.classList.toggle("overflow-ellipsis",i.t=o),s!==i.a&&n.classList.toggle("whitespace-nowrap",i.a=s),l!==i.o&&n.classList.toggle("whitespace-normal",i.o=l),i},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()})()),J(r=>{var n=!!e.isSelected,i=`${e.item.size}px`;return n!==r.e&&t.classList.toggle("selected",r.e=n),i!==r.t&&((r.t=i)!=null?t.style.setProperty("min-height",i):t.style.removeProperty("min-height")),r},{e:void 0,t:void 0}),t})();to(["click"]);var Hie=K("<strong class=font-extrabold>"),Wie=K("<div><p>"),ky=K('<p class="text-xs text-red-500 mt-1 italic">'),Qie=K("<div><div></div><div> <!>, <!> <!> supply, <!> <!>, "),Gie=K("<span class=text-blue-600>(<!>): "),Yie=K("<div>");function Kie(e){return!e||e.length===0?{}:e.reduce((t,r)=>{if(!r.treatmentIds)return t;for(const n of r.treatmentIds)t[n]=r.reason;return t},{})}function Rv(e,t){return e?e in t?{disabled:!0,disableReason:t[e]}:{disabled:!1}:{disabled:!1}}function Ap(e,t,r){const n=new CustomEvent(t,{composed:!0,bubbles:!0,detail:r});e?.dispatchEvent(n)}function Zie(e,t,r){Ap(e,"photon-treatment-selected",{data:t,catalogId:r})}function Xie(e){Ap(e,"photon-treatment-unselected")}function mn(e,t){Ap(e,"photon-search-text-changed",{text:t})}const Jie=_e`
4380
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ane(e,t){if(e){if(typeof e=="string")return Fv(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fv(e,t)}}function Fv(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function One(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,a=!1,o,s;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(l){a=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}return n}}function Ine(e){if(Array.isArray(e))return e}function Pne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Mne(e,t,r){return t&&Dne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var wy=function(){function e(t,r){Pne(this,e),this.metadata=new kr(r);var n=this.getCountryAndCallingCode(t),i=Ene(n,2),a=i[0],o=i[1];this.defaultCountry=a,this.defaultCallingCode=o,this.reset()}return Mne(e,[{key:"getCountryAndCallingCode",value:function(r){var n,i;return r&&(ja(r)?(n=r.defaultCountry,i=r.defaultCallingCode):n=r),n&&!this.metadata.hasCountry(n)&&(n=void 0),[n,i]}},{key:"input",value:function(r){var n=this.parser.input(r,this.state),i=n.digits,a=n.justLeadingPlus;if(a)this.formattedOutput="+";else if(i){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var o;if(this.metadata.hasSelectedNumberingPlan()&&(o=this.formatter.format(i,this.state)),o===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var s=this.state.getNationalDigits();s&&(o=this.formatter.format(s,this.state))}this.formattedOutput=o?this.getFullNumber(o):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var r=this;return this.state=new Dre({onCountryChange:function(i){r.country=i},onCallingCodeChange:function(i,a){r.metadata.selectNumberingPlan(a,i),r.formatter.reset(r.metadata.numberingPlan,r.state),r.parser.reset(r.metadata.numberingPlan)}}),this.formatter=new une({state:this.state,metadata:this.metadata}),this.parser=new kne({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){r.determineTheCountryIfNeeded(),r.formatter.reset(r.metadata.numberingPlan,r.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){var r=this.state.digits;if(r)return this._getCountry()}},{key:"_getCountry",value:function(){var r=this.state.country;return r}},{key:"determineTheCountryIfNeeded",value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:"getFullNumber",value:function(r){var n=this;if(this.isInternational()){var i=function(s){return n.formatter.getInternationalPrefixBeforeCountryCallingCode(n.state,{spacing:!!s})+s},a=this.state.callingCode;return i(a?r?"".concat(a," ").concat(r):a:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return r}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var r=this.state,n=r.nationalSignificantNumber,i=r.complexPrefixBeforeNationalSignificantNumber,a=r.nationalPrefix,o=n,s=i||a;return s&&(o=s+o),o}},{key:"getNonFormattedNumber",value:function(){var r=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(r?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var r=this.getNonFormattedNumber();if(r)return r.replace(/[\+\d]/g,kn)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var r=this.state.callingCode,n=this.metadata.getCountryCodesForCallingCode(r);return n&&n.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(yy(this.isInternational()?this.state.callingCode:this.defaultCallingCode,{nationalNumber:this.state.nationalSignificantNumber,defaultCountry:this.defaultCountry,metadata:this.metadata}))}},{key:"getNumberValue",value:function(){var r=this.state,n=r.digits,i=r.callingCode,a=r.country,o=r.nationalSignificantNumber;if(n){if(this.isInternational())return i?"+"+i+o:"+"+n;if(a||i){var s=a?this.metadata.countryCallingCode():i;return"+"+s+o}}}},{key:"getNumber",value:function(){var r=this.state,n=r.nationalSignificantNumber,i=r.carrierCode,a=r.callingCode,o=this._getCountry();if(n&&!(!o&&!a)){if(o&&o===this.defaultCountry){var s=new kr(this.metadata.metadata);s.selectNumberingPlan(o);var l=s.numberingPlan.callingCode(),d=this.metadata.getCountryCodesForCallingCode(l);if(d.length>1){var u=vy(n,{countries:d,defaultCountry:this.defaultCountry,metadata:this.metadata.metadata});u&&(o=u)}}var c=new fy(o||a,n,this.metadata.metadata);return i&&(c.carrierCode=i),c}}},{key:"isPossible",value:function(){var r=this.getNumber();return r?r.isPossible():!1}},{key:"isValid",value:function(){var r=this.getNumber();return r?r.isValid():!1}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function R1(){return zee(Are,arguments)}function _c(e){return wy.call(this,e,ny)}_c.prototype=Object.create(wy.prototype,{});_c.prototype.constructor=_c;const Nne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}.input{--sl-input-required-content-color: #f87171;--sl-input-label-font-size-medium: .875rem;--sl-input-label-color: #374151}.input::part(form-control-label){padding-bottom:.5rem}";var lu=K("<style>"),Lne=K('<div class="md:py-2 flex flex-col font-sans"><sl-input class=input type=tel placeholder="( ) ___-____"><p slot=help-text class="text-red-400 pt-1 h-[21px] font-sans">',!0,!1,!1);Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Fne=e=>{let t;const r=i=>{const a=new CustomEvent("photon-phone-changed",{composed:!0,bubbles:!0,detail:{phone:i}});t?.dispatchEvent(a)};St(()=>{e.value&&r(R1(e.value,"US").format("E.164"))});const n=N(()=>e.value?e.value.length>2?new _c("US").input(R1(e.value,"US").formatNational()):e.value:"");return[(()=>{var i=lu();return O(i,Rt),i})(),(()=>{var i=lu();return O(i,qr),i})(),(()=>{var i=lu();return O(i,Br),i})(),(()=>{var i=lu();return O(i,Nne),i})(),(()=>{var i=Lne(),a=i.firstChild,o=a.firstChild,s=t;return typeof s=="function"?Re(s,i):t=i,ce(a,"sl-input",l=>{try{const d=R1(l.target.value,"US").format("E.164");r(d)}catch{r(l.target?.value||"")}}),a._$owner=fe(),O(o,()=>e.helpText),J(l=>{var d=!!e.invalid,u=e.disabled,c=e.label,h=e.required,f=e.invalid;return d!==l.e&&a.classList.toggle("invalid",l.e=d),u!==l.t&&(a.disabled=l.t=u),c!==l.a&&(a.label=l.a=c),h!==l.o&&(a.required=l.o=h),f!==l.i&&(a.invalid=l.i=f),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),J(()=>a.value=n()),i})()]};Et("photon-phone-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1},Fne);const Rne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}";var zne=K("<div><style></style><style>");const Gh=[{id:"1",name:"Male"},{id:"2",name:"Female"},{id:"3",name:"Unknown"}],jne=e=>{let t;const r=n=>{const i=new CustomEvent("photon-sex-selected",{composed:!0,bubbles:!0,detail:{sex:n}});t?.dispatchEvent(i)};return(()=>{var n=zne(),i=n.firstChild,a=i.nextSibling;ce(n,"photon-data-selected",s=>{r(s.detail.data.name.toUpperCase())});var o=t;return typeof o=="function"?Re(o,n):t=n,O(i,Rt),O(a,Rne),O(n,b(lo,{data:Gh,get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:s=>s?.name||"",showOverflow:!0,noDataMsg:"",optional:!1,get helpText(){return e.helpText},get selectedData(){return Gh.filter(s=>s.name.toUpperCase()===e.selected)?.[0]}}),null),n})()};Et("photon-sex-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},jne);const Vne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}";var Une=K("<div><style></style><style>");const z1=[{id:"1",name:"Male/Man"},{id:"2",name:"Female/Woman"},{id:"3",name:"TransMale/TransMan"},{id:"4",name:"TransFemale/TransWoman"},{id:"5",name:"Genderqueery/Gender nonconforming"},{id:"6",name:"Something else"},{id:"7",name:"Decline to answer"}],qne=e=>{const[t,r]=B("");let n;const i=s=>s.length===0?z1:z1.filter(l=>l.name.toLowerCase().includes(s.toLowerCase())),a=s=>{const l=new CustomEvent("photon-gender-selected",{composed:!0,bubbles:!0,detail:{gender:s}});n?.dispatchEvent(l)},o=()=>{const s=new CustomEvent("photon-gender-deselected",{composed:!0,bubbles:!0,detail:{}});n?.dispatchEvent(s)};return(()=>{var s=Une(),l=s.firstChild,d=l.nextSibling;ce(s,"photon-data-unselected",()=>{o()}),ce(s,"photon-data-selected",c=>{a(c.detail.data.name)});var u=n;return typeof u=="function"?Re(u,s):n=s,O(l,Rt),O(d,Vne),O(s,b(lo,{get data(){return i(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:c=>c?.name||"",showOverflow:!0,onSearchChange:async c=>{r(c)},onHide:async()=>{r("")},noDataMsg:"",get optional(){return!e.required},get helpText(){return e.helpText},get selectedData(){return z1.filter(c=>c.name===e.selected)?.[0]}}),null),s})()};Et("photon-gender-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},qne);var Bne=K('<div class="w-full flex justify-center">'),Hne=K('<div><p class="font-sans text-lg flex-grow">Patient Info</p><div class="flex flex-col xs:flex-row xs:gap-4"><photon-text-input class="flex-grow min-w-[40%]"debounce-time=0 label="First Name"required=true></photon-text-input><photon-text-input class=min-w-[48%] debounce-time=0 label="Last Name"required=true></photon-text-input></div><div class="flex flex-col xs:flex-row items-center xs:gap-4"><photon-datepicker no-initial-date=true class="flex-grow w-full xs:min-w-[40%]"label="Date of Birth"required=true></photon-datepicker><photon-phone-input class="w-full xs:min-w-[48%]"label="Mobile Number"required=true></photon-phone-input></div><div class="flex flex-col xs:flex-row justify-between xs:gap-4"><div class="flex-grow w-full xs:min-w-[40%]"><photon-sex-input label="Sex at Birth"required=true></photon-sex-input></div><div class="flex-grow w-full xs:min-w-[40%]"><photon-gender-input label=Gender required=false></photon-gender-input></div></div><div class=mt-2><photon-text-input debounce-time=0 label=Email>',!0,!1,!1),Wne=K('<div><p class="font-sans text-lg flex-grow">Address</p><photon-text-input debounce-time=0 label="Street 1"required=true></photon-text-input><photon-text-input debounce-time=0 label="Street 2"></photon-text-input><photon-text-input debounce-time=0 label=City required=true></photon-text-input><div class="flex gap-4 pb-5 xs:pb-2"><photon-state-input class="flex-grow min-w-[40%]"label=State required=true></photon-state-input><photon-text-input debounce-time=0 class="flex-grow min-w-[40%]"label="Zip Code"required=true>',!0,!1,!1),Qne=K('<div><div class="flex items-baseline gap-2"><p class="font-sans text-lg">Preferred Pharmacy</p><p class="font-sans text-sm text-gray-500">Optional'),Gne=K('<div class="flex flex-col gap-8">'),Yne=K('<div class="w-full h-full relative"><style></style><style></style><style></style><style>');Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Kne=(e,t)=>{const r=e.selectedPatient.data?.address;return t.address_zip?.value&&MQ(t.address_zip?.value)&&t.address_zip?.value!=r?.postalCode?t.address_zip?.value:r?`${r.street1} ${r.street2??""} ${r.city}, ${r.state} ${r.postalCode}`:""},Zne=e=>{let t;const r=Jr(),{store:n,actions:i}=_d,{store:a,actions:o}=M8({firstName:void 0,lastName:void 0,dateOfBirth:void 0,phone:void 0,gender:void 0,sex:void 0,email:void 0,address_street1:void 0,address_street2:void 0,address_city:void 0,address_state:void 0,address_zip:void 0,preferredPharmacy:void 0});o.registerValidator({key:"firstName",validator:sr(_a(ln(),1,1/0),"Please enter a first name.")}),o.registerValidator({key:"lastName",validator:sr(_a(ln(),1,1/0),"Please enter a last name.")}),o.registerValidator({key:"dateOfBirth",validator:sr(Wg([YX,rv()]),"Please enter a valid date of birth.")}),o.registerValidator({key:"sex",validator:sr(LK(Gh.map(d=>d.name.toUpperCase())),"Please enter Sex at Birth.")}),o.registerValidator({key:"phone",validator:sr(_a(ln(),12),"Please enter a valid mobile number.")}),o.registerValidator({key:"email",validator:sr(Wg([XX(),rv()]),"Please enter a valid email.")}),o.registerValidator({key:"address_street1",validator:sr(_a(ln(),1,1/0),"Please enter a valid Street 1.")}),o.registerValidator({key:"address_city",validator:sr(_a(ln(),1,1/0),"Please enter a valid City.")}),o.registerValidator({key:"address_state",validator:sr(_a(ln(),2,2),"Please enter a valid State.")}),o.registerValidator({key:"address_zip",validator:sr(ZX(),"Please enter a valid zip code.")}),St(()=>{e.patientId?i.getSelectedPatient(r.getSDK(),e.patientId):i.clearSelectedPatient()});const s=d=>{const u=new CustomEvent("photon-form-updated",{composed:!0,bubbles:!0,detail:{form:d,actions:o,selected:n,reset:()=>{o.reset(),i.reset()}}});t?.dispatchEvent(u)};pe(()=>{n.selectedPatient.data&&(o.updateFormValue({key:"firstName",value:n.selectedPatient.data.name.first}),o.updateFormValue({key:"lastName",value:n.selectedPatient.data.name.last}),o.updateFormValue({key:"phone",value:n.selectedPatient.data.phone}),o.updateFormValue({key:"gender",value:n.selectedPatient.data.gender}),o.updateFormValue({key:"sex",value:n.selectedPatient.data.sex}),o.updateFormValue({key:"email",value:n.selectedPatient.data.email}),o.updateFormValue({key:"address_street1",value:n.selectedPatient.data.address?.street1}),o.updateFormValue({key:"address_street2",value:n.selectedPatient.data.address?.street2}),o.updateFormValue({key:"address_city",value:n.selectedPatient.data.address?.city}),o.updateFormValue({key:"address_state",value:n.selectedPatient.data.address?.state}),o.updateFormValue({key:"address_zip",value:n.selectedPatient.data.address?.postalCode}),o.updateFormValue({key:"preferredPharmacy",value:n.selectedPatient.data.preferredPharmacies?.[0]?.id}))}),pe(()=>{s(a)}),xr(()=>{i.clearSelectedPatient(),o.reset()});const l=N(()=>{const d=n.selectedPatient.data?.preferredPharmacies?.[0];if(!d)return;const u=d.address;return{...d,address:u,isPrevious:!0,isPreferred:!0}});return(()=>{var d=Yne(),u=d.firstChild,c=u.nextSibling,h=c.nextSibling,f=h.nextSibling,p=t;return typeof p=="function"?Re(p,d):t=d,O(u,Rt),O(c,qr),O(h,Br),O(f,oi),O(d,b(X,{get when(){return n.selectedPatient.isLoading},get children(){var g=Bne();return O(g,b(ni,{color:"green"})),g}}),null),O(d,b(X,{get when(){return!n.selectedPatient.isLoading},get children(){return b(F8,{permissions:["write:patient"],get children(){var g=Gne();return O(g,b(Rr,{get children(){var v=Hne(),m=v.firstChild,$=m.nextSibling,w=$.firstChild,k=w.nextSibling,C=$.nextSibling,S=C.firstChild,M=S.nextSibling,T=C.nextSibling,U=T.firstChild,z=U.firstChild,P=U.nextSibling,D=P.firstChild,j=T.nextSibling,W=j.firstChild;return ce(w,"photon-input-changed",async H=>{o.updateFormValue({key:"firstName",value:H.detail.input})}),w._$owner=fe(),ce(k,"photon-input-changed",async H=>{o.updateFormValue({key:"lastName",value:H.detail.input})}),k._$owner=fe(),ce(S,"photon-datepicker-selected",async H=>{o.updateFormValue({key:"dateOfBirth",value:H.detail.date})}),S._$owner=fe(),ce(M,"photon-phone-changed",async H=>{o.updateFormValue({key:"phone",value:H.detail.phone})}),M._$owner=fe(),ce(z,"photon-sex-deselected",()=>{o.updateFormValue({key:"sex",value:void 0})}),ce(z,"photon-sex-selected",H=>{o.updateFormValue({key:"sex",value:H.detail.sex})}),z._$owner=fe(),ce(D,"photon-gender-deselected",()=>{o.updateFormValue({key:"gender",value:void 0})}),ce(D,"photon-gender-selected",H=>{o.updateFormValue({key:"gender",value:H.detail.gender})}),D._$owner=fe(),ce(W,"photon-input-changed",async H=>{o.updateFormValue({key:"email",value:H.detail.input})}),W._$owner=fe(),J(H=>{var ue=a.firstName?.error,se=a.firstName?.error,G=a.lastName?.error,F=a.lastName?.error,Z=a.dateOfBirth?.error,ee=a.dateOfBirth?.error,L=a.phone?.error,le=a.phone?.error,me=a.sex?.error,re=a.sex?.error!==void 0,oe=n.selectedPatient.data?.sex,Ie=a.gender?.error,Pe=a.gender?.error!==void 0,it=n.selectedPatient.data?.gender,Ke=a.email?.error,ft=a.email?.error;return ue!==H.e&&(w.invalid=H.e=ue),se!==H.t&&(w.helpText=H.t=se),G!==H.a&&(k.invalid=H.a=G),F!==H.o&&(k.helpText=H.o=F),Z!==H.i&&(S.invalid=H.i=Z),ee!==H.n&&(S.helpText=H.n=ee),L!==H.s&&(M.invalid=H.s=L),le!==H.h&&(M.helpText=H.h=le),me!==H.r&&(z.helpText=H.r=me),re!==H.d&&(z.invalid=H.d=re),oe!==H.l&&(z.selected=H.l=oe),Ie!==H.u&&(D.helpText=H.u=Ie),Pe!==H.c&&(D.invalid=H.c=Pe),it!==H.w&&(D.selected=H.w=it),Ke!==H.m&&(W.invalid=H.m=Ke),ft!==H.f&&(W.helpText=H.f=ft),H},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0,w:void 0,m:void 0,f:void 0}),J(()=>w.value=a.firstName?.value??n.selectedPatient.data?.name.first),J(()=>k.value=a.lastName?.value??n.selectedPatient.data?.name.last),J(()=>S.value=e.patientId?n.selectedPatient.data?.dateOfBirth:a.dateOfBirth?.value),J(()=>M.value=a.phone?.value??n.selectedPatient.data?.phone),J(()=>W.value=a.email?.value??n.selectedPatient.data?.email),v}}),null),O(g,b(Rr,{get children(){var v=Wne(),m=v.firstChild,$=m.nextSibling,w=$.nextSibling,k=w.nextSibling,C=k.nextSibling,S=C.firstChild,M=S.nextSibling;return ce($,"photon-input-changed",async T=>{o.updateFormValue({key:"address_street1",value:T.detail.input})}),$._$owner=fe(),ce(w,"photon-input-changed",async T=>{o.updateFormValue({key:"address_street2",value:T.detail.input})}),w.optional=!0,w._$owner=fe(),ce(k,"photon-input-changed",async T=>{o.updateFormValue({key:"address_city",value:T.detail.input})}),k._$owner=fe(),ce(S,"photon-state-selected",T=>{o.updateFormValue({key:"address_state",value:T.detail.state})}),S._$owner=fe(),ce(M,"photon-input-changed",async T=>{o.updateFormValue({key:"address_zip",value:T.detail.input})}),M._$owner=fe(),J(T=>{var U=a.address_street1?.error,z=a.address_street1?.error,P=a.address_street2?.error,D=a.address_street2?.error,j=a.address_city?.error,W=a.address_city?.error,H=a.address_state?.error,ue=a.address_state?.error!==void 0,se=a.state?.value??n.selectedPatient.data?.address?.state,G=a.address_zip?.error,F=a.address_zip?.error;return U!==T.e&&($.invalid=T.e=U),z!==T.t&&($.helpText=T.t=z),P!==T.a&&(w.invalid=T.a=P),D!==T.o&&(w.helpText=T.o=D),j!==T.i&&(k.invalid=T.i=j),W!==T.n&&(k.helpText=T.n=W),H!==T.s&&(S.helpText=T.s=H),ue!==T.h&&(S.invalid=T.h=ue),se!==T.r&&(S.selected=T.r=se),G!==T.d&&(M.invalid=T.d=G),F!==T.l&&(M.helpText=T.l=F),T},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),J(()=>$.value=a.address_street1?.value??n.selectedPatient.data?.address?.street1),J(()=>w.value=a.address_street2?.value??n.selectedPatient.data?.address?.street2),J(()=>k.value=a.address_city?.value??n.selectedPatient.data?.address?.city),J(()=>M.value=a.address_zip?.value??n.selectedPatient.data?.address?.postalCode),v}}),null),O(g,b(Rr,{get children(){var v=Qne();return v.firstChild,O(v,b(N6,{get address(){return Kne(n,a)},setPharmacy:m=>{o.updateFormValue({key:"preferredPharmacy",value:m.id})},get patientId(){return e.patientId},get initialValue(){return l()},hidePreferred:!0}),null),v}}),null),g}})}}),null),d})()};Et("photon-patient-form",{patientId:""},Zne);const Xne=".input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}";var Jne=K("<div><style></style><style>");const j1=[{id:"1",name:"AL"},{id:"2",name:"AK"},{id:"3",name:"AZ"},{id:"4",name:"AR"},{id:"5",name:"CA"},{id:"6",name:"CO"},{id:"7",name:"CT"},{id:"8",name:"DE"},{id:"9",name:"DC"},{id:"10",name:"FL"},{id:"11",name:"GA"},{id:"12",name:"HI"},{id:"13",name:"ID"},{id:"14",name:"IL"},{id:"15",name:"IN"},{id:"16",name:"IA"},{id:"17",name:"KS"},{id:"18",name:"KY"},{id:"19",name:"LA"},{id:"20",name:"ME"},{id:"21",name:"MD"},{id:"22",name:"MA"},{id:"23",name:"MI"},{id:"24",name:"MN"},{id:"25",name:"MS"},{id:"26",name:"MO"},{id:"27",name:"MT"},{id:"28",name:"NE"},{id:"29",name:"NV"},{id:"30",name:"NH"},{id:"31",name:"NJ"},{id:"32",name:"NM"},{id:"33",name:"NY"},{id:"34",name:"NC"},{id:"35",name:"ND"},{id:"36",name:"OH"},{id:"37",name:"OK"},{id:"38",name:"OR"},{id:"39",name:"PA"},{id:"40",name:"PR"},{id:"41",name:"RI"},{id:"42",name:"SC"},{id:"43",name:"SD"},{id:"44",name:"TN"},{id:"45",name:"TX"},{id:"46",name:"UT"},{id:"47",name:"VT"},{id:"48",name:"VA"},{id:"49",name:"WA"},{id:"50",name:"WV"},{id:"51",name:"WI"},{id:"52",name:"WY"}],eie=e=>{const[t,r]=B("");let n;const i=o=>{const s=new CustomEvent("photon-state-selected",{composed:!0,bubbles:!0,detail:{state:o}});n?.dispatchEvent(s)},a=o=>o.length===0?j1:j1.filter(s=>s.name.toLowerCase().includes(o.toLowerCase()));return(()=>{var o=Jne(),s=o.firstChild,l=s.nextSibling;ce(o,"photon-data-selected",u=>{i(u.detail.data.name)});var d=n;return typeof d=="function"?Re(d,o):n=o,O(s,Rt),O(l,Xne),O(o,b(lo,{get data(){return a(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:u=>u?.name||"",showOverflow:!0,onSearchChange:async u=>{r(u)},onHide:async()=>{r("")},noDataMsg:"",optional:!1,get helpText(){return e.helpText},get selectedData(){return j1.filter(u=>u.name===e.selected)?.[0]}}),null),o})()};Et("photon-state-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},eie);var tie=K('<div class="text-black text-xl md:text-3xl">'),rie=K("<sl-icon class=flex-shrink-0>",!0,!1,!1),nie=K('<footer class="z-40 fixed bottom-0 w-full bg-white shadow-card px-4 py-4 md:px-8"><div class="flex flex-col xs:flex-row-reverse xs:justify-start gap-2 items-center w-full sm:w-[600px] xs:mx-auto sm:px-4">'),iie=K('<div class="z-50 fixed top-0 left-0 w-full h-screen overflow-y-scroll bg-[#F9FAFB]"><style></style><photon-dialog confirm-text="Yes, Close"cancel-text="Keep Editing"><p class="font-sans text-lg xs:text-base"></p></photon-dialog><header class="z-40 flex items-center px-4 py-2 md:px-8 md:py-3 bg-white fixed w-full shadow-card"><div class="flex items-center"></div><div class="flex-1 flex justify-center items-center min-w-0 px-2"><p class="ml-1 font-sans text-lg md:text-xl font-medium truncate"></p></div><div class="flex items-center w-[44px]"></div></header><div class="z-30 w-full min-h-screen bg-[#F9FAFB] pt-14"><div class="px-4 pb-40 md:pt-4 md:pb-52 md:px-4 w-full h-full sm:w-[600px] xs:mx-auto">',!0,!1,!1);const xy=e=>{const t=Be({closeTitle:"Lose unsaved changes?",closeBody:"You will not be able to recover unsaved changes.",checkShouldWarn:()=>!1},e);let r;const[n,i]=B(!1),a=()=>{i(!1),t.onClosed()},o=()=>i(!1);return(()=>{var s=iie(),l=s.firstChild,d=l.nextSibling,u=d.firstChild,c=d.nextSibling,h=c.firstChild,f=h.nextSibling,p=f.firstChild,g=c.nextSibling,v=g.firstChild,m=r;return typeof m=="function"?Re(m,s):r=s,O(l,Rt),ce(d,"photon-dialog-alt",o),ce(d,"photon-dialog-canceled",o),ce(d,"photon-dialog-confirmed",a),d._$owner=fe(),O(u,()=>t.closeBody),O(h,b(st,{variant:"naked",size:"sm",onClick:()=>{t.checkShouldWarn()?i(!0):t.onClosed()},get children(){var $=tie();return O($,b(at,{name:"xMark"})),$}})),O(f,b(X,{get when(){return t.titleIconName},get children(){var $=rie();return $._$owner=fe(),J(()=>$.name=t.titleIconName),$}}),p),O(p,()=>t.title),O(v,()=>t.form),O(s,b(X,{get when(){return t.footer},get children(){var $=nie(),w=$.firstChild;return O(w,()=>t.footer),$}}),null),J($=>{var w=t.closeTitle,k=n();return w!==$.e&&(d.label=$.e=w),k!==$.t&&(d.open=$.t=k),$},{e:void 0,t:void 0}),s})()};var aie=K("<div><style>"),oie=K('<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4"role=alert><span class="block sm:inline">'),sie=K("<photon-patient-form slot=form>",!0,!1,!1);const lie=e=>{let t;const r=Jr(),[n,i]=B(!1),[a,o]=B(!1),[s,l]=B(void 0),[d,u]=B(void 0),[c,h]=B(void 0),[f,p]=B(void 0),g=(w,k=!1)=>{const C=new CustomEvent("photon-patient-updated",{composed:!0,bubbles:!0,detail:{patientId:w,createPrescription:k}});t?.dispatchEvent(C)},v=(w,k=!1)=>{const C=new CustomEvent("photon-patient-created",{composed:!0,bubbles:!0,detail:{patientId:w,createPrescription:k}});t?.dispatchEvent(C)},m=()=>{const w=new CustomEvent("photon-patient-closed",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(w)},$=async(w,k,C,S=!1)=>{p(void 0),o(S),i(!0);const M=["firstName","lastName","dateOfBirth","phone","sex","email","address_street1","address_city","address_state","address_zip"];if(k.validate(M),k.hasErrors(M))return i(!1),!0;w.preferredPharmacy.value&&C.selectedPatient.data?.preferredPharmacies&&C.selectedPatient.data?.preferredPharmacies.length!==0&&!C.selectedPatient.data?.preferredPharmacies?.map(U=>U?.id).filter(U=>U!==null).includes(w.preferredPharmacy.value)&&await r.getSDK().clinical.patient.removePatientPreferredPharmacy({})({variables:{patientId:e.patientId,pharmacyId:C.selectedPatient.data?.preferredPharmacies[0].id},awaitRefetchQueries:!1});const T={...e?.patientId?{id:e.patientId}:{},name:{first:w.firstName.value,last:w.lastName.value},gender:w.gender.value,email:w.email.value?w.email.value:void 0,phone:w.phone.value,dateOfBirth:w.dateOfBirth.value,sex:w.sex.value,address:w.address_street1.value!==void 0?{street1:w.address_street1.value,street2:w.address_street2.value,city:w.address_city.value,state:w.address_state.value,postalCode:w.address_zip.value,country:"US"}:void 0,preferredPharmacies:w.preferredPharmacy.value?[w.preferredPharmacy.value]:[]};try{if(e?.patientId)await r.getSDK().clinical.patient.updatePatient({})({variables:T,awaitRefetchQueries:!1}),g(e.patientId,S);else{const z=await r.getSDK().clinical.patient.createPatient({})({variables:T,awaitRefetchQueries:!1});v(z?.data?.createPatient?.id||"",S)}i(!1),k.resetStores(),e.open=!1}catch(U){i(!1),p(U?.message||"An error occurred while saving the patient.")}};return(()=>{var w=aie(),k=w.firstChild,C=t;return typeof C=="function"?Re(C,w):t=w,O(k,oi),O(w,b(X,{get when(){return e.open},get children(){return b(xy,{onClosed:()=>{m(),c().resetStores(),e.open=!1},get title(){return e?.patientId?"Edit patient":"New patient"},get titleIconName(){return e?.patientId?"pencil-square":"person-plus"},get footer(){return[b(X,{get when(){return!e?.hideCreatePrescription},get children(){return b(st,{class:"w-full xs:w-fit",size:"lg",get disabled(){return n()},get loading(){return N(()=>!!n())()&&a()},onClick:()=>$(s(),c(),d(),!0),get children(){return[N(()=>e?.patientId?"Save":"Create")," and start prescription"]}})}}),b(st,{class:"w-full xs:w-fit",size:"lg",get variant(){return e?.hideCreatePrescription?"primary":"secondary"},get disabled(){return n()},get loading(){return N(()=>!!n())()&&!a()},onClick:()=>$(s(),c(),d(),!1),get children(){return e?.patientId?"Save":"Create"}})]},get form(){return[b(X,{get when(){return f()},get children(){var S=oie(),M=S.firstChild;return O(M,f),S}}),(()=>{var S=sie();return ce(S,"photon-form-updated",M=>{l(M.detail.form),h(Object.assign({},M.detail.actions,{resetStores:M.detail.reset})),u(M.detail.selected)}),S._$owner=fe(),J(()=>S.patientId=e.patientId),S})()]}})}}),null),w})()};Et("photon-patient-dialog",{patientId:"",hideCreatePrescription:!1,open:!1},lie);var die=K("<photon-patient-dialog>",!0,!1,!1);const uie=e=>(console.warn("photon-update-patient-dialog will be deprecated soon. Please use photon-patient-dialog instead."),(()=>{var t=die();return t._$owner=fe(),J(r=>{var n=e.patientId,i=e.open;return n!==r.e&&(t.patientId=r.e=n),i!==r.t&&(t.open=r.t=i),r},{e:void 0,t:void 0}),t})());Et("photon-update-patient-dialog",{patientId:"",open:!1},uie);const cie=".invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.input::part(base):hover{cursor:pointer}.disabled::part(base):hover{cursor:not-allowed}.selected::part(base){--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.default::part(base):hover{--tw-bg-opacity: 1;background-color:rgb(229,231,235,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity))}.default::part(label){width:100%;overflow:hidden}.group-member::part(base){padding-left:1rem;font-weight:500}.group{background:#d1e9ff;padding-top:.25rem;padding-bottom:.25rem;--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity));font-size:.75rem;font-weight:500}.treatment-option::part(checked-icon){display:none;width:0px}.full-screen-close-btn::part(base){padding:0}.treatment-search::part(input){padding-right:0}.treatment-search::part(input)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(209,213,219,var(--tw-text-opacity))}.treatment-search::part(input)::placeholder{--tw-text-opacity: 1;color:rgb(209,213,219,var(--tw-text-opacity))}.dropdown::part(panel){box-shadow:none}.dropdown-container{height:100vh;height:100dvh;max-height:100dvh}.dropdown-container-list-items{-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-y}";var hie=K('<div slot=suffix class=flex><sl-icon class="text-gray-400 hover:text-gray-600"name=x-circle-fill>',!0,!1,!1),fie=K('<div><style></style><style></style><style></style><style></style><div class="dropdown-container fixed top-0 left-0 w-full bg-white overflow-hidden z-2000 flex flex-col"><div class="flex items-center pb-2 pl-5 pr-5 pt-3 flex-shrink-0"><div class="flex items-center"><sl-icon-button name=x label="Close medication search"class=full-screen-close-btn></sl-icon-button></div></div><div class=flex-shrink-0><sl-input slot=trigger clearable autocomplete=off size=medium class="treatment-search input mb-2 px-4"><p slot=help-text class="text-red-400 pt-1 font-sans"></p><div slot=suffix class=flex><sl-spinner slot=suffix></sl-spinner></div></sl-input></div><div class="w-full flex-1 overflow-y-auto .dropdown-container-list-items">',!0,!1,!1),pie=K('<div class="md:flex flex-1 justify-center items-center pl-2"><div class="flex items-center space-x-2"><p class="text-gray-700 text-sm font-sans inline font-medium">'),mie=K('<p class="pl-1 text-red-400">*'),gie=K('<p class="text-gray-400 text-xs pl-2 font-sans">Optional'),vie=K("<div class=px-4><p class=text-gray-400>Loading..."),yie=K("<div class=px-4><p class=text-gray-400>No treatments found"),bie=K('<div class="group uppercase px-4">'),$ie=K("<div class=treatment-option>"),wie=K('<p class="text-center text-gray-400 italic px-3">Loading...'),xie=K('<p class="text-center text-gray-400 italic px-3">Nothing more to load'),kie=K('<div class="px-4 py-1">');Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const _ie=e=>{let t,r,n;e.actionRef&&(e.actionRef.clear=()=>{n.value="",i(""),s()});const i=$d(async u=>{e.onSearchChange&&await e.onSearchChange(u)},500),a=u=>{if(u)return e.helpText?e.helpText:e.required?"Please select data...":void 0},o=u=>{const c=new CustomEvent("photon-data-selected",{composed:!0,bubbles:!0,detail:{data:u}});t?.dispatchEvent(c)},s=()=>{const u=new CustomEvent("photon-data-unselected",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(u)};St(()=>{n&&(n.addEventListener("keydown",u=>{(u.code=="Space"||u.key==" ")&&u.stopImmediatePropagation()}),setTimeout(()=>{n.focus()},100))}),pe(()=>{if(e.open){const u=window.scrollY;document.body.style.position="fixed",document.body.style.top=`-${u}px`,document.body.style.width="100%",document.body.style.overflow="hidden",xr(()=>{const c=document.body.style.top;document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflow="",window.scrollTo(0,parseInt(c||"0")*-1)})}});const l=N(()=>e.groups?e.groups.map(u=>{const c=e.data.map((h,f)=>({data:h,allItemsIdx:f})).filter(h=>u.filter(h.data));return c.length>0?[{title:u.label},...c]:[]}).flat():e.data.map((u,c)=>({data:u,allItemsIdx:c}))),d=N(()=>yp({count:l().length,getScrollElement:()=>r??null,estimateSize:()=>42,overscan:100}));return(()=>{var u=fie(),c=u.firstChild,h=c.nextSibling,f=h.nextSibling,p=f.nextSibling,g=p.nextSibling,v=g.firstChild,m=v.firstChild,$=m.firstChild,w=v.nextSibling,k=w.firstChild,C=k.firstChild,S=C.nextSibling,M=S.firstChild,T=w.nextSibling,U=t;typeof U=="function"?Re(U,u):t=u,O(c,Rt),O(h,qr),O(f,Br),O(p,cie),g.$$touchstart=D=>D.stopPropagation(),g.$$touchmove=D=>D.stopPropagation(),v.style.setProperty("touch-action","none"),m.style.setProperty("font-size","26px"),ce($,"click",()=>{e.onClose&&e.onClose()}),$.style.setProperty("padding","0px"),$._$owner=fe(),O(v,(()=>{var D=N(()=>!!e.label);return()=>D()?(()=>{var j=pie(),W=j.firstChild,H=W.firstChild;return O(H,()=>e.label),j})():null})(),null),O(v,(()=>{var D=N(()=>!!e.required);return()=>D()?mie():null})(),null),O(v,(()=>{var D=N(()=>!!e.optional);return()=>D()?gie():null})(),null),w.$$touchstart=D=>D.stopPropagation(),w.$$touchmove=D=>D.stopPropagation(),w.style.setProperty("touch-action","none"),ce(k,"sl-clear",()=>{n.value="",i(""),s()}),ce(k,"input",D=>{i(D.target.value)});var z=n;typeof z=="function"?Re(z,k):n=k,k.style.setProperty("border-radius","0px"),k.style.setProperty("border","0px"),k._$owner=fe(),O(C,()=>a(e.invalid??!1)),M._$owner=fe(),O(k,b(X,{get when(){return e.clearable},get children(){var D=hie(),j=D.firstChild;return ce(j,"click",W=>{W.stopImmediatePropagation(),n.value="",i(""),s()}),j._$owner=fe(),J(()=>D.classList.toggle("hidden",!!(e.isLoading||!e.selectedData))),D}}),null);var P=r;return typeof P=="function"?Re(P,T):r=T,O(T,b(xt,{get each(){return d().getVirtualItems()},get fallback(){return b(Cie,{get isLoading(){return e.isLoading}})},children:D=>{const j=D.index>l().length-1,W=l()[D.index],H=e.selectedData,ue=!j&&!!H&&"id"in H&&"data"in W&&H.id===W.data.id,se="title"in W?Sie:Eie,G="title"in W?{item:W}:{item:D,isLoader:j,isSelected:ue,index:D.index,hasMore:e.hasMore,showOverflow:e.showOverflow,onClick:()=>{j||(n.value="",i(""),o(W.data))}};return b(gb,Be({component:se},G,{get children(){return N(()=>"data"in W)()&&e.displayAccessor(W.data,!0)}}))}})),J(D=>{var j=e.placeholder,W=e.disabled??!1,H=!!(e.invalid??!1),ue=!!(e.disabled??!1),se=e.required,G=!!e.forceLabelSize,F=!e.isLoading;return j!==D.e&&(k.placeholder=D.e=j),W!==D.t&&(k.disabled=D.t=W),H!==D.a&&k.classList.toggle("invalid",D.a=H),ue!==D.o&&k.classList.toggle("disabled",D.o=ue),se!==D.i&&(k.required=D.i=se),G!==D.n&&C.classList.toggle("h-[21px]",D.n=G),F!==D.s&&S.classList.toggle("hidden",D.s=F),D},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),J(()=>k.value=e.searchText),u})()},Cie=e=>b(X,{get when(){return e.isLoading},get fallback(){return yie()},get children(){return vie()}}),Sie=e=>(()=>{var t=bie();return t.style.setProperty("position","sticky"),t.style.setProperty("top","0px"),t.style.setProperty("z-index","10"),O(t,()=>e.item.title),t})(),Eie=e=>(()=>{var t=$ie();return t.$$click=()=>e.onClick(),O(t,(()=>{var r=N(()=>!!e.isLoader);return()=>r()?N(()=>!!e.hasMore)()?wie():xie():(()=>{var n=kie();return O(n,()=>e.children),n})()})()),J(r=>{var n=!!e.isSelected,i=!!e.isSelected;return n!==r.e&&t.classList.toggle("bg-blue-500",r.e=n),i!==r.t&&t.classList.toggle("text-white",r.t=i),r},{e:void 0,t:void 0}),t})();to(["touchmove","touchstart","click"]);const Tie=".invalid::part(base){--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity));border-width:2px}.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.input::part(base):hover{cursor:pointer}.input::part(input){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.disabled::part(base):hover{cursor:not-allowed}.selected::part(base){--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.default::part(base):hover{--tw-bg-opacity: 1;background-color:rgb(229,231,235,var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity))}.default::part(label){width:100%;overflow:hidden}.group-member::part(base){padding-left:1rem;font-weight:500}.group::part(base){background:#d1e9ff;padding-top:.25rem;padding-bottom:.25rem;--tw-text-opacity: 1;color:rgb(31,41,55,var(--tw-text-opacity));font-size:.75rem;font-weight:600}.dropdown::part(panel){border-radius:var(--photon-border-radius, .5rem)}.dropdown-container{border-radius:var(--photon-border-radius, .5rem)}.group::part(checked-icon){display:none;width:0px}.group::part(label){padding-left:12px;padding-right:12px}.treatment-option::part(checked-icon){display:none;width:0px}";var Aie=K('<div slot=suffix class=flex><sl-icon class="text-gray-400 hover:text-gray-600"name=x-circle-fill>',!0,!1,!1),Oie=K('<div><style></style><style></style><style></style><style></style><sl-dropdown class="dropdown relative"hoist><sl-input clearable slot=trigger autocomplete=off size=medium class=input><p slot=help-text class="text-red-400 pt-1 font-sans"></p><div slot=suffix class=flex><sl-spinner slot=suffix></sl-spinner></div><div slot=suffix class=flex><sl-icon></sl-icon></div></sl-input><div class="border border-gray-200 dropdown-container overflow-hidden relative"><div class="bg-white overflow-x-hidden overflow-y-auto relative"><div>',!0,!1,!1),Iie=K('<div class="flex items-center pb-2"><p class="text-gray-700 text-sm font-sans">'),Pie=K('<p class="pl-1 text-red-400">*'),Die=K('<p class="text-gray-400 text-xs pl-2 font-sans">Optional'),Mie=K('<sl-menu-item><p class="text-center text-gray-400 italic">Loading...',!0,!1,!1),Nie=K("<sl-menu-item>",!0,!1,!1),Lie=K('<sl-menu-item class="group uppercase">',!0,!1,!1),Fie=K("<sl-menu-item class=treatment-option>",!0,!1,!1),Rie=K('<p class="text-center text-gray-400 italic">Loading...'),zie=K('<p class="text-center text-gray-400 italic">Nothing more to load'),jie=K('<p class="break-words px-3">');Xt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Vie=e=>{let t,r,n,i,a;e.actionRef&&(e.actionRef.clear=()=>{d(void 0),c(-1),i.value="",p(""),$()});const[o,s]=B(!1),[l,d]=B(void 0),[u,c]=B(-1),[h,f]=B(),p=$d(async C=>{e.onSearchChange&&await e.onSearchChange(C)},250),g=new IntersectionObserver(async C=>{C?.at(-1)?.isIntersecting&&e.hasMore&&e.fetchMore&&await e.fetchMore()});pe(()=>{e.data.length===0&&d(void 0)}),pe(()=>{h()&&g.observe(h())});const v=C=>{if(C)return e.helpText?e.helpText:e.required?"Please select data...":void 0},m=C=>{const S=new CustomEvent("photon-data-selected",{composed:!0,bubbles:!0,detail:{data:C}});t?.dispatchEvent(S)},$=()=>{const C=new CustomEvent("photon-data-unselected",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(C)};pe(()=>{e.selectedData&&d(e.selectedData),e.selectedData===void 0&&d(void 0)}),St(()=>{i&&i.addEventListener("keydown",C=>{(C.code=="Space"||C.key==" ")&&C.stopImmediatePropagation()})});const w=N(()=>e.groups?e.groups.map(C=>{const S=e.data.map((M,T)=>({data:M,allItemsIdx:T})).filter(M=>C.filter(M.data));return S.length>0?[{title:C.label},...S]:[]}).flat():e.data.map((C,S)=>({data:C,allItemsIdx:S}))),k=N(()=>yp({count:w().length,getScrollElement:()=>n??null,estimateSize:()=>36.8,overscan:100}));return(()=>{var C=Oie(),S=C.firstChild,M=S.nextSibling,T=M.nextSibling,U=T.nextSibling,z=U.nextSibling,P=z.firstChild,D=P.firstChild,j=D.nextSibling,W=j.firstChild,H=j.nextSibling,ue=H.firstChild,se=P.nextSibling,G=se.firstChild,F=G.firstChild,Z=t;typeof Z=="function"?Re(Z,C):t=C,O(S,Rt),O(M,qr),O(T,Br),O(U,Tie),O(C,(()=>{var re=N(()=>!!e.label);return()=>re()?(()=>{var oe=Iie(),Ie=oe.firstChild;return O(Ie,()=>e.label),O(oe,(()=>{var Pe=N(()=>!!e.required);return()=>Pe()?Pie():null})(),null),O(oe,(()=>{var Pe=N(()=>!!e.optional);return()=>Pe()?Die():null})(),null),oe})():null})(),z),ce(z,"sl-show",async()=>{s(!0),e.onOpen&&await e.onOpen()}),ce(z,"sl-hide",async()=>{l()||(i.value="",e.onHide&&await e.onHide()),s(!1)});var ee=r;typeof ee=="function"?Re(ee,z):r=z,z.style.setProperty("width","100%"),z._$owner=fe(),ce(P,"sl-clear",()=>{d(void 0),c(-1),i.value="",p(""),$()}),ce(P,"sl-focus",re=>{e.onInputFocus?(e.onInputFocus(),re.stopImmediatePropagation()):(r.children[1].style.width=`${i.clientWidth}px`,u()>0&&k().scrollToIndex(u()))}),ce(P,"sl-input",re=>{o()||r.show(),p(re.target.value)});var L=i;typeof L=="function"?Re(L,P):i=P,P._$owner=fe(),O(D,()=>v(e.invalid??!1)),W._$owner=fe(),O(P,b(X,{get when(){return e.clearable},get children(){var re=Aie(),oe=re.firstChild;return ce(oe,"click",Ie=>{Ie.stopImmediatePropagation(),d(void 0),c(-1),i.value="",p(""),$(),r.hide()}),oe._$owner=fe(),J(()=>re.classList.toggle("hidden",!!(e.isLoading||l()==null))),re}}),H),ue._$owner=fe(),se.style.setProperty("width","518px");var le=a;typeof le=="function"?Re(le,G):a=G,G.style.setProperty("max-height","500px"),G.style.setProperty("min-height","37px"),G.style.setProperty("width","100%"),G.style.setProperty("display","flex"),G.style.setProperty("flex-direction","column"),G.style.setProperty("justify-content","start");var me=n;return typeof me=="function"?Re(me,F):n=F,F.style.setProperty("width","100%"),O(F,b(xt,{get each(){return k().getVirtualItems()},get fallback(){return b(Uie,{get noDataMsg(){return e.noDataMsg},get isLoading(){return e.isLoading}})},children:re=>{const oe=re.index>w().length-1,Ie=w()[re.index],Pe=l(),it=!oe&&!!Pe&&"id"in Pe&&"data"in Ie&&Pe.id===Ie.data.id;return b(Ac,{get children(){return[b(vn,{get when(){return"title"in Ie},get children(){return b(qie,{item:Ie})}}),b(vn,{get when(){return"data"in Ie},get children(){return b(Bie,{item:re,isLoader:oe,isSelected:it,get index(){return re.index},get hasMore(){return e.hasMore},get showOverflow(){return e.showOverflow},onClick:()=>{oe||(d(Ie.data),c(Ie.allItemsIdx),m(Ie.data),r.hide())},setLastIndex:f,get children(){return e.displayAccessor(Ie.data,!0)}})}})]}})}})),J(re=>{var oe=e.forceLabelSize&&!e.invalid?-20:e.invalid?-18:0,Ie=e.disabled??!1,Pe=e.placeholder??void 0,it=e.disabled??!1,Ke=!!(e.invalid??!1),ft=!!(e.disabled??!1),Ot=!l()&&i.value==="",de=e.required,Y=!!e.forceLabelSize,we=!e.isLoading,Ce=!!e.isLoading,et=o()?"chevron-up":"chevron-down",Ue=`${k().getTotalSize()}px`;return oe!==re.e&&(z.distance=re.e=oe),Ie!==re.t&&(z.disabled=re.t=Ie),Pe!==re.a&&(P.placeholder=re.a=Pe),it!==re.o&&(P.disabled=re.o=it),Ke!==re.i&&P.classList.toggle("invalid",re.i=Ke),ft!==re.n&&P.classList.toggle("disabled",re.n=ft),Ot!==re.s&&P.classList.toggle("placeholder",re.s=Ot),de!==re.h&&(P.required=re.h=de),Y!==re.r&&D.classList.toggle("h-[21px]",re.r=Y),we!==re.d&&j.classList.toggle("hidden",re.d=we),Ce!==re.l&&H.classList.toggle("hidden",re.l=Ce),et!==re.u&&(ue.name=re.u=et),Ue!==re.c&&((re.c=Ue)!=null?F.style.setProperty("height",Ue):F.style.removeProperty("height")),re},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0,u:void 0,c:void 0}),J(()=>P.value=e.searchText),C})()},Uie=e=>b(X,{get when(){return e.isLoading},get fallback(){return(()=>{var t=Nie();return t._$owner=fe(),O(t,()=>e.noDataMsg?e.noDataMsg:"No data found"),t})()},get children(){var t=Mie();return t._$owner=fe(),t}}),qie=e=>(()=>{var t=Lie();return t._$owner=fe(),O(t,()=>e.item.title),t})(),Bie=e=>(()=>{var t=Fie();return Re(r=>{e.isLoader&&e.index>0&&e.setLastIndex(r)},t),t.$$click=()=>e.onClick(),t.style.setProperty("width","100%"),t.style.setProperty("white-space","normal"),t._$owner=fe(),O(t,(()=>{var r=N(()=>!!e.isLoader);return()=>r()?N(()=>!!e.hasMore)()?Rie():zie():(()=>{var n=jie();return O(n,()=>e.children),J(i=>{var a=!e.showOverflow,o=!e.showOverflow,s=!e.showOverflow,l=!!e.showOverflow;return a!==i.e&&n.classList.toggle("overflow-hidden",i.e=a),o!==i.t&&n.classList.toggle("overflow-ellipsis",i.t=o),s!==i.a&&n.classList.toggle("whitespace-nowrap",i.a=s),l!==i.o&&n.classList.toggle("whitespace-normal",i.o=l),i},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()})()),J(r=>{var n=!!e.isSelected,i=`${e.item.size}px`;return n!==r.e&&t.classList.toggle("selected",r.e=n),i!==r.t&&((r.t=i)!=null?t.style.setProperty("min-height",i):t.style.removeProperty("min-height")),r},{e:void 0,t:void 0}),t})();to(["click"]);var Hie=K("<strong class=font-extrabold>"),Wie=K("<div><p>"),ky=K('<p class="text-xs text-red-500 mt-1 italic">'),Qie=K("<div><div></div><div> <!>, <!> <!> supply, <!> <!>, "),Gie=K("<span class=text-blue-600>(<!>): "),Yie=K("<div>");function Kie(e){return!e||e.length===0?{}:e.reduce((t,r)=>{if(!r.treatmentIds)return t;for(const n of r.treatmentIds)t[n]=r.reason;return t},{})}function Rv(e,t){return e?e in t?{disabled:!0,disableReason:t[e]}:{disabled:!1}:{disabled:!1}}function Ap(e,t,r){const n=new CustomEvent(t,{composed:!0,bubbles:!0,detail:r});e?.dispatchEvent(n)}function Zie(e,t,r){Ap(e,"photon-treatment-selected",{data:t,catalogId:r})}function Xie(e){Ap(e,"photon-treatment-unselected")}function mn(e,t){Ap(e,"photon-search-text-changed",{text:t})}const Jie=_e`
4381
4381
  query SearchTreatments($filter: TreatmentFilter!) {
4382
4382
  treatments(filter: $filter) {
4383
4383
  __typename
package/dist/index.mjs CHANGED
@@ -37328,7 +37328,7 @@ function dH(e) {
37328
37328
  get onClick() {
37329
37329
  return e?.editPatient;
37330
37330
  },
37331
- children: "Edit Patient"
37331
+ children: "Edit patient"
37332
37332
  });
37333
37333
  }
37334
37334
  }), null), s;
@@ -41380,7 +41380,7 @@ const J6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41380
41380
  function Ch(e, t) {
41381
41381
  return e.every((r) => t.includes(r));
41382
41382
  }
41383
- const NQ = "0.17.4", LQ = {
41383
+ const NQ = "0.17.5", LQ = {
41384
41384
  version: NQ
41385
41385
  };
41386
41386
  var FQ = /* @__PURE__ */ K("<slot>"), RQ = /* @__PURE__ */ K("<div>");
@@ -59930,7 +59930,7 @@ const lie = (e) => {
59930
59930
  m(), c().resetStores(), e.open = !1;
59931
59931
  },
59932
59932
  get title() {
59933
- return e?.patientId ? "Update patient" : "New patient";
59933
+ return e?.patientId ? "Edit patient" : "New patient";
59934
59934
  },
59935
59935
  get titleIconName() {
59936
59936
  return e?.patientId ? "pencil-square" : "person-plus";
@@ -59952,7 +59952,7 @@ const lie = (e) => {
59952
59952
  },
59953
59953
  onClick: () => $(s(), c(), d(), !0),
59954
59954
  get children() {
59955
- return [N(() => e?.patientId ? "Update" : "Create"), " and start prescription"];
59955
+ return [N(() => e?.patientId ? "Save" : "Create"), " and start prescription"];
59956
59956
  }
59957
59957
  });
59958
59958
  }
@@ -59970,7 +59970,7 @@ const lie = (e) => {
59970
59970
  },
59971
59971
  onClick: () => $(s(), c(), d(), !1),
59972
59972
  get children() {
59973
- return [N(() => e?.patientId ? "Update" : "Create"), " patient"];
59973
+ return e?.patientId ? "Save" : "Create";
59974
59974
  }
59975
59975
  })];
59976
59976
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photonhealth/elements",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",