@openmrs/esm-form-builder-app 3.5.2-pre.3900 → 3.5.2-pre.3902
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/1515.js +1 -1
- package/dist/3378.js +1 -1
- package/dist/4383.js +1 -1
- package/dist/4442.js +1 -1
- package/dist/4831.js +1 -1
- package/dist/4948.js +1 -1
- package/dist/5543.js +1 -1
- package/dist/7104.js +1 -1
- package/dist/7484.js +1 -1
- package/dist/7992.js +1 -1
- package/dist/8636.js +1 -1
- package/dist/8998.js +2 -2
- package/dist/9103.js +1 -1
- package/dist/9316.js +1 -1
- package/dist/openmrs-esm-form-builder-app.js +2 -2
- package/dist/openmrs-esm-form-builder-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -2
package/dist/9103.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).push([["9103"],{47826(e,t,n){n.r(t),n.d(t,{default:()=>J});var a=n(47499),l=n.n(a),r=n(58779),i=n(13400),o=n(14968),s=n(46718);let u=(0,a.createContext)(void 0),c=({children:e,initialFormField:t,isObsGrouped:n=!1,selectedConcept:r=null,updateParentFormField:i})=>{let[o,s]=(0,a.useState)(t),[c,d]=(0,a.useState)(r),[p,m]=(0,a.useState)(!0),b=(0,a.useCallback)(e=>{if(n){let t="function"==typeof e?e(o):e;s(t),i?.(t)}else s(e)},[n,i,o]);return l().createElement(u.Provider,{value:{formField:o,setFormField:b,concept:c,setConcept:d,isConceptValid:p,setIsConceptValid:m,updateParentFormField:i,isObsGrouped:n}},e)},d=()=>{let e=(0,a.useContext)(u);if(!e)throw Error("useFormField must be used within a FormFieldProvider");return e},p=()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),i={datetime:[{value:"both",label:e("calendarAndTimer","Calendar and timer"),defaultChecked:!0}],date:[{value:"calendar",label:e("calendarOnly","Calendar only"),defaultChecked:!1}],time:[{value:"timer",label:e("timerOnly","Timer only"),defaultChecked:!1}]},s=(0,a.useCallback)(e=>{n(t=>({...t,datePickerFormat:e.value}))},[n]);return l().createElement(o.RadioButtonGroup,{name:"datePickerType",legendText:e("datePickerType","The type of date picker to show ")},Object.values(i).flat().map(e=>l().createElement(o.RadioButton,{key:`date-picker-type-${e.value}`,id:e.value,checked:t.datePickerFormat&&t.datePickerFormat===e.value,labelText:e.label,onClick:s.bind(null,e),value:e.value})))};var m=n(58365),b=n(29012),g=n(98668),_=n(43627);async function f(e){let t=`${s.restBaseUrl}/concept/${e}?v=full`;return await (0,s.openmrsFetch)(t)}var h=n(79610),q=n(73391),E=n.n(q);let y={label:"-esm-form-builder__concept-search__label___o5ui+",searchContainer:"-esm-form-builder__concept-search__searchContainer___7VR0j",error:"-esm-form-builder__concept-search__error___OCeWK",loader:"-esm-form-builder__concept-search__loader___bnJKJ",concept:"-esm-form-builder__concept-search__concept___n7Rr1",conceptList:"-esm-form-builder__concept-search__conceptList___FDDR7",dropdownContainer:"-esm-form-builder__concept-search__dropdownContainer___u5xIR",emptyResults:"-esm-form-builder__concept-search__emptyResults___jTyVE",oclLauncherBanner:"-esm-form-builder__concept-search__oclLauncherBanner___MPsdO",oclLink:"-esm-form-builder__concept-search__oclLink___aBFfJ"},O=({label:e,defaultConcept:t,onClearSelectedConcept:n,onSelectConcept:i,retainConceptInContextAfterSearch:u=!1,clearSearchAfterSelection:c=!1})=>{let{t:p}=(0,r.useTranslation)(),[m,b]=(0,a.useState)(""),g=(0,s.useDebounce)(m),{concepts:_,conceptLookupError:f,isLoadingConcepts:q}=function(e){let t=`${s.restBaseUrl}/concept?q=${e}&v=full&includeAll=true`,{data:n,error:a,isLoading:l}=E()(e?t:null,s.openmrsFetch);return{concepts:n?.data?.results??[],conceptLookupError:a,isLoadingConcepts:l}}(g),{concept:O,conceptName:k,conceptNameLookupError:C,isLoadingConcept:v}=function(e){let t=`${s.restBaseUrl}/concept/${e}?v=full`,{data:n,error:a}=E()(e?t:null,s.openmrsFetch);return{concept:n?.data??null,conceptName:n?.data?.display??null,conceptNameLookupError:a,isLoadingConcept:e&&!n&&!a||!1}}(t),[x,T]=(0,a.useState)(O),{concept:w,setConcept:S,setIsConceptValid:I}=d();(0,a.useEffect)(()=>{u&&O&&!w&&S(O)},[O,u,w,S]);let F=(0,a.useCallback)(e=>b(e.target.value),[]);(0,a.useEffect)(()=>{(f||C)&&I(!1)},[f,C,I]);let N=(0,a.useCallback)(()=>{T(null),b(""),I(!0),n&&n()},[n,I]),L=(0,a.useCallback)(e=>{b(""),T(e),i(e),I(!0),c&&N()},[i,I,N,c]),A=x??O,P=!m&&!!A?.retired;return l().createElement(l().Fragment,null,l().createElement(o.FormLabel,{className:y.label},e??p("searchForBackingConcept","Search for a backing concept")),(f||C)&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:y.error,title:f?p("errorFetchingConcepts","Error fetching concepts"):p("errorFetchingConceptName","Couldn't resolve concept name"),subtitle:f?p("pleaseTryAgain","Please try again."):p("conceptDoesNotExist","The linked concept '{{conceptName}}' does not exist in your dictionary",{conceptName:t})}),l().createElement("div",{className:y.searchContainer},v?l().createElement(o.InlineLoading,{className:y.loader,description:p("loading","Loading")+"..."}):l().createElement(o.Search,{id:"conceptLookup",onClear:N,onChange:F,labelText:p("searchForBackingConcept","Search for a backing concept"),placeholder:p("searchConcept","Search using a concept name or UUID"),size:"md",value:(()=>{if(m)return m;let e=x?.display??k??"";return P?p("retiredConceptDisplay","{{display}} (Retired)",{display:e}):e})()}),m?q?l().createElement(o.InlineLoading,{className:y.loader,description:p("searching","Searching")+"..."}):_?.length&&!q?l().createElement("ul",{className:y.conceptList},_?.map((e,t)=>l().createElement("li",{role:"menuitem",className:y.concept,"data-retired":e.retired||void 0,key:t,onClick:()=>L(e)},l().createElement("span",null,e.display),e.retired&&l().createElement(o.Tag,{size:"sm",type:"cool-gray"},p("retired","Retired"))))):l().createElement("div",{className:y.dropdownContainer},l().createElement(o.Layer,null,l().createElement(o.Tile,{className:y.emptyResults},l().createElement("span",null,p("noMatchingConcepts","No concepts were found that match")," ",l().createElement("strong",null,'"',g,'".'))),l().createElement("div",{className:y.oclLauncherBanner},l().createElement("p",{className:y.bodyShort01},p("conceptSearchHelpText","Can't find a concept?")),l().createElement("a",{className:y.oclLink,target:"_blank",rel:"noopener noreferrer",href:"https://app.openconceptlab.org/"},p("searchInOCL","Search in OCL"),l().createElement(h.F1,{size:16}))))):null))};var k=n(46942),C=n.n(k),v=n(74979),x=n(40771),T=n(55576),w=n(2383);let S=({id:e,text:t,onDelete:n,isInvalid:a})=>{let{t:i}=(0,r.useTranslation)(),{attributes:s,listeners:u,setNodeRef:c,transform:d,transition:p,isDragging:m}=(0,_.gl)({id:e}),b={transform:v.Ks.Transform.toString(d),transition:p};return l().createElement("div",{ref:c,style:b,className:C()("-esm-form-builder__sortable-tag__sortableTagWrapper___Kg-RP",{"-esm-form-builder__sortable-tag__dragContainerWhenDragging___ZDdHh":m,"-esm-form-builder__sortable-tag__invalid___rdyma":a})},l().createElement("div",{className:"-esm-form-builder__sortable-tag__leftContent___Q7xYQ"},l().createElement("div",{...s,...u,className:"-esm-form-builder__sortable-tag__dragHandle___pqFxT"},l().createElement(o.IconButton,{kind:"ghost",size:"md",label:i("dragToReorder","Drag to reorder")},l().createElement(x.sx,null))),l().createElement("span",{className:C()("-esm-form-builder__sortable-tag__sortableTag___ojQNX",{"-esm-form-builder__sortable-tag__dragging___vMSwX":m})},t)),l().createElement("div",null,n&&l().createElement(o.IconButton,{enterDelayMs:300,label:i("deleteAnswer","Delete answer"),kind:"ghost",onClick:n,size:"md"},l().createElement(T.zH,null)),a&&l().createElement(w.OR,{className:"-esm-form-builder__sortable-tag__invalidIcon___SKD9A","aria-label":"Invalid answer",size:16})))},I={multiSelect:"-esm-form-builder__select-answers__multiSelect___6s6dl",tag:"-esm-form-builder__select-answers__tag___xLfyA"},F=()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,concept:n,setFormField:i}=d(),[s,u]=(0,a.useState)([]),[c,p]=(0,a.useState)([]),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{n||u([])},[n]),(0,a.useEffect)(()=>{if(n&&m.current!==n.uuid&&(m.current=n.uuid,n.answers?.length&&!t.questionOptions?.answers?.length)){let e=n.answers.map(e=>({concept:e.uuid,label:e.display}));i(t=>({...t,questionOptions:{...t.questionOptions,answers:e}}))}},[n,t.questionOptions?.answers,i]);let b=(0,a.useMemo)(()=>(t.questionOptions?.answers?.map(e=>({id:e.concept,text:e.label}))??[]).filter(e=>!s.some(t=>t.id===e.id)),[t.questionOptions?.answers,s]),h=(0,a.useCallback)(({selectedItems:e})=>{let t=e.filter(e=>"select-all"!==e.id).map(e=>({concept:e.id,label:e.text}));i(e=>JSON.stringify(e.questionOptions?.answers||[])===JSON.stringify(t)?e:{...e,questionOptions:{...e.questionOptions,answers:t}})},[i]),q=(0,a.useCallback)(e=>{let t={id:e.uuid,text:e.display},n=b.some(e=>e.id===t.id),a=s.some(e=>e.id===t.id);n||a||(u(e=>[...e,t]),i(t=>{let n=t.questionOptions?.answers??[];return n.push({concept:e.uuid,label:e.display}),{...t,questionOptions:{...t.questionOptions,answers:n}}}))},[b,s,i]),E=(0,a.useCallback)(e=>{u(t=>t.filter(t=>t.id!==e)),i(t=>{let n=t.questionOptions?.answers??[];return{...t,questionOptions:{...t.questionOptions,answers:n.filter(t=>t.concept!==e)}}})},[i]),y=(0,a.useMemo)(()=>{let a=n?.answers?.map(e=>({id:e.uuid,text:e.display}))??[],l=t.questionOptions?.answers??[];if(0===a.length&&l.length>0)return[...l.map(e=>({id:e.concept,text:e.label})),{id:"select-all",text:e("selectAllOptions","Select all options"),isSelectAll:!0}];let r=new Map(l.map(e=>[e.concept,e.label]));return[...a.map(e=>({id:e.id,text:r.get(e.id)??e.text})),...l.filter(e=>!a.some(t=>t.id===e.concept)).map(e=>({id:e.concept,text:e.label})),{id:"select-all",text:e("selectAllOptions","Select all options"),isSelectAll:!0}]},[n?.answers,t.questionOptions?.answers,e]),k=(0,a.useCallback)(async()=>{if(!y.length)return void p([]);let e=new Set((n?.answers||[]).map(e=>e.uuid)),t=[];for(let n of Array.from(new Map(y.filter(e=>"select-all"!==e.id).map(e=>[e.id,e])).values()))if(!e.has(n.id))try{let e=await f(n.id);e?.data?.uuid!==n.id&&t.push(n.id)}catch(e){t.push(n.id)}p(t)},[y,n]);(0,a.useEffect)(()=>{n?.answers?.length&&k()},[y,n,k]);let C=(0,a.useCallback)(e=>e.text,[]),v=(0,a.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&i(e=>{let a=e.questionOptions?.answers??[],l=a.findIndex(e=>e.concept===t.id),r=a.findIndex(e=>e.concept===n.id);if(-1===l||-1===r)return e;let i=(0,_.be)(a,l,r);return{...e,questionOptions:{...e.questionOptions,answers:i}}})},[i]),x=(0,a.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&u(e=>{let a=e.findIndex(e=>e.id===t.id),l=e.findIndex(e=>e.id===n.id);return -1===a||-1===l?e:(0,_.be)(e,a,l)})},[u]);return l().createElement(o.Stack,{gap:5},y.length>1&&l().createElement(o.MultiSelect,{className:I.multiSelect,direction:"bottom",id:"selectAnswers",items:y,itemToString:C,label:"",onChange:h,size:"md",selectedItems:b,titleText:e("selectAnswersToDisplay","Select answers to display")}),b.length>0&&l().createElement(g.Mp,{onDragEnd:v},l().createElement(_.gB,{items:b,strategy:_._G},l().createElement("div",null,b.map(e=>l().createElement(S,{key:e.id,id:e.id,text:e.text,isInvalid:c.includes(e.id)}))))),c.length>0&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:I.error,title:e("invalidAnswerConcept","Invalid Answer Concept Detected"),subtitle:e("answerConceptValidation","One or more selected answer concepts do not exist in the system. ")}),n&&n.datatype?.name==="Coded"&&l().createElement(l().Fragment,null,l().createElement(O,{label:e("searchForAnswerConcept","Search for a concept to add as an answer"),onSelectConcept:q,clearSearchAfterSelection:!0}),s.length>0&&l().createElement(g.Mp,{onDragEnd:x},l().createElement(_.gB,{items:s,strategy:_._G},l().createElement("div",null,s.map(e=>l().createElement(S,{key:e.id,id:e.id,text:e.text,onDelete:()=>E(e.id)})))))))},N=["control","encounterDatetime","encounterLocation","encounterProvider","encounterRole","obs","obsGroup","patientIdentifier","personAttribute","testOrder","programState"],L=["checkbox","checkbox-searchable","content-switcher","date","datetime","drug","encounter-location","encounter-provider","encounter-role","fixed-value","file","group","number","problem","radio","repeating","select","text","textarea","toggle","ui-select-extended","workspace-launcher","markdown","extension-widget","select-concept-answers"],A={control:["text","markdown"],encounterDatetime:["date","datetime"],encounterLocation:["ui-select-extended"],encounterProvider:["ui-select-extended"],encounterRole:["ui-select-extended"],obs:L,obsGroup:["group","repeating"],personAttribute:["text","select","date","radio","checkbox","textarea","toggle","ui-select-extended"],testOrder:["group","repeating"],patientIdentifier:["text"],programState:["select"]},P={number:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(l().Fragment,null,l().createElement(o.TextInput,{id:"min",labelText:e("minValue","Min value that can be entered"),value:t.questionOptions?.min??"",invalid:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??""),invalidText:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??"")?e("invalidMinMax","Min value cannot be greater than max"):"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,min:e.target.value}})}}),l().createElement(o.TextInput,{id:"max",labelText:e("maxValue","Max value that can be entered"),value:t.questionOptions?.max??"",invalid:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??""),invalidText:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??"")?e("invalidMinMax","Min value cannot be greater than max"):"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,max:e.target.value}})}}))},text:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),i=(0,a.useCallback)(()=>parseFloat(t.questionOptions?.minLength??"")>parseFloat(t.questionOptions?.maxLength??""),[t.questionOptions?.maxLength,t.questionOptions?.minLength]),s=(0,a.useCallback)(()=>i()?e("invalidMinMax","Min value cannot be greater than max"):"",[i,e]);return l().createElement(l().Fragment,null,l().createElement(o.TextInput,{id:"minLength",labelText:e("minLengthOfCharacters","Min length of characters"),value:t.questionOptions?.minLength??"",invalid:i(),invalidText:s(),onChange:e=>{n({...t,questionOptions:{...t.questionOptions,minLength:e.target.value}})}}),l().createElement(o.TextInput,{id:"maxLength",labelText:e("maxLengthOfCharacters","Max length of characters"),value:t.questionOptions?.maxLength??"",invalid:i(),invalidText:s(),onChange:e=>{n({...t,questionOptions:{...t.questionOptions,maxLength:e.target.value}})}}))},textarea:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(o.TextInput,{id:"textAreaRows",labelText:e("rows","Rows"),value:t.questionOptions?.rows?t.questionOptions.rows.toString():"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,rows:parseInt(e.target.value)}})}})},toggle:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(l().Fragment,null,l().createElement(o.TextInput,{id:"labelTrue",labelText:e("labelTrue","Label true"),value:t.questionOptions?.toggleOptions?.labelTrue??"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,toggleOptions:{...t.questionOptions.toggleOptions,labelTrue:e.target.value}}})},placeholder:e("on","On")}),l().createElement(o.TextInput,{id:"labelFalse",labelText:e("labelFalse","Label false"),value:t.questionOptions?.toggleOptions?.labelFalse??"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,toggleOptions:{...t.questionOptions.toggleOptions,labelFalse:e.target.value}}})},placeholder:e("off","Off")}))},"ui-select-extended":()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(l().Fragment,null,l().createElement(o.RadioButtonGroup,{defaultSelected:"notSearchable",name:"isUiSelectSearchable",legendText:e("isUiSelectSearchable","Is the ui-select-extended rendering searchable")},l().createElement(o.RadioButton,{id:"uiSelectNotSearchable",checked:!t.questionOptions?.isSearchable,labelText:e("notSearchable","Not Searchable"),onClick:()=>{n({...t,questionOptions:{...t.questionOptions,isSearchable:!1}})},value:"notSearchable"}),l().createElement(o.RadioButton,{id:"uiSelectSearchable",checked:t.questionOptions?.isSearchable,labelText:e("searchable","Searchable"),onClick:()=>{n({...t,questionOptions:{...t.questionOptions,isSearchable:!0}})},value:"searchable"})))},date:p,datetime:p,markdown:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),[a,i]=l().useState("write");return l().createElement("div",{className:"-esm-form-builder__markdown__container___tPxf6"},l().createElement(m.default,{value:t.value,onChange:e=>{n({...t,value:e})},selectedTab:a,onTabChange:()=>{i(e=>"write"===e?"preview":"write")},toolbarCommands:[["bold","italic"]],generateMarkdownPreview:e=>Promise.resolve(l().createElement(b.o,{children:Array.isArray(e)?e.join("\n"):e})),childProps:{writeButton:{tabIndex:-1}},loadingPreview:e("loadingPreview","Loading preview...")}))},select:F,radio:F,checkbox:F},B=()=>{let{formField:e}=d(),t=e.type&&"obs"!==e.type?A[e.type]:L,n=t?.includes(e.questionOptions?.rendering)&&"programState"!==e.type?P[e.questionOptions?.rendering]:null;return n?l().createElement(n,null):(e.questionOptions?.rendering&&console.error(`No component found for rendering type: ${e.questionOptions.rendering} or a rendering type is not available for ${e.type}`),null)},R="-esm-form-builder__obs-type-question__label___V1dxE",M="-esm-form-builder__obs-type-question__tableStriped___5AEgu",D=()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n,concept:i,setConcept:s}=d(),[u,c]=(0,a.useState)(null);(0,a.useEffect)(()=>{t.questionOptions?.concept&&c(t.questionOptions.concept)},[t.questionOptions?.concept]);let p=(0,a.useCallback)(e=>{switch(e.datatype.name){case"Datetime":return"both";case"Date":return"calendar";case"Time":return"timer";default:return null}},[]),m=(0,a.useCallback)(e=>{if(e){s(e);let t=p(e);n(n=>({...n,questionOptions:{...n.questionOptions,concept:e.uuid},...t&&{datePickerFormat:t}}))}},[p,n,s]),b=(0,a.useCallback)(()=>{s(null),c(null),n(e=>{let t={...e};return t.questionOptions&&(delete t.questionOptions.concept,delete t.questionOptions.answers),t.datePickerFormat&&delete t.datePickerFormat,t})},[n,s]),g=(0,a.useCallback)(e=>{let t=`${e.type}:${e.value}`;c(t),n(e=>({...e,questionOptions:{...e.questionOptions,concept:t}}))},[n]),_=(0,a.useCallback)(()=>{c(null),i&&n(e=>({...e,questionOptions:{...e.questionOptions,concept:i.uuid}}))},[i,n]),f=(0,a.useMemo)(()=>i&&i.mappings?i.mappings.map(e=>{let t=e.display.split(": ");return{relationship:e.conceptMapType.display,type:t[0],value:t[1]}}):[],[i]),h=f.some(e=>"SAME-AS"===e.relationship);return l().createElement(o.Stack,{gap:5},l().createElement(O,{defaultConcept:t.questionOptions?.concept??null,onClearSelectedConcept:b,onSelectConcept:m,retainConceptInContextAfterSearch:!0}),i?.allowDecimal===!1&&l().createElement(o.InlineNotification,{kind:"info",lowContrast:!0,title:e("decimalsNotAllowed","This concept does not allow decimals")}),(i?.conceptClass?.display||i?.datatype?.display||i?.uuid)&&l().createElement(o.FormGroup,{legendText:""},l().createElement(o.FormLabel,{className:R},e("attributes","Attributes")),l().createElement("table",{className:M},l().createElement("thead",null,l().createElement("tr",null,l().createElement("th",null,e("attributes","Attributes")),l().createElement("th",null,e("value","Value")))),l().createElement("tbody",null,l().createElement("tr",null,l().createElement("td",null,e("class","Class")),l().createElement("td",null,i?.conceptClass?.display||"")),l().createElement("tr",null,l().createElement("td",null,e("datatype","Data Type")),l().createElement("td",null,i?.datatype?.display||"")),l().createElement("tr",null,l().createElement("td",null,e("conceptId","Concept ID")),l().createElement("td",null,i?.uuid||""))))),f.length>0&&l().createElement(o.FormGroup,{legendText:""},l().createElement(o.FormLabel,{className:R},e("mappings","Mappings")),l().createElement("table",{className:M},l().createElement("thead",null,l().createElement("tr",null,l().createElement("th",null,e("relationship","Relationship")),l().createElement("th",null,e("source","Source")),l().createElement("th",null,e("code","Code")),h&&l().createElement("th",null,e("select","Select")))),l().createElement("tbody",null,f.map((e,t)=>l().createElement("tr",{key:`mapping-${t}`},l().createElement("td",null,e.relationship),l().createElement("td",null,e.type),l().createElement("td",null,e.value),h&&l().createElement("td",null,"SAME-AS"===e.relationship&&l().createElement(o.Checkbox,{id:`checkbox-${t}`,labelText:"",checked:u===`${e.type}:${e.value}`,onChange:()=>{u===`${e.type}:${e.value}`?_():g(e)}}))))))))},$="-esm-form-builder__program-state-type-question__error___9EgYn",U={label:"-esm-form-builder__patient-identifier-type-question__label___SmDY6",loader:"-esm-form-builder__patient-identifier-type-question__loader___YH+ES"};var Q=n(92137);let G="-esm-form-builder__person-attribute-type-question__error___1c-uZ",z={obs:D,programState:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),{programs:i,programsLookupError:u,isLoadingPrograms:c}=function(){let e=`${s.restBaseUrl}/program?v=custom:(uuid,name,retired,allWorkflows)`,{data:t,error:n,isLoading:a}=E()(e,s.openmrsFetch);return{programs:t?t?.data?.results:[],programsLookupError:n,isLoadingPrograms:a}}(),[p,m]=(0,a.useState)(),[b,g]=(0,a.useState)(),[_,f]=(0,a.useState)([]),{programStates:h,programStatesLookupError:q,isLoadingProgramStates:y,mutateProgramStates:O}=function(e){let t=`${s.restBaseUrl}/workflow/${e}?v=custom:(uuid,retired,states,concept:(uuid,display))`,{data:n,error:a,isLoading:l,mutate:r}=E()(e?t:null,s.openmrsFetch);return{programStates:n?.data?.states??[],programStatesLookupError:a,isLoadingProgramStates:l,mutateProgramStates:r}}(b?.uuid),k=(0,a.useMemo)(()=>{if(!t.questionOptions?.answers||!h.length)return[];let e=new Set(t.questionOptions.answers.map(e=>e.value));return h.filter(t=>e.has(t.uuid))},[t.questionOptions?.answers,h]),C=(0,a.useCallback)(e=>{m(e),g(null),f(e?.allWorkflows??[]),n(t=>{if(e)return{...t,questionOptions:{...t.questionOptions,programUuid:e.uuid}};let n={...t.questionOptions};return delete n.programUuid,delete n.workflowUuid,delete n.answers,{...t,questionOptions:n}})},[n]),v=(0,a.useCallback)(e=>{g(e),O(),n(t=>{if(e)return{...t,questionOptions:{...t.questionOptions,workflowUuid:e.uuid}};let n={...t.questionOptions};return delete n.workflowUuid,delete n.answers,{...t,questionOptions:n}})},[O,n]),x=(0,a.useCallback)(e=>{n({...t,questionOptions:{...t.questionOptions,answers:e.selectedItems.map(e=>({value:e.uuid,label:e.concept.display}))}})},[t,n]);(0,a.useEffect)(()=>{let e=i.find(e=>e.uuid===t.questionOptions?.programUuid);if(e&&(m(e),f(e.allWorkflows),t.questionOptions.workflowUuid)){let n=e.allWorkflows.find(e=>e.uuid===t.questionOptions?.workflowUuid);n&&g(n)}},[t.questionOptions?.programUuid,t.questionOptions?.workflowUuid,i]);let T=(0,a.useCallback)(e=>e.concept.display,[]);return l().createElement(o.Stack,{gap:5},l().createElement(o.FormLabel,{className:"-esm-form-builder__program-state-type-question__label___2V95S"},e("selectProgram","Select a program")),u&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:$,title:e("errorFetchingPrograms","Error fetching programs"),subtitle:e("pleaseTryAgain","Please try again.")}),c?l().createElement(o.SelectSkeleton,null):i.length>0&&l().createElement(o.ComboBox,{id:"programLookup",items:i,itemToString:e=>e?.name,onChange:({selectedItem:e})=>{C(e)},placeholder:e("addProgram","Add program"),selectedItem:p,titleText:e("program","Program"),initialSelectedItem:i.find(e=>e?.uuid===t.questionOptions?.programUuid)}),p&&l().createElement(o.ComboBox,{id:"programWorkflowLookup",items:_,itemToString:e=>e?.concept?.display,onChange:({selectedItem:e})=>v(e),placeholder:e("addProgramWorkflow","Add program workflow"),selectedItem:b,titleText:e("programWorkflow","Program workflow"),initialSelectedItem:_.find(e=>e?.uuid===t.questionOptions?.workflowUuid)}),b&&l().createElement("div",null,q&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:$,title:e("errorFetchingProgramState","Error fetching program state"),subtitle:e("pleaseTryAgain","Please try again.")}),y?l().createElement(o.SelectSkeleton,null):h?.length>0&&l().createElement(o.MultiSelect,{titleText:e("programState","Program state"),id:"programState",items:h,itemToString:T,label:"",selectionFeedback:"top-after-reopen",onChange:x,selectedItems:k}),k?.map(e=>l().createElement("div",{key:e.uuid},l().createElement(o.Tag,{className:"-esm-form-builder__program-state-type-question__tag___-3SsZ",type:"blue"},e?.concept?.display)))))},patientIdentifier:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),{patientIdentifierTypes:i,patientIdentifierTypeLookupError:u,isLoadingPatientIdentifierTypes:c}=function(){let e=`${s.restBaseUrl}/patientidentifiertype?v=custom:(uuid,display,name,description)`,{data:t,error:n,isLoading:a}=E()(e,s.openmrsFetch);return{patientIdentifierTypes:t?.data?.results??[],patientIdentifierTypeLookupError:n,isLoadingPatientIdentifierTypes:a}}(),[p,m]=(0,a.useState)(t.questionOptions?.identifierType?i.find(e=>e.uuid===t.questionOptions.identifierType):null),b=(0,a.useCallback)(e=>e?.display??"",[]);return l().createElement("div",null,l().createElement(o.FormLabel,{className:U.label},e("searchForBackingPatientIdentifierType","Search for a backing patient identifier type")),u&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:U.error,title:e("errorFetchingPatientIdentifierTypes","Error fetching patient identifier types"),subtitle:e("pleaseTryAgain","Please try again.")}),c?l().createElement(o.InlineLoading,{className:U.loader,description:e("loading","Loading")+"..."}):l().createElement(o.ComboBox,{helperText:e("patientIdentifierTypeHelperText","Patient identifier type fields must be linked to a patient identifier type"),id:"patientIdentifierTypeLookup",items:i,itemToString:b,onChange:({selectedItem:e})=>{m(e),n({...t,questionOptions:{...t.questionOptions,identifierType:e.uuid}})},placeholder:e("choosePatientIdentifierType","Choose a patient identifier type"),selectedItem:p,initialSelectedItem:i.find(e=>e?.uuid===t.questionOptions?.identifierType)}))},obsGroup:D,testOrder:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),i=(0,a.useMemo)(()=>t.questionOptions?.selectableOrders||[],[t.questionOptions?.selectableOrders]),s=(0,a.useCallback)(e=>{n(t=>({...t,questionOptions:{...t.questionOptions,concept:e}}))},[n]),u=(0,a.useCallback)(()=>{let e={concept:"",label:""};n(t=>({...t,questionOptions:{...t.questionOptions,selectableOrders:[...i,e]}}))},[i,n]),c=(0,a.useCallback)(e=>{let t=i.filter((t,n)=>n!==e);n(e=>({...e,questionOptions:{...e.questionOptions,selectableOrders:t}}))},[i,n]),p=(0,a.useCallback)((e,t,a)=>{let l=i.map((n,l)=>l===e?{...n,[t]:a}:n);n(e=>({...e,questionOptions:{...e.questionOptions,selectableOrders:l}}))},[i,n]),m=(0,a.useCallback)((e,t)=>{p(e,"concept",t)},[p]);return l().createElement("div",{className:"-esm-form-builder__test-order-type-question__testOrderContainer___cUcd5"},l().createElement(O,{defaultConcept:t.questionOptions?.concept,onSelectConcept:e=>s(e.uuid)}),l().createElement(o.FormGroup,{legendText:e("selectableOrders","Selectable Orders")},l().createElement(o.Stack,{gap:4},i.map((t,n)=>l().createElement("div",{key:n,className:"-esm-form-builder__test-order-type-question__selectableOrderItem___y7bhc"},l().createElement("div",{className:"-esm-form-builder__test-order-type-question__orderFields___AzGqM"},l().createElement("div",{className:"-esm-form-builder__test-order-type-question__conceptField___hkC3C"},l().createElement(O,{defaultConcept:t.concept,onSelectConcept:e=>m(n,e.uuid)})),l().createElement(o.TextInput,{id:`order-label-${n}`,labelText:e("label","Label"),value:t.label,onChange:e=>p(n,"label",e.target.value),placeholder:e("enterOrderLabel","Enter order label")}),l().createElement(o.Button,{kind:"ghost",size:"md",renderIcon:T.zH,iconDescription:e("removeOrder","Remove order"),onClick:()=>c(n),className:"-esm-form-builder__test-order-type-question__removeButton___hdacf"})))),l().createElement(o.Button,{kind:"tertiary",size:"md",renderIcon:Q.OM,onClick:u,className:"-esm-form-builder__test-order-type-question__addButton___bN-V4"},e("addSelectableOrder","Add selectable order")))))},personAttribute:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),{personAttributeTypes:i,personAttributeTypeLookupError:u,isLoadingPersonAttributeTypes:c}=function(){let e=`${s.restBaseUrl}/personattributetype?v=custom:(uuid,display,format,concept)`,{data:t,error:n,isLoading:a}=E()(e,s.openmrsFetch);return{personAttributeTypes:t?.data?.results??[],personAttributeTypeLookupError:n,isLoadingPersonAttributeTypes:a}}(),p=t.questionOptions?.attributeType,[m,b]=(0,a.useState)(null),[g,_]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(p&&i.length>0){let e=i.find(e=>e.uuid===p);e?(b(e),_(!1)):(b(null),_(!0))}else p||(b(null),_(!1))},[p,i]);let f=(0,a.useCallback)(e=>e?.display??"",[]);return l().createElement("div",null,l().createElement(o.FormLabel,{className:"-esm-form-builder__person-attribute-type-question__label___LosP2"},e("searchForBackingPersonAttributeType","Search for a backing person attribute type")),g&&l().createElement(o.InlineNotification,{kind:"warning",lowContrast:!0,className:G,title:e("invalidPersonAttributeType","Invalid person attribute type"),subtitle:e("personAttributeTypeNotFound","The configured person attribute type ({{uuid}}) was not found. It may have been deleted or retired.",{uuid:p})}),u&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:G,title:e("errorFetchingPersonAttributeTypes","Error fetching person attribute types"),subtitle:e("pleaseTryAgain","Please try again.")}),c?l().createElement(o.InlineLoading,{className:"-esm-form-builder__person-attribute-type-question__loader___lMIpa",description:e("loading","Loading")+"..."}):l().createElement(o.ComboBox,{disabled:!!u,helperText:e("personAttributeTypeHelperText","Person attribute type fields must be linked to a person attribute type"),id:"personAttributeTypeLookup",items:i,itemToString:f,onChange:({selectedItem:e})=>{b(e),n({...t,questionOptions:{...t.questionOptions,attributeType:e?.uuid}})},placeholder:e("choosePersonAttributeType","Choose a person attribute type"),selectedItem:m}))}},W=()=>{let{formField:e}=d(),t=z[e.type];return t?l().createElement(t,null):(console.error(`No component found for questiontype: ${e.type}`),null)},H=({isRequired:e,text:t,t:n})=>l().createElement(l().Fragment,null,l().createElement("span",null,t),e&&l().createElement("span",{title:n("required","Required"),className:"-esm-form-builder__required-label__required___at0FS"},"*")),V=({checkIfQuestionIdExists:e})=>{let{t}=(0,r.useTranslation)(),{formField:n,setFormField:i}=d(),[s,u]=(0,a.useState)(!!n?.questionInfo),c=(0,a.useCallback)(()=>e(n.id),[n.id,e]),p=(0,a.useCallback)(e=>{i(t=>{if("false"===e){let{questionInfo:e,...n}=t;return n}return t}),u("true"===e)},[i]),m=(0,a.useCallback)(e=>{let t=e.target.value;i(e=>e?.questionOptions?.rendering&&"obs"!==t&&!(N.includes(t)&&A[t]?.includes(e.questionOptions.rendering))?{...e,questionOptions:{...e.questionOptions,rendering:null},type:t}:{...e,type:t})},[i]),b=(0,a.useCallback)(e=>{i(t=>({...t,questionInfo:e.target.value}))},[i]);return l().createElement(o.Stack,{gap:5},n.questionOptions&&"markdown"!==n.questionOptions.rendering&&l().createElement(o.TextInput,{id:"questionLabel",labelText:l().createElement(H,{isRequired:!0,text:t("questionLabel","Label"),t:t}),placeholder:t("labelPlaceholder","e.g. Type of Anaesthesia"),value:n?.label,onChange:e=>i({...n,label:e.target.value}),required:!0}),l().createElement(o.TextInput,{id:"questionId",invalid:!!n?.id&&c(),invalidText:t("questionIdExists","This question ID already exists in your schema"),labelText:l().createElement("div",{className:"-esm-form-builder__question__questionIdLabel___-n8YP"},l().createElement("span",null,l().createElement(H,{isRequired:!0,text:t("questionId","Question ID"),t:t})),n?.label&&l().createElement(o.Button,{kind:"ghost",onClick:()=>{let e=n.label?.toLowerCase()?.replace(/(?:^\w|[A-Z]|\b\w)/g,(e,t)=>0===t?e.toLowerCase():e.toUpperCase()).replace(/\s+/g,"");i({...n,id:e})},size:"sm"},t("convertLabelToCamelCase","Convert label to camel-case"))),helperText:t("questionIdHelper","Prefer camel-case; must be unique within this form"),value:n?.id,onChange:e=>{i({...n,id:e.target.value})},placeholder:t("questionIdPlaceholder",'Enter a unique ID e.g. "anaesthesiaType" for a question asking about the type of anaesthesia.'),required:!0}),l().createElement(o.Select,{value:n?.type??"control",onChange:m,id:"questionType",invalidText:t("typeRequired","Type is required"),labelText:l().createElement(H,{isRequired:!0,text:t("questionType","Question type"),t:t}),required:!0},!n?.type&&l().createElement(o.SelectItem,{text:t("chooseQuestionType","Choose a question type"),value:""}),N.map((e,t)=>l().createElement(o.SelectItem,{text:e,value:e,key:t}))),l().createElement(o.Select,{value:n?.questionOptions?.rendering,onChange:e=>{i(null===n?{...n,questionOptions:{rendering:e.target.value}}:{...n,questionOptions:{...n.questionOptions,rendering:e.target.value}})},id:"renderingType",invalidText:t("validRenderingTypeRequired","A valid rendering type value is required"),labelText:l().createElement(H,{isRequired:!0,text:t("renderingType","Rendering type"),t:t}),required:!0},!n.questionOptions?.rendering&&l().createElement(o.SelectItem,{text:t("chooseRenderingType","Choose a rendering type"),value:""}),n.type&&"obs"!==n.type&&N.includes(n.type)?A[n?.type].map((e,t)=>l().createElement(o.SelectItem,{key:`${e}-${t}`,text:e,value:e})):L.map((e,t)=>l().createElement(o.SelectItem,{key:t,text:e,value:e}))),n.questionOptions&&"markdown"!==n.questionOptions.rendering&&l().createElement(l().Fragment,null,l().createElement(o.RadioButtonGroup,{name:"isQuestionRequired",legendText:t("isQuestionRequiredOrOptional","Is this question a required or optional field? Required fields must be answered before the form can be submitted.")},l().createElement(o.RadioButton,{id:"questionIsNotRequired",checked:!n.required||!n.required,labelText:t("optional","Optional"),onClick:()=>i({...n,required:!1}),value:"optional"}),l().createElement(o.RadioButton,{id:"questionIsRequired",checked:!!n.required,labelText:t("required","Required"),onClick:()=>i({...n,required:!0}),value:"required"}))),n.type&&l().createElement(W,null),n.questionOptions?.rendering&&l().createElement(B,null),l().createElement(o.RadioButtonGroup,{name:"isQuestionInfoProvided",legendText:t("isQuestionInfoProvided","Would you like to provide additional details about the question?")},l().createElement(o.RadioButton,{id:"questionInfoProvided",checked:!!n?.questionInfo,labelText:t("yes","Yes"),onClick:()=>p("true"),value:"true"}),l().createElement(o.RadioButton,{id:"questionInfoNotProvided",checked:!n?.questionInfo,labelText:t("no","No"),onClick:()=>p("false"),value:"false"})),s&&l().createElement(o.TextInput,{id:"questionInfo",labelText:t("questionInfo","Additional Question Info"),placeholder:t("questionInfoPlaceholder","Enter any relevant info about the question to provide more context."),value:n?.questionInfo,onChange:b}))},Y=e=>e?(0,i.A)(e.map(e=>[e.id,Y(e.questions)])):[],j=({formField:e,closeModal:t,schema:n,pageIndex:i,sectionIndex:u,questionIndex:p,subQuestionIndex:m,onSchemaChange:b})=>{let{t:g}=(0,r.useTranslation)(),{formField:_,setFormField:f,isConceptValid:h}=d(),q=(0,a.useCallback)(t=>{let a=n?.pages?.flatMap(e=>e?.sections?.flatMap(e=>Y(e.questions)))||[],l=_?.questions?Y(_.questions):[];l.push(_.id);let r=e&&""!==e.id?Y(e.questions):[];e&&""!==e.id&&r.push(e.id);let i=a.slice();return r.forEach(e=>{let t=i.indexOf(e);-1!==t&&i.splice(t,1)}),[...i,...l].filter(e=>e===t).length>1},[n,_,e]),E=(0,a.useCallback)(()=>{let e={type:"",questionOptions:void 0,id:""};f(t=>({...t,questions:t.questions?[...t.questions,e]:[e]}))},[f]),y=(0,a.useCallback)(e=>{f(t=>({...t,questions:t.questions?.filter((t,n)=>n!==e)||[]}))},[f]),O=(0,a.useCallback)((e,t)=>{f(n=>{let a=[...n.questions];return a[t]=e,{...n,questions:a}})},[f]);return l().createElement(l().Fragment,null,l().createElement(o.ModalHeader,{closeModal:t,title:e?g("editQuestion","Edit question"):g("createNewQuestion","Create a new question")}),l().createElement(o.Form,{className:"-esm-form-builder__question__form___e4c8f",onSubmit:e=>e.preventDefault()},l().createElement(o.ModalBody,{hasScrollingContent:!0},l().createElement(o.FormGroup,{legendText:""},l().createElement(o.Stack,{gap:5},l().createElement(V,{checkIfQuestionIdExists:q}),_.questions?.length>=1&&l().createElement(o.Accordion,{size:"lg"},_.questions.map((e,t)=>l().createElement(o.AccordionItem,{key:`Question ${t+1}`,title:e.label??`Question ${t+1}`,open:t===_.questions?.length-1,className:"-esm-form-builder__question__obsGroupQuestionContent___Bo56I"},l().createElement(c,{initialFormField:e,isObsGrouped:!0,updateParentFormField:e=>O(e,t)},l().createElement(V,{checkIfQuestionIdExists:q}),l().createElement(o.Button,{kind:"danger",onClick:()=>y(t),className:"-esm-form-builder__question__deleteObsGroupQuestionButton___wskSy"},g("deleteQuestion","Delete question")))))),"obsGroup"===_.type&&l().createElement(o.Button,{kind:"tertiary",size:"sm",onClick:E},g("addObsGroupQuestion","Add a grouped question"))))),l().createElement(o.ModalFooter,null,l().createElement(o.Button,{onClick:t,kind:"secondary"},g("cancel","Cancel")),l().createElement(o.Button,{disabled:!_||!_.id||!h||"obs"===_.type&&(!_.questionOptions?.concept||_.questionOptions?.concept==="")||!_.questions&&q(_.id)||!_.questionOptions?.rendering,onClick:()=>{try{e?null!=m?n.pages[i].sections[u].questions[p].questions[m]=_:n.pages[i].sections[u].questions[p]=_:n.pages[i]?.sections?.[u]?.questions?.push(_),b({...n}),(0,s.showSnackbar)({title:g("success","Success!"),kind:"success",isLowContrast:!0,subtitle:e?g("questionUpdated","Question updated"):g("questionCreated","New question created")})}catch(e){e instanceof Error&&(0,s.showSnackbar)({title:g("errorSavingQuestion","Error saving question"),kind:"error",subtitle:e?.message})}t()}},l().createElement("span",null,g("save","Save"))))))},J=e=>l().createElement(l().Fragment,null,l().createElement(c,{initialFormField:e.formField??{type:"control",questionOptions:{rendering:"text"},id:""}},l().createElement(j,e)))}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).push([["9103"],{47826(e,t,n){n.r(t),n.d(t,{default:()=>J});var a=n(47499),l=n.n(a),r=n(58779),i=n(13400),o=n(14968),s=n(23365);let u=(0,a.createContext)(void 0),c=({children:e,initialFormField:t,isObsGrouped:n=!1,selectedConcept:r=null,updateParentFormField:i})=>{let[o,s]=(0,a.useState)(t),[c,d]=(0,a.useState)(r),[p,m]=(0,a.useState)(!0),b=(0,a.useCallback)(e=>{if(n){let t="function"==typeof e?e(o):e;s(t),i?.(t)}else s(e)},[n,i,o]);return l().createElement(u.Provider,{value:{formField:o,setFormField:b,concept:c,setConcept:d,isConceptValid:p,setIsConceptValid:m,updateParentFormField:i,isObsGrouped:n}},e)},d=()=>{let e=(0,a.useContext)(u);if(!e)throw Error("useFormField must be used within a FormFieldProvider");return e},p=()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),i={datetime:[{value:"both",label:e("calendarAndTimer","Calendar and timer"),defaultChecked:!0}],date:[{value:"calendar",label:e("calendarOnly","Calendar only"),defaultChecked:!1}],time:[{value:"timer",label:e("timerOnly","Timer only"),defaultChecked:!1}]},s=(0,a.useCallback)(e=>{n(t=>({...t,datePickerFormat:e.value}))},[n]);return l().createElement(o.RadioButtonGroup,{name:"datePickerType",legendText:e("datePickerType","The type of date picker to show ")},Object.values(i).flat().map(e=>l().createElement(o.RadioButton,{key:`date-picker-type-${e.value}`,id:e.value,checked:t.datePickerFormat&&t.datePickerFormat===e.value,labelText:e.label,onClick:s.bind(null,e),value:e.value})))};var m=n(58365),b=n(29012),g=n(98668),_=n(43627);async function f(e){let t=`${s.restBaseUrl}/concept/${e}?v=full`;return await (0,s.openmrsFetch)(t)}var h=n(79610),q=n(73391),E=n.n(q);let y={label:"-esm-form-builder__concept-search__label___o5ui+",searchContainer:"-esm-form-builder__concept-search__searchContainer___7VR0j",error:"-esm-form-builder__concept-search__error___OCeWK",loader:"-esm-form-builder__concept-search__loader___bnJKJ",concept:"-esm-form-builder__concept-search__concept___n7Rr1",conceptList:"-esm-form-builder__concept-search__conceptList___FDDR7",dropdownContainer:"-esm-form-builder__concept-search__dropdownContainer___u5xIR",emptyResults:"-esm-form-builder__concept-search__emptyResults___jTyVE",oclLauncherBanner:"-esm-form-builder__concept-search__oclLauncherBanner___MPsdO",oclLink:"-esm-form-builder__concept-search__oclLink___aBFfJ"},O=({label:e,defaultConcept:t,onClearSelectedConcept:n,onSelectConcept:i,retainConceptInContextAfterSearch:u=!1,clearSearchAfterSelection:c=!1})=>{let{t:p}=(0,r.useTranslation)(),[m,b]=(0,a.useState)(""),g=(0,s.useDebounce)(m),{concepts:_,conceptLookupError:f,isLoadingConcepts:q}=function(e){let t=`${s.restBaseUrl}/concept?q=${e}&v=full&includeAll=true`,{data:n,error:a,isLoading:l}=E()(e?t:null,s.openmrsFetch);return{concepts:n?.data?.results??[],conceptLookupError:a,isLoadingConcepts:l}}(g),{concept:O,conceptName:k,conceptNameLookupError:C,isLoadingConcept:v}=function(e){let t=`${s.restBaseUrl}/concept/${e}?v=full`,{data:n,error:a}=E()(e?t:null,s.openmrsFetch);return{concept:n?.data??null,conceptName:n?.data?.display??null,conceptNameLookupError:a,isLoadingConcept:e&&!n&&!a||!1}}(t),[x,T]=(0,a.useState)(O),{concept:w,setConcept:S,setIsConceptValid:I}=d();(0,a.useEffect)(()=>{u&&O&&!w&&S(O)},[O,u,w,S]);let F=(0,a.useCallback)(e=>b(e.target.value),[]);(0,a.useEffect)(()=>{(f||C)&&I(!1)},[f,C,I]);let N=(0,a.useCallback)(()=>{T(null),b(""),I(!0),n&&n()},[n,I]),L=(0,a.useCallback)(e=>{b(""),T(e),i(e),I(!0),c&&N()},[i,I,N,c]),A=x??O,P=!m&&!!A?.retired;return l().createElement(l().Fragment,null,l().createElement(o.FormLabel,{className:y.label},e??p("searchForBackingConcept","Search for a backing concept")),(f||C)&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:y.error,title:f?p("errorFetchingConcepts","Error fetching concepts"):p("errorFetchingConceptName","Couldn't resolve concept name"),subtitle:f?p("pleaseTryAgain","Please try again."):p("conceptDoesNotExist","The linked concept '{{conceptName}}' does not exist in your dictionary",{conceptName:t})}),l().createElement("div",{className:y.searchContainer},v?l().createElement(o.InlineLoading,{className:y.loader,description:p("loading","Loading")+"..."}):l().createElement(o.Search,{id:"conceptLookup",onClear:N,onChange:F,labelText:p("searchForBackingConcept","Search for a backing concept"),placeholder:p("searchConcept","Search using a concept name or UUID"),size:"md",value:(()=>{if(m)return m;let e=x?.display??k??"";return P?p("retiredConceptDisplay","{{display}} (Retired)",{display:e}):e})()}),m?q?l().createElement(o.InlineLoading,{className:y.loader,description:p("searching","Searching")+"..."}):_?.length&&!q?l().createElement("ul",{className:y.conceptList},_?.map((e,t)=>l().createElement("li",{role:"menuitem",className:y.concept,"data-retired":e.retired||void 0,key:t,onClick:()=>L(e)},l().createElement("span",null,e.display),e.retired&&l().createElement(o.Tag,{size:"sm",type:"cool-gray"},p("retired","Retired"))))):l().createElement("div",{className:y.dropdownContainer},l().createElement(o.Layer,null,l().createElement(o.Tile,{className:y.emptyResults},l().createElement("span",null,p("noMatchingConcepts","No concepts were found that match")," ",l().createElement("strong",null,'"',g,'".'))),l().createElement("div",{className:y.oclLauncherBanner},l().createElement("p",{className:y.bodyShort01},p("conceptSearchHelpText","Can't find a concept?")),l().createElement("a",{className:y.oclLink,target:"_blank",rel:"noopener noreferrer",href:"https://app.openconceptlab.org/"},p("searchInOCL","Search in OCL"),l().createElement(h.F1,{size:16}))))):null))};var k=n(46942),C=n.n(k),v=n(74979),x=n(40771),T=n(55576),w=n(2383);let S=({id:e,text:t,onDelete:n,isInvalid:a})=>{let{t:i}=(0,r.useTranslation)(),{attributes:s,listeners:u,setNodeRef:c,transform:d,transition:p,isDragging:m}=(0,_.gl)({id:e}),b={transform:v.Ks.Transform.toString(d),transition:p};return l().createElement("div",{ref:c,style:b,className:C()("-esm-form-builder__sortable-tag__sortableTagWrapper___Kg-RP",{"-esm-form-builder__sortable-tag__dragContainerWhenDragging___ZDdHh":m,"-esm-form-builder__sortable-tag__invalid___rdyma":a})},l().createElement("div",{className:"-esm-form-builder__sortable-tag__leftContent___Q7xYQ"},l().createElement("div",{...s,...u,className:"-esm-form-builder__sortable-tag__dragHandle___pqFxT"},l().createElement(o.IconButton,{kind:"ghost",size:"md",label:i("dragToReorder","Drag to reorder")},l().createElement(x.sx,null))),l().createElement("span",{className:C()("-esm-form-builder__sortable-tag__sortableTag___ojQNX",{"-esm-form-builder__sortable-tag__dragging___vMSwX":m})},t)),l().createElement("div",null,n&&l().createElement(o.IconButton,{enterDelayMs:300,label:i("deleteAnswer","Delete answer"),kind:"ghost",onClick:n,size:"md"},l().createElement(T.zH,null)),a&&l().createElement(w.OR,{className:"-esm-form-builder__sortable-tag__invalidIcon___SKD9A","aria-label":"Invalid answer",size:16})))},I={multiSelect:"-esm-form-builder__select-answers__multiSelect___6s6dl",tag:"-esm-form-builder__select-answers__tag___xLfyA"},F=()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,concept:n,setFormField:i}=d(),[s,u]=(0,a.useState)([]),[c,p]=(0,a.useState)([]),m=(0,a.useRef)(null);(0,a.useEffect)(()=>{n||u([])},[n]),(0,a.useEffect)(()=>{if(n&&m.current!==n.uuid&&(m.current=n.uuid,n.answers?.length&&!t.questionOptions?.answers?.length)){let e=n.answers.map(e=>({concept:e.uuid,label:e.display}));i(t=>({...t,questionOptions:{...t.questionOptions,answers:e}}))}},[n,t.questionOptions?.answers,i]);let b=(0,a.useMemo)(()=>(t.questionOptions?.answers?.map(e=>({id:e.concept,text:e.label}))??[]).filter(e=>!s.some(t=>t.id===e.id)),[t.questionOptions?.answers,s]),h=(0,a.useCallback)(({selectedItems:e})=>{let t=e.filter(e=>"select-all"!==e.id).map(e=>({concept:e.id,label:e.text}));i(e=>JSON.stringify(e.questionOptions?.answers||[])===JSON.stringify(t)?e:{...e,questionOptions:{...e.questionOptions,answers:t}})},[i]),q=(0,a.useCallback)(e=>{let t={id:e.uuid,text:e.display},n=b.some(e=>e.id===t.id),a=s.some(e=>e.id===t.id);n||a||(u(e=>[...e,t]),i(t=>{let n=t.questionOptions?.answers??[];return n.push({concept:e.uuid,label:e.display}),{...t,questionOptions:{...t.questionOptions,answers:n}}}))},[b,s,i]),E=(0,a.useCallback)(e=>{u(t=>t.filter(t=>t.id!==e)),i(t=>{let n=t.questionOptions?.answers??[];return{...t,questionOptions:{...t.questionOptions,answers:n.filter(t=>t.concept!==e)}}})},[i]),y=(0,a.useMemo)(()=>{let a=n?.answers?.map(e=>({id:e.uuid,text:e.display}))??[],l=t.questionOptions?.answers??[];if(0===a.length&&l.length>0)return[...l.map(e=>({id:e.concept,text:e.label})),{id:"select-all",text:e("selectAllOptions","Select all options"),isSelectAll:!0}];let r=new Map(l.map(e=>[e.concept,e.label]));return[...a.map(e=>({id:e.id,text:r.get(e.id)??e.text})),...l.filter(e=>!a.some(t=>t.id===e.concept)).map(e=>({id:e.concept,text:e.label})),{id:"select-all",text:e("selectAllOptions","Select all options"),isSelectAll:!0}]},[n?.answers,t.questionOptions?.answers,e]),k=(0,a.useCallback)(async()=>{if(!y.length)return void p([]);let e=new Set((n?.answers||[]).map(e=>e.uuid)),t=[];for(let n of Array.from(new Map(y.filter(e=>"select-all"!==e.id).map(e=>[e.id,e])).values()))if(!e.has(n.id))try{let e=await f(n.id);e?.data?.uuid!==n.id&&t.push(n.id)}catch(e){t.push(n.id)}p(t)},[y,n]);(0,a.useEffect)(()=>{n?.answers?.length&&k()},[y,n,k]);let C=(0,a.useCallback)(e=>e.text,[]),v=(0,a.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&i(e=>{let a=e.questionOptions?.answers??[],l=a.findIndex(e=>e.concept===t.id),r=a.findIndex(e=>e.concept===n.id);if(-1===l||-1===r)return e;let i=(0,_.be)(a,l,r);return{...e,questionOptions:{...e.questionOptions,answers:i}}})},[i]),x=(0,a.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&u(e=>{let a=e.findIndex(e=>e.id===t.id),l=e.findIndex(e=>e.id===n.id);return -1===a||-1===l?e:(0,_.be)(e,a,l)})},[u]);return l().createElement(o.Stack,{gap:5},y.length>1&&l().createElement(o.MultiSelect,{className:I.multiSelect,direction:"bottom",id:"selectAnswers",items:y,itemToString:C,label:"",onChange:h,size:"md",selectedItems:b,titleText:e("selectAnswersToDisplay","Select answers to display")}),b.length>0&&l().createElement(g.Mp,{onDragEnd:v},l().createElement(_.gB,{items:b,strategy:_._G},l().createElement("div",null,b.map(e=>l().createElement(S,{key:e.id,id:e.id,text:e.text,isInvalid:c.includes(e.id)}))))),c.length>0&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:I.error,title:e("invalidAnswerConcept","Invalid Answer Concept Detected"),subtitle:e("answerConceptValidation","One or more selected answer concepts do not exist in the system. ")}),n&&n.datatype?.name==="Coded"&&l().createElement(l().Fragment,null,l().createElement(O,{label:e("searchForAnswerConcept","Search for a concept to add as an answer"),onSelectConcept:q,clearSearchAfterSelection:!0}),s.length>0&&l().createElement(g.Mp,{onDragEnd:x},l().createElement(_.gB,{items:s,strategy:_._G},l().createElement("div",null,s.map(e=>l().createElement(S,{key:e.id,id:e.id,text:e.text,onDelete:()=>E(e.id)})))))))},N=["control","encounterDatetime","encounterLocation","encounterProvider","encounterRole","obs","obsGroup","patientIdentifier","personAttribute","testOrder","programState"],L=["checkbox","checkbox-searchable","content-switcher","date","datetime","drug","encounter-location","encounter-provider","encounter-role","fixed-value","file","group","number","problem","radio","repeating","select","text","textarea","toggle","ui-select-extended","workspace-launcher","markdown","extension-widget","select-concept-answers"],A={control:["text","markdown"],encounterDatetime:["date","datetime"],encounterLocation:["ui-select-extended"],encounterProvider:["ui-select-extended"],encounterRole:["ui-select-extended"],obs:L,obsGroup:["group","repeating"],personAttribute:["text","select","date","radio","checkbox","textarea","toggle","ui-select-extended"],testOrder:["group","repeating"],patientIdentifier:["text"],programState:["select"]},P={number:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(l().Fragment,null,l().createElement(o.TextInput,{id:"min",labelText:e("minValue","Min value that can be entered"),value:t.questionOptions?.min??"",invalid:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??""),invalidText:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??"")?e("invalidMinMax","Min value cannot be greater than max"):"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,min:e.target.value}})}}),l().createElement(o.TextInput,{id:"max",labelText:e("maxValue","Max value that can be entered"),value:t.questionOptions?.max??"",invalid:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??""),invalidText:parseFloat(t.questionOptions?.min??"")>parseFloat(t.questionOptions?.max??"")?e("invalidMinMax","Min value cannot be greater than max"):"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,max:e.target.value}})}}))},text:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),i=(0,a.useCallback)(()=>parseFloat(t.questionOptions?.minLength??"")>parseFloat(t.questionOptions?.maxLength??""),[t.questionOptions?.maxLength,t.questionOptions?.minLength]),s=(0,a.useCallback)(()=>i()?e("invalidMinMax","Min value cannot be greater than max"):"",[i,e]);return l().createElement(l().Fragment,null,l().createElement(o.TextInput,{id:"minLength",labelText:e("minLengthOfCharacters","Min length of characters"),value:t.questionOptions?.minLength??"",invalid:i(),invalidText:s(),onChange:e=>{n({...t,questionOptions:{...t.questionOptions,minLength:e.target.value}})}}),l().createElement(o.TextInput,{id:"maxLength",labelText:e("maxLengthOfCharacters","Max length of characters"),value:t.questionOptions?.maxLength??"",invalid:i(),invalidText:s(),onChange:e=>{n({...t,questionOptions:{...t.questionOptions,maxLength:e.target.value}})}}))},textarea:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(o.TextInput,{id:"textAreaRows",labelText:e("rows","Rows"),value:t.questionOptions?.rows?t.questionOptions.rows.toString():"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,rows:parseInt(e.target.value)}})}})},toggle:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(l().Fragment,null,l().createElement(o.TextInput,{id:"labelTrue",labelText:e("labelTrue","Label true"),value:t.questionOptions?.toggleOptions?.labelTrue??"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,toggleOptions:{...t.questionOptions.toggleOptions,labelTrue:e.target.value}}})},placeholder:e("on","On")}),l().createElement(o.TextInput,{id:"labelFalse",labelText:e("labelFalse","Label false"),value:t.questionOptions?.toggleOptions?.labelFalse??"",onChange:e=>{n({...t,questionOptions:{...t.questionOptions,toggleOptions:{...t.questionOptions.toggleOptions,labelFalse:e.target.value}}})},placeholder:e("off","Off")}))},"ui-select-extended":()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d();return l().createElement(l().Fragment,null,l().createElement(o.RadioButtonGroup,{defaultSelected:"notSearchable",name:"isUiSelectSearchable",legendText:e("isUiSelectSearchable","Is the ui-select-extended rendering searchable")},l().createElement(o.RadioButton,{id:"uiSelectNotSearchable",checked:!t.questionOptions?.isSearchable,labelText:e("notSearchable","Not Searchable"),onClick:()=>{n({...t,questionOptions:{...t.questionOptions,isSearchable:!1}})},value:"notSearchable"}),l().createElement(o.RadioButton,{id:"uiSelectSearchable",checked:t.questionOptions?.isSearchable,labelText:e("searchable","Searchable"),onClick:()=>{n({...t,questionOptions:{...t.questionOptions,isSearchable:!0}})},value:"searchable"})))},date:p,datetime:p,markdown:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),[a,i]=l().useState("write");return l().createElement("div",{className:"-esm-form-builder__markdown__container___tPxf6"},l().createElement(m.default,{value:t.value,onChange:e=>{n({...t,value:e})},selectedTab:a,onTabChange:()=>{i(e=>"write"===e?"preview":"write")},toolbarCommands:[["bold","italic"]],generateMarkdownPreview:e=>Promise.resolve(l().createElement(b.o,{children:Array.isArray(e)?e.join("\n"):e})),childProps:{writeButton:{tabIndex:-1}},loadingPreview:e("loadingPreview","Loading preview...")}))},select:F,radio:F,checkbox:F},B=()=>{let{formField:e}=d(),t=e.type&&"obs"!==e.type?A[e.type]:L,n=t?.includes(e.questionOptions?.rendering)&&"programState"!==e.type?P[e.questionOptions?.rendering]:null;return n?l().createElement(n,null):(e.questionOptions?.rendering&&console.error(`No component found for rendering type: ${e.questionOptions.rendering} or a rendering type is not available for ${e.type}`),null)},R="-esm-form-builder__obs-type-question__label___V1dxE",M="-esm-form-builder__obs-type-question__tableStriped___5AEgu",D=()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n,concept:i,setConcept:s}=d(),[u,c]=(0,a.useState)(null);(0,a.useEffect)(()=>{t.questionOptions?.concept&&c(t.questionOptions.concept)},[t.questionOptions?.concept]);let p=(0,a.useCallback)(e=>{switch(e.datatype.name){case"Datetime":return"both";case"Date":return"calendar";case"Time":return"timer";default:return null}},[]),m=(0,a.useCallback)(e=>{if(e){s(e);let t=p(e);n(n=>({...n,questionOptions:{...n.questionOptions,concept:e.uuid},...t&&{datePickerFormat:t}}))}},[p,n,s]),b=(0,a.useCallback)(()=>{s(null),c(null),n(e=>{let t={...e};return t.questionOptions&&(delete t.questionOptions.concept,delete t.questionOptions.answers),t.datePickerFormat&&delete t.datePickerFormat,t})},[n,s]),g=(0,a.useCallback)(e=>{let t=`${e.type}:${e.value}`;c(t),n(e=>({...e,questionOptions:{...e.questionOptions,concept:t}}))},[n]),_=(0,a.useCallback)(()=>{c(null),i&&n(e=>({...e,questionOptions:{...e.questionOptions,concept:i.uuid}}))},[i,n]),f=(0,a.useMemo)(()=>i&&i.mappings?i.mappings.map(e=>{let t=e.display.split(": ");return{relationship:e.conceptMapType.display,type:t[0],value:t[1]}}):[],[i]),h=f.some(e=>"SAME-AS"===e.relationship);return l().createElement(o.Stack,{gap:5},l().createElement(O,{defaultConcept:t.questionOptions?.concept??null,onClearSelectedConcept:b,onSelectConcept:m,retainConceptInContextAfterSearch:!0}),i?.allowDecimal===!1&&l().createElement(o.InlineNotification,{kind:"info",lowContrast:!0,title:e("decimalsNotAllowed","This concept does not allow decimals")}),(i?.conceptClass?.display||i?.datatype?.display||i?.uuid)&&l().createElement(o.FormGroup,{legendText:""},l().createElement(o.FormLabel,{className:R},e("attributes","Attributes")),l().createElement("table",{className:M},l().createElement("thead",null,l().createElement("tr",null,l().createElement("th",null,e("attributes","Attributes")),l().createElement("th",null,e("value","Value")))),l().createElement("tbody",null,l().createElement("tr",null,l().createElement("td",null,e("class","Class")),l().createElement("td",null,i?.conceptClass?.display||"")),l().createElement("tr",null,l().createElement("td",null,e("datatype","Data Type")),l().createElement("td",null,i?.datatype?.display||"")),l().createElement("tr",null,l().createElement("td",null,e("conceptId","Concept ID")),l().createElement("td",null,i?.uuid||""))))),f.length>0&&l().createElement(o.FormGroup,{legendText:""},l().createElement(o.FormLabel,{className:R},e("mappings","Mappings")),l().createElement("table",{className:M},l().createElement("thead",null,l().createElement("tr",null,l().createElement("th",null,e("relationship","Relationship")),l().createElement("th",null,e("source","Source")),l().createElement("th",null,e("code","Code")),h&&l().createElement("th",null,e("select","Select")))),l().createElement("tbody",null,f.map((e,t)=>l().createElement("tr",{key:`mapping-${t}`},l().createElement("td",null,e.relationship),l().createElement("td",null,e.type),l().createElement("td",null,e.value),h&&l().createElement("td",null,"SAME-AS"===e.relationship&&l().createElement(o.Checkbox,{id:`checkbox-${t}`,labelText:"",checked:u===`${e.type}:${e.value}`,onChange:()=>{u===`${e.type}:${e.value}`?_():g(e)}}))))))))},$="-esm-form-builder__program-state-type-question__error___9EgYn",U={label:"-esm-form-builder__patient-identifier-type-question__label___SmDY6",loader:"-esm-form-builder__patient-identifier-type-question__loader___YH+ES"};var Q=n(92137);let G="-esm-form-builder__person-attribute-type-question__error___1c-uZ",z={obs:D,programState:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),{programs:i,programsLookupError:u,isLoadingPrograms:c}=function(){let e=`${s.restBaseUrl}/program?v=custom:(uuid,name,retired,allWorkflows)`,{data:t,error:n,isLoading:a}=E()(e,s.openmrsFetch);return{programs:t?t?.data?.results:[],programsLookupError:n,isLoadingPrograms:a}}(),[p,m]=(0,a.useState)(),[b,g]=(0,a.useState)(),[_,f]=(0,a.useState)([]),{programStates:h,programStatesLookupError:q,isLoadingProgramStates:y,mutateProgramStates:O}=function(e){let t=`${s.restBaseUrl}/workflow/${e}?v=custom:(uuid,retired,states,concept:(uuid,display))`,{data:n,error:a,isLoading:l,mutate:r}=E()(e?t:null,s.openmrsFetch);return{programStates:n?.data?.states??[],programStatesLookupError:a,isLoadingProgramStates:l,mutateProgramStates:r}}(b?.uuid),k=(0,a.useMemo)(()=>{if(!t.questionOptions?.answers||!h.length)return[];let e=new Set(t.questionOptions.answers.map(e=>e.value));return h.filter(t=>e.has(t.uuid))},[t.questionOptions?.answers,h]),C=(0,a.useCallback)(e=>{m(e),g(null),f(e?.allWorkflows??[]),n(t=>{if(e)return{...t,questionOptions:{...t.questionOptions,programUuid:e.uuid}};let n={...t.questionOptions};return delete n.programUuid,delete n.workflowUuid,delete n.answers,{...t,questionOptions:n}})},[n]),v=(0,a.useCallback)(e=>{g(e),O(),n(t=>{if(e)return{...t,questionOptions:{...t.questionOptions,workflowUuid:e.uuid}};let n={...t.questionOptions};return delete n.workflowUuid,delete n.answers,{...t,questionOptions:n}})},[O,n]),x=(0,a.useCallback)(e=>{n({...t,questionOptions:{...t.questionOptions,answers:e.selectedItems.map(e=>({value:e.uuid,label:e.concept.display}))}})},[t,n]);(0,a.useEffect)(()=>{let e=i.find(e=>e.uuid===t.questionOptions?.programUuid);if(e&&(m(e),f(e.allWorkflows),t.questionOptions.workflowUuid)){let n=e.allWorkflows.find(e=>e.uuid===t.questionOptions?.workflowUuid);n&&g(n)}},[t.questionOptions?.programUuid,t.questionOptions?.workflowUuid,i]);let T=(0,a.useCallback)(e=>e.concept.display,[]);return l().createElement(o.Stack,{gap:5},l().createElement(o.FormLabel,{className:"-esm-form-builder__program-state-type-question__label___2V95S"},e("selectProgram","Select a program")),u&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:$,title:e("errorFetchingPrograms","Error fetching programs"),subtitle:e("pleaseTryAgain","Please try again.")}),c?l().createElement(o.SelectSkeleton,null):i.length>0&&l().createElement(o.ComboBox,{id:"programLookup",items:i,itemToString:e=>e?.name,onChange:({selectedItem:e})=>{C(e)},placeholder:e("addProgram","Add program"),selectedItem:p,titleText:e("program","Program"),initialSelectedItem:i.find(e=>e?.uuid===t.questionOptions?.programUuid)}),p&&l().createElement(o.ComboBox,{id:"programWorkflowLookup",items:_,itemToString:e=>e?.concept?.display,onChange:({selectedItem:e})=>v(e),placeholder:e("addProgramWorkflow","Add program workflow"),selectedItem:b,titleText:e("programWorkflow","Program workflow"),initialSelectedItem:_.find(e=>e?.uuid===t.questionOptions?.workflowUuid)}),b&&l().createElement("div",null,q&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:$,title:e("errorFetchingProgramState","Error fetching program state"),subtitle:e("pleaseTryAgain","Please try again.")}),y?l().createElement(o.SelectSkeleton,null):h?.length>0&&l().createElement(o.MultiSelect,{titleText:e("programState","Program state"),id:"programState",items:h,itemToString:T,label:"",selectionFeedback:"top-after-reopen",onChange:x,selectedItems:k}),k?.map(e=>l().createElement("div",{key:e.uuid},l().createElement(o.Tag,{className:"-esm-form-builder__program-state-type-question__tag___-3SsZ",type:"blue"},e?.concept?.display)))))},patientIdentifier:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),{patientIdentifierTypes:i,patientIdentifierTypeLookupError:u,isLoadingPatientIdentifierTypes:c}=function(){let e=`${s.restBaseUrl}/patientidentifiertype?v=custom:(uuid,display,name,description)`,{data:t,error:n,isLoading:a}=E()(e,s.openmrsFetch);return{patientIdentifierTypes:t?.data?.results??[],patientIdentifierTypeLookupError:n,isLoadingPatientIdentifierTypes:a}}(),[p,m]=(0,a.useState)(t.questionOptions?.identifierType?i.find(e=>e.uuid===t.questionOptions.identifierType):null),b=(0,a.useCallback)(e=>e?.display??"",[]);return l().createElement("div",null,l().createElement(o.FormLabel,{className:U.label},e("searchForBackingPatientIdentifierType","Search for a backing patient identifier type")),u&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:U.error,title:e("errorFetchingPatientIdentifierTypes","Error fetching patient identifier types"),subtitle:e("pleaseTryAgain","Please try again.")}),c?l().createElement(o.InlineLoading,{className:U.loader,description:e("loading","Loading")+"..."}):l().createElement(o.ComboBox,{helperText:e("patientIdentifierTypeHelperText","Patient identifier type fields must be linked to a patient identifier type"),id:"patientIdentifierTypeLookup",items:i,itemToString:b,onChange:({selectedItem:e})=>{m(e),n({...t,questionOptions:{...t.questionOptions,identifierType:e.uuid}})},placeholder:e("choosePatientIdentifierType","Choose a patient identifier type"),selectedItem:p,initialSelectedItem:i.find(e=>e?.uuid===t.questionOptions?.identifierType)}))},obsGroup:D,testOrder:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),i=(0,a.useMemo)(()=>t.questionOptions?.selectableOrders||[],[t.questionOptions?.selectableOrders]),s=(0,a.useCallback)(e=>{n(t=>({...t,questionOptions:{...t.questionOptions,concept:e}}))},[n]),u=(0,a.useCallback)(()=>{let e={concept:"",label:""};n(t=>({...t,questionOptions:{...t.questionOptions,selectableOrders:[...i,e]}}))},[i,n]),c=(0,a.useCallback)(e=>{let t=i.filter((t,n)=>n!==e);n(e=>({...e,questionOptions:{...e.questionOptions,selectableOrders:t}}))},[i,n]),p=(0,a.useCallback)((e,t,a)=>{let l=i.map((n,l)=>l===e?{...n,[t]:a}:n);n(e=>({...e,questionOptions:{...e.questionOptions,selectableOrders:l}}))},[i,n]),m=(0,a.useCallback)((e,t)=>{p(e,"concept",t)},[p]);return l().createElement("div",{className:"-esm-form-builder__test-order-type-question__testOrderContainer___cUcd5"},l().createElement(O,{defaultConcept:t.questionOptions?.concept,onSelectConcept:e=>s(e.uuid)}),l().createElement(o.FormGroup,{legendText:e("selectableOrders","Selectable Orders")},l().createElement(o.Stack,{gap:4},i.map((t,n)=>l().createElement("div",{key:n,className:"-esm-form-builder__test-order-type-question__selectableOrderItem___y7bhc"},l().createElement("div",{className:"-esm-form-builder__test-order-type-question__orderFields___AzGqM"},l().createElement("div",{className:"-esm-form-builder__test-order-type-question__conceptField___hkC3C"},l().createElement(O,{defaultConcept:t.concept,onSelectConcept:e=>m(n,e.uuid)})),l().createElement(o.TextInput,{id:`order-label-${n}`,labelText:e("label","Label"),value:t.label,onChange:e=>p(n,"label",e.target.value),placeholder:e("enterOrderLabel","Enter order label")}),l().createElement(o.Button,{kind:"ghost",size:"md",renderIcon:T.zH,iconDescription:e("removeOrder","Remove order"),onClick:()=>c(n),className:"-esm-form-builder__test-order-type-question__removeButton___hdacf"})))),l().createElement(o.Button,{kind:"tertiary",size:"md",renderIcon:Q.OM,onClick:u,className:"-esm-form-builder__test-order-type-question__addButton___bN-V4"},e("addSelectableOrder","Add selectable order")))))},personAttribute:()=>{let{t:e}=(0,r.useTranslation)(),{formField:t,setFormField:n}=d(),{personAttributeTypes:i,personAttributeTypeLookupError:u,isLoadingPersonAttributeTypes:c}=function(){let e=`${s.restBaseUrl}/personattributetype?v=custom:(uuid,display,format,concept)`,{data:t,error:n,isLoading:a}=E()(e,s.openmrsFetch);return{personAttributeTypes:t?.data?.results??[],personAttributeTypeLookupError:n,isLoadingPersonAttributeTypes:a}}(),p=t.questionOptions?.attributeType,[m,b]=(0,a.useState)(null),[g,_]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(p&&i.length>0){let e=i.find(e=>e.uuid===p);e?(b(e),_(!1)):(b(null),_(!0))}else p||(b(null),_(!1))},[p,i]);let f=(0,a.useCallback)(e=>e?.display??"",[]);return l().createElement("div",null,l().createElement(o.FormLabel,{className:"-esm-form-builder__person-attribute-type-question__label___LosP2"},e("searchForBackingPersonAttributeType","Search for a backing person attribute type")),g&&l().createElement(o.InlineNotification,{kind:"warning",lowContrast:!0,className:G,title:e("invalidPersonAttributeType","Invalid person attribute type"),subtitle:e("personAttributeTypeNotFound","The configured person attribute type ({{uuid}}) was not found. It may have been deleted or retired.",{uuid:p})}),u&&l().createElement(o.InlineNotification,{kind:"error",lowContrast:!0,className:G,title:e("errorFetchingPersonAttributeTypes","Error fetching person attribute types"),subtitle:e("pleaseTryAgain","Please try again.")}),c?l().createElement(o.InlineLoading,{className:"-esm-form-builder__person-attribute-type-question__loader___lMIpa",description:e("loading","Loading")+"..."}):l().createElement(o.ComboBox,{disabled:!!u,helperText:e("personAttributeTypeHelperText","Person attribute type fields must be linked to a person attribute type"),id:"personAttributeTypeLookup",items:i,itemToString:f,onChange:({selectedItem:e})=>{b(e),n({...t,questionOptions:{...t.questionOptions,attributeType:e?.uuid}})},placeholder:e("choosePersonAttributeType","Choose a person attribute type"),selectedItem:m}))}},W=()=>{let{formField:e}=d(),t=z[e.type];return t?l().createElement(t,null):(console.error(`No component found for questiontype: ${e.type}`),null)},H=({isRequired:e,text:t,t:n})=>l().createElement(l().Fragment,null,l().createElement("span",null,t),e&&l().createElement("span",{title:n("required","Required"),className:"-esm-form-builder__required-label__required___at0FS"},"*")),V=({checkIfQuestionIdExists:e})=>{let{t}=(0,r.useTranslation)(),{formField:n,setFormField:i}=d(),[s,u]=(0,a.useState)(!!n?.questionInfo),c=(0,a.useCallback)(()=>e(n.id),[n.id,e]),p=(0,a.useCallback)(e=>{i(t=>{if("false"===e){let{questionInfo:e,...n}=t;return n}return t}),u("true"===e)},[i]),m=(0,a.useCallback)(e=>{let t=e.target.value;i(e=>e?.questionOptions?.rendering&&"obs"!==t&&!(N.includes(t)&&A[t]?.includes(e.questionOptions.rendering))?{...e,questionOptions:{...e.questionOptions,rendering:null},type:t}:{...e,type:t})},[i]),b=(0,a.useCallback)(e=>{i(t=>({...t,questionInfo:e.target.value}))},[i]);return l().createElement(o.Stack,{gap:5},n.questionOptions&&"markdown"!==n.questionOptions.rendering&&l().createElement(o.TextInput,{id:"questionLabel",labelText:l().createElement(H,{isRequired:!0,text:t("questionLabel","Label"),t:t}),placeholder:t("labelPlaceholder","e.g. Type of Anaesthesia"),value:n?.label,onChange:e=>i({...n,label:e.target.value}),required:!0}),l().createElement(o.TextInput,{id:"questionId",invalid:!!n?.id&&c(),invalidText:t("questionIdExists","This question ID already exists in your schema"),labelText:l().createElement("div",{className:"-esm-form-builder__question__questionIdLabel___-n8YP"},l().createElement("span",null,l().createElement(H,{isRequired:!0,text:t("questionId","Question ID"),t:t})),n?.label&&l().createElement(o.Button,{kind:"ghost",onClick:()=>{let e=n.label?.toLowerCase()?.replace(/(?:^\w|[A-Z]|\b\w)/g,(e,t)=>0===t?e.toLowerCase():e.toUpperCase()).replace(/\s+/g,"");i({...n,id:e})},size:"sm"},t("convertLabelToCamelCase","Convert label to camel-case"))),helperText:t("questionIdHelper","Prefer camel-case; must be unique within this form"),value:n?.id,onChange:e=>{i({...n,id:e.target.value})},placeholder:t("questionIdPlaceholder",'Enter a unique ID e.g. "anaesthesiaType" for a question asking about the type of anaesthesia.'),required:!0}),l().createElement(o.Select,{value:n?.type??"control",onChange:m,id:"questionType",invalidText:t("typeRequired","Type is required"),labelText:l().createElement(H,{isRequired:!0,text:t("questionType","Question type"),t:t}),required:!0},!n?.type&&l().createElement(o.SelectItem,{text:t("chooseQuestionType","Choose a question type"),value:""}),N.map((e,t)=>l().createElement(o.SelectItem,{text:e,value:e,key:t}))),l().createElement(o.Select,{value:n?.questionOptions?.rendering,onChange:e=>{i(null===n?{...n,questionOptions:{rendering:e.target.value}}:{...n,questionOptions:{...n.questionOptions,rendering:e.target.value}})},id:"renderingType",invalidText:t("validRenderingTypeRequired","A valid rendering type value is required"),labelText:l().createElement(H,{isRequired:!0,text:t("renderingType","Rendering type"),t:t}),required:!0},!n.questionOptions?.rendering&&l().createElement(o.SelectItem,{text:t("chooseRenderingType","Choose a rendering type"),value:""}),n.type&&"obs"!==n.type&&N.includes(n.type)?A[n?.type].map((e,t)=>l().createElement(o.SelectItem,{key:`${e}-${t}`,text:e,value:e})):L.map((e,t)=>l().createElement(o.SelectItem,{key:t,text:e,value:e}))),n.questionOptions&&"markdown"!==n.questionOptions.rendering&&l().createElement(l().Fragment,null,l().createElement(o.RadioButtonGroup,{name:"isQuestionRequired",legendText:t("isQuestionRequiredOrOptional","Is this question a required or optional field? Required fields must be answered before the form can be submitted.")},l().createElement(o.RadioButton,{id:"questionIsNotRequired",checked:!n.required||!n.required,labelText:t("optional","Optional"),onClick:()=>i({...n,required:!1}),value:"optional"}),l().createElement(o.RadioButton,{id:"questionIsRequired",checked:!!n.required,labelText:t("required","Required"),onClick:()=>i({...n,required:!0}),value:"required"}))),n.type&&l().createElement(W,null),n.questionOptions?.rendering&&l().createElement(B,null),l().createElement(o.RadioButtonGroup,{name:"isQuestionInfoProvided",legendText:t("isQuestionInfoProvided","Would you like to provide additional details about the question?")},l().createElement(o.RadioButton,{id:"questionInfoProvided",checked:!!n?.questionInfo,labelText:t("yes","Yes"),onClick:()=>p("true"),value:"true"}),l().createElement(o.RadioButton,{id:"questionInfoNotProvided",checked:!n?.questionInfo,labelText:t("no","No"),onClick:()=>p("false"),value:"false"})),s&&l().createElement(o.TextInput,{id:"questionInfo",labelText:t("questionInfo","Additional Question Info"),placeholder:t("questionInfoPlaceholder","Enter any relevant info about the question to provide more context."),value:n?.questionInfo,onChange:b}))},Y=e=>e?(0,i.A)(e.map(e=>[e.id,Y(e.questions)])):[],j=({formField:e,closeModal:t,schema:n,pageIndex:i,sectionIndex:u,questionIndex:p,subQuestionIndex:m,onSchemaChange:b})=>{let{t:g}=(0,r.useTranslation)(),{formField:_,setFormField:f,isConceptValid:h}=d(),q=(0,a.useCallback)(t=>{let a=n?.pages?.flatMap(e=>e?.sections?.flatMap(e=>Y(e.questions)))||[],l=_?.questions?Y(_.questions):[];l.push(_.id);let r=e&&""!==e.id?Y(e.questions):[];e&&""!==e.id&&r.push(e.id);let i=a.slice();return r.forEach(e=>{let t=i.indexOf(e);-1!==t&&i.splice(t,1)}),[...i,...l].filter(e=>e===t).length>1},[n,_,e]),E=(0,a.useCallback)(()=>{let e={type:"",questionOptions:void 0,id:""};f(t=>({...t,questions:t.questions?[...t.questions,e]:[e]}))},[f]),y=(0,a.useCallback)(e=>{f(t=>({...t,questions:t.questions?.filter((t,n)=>n!==e)||[]}))},[f]),O=(0,a.useCallback)((e,t)=>{f(n=>{let a=[...n.questions];return a[t]=e,{...n,questions:a}})},[f]);return l().createElement(l().Fragment,null,l().createElement(o.ModalHeader,{closeModal:t,title:e?g("editQuestion","Edit question"):g("createNewQuestion","Create a new question")}),l().createElement(o.Form,{className:"-esm-form-builder__question__form___e4c8f",onSubmit:e=>e.preventDefault()},l().createElement(o.ModalBody,{hasScrollingContent:!0},l().createElement(o.FormGroup,{legendText:""},l().createElement(o.Stack,{gap:5},l().createElement(V,{checkIfQuestionIdExists:q}),_.questions?.length>=1&&l().createElement(o.Accordion,{size:"lg"},_.questions.map((e,t)=>l().createElement(o.AccordionItem,{key:`Question ${t+1}`,title:e.label??`Question ${t+1}`,open:t===_.questions?.length-1,className:"-esm-form-builder__question__obsGroupQuestionContent___Bo56I"},l().createElement(c,{initialFormField:e,isObsGrouped:!0,updateParentFormField:e=>O(e,t)},l().createElement(V,{checkIfQuestionIdExists:q}),l().createElement(o.Button,{kind:"danger",onClick:()=>y(t),className:"-esm-form-builder__question__deleteObsGroupQuestionButton___wskSy"},g("deleteQuestion","Delete question")))))),"obsGroup"===_.type&&l().createElement(o.Button,{kind:"tertiary",size:"sm",onClick:E},g("addObsGroupQuestion","Add a grouped question"))))),l().createElement(o.ModalFooter,null,l().createElement(o.Button,{onClick:t,kind:"secondary"},g("cancel","Cancel")),l().createElement(o.Button,{disabled:!_||!_.id||!h||"obs"===_.type&&(!_.questionOptions?.concept||_.questionOptions?.concept==="")||!_.questions&&q(_.id)||!_.questionOptions?.rendering,onClick:()=>{try{e?null!=m?n.pages[i].sections[u].questions[p].questions[m]=_:n.pages[i].sections[u].questions[p]=_:n.pages[i]?.sections?.[u]?.questions?.push(_),b({...n}),(0,s.showSnackbar)({title:g("success","Success!"),kind:"success",isLowContrast:!0,subtitle:e?g("questionUpdated","Question updated"):g("questionCreated","New question created")})}catch(e){e instanceof Error&&(0,s.showSnackbar)({title:g("errorSavingQuestion","Error saving question"),kind:"error",subtitle:e?.message})}t()}},l().createElement("span",null,g("save","Save"))))))},J=e=>l().createElement(l().Fragment,null,l().createElement(c,{initialFormField:e.formField??{type:"control",questionOptions:{rendering:"text"},id:""}},l().createElement(j,e)))}}]);
|
package/dist/9316.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).push([["9316"],{83519(e,t,r){r.r(t),r.d(t,{default:()=>m});var a=r(47499),o=r.n(a),l=r(58779),n=r(14968),c=r(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).push([["9316"],{83519(e,t,r){r.r(t),r.d(t,{default:()=>m});var a=r(47499),o=r.n(a),l=r(58779),n=r(14968),c=r(23365);let m=({schema:e,onSchemaChange:t,closeModal:r})=>{let{t:m}=(0,l.useTranslation)(),[s,i]=(0,a.useState)(""),[u,d]=(0,a.useState)("");return o().createElement(o().Fragment,null,o().createElement(n.ModalHeader,{closeModal:r,title:m("createNewForm","Create a new form")}),o().createElement(n.Form,{onSubmit:e=>e.preventDefault()},o().createElement(n.ModalBody,null,o().createElement(n.Stack,{gap:5},o().createElement(n.FormGroup,{legendText:""},o().createElement(n.TextInput,{id:"formName",labelText:m("formName","Form Name"),placeholder:m("namePlaceholder","What the form is called in the system"),value:s,onChange:e=>i(e.target.value)})),o().createElement(n.FormGroup,{legendText:""},o().createElement(n.TextInput,{id:"formDescription",labelText:m("formDescription","Form description"),placeholder:m("formDescriptionPlaceholder","A short description of the form e.g. A form for collecting COVID-19 symptoms"),value:u,onChange:e=>d(e.target.value)}))))),o().createElement(n.ModalFooter,null,o().createElement(n.Button,{kind:"secondary",onClick:r},m("cancel","Cancel")),o().createElement(n.Button,{disabled:!s,onClick:()=>{if(s){try{let r={...e,name:s,description:u};t(r),(0,c.showSnackbar)({title:m("success","Success!"),kind:"success",isLowContrast:!0,subtitle:m("formCreated","New form created")})}catch(e){e instanceof Error&&(0,c.showSnackbar)({title:m("errorCreatingForm","Error creating form"),kind:"error",subtitle:e?.message})}r()}}},o().createElement("span",null,m("createForm","Create Form")))))}}}]);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var _openmrs_esm_form_builder_app;!function(){var e="u">typeof globalThis?globalThis:self;if(void 0===e._FEDERATION_RUNTIME_CORE||void 0===e._OPENMRS_FEDERATION_SDK||void 0===e._OPENMRS_FEDERATION_ERROR_CODES)throw Error("@openmrs/esm-form-builder-app cannot start: the OpenMRS app shell serving this page does not provide the Module Federation runtime. This app was built with newer OpenMRS tooling than the app shell, so either upgrade @openmrs/esm-app-shell, or rebuild this app with tooling matching the app shell.");var t=e._FEDERATION_RUNTIME_CORE_FROM;t&&t.version&&"2.8"!==String(t.version).split(".").slice(0,2).join(".")&&console.warn("@openmrs/esm-form-builder-app was built against Module Federation 2.8.x but the app shell provides "+t.version+". Shared dependencies may not de-duplicate correctly.")}(),(()=>{var e,t,r,n,o,i={89672(e,t,r){"use strict";var n,o,i,a,s,l,u,p,c,d,f,h,m=r(37032),g=r.n(m);let b=[].filter(({plugin:e})=>e).map(({plugin:e,params:t})=>e(t)),y={};if((r.initializeSharingData||r.initializeExposesData)&&r.federation){let e=(e,t,r)=>{e&&e[t]&&(e[t]=r)},t=(e,t,r)=>{let n=r();Array.isArray(n)?(null!=e[t]||(e[t]=[]),e[t].push(...n)):"object"==typeof n&&null!==n&&(null!=e[t]||(e[t]={}),Object.assign(e[t],n))},m=(e,t,r)=>{null!=e[t]||(e[t]=r())},S=null!=(n=null==(l=r.remotesLoadingData)?void 0:l.chunkMapping)?n:{},E=null!=(o=null==(u=r.remotesLoadingData)?void 0:u.moduleIdToRemoteDataMapping)?o:{},_=null!=(i=null==(p=r.initializeSharingData)?void 0:p.scopeToSharingDataMapping)?i:{},O=null!=(a=null==(c=r.consumesLoadingData)?void 0:c.chunkMapping)?a:{},M=null!=(s=null==(d=r.consumesLoadingData)?void 0:d.moduleIdToConsumeDataMapping)?s:{},v={},R=[],T={},w=null==(f=r.initializeExposesData)?void 0:f.shareScope;for(let e in g())r.federation[e]=g()[e];m(r.federation,"consumesLoadingModuleToHandlerMapping",()=>{let e={};for(let[t,r]of Object.entries(M))e[t]={getter:r.fallback,shareInfo:{shareConfig:{fixedDependencies:!1,requiredVersion:r.requiredVersion,strictVersion:r.strictVersion,singleton:r.singleton,eager:r.eager},scope:[r.shareScope]},shareKey:r.shareKey};return e}),m(r.federation,"initOptions",()=>({})),m(r.federation.initOptions,"name",()=>"@openmrs/esm-form-builder-app"),m(r.federation.initOptions,"shareStrategy",()=>"version-first"),m(r.federation.initOptions,"shared",()=>{let e={};for(let[t,r]of Object.entries(_))for(let n of r)if("object"==typeof n&&null!==n){let{name:r,version:o,factory:i,eager:a,singleton:s,requiredVersion:l,strictVersion:u}=n,p={},c=function(e){return void 0!==e};c(s)&&(p.singleton=s),c(l)&&(p.requiredVersion=l),c(a)&&(p.eager=a),c(u)&&(p.strictVersion=u);let d={version:o,scope:[t],shareConfig:p,get:i};e[r]?e[r].push(d):e[r]=[d]}return e}),t(r.federation.initOptions,"remotes",()=>Object.values(y).flat().filter(e=>"script"===e.externalType)),t(r.federation.initOptions,"plugins",()=>b),m(r.federation,"bundlerRuntimeOptions",()=>({})),m(r.federation.bundlerRuntimeOptions,"remotes",()=>({})),m(r.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>S),m(r.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>y),m(r.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{let e={};for(let[t,r]of Object.entries(E))e[t]=[r.shareScope,r.name,r.externalModuleId,r.remoteName];return e}),m(r.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>r),t(r.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{let e={};for(let[t,r]of Object.entries(E)){let n=y[r.remoteName];n&&(e[t]=n)}return e}),e(r,"S",r.federation.bundlerRuntime.S),r.federation.attachShareScopeMap&&r.federation.attachShareScopeMap(r),e(r.f,"remotes",(e,t)=>r.federation.bundlerRuntime.remotes({chunkId:e,promises:t,chunkMapping:S,idToExternalAndNameMapping:r.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:r.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:r})),e(r.f,"consumes",(e,t)=>r.federation.bundlerRuntime.consumes({chunkId:e,promises:t,chunkMapping:O,moduleToHandlerMapping:r.federation.consumesLoadingModuleToHandlerMapping,installedModules:v,webpackRequire:r})),e(r,"I",(e,t)=>r.federation.bundlerRuntime.I({shareScopeName:e,initScope:t,initPromises:R,initTokens:T,webpackRequire:r})),e(r,"initContainer",(e,t,n)=>r.federation.bundlerRuntime.initContainerEntry({shareScope:e,initScope:t,remoteEntryInitOptions:n,shareScopeKey:w,webpackRequire:r})),e(r,"getContainer",(e,t)=>{var n=r.initializeExposesData.moduleMap;return r.R=t,t=Object.prototype.hasOwnProperty.call(n,e)?n[e]():Promise.resolve().then(()=>{throw Error('Module "'+e+'" does not exist in container.')}),r.R=void 0,t}),r.federation.instance=r.federation.runtime.init(r.federation.initOptions),(null==(h=r.consumesLoadingData)?void 0:h.initialConsumes)&&r.federation.bundlerRuntime.installInitialConsumes({webpackRequire:r,installedModules:v,initialConsumes:r.consumesLoadingData.initialConsumes,moduleToHandlerMapping:r.federation.consumesLoadingModuleToHandlerMapping})}},22448(e,t,r){"use strict";r.d(t,{get:()=>r.getContainer,init:()=>r.initContainer})},53054(e){"use strict";e.exports=globalThis._FEDERATION_RUNTIME_CORE},9170(e){"use strict";e.exports=globalThis._OPENMRS_FEDERATION_ERROR_CODES},31853(e){"use strict";e.exports=globalThis._OPENMRS_FEDERATION_SDK},19369(e,t){var r=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;t.__toESM=(e,t,l)=>(l=null!=e?r(a(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,l=i(t),u=0,p=l.length;u<p;u++)a=l[u],s.call(e,a)||void 0===a||n(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=o(t,a))||r.enumerable});return e})(!t&&e&&e.__esModule?l:n(l,"default",{value:e,enumerable:!0}),e))},51222(e,t,r){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),r(19369);let n=r(81146),o=r(53054),i={...o.helpers.global,getGlobalFederationInstance:n.getGlobalFederationInstance},a=o.helpers.share,s=o.helpers.utils;t.default={global:i,share:a,utils:s},t.global=i,t.share=a,t.utils=s},67201(e,t,r){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),r(19369);let n=r(81146),o=r(53054),i=r(9170);function a(e){let t=new((0,o.getGlobalFederationConstructor)()||o.ModuleFederation)({id:`${e.name}@${e.version||Date.now()}`,...e});return(0,o.setGlobalFederationInstance)(t),t}let s=null;(0,o.setGlobalFederationConstructor)(o.ModuleFederation),Object.defineProperty(t,"Module",{enumerable:!0,get:function(){return o.Module}}),t.ModuleFederation=o.ModuleFederation,t.createInstance=a,t.getInstance=function(e){return e?o.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(e)||null:s},Object.defineProperty(t,"getRemoteEntry",{enumerable:!0,get:function(){return o.getRemoteEntry}}),Object.defineProperty(t,"getRemoteInfo",{enumerable:!0,get:function(){return o.getRemoteInfo}}),t.init=function(e){let t=n.getGlobalFederationInstance(e.name,e.version),r={...e,id:e.id||""};return t?(t.initOptions(r),s||(s=t),t):s=a(r)},t.loadRemote=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.loadRemote.apply(s,e)},Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return o.loadScript}}),Object.defineProperty(t,"loadScriptNode",{enumerable:!0,get:function(){return o.loadScriptNode}}),t.loadShare=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.loadShare.apply(s,e)},t.loadShareSync=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.loadShareSync.apply(s,e)},t.preloadRemote=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.preloadRemote.apply(s,e)},Object.defineProperty(t,"registerGlobalPlugins",{enumerable:!0,get:function(){return o.registerGlobalPlugins}}),t.registerPlugins=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.registerPlugins.apply(s,e)},t.registerRemotes=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.registerRemotes.apply(s,e)},t.registerShared=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.registerShared.apply(s,e)}},81146(e,t,r){r(19369);let n=r(53054);t.getGlobalFederationInstance=function(e,t){let r="@openmrs/esm-form-builder-app:3.5.2-pre.3900";return n.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(n=>!!r&&n.options.id===r||n.options.name===e&&!n.options.version&&!t||n.options.name===e&&!!t&&n.options.version===t)}},41326(e,t){var r=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;t.__toESM=(e,t,l)=>(l=null!=e?r(a(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,l=i(t),u=0,p=l.length;u<p;u++)a=l[u],s.call(e,a)||void 0===a||n(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=o(t,a))||r.enumerable});return e})(!t&&e&&e.__esModule?l:n(l,"default",{value:e,enumerable:!0}),e))},3026(e,t){t.attachShareScopeMap=function(e){e.S&&!e.federation.hasAttachShareScopeMap&&e.federation.instance&&e.federation.instance.shareScopeMap&&(e.S=e.federation.instance.shareScopeMap,e.federation.hasAttachShareScopeMap=!0)}},59592(e,t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t.FEDERATION_SUPPORTED_TYPES=["script"]},55769(e,t,r){let n=r(3026),o=r(39671),i=r(69864),a=r(29296),s=r(2742);t.consumes=function(e){o.updateConsumeOptions(e);let{chunkId:t,promises:r,installedModules:l,webpackRequire:u,chunkMapping:p,moduleToHandlerMapping:c}=e;n.attachShareScopeMap(u),u.o(p,t)&&p[t].forEach(e=>{if(u.o(l,e))return r.push(l[e]);let t=t=>{l[e]=0,u.m[e]=r=>{delete u.c[e];let n=t(),{shareInfo:o}=c[e];if(o?.shareConfig?.layer&&n&&"object"==typeof n)try{n.hasOwnProperty("layer")&&void 0!==n.layer||(n.layer=o.shareConfig.layer)}catch(e){}r.exports=n}},n=t=>{delete l[e],u.m[e]=r=>{throw delete u.c[e],t}};try{let o=u.federation.instance;if(!o)throw Error("Federation instance not found!");let{shareKey:p,getter:d,shareInfo:f,treeShakingGetter:h}=c[e],m=i.getUsedExports(u,p),g={...f};Array.isArray(g.scope)&&Array.isArray(g.scope[0])&&(g.scope=g.scope[0]),m&&(g.treeShaking={usedExports:m,useIn:[o.options.name]});let b=o.loadShare(p,{customShareInfo:g}).then(e=>{if(!1===e){if("function"!=typeof d)throw Error(s.getShortErrorMsg(a.RUNTIME_012,{[a.RUNTIME_012]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'},{shareKey:p}));return h?.()||d()}return e});b.then?r.push(l[e]=b.then(t).catch(n)):t(b)}catch(e){n(e)}})}},29296(e,t){t.RUNTIME_012="RUNTIME-012"},2742(e,t){t.getShortErrorMsg=(e,t,r,n)=>{let o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`),n&&o.push(`Original Error Message:
|
|
1
|
+
var _openmrs_esm_form_builder_app;!function(){var e="u">typeof globalThis?globalThis:self;if(void 0===e._FEDERATION_RUNTIME_CORE||void 0===e._OPENMRS_FEDERATION_SDK||void 0===e._OPENMRS_FEDERATION_ERROR_CODES)throw Error("@openmrs/esm-form-builder-app cannot start: the OpenMRS app shell serving this page does not provide the Module Federation runtime. This app was built with newer OpenMRS tooling than the app shell, so either upgrade @openmrs/esm-app-shell, or rebuild this app with tooling matching the app shell.");var t=e._FEDERATION_RUNTIME_CORE_FROM;t&&t.version&&"2.8"!==String(t.version).split(".").slice(0,2).join(".")&&console.warn("@openmrs/esm-form-builder-app was built against Module Federation 2.8.x but the app shell provides "+t.version+". Shared dependencies may not de-duplicate correctly.")}(),(()=>{var e,t,r,n,o,i={89672(e,t,r){"use strict";var n,o,i,a,s,l,u,p,c,d,f,h,m=r(37032),g=r.n(m);let b=[].filter(({plugin:e})=>e).map(({plugin:e,params:t})=>e(t)),y={};if((r.initializeSharingData||r.initializeExposesData)&&r.federation){let e=(e,t,r)=>{e&&e[t]&&(e[t]=r)},t=(e,t,r)=>{let n=r();Array.isArray(n)?(null!=e[t]||(e[t]=[]),e[t].push(...n)):"object"==typeof n&&null!==n&&(null!=e[t]||(e[t]={}),Object.assign(e[t],n))},m=(e,t,r)=>{null!=e[t]||(e[t]=r())},S=null!=(n=null==(l=r.remotesLoadingData)?void 0:l.chunkMapping)?n:{},E=null!=(o=null==(u=r.remotesLoadingData)?void 0:u.moduleIdToRemoteDataMapping)?o:{},_=null!=(i=null==(p=r.initializeSharingData)?void 0:p.scopeToSharingDataMapping)?i:{},O=null!=(a=null==(c=r.consumesLoadingData)?void 0:c.chunkMapping)?a:{},M=null!=(s=null==(d=r.consumesLoadingData)?void 0:d.moduleIdToConsumeDataMapping)?s:{},v={},R=[],T={},w=null==(f=r.initializeExposesData)?void 0:f.shareScope;for(let e in g())r.federation[e]=g()[e];m(r.federation,"consumesLoadingModuleToHandlerMapping",()=>{let e={};for(let[t,r]of Object.entries(M))e[t]={getter:r.fallback,shareInfo:{shareConfig:{fixedDependencies:!1,requiredVersion:r.requiredVersion,strictVersion:r.strictVersion,singleton:r.singleton,eager:r.eager},scope:[r.shareScope]},shareKey:r.shareKey};return e}),m(r.federation,"initOptions",()=>({})),m(r.federation.initOptions,"name",()=>"@openmrs/esm-form-builder-app"),m(r.federation.initOptions,"shareStrategy",()=>"version-first"),m(r.federation.initOptions,"shared",()=>{let e={};for(let[t,r]of Object.entries(_))for(let n of r)if("object"==typeof n&&null!==n){let{name:r,version:o,factory:i,eager:a,singleton:s,requiredVersion:l,strictVersion:u}=n,p={},c=function(e){return void 0!==e};c(s)&&(p.singleton=s),c(l)&&(p.requiredVersion=l),c(a)&&(p.eager=a),c(u)&&(p.strictVersion=u);let d={version:o,scope:[t],shareConfig:p,get:i};e[r]?e[r].push(d):e[r]=[d]}return e}),t(r.federation.initOptions,"remotes",()=>Object.values(y).flat().filter(e=>"script"===e.externalType)),t(r.federation.initOptions,"plugins",()=>b),m(r.federation,"bundlerRuntimeOptions",()=>({})),m(r.federation.bundlerRuntimeOptions,"remotes",()=>({})),m(r.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>S),m(r.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>y),m(r.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{let e={};for(let[t,r]of Object.entries(E))e[t]=[r.shareScope,r.name,r.externalModuleId,r.remoteName];return e}),m(r.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>r),t(r.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{let e={};for(let[t,r]of Object.entries(E)){let n=y[r.remoteName];n&&(e[t]=n)}return e}),e(r,"S",r.federation.bundlerRuntime.S),r.federation.attachShareScopeMap&&r.federation.attachShareScopeMap(r),e(r.f,"remotes",(e,t)=>r.federation.bundlerRuntime.remotes({chunkId:e,promises:t,chunkMapping:S,idToExternalAndNameMapping:r.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:r.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:r})),e(r.f,"consumes",(e,t)=>r.federation.bundlerRuntime.consumes({chunkId:e,promises:t,chunkMapping:O,moduleToHandlerMapping:r.federation.consumesLoadingModuleToHandlerMapping,installedModules:v,webpackRequire:r})),e(r,"I",(e,t)=>r.federation.bundlerRuntime.I({shareScopeName:e,initScope:t,initPromises:R,initTokens:T,webpackRequire:r})),e(r,"initContainer",(e,t,n)=>r.federation.bundlerRuntime.initContainerEntry({shareScope:e,initScope:t,remoteEntryInitOptions:n,shareScopeKey:w,webpackRequire:r})),e(r,"getContainer",(e,t)=>{var n=r.initializeExposesData.moduleMap;return r.R=t,t=Object.prototype.hasOwnProperty.call(n,e)?n[e]():Promise.resolve().then(()=>{throw Error('Module "'+e+'" does not exist in container.')}),r.R=void 0,t}),r.federation.instance=r.federation.runtime.init(r.federation.initOptions),(null==(h=r.consumesLoadingData)?void 0:h.initialConsumes)&&r.federation.bundlerRuntime.installInitialConsumes({webpackRequire:r,installedModules:v,initialConsumes:r.consumesLoadingData.initialConsumes,moduleToHandlerMapping:r.federation.consumesLoadingModuleToHandlerMapping})}},22448(e,t,r){"use strict";r.d(t,{get:()=>r.getContainer,init:()=>r.initContainer})},53054(e){"use strict";e.exports=globalThis._FEDERATION_RUNTIME_CORE},9170(e){"use strict";e.exports=globalThis._OPENMRS_FEDERATION_ERROR_CODES},31853(e){"use strict";e.exports=globalThis._OPENMRS_FEDERATION_SDK},19369(e,t){var r=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;t.__toESM=(e,t,l)=>(l=null!=e?r(a(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,l=i(t),u=0,p=l.length;u<p;u++)a=l[u],s.call(e,a)||void 0===a||n(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=o(t,a))||r.enumerable});return e})(!t&&e&&e.__esModule?l:n(l,"default",{value:e,enumerable:!0}),e))},51222(e,t,r){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),r(19369);let n=r(81146),o=r(53054),i={...o.helpers.global,getGlobalFederationInstance:n.getGlobalFederationInstance},a=o.helpers.share,s=o.helpers.utils;t.default={global:i,share:a,utils:s},t.global=i,t.share=a,t.utils=s},67201(e,t,r){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),r(19369);let n=r(81146),o=r(53054),i=r(9170);function a(e){let t=new((0,o.getGlobalFederationConstructor)()||o.ModuleFederation)({id:`${e.name}@${e.version||Date.now()}`,...e});return(0,o.setGlobalFederationInstance)(t),t}let s=null;(0,o.setGlobalFederationConstructor)(o.ModuleFederation),Object.defineProperty(t,"Module",{enumerable:!0,get:function(){return o.Module}}),t.ModuleFederation=o.ModuleFederation,t.createInstance=a,t.getInstance=function(e){return e?o.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(e)||null:s},Object.defineProperty(t,"getRemoteEntry",{enumerable:!0,get:function(){return o.getRemoteEntry}}),Object.defineProperty(t,"getRemoteInfo",{enumerable:!0,get:function(){return o.getRemoteInfo}}),t.init=function(e){let t=n.getGlobalFederationInstance(e.name,e.version),r={...e,id:e.id||""};return t?(t.initOptions(r),s||(s=t),t):s=a(r)},t.loadRemote=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.loadRemote.apply(s,e)},Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return o.loadScript}}),Object.defineProperty(t,"loadScriptNode",{enumerable:!0,get:function(){return o.loadScriptNode}}),t.loadShare=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.loadShare.apply(s,e)},t.loadShareSync=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.loadShareSync.apply(s,e)},t.preloadRemote=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.preloadRemote.apply(s,e)},Object.defineProperty(t,"registerGlobalPlugins",{enumerable:!0,get:function(){return o.registerGlobalPlugins}}),t.registerPlugins=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.registerPlugins.apply(s,e)},t.registerRemotes=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.registerRemotes.apply(s,e)},t.registerShared=function(...e){return(0,o.assert)(s,i.RUNTIME_009,i.runtimeDescMap),s.registerShared.apply(s,e)}},81146(e,t,r){r(19369);let n=r(53054);t.getGlobalFederationInstance=function(e,t){let r="@openmrs/esm-form-builder-app:3.5.2-pre.3902";return n.CurrentGlobal.__FEDERATION__.__INSTANCES__.find(n=>!!r&&n.options.id===r||n.options.name===e&&!n.options.version&&!t||n.options.name===e&&!!t&&n.options.version===t)}},41326(e,t){var r=Object.create,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;t.__toESM=(e,t,l)=>(l=null!=e?r(a(e)):{},((e,t,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var a,l=i(t),u=0,p=l.length;u<p;u++)a=l[u],s.call(e,a)||void 0===a||n(e,a,{get:(e=>t[e]).bind(null,a),enumerable:!(r=o(t,a))||r.enumerable});return e})(!t&&e&&e.__esModule?l:n(l,"default",{value:e,enumerable:!0}),e))},3026(e,t){t.attachShareScopeMap=function(e){e.S&&!e.federation.hasAttachShareScopeMap&&e.federation.instance&&e.federation.instance.shareScopeMap&&(e.S=e.federation.instance.shareScopeMap,e.federation.hasAttachShareScopeMap=!0)}},59592(e,t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t.FEDERATION_SUPPORTED_TYPES=["script"]},55769(e,t,r){let n=r(3026),o=r(39671),i=r(69864),a=r(29296),s=r(2742);t.consumes=function(e){o.updateConsumeOptions(e);let{chunkId:t,promises:r,installedModules:l,webpackRequire:u,chunkMapping:p,moduleToHandlerMapping:c}=e;n.attachShareScopeMap(u),u.o(p,t)&&p[t].forEach(e=>{if(u.o(l,e))return r.push(l[e]);let t=t=>{l[e]=0,u.m[e]=r=>{delete u.c[e];let n=t(),{shareInfo:o}=c[e];if(o?.shareConfig?.layer&&n&&"object"==typeof n)try{n.hasOwnProperty("layer")&&void 0!==n.layer||(n.layer=o.shareConfig.layer)}catch(e){}r.exports=n}},n=t=>{delete l[e],u.m[e]=r=>{throw delete u.c[e],t}};try{let o=u.federation.instance;if(!o)throw Error("Federation instance not found!");let{shareKey:p,getter:d,shareInfo:f,treeShakingGetter:h}=c[e],m=i.getUsedExports(u,p),g={...f};Array.isArray(g.scope)&&Array.isArray(g.scope[0])&&(g.scope=g.scope[0]),m&&(g.treeShaking={usedExports:m,useIn:[o.options.name]});let b=o.loadShare(p,{customShareInfo:g}).then(e=>{if(!1===e){if("function"!=typeof d)throw Error(s.getShortErrorMsg(a.RUNTIME_012,{[a.RUNTIME_012]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'},{shareKey:p}));return h?.()||d()}return e});b.then?r.push(l[e]=b.then(t).catch(n)):t(b)}catch(e){n(e)}})}},29296(e,t){t.RUNTIME_012="RUNTIME-012"},2742(e,t){t.getShortErrorMsg=(e,t,r,n)=>{let o=[`${[t[e]]} #${e}`];return r&&o.push(`args: ${JSON.stringify(r)}`),o.push(`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`),n&&o.push(`Original Error Message:
|
|
2
2
|
${n}`),o.join("\n")}},42176(e,t){t.getSharedFallbackGetter=({shareKey:e,factory:t,version:r,webpackRequire:n,libraryType:o="global"})=>{let{runtime:i,instance:a,bundlerRuntime:s,sharedFallback:l}=n.federation;if(!l)return t;let u=l[e];if(!u)return t;let p=r?u.find(e=>e[1]===r):u[0];if(!p)throw Error(`No fallback item found for shareKey: ${e} and version: ${r}`);return()=>i.getRemoteEntry({origin:n.federation.instance,remoteInfo:{name:p[2],entry:`${n.p}${p[0]}`,type:o,entryGlobalName:p[2],shareScope:"default"}}).then(t=>{if(!t)throw Error(`Failed to load fallback entry for shareKey: ${e} and version: ${r}`);return t.init(n.federation.instance,s).then(()=>t.get())})}},69864(e,t){t.getUsedExports=function(e,t){let r=e.federation.usedExports;if(r)return r[t]}},37032(e,t,r){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let n=r(41326),o=r(3026),i=r(95313),a=r(55769),s=r(32614),l=r(8066),u=r(38593),p=r(76554),c=r(42176),d=r(67201);d=n.__toESM(d);let f={remotes:i.remotes,consumes:a.consumes,I:s.initializeSharing,S:{},installInitialConsumes:l.installInitialConsumes,initContainerEntry:u.initContainerEntry,init:p.init,getSharedFallbackGetter:c.getSharedFallbackGetter},h={runtime:d,instance:void 0,initOptions:void 0,bundlerRuntime:f,attachShareScopeMap:o.attachShareScopeMap,bundlerRuntimeOptions:{}},m=h.instance,g=h.initOptions,b=h.bundlerRuntimeOptions;t.attachShareScopeMap=o.attachShareScopeMap,t.bundlerRuntime=f,t.bundlerRuntimeOptions=b,t.default=h,t.initOptions=g,t.instance=m,Object.defineProperty(t,"runtime",{enumerable:!0,get:function(){return d}})},76554(e,t,r){let n=r(41326),o=r(67201),i=r(51222);i=n.__toESM(i),t.init=function({webpackRequire:e}){let{initOptions:t,runtime:n,sharedFallback:a,bundlerRuntime:s,libraryType:l}=e.federation;if(!t)throw Error("initOptions is required!");return t.plugins||=[],t.plugins.push({name:"tree-shake-plugin",beforeInit(t){let{userOptions:n,origin:u,options:p}=t,c=n.version||p.version;if(!a)return t;let d=n.shared||{},f=[];Object.keys(d).forEach(t=>{(Array.isArray(d[t])?d[t]:[d[t]]).forEach(r=>{f.push([t,r]),"get"in r&&(r.treeShaking||={},r.treeShaking.get=r.get,r.get=s.getSharedFallbackGetter({shareKey:t,factory:r.get,webpackRequire:e,libraryType:l,version:r.version}))})});let h=i.default.global.getGlobalSnapshotInfoByModuleInfo({name:u.name,version:c});return h&&"shared"in h&&(Object.keys(p.shared||{}).forEach(e=>{p.shared[e].forEach(t=>{f.push([e,t])})}),f.forEach(([e,t])=>{((e,t)=>{let n=h.shared.find(t=>t.sharedName===e);if(!n)return;let{treeShaking:i}=t;if(!i)return;let{secondarySharedTreeShakingName:a,secondarySharedTreeShakingEntry:s,treeShakingStatus:p}=n;i.status!==p&&(i.status=p,s&&l&&a&&(i.get=async()=>{let e=await (0,o.getRemoteEntry)({origin:u,remoteInfo:{name:a,entry:s,type:l,entryGlobalName:a,shareScope:"default"}});return await e.init(u,r.federation.bundlerRuntime),e.get()}))})(e,t)})),t}}),n.init(t)}},38593(e,t){t.initContainerEntry=function(e){let{webpackRequire:t,shareScope:r,initScope:n,shareScopeKey:o,remoteEntryInitOptions:i}=e;if(!t.S||!t.federation||!t.federation.instance||!t.federation.initOptions)return;let a=t.federation.instance;a.initOptions({name:t.federation.initOptions.name,remotes:[],...i});let s=i?.shareScopeKeys,l=i?.shareScopeMap;if(o&&"string"!=typeof o)o.forEach(e=>{if(!s||!l)return void a.initShareScopeMap(e,r,{hostShareScopeMap:i?.shareScopeMap||{}});l[e]||(l[e]={});let t=l[e];a.initShareScopeMap(e,t,{hostShareScopeMap:i?.shareScopeMap||{}})});else{let e=o||"default";Array.isArray(s)?s.forEach(e=>{l[e]||(l[e]={});let t=l[e];a.initShareScopeMap(e,t,{hostShareScopeMap:i?.shareScopeMap||{}})}):a.initShareScopeMap(e,r,{hostShareScopeMap:i?.shareScopeMap||{}})}return(t.federation.attachShareScopeMap&&t.federation.attachShareScopeMap(t),Array.isArray(o))?t.federation.initOptions.shared?t.I(o,n):Promise.all(o.map(e=>t.I(e,n))).then(()=>!0):t.I(o||"default",n)}},32614(e,t,r){let n=r(3026),o=r(59592);t.initializeSharing=function({shareScopeName:e,webpackRequire:t,initPromises:r,initTokens:i,initScope:a}){let s=Array.isArray(e)?e:[e];var l=[],u=function(s){a||(a=[]);let l=t.federation.instance;var u=i[s];if(u||(u=i[s]={from:l.name}),a.indexOf(u)>=0)return;a.push(u);let p=r[s];if(p)return p;var c=r=>{var n=e=>{let t;return t="Initialization of sharing external failed: "+e,"u">typeof console&&console.warn&&console.warn(t)};try{var o=t(r);if(!o)return;var i=r=>r&&r.init&&r.init(t.S[s],a,{shareScopeMap:t.S||{},shareScopeKeys:e});if(o.then)return d.push(o.then(i,n));var l=i(o);if(l&&"boolean"!=typeof l&&l.then)return d.push(l.catch(n))}catch(e){n(e)}};let d=l.initializeSharing(s,{strategy:l.options.shareStrategy,initScope:a,from:"build"});n.attachShareScopeMap(t);let f=t.federation.bundlerRuntimeOptions.remotes;return(f&&Object.keys(f.idToRemoteMap).forEach(e=>{let t=f.idToRemoteMap[e],r=f.idToExternalAndNameMapping[e][2];if(t.length>1)c(r);else if(1===t.length){let e=t[0];o.FEDERATION_SUPPORTED_TYPES.includes(e.externalType)||c(r)}}),d.length)?r[s]=Promise.all(d).then(()=>r[s]=!0):r[s]=!0};return s.forEach(e=>{l.push(u(e))}),Promise.all(l).then(()=>!0)}},8066(e,t,r){let n=r(39671),o=r(69864);t.installInitialConsumes=function(e){n.updateConsumeOptions(e);let{moduleToHandlerMapping:t,webpackRequire:r,installedModules:i,initialConsumes:a,asyncLoad:s}=e,l=[];a.forEach(e=>{l.push([e,()=>(function(e){let{moduleId:t,moduleToHandlerMapping:r,webpackRequire:n,asyncLoad:i}=e,a=n.federation.instance;if(!a)throw Error("Federation instance not found!");let{shareKey:s,shareInfo:l}=r[t];try{let e=o.getUsedExports(n,s),t={...l};if(e&&(t.treeShaking={usedExports:e,useIn:[a.options.name]}),i)return a.loadShare(s,{customShareInfo:t});return a.loadShareSync(s,{customShareInfo:t})}catch(e){throw console.error('loadShareSync failed! The function should not be called unless you set "eager:true". If you do not set it, and encounter this issue, you can check whether an async boundary is implemented.'),console.error("The original error message is as follows: "),e}})({moduleId:e,moduleToHandlerMapping:t,webpackRequire:r,asyncLoad:s})])});let u=(e,n)=>{r.m[e]=o=>{i[e]=0,delete r.c[e];let a=n();if("function"!=typeof a)throw Error(`Shared module is not available for eager consumption: ${e}`);let s=a(),{shareInfo:l}=t[e];if(l?.shareConfig?.layer&&s&&"object"==typeof s)try{s.hasOwnProperty("layer")&&void 0!==s.layer||(s.layer=l.shareConfig.layer)}catch(e){}o.exports=s}};if(s)return Promise.all(l.map(async([e,t])=>{let r=await t();u(e,()=>r)}));l.forEach(([e,t])=>{u(e,t)})}},95313(e,t,r){r(41326);let n=r(3026),o=r(59592),i=r(39671),a=r(31853);t.remotes=function(e){i.updateRemoteOptions(e);let{chunkId:t,promises:r,webpackRequire:s,chunkMapping:l,idToExternalAndNameMapping:u,idToRemoteMap:p}=e;n.attachShareScopeMap(s),s.o(l,t)&&l[t].forEach(e=>{let t=s.R;t||(t=[]);let n=u[e],i=p[e]||[];if(t.indexOf(n)>=0)return;if(t.push(n),n.p)return r.push(n.p);let l=t=>{t||(t=Error("Container missing")),"string"==typeof t.message&&(t.message+=`
|
|
3
|
-
while loading "${n[1]}" from ${n[2]}`),s.m[e]=()=>{throw t},n.p=0},c=(e,t,o,i,a,s)=>{try{let u=e(t,o);if(!u||!u.then)return a(u,i,s);{let e=u.then(e=>a(e,i),l);if(!s)return e;r.push(n.p=e)}}catch(e){l(e)}};var d=(e,r,o)=>c(r.get,n[1],t,0,f,o),f=t=>{n.p=1,s.m[e]=e=>{e.exports=t()}};1===i.length&&o.FEDERATION_SUPPORTED_TYPES.includes(i[0].externalType)&&i[0].name?c(()=>{try{let e=(0,a.decodeName)(i[0].name,a.ENCODE_NAME_PREFIX)+n[1].slice(1),t=s.federation.instance,r=()=>s.federation.instance.loadRemote(e,{loadFactory:!1,from:"build"});if("version-first"===t.options.shareStrategy){let e=Array.isArray(n[0])?n[0]:[n[0]];return Promise.all(e.map(e=>t.sharedHandler.initializeSharing(e))).then(()=>r())}return r()}catch(e){l(e)}},n[2],0,0,f,1):c(s,n[2],0,0,(e,t,r)=>e?c(s.I,n[0],0,e,d,r):l(),1)})}},39671(e,t){t.updateConsumeOptions=function(e){let{webpackRequire:t,moduleToHandlerMapping:r}=e,{consumesLoadingData:n,initializeSharingData:o}=t,{sharedFallback:i,bundlerRuntime:a,libraryType:s}=t.federation;if(n&&!n._updated){let{moduleIdToConsumeDataMapping:o={},initialConsumes:l=[],chunkMapping:u={}}=n;if(Object.entries(o).forEach(([e,n])=>{r[e]||(r[e]={getter:i?a?.getSharedFallbackGetter({shareKey:n.shareKey,factory:n.fallback,webpackRequire:t,libraryType:s}):n.fallback,treeShakingGetter:i?n.fallback:void 0,shareInfo:{shareConfig:{requiredVersion:n.requiredVersion,strictVersion:n.strictVersion,singleton:n.singleton,eager:n.eager,layer:n.layer},scope:Array.isArray(n.shareScope)?n.shareScope:[n.shareScope||"default"],treeShaking:i?{get:n.fallback,mode:n.treeShakingMode}:void 0},shareKey:n.shareKey})}),"initialConsumes"in e){let{initialConsumes:t=[]}=e;l.forEach(e=>{t.includes(e)||t.push(e)})}if("chunkMapping"in e){let{chunkMapping:t={}}=e;Object.entries(u).forEach(([e,r])=>{t[e]||(t[e]=[]),r.forEach(r=>{t[e].includes(r)||t[e].push(r)})})}n._updated=1}if(o&&!o._updated){let{federation:e}=t;if(!e.instance||!o.scopeToSharingDataMapping)return;let r={};for(let[e,t]of Object.entries(o.scopeToSharingDataMapping))for(let n of t)if("object"==typeof n&&null!==n){let{name:t,version:o,factory:i,eager:a,singleton:s,requiredVersion:l,strictVersion:u}=n,p={requiredVersion:`^${o}`},c=function(e){return void 0!==e};c(s)&&(p.singleton=s),c(l)&&(p.requiredVersion=l),c(a)&&(p.eager=a),c(u)&&(p.strictVersion=u);let d={version:o,scope:[e],shareConfig:p,get:i};r[t]?r[t].push(d):r[t]=[d]}e.instance.registerShared(r),o._updated=1}},t.updateRemoteOptions=function(e){let{webpackRequire:t,idToExternalAndNameMapping:r={},idToRemoteMap:n={},chunkMapping:o={}}=e,{remotesLoadingData:i}=t,a=t.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;if(!i||i._updated||!a)return;let{chunkMapping:s,moduleIdToRemoteDataMapping:l}=i;if(s&&l){for(let[e,t]of Object.entries(l))if(r[e]||(r[e]=[t.shareScope,t.name,t.externalModuleId]),!n[e]&&a[t.remoteName]){let r=a[t.remoteName];n[e]||=[],r.forEach(t=>{n[e].includes(t)||n[e].push(t)})}o&&Object.entries(s).forEach(([e,t])=>{o[e]||(o[e]=[]),t.forEach(t=>{o[e].includes(t)||o[e].push(t)})}),i._updated=1}}}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={id:e,loaded:!1,exports:{}};return i[e].call(r.exports,r,r.exports,s),r.loaded=!0,r.exports}s.m=i,s.c=a,s.x=()=>s(22448),s.federation||(s.federation={chunkMatcher:function(e){return!/^(6[36]92|2020|4123|5861|7674)$/.test(e)},rootOutputDir:""}),s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},u=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);s.r(r);var n={};l=l||[null,u({}),u([]),u(u)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~l.indexOf(o);o=u(o))Object.getOwnPropertyNames(o).forEach(t=>{n[t]=()=>e[t]});return n.default=()=>e,s.d(r,n),r},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".js",s.miniCssF=e=>""+e+".css",s.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},s.l=function(e,t,r,n){if(p[e])return void p[e].push(t);if(void 0!==r)for(var o,i,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var u=a[l];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@openmrs/esm-form-builder-app:"+r){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","@openmrs/esm-form-builder-app:"+r),o.src=e),p[e]=[t];var c=function(t,r){o.onerror=o.onload=null,clearTimeout(d);var n=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},d=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s.rv=()=>"1.7.9",s.S={},s.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"@carbon/react",version:"1.92.1",factory:()=>Promise.all([s.e("3238"),s.e("9314"),s.e("8668"),s.e("1617"),s.e("1481"),s.e("123"),s.e("3877"),s.e("4511"),s.e("6392"),s.e("6692")]).then(()=>()=>s(78930)),eager:0,singleton:1,requiredVersion:"1.x",strictVersion:0},{name:"@openmrs/esm-framework",version:"10.0.1-pre.5753",factory:()=>Promise.all([s.e("3238"),s.e("8668"),s.e("3877"),s.e("5699"),s.e("1850"),s.e("6392"),s.e("4123"),s.e("6692"),s.e("2020"),s.e("5861"),s.e("7674")]).then(()=>()=>s(30465)),eager:0,singleton:1,requiredVersion:"10.x",strictVersion:0},{name:"react-dom",version:"18.3.1",factory:()=>Promise.all([s.e("5098"),s.e("6392")]).then(()=>()=>s(40961)),eager:0,singleton:1,requiredVersion:"18.x",strictVersion:0},{name:"react-i18next",version:"16.0.0",factory:()=>Promise.all([s.e("3379"),s.e("6392")]).then(()=>()=>s(30673)),eager:0,singleton:1,requiredVersion:"16.x",strictVersion:0},{name:"react",version:"18.3.1",factory:()=>s.e("6237").then(()=>()=>s(96540)),eager:0,singleton:1,requiredVersion:"18.x",strictVersion:0},{name:"rxjs",version:"6.6.7",factory:()=>s.e("2997").then(()=>()=>s(75908)),eager:0,singleton:1,requiredVersion:"6.x",strictVersion:0},{name:"swr/_internal",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("6392")]).then(()=>()=>s(14993)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0},{name:"swr/immutable",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6392"),s.e("5898")]).then(()=>()=>s(54225)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0},{name:"swr/infinite",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6392"),s.e("1578")]).then(()=>()=>s(23041)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0},{name:"swr",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6392"),s.e("8410")]).then(()=>()=>s(92177)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0}]},uniqueName:"@openmrs/esm-form-builder-app"},s.I=s.I||function(){throw Error("should have __webpack_require__.I")},s.g.importScripts&&(c=s.g.location+"");var l,u,p,c,d=s.g.document;if(!c&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(c=d.currentScript.src),!c)){var f=d.getElementsByTagName("script");if(f.length)for(var h=f.length-1;h>-1&&(!c||!/^http(s?):/.test(c));)c=f[h--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");if(s.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.consumesLoadingData={chunkMapping:{5543:["76922"],2020:["73391"],6692:["54575"],5861:["66148"],3378:["46718"],4123:["58779","14968"],6392:["47499"],7674:["25952","12786"]},moduleIdToConsumeDataMapping:{25952:{shareScope:"default",shareKey:"swr/_internal",import:"swr/_internal",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("6362").then(()=>()=>s(14993))},46718:{shareScope:"default",shareKey:"@openmrs/esm-framework",import:"@openmrs/esm-framework",requiredVersion:"10.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("3238"),s.e("8668"),s.e("3877"),s.e("5699"),s.e("1850"),s.e("6392"),s.e("4123"),s.e("6692"),s.e("2020"),s.e("5861"),s.e("7674")]).then(()=>()=>s(30465))},54575:{shareScope:"default",shareKey:"react-dom",import:"react-dom",requiredVersion:"18.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("5098").then(()=>()=>s(40961))},14968:{shareScope:"default",shareKey:"@carbon/react",import:"@carbon/react",requiredVersion:"1.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("3238"),s.e("9314"),s.e("8668"),s.e("1617"),s.e("1481"),s.e("123"),s.e("3877"),s.e("4511"),s.e("6692")]).then(()=>()=>s(78930))},66148:{shareScope:"default",shareKey:"swr/immutable",import:"swr/immutable",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("3517")]).then(()=>()=>s(54225))},58779:{shareScope:"default",shareKey:"react-i18next",import:"react-i18next",requiredVersion:"16.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("3379").then(()=>()=>s(30673))},47499:{shareScope:"default",shareKey:"react",import:"react",requiredVersion:"18.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("6237").then(()=>()=>s(96540))},76922:{shareScope:"default",shareKey:"rxjs",import:"rxjs",requiredVersion:"6.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("2997").then(()=>()=>s(75908))},73391:{shareScope:"default",shareKey:"swr",import:"swr",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6029")]).then(()=>()=>s(92177))},12786:{shareScope:"default",shareKey:"swr/infinite",import:"swr/infinite",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("9197")]).then(()=>()=>s(23041))}},initialConsumes:[]},s.f.consumes=s.f.consumes||function(){throw Error("should have __webpack_require__.f.consumes")},"u">typeof document){var m=function(e,t,r,n,o){var i=document.createElement("link");return i.rel="stylesheet",i.type="text/css",s.nc&&(i.nonce=s.nc),i.href=t,i.onerror=i.onload=function(r){if(i.onerror=i.onload=null,"load"===r.type)n();else{var a=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.href||t,l=Error("Loading CSS chunk "+e+" failed.\\n("+s+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=a,l.request=s,i.parentNode&&i.parentNode.removeChild(i),o(l)}},r?r.parentNode.insertBefore(i,r.nextSibling):document.head.appendChild(i),i},g=function(e,t){for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=r[n],i=o.getAttribute("data-href")||o.getAttribute("href");if(i&&(i=i.split("?")[0]),"stylesheet"===o.rel&&(i===e||i===t))return o}for(var a=document.getElementsByTagName("style"),n=0;n<a.length;n++){var o=a[n],i=o.getAttribute("data-href");if(i===e||i===t)return o}},b={8255:0};s.f.miniCss=function(e,t){if(b[e])t.push(b[e]);else 0!==b[e]&&({1515:1,1850:1,4442:1,5543:1,7247:1,9103:1})[e]&&t.push(b[e]=new Promise(function(t,r){var n=s.miniCssF(e),o=s.p+n;if(g(n,o))return t();m(e,o,null,t,r)}).then(function(){b[e]=0},function(t){throw delete b[e],t}))}}s.initializeExposesData={moduleMap:{"./start":()=>s.e("3378").then(()=>()=>s(47481))},shareScope:"default"},s.getContainer=s.getContainer||function(){throw Error("should have __webpack_require__.getContainer")},s.initContainer=s.initContainer||function(){throw Error("should have __webpack_require__.initContainer")},e={8255:0},s.f.j=function(t,r){var n=s.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else if(/^(6[36]92|2020|4123|5861|7674)$/.test(t))e[t]=0;else{var o=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=o);var i=s.p+s.u(t),a=Error();s.l(i,function(r){if(s.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}},"chunk-"+t,t)}},t=(t,r)=>{var n,o,[i,a,l]=r,u=0;if(i.some(t=>0!==e[t])){for(n in a)s.o(a,n)&&(s.m[n]=a[n]);l&&l(s)}for(t&&t(r);u<i.length;u++)o=i[u],s.o(e,o)&&e[o]&&e[o][0](),e[o]=0},(r=globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r)),s.ruid="bundler=rspack@1.7.9",n=s.x,o=!1,s.x=function(){if(o||(o=!0,s(89672)),"function"==typeof n)return n();console.warn("[MF] Invalid prevStartup")},_openmrs_esm_form_builder_app=s.x()})();
|
|
3
|
+
while loading "${n[1]}" from ${n[2]}`),s.m[e]=()=>{throw t},n.p=0},c=(e,t,o,i,a,s)=>{try{let u=e(t,o);if(!u||!u.then)return a(u,i,s);{let e=u.then(e=>a(e,i),l);if(!s)return e;r.push(n.p=e)}}catch(e){l(e)}};var d=(e,r,o)=>c(r.get,n[1],t,0,f,o),f=t=>{n.p=1,s.m[e]=e=>{e.exports=t()}};1===i.length&&o.FEDERATION_SUPPORTED_TYPES.includes(i[0].externalType)&&i[0].name?c(()=>{try{let e=(0,a.decodeName)(i[0].name,a.ENCODE_NAME_PREFIX)+n[1].slice(1),t=s.federation.instance,r=()=>s.federation.instance.loadRemote(e,{loadFactory:!1,from:"build"});if("version-first"===t.options.shareStrategy){let e=Array.isArray(n[0])?n[0]:[n[0]];return Promise.all(e.map(e=>t.sharedHandler.initializeSharing(e))).then(()=>r())}return r()}catch(e){l(e)}},n[2],0,0,f,1):c(s,n[2],0,0,(e,t,r)=>e?c(s.I,n[0],0,e,d,r):l(),1)})}},39671(e,t){t.updateConsumeOptions=function(e){let{webpackRequire:t,moduleToHandlerMapping:r}=e,{consumesLoadingData:n,initializeSharingData:o}=t,{sharedFallback:i,bundlerRuntime:a,libraryType:s}=t.federation;if(n&&!n._updated){let{moduleIdToConsumeDataMapping:o={},initialConsumes:l=[],chunkMapping:u={}}=n;if(Object.entries(o).forEach(([e,n])=>{r[e]||(r[e]={getter:i?a?.getSharedFallbackGetter({shareKey:n.shareKey,factory:n.fallback,webpackRequire:t,libraryType:s}):n.fallback,treeShakingGetter:i?n.fallback:void 0,shareInfo:{shareConfig:{requiredVersion:n.requiredVersion,strictVersion:n.strictVersion,singleton:n.singleton,eager:n.eager,layer:n.layer},scope:Array.isArray(n.shareScope)?n.shareScope:[n.shareScope||"default"],treeShaking:i?{get:n.fallback,mode:n.treeShakingMode}:void 0},shareKey:n.shareKey})}),"initialConsumes"in e){let{initialConsumes:t=[]}=e;l.forEach(e=>{t.includes(e)||t.push(e)})}if("chunkMapping"in e){let{chunkMapping:t={}}=e;Object.entries(u).forEach(([e,r])=>{t[e]||(t[e]=[]),r.forEach(r=>{t[e].includes(r)||t[e].push(r)})})}n._updated=1}if(o&&!o._updated){let{federation:e}=t;if(!e.instance||!o.scopeToSharingDataMapping)return;let r={};for(let[e,t]of Object.entries(o.scopeToSharingDataMapping))for(let n of t)if("object"==typeof n&&null!==n){let{name:t,version:o,factory:i,eager:a,singleton:s,requiredVersion:l,strictVersion:u}=n,p={requiredVersion:`^${o}`},c=function(e){return void 0!==e};c(s)&&(p.singleton=s),c(l)&&(p.requiredVersion=l),c(a)&&(p.eager=a),c(u)&&(p.strictVersion=u);let d={version:o,scope:[e],shareConfig:p,get:i};r[t]?r[t].push(d):r[t]=[d]}e.instance.registerShared(r),o._updated=1}},t.updateRemoteOptions=function(e){let{webpackRequire:t,idToExternalAndNameMapping:r={},idToRemoteMap:n={},chunkMapping:o={}}=e,{remotesLoadingData:i}=t,a=t.federation?.bundlerRuntimeOptions?.remotes?.remoteInfos;if(!i||i._updated||!a)return;let{chunkMapping:s,moduleIdToRemoteDataMapping:l}=i;if(s&&l){for(let[e,t]of Object.entries(l))if(r[e]||(r[e]=[t.shareScope,t.name,t.externalModuleId]),!n[e]&&a[t.remoteName]){let r=a[t.remoteName];n[e]||=[],r.forEach(t=>{n[e].includes(t)||n[e].push(t)})}o&&Object.entries(s).forEach(([e,t])=>{o[e]||(o[e]=[]),t.forEach(t=>{o[e].includes(t)||o[e].push(t)})}),i._updated=1}}}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={id:e,loaded:!1,exports:{}};return i[e].call(r.exports,r,r.exports,s),r.loaded=!0,r.exports}s.m=i,s.c=a,s.x=()=>s(22448),s.federation||(s.federation={chunkMatcher:function(e){return!/^(6[36]92|2020|4123|5861|7674)$/.test(e)},rootOutputDir:""}),s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},u=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,t){if(1&t&&(e=this(e)),8&t||"object"==typeof e&&e&&(4&t&&e.__esModule||16&t&&"function"==typeof e.then))return e;var r=Object.create(null);s.r(r);var n={};l=l||[null,u({}),u([]),u(u)];for(var o=2&t&&e;("object"==typeof o||"function"==typeof o)&&!~l.indexOf(o);o=u(o))Object.getOwnPropertyNames(o).forEach(t=>{n[t]=()=>e[t]});return n.default=()=>e,s.d(r,n),r},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".js",s.miniCssF=e=>""+e+".css",s.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},s.l=function(e,t,r,n){if(p[e])return void p[e].push(t);if(void 0!==r)for(var o,i,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var u=a[l];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@openmrs/esm-form-builder-app:"+r){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","@openmrs/esm-form-builder-app:"+r),o.src=e),p[e]=[t];var c=function(t,r){o.onerror=o.onload=null,clearTimeout(d);var n=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(r)},d=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s.rv=()=>"1.7.9",s.S={},s.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"@carbon/react",version:"1.92.1",factory:()=>Promise.all([s.e("3238"),s.e("9314"),s.e("8668"),s.e("1617"),s.e("1481"),s.e("123"),s.e("3877"),s.e("4511"),s.e("6392"),s.e("6692")]).then(()=>()=>s(78930)),eager:0,singleton:1,requiredVersion:"1.x",strictVersion:0},{name:"@openmrs/esm-framework",version:"10.0.1-pre.5753",factory:()=>Promise.all([s.e("3238"),s.e("8668"),s.e("3877"),s.e("5699"),s.e("1850"),s.e("6392"),s.e("4123"),s.e("6692"),s.e("2020"),s.e("5861"),s.e("7674")]).then(()=>()=>s(30465)),eager:0,singleton:1,requiredVersion:"11.x",strictVersion:0},{name:"react-dom",version:"18.3.1",factory:()=>Promise.all([s.e("5098"),s.e("6392")]).then(()=>()=>s(40961)),eager:0,singleton:1,requiredVersion:"18.x",strictVersion:0},{name:"react-i18next",version:"16.0.0",factory:()=>Promise.all([s.e("3379"),s.e("6392")]).then(()=>()=>s(30673)),eager:0,singleton:1,requiredVersion:"16.x",strictVersion:0},{name:"react",version:"18.3.1",factory:()=>s.e("6237").then(()=>()=>s(96540)),eager:0,singleton:1,requiredVersion:"18.x",strictVersion:0},{name:"rxjs",version:"6.6.7",factory:()=>s.e("2997").then(()=>()=>s(75908)),eager:0,singleton:1,requiredVersion:"6.x",strictVersion:0},{name:"swr/_internal",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("6392")]).then(()=>()=>s(14993)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0},{name:"swr/immutable",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6392"),s.e("5898")]).then(()=>()=>s(54225)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0},{name:"swr/infinite",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6392"),s.e("1578")]).then(()=>()=>s(23041)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0},{name:"swr",version:"2.5.1",factory:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6392"),s.e("8410")]).then(()=>()=>s(92177)),eager:0,singleton:1,requiredVersion:"2.x",strictVersion:0}]},uniqueName:"@openmrs/esm-form-builder-app"},s.I=s.I||function(){throw Error("should have __webpack_require__.I")},s.g.importScripts&&(c=s.g.location+"");var l,u,p,c,d=s.g.document;if(!c&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(c=d.currentScript.src),!c)){var f=d.getElementsByTagName("script");if(f.length)for(var h=f.length-1;h>-1&&(!c||!/^http(s?):/.test(c));)c=f[h--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");if(s.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.consumesLoadingData={chunkMapping:{5543:["76922"],2020:["73391"],6692:["54575"],5861:["66148"],3378:["23365"],4123:["58779","14968"],6392:["47499"],7674:["25952","12786"]},moduleIdToConsumeDataMapping:{25952:{shareScope:"default",shareKey:"swr/_internal",import:"swr/_internal",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("6362").then(()=>()=>s(14993))},12786:{shareScope:"default",shareKey:"swr/infinite",import:"swr/infinite",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("9197")]).then(()=>()=>s(23041))},54575:{shareScope:"default",shareKey:"react-dom",import:"react-dom",requiredVersion:"18.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("5098").then(()=>()=>s(40961))},14968:{shareScope:"default",shareKey:"@carbon/react",import:"@carbon/react",requiredVersion:"1.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("3238"),s.e("9314"),s.e("8668"),s.e("1617"),s.e("1481"),s.e("123"),s.e("3877"),s.e("4511"),s.e("6692")]).then(()=>()=>s(78930))},66148:{shareScope:"default",shareKey:"swr/immutable",import:"swr/immutable",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("3517")]).then(()=>()=>s(54225))},58779:{shareScope:"default",shareKey:"react-i18next",import:"react-i18next",requiredVersion:"16.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("3379").then(()=>()=>s(30673))},47499:{shareScope:"default",shareKey:"react",import:"react",requiredVersion:"18.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("6237").then(()=>()=>s(96540))},23365:{shareScope:"default",shareKey:"@openmrs/esm-framework",import:"@openmrs/esm-framework",requiredVersion:"11.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("3238"),s.e("8668"),s.e("3877"),s.e("5699"),s.e("1850"),s.e("6392"),s.e("4123"),s.e("6692"),s.e("2020"),s.e("5861"),s.e("7674")]).then(()=>()=>s(30465))},73391:{shareScope:"default",shareKey:"swr",import:"swr",requiredVersion:"2.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([s.e("6362"),s.e("7977"),s.e("6029")]).then(()=>()=>s(92177))},76922:{shareScope:"default",shareKey:"rxjs",import:"rxjs",requiredVersion:"6.x",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>s.e("2997").then(()=>()=>s(75908))}},initialConsumes:[]},s.f.consumes=s.f.consumes||function(){throw Error("should have __webpack_require__.f.consumes")},"u">typeof document){var m=function(e,t,r,n,o){var i=document.createElement("link");return i.rel="stylesheet",i.type="text/css",s.nc&&(i.nonce=s.nc),i.href=t,i.onerror=i.onload=function(r){if(i.onerror=i.onload=null,"load"===r.type)n();else{var a=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.href||t,l=Error("Loading CSS chunk "+e+" failed.\\n("+s+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=a,l.request=s,i.parentNode&&i.parentNode.removeChild(i),o(l)}},r?r.parentNode.insertBefore(i,r.nextSibling):document.head.appendChild(i),i},g=function(e,t){for(var r=document.getElementsByTagName("link"),n=0;n<r.length;n++){var o=r[n],i=o.getAttribute("data-href")||o.getAttribute("href");if(i&&(i=i.split("?")[0]),"stylesheet"===o.rel&&(i===e||i===t))return o}for(var a=document.getElementsByTagName("style"),n=0;n<a.length;n++){var o=a[n],i=o.getAttribute("data-href");if(i===e||i===t)return o}},b={8255:0};s.f.miniCss=function(e,t){if(b[e])t.push(b[e]);else 0!==b[e]&&({1515:1,1850:1,4442:1,5543:1,7247:1,9103:1})[e]&&t.push(b[e]=new Promise(function(t,r){var n=s.miniCssF(e),o=s.p+n;if(g(n,o))return t();m(e,o,null,t,r)}).then(function(){b[e]=0},function(t){throw delete b[e],t}))}}s.initializeExposesData={moduleMap:{"./start":()=>s.e("3378").then(()=>()=>s(47481))},shareScope:"default"},s.getContainer=s.getContainer||function(){throw Error("should have __webpack_require__.getContainer")},s.initContainer=s.initContainer||function(){throw Error("should have __webpack_require__.initContainer")},e={8255:0},s.f.j=function(t,r){var n=s.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else if(/^(6[36]92|2020|4123|5861|7674)$/.test(t))e[t]=0;else{var o=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=o);var i=s.p+s.u(t),a=Error();s.l(i,function(r){if(s.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",a.name="ChunkLoadError",a.type=o,a.request=i,n[1](a)}},"chunk-"+t,t)}},t=(t,r)=>{var n,o,[i,a,l]=r,u=0;if(i.some(t=>0!==e[t])){for(n in a)s.o(a,n)&&(s.m[n]=a[n]);l&&l(s)}for(t&&t(r);u<i.length;u++)o=i[u],s.o(e,o)&&e[o]&&e[o][0](),e[o]=0},(r=globalThis.webpackChunk_openmrs_esm_form_builder_app=globalThis.webpackChunk_openmrs_esm_form_builder_app||[]).forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r)),s.ruid="bundler=rspack@1.7.9",n=s.x,o=!1,s.x=function(){if(o||(o=!0,s(89672)),"function"==typeof n)return n();console.warn("[MF] Invalid prevStartup")},_openmrs_esm_form_builder_app=s.x()})();
|