@photonhealth/elements 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -359,6 +359,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
359
359
  $fills: [FillInput!]!
360
360
  $address: AddressInput!
361
361
  $pharmacyId: ID!
362
+ $groupId: ID
362
363
  ) {
363
364
  createOrder(
364
365
  externalId: $externalId
@@ -366,6 +367,7 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
366
367
  fills: $fills
367
368
  address: $address
368
369
  pharmacyId: $pharmacyId
370
+ groupId: $groupId
369
371
  ) {
370
372
  ...${r}
371
373
  }
@@ -1471,7 +1473,7 @@ Description:
1471
1473
  }
1472
1474
  }
1473
1475
  }
1474
- `,$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 Er(()=>clearInterval(n))},B6="%[a-f0-9]{2}",bg=new RegExp("("+B6+")|([^%]+?)","gi"),$g=new RegExp("("+B6+")+","gi");function Ch(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([],Ch(r),Ch(n))}function kQ(e){try{return decodeURIComponent(e)}catch{let t=e.match(bg)||[];for(let r=1;r<t.length;r++)e=Ch(t,r).join(""),t=e.match(bg)||[];return e}}function _Q(e){const t={"%FE%FF":"��","%FF%FE":"��"};let r=$g.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=$g.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()}`),Sh=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 wg(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 Jf(e){e=G6(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function ep(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]=wg(s,t,l)}else typeof a=="object"&&a!==null&&t.types[i]==="string"?n[i]=Object.values(a).join(t.arrayFormatSeparator):n[i]=wg(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 K6(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 Y6(e,t){t={decode:!0,...t};let[r,n]=H6(e,"#");return r===void 0&&(r=e),{url:r?.split("?")?.[0]??"",query:ep(Jf(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:mi(n,t)}:{}}}function Z6(e,t){t={encode:!0,strict:!0,[Sh]:!0,...t};const r=G6(e.url).split("?")[0]||"",n=Jf(e.url),i={...ep(n,{sort:!1}),...e.query};let a=K6(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[Sh]?s.hash:`#${e.fragmentIdentifier}`}return`${r}${a}${o}`}function X6(e,t,r){r={parseFragmentIdentifier:!0,[Sh]:!1,...r};const{url:n,query:i,fragmentIdentifier:a}=Y6(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:Jf,parse:ep,parseUrl:Y6,pick:X6,stringify:K6,stringifyUrl:Z6},Symbol.toStringTag,{value:"Module"})),MQ=(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)},DQ=e=>/^\d+$/.test(e)&&e.length>=5;function Eh(e,t){return e.every(r=>t.includes(r))}const NQ="0.17.0",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(()=>{MQ()&&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,A(d,b(q6.Provider,{get value(){return o()},get children(){return b(eB,{get children(){return b(MR,{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(59 130 246 / .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(59 130 246 / .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}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.left-0{left:0}.left-4{left:1rem}.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}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-2\\/5{width:40%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.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-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-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.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(59,130,246,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-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-28{padding-top:7rem}.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(37,99,235,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(29,78,216,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\\:min-w-\\[40\\%\\]{min-width:40%}.xs\\:min-w-\\[48\\%\\]{min-width:48%}.xs\\:flex-row{flex-direction:row}.xs\\:gap-4{gap:1rem}.xs\\:pb-2{padding-bottom:.5rem}.xs\\:pt-28{padding-top:7rem}.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\\:py-2{padding-top:.5rem;padding-bottom:.5rem}}@media (min-width: 768px){.md\\:static{position:static}.md\\:mb-0{margin-bottom:0}.md\\:flex{display:flex}.md\\:flex-1{flex:1 1 0%}.md\\:flex-row{flex-direction:row}.md\\:justify-center{justify-content:center}.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}}@media (min-width: 1024px){.lg\\:gap-2{gap:.5rem}.lg\\:pt-20{padding-top:5rem}}';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 A(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)},A(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 A(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()&&Er(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 Er(()=>clearInterval(n))},B6="%[a-f0-9]{2}",bg=new RegExp("("+B6+")|([^%]+?)","gi"),$g=new RegExp("("+B6+")+","gi");function Ch(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([],Ch(r),Ch(n))}function kQ(e){try{return decodeURIComponent(e)}catch{let t=e.match(bg)||[];for(let r=1;r<t.length;r++)e=Ch(t,r).join(""),t=e.match(bg)||[];return e}}function _Q(e){const t={"%FE%FF":"��","%FF%FE":"��"};let r=$g.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=$g.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()}`),Sh=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 wg(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 Jf(e){e=G6(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function ep(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]=wg(s,t,l)}else typeof a=="object"&&a!==null&&t.types[i]==="string"?n[i]=Object.values(a).join(t.arrayFormatSeparator):n[i]=wg(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 K6(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 Y6(e,t){t={decode:!0,...t};let[r,n]=H6(e,"#");return r===void 0&&(r=e),{url:r?.split("?")?.[0]??"",query:ep(Jf(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:mi(n,t)}:{}}}function Z6(e,t){t={encode:!0,strict:!0,[Sh]:!0,...t};const r=G6(e.url).split("?")[0]||"",n=Jf(e.url),i={...ep(n,{sort:!1}),...e.query};let a=K6(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[Sh]?s.hash:`#${e.fragmentIdentifier}`}return`${r}${a}${o}`}function X6(e,t,r){r={parseFragmentIdentifier:!0,[Sh]:!1,...r};const{url:n,query:i,fragmentIdentifier:a}=Y6(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:Jf,parse:ep,parseUrl:Y6,pick:X6,stringify:K6,stringifyUrl:Z6},Symbol.toStringTag,{value:"Module"})),MQ=(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)},DQ=e=>/^\d+$/.test(e)&&e.length>=5;function Eh(e,t){return e.every(r=>t.includes(r))}const NQ="0.17.1",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(()=>{MQ()&&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,A(d,b(q6.Provider,{get value(){return o()},get children(){return b(eB,{get children(){return b(MR,{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(59 130 246 / .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(59 130 246 / .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}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.left-0{left:0}.left-4{left:1rem}.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}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-2\\/5{width:40%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.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-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-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.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(59,130,246,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-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-28{padding-top:7rem}.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(37,99,235,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(29,78,216,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\\:min-w-\\[40\\%\\]{min-width:40%}.xs\\:min-w-\\[48\\%\\]{min-width:48%}.xs\\:flex-row{flex-direction:row}.xs\\:gap-4{gap:1rem}.xs\\:pb-2{padding-bottom:.5rem}.xs\\:pt-28{padding-top:7rem}.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\\:py-2{padding-top:.5rem;padding-bottom:.5rem}}@media (min-width: 768px){.md\\:static{position:static}.md\\:mb-0{margin-bottom:0}.md\\:flex{display:flex}.md\\:flex-1{flex:1 1 0%}.md\\:flex-row{flex-direction:row}.md\\:justify-center{justify-content:center}.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}}@media (min-width: 1024px){.lg\\:gap-2{gap:.5rem}.lg\\:pt-20{padding-top:5rem}}';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 A(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)},A(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 A(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()&&Er(n),Object.assign((...a)=>{r!==void 0&&n(),r=setTimeout(()=>e(...a),t)},{clear:n})};/**
1475
1477
  * @license
1476
1478
  * Copyright 2019 Google LLC
1477
1479
  * SPDX-License-Identifier: BSD-3-Clause
@@ -3762,7 +3764,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3762
3764
  }
3763
3765
  `;function FJ(e){let t;const{draftPrescriptions:r}=pd(),{routingConstraints:n,combinedRoutingConstraint:i,tryUpdatePrescriptionStates:a,isLoadingPrefills:o,orderFormData:s}=oo(),l=D(()=>r().map(de=>de.id)),d=D(()=>{if(e.pharmacyId)return e.pharmacyId;if(i()?.routing_constraint_type==="include"&&i()?.constraint_pharmacies?.length===1)return i().constraint_pharmacies?.[0].id}),u=Jr(),[c,h]=B(!e.templateIds&&!e.prescriptionIds),[f,p]=B([]),[g,v]=B(!0),[m,w]=B(!1),[$,k]=B(u?.authentication.state.isAuthenticated||!1),[,C]=Ps(),[S,M]=B([]),[O,V]=B(!1),[F,T]=B(!1);let L="";e.additionalNotes&&(L=`${e.additionalNotes}
3764
3766
 
3765
- `),e.weight&&(L=`${L}${TJ(e.weight,e?.weightUnit)}`),St(()=>{e.address&&e.formActions.updateFormValue({key:"address",value:e.address}),t.addEventListener("photon-ticket-created-duplicate",()=>{Au(e.formActions,L?{notes:L}:void 0)})}),pe(()=>{!u?.authentication.state.isAuthenticated&&!u?.authentication.state.isLoading&&!u?.authentication.state.error&&u?.autoLogin&&u?.authentication.login({appState:{returnTo:window.location.pathname}})}),pe(()=>{v(u?.authentication.state.isLoading||!1)}),pe(()=>{k(u?.authentication.state.isAuthenticated||!1)});const R=D(()=>Eh(["write:prescription"],u?.authentication.state.permissions||[])),G=D(()=>{const de=e.formStore?.address?.value??e.formStore?.patient?.value?.address??{},{__typename:Y,name:we,...Ce}=de;return{street2:"",country:"US",...Ce}}),W=de=>{const Y=new CustomEvent("photon-prescriptions-created",{composed:!0,bubbles:!0,detail:{prescriptions:de}});t?.dispatchEvent(Y)},ue=de=>{const Y=new CustomEvent("photon-draft-prescription-created",{composed:!0,bubbles:!0,detail:{draft:de}});t?.dispatchEvent(Y)},se=de=>{const Y=new CustomEvent("photon-order-created",{composed:!0,bubbles:!0,detail:{order:de}});t?.dispatchEvent(Y)},Q=de=>{const Y=new Set;return de.filter(we=>{const Ce=we.treatment.id;return Y.has(Ce)?!1:(Y.add(Ce),!0)})},j=async()=>{const de=e.formStore.treatment?.value?.id,Y=r().map(RJ);de&&Y.push({treatment:{id:de}});const we=Q(Y),{data:Ce}=await it.query({query:LJ,variables:{patientId:e.formStore.patient?.value.id,draftedPrescriptions:we}});M(Ce?.prescriptionScreen?.alerts??[])};pe(()=>{r().length>0&&j()});const Z=de=>{const Y=new CustomEvent("photon-prescriptions-error",{composed:!0,bubbles:!0,detail:{errors:de}});t?.dispatchEvent(Y)},ee=(de=[])=>{const Y=new CustomEvent("photon-order-error",{composed:!0,bubbles:!0,detail:{errors:de}});t?.dispatchEvent(Y)},N=de=>{const Y=new CustomEvent("photon-form-validate",{composed:!0,bubbles:!0,detail:{canSubmit:de,form:e.formStore,actions:e.formActions}});t?.dispatchEvent(Y)},le=()=>{T(!0)},me=()=>C.setIsCombineDialogOpen(!0,()=>re(e.enableOrder),G()),re=async de=>{if(g())return;if(p([]),V(!1),!R())return ir({status:"error",header:"Unauthorized",body:"You do not have permission to prescribe"});const Y=de?["patient","address"]:["patient"];e.formActions.validate(Y);const we=e.formActions.getErrors(Y);we.length===0?(v(!0),e.formActions.updateFormValue({key:"errors",value:[]}),e.enableOrder?await Ie():await oe(),W(r())):p(we)},oe=async()=>{try{await a(l(),ry.Active)}catch(de){Z([de])}v(!1)},Ie=async()=>{const de=u.getSDK().clinical.order.createOrder({}),Y=u.getSDK().clinical.patient.removePatientPreferredPharmacy({}),we=u.getSDK().clinical.patient.updatePatient({});try{if(e.formStore.updatePreferredPharmacy?.value&&s.pharmacyId&&e.formStore.fulfillmentType?.value==="PICK_UP"){const Ge=e.formStore.patient?.value;Ge?.preferredPharmacies&&Ge?.preferredPharmacies?.length>0&&Y({variables:{patientId:Ge.id,pharmacyId:Ge.preferredPharmacies[0].id},awaitRefetchQueries:!1}),we({variables:{id:Ge.id,preferredPharmacies:[s.pharmacyId]},awaitRefetchQueries:!1})}let Ce=d();s.pharmacyId&&(Ce=s.pharmacyId),Ce||(Ce="");const{data:et,errors:Ue}=await de({variables:{...e.externalOrderId?{externalId:e.externalOrderId}:{},patientId:e.formStore.patient?.value.id,pharmacyId:Ce,fulfillmentType:e.formStore.fulfillmentType?.value||"",address:G(),fills:l().map(Ge=>({prescriptionId:Ge}))},refetchQueries:[],awaitRefetchQueries:!1});if(v(!1),Ue){ee(Ue);return}se(et.createOrder)}catch(Ce){ee([Ce]),v(!1),ir({status:"error",header:"Error Creating Order",body:Ce?.message})}},Pe=()=>S().length>0&&O()===!1?le():e.enableCombineAndDuplicate&&C.hasRoutingOrder()?me():re(e.enableOrder);pe(()=>{e.triggerSubmit&&Fe(()=>Pe())}),pe(()=>{N(!!(r().length>0&&e.formStore.patient?.value))});const it=u.sdk.apolloClinical;let Ye;const ft=D(()=>!e.patientId||e.patientId===e.formStore.patient?.value?.id||e.patientId===e.formStore.patient?.value?.externalId),Ot=de=>{ue(de),m()&&w(!1)};return(()=>{var de=DJ(),Y=de.firstChild,we=Y.nextSibling,Ce=we.nextSibling,et=Ce.nextSibling,Ue=et.nextSibling,Ge=Ue.nextSibling,tt=Ge.firstChild,Gt=t;return typeof Gt=="function"?Re(Gt,de):t=de,A(Y,Rt),A(we,qr),A(Ce,Br),A(et,EJ),A(Ue,oi),A(de,b(X,{get when(){return D(()=>!!(F()&&S().length>0))()&&!O()},get children(){return b(AB,{get alerts(){return S()},get isOpen(){return F()},onIgnoreWarningAndCreateAnyway:()=>{v(!1),V(!0),T(!1);const Ke=new CustomEvent("photon-clinical-alert-acknowledge",{composed:!0,bubbles:!0,detail:{alerts:S()}});Pe(),t?.dispatchEvent(Ke)},onRevisitPrescriptions:()=>{v(!1),T(!1);const Ke=new CustomEvent("photon-clinical-alert-cancel",{composed:!0,bubbles:!0,detail:{alerts:S()}});t?.dispatchEvent(Ke)}})}}),Ge),A(de,b(X,{get when(){return e.enableCombineAndDuplicate},get children(){return[b(vi.DuplicateDialog,{}),b(vi.CombineDialog,{}),b(vi.IssueDialog,{})]}}),Ge),A(Ge,b(rQ,{get buffer(){return e?.toastBuffer||0}}),tt),A(tt,b(X,{get when(){return D(()=>!!(!u||g()))()&&!$()},get children(){var Ke=OJ();return A(Ke,b(ni,{color:"green"})),Ke}}),null),A(tt,b(F8,{permissions:["read:patient"],get children(){return b(pQ,{client:it,get children(){return[b(X,{get when(){return!R()},get children(){return b(B2,{type:"warning",header:"You do not have permission to prescribe",message:"You have access to see the form but you will not be able to submit an order."})}}),b(xJ,{get actions(){return e.formActions},get store(){return e.formStore},get patientId(){return e.patientId},client:u,get enableOrder(){return e.enableOrder},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks??!1},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton??!1},get hidePatientCard(){return e.hidePatientCard}}),b(X,{get when(){return ft()&&(e.formStore.patient?.value?.address||e.formStore.patient?.value?.id&&!e.enableOrder)},get children(){return[b(X,{get when(){return e.enableCombineAndDuplicate},get children(){return b(vi.Card,{})}}),b(X,{get when(){return c()||m()},get children(){var Ke=IJ(),Pr=Ye;return typeof Pr=="function"?Re(Pr,Ke):Ye=Ke,A(Ke,b(aJ,{get hideAddToTemplates(){return e.hideTemplates},get actions(){return e.formActions},get store(){return e.formStore},get weight(){return e.weight},get weightUnit(){return e.weightUnit},prefillNotes:L,get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},screenDraftedPrescriptions:function(){j()},draftedPrescriptionChanged:function(){j()},onDraftPrescriptionCreated:Ot,get screeningAlerts(){return S()},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch},get enableOrder(){return e.enableOrder},get disableList(){return e.disableList}})),Ke}}),b(uJ,{prescriptionRef:Ye,get actions(){return e.formActions},get store(){return e.formStore},setIsEditing:w,handleDraftPrescriptionsChange:function(){j()},get screeningAlerts(){return S()},get routingConstraints(){return n()},get enableOrder(){return e.enableOrder}}),b(X,{get when(){return D(()=>!!e.enableOrder)()&&!d()},get children(){return b(pJ,{get store(){return e.formStore},get actions(){return e.formActions},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get mailOrderIds(){return e.mailOrderIds}})}}),b(X,{get when(){return D(()=>!!e.enableOrder)()&&d()},get children(){return b(SJ,{get pharmacyId(){return d()}})}}),b(X,{get when(){return!e.hideSubmit},get children(){return[b(X,{get when(){return f().length>0&&e.enableOrder},get children(){var Ke=PJ();return A(Ke,b(xt,{get each(){return f()},get fallback(){return NJ()},children:({key:Pr,error:zs})=>b(B2,{type:"warning",header:`Error with ${Pr}`,message:zs})})),Ke}}),(()=>{var Ke=MJ();return A(Ke,b(X,{get when(){return!c()},get children(){return b(st,{variant:"secondary",onClick:()=>h(!0),children:"Add Prescription"})}}),null),A(Ke,b(st,{get loading(){return o()||g()},onClick:Pe,get children(){return e.enableOrder?"Send Order":"Save Prescriptions"}}),null),Ke})()]}})]}})]}})}}),null),de})()}const RJ=e=>({dispenseAsWritten:e.dispenseAsWritten||void 0,dispenseQuantity:e.dispenseQuantity,dispenseUnit:e.dispenseUnit,fillsAllowed:e.fillsAllowed,daysSupply:e.daysSupply||void 0,instructions:e.instructions,notes:e.notes||void 0,effectiveDate:e.effectiveDate,treatment:{id:e.treatment.id}}),zJ=e=>{const{actions:t}=_d,{store:r,actions:n}=D8({dispenseAsWritten:!1,patient:void 0,treatment:void 0,pharmacy:void 0,errors:[],address:void 0});return Er(()=>{t.clearSelectedPatient(),n.reset()}),b(gj,{get children(){return b(vi,{get patientId(){return r.patient?.value?.id},get children(){return b(tB,{get templateIdsPrefill(){return e.templateIds?.split(",").map(i=>i.trim())||[]},get templateOverrides(){return e.templateOverrides||{}},get prescriptionIdsPrefill(){return e.prescriptionIds?.split(",").map(i=>i.trim())||[]},get patientId(){return r.patient?.value?.id},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get children(){return b(FJ,{get patientId(){return e.patientId},get templateIds(){return e.templateIds},get templateOverrides(){return e.templateOverrides},get prescriptionIds(){return e.prescriptionIds},get hideSubmit(){return e.hideSubmit},get hideTemplates(){return e.hideTemplates},get hidePatientCard(){return e.hidePatientCard},get enableOrder(){return e.enableOrder},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get mailOrderIds(){return e.mailOrderIds},get pharmacyId(){return e.pharmacyId},get loading(){return e.loading},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get additionalNotes(){return e.additionalNotes},get triggerSubmit(){return e.triggerSubmit},get toastBuffer(){return e.toastBuffer},formStore:r,formActions:n,get externalOrderId(){return e.externalOrderId},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch},get disableList(){return e.disableList}})}})}})}})};Et("photon-prescribe-workflow",{patientId:void 0,templateIds:void 0,templateOverrides:void 0,prescriptionIds:void 0,hideSubmit:!1,hideTemplates:!1,hidePatientCard:!1,enableOrder:!1,enableLocalPickup:!1,enableSendToPatient:!1,enableDeliveryPharmacies:!0,enableCombineAndDuplicate:!1,enableMedHistory:!1,enableMedHistoryRefillButton:!1,enableMedHistoryLinks:!1,mailOrderIds:void 0,pharmacyId:void 0,loading:!1,address:void 0,weight:void 0,weightUnit:"lbs",additionalNotes:void 0,triggerSubmit:!1,setTriggerSubmit:void 0,toastBuffer:0,externalOrderId:void 0,catalogId:void 0,allowOffCatalogSearch:!0,enableCoverageCheck:!1,disableList:void 0},zJ);var jJ=K('<p class="font-sans text-l font-medium mb-2">'),VJ=K("<sl-icon-button class=self-start>",!0,!1,!1),UJ=K("<style>"),qJ=K('<div class="rounded-lg bg-white p-4 shadow-card border border-gray-200">'),BJ=K('<div class="flex flex-row justify-between">'),HJ=K("<slot>");const WJ=e=>{const[t,r]=B(!0);let n=null,i=null;return e.title&&(n=(()=>{var a=jJ();return A(a,()=>e.title),a})()),e.collapsable&&(i=(()=>{var a=VJ();return ce(a,"click",()=>{r(!t())}),a._$owner=fe(),J(()=>a.name=t()?"chevron-right":"chevron-down"),a})()),[(()=>{var a=UJ();return A(a,Rt),a})(),(()=>{var a=qJ();return A(a,n||i?(()=>{var o=BJ();return A(o,n,null),A(o,i,null),o})():null,null),A(a,(()=>{var o=D(()=>!!(e.collapsable&&t()));return()=>o()?null:(()=>{var s=HJ();return s._$owner=fe(),s})()})(),null),J(o=>{var s=!!e.invalid,l=!!e.invalid;return s!==o.e&&a.classList.toggle("border-red-400",o.e=s),l!==o.t&&a.classList.toggle("border-2",o.t=l),o},{e:void 0,t:void 0}),a})()]};Et("photon-card",{invalid:!1,title:null,collapsable:!1},WJ);const QJ=_e`
3767
+ `),e.weight&&(L=`${L}${TJ(e.weight,e?.weightUnit)}`),St(()=>{e.address&&e.formActions.updateFormValue({key:"address",value:e.address}),t.addEventListener("photon-ticket-created-duplicate",()=>{Au(e.formActions,L?{notes:L}:void 0)})}),pe(()=>{!u?.authentication.state.isAuthenticated&&!u?.authentication.state.isLoading&&!u?.authentication.state.error&&u?.autoLogin&&u?.authentication.login({appState:{returnTo:window.location.pathname}})}),pe(()=>{v(u?.authentication.state.isLoading||!1)}),pe(()=>{k(u?.authentication.state.isAuthenticated||!1)});const R=D(()=>Eh(["write:prescription"],u?.authentication.state.permissions||[])),G=D(()=>{const de=e.formStore?.address?.value??e.formStore?.patient?.value?.address??{},{__typename:Y,name:we,...Ce}=de;return{street2:"",country:"US",...Ce}}),W=de=>{const Y=new CustomEvent("photon-prescriptions-created",{composed:!0,bubbles:!0,detail:{prescriptions:de}});t?.dispatchEvent(Y)},ue=de=>{const Y=new CustomEvent("photon-draft-prescription-created",{composed:!0,bubbles:!0,detail:{draft:de}});t?.dispatchEvent(Y)},se=de=>{const Y=new CustomEvent("photon-order-created",{composed:!0,bubbles:!0,detail:{order:de}});t?.dispatchEvent(Y)},Q=de=>{const Y=new Set;return de.filter(we=>{const Ce=we.treatment.id;return Y.has(Ce)?!1:(Y.add(Ce),!0)})},j=async()=>{const de=e.formStore.treatment?.value?.id,Y=r().map(RJ);de&&Y.push({treatment:{id:de}});const we=Q(Y),{data:Ce}=await it.query({query:LJ,variables:{patientId:e.formStore.patient?.value.id,draftedPrescriptions:we}});M(Ce?.prescriptionScreen?.alerts??[])};pe(()=>{r().length>0&&j()});const Z=de=>{const Y=new CustomEvent("photon-prescriptions-error",{composed:!0,bubbles:!0,detail:{errors:de}});t?.dispatchEvent(Y)},ee=(de=[])=>{const Y=new CustomEvent("photon-order-error",{composed:!0,bubbles:!0,detail:{errors:de}});t?.dispatchEvent(Y)},N=de=>{const Y=new CustomEvent("photon-form-validate",{composed:!0,bubbles:!0,detail:{canSubmit:de,form:e.formStore,actions:e.formActions}});t?.dispatchEvent(Y)},le=()=>{T(!0)},me=()=>C.setIsCombineDialogOpen(!0,()=>re(e.enableOrder),G()),re=async de=>{if(g())return;if(p([]),V(!1),!R())return ir({status:"error",header:"Unauthorized",body:"You do not have permission to prescribe"});const Y=de?["patient","address"]:["patient"];e.formActions.validate(Y);const we=e.formActions.getErrors(Y);we.length===0?(v(!0),e.formActions.updateFormValue({key:"errors",value:[]}),e.enableOrder?await Ie():await oe(),W(r())):p(we)},oe=async()=>{try{await a(l(),ry.Active)}catch(de){Z([de])}v(!1)},Ie=async()=>{const de=u.getSDK().clinical.order.createOrder({}),Y=u.getSDK().clinical.patient.removePatientPreferredPharmacy({}),we=u.getSDK().clinical.patient.updatePatient({});try{if(e.formStore.updatePreferredPharmacy?.value&&s.pharmacyId&&e.formStore.fulfillmentType?.value==="PICK_UP"){const Ge=e.formStore.patient?.value;Ge?.preferredPharmacies&&Ge?.preferredPharmacies?.length>0&&Y({variables:{patientId:Ge.id,pharmacyId:Ge.preferredPharmacies[0].id},awaitRefetchQueries:!1}),we({variables:{id:Ge.id,preferredPharmacies:[s.pharmacyId]},awaitRefetchQueries:!1})}let Ce=d();s.pharmacyId&&(Ce=s.pharmacyId),Ce||(Ce="");const{data:et,errors:Ue}=await de({variables:{...e.externalOrderId?{externalId:e.externalOrderId}:{},...e.groupId?{groupId:e.groupId}:{},patientId:e.formStore.patient?.value.id,pharmacyId:Ce,fulfillmentType:e.formStore.fulfillmentType?.value||"",address:G(),fills:l().map(Ge=>({prescriptionId:Ge}))},refetchQueries:[],awaitRefetchQueries:!1});if(v(!1),Ue){ee(Ue);return}se(et.createOrder)}catch(Ce){ee([Ce]),v(!1),ir({status:"error",header:"Error Creating Order",body:Ce?.message})}},Pe=()=>S().length>0&&O()===!1?le():e.enableCombineAndDuplicate&&C.hasRoutingOrder()?me():re(e.enableOrder);pe(()=>{e.triggerSubmit&&Fe(()=>Pe())}),pe(()=>{N(!!(r().length>0&&e.formStore.patient?.value))});const it=u.sdk.apolloClinical;let Ye;const ft=D(()=>!e.patientId||e.patientId===e.formStore.patient?.value?.id||e.patientId===e.formStore.patient?.value?.externalId),Ot=de=>{ue(de),m()&&w(!1)};return(()=>{var de=DJ(),Y=de.firstChild,we=Y.nextSibling,Ce=we.nextSibling,et=Ce.nextSibling,Ue=et.nextSibling,Ge=Ue.nextSibling,tt=Ge.firstChild,Gt=t;return typeof Gt=="function"?Re(Gt,de):t=de,A(Y,Rt),A(we,qr),A(Ce,Br),A(et,EJ),A(Ue,oi),A(de,b(X,{get when(){return D(()=>!!(F()&&S().length>0))()&&!O()},get children(){return b(AB,{get alerts(){return S()},get isOpen(){return F()},onIgnoreWarningAndCreateAnyway:()=>{v(!1),V(!0),T(!1);const Ke=new CustomEvent("photon-clinical-alert-acknowledge",{composed:!0,bubbles:!0,detail:{alerts:S()}});Pe(),t?.dispatchEvent(Ke)},onRevisitPrescriptions:()=>{v(!1),T(!1);const Ke=new CustomEvent("photon-clinical-alert-cancel",{composed:!0,bubbles:!0,detail:{alerts:S()}});t?.dispatchEvent(Ke)}})}}),Ge),A(de,b(X,{get when(){return e.enableCombineAndDuplicate},get children(){return[b(vi.DuplicateDialog,{}),b(vi.CombineDialog,{}),b(vi.IssueDialog,{})]}}),Ge),A(Ge,b(rQ,{get buffer(){return e?.toastBuffer||0}}),tt),A(tt,b(X,{get when(){return D(()=>!!(!u||g()))()&&!$()},get children(){var Ke=OJ();return A(Ke,b(ni,{color:"green"})),Ke}}),null),A(tt,b(F8,{permissions:["read:patient"],get children(){return b(pQ,{client:it,get children(){return[b(X,{get when(){return!R()},get children(){return b(B2,{type:"warning",header:"You do not have permission to prescribe",message:"You have access to see the form but you will not be able to submit an order."})}}),b(xJ,{get actions(){return e.formActions},get store(){return e.formStore},get patientId(){return e.patientId},client:u,get enableOrder(){return e.enableOrder},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks??!1},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton??!1},get hidePatientCard(){return e.hidePatientCard}}),b(X,{get when(){return ft()&&(e.formStore.patient?.value?.address||e.formStore.patient?.value?.id&&!e.enableOrder)},get children(){return[b(X,{get when(){return e.enableCombineAndDuplicate},get children(){return b(vi.Card,{})}}),b(X,{get when(){return c()||m()},get children(){var Ke=IJ(),Pr=Ye;return typeof Pr=="function"?Re(Pr,Ke):Ye=Ke,A(Ke,b(aJ,{get hideAddToTemplates(){return e.hideTemplates},get actions(){return e.formActions},get store(){return e.formStore},get weight(){return e.weight},get weightUnit(){return e.weightUnit},prefillNotes:L,get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},screenDraftedPrescriptions:function(){j()},draftedPrescriptionChanged:function(){j()},onDraftPrescriptionCreated:Ot,get screeningAlerts(){return S()},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch},get enableOrder(){return e.enableOrder},get disableList(){return e.disableList}})),Ke}}),b(uJ,{prescriptionRef:Ye,get actions(){return e.formActions},get store(){return e.formStore},setIsEditing:w,handleDraftPrescriptionsChange:function(){j()},get screeningAlerts(){return S()},get routingConstraints(){return n()},get enableOrder(){return e.enableOrder}}),b(X,{get when(){return D(()=>!!e.enableOrder)()&&!d()},get children(){return b(pJ,{get store(){return e.formStore},get actions(){return e.formActions},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get mailOrderIds(){return e.mailOrderIds}})}}),b(X,{get when(){return D(()=>!!e.enableOrder)()&&d()},get children(){return b(SJ,{get pharmacyId(){return d()}})}}),b(X,{get when(){return!e.hideSubmit},get children(){return[b(X,{get when(){return f().length>0&&e.enableOrder},get children(){var Ke=PJ();return A(Ke,b(xt,{get each(){return f()},get fallback(){return NJ()},children:({key:Pr,error:zs})=>b(B2,{type:"warning",header:`Error with ${Pr}`,message:zs})})),Ke}}),(()=>{var Ke=MJ();return A(Ke,b(X,{get when(){return!c()},get children(){return b(st,{variant:"secondary",onClick:()=>h(!0),children:"Add Prescription"})}}),null),A(Ke,b(st,{get loading(){return o()||g()},onClick:Pe,get children(){return e.enableOrder?"Send Order":"Save Prescriptions"}}),null),Ke})()]}})]}})]}})}}),null),de})()}const RJ=e=>({dispenseAsWritten:e.dispenseAsWritten||void 0,dispenseQuantity:e.dispenseQuantity,dispenseUnit:e.dispenseUnit,fillsAllowed:e.fillsAllowed,daysSupply:e.daysSupply||void 0,instructions:e.instructions,notes:e.notes||void 0,effectiveDate:e.effectiveDate,treatment:{id:e.treatment.id}}),zJ=e=>{const{actions:t}=_d,{store:r,actions:n}=D8({dispenseAsWritten:!1,patient:void 0,treatment:void 0,pharmacy:void 0,errors:[],address:void 0});return Er(()=>{t.clearSelectedPatient(),n.reset()}),b(gj,{get children(){return b(vi,{get patientId(){return r.patient?.value?.id},get children(){return b(tB,{get templateIdsPrefill(){return e.templateIds?.split(",").map(i=>i.trim())||[]},get templateOverrides(){return e.templateOverrides||{}},get prescriptionIdsPrefill(){return e.prescriptionIds?.split(",").map(i=>i.trim())||[]},get patientId(){return r.patient?.value?.id},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get children(){return b(FJ,{get patientId(){return e.patientId},get templateIds(){return e.templateIds},get templateOverrides(){return e.templateOverrides},get prescriptionIds(){return e.prescriptionIds},get hideSubmit(){return e.hideSubmit},get hideTemplates(){return e.hideTemplates},get hidePatientCard(){return e.hidePatientCard},get enableOrder(){return e.enableOrder},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get mailOrderIds(){return e.mailOrderIds},get pharmacyId(){return e.pharmacyId},get loading(){return e.loading},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get additionalNotes(){return e.additionalNotes},get triggerSubmit(){return e.triggerSubmit},get toastBuffer(){return e.toastBuffer},formStore:r,formActions:n,get externalOrderId(){return e.externalOrderId},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch},get disableList(){return e.disableList},get groupId(){return e.groupId}})}})}})}})};Et("photon-prescribe-workflow",{patientId:void 0,templateIds:void 0,templateOverrides:void 0,prescriptionIds:void 0,hideSubmit:!1,hideTemplates:!1,hidePatientCard:!1,enableOrder:!1,enableLocalPickup:!1,enableSendToPatient:!1,enableDeliveryPharmacies:!0,enableCombineAndDuplicate:!1,enableMedHistory:!1,enableMedHistoryRefillButton:!1,enableMedHistoryLinks:!1,mailOrderIds:void 0,pharmacyId:void 0,loading:!1,address:void 0,weight:void 0,weightUnit:"lbs",additionalNotes:void 0,triggerSubmit:!1,setTriggerSubmit:void 0,toastBuffer:0,externalOrderId:void 0,catalogId:void 0,allowOffCatalogSearch:!0,enableCoverageCheck:!1,disableList:void 0,groupId:void 0},zJ);var jJ=K('<p class="font-sans text-l font-medium mb-2">'),VJ=K("<sl-icon-button class=self-start>",!0,!1,!1),UJ=K("<style>"),qJ=K('<div class="rounded-lg bg-white p-4 shadow-card border border-gray-200">'),BJ=K('<div class="flex flex-row justify-between">'),HJ=K("<slot>");const WJ=e=>{const[t,r]=B(!0);let n=null,i=null;return e.title&&(n=(()=>{var a=jJ();return A(a,()=>e.title),a})()),e.collapsable&&(i=(()=>{var a=VJ();return ce(a,"click",()=>{r(!t())}),a._$owner=fe(),J(()=>a.name=t()?"chevron-right":"chevron-down"),a})()),[(()=>{var a=UJ();return A(a,Rt),a})(),(()=>{var a=qJ();return A(a,n||i?(()=>{var o=BJ();return A(o,n,null),A(o,i,null),o})():null,null),A(a,(()=>{var o=D(()=>!!(e.collapsable&&t()));return()=>o()?null:(()=>{var s=HJ();return s._$owner=fe(),s})()})(),null),J(o=>{var s=!!e.invalid,l=!!e.invalid;return s!==o.e&&a.classList.toggle("border-red-400",o.e=s),l!==o.t&&a.classList.toggle("border-2",o.t=l),o},{e:void 0,t:void 0}),a})()]};Et("photon-card",{invalid:!1,title:null,collapsable:!1},WJ);const QJ=_e`
3766
3768
  fragment CatalogFields on Catalog {
3767
3769
  id
3768
3770
  }
package/dist/index.mjs CHANGED
@@ -11641,6 +11641,7 @@ class Ik {
11641
11641
  $fills: [FillInput!]!
11642
11642
  $address: AddressInput!
11643
11643
  $pharmacyId: ID!
11644
+ $groupId: ID
11644
11645
  ) {
11645
11646
  createOrder(
11646
11647
  externalId: $externalId
@@ -11648,6 +11649,7 @@ class Ik {
11648
11649
  fills: $fills
11649
11650
  address: $address
11650
11651
  pharmacyId: $pharmacyId
11652
+ groupId: $groupId
11651
11653
  ) {
11652
11654
  ...${r}
11653
11655
  }
@@ -41375,7 +41377,7 @@ const J6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41375
41377
  function Eh(e, t) {
41376
41378
  return e.every((r) => t.includes(r));
41377
41379
  }
41378
- const NQ = "0.17.0", LQ = {
41380
+ const NQ = "0.17.1", LQ = {
41379
41381
  version: NQ
41380
41382
  };
41381
41383
  var FQ = /* @__PURE__ */ K("<slot>"), RQ = /* @__PURE__ */ K("<div>");
@@ -53711,6 +53713,9 @@ function FJ(e) {
53711
53713
  ...e.externalOrderId ? {
53712
53714
  externalId: e.externalOrderId
53713
53715
  } : {},
53716
+ ...e.groupId ? {
53717
+ groupId: e.groupId
53718
+ } : {},
53714
53719
  patientId: e.formStore.patient?.value.id,
53715
53720
  pharmacyId: Ce,
53716
53721
  fulfillmentType: e.formStore.fulfillmentType?.value || "",
@@ -54187,6 +54192,9 @@ const RJ = (e) => ({
54187
54192
  },
54188
54193
  get disableList() {
54189
54194
  return e.disableList;
54195
+ },
54196
+ get groupId() {
54197
+ return e.groupId;
54190
54198
  }
54191
54199
  });
54192
54200
  }
@@ -54226,7 +54234,8 @@ Et("photon-prescribe-workflow", {
54226
54234
  catalogId: void 0,
54227
54235
  allowOffCatalogSearch: !0,
54228
54236
  enableCoverageCheck: !1,
54229
- disableList: void 0
54237
+ disableList: void 0,
54238
+ groupId: void 0
54230
54239
  }, zJ);
54231
54240
  var jJ = /* @__PURE__ */ K('<p class="font-sans text-l font-medium mb-2">'), VJ = /* @__PURE__ */ K("<sl-icon-button class=self-start>", !0, !1, !1), UJ = /* @__PURE__ */ K("<style>"), qJ = /* @__PURE__ */ K('<div class="rounded-lg bg-white p-4 shadow-card border border-gray-200">'), BJ = /* @__PURE__ */ K('<div class="flex flex-row justify-between">'), HJ = /* @__PURE__ */ K("<slot>");
54232
54241
  const WJ = (e) => {
@@ -49,6 +49,7 @@ export type PrescribeProps = {
49
49
  catalogId?: string;
50
50
  allowOffCatalogSearch?: boolean;
51
51
  disableList?: DisableList;
52
+ groupId?: string;
52
53
  };
53
54
  export declare const ScreenDraftedPrescriptionsQuery: import("graphql").DocumentNode;
54
55
  export declare function PrescribeWorkflow(props: PrescribeProps): import("solid-js").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photonhealth/elements",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",